[PATCH] setup: fix text background in chooser

Igor Pechtchanski pechtcha@cs.nyu.edu
Thu Sep 8 03:31:00 GMT 2005


On Wed, 7 Sep 2005, Eric Blake wrote:

> > I have updated the Cygwin setup utility to version 2.510.2.1.
>
> [snip]
> Minor bugs I have noticed:
> On the file chooser page, all text has a white background rather
> than using the default background selected by the current Windows
> settings, as shown in the attachment.  This was on Win2k, where the
> default background color is chosen by Display properties, Appearance
> tab, Item dropdown, Window.
> [snip]

I was able to reproduce this on WinXP.  The attached patch fixes the issue
for me.  I haven't yet tested on Win2k (will tomorrow).  ChangeLog below.
	Igor
==============================================================================
ChangeLog:
2005-09-07  Igor Pechtchanski  <pechtcha@cs.nyu.edu>

	* PickCategoryLine.cc (PickCategoryLine::paint): Set background mode.
	Use bitwise AND to blit bitmaps.
	* PickPackageLine.cc (PickPackageLine::paint): Ditto.

-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

If there's any real truth it's that the entire multidimensional infinity
of the Universe is almost certainly being run by a bunch of maniacs. /DA
-------------- next part --------------
Index: PickCategoryLine.cc
===================================================================
RCS file: /cvs/cygwin-apps/setup/PickCategoryLine.cc,v
retrieving revision 2.8
diff -u -p -r2.8 PickCategoryLine.cc
--- PickCategoryLine.cc	21 May 2005 23:04:02 -0000	2.8
+++ PickCategoryLine.cc	8 Sep 2005 03:09:57 -0000
@@ -31,6 +31,7 @@ PickCategoryLine::empty (void)
 void
 PickCategoryLine::paint (HDC hdc, HRGN hUpdRgn, int x, int y, int row, int show_cat)
 {
+  int bkMode = SetBkMode(hdc, TRANSPARENT);
   int r = y + row * theView.row_height;
   if (show_label)
     {
@@ -40,7 +41,7 @@ PickCategoryLine::paint (HDC hdc, HRGN h
       // draw the '+' or '-' box
       SelectObject (theView.bitmap_dc, 
                       (collapsed ? theView.bm_treeplus : theView.bm_treeminus));
-      BitBlt (hdc, x2, by, 11, 11, theView.bitmap_dc, 0, 0, SRCCOPY);
+      BitBlt (hdc, x2, by, 11, 11, theView.bitmap_dc, 0, 0, SRCAND);
 
       // draw the category name
       TextOut (hdc, x2 + 11 + ICON_MARGIN, r, cat.first.c_str(), cat.first.size());
@@ -54,7 +55,7 @@ PickCategoryLine::paint (HDC hdc, HRGN h
       // draw the 'spin' glyph
       SelectObject (theView.bitmap_dc, theView.bm_spin);
       spin_x = x2 + 11 + ICON_MARGIN + labellength + ICON_MARGIN;
-      BitBlt (hdc, spin_x, by, 11, 11, theView.bitmap_dc, 0, 0, SRCCOPY);
+      BitBlt (hdc, spin_x, by, 11, 11, theView.bitmap_dc, 0, 0, SRCAND);
       
       // draw the caption ('Default', 'Install', etc)
       TextOut (hdc, spin_x + SPIN_WIDTH + ICON_MARGIN, r, 
@@ -104,6 +105,7 @@ PickCategoryLine::paint (HDC hdc, HRGN h
             SelectClipRgn (hdc, hUpdRgn);
         }
     }
+  SetBkMode(hdc, bkMode);
 }
 
 int
Index: PickPackageLine.cc
===================================================================
RCS file: /cvs/cygwin-apps/setup/PickPackageLine.cc,v
retrieving revision 2.18
diff -u -p -r2.18 PickPackageLine.cc
--- PickPackageLine.cc	1 Sep 2005 15:49:58 -0000	2.18
+++ PickPackageLine.cc	8 Sep 2005 03:09:57 -0000
@@ -22,12 +22,13 @@ void
 PickPackageLine::DrawIcon (HDC hdc, int x, int y, HANDLE hIcon)
 {
   SelectObject (theView.bitmap_dc, hIcon);
-  BitBlt (hdc, x, y, 11, 11, theView.bitmap_dc, 0, 0, SRCCOPY);
+  BitBlt (hdc, x, y, 11, 11, theView.bitmap_dc, 0, 0, SRCAND);
 }
 
 void
 PickPackageLine::paint (HDC hdc, HRGN unused, int x, int y, int col_num, int show_cat)
 {
+  int bkMode = SetBkMode(hdc, TRANSPARENT);
   int rb = y + theView.tm.tmHeight;
   int by = rb - 11; // top of box images
   String s;
@@ -124,6 +125,8 @@ PickPackageLine::paint (HDC hdc, HRGN un
         s += String(": ") + pkg.SDesc ();
       TextOut (hdc, x + HMARGIN / 2, y, s.c_str(), s.size());
     }
+
+  SetBkMode(hdc, bkMode);
 }
 
 int


More information about the Cygwin-apps mailing list