diff options
author | das <das> | 2007-11-09 06:26:53 (GMT) |
---|---|---|
committer | das <das> | 2007-11-09 06:26:53 (GMT) |
commit | b0e3f55fe56f3f1fa4ad3cf7c63dddcfff5a9846 (patch) | |
tree | 40938979466c8caac1c03c907753bc43175304bd /macosx/tkMacOSXColor.c | |
parent | 455d9dc4b8b50ed064729851295535018eb99449 (diff) | |
download | tk-b0e3f55fe56f3f1fa4ad3cf7c63dddcfff5a9846.zip tk-b0e3f55fe56f3f1fa4ad3cf7c63dddcfff5a9846.tar.gz tk-b0e3f55fe56f3f1fa4ad3cf7c63dddcfff5a9846.tar.bz2 |
Backport from HEAD of Aqua changes from 2007-10-12 to 2007-11-09
Diffstat (limited to 'macosx/tkMacOSXColor.c')
-rw-r--r-- | macosx/tkMacOSXColor.c | 42 |
1 files changed, 38 insertions, 4 deletions
diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c index cc2e674..2b6c32b 100644 --- a/macosx/tkMacOSXColor.c +++ b/macosx/tkMacOSXColor.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXColor.c,v 1.2.2.10 2007/07/02 13:06:14 das Exp $ + * RCS: @(#) $Id: tkMacOSXColor.c,v 1.2.2.11 2007/11/09 06:26:55 das Exp $ */ #include "tkMacOSXPrivate.h" @@ -253,9 +253,12 @@ GetThemeColor( } else if (textColor) { err = ChkErr(GetThemeTextColor, textColor, 32, true, c); } else { - c->red = ((pixel >> 16) & 0xff) << 8; - c->green = ((pixel >> 8) & 0xff) << 8; - c->blue = ((pixel ) & 0xff) << 8; + c->red = (pixel >> 16) & 0xff; + c->green = (pixel >> 8) & 0xff; + c->blue = (pixel ) & 0xff; + c->red |= c->red << 8; + c->green |= c->green << 8; + c->blue |= c->blue << 8; } return err; } @@ -638,6 +641,37 @@ TkpGetColorByValue( return tkColPtr; } +#if 0 +/* + *---------------------------------------------------------------------- + * + * TkMacOSXCompareColors -- + * + * On Mac, color codes may specify symbolic values like "highlight + * foreground", but we really need the actual values to compare. + * Maybe see also: "TIP #154: Add Named Colors to Tk". + * + * Results: + * Returns true if both colors are the same, false otherwise. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +int +TkMacOSXCompareColors( + unsigned long c1, + unsigned long c2) +{ + RGBColor col1, col2; + return TkSetMacColor(c1,&col1) && + TkSetMacColor(c1,&col2) && + !memcmp(&col1,&col2,sizeof(col1)); +} +#endif /* !TK_DRAW_IN_CONTEXT */ + /* *---------------------------------------------------------------------- * |