summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXColor.c
diff options
context:
space:
mode:
authordas <das>2007-06-06 09:56:53 (GMT)
committerdas <das>2007-06-06 09:56:53 (GMT)
commitc8e1491e70ce690a6fc19232c32e040ee9af37e0 (patch)
tree0f31e25d4ca595727ac6e0b38a271fa4d9ad77bb /macosx/tkMacOSXColor.c
parent62147152b6098c280030c1e1aede58e9a0292839 (diff)
downloadtk-c8e1491e70ce690a6fc19232c32e040ee9af37e0.zip
tk-c8e1491e70ce690a6fc19232c32e040ee9af37e0.tar.gz
tk-c8e1491e70ce690a6fc19232c32e040ee9af37e0.tar.bz2
* macosx/tkMacOSXMouseEvent.c (GenerateMouseWheelEvent): enable
processing of mousewheel events in background windows. * macosx/tkMacOSXScrlbr.c: modernize checks for active/front window. * macosx/tkMacOSXScale.c: * macosx/tkMacOSXWm.c: * macosx/tkMacOSXColor.c: factor out verbose #ifdef checks of * macosx/tkMacOSXDraw.c: MAC_OS_X_VERSION_{MAX_ALLOWED,MIN_REQUIRED} * macosx/tkMacOSXEntry.c: and runtime checks of kHIToolboxVersion into * macosx/tkMacOSXEvent.c: new TK_{IF,ELSE,ENDIF}_MAC_OS_X macros. * macosx/tkMacOSXInit.c: * macosx/tkMacOSXInt.h: * macosx/tkMacOSXWm.c: * macosx/tkMacOSXDraw.c: factor out clip clearing in QD ports; * macosx/tkMacOSXEntry.c: formatting cleanup.
Diffstat (limited to 'macosx/tkMacOSXColor.c')
-rw-r--r--macosx/tkMacOSXColor.c62
1 files changed, 19 insertions, 43 deletions
diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c
index 5a35086..5d4fb78 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.6 2007/05/31 13:42:12 das Exp $
+ * RCS: @(#) $Id: tkMacOSXColor.c,v 1.2.2.7 2007/06/06 09:56:54 das Exp $
*/
#include "tkMacOSXInt.h"
@@ -382,50 +382,34 @@ TkMacOSXSetColorInContext(unsigned long pixel, CGContextRef context)
if (GetThemeFromPixelCode((pixel >> 24) & 0xff, &brush, &textColor,
&background)) {
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
if (brush) {
- if (1
-#if MAC_OS_X_VERSION_MIN_REQUIRED < 1040
- && HIThemeSetFill != NULL && HIThemeSetStroke != NULL
-#endif
- ) {
+ TK_IF_MAC_OS_X_API (4, HIThemeSetFill,
err = ChkErr(HIThemeSetFill, brush, NULL, context,
kHIThemeOrientationNormal);
- if (err == noErr) {
+ TK_IF_MAC_OS_X_API_COND (4, err == noErr, HIThemeSetFill,
err = ChkErr(HIThemeSetStroke, brush, NULL, context,
kHIThemeOrientationNormal);
- }
- }
+ ) TK_ENDIF_MAC_OS_X
+ ) TK_ENDIF_MAC_OS_X
} else if (textColor) {
- if (1
-#if MAC_OS_X_VERSION_MIN_REQUIRED < 1040
- && HIThemeSetTextFill != NULL
-#endif
- ) {
+ TK_IF_MAC_OS_X_API (4, HIThemeSetTextFill,
err = ChkErr(HIThemeSetTextFill, textColor, NULL, context,
kHIThemeOrientationNormal);
- }
- } else
-#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1040 */
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
- if (background) {
- if (1
-#if MAC_OS_X_VERSION_MIN_REQUIRED < 1030
- && CGContextGetClipBoundingBox != NULL
- && HIThemeApplyBackground != NULL
- && &kHIToolboxVersionNumber != NULL /* c.f. QA1377 */
- && kHIToolboxVersionNumber >= kHIToolboxVersionNumber10_3
-#endif
- ) {
+ ) TK_ENDIF_MAC_OS_X
+ } else if (background) {
+ TK_IF_MAC_OS_X_API (3, CGContextGetClipBoundingBox,
CGRect rect = CGContextGetClipBoundingBox(context);
HIThemeBackgroundDrawInfo info = { 0, kThemeStateActive,
background };
- err = ChkErr(HIThemeApplyBackground, &rect, &info, context,
- kHIThemeOrientationNormal);
- }
+ TK_IF_MAC_OS_X_API (3, HIThemeApplyBackground,
+ TK_IF_MAC_OS_X_HI_TOOLBOX (3, /* c.f. QA1377 */
+ err = ChkErr(HIThemeApplyBackground, &rect, &info,
+ context, kHIThemeOrientationNormal);
+ ) TK_ENDIF_MAC_OS_X
+ ) TK_ENDIF_MAC_OS_X
+ ) TK_ENDIF_MAC_OS_X
}
-#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 */
if (err == noErr) {
return;
}
@@ -458,17 +442,9 @@ TkMacOSXSetColorInContext(unsigned long pixel, CGContextRef context)
Tcl_Panic("TkMacOSXSetColorInContext(): "
"pattern initialization failed !");
}
- bitmapInfo =
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
- (1
-#if MAC_OS_X_VERSION_MIN_REQUIRED < 1040
- && &kHIToolboxVersionNumber != NULL
- && kHIToolboxVersionNumber >=
- kHIToolboxVersionNumber10_4
-#endif
- ) ? kCGBitmapByteOrder32Host :
-#endif
- 0;
+ TK_IF_MAC_OS_X_HI_TOOLBOX (4,
+ bitmapInfo = kCGBitmapByteOrder32Host;
+ ) TK_ENDIF_MAC_OS_X
}
portChanged = QDSwapPort(patGWorld, &savePort);
TkMacOSXSetColorInPort(pixel, 1, pixpat);