summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordas <das>2007-06-09 17:09:39 (GMT)
committerdas <das>2007-06-09 17:09:39 (GMT)
commit00da9d704110e07f22779330047d0b99406dd2ce (patch)
treef359d2dd182768b18f13b4636ebdc5c225ffa0f8
parenta700737d94005b30448cf6028feee89c787ed748 (diff)
downloadtk-00da9d704110e07f22779330047d0b99406dd2ce.zip
tk-00da9d704110e07f22779330047d0b99406dd2ce.tar.gz
tk-00da9d704110e07f22779330047d0b99406dd2ce.tar.bz2
* macosx/tkMacOSXColor.c: fix issues with TK_{IF,ELSE,ENDIF} macros;
* macosx/tkMacOSXDraw.c: implement Jaguar equivalent of unavailable * macosx/tkMacOSXEntry.c: kHIToolboxVersion global; panic at startup * macosx/tkMacOSXEvent.c: if MAC_OS_X_VERSION_MIN_REQUIRED constraint * macosx/tkMacOSXInit.c: is not satisfied. * macosx/tkMacOSXInt.h: * macosx/tkMacOSXWm.c: * macosx/tkMacOSXDraw.c (XCopyArea, XCopyPlane, TkPutImage) (TkMacOSXSetupDrawingContext): factor out common code and standardize setup/restore of port, context and clipping; formatting cleanup. * macosx/tkMacOSXWindowEvent.c: add error checking. * macosx/tkMacOSXMenu.c: fix gcc3 warning. * macosx/tkMacOSXScrlbr.c: fix testsuite crash. * macosx/tkMacOSXSubwindows.c: formatting cleanup. * macosx/tkMacOSXRegion.c: fix typos. * macosx/tkMacOSXScale.c: * macosx/tkMacOSXXStubs.c (Tk_GetUserInactiveTime): remove superfluous CFRetain/CFRelease. * macosx/Wish-Release.xcconfig: disable tktest release build stripping. * macosx/Wish.xcodeproj/project.pbxproj: add new Tclsh-Info.plist.in.
-rw-r--r--ChangeLog28
-rw-r--r--macosx/Wish-Release.xcconfig4
-rw-r--r--macosx/Wish.xcodeproj/project.pbxproj6
-rw-r--r--macosx/tkMacOSXColor.c22
-rw-r--r--macosx/tkMacOSXDraw.c510
-rw-r--r--macosx/tkMacOSXEntry.c8
-rw-r--r--macosx/tkMacOSXEvent.c4
-rw-r--r--macosx/tkMacOSXInit.c42
-rw-r--r--macosx/tkMacOSXInt.h93
-rw-r--r--macosx/tkMacOSXMenu.c4
-rw-r--r--macosx/tkMacOSXRegion.c6
-rw-r--r--macosx/tkMacOSXScale.c8
-rw-r--r--macosx/tkMacOSXScrlbr.c5
-rw-r--r--macosx/tkMacOSXSubwindows.c39
-rw-r--r--macosx/tkMacOSXWindowEvent.c4
-rw-r--r--macosx/tkMacOSXWm.c16
-rw-r--r--macosx/tkMacOSXXStubs.c5
17 files changed, 419 insertions, 385 deletions
diff --git a/ChangeLog b/ChangeLog
index 6705cb6..0b9c768 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,31 @@
+2007-06-09 Daniel Steffen <das@users.sourceforge.net>
+
+ * macosx/tkMacOSXColor.c: fix issues with TK_{IF,ELSE,ENDIF} macros;
+ * macosx/tkMacOSXDraw.c: implement Jaguar equivalent of unavailable
+ * macosx/tkMacOSXEntry.c: kHIToolboxVersion global; panic at startup
+ * macosx/tkMacOSXEvent.c: if MAC_OS_X_VERSION_MIN_REQUIRED constraint
+ * macosx/tkMacOSXInit.c: is not satisfied.
+ * macosx/tkMacOSXInt.h:
+ * macosx/tkMacOSXWm.c:
+
+ * macosx/tkMacOSXDraw.c (XCopyArea, XCopyPlane, TkPutImage)
+ (TkMacOSXSetupDrawingContext): factor out common code and standardize
+ setup/restore of port, context and clipping; formatting cleanup.
+
+ * macosx/tkMacOSXWindowEvent.c: add error checking.
+ * macosx/tkMacOSXMenu.c: fix gcc3 warning.
+ * macosx/tkMacOSXScrlbr.c: fix testsuite crash.
+ * macosx/tkMacOSXSubwindows.c: formatting cleanup.
+ * macosx/tkMacOSXRegion.c: fix typos.
+ * macosx/tkMacOSXScale.c:
+
+ * macosx/tkMacOSXXStubs.c (Tk_GetUserInactiveTime): remove superfluous
+ CFRetain/CFRelease.
+
+ * macosx/Wish-Release.xcconfig: disable tktest release build stripping.
+
+ * macosx/Wish.xcodeproj/project.pbxproj: add new Tclsh-Info.plist.in.
+
2007-06-06 Daniel Steffen <das@users.sourceforge.net>
* macosx/tkMacOSXInt.h: use native debug message API when available.
diff --git a/macosx/Wish-Release.xcconfig b/macosx/Wish-Release.xcconfig
index e1a8752..b317034 100644
--- a/macosx/Wish-Release.xcconfig
+++ b/macosx/Wish-Release.xcconfig
@@ -9,13 +9,13 @@
// See the file "license.terms" for information on usage and redistribution
// of this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
-// RCS: @(#) $Id: Wish-Release.xcconfig,v 1.2 2007/04/23 21:24:32 das Exp $
+// RCS: @(#) $Id: Wish-Release.xcconfig,v 1.3 2007/06/09 17:09:39 das Exp $
//
#include "Wish-Common.xcconfig"
DEBUG_INFORMATION_FORMAT = dwarf-with-dsym
-DEPLOYMENT_POSTPROCESSING = YES
+// DEPLOYMENT_POSTPROCESSING = YES
GCC_OPTIMIZATION_LEVEL = s
GCC_PREPROCESSOR_DEFINITIONS = NDEBUG $(TCL_DEFS) $(TK_DEFS) $(GCC_PREPROCESSOR_DEFINITIONS)
CONFIGURE_ARGS = --disable-symbols $(TCL_CONFIGURE_ARGS) $(CONFIGURE_ARGS)
diff --git a/macosx/Wish.xcodeproj/project.pbxproj b/macosx/Wish.xcodeproj/project.pbxproj
index dacd1a7..fa25b9d 100644
--- a/macosx/Wish.xcodeproj/project.pbxproj
+++ b/macosx/Wish.xcodeproj/project.pbxproj
@@ -313,6 +313,7 @@
/* Begin PBXFileReference section */
8DD76FB20486AB0100D96B5E /* tktest */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = tktest; sourceTree = BUILT_PRODUCTS_DIR; };
+ F91E62260C1AE686006C9D96 /* Tclsh-Info.plist.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = "Tclsh-Info.plist.in"; sourceTree = "<group>"; };
F93E5EFD09CF8711008FA367 /* tkMacOSXFont.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkMacOSXFont.h; sourceTree = "<group>"; };
F9408AF20B195C08009F7CAC /* tclMathOp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclMathOp.c; sourceTree = "<group>"; };
F966BA0408F27A37005CB29B /* error.xbm */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = error.xbm; sourceTree = "<group>"; };
@@ -1779,7 +1780,7 @@
F966C06F08F281DC005CB29B /* Frameworks */,
1AB674ADFE9D54B511CA2CBB /* Products */,
);
- comments = "Copyright (c) 2004-2007 Daniel A. Steffen <das@users.sourceforge.net>\n\nSee the file \"license.terms\" for information on usage and redistribution of\nthis file, and for a DISCLAIMER OF ALL WARRANTIES.\n\nRCS: @(#) $Id: project.pbxproj,v 1.23 2007/06/06 09:55:53 das Exp $\n";
+ comments = "Copyright (c) 2004-2007 Daniel A. Steffen <das@users.sourceforge.net>\n\nSee the file \"license.terms\" for information on usage and redistribution of\nthis file, and for a DISCLAIMER OF ALL WARRANTIES.\n\nRCS: @(#) $Id: project.pbxproj,v 1.24 2007/06/09 17:09:41 das Exp $\n";
name = Wish;
path = .;
sourceTree = SOURCE_ROOT;
@@ -3217,10 +3218,11 @@
F96D432E08F272B5004A47F5 /* configure.ac */,
F96D432F08F272B5004A47F5 /* GNUmakefile */,
F96D433108F272B5004A47F5 /* README */,
- F96D433208F272B5004A47F5 /* Tcl-Info.plist.in */,
F96D433908F272B5004A47F5 /* tclMacOSXBundle.c */,
F96D433D08F272B5004A47F5 /* tclMacOSXFCmd.c */,
F96D433E08F272B5004A47F5 /* tclMacOSXNotify.c */,
+ F96D433208F272B5004A47F5 /* Tcl-Info.plist.in */,
+ F91E62260C1AE686006C9D96 /* Tclsh-Info.plist.in */,
);
path = macosx;
sourceTree = "<group>";
diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c
index 7355356..2194b7a 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.10 2007/06/06 09:55:52 das Exp $
+ * RCS: @(#) $Id: tkMacOSXColor.c,v 1.11 2007/06/09 17:09:39 das Exp $
*/
#include "tkMacOSXInt.h"
@@ -386,16 +386,16 @@ TkMacOSXSetColorInContext(unsigned long pixel, CGContextRef context)
TK_IF_MAC_OS_X_API (4, HIThemeSetFill,
err = ChkErr(HIThemeSetFill, brush, NULL, context,
kHIThemeOrientationNormal);
- TK_IF_MAC_OS_X_API_COND (4, err == noErr, HIThemeSetFill,
+ TK_IF_MAC_OS_X_API_COND (4, HIThemeSetFill, err == noErr,
err = ChkErr(HIThemeSetStroke, brush, NULL, context,
kHIThemeOrientationNormal);
- ) TK_ENDIF_MAC_OS_X
- ) TK_ENDIF_MAC_OS_X
+ ) TK_ENDIF
+ ) TK_ENDIF
} else if (textColor) {
TK_IF_MAC_OS_X_API (4, HIThemeSetTextFill,
err = ChkErr(HIThemeSetTextFill, textColor, NULL, context,
kHIThemeOrientationNormal);
- ) TK_ENDIF_MAC_OS_X
+ ) TK_ENDIF
} else if (background) {
TK_IF_MAC_OS_X_API (3, CGContextGetClipBoundingBox,
CGRect rect = CGContextGetClipBoundingBox(context);
@@ -403,12 +403,12 @@ TkMacOSXSetColorInContext(unsigned long pixel, CGContextRef context)
background };
TK_IF_MAC_OS_X_API (3, HIThemeApplyBackground,
- TK_IF_MAC_OS_X_HI_TOOLBOX (3, /* c.f. QA1377 */
+ TK_IF_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
+ ) TK_ENDIF
+ ) TK_ENDIF
+ ) TK_ENDIF
}
if (err == noErr) {
return;
@@ -442,9 +442,9 @@ TkMacOSXSetColorInContext(unsigned long pixel, CGContextRef context)
Tcl_Panic("TkMacOSXSetColorInContext(): "
"pattern initialization failed !");
}
- TK_IF_MAC_OS_X_HI_TOOLBOX (4,
+ TK_IF_HI_TOOLBOX (4,
bitmapInfo = kCGBitmapByteOrder32Host;
- ) TK_ENDIF_MAC_OS_X
+ ) TK_ENDIF
}
portChanged = QDSwapPort(patGWorld, &savePort);
TkMacOSXSetColorInPort(pixel, 1, pixpat);
diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c
index 0ea1b1a..a5c00d6 100644
--- a/macosx/tkMacOSXDraw.c
+++ b/macosx/tkMacOSXDraw.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXDraw.c,v 1.25 2007/06/06 09:55:52 das Exp $
+ * RCS: @(#) $Id: tkMacOSXDraw.c,v 1.26 2007/06/09 17:09:40 das Exp $
*/
#include "tkMacOSXInt.h"
@@ -52,6 +52,7 @@ static int useThemedFrame = 0;
* Prototypes for functions used only in this file.
*/
static unsigned char InvertByte(unsigned char data);
+static void ClipToGC(Drawable d, GC gc, CGrafPtr port, RgnHandle clipRgn);
static void NoQDClip(CGrafPtr port);
@@ -157,85 +158,43 @@ XCopyArea(
int dest_x, /* Dest X & Y on dest rect. */
int dest_y)
{
- Rect srcRect, dstRect, *srcPtr, *dstPtr;
- const BitMap *srcBit, *dstBit;
+ Rect srcRect, dstRect, *srcPtr = &srcRect, *dstPtr = &dstRect;
MacDrawable *srcDraw = (MacDrawable *) src, *dstDraw = (MacDrawable *) dst;
- CGrafPtr srcPort, dstPort, savePort;
+ CGrafPtr srcPort, destPort, savePort;
Boolean portChanged;
- RGBColor origForeColor, origBackColor, whiteColor, blackColor;
-
- dstPort = TkMacOSXGetDrawablePort(dst);
- srcPort = TkMacOSXGetDrawablePort(src);
+ const BitMap *srcBit, *dstBit;
+ RGBColor origForeColor, origBackColor;
+ RGBColor black = {0, 0, 0}, white = {0xffff, 0xffff, 0xffff};
display->request++;
- portChanged = QDSwapPort(dstPort, &savePort);
- GetForeColor(&origForeColor);
- GetBackColor(&origBackColor);
- whiteColor.red = 0;
- whiteColor.blue = 0;
- whiteColor.green = 0;
- RGBForeColor(&whiteColor);
- blackColor.red = 0xFFFF;
- blackColor.blue = 0xFFFF;
- blackColor.green = 0xFFFF;
- RGBBackColor(&blackColor);
-
- srcPtr = &srcRect;
- SetRect(&srcRect, (short) (srcDraw->xOff + src_x),
- (short) (srcDraw->yOff + src_y),
- (short) (srcDraw->xOff + src_x + width),
- (short) (srcDraw->yOff + src_y + height));
- if (tkPictureIsOpen) {
- dstPtr = &srcRect;
- } else {
- dstPtr = &dstRect;
- SetRect(&dstRect, (short) (dstDraw->xOff + dest_x),
- (short) (dstDraw->yOff + dest_y),
- (short) (dstDraw->xOff + dest_x + width),
- (short) (dstDraw->yOff + dest_y + height));
- }
- TkMacOSXSetUpClippingRgn(dst);
-
- /*
- * We will change the clip rgn in this routine, so we need to
- * be able to restore it when we exit.
- */
-
+ srcPort = TkMacOSXGetDrawablePort(src);
+ destPort = TkMacOSXGetDrawablePort(dst);
+ srcBit = GetPortBitMapForCopyBits(srcPort);
+ dstBit = GetPortBitMapForCopyBits(destPort);
+ SetRect(srcPtr, srcDraw->xOff + src_x, srcDraw->yOff + src_y,
+ srcDraw->xOff + src_x + width, srcDraw->yOff + src_y + height);
TkMacOSXCheckTmpRgnEmpty(2);
- GetClip(tkMacOSXtmpRgn2);
+ GetPortClipRegion(destPort, tkMacOSXtmpRgn2);
if (tkPictureIsOpen) {
- /*
- * When rendering into a picture, after a call to "OpenCPicture"
- * the drawable clipping is incorrect, so don't clip.
- */
-
- NoQDClip(dstPort);
- }
- if (gc->clip_mask && ((TkpClipMask*)gc->clip_mask)->type
- == TKP_CLIP_REGION) {
- RgnHandle gcClipRgn = (RgnHandle)
- ((TkpClipMask*)gc->clip_mask)->value.region;
- int xOffset = dstDraw->xOff + gc->clip_x_origin;
- int yOffset = dstDraw->yOff + gc->clip_y_origin;
-
- if (!tkPictureIsOpen) {
- OffsetRgn(gcClipRgn, xOffset, yOffset);
- }
- TkMacOSXCheckTmpRgnEmpty(1);
- GetClip(tkMacOSXtmpRgn1);
- SectRgn(tkMacOSXtmpRgn1, gcClipRgn, tkMacOSXtmpRgn1);
- SetClip(tkMacOSXtmpRgn1);
- SetEmptyRgn(tkMacOSXtmpRgn1);
- if (!tkPictureIsOpen) {
- OffsetRgn(gcClipRgn, -xOffset, -yOffset);
- }
+ dstPtr = srcPtr;
+ NoQDClip(destPort);
+ } else {
+ SetRect(dstPtr, dstDraw->xOff + dest_x, dstDraw->yOff + dest_y,
+ dstDraw->xOff + dest_x + width,
+ dstDraw->yOff + dest_y + height);
+ TkMacOSXSetUpClippingRgn(dst);
}
- srcBit = GetPortBitMapForCopyBits(srcPort);
- dstBit = GetPortBitMapForCopyBits(dstPort);
+ TkMacOSXCheckTmpRgnEmpty(1);
+ ClipToGC(dst, gc, destPort, tkMacOSXtmpRgn1);
+ portChanged = QDSwapPort(destPort, &savePort);
+ GetPortForeColor(destPort, &origForeColor);
+ GetPortBackColor(destPort, &origBackColor);
+ RGBForeColor(&black);
+ RGBBackColor(&white);
CopyBits(srcBit, dstBit, srcPtr, dstPtr, srcCopy, NULL);
- SetClip(tkMacOSXtmpRgn2);
RGBForeColor(&origForeColor);
RGBBackColor(&origBackColor);
+ SetPortClipRegion(destPort, tkMacOSXtmpRgn2);
SetEmptyRgn(tkMacOSXtmpRgn2);
if (portChanged) {
QDSwapPort(savePort, NULL);
@@ -266,90 +225,82 @@ XCopyPlane(
Display *display, /* Display. */
Drawable src, /* Source drawable. */
Drawable dst, /* Destination drawable. */
- GC gc, /* The GC to use. */
- int src_x, int src_y, /* X, Y, width & height define the source
- * rect. */
- unsigned int width, unsigned int height,
- int dest_x, int dest_y, /* X & Y on dest where we will copy. */
+ GC gc, /* GC to use. */
+ int src_x, /* X & Y, width & height */
+ int src_y, /* define the source rectangle */
+ unsigned int width, /* the will be copied. */
+ unsigned int height,
+ int dest_x, /* Dest X & Y on dest rect. */
+ int dest_y,
unsigned long plane) /* Which plane to copy. */
{
- Rect srcRect, dstRect, *srcPtr, *dstPtr;
- const BitMap *srcBit, *dstBit, *mskBit;
+ Rect srcRect, dstRect, *srcPtr = &srcRect, *dstPtr = &dstRect;
MacDrawable *srcDraw = (MacDrawable *) src, *dstDraw = (MacDrawable *) dst;
- CGrafPtr srcPort, dstPort, mskPort, savePort;
+ CGrafPtr srcPort, destPort, savePort;
Boolean portChanged;
+ const BitMap *srcBit, *dstBit;
+ RGBColor origForeColor, origBackColor;
TkpClipMask *clipPtr = (TkpClipMask *) gc->clip_mask;
- short tmode;
-
- srcPort = TkMacOSXGetDrawablePort(src);
- dstPort = TkMacOSXGetDrawablePort(dst);
display->request++;
- portChanged = QDSwapPort(dstPort, &savePort);
- TkMacOSXSetUpClippingRgn(dst);
-
+ srcPort = TkMacOSXGetDrawablePort(src);
+ destPort = TkMacOSXGetDrawablePort(dst);
srcBit = GetPortBitMapForCopyBits(srcPort);
- dstBit = GetPortBitMapForCopyBits(dstPort);
- SetRect(&srcRect, (short) (srcDraw->xOff + src_x),
- (short) (srcDraw->yOff + src_y),
- (short) (srcDraw->xOff + src_x + width),
- (short) (srcDraw->yOff + src_y + height));
- srcPtr = &srcRect;
+ dstBit = GetPortBitMapForCopyBits(destPort);
+ SetRect(srcPtr, srcDraw->xOff + src_x, srcDraw->yOff + src_y,
+ srcDraw->xOff + src_x + width, srcDraw->yOff + src_y + height);
+ TkMacOSXCheckTmpRgnEmpty(2);
+ GetPortClipRegion(destPort, tkMacOSXtmpRgn2);
if (tkPictureIsOpen) {
- /*
- * When rendering into a picture, after a call to "OpenCPicture"
- * the drawable clipping is incorrect, so don't clip.
- */
-
- NoQDClip(dstPort);
- dstPtr = &srcRect;
+ dstPtr = srcPtr;
+ NoQDClip(destPort);
} else {
- dstPtr = &dstRect;
- SetRect(&dstRect, (short) (dstDraw->xOff + dest_x),
- (short) (dstDraw->yOff + dest_y),
- (short) (dstDraw->xOff + dest_x + width),
- (short) (dstDraw->yOff + dest_y + height));
+ SetRect(dstPtr, dstDraw->xOff + dest_x, dstDraw->yOff + dest_y,
+ dstDraw->xOff + dest_x + width,
+ dstDraw->yOff + dest_y + height);
+ TkMacOSXSetUpClippingRgn(dst);
}
- tmode = srcOr;
- tmode = srcCopy + transparent;
-
+ TkMacOSXCheckTmpRgnEmpty(1);
+ GetPortClipRegion(destPort, tkMacOSXtmpRgn1);
+ ClipToGC(dst, gc, destPort, tkMacOSXtmpRgn1);
+ SetPortClipRegion(destPort, tkMacOSXtmpRgn1);
+ SetEmptyRgn(tkMacOSXtmpRgn1);
+ portChanged = QDSwapPort(destPort, &savePort);
+ GetPortForeColor(destPort, &origForeColor);
+ GetPortBackColor(destPort, &origBackColor);
TkMacOSXSetColorInPort(gc->foreground, 1, NULL);
-
- if (clipPtr == NULL || clipPtr->type == TKP_CLIP_REGION) {
+ if (!clipPtr || clipPtr->type == TKP_CLIP_REGION) {
/*
- * Case 1: opaque bitmaps.
+ * Opaque bitmaps.
*/
TkMacOSXSetColorInPort(gc->background, 0, NULL);
- tmode = srcCopy;
- CopyBits(srcBit, dstBit, srcPtr, dstPtr, tmode, NULL);
+ CopyBits(srcBit, dstBit, srcPtr, dstPtr, srcCopy, NULL);
} else if (clipPtr->type == TKP_CLIP_PIXMAP) {
if (clipPtr->value.pixmap == src) {
- PixMapHandle pm;
/*
- * Case 2: transparent bitmaps. If it's color we ignore
- * the forecolor.
+ * Transparent bitmaps. If it's color we ignore the forecolor.
*/
+ short tmode = GetPixDepth(GetPortPixMap(srcPort)) == 1 ?
+ srcOr : transparent;
- pm = GetPortPixMap(srcPort);
- if (GetPixDepth(pm) == 1) {
- tmode = srcOr;
- } else {
- tmode = transparent;
- }
CopyBits(srcBit, dstBit, srcPtr, dstPtr, tmode, NULL);
} else {
/*
- * Case 3: two arbitrary bitmaps.
+ * Two arbitrary bitmaps.
*/
- tmode = srcCopy;
- mskPort = TkMacOSXGetDrawablePort(clipPtr->value.pixmap);
- mskBit = GetPortBitMapForCopyBits(mskPort);
- CopyDeepMask(srcBit, mskBit, dstBit,
- srcPtr, srcPtr, dstPtr, tmode, NULL);
+ CGrafPtr mskPort = TkMacOSXGetDrawablePort(clipPtr->value.pixmap);
+ const BitMap *mskBit = GetPortBitMapForCopyBits(mskPort);
+
+ CopyDeepMask(srcBit, mskBit, dstBit, srcPtr, srcPtr, dstPtr,
+ srcCopy, NULL);
}
}
+ RGBForeColor(&origForeColor);
+ RGBBackColor(&origBackColor);
+ SetPortClipRegion(destPort, tkMacOSXtmpRgn2);
+ SetEmptyRgn(tkMacOSXtmpRgn2);
if (portChanged) {
QDSwapPort(savePort, NULL);
}
@@ -387,46 +338,48 @@ TkPutImage(
unsigned int width, /* Same width & height for both */
unsigned int height) /* distination and source. */
{
+ Rect srcRect, dstRect, *srcPtr = &srcRect, *dstPtr = &dstRect;
+ MacDrawable *dstDraw = (MacDrawable *) d;
CGrafPtr destPort, savePort;
Boolean portChanged;
- const BitMap * destBits;
- MacDrawable *dstDraw = (MacDrawable *) d;
+ const BitMap *dstBit;
+ RGBColor origForeColor, origBackColor;
+ RGBColor black = {0, 0, 0}, white = {0xffff, 0xffff, 0xffff};
int i, j;
char *newData = NULL;
- Rect destRect, srcRect, *destPtr, *srcPtr;
char *dataPtr, *newPtr, *oldPtr;
int rowBytes = image->bytes_per_line;
int slices, sliceRowBytes, lastSliceRowBytes, sliceWidth, lastSliceWidth;
display->request++;
destPort = TkMacOSXGetDrawablePort(d);
- portChanged = QDSwapPort(destPort, &savePort);
- TkMacOSXSetUpClippingRgn(d);
-
- destBits = GetPortBitMapForCopyBits(destPort);
- srcPtr = &srcRect;
+ dstBit = GetPortBitMapForCopyBits(destPort);
SetRect(srcPtr, src_x, src_y, src_x + width, src_y + height);
+ TkMacOSXCheckTmpRgnEmpty(2);
+ GetPortClipRegion(destPort, tkMacOSXtmpRgn2);
if (tkPictureIsOpen) {
- /*
- * When rendering into a picture, after a call to "OpenCPicture"
- * the drawable clipping is incorrect, so don't clip.
- */
-
+ dstPtr = srcPtr;
NoQDClip(destPort);
- destPtr = srcPtr;
} else {
- destPtr = &destRect;
- SetRect(destPtr, dstDraw->xOff + dest_x, dstDraw->yOff + dest_y,
- dstDraw->xOff + dest_x + width, dstDraw->yOff + dest_y + height);
+ SetRect(dstPtr, dstDraw->xOff + dest_x, dstDraw->yOff + dest_y,
+ dstDraw->xOff + dest_x + width,
+ dstDraw->yOff + dest_y + height);
+ TkMacOSXSetUpClippingRgn(d);
}
-
+ TkMacOSXCheckTmpRgnEmpty(1);
+ ClipToGC(d, gc, destPort, tkMacOSXtmpRgn1);
+ portChanged = QDSwapPort(destPort, &savePort);
+ GetPortForeColor(destPort, &origForeColor);
+ GetPortBackColor(destPort, &origBackColor);
+ RGBForeColor(&black);
+ RGBBackColor(&white);
if (image->obdata) {
/*
* Image from XGetImage, copy from containing GWorld directly.
*/
CopyBits(GetPortBitMapForCopyBits(TkMacOSXGetDrawablePort((Drawable)
- image->obdata)), destBits, srcPtr, destPtr, srcCopy, NULL);
+ image->obdata)), dstBit, srcPtr, dstPtr, srcCopy, NULL);
} else if (image->depth == 1) {
/*
* BW image
@@ -479,12 +432,13 @@ TkPutImage(
}
bitmap.baseAddr = newData;
bitmap.rowBytes = sliceRowBytes + odd;
- CopyBits(&bitmap, destBits, srcPtr, destPtr, srcCopy, NULL);
+ CopyBits(&bitmap, dstBit, srcPtr, dstPtr, srcCopy, NULL);
if (slices) {
bitmap.bounds.left = bitmap.bounds.right;
dataPtr += sliceRowBytes;
}
} while (slices--);
+ ckfree(newData);
} else {
/*
* Color image
@@ -540,24 +494,25 @@ TkPutImage(
}
pixmap.baseAddr = newData;
pixmap.rowBytes = sliceRowBytes | 0x8000;
- CopyBits((BitMap *) &pixmap, destBits, srcPtr, destPtr,
- srcCopy, NULL);
+ CopyBits((BitMap*) &pixmap, dstBit, srcPtr, dstPtr, srcCopy,
+ NULL);
if (slices) {
pixmap.bounds.left = pixmap.bounds.right;
dataPtr += sliceRowBytes;
}
} while (slices--);
+ ckfree(newData);
} else {
pixmap.bounds.right = (short) image->width;
pixmap.baseAddr = image->data;
pixmap.rowBytes = rowBytes | 0x8000;
- CopyBits((BitMap *) &pixmap, destBits, srcPtr, destPtr,
- srcCopy, NULL);
+ CopyBits((BitMap*) &pixmap, dstBit, srcPtr, dstPtr, srcCopy, NULL);
}
}
- if (newData != NULL) {
- ckfree(newData);
- }
+ RGBForeColor(&origForeColor);
+ RGBBackColor(&origBackColor);
+ SetPortClipRegion(destPort, tkMacOSXtmpRgn2);
+ SetEmptyRgn(tkMacOSXtmpRgn2);
if (portChanged) {
QDSwapPort(savePort, NULL);
}
@@ -1001,10 +956,10 @@ XDrawArc(
macWin->xOff + x + o,
macWin->yOff + y + o,
width, height);
- TK_IF_MAC_OS_X_API_COND (4, angle1 == 0 && angle2 == 23040,
- CGContextStrokeEllipseInRect,
+ TK_IF_MAC_OS_X_API_COND (4, CGContextStrokeEllipseInRect,
+ angle1 == 0 && angle2 == 23040,
CGContextStrokeEllipseInRect(dc.context, rect);
- ) TK_ELSE_MAC_OS_X (4,
+ ) TK_ELSE (
CGMutablePathRef p = CGPathCreateMutable();
CGAffineTransform t = CGAffineTransformIdentity;
CGPoint c = CGPointMake(CGRectGetMidX(rect), CGRectGetMidY(rect));
@@ -1019,7 +974,7 @@ XDrawArc(
CGContextAddPath(dc.context, p);
CGPathRelease(p);
CGContextStrokePath(dc.context);
- ) TK_ENDIF_MAC_OS_X
+ ) TK_ENDIF
} else {
Rect theRect;
short start, extent;
@@ -1089,10 +1044,10 @@ XDrawArcs(
macWin->yOff + arcPtr->y + o,
arcPtr->width, arcPtr->height);
- TK_IF_MAC_OS_X_API_COND (4, arcPtr->angle1 == 0 &&
- arcPtr->angle2 == 23040, CGContextStrokeEllipseInRect,
+ TK_IF_MAC_OS_X_API_COND (4, CGContextStrokeEllipseInRect,
+ arcPtr->angle1 == 0 && arcPtr->angle2 == 23040,
CGContextStrokeEllipseInRect(dc.context, rect);
- ) TK_ELSE_MAC_OS_X (4,
+ ) TK_ELSE (
CGMutablePathRef p = CGPathCreateMutable();
CGAffineTransform t = CGAffineTransformIdentity;
CGPoint c = CGPointMake(CGRectGetMidX(rect),
@@ -1111,7 +1066,7 @@ XDrawArcs(
CGContextAddPath(dc.context, p);
CGPathRelease(p);
CGContextStrokePath(dc.context);
- ) TK_ENDIF_MAC_OS_X
+ ) TK_ENDIF
}
} else {
Rect theRect;
@@ -1181,10 +1136,10 @@ XFillArc(
macWin->yOff + y + o,
width - u, height - u);
- TK_IF_MAC_OS_X_API_COND (4, angle1 == 0 && angle2 == 23040,
- CGContextFillEllipseInRect,
+ TK_IF_MAC_OS_X_API_COND (4, CGContextFillEllipseInRect,
+ angle1 == 0 && angle2 == 23040,
CGContextFillEllipseInRect(dc.context, rect);
- ) TK_ELSE_MAC_OS_X (4,
+ ) TK_ELSE (
CGMutablePathRef p = CGPathCreateMutable();
CGAffineTransform t = CGAffineTransformIdentity;
CGPoint c = CGPointMake(CGRectGetMidX(rect), CGRectGetMidY(rect));
@@ -1203,7 +1158,7 @@ XFillArc(
CGContextAddPath(dc.context, p);
CGPathRelease(p);
CGContextFillPath(dc.context);
- ) TK_ENDIF_MAC_OS_X
+ ) TK_ENDIF
} else {
Rect theRect;
short start, extent;
@@ -1299,10 +1254,10 @@ XFillArcs(
macWin->xOff + arcPtr->x + o,
macWin->yOff + arcPtr->y + o,
arcPtr->width - u, arcPtr->height - u);
- TK_IF_MAC_OS_X_API_COND (4, arcPtr->angle1 == 0 &&
- arcPtr->angle2 == 23040, CGContextFillEllipseInRect,
+ TK_IF_MAC_OS_X_API_COND (4, CGContextFillEllipseInRect,
+ arcPtr->angle1 == 0 && arcPtr->angle2 == 23040,
CGContextFillEllipseInRect(dc.context, rect);
- ) TK_ELSE_MAC_OS_X (4,
+ ) TK_ELSE (
CGMutablePathRef p = CGPathCreateMutable();
CGAffineTransform t = CGAffineTransformIdentity;
CGPoint c = CGPointMake(CGRectGetMidX(rect),
@@ -1325,7 +1280,7 @@ XFillArcs(
CGContextAddPath(dc.context, p);
CGPathRelease(p);
CGContextFillPath(dc.context);
- ) TK_ENDIF_MAC_OS_X
+ ) TK_ENDIF
}
} else {
Rect theRect;
@@ -1424,14 +1379,11 @@ TkScrollWindow(
TkRegion damageRgn) /* Region to accumulate damage in. */
{
MacDrawable *destDraw = (MacDrawable *) Tk_WindowId(tkwin);
- RgnHandle rgn = (RgnHandle) damageRgn;
CGrafPtr destPort, savePort;
Boolean portChanged;
Rect srcRect, scrollRect;
-
- destPort = TkMacOSXGetDrawablePort(Tk_WindowId(tkwin));
- portChanged = QDSwapPort(destPort, &savePort);
- TkMacOSXSetUpClippingRgn(Tk_WindowId(tkwin));
+ int result;
+ RgnHandle rgn = (RgnHandle) damageRgn;
/*
* Due to the implementation below the behavior may be differnt
@@ -1459,11 +1411,8 @@ TkScrollWindow(
scrollRect.bottom += dy;
}
- /*
- * Adjust clip region so that we don't copy any windows
- * that may overlap us.
- */
-
+ destPort = TkMacOSXGetDrawablePort(Tk_WindowId(tkwin));
+ TkMacOSXSetUpClippingRgn(Tk_WindowId(tkwin));
TkMacOSXCheckTmpRgnEmpty(1);
TkMacOSXCheckTmpRgnEmpty(2);
RectRgn(rgn, &srcRect);
@@ -1473,25 +1422,26 @@ TkScrollWindow(
GetPortClipRegion(destPort, tkMacOSXtmpRgn2);
DiffRgn(tkMacOSXtmpRgn2, rgn, tkMacOSXtmpRgn2);
SetPortClipRegion(destPort, tkMacOSXtmpRgn2);
- SetEmptyRgn(tkMacOSXtmpRgn1);
SetEmptyRgn(tkMacOSXtmpRgn2);
+ SetEmptyRgn(tkMacOSXtmpRgn1);
SetEmptyRgn(rgn);
+ portChanged = QDSwapPort(destPort, &savePort);
ScrollRect(&scrollRect, dx, dy, rgn);
if (portChanged) {
QDSwapPort(savePort, NULL);
}
+
/*
* Fortunately, the region returned by ScrollRect is semantically
* the same as what we need to return in this function. If the
* region is empty we return zero to denote that no damage was
* created.
*/
- if (EmptyRgn(rgn)) {
- return 0;
- } else {
- return 1;
- }
+
+ result = EmptyRgn(rgn) ? 0 : 1;
+
+ return result;
}
/*
@@ -1565,57 +1515,14 @@ TkMacOSXSetupDrawingContext(
CGrafPtr port;
Rect portBounds;
+ dc->saveState = NULL;
+ dc->penPat = NULL;
+ dc->portChanged = false;
port = TkMacOSXGetDrawablePort(d);
if (port) {
GetPortBounds(port, &portBounds);
}
- dc->saveState = NULL;
- if (port && !context) {
- dc->portChanged = QDSwapPort(port, &(dc->savePort));
- TkMacOSXSetUpClippingRgn(d);
- TkMacOSXCheckTmpRgnEmpty(1);
- if (useCG) {
- if (ChkErr(QDBeginCGContext, port, &context) == noErr) {
- /*
- * Now clip the CG Context to the port. Note, we have already
- * set up the port with our clip region, so we can just get
- * the clip back out of there. If we use the macWin->clipRgn
- * directly at this point, we get some odd drawing effects.
- *
- * We also have to intersect our clip region with the port
- * visible region so we don't overwrite the window decoration.
- */
-
- RectRgn(tkMacOSXtmpRgn1, &portBounds);
- SectRegionWithPortClipRegion(port, tkMacOSXtmpRgn1);
- SectRegionWithPortVisibleRegion(port, tkMacOSXtmpRgn1);
- if (gc && gc->clip_mask && ((TkpClipMask*)gc->clip_mask)->type
- == TKP_CLIP_REGION) {
- RgnHandle gcClipRgn = (RgnHandle)
- ((TkpClipMask*)gc->clip_mask)->value.region;
- int xOffset = macDraw->xOff + gc->clip_x_origin;
- int yOffset = macDraw->yOff + gc->clip_y_origin;
-
- OffsetRgn(gcClipRgn, xOffset, yOffset);
- SectRgn(gcClipRgn, tkMacOSXtmpRgn1, tkMacOSXtmpRgn1);
- OffsetRgn(gcClipRgn, -xOffset, -yOffset);
- }
- ClipCGContextToRegion(context, &portBounds, tkMacOSXtmpRgn1);
- SetEmptyRgn(tkMacOSXtmpRgn1);
-
- /*
- * Note: You have to call SyncCGContextOriginWithPort
- * AFTER all the clip region manipulations.
- */
-
- SyncCGContextOriginWithPort(context, port);
- } else {
- context = NULL;
- useCG = 0;
- }
- }
- } else if (context) {
- TkMacOSXCheckTmpRgnEmpty(1);
+ if (context) {
if (!port) {
TK_IF_MAC_OS_X_API (3, CGContextGetClipBoundingBox,
CGRect r = CGContextGetClipBoundingBox(context);
@@ -1624,8 +1531,9 @@ TkMacOSXSetupDrawingContext(
r.origin.y + macDraw->yOff,
r.origin.x + r.size.width + macDraw->xOff,
r.origin.y + r.size.height + macDraw->yOff);
- ) TK_ENDIF_MAC_OS_X
+ ) TK_ENDIF
}
+ TkMacOSXCheckTmpRgnEmpty(1);
RectRgn(tkMacOSXtmpRgn1, &portBounds);
if (port) {
TkMacOSXSetUpClippingRgn(d);
@@ -1636,24 +1544,31 @@ TkMacOSXSetupDrawingContext(
SectRgn(macDraw->clipRgn, macDraw->drawRgn, tkMacOSXtmpRgn1);
OffsetRgn(macDraw->drawRgn, -macDraw->xOff, -macDraw->yOff);
}
- if (gc && gc->clip_mask && ((TkpClipMask*)gc->clip_mask)->type
- == TKP_CLIP_REGION) {
- RgnHandle gcClipRgn = (RgnHandle)
- ((TkpClipMask*)gc->clip_mask)->value.region;
- int xOffset = macDraw->xOff + gc->clip_x_origin;
- int yOffset = macDraw->yOff + gc->clip_y_origin;
-
- OffsetRgn(gcClipRgn, xOffset, yOffset);
- SectRgn(gcClipRgn, tkMacOSXtmpRgn1, tkMacOSXtmpRgn1);
- OffsetRgn(gcClipRgn, -xOffset, -yOffset);
- }
+ ClipToGC(d, gc, NULL, tkMacOSXtmpRgn1);
CGContextSaveGState(context);
+ dc->saveState = (void*)1;
ClipCGContextToRegion(context, &portBounds, tkMacOSXtmpRgn1);
SetEmptyRgn(tkMacOSXtmpRgn1);
port = NULL;
- dc->portChanged = false;
- dc->saveState = (void*)1;
useCG = 1;
+ } else if (port) {
+ dc->portChanged = QDSwapPort(port, &(dc->savePort));
+ TkMacOSXSetUpClippingRgn(d);
+ if (useCG) {
+ if (ChkErr(QDBeginCGContext, port, &context) == noErr) {
+ TkMacOSXCheckTmpRgnEmpty(1);
+ RectRgn(tkMacOSXtmpRgn1, &portBounds);
+ SectRegionWithPortClipRegion(port, tkMacOSXtmpRgn1);
+ SectRegionWithPortVisibleRegion(port, tkMacOSXtmpRgn1);
+ ClipToGC(d, gc, NULL, tkMacOSXtmpRgn1);
+ ClipCGContextToRegion(context, &portBounds, tkMacOSXtmpRgn1);
+ SetEmptyRgn(tkMacOSXtmpRgn1);
+ SyncCGContextOriginWithPort(context, port);
+ } else {
+ context = NULL;
+ useCG = 0;
+ }
+ }
} else {
Tcl_Panic("TkMacOSXSetupDrawingContext(): "
"no port or context to draw into !");
@@ -1681,7 +1596,6 @@ TkMacOSXSetupDrawingContext(
CGContextSetShouldAntialias(context, 1);
}
CGContextSetLineWidth(context, w);
-
if (gc->line_style != LineSolid) {
int num = 0;
char *p = &(gc->dashes);
@@ -1694,7 +1608,6 @@ TkMacOSXSetupDrawingContext(
}
CGContextSetLineDash(context, dashOffset, lengths, num);
}
-
if (gc->cap_style == CapButt) {
/*
* What about CapNotLast, CapProjecting?
@@ -1706,7 +1619,6 @@ TkMacOSXSetupDrawingContext(
} else if (gc->cap_style == CapProjecting) {
CGContextSetLineCap(context, kCGLineCapSquare);
}
-
if (gc->join_style == JoinMiter) {
CGContextSetLineJoin(context, kCGLineJoinMiter);
} else if (gc->join_style == JoinRound) {
@@ -1716,36 +1628,21 @@ TkMacOSXSetupDrawingContext(
}
}
} else {
+ PixPatHandle savePat = penPat;
+
ChkErr(GetThemeDrawingState, &(dc->saveState));
+ penPat = NULL;
+ TkMacOSXSetUpGraphicsPort(gc, port);
+ dc->penPat = penPat;
+ penPat = savePat;
if (gc) {
- PixPatHandle savePat = penPat;
-
- penPat = NULL;
- TkMacOSXSetUpGraphicsPort(gc, port);
- dc->penPat = penPat;
- penPat = savePat;
- if (gc->clip_mask && ((TkpClipMask*)gc->clip_mask)->type
- == TKP_CLIP_REGION) {
- RgnHandle gcClipRgn = (RgnHandle)
- ((TkpClipMask*)gc->clip_mask)->value.region;
- int xOffset = macDraw->xOff + gc->clip_x_origin;
- int yOffset = macDraw->yOff + gc->clip_y_origin;
-
- OffsetRgn(gcClipRgn, xOffset, yOffset);
- GetClip(tkMacOSXtmpRgn1);
- SectRgn(gcClipRgn, tkMacOSXtmpRgn1, tkMacOSXtmpRgn1);
- SetClip(tkMacOSXtmpRgn1);
- SetEmptyRgn(tkMacOSXtmpRgn1);
- OffsetRgn(gcClipRgn, -xOffset, -yOffset);
- }
- } else {
- TkMacOSXSetUpGraphicsPort(NULL, port);
- dc->penPat = NULL;
+ TkMacOSXCheckTmpRgnEmpty(1);
+ ClipToGC(d, gc, port, tkMacOSXtmpRgn1);
}
ShowPen();
}
- dc->port = port;
dc->portBounds = portBounds;
+ dc->port = port;
dc->context = context;
return useCG;
}
@@ -1817,32 +1714,29 @@ TkMacOSXSetUpClippingRgn(
Drawable drawable) /* Drawable to update. */
{
MacDrawable *macDraw = (MacDrawable *) drawable;
+ CGrafPtr port = TkMacOSXGetDrawablePort(drawable);
- if (macDraw->winPtr != NULL) {
- if (macDraw->flags & TK_CLIP_INVALID) {
- TkMacOSXUpdateClipRgn(macDraw->winPtr);
- }
-
+ if (macDraw->winPtr && macDraw->flags & TK_CLIP_INVALID) {
+ TkMacOSXUpdateClipRgn(macDraw->winPtr);
#ifdef TK_MAC_DEBUG_DRAWING
- TkMacOSXDebugFlashRegion(TkMacOSXGetDrawablePort(drawable),
- macDraw->clipRgn);
+ TkMacOSXDebugFlashRegion(port, macDraw->clipRgn);
#endif /* TK_MAC_DEBUG_DRAWING */
}
- if (macDraw->clipRgn != NULL) {
+ if (macDraw->clipRgn) {
if (macDraw->flags & TK_CLIPPED_DRAW) {
TkMacOSXCheckTmpRgnEmpty(1);
OffsetRgn(macDraw->drawRgn, macDraw->xOff, macDraw->yOff);
SectRgn(macDraw->clipRgn, macDraw->drawRgn, tkMacOSXtmpRgn1);
OffsetRgn(macDraw->drawRgn, -macDraw->xOff, -macDraw->yOff);
- SetClip(tkMacOSXtmpRgn1);
+ SetPortClipRegion(port, tkMacOSXtmpRgn1);
SetEmptyRgn(tkMacOSXtmpRgn1);
} else {
- SetClip(macDraw->clipRgn);
+ SetPortClipRegion(port, macDraw->clipRgn);
}
} else if (macDraw->flags & TK_CLIPPED_DRAW) {
OffsetRgn(macDraw->drawRgn, macDraw->xOff, macDraw->yOff);
- SetClip(macDraw->drawRgn);
+ SetPortClipRegion(port, macDraw->drawRgn);
OffsetRgn(macDraw->drawRgn, -macDraw->xOff, -macDraw->yOff);
}
}
@@ -1887,6 +1781,54 @@ TkpClipDrawableToRect(
/*
*----------------------------------------------------------------------
*
+ * ClipToGC --
+ *
+ * Helper function to intersect the given port's clip region (or if
+ * port is NULL, the given clipRgn) with gc clip region.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+static void
+ClipToGC(
+ Drawable d,
+ GC gc,
+ CGrafPtr port, /* can be NULL */
+ RgnHandle clipRgn) /* tmp region or if port == NULL, region to intersect */
+{
+ if (gc && gc->clip_mask &&
+ ((TkpClipMask*)gc->clip_mask)->type == TKP_CLIP_REGION) {
+ RgnHandle gcClipRgn = (RgnHandle)
+ ((TkpClipMask*)gc->clip_mask)->value.region;
+ int xOffset = ((MacDrawable *) d)->xOff + gc->clip_x_origin;
+ int yOffset = ((MacDrawable *) d)->yOff + gc->clip_y_origin;
+
+ if (!tkPictureIsOpen) {
+ OffsetRgn(gcClipRgn, xOffset, yOffset);
+ }
+ if (port) {
+ GetPortClipRegion(port, clipRgn);
+ }
+ SectRgn(clipRgn, gcClipRgn, clipRgn);
+ if (port) {
+ SetPortClipRegion(port, clipRgn);
+ SetEmptyRgn(clipRgn);
+ }
+ if (!tkPictureIsOpen) {
+ OffsetRgn(gcClipRgn, -xOffset, -yOffset);
+ }
+ }
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* NoQDClip --
*
* Helper function to setup a QD port to not clip anything.
diff --git a/macosx/tkMacOSXEntry.c b/macosx/tkMacOSXEntry.c
index 38c35f4..7b4ff54 100644
--- a/macosx/tkMacOSXEntry.c
+++ b/macosx/tkMacOSXEntry.c
@@ -53,7 +53,7 @@
* software in accordance with the terms specified in this
* license.
*
- * RCS: @(#) $Id: tkMacOSXEntry.c,v 1.10 2007/06/06 09:55:52 das Exp $
+ * RCS: @(#) $Id: tkMacOSXEntry.c,v 1.11 2007/06/09 17:09:40 das Exp $
*/
#include "tkMacOSXInt.h"
@@ -84,7 +84,7 @@ ComputeIncDecParameters(int height, int *width)
{
ThemeButtonKind kind;
- TK_IF_MAC_OS_X_HI_TOOLBOX (3,
+ TK_IF_HI_TOOLBOX (3,
if (height < 11 || height > 28) {
*width = 0;
kind = (ThemeButtonKind) 0;
@@ -100,7 +100,7 @@ ComputeIncDecParameters(int height, int *width)
kind = kThemeIncDecButtonMini;
}
}
- ) TK_ELSE_MAC_OS_X (3,
+ ) TK_ELSE_HI_TOOLBOX (3,
if (height < 21 || height > 28) {
*width = 0;
kind = (ThemeButtonKind) 0;
@@ -108,7 +108,7 @@ ComputeIncDecParameters(int height, int *width)
*width = 13;
kind = kThemeIncDecButton;
}
- ) TK_ENDIF_MAC_OS_X
+ ) TK_ENDIF
return kind;
}
diff --git a/macosx/tkMacOSXEvent.c b/macosx/tkMacOSXEvent.c
index 7542975..d7d12cd 100644
--- a/macosx/tkMacOSXEvent.c
+++ b/macosx/tkMacOSXEvent.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXEvent.c,v 1.19 2007/06/06 09:55:52 das Exp $
+ * RCS: @(#) $Id: tkMacOSXEvent.c,v 1.20 2007/06/09 17:09:40 das Exp $
*/
#include "tkMacOSXInt.h"
@@ -49,7 +49,7 @@ TkMacOSXFlushWindows(void)
if (QDIsPortBuffered(portPtr)) {
QDFlushPortBuffer(portPtr, NULL);
}
- ) TK_ENDIF_MAC_OS_X
+ ) TK_ENDIF
wRef = GetNextWindow(wRef);
}
}
diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c
index f1990bd..8fdbe9f 100644
--- a/macosx/tkMacOSXInit.c
+++ b/macosx/tkMacOSXInit.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXInit.c,v 1.30 2007/06/06 09:55:52 das Exp $
+ * RCS: @(#) $Id: tkMacOSXInit.c,v 1.31 2007/06/09 17:09:40 das Exp $
*/
#include "tkMacOSXInt.h"
@@ -19,6 +19,7 @@
#include "tclInt.h" /* for Tcl_GetStartupScript() & Tcl_SetStartupScript() */
#include <sys/stat.h>
+#include <sys/utsname.h>
#include <mach-o/dyld.h>
#include <mach-o/getsect.h>
@@ -93,6 +94,8 @@ Tcl_Encoding TkMacOSXCarbonEncoding = NULL;
*/
static char scriptPath[PATH_MAX + 1] = "";
+float tkMacOSXToolboxVersionNumber = 0;
+
/*
*----------------------------------------------------------------------
@@ -117,7 +120,7 @@ TkpInit(
Tcl_Interp *interp)
{
static char tkLibPath[PATH_MAX + 1];
- static int tkMacOSXInitialized = 0;
+ static int initialized = 0;
Tk_MacOSXSetupTkNotifier();
@@ -127,15 +130,44 @@ TkpInit(
* we protect against doing it more than once.
*/
- if (!tkMacOSXInitialized) {
+ if (!initialized) {
int bundledExecutable = 0;
CFBundleRef bundleRef;
CFURLRef bundleUrl = NULL;
CFStringEncoding encoding;
const char *encodingStr = NULL;
int i;
+ struct utsname name;
+ long osVersion = 0;
- tkMacOSXInitialized = 1;
+ initialized = 1;
+
+ /*
+ * Initialize/check OS version variable for runtime checks.
+ */
+
+ if (!uname(&name)) {
+ osVersion = strtol(name.release, NULL, 10) - 4;
+ }
+ if (osVersion && osVersion < (MAC_OS_X_VERSION_MIN_REQUIRED-1000)/10) {
+ Tcl_Panic("Mac OS X 10.%d or later required !",
+ (MAC_OS_X_VERSION_MIN_REQUIRED-1000)/10);
+ }
+ TK_IF_MAC_OS_X_API (3, &kHIToolboxVersionNumber,
+ tkMacOSXToolboxVersionNumber = kHIToolboxVersionNumber;
+ ) TK_ELSE_MAC_OS_X (3,
+ if (osVersion > 5) {
+ tkMacOSXToolboxVersionNumber = INFINITY;
+ } else if (osVersion >= 3) {
+ static const float tbVersions[3] = {
+ kHIToolboxVersionNumber10_3,
+ kHIToolboxVersionNumber10_4,
+ kHIToolboxVersionNumber10_5,
+ };
+
+ tkMacOSXToolboxVersionNumber = tbVersions[osVersion-3];
+ }
+ ) TK_ENDIF
/*
* When Tk is in a framework, force tcl_findLibrary to look in the
@@ -258,7 +290,7 @@ TkpInit(
TK_IF_MAC_OS_X_API (3, TransformProcessType,
err = ChkErr(TransformProcessType, &psn,
kProcessTransformToForegroundApplication);
- ) TK_ENDIF_MAC_OS_X
+ ) TK_ENDIF
#if MAC_OSX_TK_USE_CPS_SPI
if (err != noErr) {
/*
diff --git a/macosx/tkMacOSXInt.h b/macosx/tkMacOSXInt.h
index 119f61d..6c70a03 100644
--- a/macosx/tkMacOSXInt.h
+++ b/macosx/tkMacOSXInt.h
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXInt.h,v 1.26 2007/06/06 21:23:37 das Exp $
+ * RCS: @(#) $Id: tkMacOSXInt.h,v 1.27 2007/06/09 17:09:40 das Exp $
*/
#ifndef _TKMACINT
@@ -49,6 +49,7 @@
#define kAppearancePartPageUpArea 22
#define kAppearancePartPageDownArea 23
#define kAppearancePartIndicator 129
+ #define kUIModeAllSuppressed 4
#define FixedToInt(a) ((short)(((Fixed)(a) + fixed1/2) >> 16))
#define IntToFixed(a) ((Fixed)(a) << 16)
#endif
@@ -75,7 +76,7 @@
#define kWindowUnifiedTitleAndToolbarAttribute (1L << 7)
#define kWindowTexturedSquareCornersAttribute (1L << 10)
#endif
-/* Runtime HIToolbox version checking */
+/* HIToolbox version constants */
#ifndef kHIToolboxVersionNumber10_3
#define kHIToolboxVersionNumber10_3 (145)
#endif
@@ -85,68 +86,98 @@
#ifndef kHIToolboxVersionNumber10_5
#define kHIToolboxVersionNumber10_5 (303)
#endif
+/* Macros for HIToolbox runtime version checking */
+MODULE_SCOPE float tkMacOSXToolboxVersionNumber;
+#define TK_IF_HI_TOOLBOX(vers, ...) \
+ tk_if_mac_os_x_min_10_##vers(tkMacOSXToolboxVersionNumber >= \
+ kHIToolboxVersionNumber10_##vers, 1, __VA_ARGS__)
+#define TK_ELSE_HI_TOOLBOX(vers, ...) \
+ tk_else_mac_os_x_min_10_##vers(__VA_ARGS__)
/* Macros for Mac OS X API availability checking */
#define TK_IF_MAC_OS_X_API(vers, symbol, ...) \
- tk_if_mac_os_x_10_##vers(1, symbol, 1, __VA_ARGS__)
-#define TK_IF_MAC_OS_X_API_COND(vers, cond, symbol,...) \
- tk_if_mac_os_x_10_##vers(cond, symbol, 1, __VA_ARGS__)
-#define TK_IF_MAC_OS_X_HI_TOOLBOX(vers, ...) \
- tk_if_mac_os_x_10_##vers(1, &kHIToolboxVersionNumber, \
- kHIToolboxVersionNumber >= kHIToolboxVersionNumber10_##vers, \
- __VA_ARGS__)
+ tk_if_mac_os_x_10_##vers(symbol != NULL, 1, __VA_ARGS__)
#define TK_ELSE_MAC_OS_X(vers, ...) \
tk_else_mac_os_x_10_##vers(__VA_ARGS__)
-#define TK_ENDIF_MAC_OS_X \
+#define TK_IF_MAC_OS_X_API_COND(vers, symbol, cond, ...) \
+ tk_if_mac_os_x_10_##vers(symbol != NULL, cond, __VA_ARGS__)
+#define TK_ELSE(...) \
+ } else { __VA_ARGS__
+#define TK_ENDIF \
}
-/* Private helper macros to implement the API checking above */
-#define tk_if_mac_os_x_yes(cond, symbol, postcond, ...) \
+/* Private macros that implement the checking macros above */
+#define tk_if_mac_os_x_yes(chk, cond, ...) \
if (cond) { __VA_ARGS__
#define tk_else_mac_os_x_yes(...) \
} else {
-#define tk_if_mac_os_x_chk(cond, symbol, postcond, ...) \
- if ((cond) && (symbol) != NULL && (postcond)) { __VA_ARGS__
+#define tk_if_mac_os_x_chk(chk, cond, ...) \
+ if ((chk) && (cond)) { __VA_ARGS__
#define tk_else_mac_os_x_chk(...) \
} else { __VA_ARGS__
-#define tk_if_mac_os_x_no(cond, symbol, postcond, ...) \
+#define tk_if_mac_os_x_no(chk, cond, ...) \
if (0) {
#define tk_else_mac_os_x_no(...) \
} else { __VA_ARGS__
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
+/* Private mapping macros defined according to Mac OS X version requirements */
+/* 10.3 Panther */
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1030
+#define tk_if_mac_os_x_min_10_3 tk_if_mac_os_x_yes
+#define tk_else_mac_os_x_min_10_3 tk_else_mac_os_x_yes
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
#define tk_if_mac_os_x_10_3 tk_if_mac_os_x_yes
#define tk_else_mac_os_x_10_3 tk_else_mac_os_x_yes
-#else
+#endif /* MAC_OS_X_VERSION_MAX_ALLOWED */
+#else /* MAC_OS_X_VERSION_MIN_REQUIRED */
+#define tk_if_mac_os_x_min_10_3 tk_if_mac_os_x_chk
+#define tk_else_mac_os_x_min_10_3 tk_else_mac_os_x_chk
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
#define tk_if_mac_os_x_10_3 tk_if_mac_os_x_chk
#define tk_else_mac_os_x_10_3 tk_else_mac_os_x_chk
-#endif
-#else
+#endif /* MAC_OS_X_VERSION_MAX_ALLOWED */
+#endif /* MAC_OS_X_VERSION_MIN_REQUIRED */
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1030
#define tk_if_mac_os_x_10_3 tk_if_mac_os_x_no
#define tk_else_mac_os_x_10_3 tk_else_mac_os_x_no
-#endif
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
+#endif /* MAC_OS_X_VERSION_MAX_ALLOWED */
+/* 10.4 Tiger */
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1040
+#define tk_if_mac_os_x_min_10_4 tk_if_mac_os_x_yes
+#define tk_else_mac_os_x_min_10_4 tk_else_mac_os_x_yes
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
#define tk_if_mac_os_x_10_4 tk_if_mac_os_x_yes
#define tk_else_mac_os_x_10_4 tk_else_mac_os_x_yes
-#else
+#endif /* MAC_OS_X_VERSION_MAX_ALLOWED */
+#else /* MAC_OS_X_VERSION_MIN_REQUIRED */
+#define tk_if_mac_os_x_min_10_4 tk_if_mac_os_x_chk
+#define tk_else_mac_os_x_min_10_4 tk_else_mac_os_x_chk
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
#define tk_if_mac_os_x_10_4 tk_if_mac_os_x_chk
#define tk_else_mac_os_x_10_4 tk_else_mac_os_x_chk
-#endif
-#else
+#endif /* MAC_OS_X_VERSION_MAX_ALLOWED */
+#endif /* MAC_OS_X_VERSION_MIN_REQUIRED */
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1040
#define tk_if_mac_os_x_10_4 tk_if_mac_os_x_no
#define tk_else_mac_os_x_10_4 tk_else_mac_os_x_no
-#endif
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
+#endif /* MAC_OS_X_VERSION_MAX_ALLOWED */
+/* 10.5 Leopard */
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
+#define tk_if_mac_os_x_min_10_5 tk_if_mac_os_x_yes
+#define tk_else_mac_os_x_min_10_5 tk_else_mac_os_x_yes
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
#define tk_if_mac_os_x_10_5 tk_if_mac_os_x_yes
#define tk_else_mac_os_x_10_5 tk_else_mac_os_x_yes
-#else
+#endif /* MAC_OS_X_VERSION_MAX_ALLOWED */
+#else /* MAC_OS_X_VERSION_MIN_REQUIRED */
+#define tk_if_mac_os_x_min_10_5 tk_if_mac_os_x_chk
+#define tk_else_mac_os_x_min_10_5 tk_else_mac_os_x_chk
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
#define tk_if_mac_os_x_10_5 tk_if_mac_os_x_chk
#define tk_else_mac_os_x_10_5 tk_else_mac_os_x_chk
-#endif
-#else
+#endif /* MAC_OS_X_VERSION_MAX_ALLOWED */
+#endif /* MAC_OS_X_VERSION_MIN_REQUIRED */
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1050
#define tk_if_mac_os_x_10_5 tk_if_mac_os_x_no
#define tk_else_mac_os_x_10_5 tk_else_mac_os_x_no
-#endif
+#endif /* MAC_OS_X_VERSION_MAX_ALLOWED */
/*
* Include platform specific public interfaces.
@@ -164,7 +195,7 @@ struct TkWindowPrivate {
int xOff; /* X offset from toplevel window */
int yOff; /* Y offset from toplevel window */
RgnHandle clipRgn; /* Visible region of window */
- RgnHandle aboveClipRgn; /* Visible region of window & it's children */
+ RgnHandle aboveClipRgn; /* Visible region of window & its children */
RgnHandle drawRgn; /* Clipped drawing region */
int referenceCount; /* Don't delete toplevel until children are
* gone. */
diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c
index c551d5a..1e983ea 100644
--- a/macosx/tkMacOSXMenu.c
+++ b/macosx/tkMacOSXMenu.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXMenu.c,v 1.40 2007/06/03 13:44:40 das Exp $
+ * RCS: @(#) $Id: tkMacOSXMenu.c,v 1.41 2007/06/09 17:09:40 das Exp $
*/
#include "tkMacOSXInt.h"
@@ -1672,7 +1672,7 @@ DrawMenuBarWhenIdle(
ClientData clientData) /* ignored here */
{
TkMenuReferences *menuRefPtr;
- TkMenu *appleMenuPtr, *helpMenuPtr, *menuBarPtr;
+ TkMenu *appleMenuPtr, *helpMenuPtr, *menuBarPtr = NULL;
MenuHandle macMenuHdl;
Tcl_HashEntry *hashEntryPtr;
diff --git a/macosx/tkMacOSXRegion.c b/macosx/tkMacOSXRegion.c
index 1206d5b..d0c355e 100644
--- a/macosx/tkMacOSXRegion.c
+++ b/macosx/tkMacOSXRegion.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXRegion.c,v 1.7 2007/05/30 06:35:55 das Exp $
+ * RCS: @(#) $Id: tkMacOSXRegion.c,v 1.8 2007/06/09 17:09:40 das Exp $
*/
#include "tkMacOSXInt.h"
@@ -68,7 +68,7 @@ TkDestroyRegion(
*
* TkIntersectRegion --
*
- * Implements the equivilent of the X window function
+ * Implements the equivalent of the X window function
* XIntersectRegion. See X window documentation for more details.
*
* Results:
@@ -94,7 +94,7 @@ TkIntersectRegion(
*
* TkSubtractRegion --
*
- * Implements the equivilent of the X window function
+ * Implements the equivalent of the X window function
* XSubtractRegion. See X window documentation for more details.
*
* Results:
diff --git a/macosx/tkMacOSXScale.c b/macosx/tkMacOSXScale.c
index 1efe10e..c35c11d 100644
--- a/macosx/tkMacOSXScale.c
+++ b/macosx/tkMacOSXScale.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXScale.c,v 1.12 2007/06/06 09:55:52 das Exp $
+ * RCS: @(#) $Id: tkMacOSXScale.c,v 1.13 2007/06/09 17:09:40 das Exp $
*/
#include "tkMacOSXInt.h"
@@ -210,7 +210,7 @@ TkpDisplayScale(
macDraw = (MacDrawable *) Tk_WindowId(tkwin);
destPort = TkMacOSXGetDrawablePort(Tk_WindowId(tkwin));
windowRef = GetWindowFromPort(destPort);
- portChanged = QDSwapPort(dstPort, &savePort);
+ portChanged = QDSwapPort(destPort, &savePort);
TkMacOSXSetUpClippingRgn(Tk_WindowId(tkwin));
/*
@@ -327,7 +327,7 @@ TkpScaleElement(
TkMacOSXDbgMsg("TkpScaleElement");
#endif
destPort = TkMacOSXGetDrawablePort(Tk_WindowId(scalePtr->tkwin));
- portChanged = QDSwapPort(dstPort, &savePort);
+ portChanged = QDSwapPort(destPort, &savePort);
/*
* All of the calculations in this procedure mirror those in
@@ -408,7 +408,7 @@ MacScaleEventProc(
*/
destPort = TkMacOSXGetDrawablePort(Tk_WindowId(macScalePtr->info.tkwin));
- portChanged = QDSwapPort(dstPort, &savePort);
+ portChanged = QDSwapPort(destPort, &savePort);
TkMacOSXSetUpClippingRgn(Tk_WindowId(macScalePtr->info.tkwin));
TkMacOSXWinBounds((TkWindow *) macScalePtr->info.tkwin, &bounds);
diff --git a/macosx/tkMacOSXScrlbr.c b/macosx/tkMacOSXScrlbr.c
index 6197672..2ab6cfe 100644
--- a/macosx/tkMacOSXScrlbr.c
+++ b/macosx/tkMacOSXScrlbr.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXScrlbr.c,v 1.23 2007/06/06 09:55:52 das Exp $
+ * RCS: @(#) $Id: tkMacOSXScrlbr.c,v 1.24 2007/06/09 17:09:40 das Exp $
*/
#include "tkMacOSXInt.h"
@@ -954,7 +954,8 @@ UpdateControlValues(
if (portRect.bottom == contrlRect.bottom &&
portRect.right == contrlRect.right) {
TkMacOSXSetScrollbarGrow((TkWindow *) tkwin, true);
- if (TkMacOSXResizable(macDraw->toplevel->winPtr)) {
+ if (macDraw->toplevel &&
+ TkMacOSXResizable(macDraw->toplevel->winPtr)) {
int growSize;
switch (TkMacOSXWindowClass(macDraw->toplevel->winPtr)) {
diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c
index 8691aa0..d5c7616 100644
--- a/macosx/tkMacOSXSubwindows.c
+++ b/macosx/tkMacOSXSubwindows.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXSubwindows.c,v 1.21 2007/06/03 13:44:40 das Exp $
+ * RCS: @(#) $Id: tkMacOSXSubwindows.c,v 1.22 2007/06/09 17:09:41 das Exp $
*/
#include "tkMacOSXInt.h"
@@ -688,23 +688,25 @@ void
TkMacOSXUpdateClipRgn(
TkWindow *winPtr)
{
+ MacDrawable *macWin;
+
if (winPtr == NULL) {
return;
}
-
- if (winPtr->privatePtr && winPtr->privatePtr->flags & TK_CLIP_INVALID) {
+ macWin = winPtr->privatePtr;
+ if (macWin && macWin->flags & TK_CLIP_INVALID) {
TkWindow *win2Ptr;
if (Tk_IsMapped(winPtr)) {
int x, y;
- RgnHandle rgn = winPtr->privatePtr->aboveClipRgn;
+ RgnHandle rgn = macWin->aboveClipRgn;
/*
* Start with a region defined by the window bounds.
*/
- x = winPtr->privatePtr->xOff;
- y = winPtr->privatePtr->yOff;
+ x = macWin->xOff;
+ y = macWin->yOff;
SetRectRgn(rgn, (short) x, (short) y,
(short) (winPtr->changes.width + x),
(short) (winPtr->changes.height + y));
@@ -766,8 +768,8 @@ TkMacOSXUpdateClipRgn(
* of the embedded window.
*/
- rgn = winPtr->privatePtr->clipRgn;
- CopyRgn(winPtr->privatePtr->aboveClipRgn, rgn);
+ rgn = macWin->clipRgn;
+ CopyRgn(macWin->aboveClipRgn, rgn);
win2Ptr = winPtr->childList;
while (win2Ptr) {
if (Tk_IsTopLevel(win2Ptr) || !Tk_IsMapped(win2Ptr)) {
@@ -816,17 +818,15 @@ TkMacOSXUpdateClipRgn(
TkMacOSXUpdateClipRgn(win2Ptr);
}
}
- SetEmptyRgn(winPtr->privatePtr->aboveClipRgn);
- SetEmptyRgn(winPtr->privatePtr->clipRgn);
+ SetEmptyRgn(macWin->aboveClipRgn);
+ SetEmptyRgn(macWin->clipRgn);
}
- winPtr->privatePtr->flags &= ~TK_CLIP_INVALID;
+ macWin->flags &= ~TK_CLIP_INVALID;
#ifdef TK_MAC_DEBUG_CLIP_REGIONS
- TkMacOSXDebugFlashRegion(TkMacOSXGetDrawablePort(
- (Drawable) winPtr->privatePtr),
- ((MacDrawable*) winPtr->privatePtr)->clipRgn);
+ TkMacOSXDebugFlashRegion(TkMacOSXGetDrawablePort((Drawable) macWin),
+ macWin->visRgn);
#endif /* TK_MAC_DEBUG_CLIP_REGIONS */
-
}
}
@@ -1051,18 +1051,19 @@ TkMacOSXInvalClipRgns(
{
TkWindow *winPtr = (TkWindow *) tkwin;
TkWindow *childPtr;
+ MacDrawable *macWin = winPtr->privatePtr;
/*
* If already marked we can stop because all
* decendants will also already be marked.
*/
- if (!winPtr->privatePtr || winPtr->privatePtr->flags & TK_CLIP_INVALID) {
+ if (!macWin || macWin->flags & TK_CLIP_INVALID) {
return;
}
- winPtr->privatePtr->flags |= TK_CLIP_INVALID;
- SetEmptyRgn(winPtr->privatePtr->aboveClipRgn);
- SetEmptyRgn(winPtr->privatePtr->clipRgn);
+ macWin->flags |= TK_CLIP_INVALID;
+ SetEmptyRgn(macWin->aboveClipRgn);
+ SetEmptyRgn(macWin->clipRgn);
/*
* Invalidate clip regions for all children &
diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c
index 407688a..1b71cad 100644
--- a/macosx/tkMacOSXWindowEvent.c
+++ b/macosx/tkMacOSXWindowEvent.c
@@ -54,7 +54,7 @@
* software in accordance with the terms specified in this
* license.
*
- * RCS: @(#) $Id: tkMacOSXWindowEvent.c,v 1.25 2007/06/03 13:44:40 das Exp $
+ * RCS: @(#) $Id: tkMacOSXWindowEvent.c,v 1.26 2007/06/09 17:09:41 das Exp $
*/
#include "tkMacOSXInt.h"
@@ -456,7 +456,7 @@ GenerateUpdateEvent(Window window)
TkMacOSXCheckTmpRgnEmpty(1);
destPort = TkMacOSXGetDrawablePort(window);
macWindow = GetWindowFromPort(destPort);
- GetWindowRegion(macWindow, kWindowUpdateRgn, tkMacOSXtmpRgn1);
+ ChkErr(GetWindowRegion, macWindow, kWindowUpdateRgn, tkMacOSXtmpRgn1);
QDGlobalToLocalRegion(destPort, tkMacOSXtmpRgn1);
SectRegionWithPortVisibleRegion(destPort, tkMacOSXtmpRgn1);
GetRegionBounds(tkMacOSXtmpRgn1, &updateBounds);
diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c
index 96d423a..0f5abf3 100644
--- a/macosx/tkMacOSXWm.c
+++ b/macosx/tkMacOSXWm.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: tkMacOSXWm.c,v 1.53 2007/06/06 09:55:52 das Exp $
+ * RCS: @(#) $Id: tkMacOSXWm.c,v 1.54 2007/06/09 17:09:41 das Exp $
*/
#include "tkMacOSXInt.h"
@@ -815,7 +815,7 @@ static int WmSetAttribute(
alias);
DisposeHandle((Handle) alias);
}
- ) TK_ENDIF_MAC_OS_X
+ ) TK_ENDIF
}
} else {
int len;
@@ -870,7 +870,7 @@ static int WmSetAttribute(
ChkErr(HIWindowChangeFeatures, macWindow, 0,
kWindowIsOpaque);
}
- ) TK_ENDIF_MAC_OS_X
+ ) TK_ENDIF
} else {
wmPtr->flags &= ~WM_TRANSPARENT;
wmPtr->attributes &= ~kWindowNoShadowAttribute;
@@ -940,7 +940,7 @@ static Tcl_Obj *WmGetAttribute(
err = ChkErr(FSResolveAlias, NULL, alias, &ref,
&wasChanged);
}
- ) TK_ENDIF_MAC_OS_X
+ ) TK_ENDIF
if (err == noErr) {
err = ChkErr(FSRefMakePath, &ref, path, PATH_MAX);
}
@@ -5837,7 +5837,7 @@ ApplyWindowClassAttributeChanges(
if (wmPtr->macClass != oldClass) {
TK_IF_MAC_OS_X_API (4, HIWindowChangeClass,
ChkErr(HIWindowChangeClass, macWindow, wmPtr->macClass);
- ) TK_ENDIF_MAC_OS_X
+ ) TK_ENDIF
ChkErr(GetWindowClass, macWindow, &(wmPtr->macClass));
}
if (newAttributes != oldAttributes) {
@@ -6061,12 +6061,12 @@ TkMacOSXEnterExitFullscreen(
static SystemUIOptions fullscreenOptions = 0;
if (!fullscreenMode) {
- TK_IF_MAC_OS_X_HI_TOOLBOX (3,
+ TK_IF_HI_TOOLBOX (3,
fullscreenMode = kUIModeAllSuppressed;
- ) TK_ELSE_MAC_OS_X (3,
+ ) TK_ELSE_HI_TOOLBOX (3,
fullscreenMode = kUIModeAllHidden;
fullscreenOptions = kUIOptionAutoShowMenuBar;
- ) TK_ENDIF_MAC_OS_X
+ ) TK_ENDIF
}
if (mode != fullscreenMode) {
ChkErr(SetSystemUIMode, fullscreenMode, fullscreenOptions);
diff --git a/macosx/tkMacOSXXStubs.c b/macosx/tkMacOSXXStubs.c
index e7de22a..30053ed 100644
--- a/macosx/tkMacOSXXStubs.c
+++ b/macosx/tkMacOSXXStubs.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: tkMacOSXXStubs.c,v 1.19 2007/06/03 13:44:40 das Exp $
+ * RCS: @(#) $Id: tkMacOSXXStubs.c,v 1.20 2007/06/09 17:09:41 das Exp $
*/
#include "tkMacOSXInt.h"
@@ -1143,7 +1143,6 @@ Tk_GetUserInactiveTime(Display *dpy)
timeObj = CFDictionaryGetValue(props, CFSTR("HIDIdleTime"));
if (timeObj) {
- CFRetain(timeObj);
CFTypeID type = CFGetTypeID(timeObj);
if (type == CFDataGetTypeID()) { /* Jaguar */
@@ -1161,8 +1160,6 @@ Tk_GetUserInactiveTime(Display *dpy)
} else {
ret = -1l;
}
-
- CFRelease(timeObj);
}
/* Cleanup */
CFRelease(props);