summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhobbs <hobbs>2000-04-17 06:26:05 (GMT)
committerhobbs <hobbs>2000-04-17 06:26:05 (GMT)
commitb584610b72b25d8a9235118fb0e15fc6f17e630a (patch)
tree2f04214808752b13ec158ee44b1da727d5a886d4
parent76b8c4a413bbc3536c1d134f0a03193a8969b15b (diff)
downloadtk-b584610b72b25d8a9235118fb0e15fc6f17e630a.zip
tk-b584610b72b25d8a9235118fb0e15fc6f17e630a.tar.gz
tk-b584610b72b25d8a9235118fb0e15fc6f17e630a.tar.bz2
* win/tkWinColor.c (FindSystemColor): correct calculation of
colors when shifting value. [Bug: 4919]
-rw-r--r--ChangeLog41
-rw-r--r--win/tkWinColor.c29
2 files changed, 39 insertions, 31 deletions
diff --git a/ChangeLog b/ChangeLog
index bc75556..93201ef 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,22 +1,29 @@
+2000-04-16 Jeff Hobbs <hobbs@scriptics.com>
+
+ * win/tkWinColor.c (FindSystemColor): correct calculation of
+ colors when shifting value. [Bug: 4919]
+
2000-04-16 Jim Ingham <jingham@cygnus.com>
- * mac/tkMacPort.h: protect against strncasecmp already defined - it is in
- the Pro5 version of MSL.
-
- * mac/tkMacWindowMgr.c (GenerateKeyEvent): Check for a null tkWin. If the
- hidden window we use for double-buffering controls manages to percolate to
- the top (should never happen, but...) this will keep us from crashing.
-
- * mac/tkMacButton.c (InitSampleControls): Hide the double-buffering window
- BEHIND the first "." window you can find. This will keep it from ever being
- the front window, and thus a black hole for events.
- * mac/tkMacButton.c (ButtonEventProc): Disable the controls when the window is
- in the background. This is required by the MacOS HIG. This doesn't always get
- called when it should, it still needs more work.
-
- * mac/tkMacDialog.c: Pretty substantial rewrite to include Navigation Services
- support for systems which have it.
-
+ * mac/tkMacPort.h: protect against strncasecmp already defined -
+ it is in the Pro5 version of MSL.
+
+ * mac/tkMacWindowMgr.c (GenerateKeyEvent): Check for a null tkWin.
+ If the hidden window we use for double-buffering controls manages
+ to percolate to the top (should never happen, but...) this will
+ keep us from crashing.
+
+ * mac/tkMacButton.c (InitSampleControls): Hide the
+ double-buffering window BEHIND the first "." window you can find.
+ This will keep it from ever being the front window, and thus a
+ black hole for events. * mac/tkMacButton.c (ButtonEventProc):
+ Disable the controls when the window is in the background. This
+ is required by the MacOS HIG. This doesn't always get called when
+ it should, it still needs more work.
+
+ * mac/tkMacDialog.c: Pretty substantial rewrite to include
+ Navigation Services support for systems which have it.
+
2000-04-14 Eric Melski <ericm@scriptics.com>
* win/tkWinKey.c: Added check for ASCII delete character in
diff --git a/win/tkWinColor.c b/win/tkWinColor.c
index 91a482b..d3d8caf 100644
--- a/win/tkWinColor.c
+++ b/win/tkWinColor.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWinColor.c,v 1.4 2000/03/02 23:52:36 hobbs Exp $
+ * RCS: @(#) $Id: tkWinColor.c,v 1.5 2000/04/17 06:26:09 hobbs Exp $
*/
#include "tkWinInt.h"
@@ -156,9 +156,13 @@ FindSystemColor(name, colorPtr, indexPtr)
*indexPtr = sysColors[i].index;
colorPtr->pixel = GetSysColor(sysColors[i].index);
- colorPtr->red = GetRValue(colorPtr->pixel) << 8;
- colorPtr->green = GetGValue(colorPtr->pixel) << 8;
- colorPtr->blue = GetBValue(colorPtr->pixel) << 8;
+ /*
+ * x257 is (value<<8 + value) to get the properly bit shifted
+ * and padded value. [Bug: 4919]
+ */
+ colorPtr->red = GetRValue(colorPtr->pixel) * 257;
+ colorPtr->green = GetGValue(colorPtr->pixel) * 257;
+ colorPtr->blue = GetBValue(colorPtr->pixel) * 257;
colorPtr->flags = DoRed|DoGreen|DoBlue;
colorPtr->pad = 0;
return 1;
@@ -338,7 +342,7 @@ XAllocColor(display, colormap, color)
TkWinColormap *cmap = (TkWinColormap *) colormap;
PALETTEENTRY entry, closeEntry;
HDC dc = GetDC(NULL);
-
+
entry.peRed = (color->red) >> 8;
entry.peGreen = (color->green) >> 8;
entry.peBlue = (color->blue) >> 8;
@@ -373,9 +377,9 @@ XAllocColor(display, colormap, color)
if ((index >= cmap->size) || (newPixel != closePixel)) {
if (cmap->size == sizePalette) {
- color->red = (closeEntry.peRed << 8) | closeEntry.peRed;
- color->green = (closeEntry.peGreen << 8) | closeEntry.peGreen;
- color->blue = (closeEntry.peBlue << 8) | closeEntry.peBlue;
+ color->red = closeEntry.peRed * 257;
+ color->green = closeEntry.peGreen * 257;
+ color->blue = closeEntry.peBlue * 257;
entry = closeEntry;
if (index >= cmap->size) {
OutputDebugString("XAllocColor: Colormap is bigger than we thought");
@@ -404,12 +408,9 @@ XAllocColor(display, colormap, color)
color->pixel = GetNearestColor(dc,
RGB(entry.peRed, entry.peGreen, entry.peBlue));
- color->red = GetRValue(color->pixel);
- color->red |= (color->red << 8);
- color->green = GetGValue(color->pixel);
- color->green |= (color->green << 8);
- color->blue = GetBValue(color->pixel);
- color->blue |= (color->blue << 8);
+ color->red = GetRValue(color->pixel) * 257;
+ color->green = GetGValue(color->pixel) * 257;
+ color->blue = GetBValue(color->pixel) * 257;
}
ReleaseDC(NULL, dc);