summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordas <das>2007-05-30 06:35:54 (GMT)
committerdas <das>2007-05-30 06:35:54 (GMT)
commit8cecf7c3224a2661737fe9f628fe4c04e1f6581c (patch)
treed698fa040408e94632aa7a89b0599efb12078dfb
parent1f0c37d937775259c4a11c9652db6da862f3e2e4 (diff)
downloadtk-8cecf7c3224a2661737fe9f628fe4c04e1f6581c.zip
tk-8cecf7c3224a2661737fe9f628fe4c04e1f6581c.tar.gz
tk-8cecf7c3224a2661737fe9f628fe4c04e1f6581c.tar.bz2
* macosx/tkMacOSXMenu.c (DrawMenuSeparator): use DrawingContext API.
* macosx/tkMacOSXWindowEvent.c (ClearPort): clip to updateRgn. * macosx/tkMacOSXDebug.c: factor out debug region flashing. * macosx/tkMacOSXDebug.h: * macosx/tkMacOSXDraw.c: * macosx/tkMacOSXSubwindows.c: * macosx/tkMacOSXWindowEvent.c: * macosx/tkMacOSXEvent.c: cleanup whitespace and formatting. * macosx/tkMacOSXFont.c: * macosx/tkMacOSXRegion.c: * macosx/tkMacOSXSubwindows.c: * macosx/tkMacOSXWindowEvent.c: * macosx/tkMacOSXWm.c: * macosx/tkMacOSXXStubs.c: * xlib/xgc.c: * macosx/Wish.xcodeproj/project.pbxproj: delete references to removed * macosx/Wish.xcodeproj/default.pbxuser: ttk files.
-rw-r--r--ChangeLog31
-rw-r--r--macosx/tkMacOSXDebug.c22
-rw-r--r--macosx/tkMacOSXDebug.h4
-rw-r--r--macosx/tkMacOSXDraw.c96
-rw-r--r--macosx/tkMacOSXEvent.c4
-rw-r--r--macosx/tkMacOSXFont.c81
-rw-r--r--macosx/tkMacOSXMenu.c15
-rw-r--r--macosx/tkMacOSXRegion.c118
-rw-r--r--macosx/tkMacOSXSubwindows.c75
-rw-r--r--macosx/tkMacOSXWindowEvent.c102
-rw-r--r--macosx/tkMacOSXWm.c19
-rw-r--r--macosx/tkMacOSXXStubs.c42
-rw-r--r--xlib/xgc.c31
13 files changed, 320 insertions, 320 deletions
diff --git a/ChangeLog b/ChangeLog
index cc02f68..6f2d90b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,33 @@
+2007-05-30 Daniel Steffen <das@users.sourceforge.net>
+
+ * library/bgerror.tcl: standardize dialog option & button size
+ * library/dialog.tcl: modifications done when running on on Aqua.
+ * library/msgbox.tcl:
+
+ * library/demos/button.tcl: set button highlightbackground on Aqua.
+
+ * macosx/tkMacOSXMenu.c (DrawMenuSeparator): use DrawingContext API.
+
+ * macosx/tkMacOSXWindowEvent.c (ClearPort): clip to updateRgn.
+
+ * macosx/tkMacOSXDebug.c: factor out debug region flashing.
+ * macosx/tkMacOSXDebug.h:
+ * macosx/tkMacOSXDraw.c:
+ * macosx/tkMacOSXSubwindows.c:
+ * macosx/tkMacOSXWindowEvent.c:
+
+ * macosx/tkMacOSXEvent.c: cleanup whitespace and formatting.
+ * macosx/tkMacOSXFont.c:
+ * macosx/tkMacOSXRegion.c:
+ * macosx/tkMacOSXSubwindows.c:
+ * macosx/tkMacOSXWindowEvent.c:
+ * macosx/tkMacOSXWm.c:
+ * macosx/tkMacOSXXStubs.c:
+ * xlib/xgc.c:
+
+ * macosx/Wish.xcodeproj/project.pbxproj: delete references to removed
+ * macosx/Wish.xcodeproj/default.pbxuser: ttk files.
+
2007-05-28 Benjamin Riefenstahl <b.riefenstahl@turtle-trading.net>
* macosx/tkMacOSXFont.c (TkpMeasureCharsInContext): Fix short
@@ -12,7 +42,6 @@
* tests/ttk/misc.test: Removed.
* doc/ttk_dialog.tcl: Removed.
-
2007-05-25 Donal K. Fellows <dkf@users.sf.net>
* doc/canvas.n: Fixed documentation of default -joinstyle option
diff --git a/macosx/tkMacOSXDebug.c b/macosx/tkMacOSXDebug.c
index b0dc136..7d1fae6 100644
--- a/macosx/tkMacOSXDebug.c
+++ b/macosx/tkMacOSXDebug.c
@@ -54,7 +54,7 @@
* software in accordance with the terms specified in this
* license.
*
- * RCS: @(#) $Id: tkMacOSXDebug.c,v 1.12 2007/04/23 21:24:33 das Exp $
+ * RCS: @(#) $Id: tkMacOSXDebug.c,v 1.13 2007/05/30 06:35:54 das Exp $
*/
#include "tkMacOSXInt.h"
@@ -453,6 +453,22 @@ TkMacOSXMouseTrackingResultToAscii(MouseTrackingResult r, char * buf)
}
#endif /* TK_MACOSXDEBUG_UNUSED */
+MODULE_SCOPE void
+TkMacOSXDebugFlashRegion(
+ CGrafPtr port,
+ RgnHandle rgn)
+{
+ TkMacOSXInitNamedDebugSymbol(HIToolbox, int, QDDebugFlashRegion,
+ CGrafPtr port, RgnHandle region);
+ if (port && rgn && QDDebugFlashRegion) {
+ /*
+ * Carbon-internal region flashing SPI (c.f. Technote 2124)
+ */
+
+ QDDebugFlashRegion(port, rgn);
+ }
+}
+
/*
*----------------------------------------------------------------------
*
@@ -482,7 +498,9 @@ TkMacOSXMouseTrackingResultToAscii(MouseTrackingResult r, char * buf)
*/
MODULE_SCOPE void *
-TkMacOSXGetNamedDebugSymbol(const char* module, const char* symbol)
+TkMacOSXGetNamedDebugSymbol(
+ const char* module,
+ const char* symbol)
{
void* addr = TkMacOSXGetNamedSymbol(module, symbol);
#ifndef __LP64__
diff --git a/macosx/tkMacOSXDebug.h b/macosx/tkMacOSXDebug.h
index 235060d..a77ad9f 100644
--- a/macosx/tkMacOSXDebug.h
+++ b/macosx/tkMacOSXDebug.h
@@ -54,7 +54,7 @@
* software in accordance with the terms specified in this
* license.
*
- * RCS: @(#) $Id: tkMacOSXDebug.h,v 1.10 2007/04/23 21:24:33 das Exp $
+ * RCS: @(#) $Id: tkMacOSXDebug.h,v 1.11 2007/05/30 06:35:54 das Exp $
*/
#ifndef _TKMACDEBUG
@@ -82,6 +82,8 @@ MODULE_SCOPE char* TkMacOSXMenuMessageToAscii(int msg, char * s);
MODULE_SCOPE char* TkMacOSXMouseTrackingResultToAscii(MouseTrackingResult r, char * buf );
#endif
+MODULE_SCOPE void TkMacOSXDebugFlashRegion(CGrafPtr port, RgnHandle rgn);
+
MODULE_SCOPE void* TkMacOSXGetNamedDebugSymbol(const char* module, const char* symbol);
/* Macro to abstract common use of TkMacOSXGetNamedDebugSymbol to initialize named symbols */
diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c
index d01a669..91bf610 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.21 2007/04/23 21:24:33 das Exp $
+ * RCS: @(#) $Id: tkMacOSXDraw.c,v 1.22 2007/05/30 06:35:54 das Exp $
*/
#include "tkMacOSXInt.h"
@@ -161,9 +161,7 @@ XCopyArea(
MacDrawable *srcDraw = (MacDrawable *) src, *dstDraw = (MacDrawable *) dst;
CGrafPtr srcPort, dstPort, savePort;
Boolean portChanged;
- short tmode;
RGBColor origForeColor, origBackColor, whiteColor, blackColor;
- Rect clpRect;
dstPort = TkMacOSXGetDrawablePort(dst);
srcPort = TkMacOSXGetDrawablePort(src);
@@ -207,42 +205,36 @@ XCopyArea(
if (tkPictureIsOpen) {
/*
* When rendering into a picture, after a call to "OpenCPicture"
- * the clipping is seriously WRONG and also INCONSISTENT with the
- * clipping for single plane bitmaps.
- * To circumvent this problem, we clip to the whole window
- * In this case, would have also clipped to the srcRect
- * ClipRect(&srcRect);
+ * the drawable clipping is incorrect, so clip to the whole window.
*/
- GetPortBounds(dstPort,&clpRect);
- dstPtr = &srcRect;
+ Rect clpRect;
+
+ GetPortBounds(dstPort, &clpRect);
ClipRect(&clpRect);
}
if (gc->clip_mask && ((TkpClipMask*)gc->clip_mask)->type
== TKP_CLIP_REGION) {
- RgnHandle clipRgn = (RgnHandle)
+ RgnHandle gcClipRgn = (RgnHandle)
((TkpClipMask*)gc->clip_mask)->value.region;
- int xOffset = 0, yOffset = 0;
+ int xOffset = dstDraw->xOff + gc->clip_x_origin;
+ int yOffset = dstDraw->yOff + gc->clip_y_origin;
if (!tkPictureIsOpen) {
- xOffset = dstDraw->xOff + gc->clip_x_origin;
- yOffset = dstDraw->yOff + gc->clip_y_origin;
- OffsetRgn(clipRgn, xOffset, yOffset);
+ OffsetRgn(gcClipRgn, xOffset, yOffset);
}
TkMacOSXCheckTmpRgnEmpty(1);
GetClip(tkMacOSXtmpRgn1);
- SectRgn(tkMacOSXtmpRgn1, clipRgn, tkMacOSXtmpRgn1);
+ SectRgn(tkMacOSXtmpRgn1, gcClipRgn, tkMacOSXtmpRgn1);
SetClip(tkMacOSXtmpRgn1);
SetEmptyRgn(tkMacOSXtmpRgn1);
if (!tkPictureIsOpen) {
- OffsetRgn(clipRgn, -xOffset, -yOffset);
+ OffsetRgn(gcClipRgn, -xOffset, -yOffset);
}
}
srcBit = GetPortBitMapForCopyBits(srcPort);
dstBit = GetPortBitMapForCopyBits(dstPort);
- tmode = srcCopy;
-
- CopyBits(srcBit, dstBit, srcPtr, dstPtr, tmode, NULL);
+ CopyBits(srcBit, dstBit, srcPtr, dstPtr, srcCopy, NULL);
RGBForeColor(&origForeColor);
RGBBackColor(&origBackColor);
SetClip(tkMacOSXtmpRgn2);
@@ -308,13 +300,12 @@ XCopyPlane(
if (tkPictureIsOpen) {
/*
* When rendering into a picture, after a call to "OpenCPicture"
- * the clipping is seriously WRONG and also INCONSISTENT with the
- * clipping for color bitmaps.
- * To circumvent this problem, we clip to the whole window
+ * the drawable clipping is incorrect, so clip to the whole window.
*/
Rect clpRect;
- GetPortBounds(dstPort,&clpRect);
+
+ GetPortBounds(dstPort, &clpRect);
ClipRect(&clpRect);
dstPtr = &srcRect;
} else {
@@ -423,14 +414,12 @@ TkPutImage(
if (tkPictureIsOpen) {
/*
* When rendering into a picture, after a call to "OpenCPicture"
- * the clipping is seriously WRONG and also INCONSISTENT with the
- * clipping for single plane bitmaps.
- * To circumvent this problem, we clip to the whole window
+ * the drawable clipping is incorrect, so clip to the whole window.
*/
Rect clpRect;
- GetPortBounds(destPort,&clpRect);
+ GetPortBounds(destPort, &clpRect);
ClipRect(&clpRect);
destPtr = srcPtr;
} else {
@@ -1596,8 +1585,11 @@ TkMacOSXSetUpGraphicsPort(
*/
int
-TkMacOSXSetupDrawingContext(Drawable d, GC gc, int useCG,
- TkMacOSXDrawingContext *dc)
+TkMacOSXSetupDrawingContext(
+ Drawable d,
+ GC gc,
+ int useCG, /* advisory only ! */
+ TkMacOSXDrawingContext *dc)
{
MacDrawable *macDraw = ((MacDrawable*)d);
CGContextRef context = macDraw->context;
@@ -1631,14 +1623,14 @@ TkMacOSXSetupDrawingContext(Drawable d, GC gc, int useCG,
SectRegionWithPortVisibleRegion(port, tkMacOSXtmpRgn1);
if (gc && gc->clip_mask && ((TkpClipMask*)gc->clip_mask)->type
== TKP_CLIP_REGION) {
- RgnHandle clipRgn = (RgnHandle)
+ 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(clipRgn, xOffset, yOffset);
- SectRgn(clipRgn, tkMacOSXtmpRgn1, tkMacOSXtmpRgn1);
- OffsetRgn(clipRgn, -xOffset, -yOffset);
+ OffsetRgn(gcClipRgn, xOffset, yOffset);
+ SectRgn(gcClipRgn, tkMacOSXtmpRgn1, tkMacOSXtmpRgn1);
+ OffsetRgn(gcClipRgn, -xOffset, -yOffset);
}
ClipCGContextToRegion(context, &portBounds, tkMacOSXtmpRgn1);
SetEmptyRgn(tkMacOSXtmpRgn1);
@@ -1655,6 +1647,7 @@ TkMacOSXSetupDrawingContext(Drawable d, GC gc, int useCG,
}
}
} else if (context) {
+ TkMacOSXCheckTmpRgnEmpty(1);
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
if (!port
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1030
@@ -1669,8 +1662,6 @@ TkMacOSXSetupDrawingContext(Drawable d, GC gc, int useCG,
r.origin.y + r.size.height + macDraw->yOff);
}
#endif
- CGContextSaveGState(context);
- TkMacOSXCheckTmpRgnEmpty(1);
RectRgn(tkMacOSXtmpRgn1, &portBounds);
if (port) {
TkMacOSXSetUpClippingRgn(d);
@@ -1683,21 +1674,25 @@ TkMacOSXSetupDrawingContext(Drawable d, GC gc, int useCG,
}
if (gc && gc->clip_mask && ((TkpClipMask*)gc->clip_mask)->type
== TKP_CLIP_REGION) {
- RgnHandle clipRgn = (RgnHandle)
+ 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(clipRgn, xOffset, yOffset);
- SectRgn(clipRgn, tkMacOSXtmpRgn1, tkMacOSXtmpRgn1);
- OffsetRgn(clipRgn, -xOffset, -yOffset);
+ OffsetRgn(gcClipRgn, xOffset, yOffset);
+ SectRgn(gcClipRgn, tkMacOSXtmpRgn1, tkMacOSXtmpRgn1);
+ OffsetRgn(gcClipRgn, -xOffset, -yOffset);
}
+ CGContextSaveGState(context);
ClipCGContextToRegion(context, &portBounds, tkMacOSXtmpRgn1);
SetEmptyRgn(tkMacOSXtmpRgn1);
port = NULL;
dc->portChanged = false;
dc->saveState = (void*)1;
useCG = 1;
+ } else {
+ Tcl_Panic("TkMacOSXSetupDrawingContext(): "
+ "no port or context to draw into !");
}
if (useCG) {
CGContextConcatCTM(context, CGAffineTransformMake(1.0, 0.0, 0.0, -1.0,
@@ -1767,17 +1762,17 @@ TkMacOSXSetupDrawingContext(Drawable d, GC gc, int useCG,
gPenPat = savePat;
if (gc->clip_mask && ((TkpClipMask*)gc->clip_mask)->type
== TKP_CLIP_REGION) {
- RgnHandle clipRgn = (RgnHandle)
+ 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(clipRgn, xOffset, yOffset);
+ OffsetRgn(gcClipRgn, xOffset, yOffset);
GetClip(tkMacOSXtmpRgn1);
- SectRgn(clipRgn, tkMacOSXtmpRgn1, tkMacOSXtmpRgn1);
+ SectRgn(gcClipRgn, tkMacOSXtmpRgn1, tkMacOSXtmpRgn1);
SetClip(tkMacOSXtmpRgn1);
SetEmptyRgn(tkMacOSXtmpRgn1);
- OffsetRgn(clipRgn, -xOffset, -yOffset);
+ OffsetRgn(gcClipRgn, -xOffset, -yOffset);
}
} else {
TkMacOSXSetUpGraphicsPort(NULL, port);
@@ -1865,17 +1860,8 @@ TkMacOSXSetUpClippingRgn(
}
#ifdef TK_MAC_DEBUG_DRAWING
- TkMacOSXInitNamedDebugSymbol(HIToolbox, int, QDDebugFlashRegion,
- CGrafPtr port, RgnHandle region);
- if (QDDebugFlashRegion) {
- CGrafPtr grafPtr = TkMacOSXGetDrawablePort(drawable);
-
- /*
- * Carbon-internal region flashing SPI (c.f. Technote 2124)
- */
-
- QDDebugFlashRegion(grafPtr, macDraw->clipRgn);
- }
+ TkMacOSXDebugFlashRegion(TkMacOSXGetDrawablePort(drawable),
+ macDraw->clipRgn);
#endif /* TK_MAC_DEBUG_DRAWING */
}
diff --git a/macosx/tkMacOSXEvent.c b/macosx/tkMacOSXEvent.c
index 974898d..dcd06fb 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.16 2007/04/23 23:10:10 das Exp $
+ * RCS: @(#) $Id: tkMacOSXEvent.c,v 1.17 2007/05/30 06:35:54 das Exp $
*/
#include "tkMacOSXInt.h"
@@ -24,7 +24,7 @@
* TkMacOSXFlushWindows --
*
* This routine flushes all the Carbon windows of the application. It
- * is called by the setup procedure for the Tcl/Carbon event source.
+ * is called by XSync().
*
* Results:
* None.
diff --git a/macosx/tkMacOSXFont.c b/macosx/tkMacOSXFont.c
index 3804902..d745c87 100644
--- a/macosx/tkMacOSXFont.c
+++ b/macosx/tkMacOSXFont.c
@@ -35,7 +35,7 @@
* that such fonts can not be used for controls, because controls
* definitely require a family id (this assertion needs testing).
*
- * RCS: @(#) $Id: tkMacOSXFont.c,v 1.25 2007/05/28 17:12:31 cc_benny Exp $
+ * RCS: @(#) $Id: tkMacOSXFont.c,v 1.26 2007/05/30 06:35:54 das Exp $
*/
#include "tkMacOSXInt.h"
@@ -797,41 +797,41 @@ TkpMeasureCharsInContext(
(uchars[offset-1] == ' ')) {
offset--;
}
- }
-
- /*
- * Fix up left-overs for the TK_WHOLE_WORDS case.
- */
-
- if (flags & TK_WHOLE_WORDS) {
- if (flags & TK_AT_LEAST_ONE) {
- /*
- * If we are the the start of the range, we need to look
- * forward. If we are not at the end of a word, we must be in
- * the middle of the first word, so we also look forward.
- */
-
- if ((offset == urstart) || (uchars[offset] != ' ')) {
- while ((offset < urend) && (uchars[offset] != ' ')) {
- offset++;
- }
- }
- } else {
- /*
- * If we are not at the end of a word, we need to look
- * backward.
- */
-
- if ((offset != urend) && (uchars[offset] != ' ')) {
- while ((offset > urstart) && (uchars[offset-1] != ' ')) {
- offset--;
- }
- while ((offset > urstart) && (uchars[offset-1] == ' ')) {
- offset--;
- }
- }
- }
- }
+ }
+
+ /*
+ * Fix up left-overs for the TK_WHOLE_WORDS case.
+ */
+
+ if (flags & TK_WHOLE_WORDS) {
+ if (flags & TK_AT_LEAST_ONE) {
+ /*
+ * If we are the the start of the range, we need to look
+ * forward. If we are not at the end of a word, we must be in
+ * the middle of the first word, so we also look forward.
+ */
+
+ if ((offset == urstart) || (uchars[offset] != ' ')) {
+ while ((offset < urend) && (uchars[offset] != ' ')) {
+ offset++;
+ }
+ }
+ } else {
+ /*
+ * If we are not at the end of a word, we need to look
+ * backward.
+ */
+
+ if ((offset != urend) && (uchars[offset] != ' ')) {
+ while ((offset > urstart) && (uchars[offset-1] != ' ')) {
+ offset--;
+ }
+ while ((offset > urstart) && (uchars[offset-1] == ' ')) {
+ offset--;
+ }
+ }
+ }
+ }
if (offset > urend) {
offset = urend;
@@ -948,13 +948,13 @@ TkpMeasureCharsInContext(
#ifdef TK_MAC_DEBUG_FONTS
TkMacOSXDbgMsg("measure: '%.*s', maxLength=%d, flags=%s%s%s%s "
- "-> width=%d, bytes=%d",
- rangeLength, source+rangeStart, maxLength,
+ "-> width=%d, bytes=%d",
+ rangeLength, source+rangeStart, maxLength,
flags & TK_PARTIAL_OK ? "partialOk " : "",
flags & TK_WHOLE_WORDS ? "wholeWords " : "",
flags & TK_AT_LEAST_ONE ? "atLeastOne " : "",
flags & TK_ISOLATE_END ? "isolateEnd " : "",
- curX, curByte);
+ curX, curByte);
#endif
*lengthPtr = curX;
@@ -2284,8 +2284,7 @@ TkMacOSXInitControlFontStyle(
* disabling of antialiased text from tcl.
* The possible values for this variable are:
*
- * -1 - Use system default as configurable in "System Preferences" ->
- * "General".
+ * -1 - Use system default as configurable in "System Prefs" -> "General".
* 0 - Unconditionally disable antialiasing.
* 1 - Unconditionally enable antialiasing.
*
diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c
index 46cdf5d..da7ce64 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.37 2007/04/23 21:24:33 das Exp $
+ * RCS: @(#) $Id: tkMacOSXMenu.c,v 1.38 2007/05/30 06:35:55 das Exp $
*/
#include "tkMacOSXInt.h"
@@ -2699,21 +2699,16 @@ DrawMenuSeparator(
int width, /* width of entry */
int height) /* height of entry */
{
- CGrafPtr destPort, savePort;
- Boolean portChanged;
+ TkMacOSXDrawingContext dc;
Rect r;
- destPort = TkMacOSXGetDrawablePort(d);
- portChanged = QDSwapPort(destPort, &savePort);
- TkMacOSXSetUpClippingRgn(d);
r.top = y;
r.left = x;
r.bottom = y + height;
r.right = x + width;
- DrawThemeMenuSeparator(&r);
- if (portChanged) {
- QDSwapPort(savePort, NULL);
- }
+ TkMacOSXSetupDrawingContext(d, gc, 1, &dc);
+ ChkErr(DrawThemeMenuSeparator, &r);
+ TkMacOSXRestoreDrawingContext(&dc);
}
#ifdef USE_TK_MDEF
diff --git a/macosx/tkMacOSXRegion.c b/macosx/tkMacOSXRegion.c
index 1e51343..1206d5b 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.6 2007/04/23 21:24:34 das Exp $
+ * RCS: @(#) $Id: tkMacOSXRegion.c,v 1.7 2007/05/30 06:35:55 das Exp $
*/
#include "tkMacOSXInt.h"
@@ -36,9 +36,7 @@
TkRegion
TkCreateRegion(void)
{
- RgnHandle rgn;
- rgn = NewRgn();
- return (TkRegion) rgn;
+ return (TkRegion) NewRgn();
}
/*
@@ -62,8 +60,7 @@ void
TkDestroyRegion(
TkRegion r)
{
- RgnHandle rgn = (RgnHandle) r;
- DisposeRgn(rgn);
+ DisposeRgn((RgnHandle) r);
}
/*
@@ -89,10 +86,33 @@ TkIntersectRegion(
TkRegion srb,
TkRegion dr_return)
{
- RgnHandle srcRgnA = (RgnHandle) sra;
- RgnHandle srcRgnB = (RgnHandle) srb;
- RgnHandle destRgn = (RgnHandle) dr_return;
- SectRgn(srcRgnA, srcRgnB, destRgn);
+ SectRgn((RgnHandle) sra, (RgnHandle) srb, (RgnHandle) dr_return);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * TkSubtractRegion --
+ *
+ * Implements the equivilent of the X window function
+ * XSubtractRegion. See X window documentation for more details.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkSubtractRegion(
+ TkRegion sra,
+ TkRegion srb,
+ TkRegion dr_return)
+{
+ DiffRgn((RgnHandle) sra, (RgnHandle) srb, (RgnHandle) dr_return);
}
/*
@@ -119,13 +139,11 @@ TkUnionRectWithRegion(
TkRegion src_region,
TkRegion dest_region_return)
{
- RgnHandle srcRgn = (RgnHandle) src_region;
- RgnHandle destRgn = (RgnHandle) dest_region_return;
-
TkMacOSXCheckTmpRgnEmpty(1);
SetRectRgn(tkMacOSXtmpRgn1, rectangle->x, rectangle->y,
rectangle->x + rectangle->width, rectangle->y + rectangle->height);
- UnionRgn(srcRgn, tkMacOSXtmpRgn1, destRgn);
+ UnionRgn((RgnHandle) src_region, tkMacOSXtmpRgn1,
+ (RgnHandle) dest_region_return);
SetEmptyRgn(tkMacOSXtmpRgn1);
}
@@ -154,15 +172,14 @@ TkRectInRegion(
unsigned int width,
unsigned int height)
{
- RgnHandle rgn = (RgnHandle) region;
int result;
TkMacOSXCheckTmpRgnEmpty(1);
SetRectRgn(tkMacOSXtmpRgn1, x, y, x + width, y + height);
- SectRgn(rgn, tkMacOSXtmpRgn1, tkMacOSXtmpRgn1);
+ SectRgn((RgnHandle) region, tkMacOSXtmpRgn1, tkMacOSXtmpRgn1);
if (EmptyRgn(tkMacOSXtmpRgn1)) {
result = RectangleOut;
- } else if (EqualRgn(rgn, tkMacOSXtmpRgn1)) {
+ } else if (EqualRgn((RgnHandle) region, tkMacOSXtmpRgn1)) {
result = RectangleIn;
} else {
result = RectanglePart;
@@ -193,11 +210,9 @@ TkClipBox(
TkRegion r,
XRectangle* rect_return)
{
- RgnHandle rgn = (RgnHandle) r;
- Rect rect;
-
- GetRegionBounds(rgn,&rect);
+ Rect rect;
+ GetRegionBounds((RgnHandle) r,&rect);
rect_return->x = rect.left;
rect_return->y = rect.top;
rect_return->width = rect.right-rect.left;
@@ -207,36 +222,6 @@ TkClipBox(
/*
*----------------------------------------------------------------------
*
- * TkSubtractRegion --
- *
- * Implements the equivilent of the X window function
- * XSubtractRegion. See X window documentation for more details.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkSubtractRegion(
- TkRegion sra,
- TkRegion srb,
- TkRegion dr_return)
-{
- RgnHandle srcRgnA = (RgnHandle) sra;
- RgnHandle srcRgnB = (RgnHandle) srb;
- RgnHandle destRgn = (RgnHandle) dr_return;
-
- DiffRgn(srcRgnA, srcRgnB, destRgn);
-}
-
-/*
- *----------------------------------------------------------------------
- *
* TkpBuildRegionFromAlphaData --
*
* Set up a rectangle of the given region based on the supplied
@@ -293,34 +278,3 @@ TkpBuildRegionFromAlphaData(
dataPtr += lineStride;
}
}
-
-#if 0
-int
-XSetClipRectangles(Display *d, GC gc, int clip_x_origin, int clip_y_origin,
- XRectangle* rectangles, int n, int ordering)
-{
- RgnHandle clipRgn;
-
- if (gc->clip_mask && ((TkpClipMask*)gc->clip_mask)->type
- == TKP_CLIP_REGION) {
- clipRgn = (RgnHandle) ((TkpClipMask*)gc->clip_mask)->value.region;
- SetEmptyRgn(clipRgn);
- } else {
- clipRgn = NewRgn(); /* LEAK! */
- }
-
- TkMacOSXCheckTmpRgnEmpty(1);
- while (n--) {
- int x = clip_x_origin + rectangles->x;
- int y = clip_y_origin + rectangles->y;
-
- SetRectRgn(tkMacOSXtmpRgn1, x, y, x + rectangles->width,
- y + rectangles->height);
- UnionRgn(tkMacOSXtmpRgn1, clipRgn, clipRgn);
- rectangles++;
- }
- SetEmptyRgn(tkMacOSXtmpRgn1);
- TkSetRegion(d, gc, (TkRegion) clipRgn);
- return 1;
-}
-#endif
diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c
index f909800..7ff515c 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.18 2007/05/09 12:55:16 das Exp $
+ * RCS: @(#) $Id: tkMacOSXSubwindows.c,v 1.19 2007/05/30 06:35:55 das Exp $
*/
#include "tkMacOSXInt.h"
@@ -200,7 +200,8 @@ XMapWindow(
if ((macWin->winPtr->wmInfoPtr->macClass == kSheetWindowClass)
&& (macWin->winPtr->wmInfoPtr->master != None)) {
ShowSheetWindow(wRef,
- GetWindowFromPort(TkMacOSXGetDrawablePort(macWin->winPtr->wmInfoPtr->master)));
+ GetWindowFromPort(TkMacOSXGetDrawablePort(
+ macWin->winPtr->wmInfoPtr->master)));
} else {
ShowWindow(wRef);
}
@@ -806,17 +807,16 @@ void
TkMacOSXUpdateClipRgn(
TkWindow *winPtr)
{
- RgnHandle rgn;
- int x, y;
- TkWindow *win2Ptr;
-
if (winPtr == NULL) {
return;
}
if (winPtr->privatePtr && winPtr->privatePtr->flags & TK_CLIP_INVALID) {
+ TkWindow *win2Ptr;
+
if (Tk_IsMapped(winPtr)) {
- rgn = winPtr->privatePtr->aboveClipRgn;
+ int x, y;
+ RgnHandle rgn = winPtr->privatePtr->aboveClipRgn;
/*
* Start with a region defined by the window bounds.
@@ -825,7 +825,7 @@ TkMacOSXUpdateClipRgn(
x = winPtr->privatePtr->xOff;
y = winPtr->privatePtr->yOff;
SetRectRgn(rgn, (short) x, (short) y,
- (short) (winPtr->changes.width + x),
+ (short) (winPtr->changes.width + x),
(short) (winPtr->changes.height + y));
/*
@@ -845,14 +845,12 @@ TkMacOSXUpdateClipRgn(
TkMacOSXUpdateClipRgn(winPtr->parentPtr);
TkMacOSXCheckTmpRgnEmpty(1);
if (winPtr->parentPtr) {
- SectRgn(rgn,
- winPtr->parentPtr->privatePtr->aboveClipRgn, rgn);
+ SectRgn(rgn, winPtr->parentPtr->privatePtr->aboveClipRgn,
+ rgn);
}
-
- win2Ptr = winPtr->nextPtr;
- while (win2Ptr != NULL) {
+ win2Ptr = winPtr;
+ while ((win2Ptr = win2Ptr->nextPtr)) {
if (Tk_IsTopLevel(win2Ptr) || !Tk_IsMapped(win2Ptr)) {
- win2Ptr = win2Ptr->nextPtr;
continue;
}
x = win2Ptr->privatePtr->xOff;
@@ -861,17 +859,13 @@ TkMacOSXUpdateClipRgn(
(short) (win2Ptr->changes.width + x),
(short) (win2Ptr->changes.height + y));
DiffRgn(rgn, tkMacOSXtmpRgn1, rgn);
-
- win2Ptr = win2Ptr->nextPtr;
}
} else if (Tk_IsEmbedded(winPtr)) {
- TkWindow *contWinPtr = TkpGetOtherWindow(winPtr);
-
- if (contWinPtr != NULL) {
- TkMacOSXUpdateClipRgn(contWinPtr);
+ win2Ptr = TkpGetOtherWindow(winPtr);
+ if (win2Ptr) {
+ TkMacOSXUpdateClipRgn(win2Ptr);
TkMacOSXCheckTmpRgnEmpty(1);
- SectRgn(rgn,
- contWinPtr->privatePtr->aboveClipRgn, rgn);
+ SectRgn(rgn, win2Ptr->privatePtr->aboveClipRgn, rgn);
} else if (tkMacOSXEmbedHandler != NULL) {
TkMacOSXCheckTmpRgnEmpty(1);
tkMacOSXEmbedHandler->getClipProc((Tk_Window) winPtr,
@@ -882,21 +876,19 @@ TkMacOSXUpdateClipRgn(
/*
* NOTE: Here we should handle out of process embedding.
*/
-
}
/*
* The final clip region is the aboveClip region (or visible
* region) minus all the children of this window.
- * Alternatively, if the window is a container, we must also
- * subtract the region of the embedded window.
+ * If the window is a container, we must also subtract the region
+ * of the embedded window.
*/
rgn = winPtr->privatePtr->clipRgn;
CopyRgn(winPtr->privatePtr->aboveClipRgn, rgn);
-
win2Ptr = winPtr->childList;
- while (win2Ptr != NULL) {
+ while (win2Ptr) {
if (Tk_IsTopLevel(win2Ptr) || !Tk_IsMapped(win2Ptr)) {
win2Ptr = win2Ptr->nextPtr;
continue;
@@ -907,13 +899,12 @@ TkMacOSXUpdateClipRgn(
(short) (win2Ptr->changes.width + x),
(short) (win2Ptr->changes.height + y));
DiffRgn(rgn, tkMacOSXtmpRgn1, rgn);
-
win2Ptr = win2Ptr->nextPtr;
}
if (Tk_IsContainer(winPtr)) {
win2Ptr = TkpGetOtherWindow(winPtr);
- if (win2Ptr != NULL) {
+ if (win2Ptr) {
if (Tk_IsMapped(win2Ptr)) {
x = win2Ptr->privatePtr->xOff;
y = win2Ptr->privatePtr->yOff;
@@ -940,27 +931,20 @@ TkMacOSXUpdateClipRgn(
if (!Tk_IsTopLevel(winPtr)) {
TkMacOSXUpdateClipRgn(winPtr->parentPtr);
} else if (Tk_IsEmbedded(winPtr)) {
- TkWindow *contWinPtr = TkpGetOtherWindow(winPtr);
-
- if (contWinPtr != NULL) {
- TkMacOSXUpdateClipRgn(contWinPtr);
+ win2Ptr = TkpGetOtherWindow(winPtr);
+ if (win2Ptr) {
+ TkMacOSXUpdateClipRgn(win2Ptr);
}
}
SetEmptyRgn(winPtr->privatePtr->aboveClipRgn);
SetEmptyRgn(winPtr->privatePtr->clipRgn);
}
-
winPtr->privatePtr->flags &= ~TK_CLIP_INVALID;
#ifdef TK_MAC_DEBUG_CLIP_REGIONS
- TkMacOSXInitNamedDebugSymbol(HIToolbox, int, QDDebugFlashRegion,
- CGrafPtr port, RgnHandle region);
- if (QDDebugFlashRegion) {
- MacDrawable *macDraw = (MacDrawable *) winPtr->privatePtr;
- CGrafPtr grafPtr = TkMacOSXGetDrawablePort((Drawable) macDraw);
- /* Carbon-internal region flashing SPI (c.f. Technote 2124) */
- QDDebugFlashRegion(grafPtr, macDraw->clipRgn);
- }
+ TkMacOSXDebugFlashRegion(TkMacOSXGetDrawablePort(
+ (Drawable) winPtr->privatePtr),
+ ((MacDrawable*) winPtr->privatePtr)->clipRgn);
#endif /* TK_MAC_DEBUG_CLIP_REGIONS */
}
@@ -1034,12 +1018,7 @@ TkMacOSXInvalidateWindow(
}
#ifdef TK_MAC_DEBUG_CLIP_REGIONS
- TkMacOSXInitNamedDebugSymbol(HIToolbox, int, QDDebugFlashRegion,
- CGrafPtr port, RgnHandle region);
- if (QDDebugFlashRegion) {
- /* Carbon-internal region flashing SPI (c.f. Technote 2124) */
- QDDebugFlashRegion(grafPtr, macWin->aboveClipRgn);
- }
+ TkMacOSXDebugFlashRegion(grafPtr, macWin->aboveClipRgn);
#endif /* TK_MAC_DEBUG_CLIP_REGIONS */
}
diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c
index 236bfdc..2f7ddd8 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.22 2007/05/09 12:55:16 das Exp $
+ * RCS: @(#) $Id: tkMacOSXWindowEvent.c,v 1.23 2007/05/30 06:35:55 das Exp $
*/
#include "tkMacOSXInt.h"
@@ -76,16 +76,15 @@ static int tkMacOSXAppInFront = true; /* Boolean variable for determining if
* we are the frontmost app. Only set
* in TkMacOSXProcessApplicationEvent
*/
-static RgnHandle gDamageRgn = NULL;
-
/*
* Declaration of functions used only in this file
*/
-static int GenerateUpdateEvent( Window window);
-static int GenerateUpdates( RgnHandle updateRgn, TkWindow *winPtr);
-static int GenerateActivateEvents( Window window, int activeFlag);
-static void ClearPort(CGrafPtr port);
+static int GenerateUpdateEvent(Window window);
+static int GenerateUpdates(RgnHandle updateRgn, Rect *updateBounds,
+ TkWindow *winPtr);
+static int GenerateActivateEvents(Window window, int activeFlag);
+static void ClearPort(CGrafPtr port, RgnHandle updateRgn);
/*
@@ -411,7 +410,7 @@ TkMacOSXProcessWindowEvent(
CGrafPtr port;
GetPort(&port);
- ClearPort(port);
+ ClearPort(port, NULL);
}
break;
}
@@ -438,11 +437,12 @@ TkMacOSXProcessWindowEvent(
static int
GenerateUpdateEvent(Window window)
{
- CGrafPtr destPort;
- WindowRef macWindow;
- TkDisplay * dispPtr;
- TkWindow * winPtr;
- int result = 0;
+ CGrafPtr destPort;
+ WindowRef macWindow;
+ TkDisplay *dispPtr;
+ TkWindow *winPtr;
+ int result = 0;
+ Rect updateBounds;
dispPtr = TkGetDisplayList();
winPtr = (TkWindow *)Tk_IdToWindow(dispPtr->display, window);
@@ -450,31 +450,23 @@ GenerateUpdateEvent(Window window)
if (winPtr ==NULL ){
return result;
}
- if (gDamageRgn == NULL) {
- gDamageRgn = NewRgn();
- }
TkMacOSXCheckTmpRgnEmpty(1);
destPort = TkMacOSXGetDrawablePort(window);
macWindow = GetWindowFromPort(destPort);
GetWindowRegion(macWindow, kWindowUpdateRgn, tkMacOSXtmpRgn1);
QDGlobalToLocalRegion(destPort, tkMacOSXtmpRgn1);
SectRegionWithPortVisibleRegion(destPort, tkMacOSXtmpRgn1);
+ GetRegionBounds(tkMacOSXtmpRgn1, &updateBounds);
#ifdef TK_MAC_DEBUG_CLIP_REGIONS
- TkMacOSXInitNamedDebugSymbol(HIToolbox, int, QDDebugFlashRegion,
- CGrafPtr port, RgnHandle region);
- if (QDDebugFlashRegion) {
- /* Carbon-internal region flashing SPI (c.f. Technote 2124) */
- QDDebugFlashRegion(destPort, tkMacOSXtmpRgn1);
- }
+ TkMacOSXDebugFlashRegion(destPort, tkMacOSXtmpRgn1);
#endif /* TK_MAC_DEBUG_CLIP_REGIONS */
BeginUpdate(macWindow);
if (winPtr->wmInfoPtr->flags & WM_TRANSPARENT) {
- ClearPort(destPort);
+ ClearPort(destPort, tkMacOSXtmpRgn1);
}
- result = GenerateUpdates(tkMacOSXtmpRgn1, winPtr);
+ result = GenerateUpdates(tkMacOSXtmpRgn1, &updateBounds, winPtr);
EndUpdate(macWindow);
SetEmptyRgn(tkMacOSXtmpRgn1);
- SetEmptyRgn(gDamageRgn);
return result;
}
@@ -500,51 +492,48 @@ GenerateUpdateEvent(Window window)
static int
GenerateUpdates(
RgnHandle updateRgn,
+ Rect *updateBounds,
TkWindow *winPtr)
{
TkWindow *childPtr;
XEvent event;
- Rect bounds, updateBounds, damageBounds;
+ Rect bounds, damageBounds;
+ static RgnHandle damageRgn = NULL;
TkMacOSXWinBounds(winPtr, &bounds);
- GetRegionBounds(updateRgn,&updateBounds);
-
- if (bounds.top > updateBounds.bottom ||
- updateBounds.top > bounds.bottom ||
- bounds.left > updateBounds.right ||
- updateBounds.left > bounds.right ||
- !RectInRgn(&bounds, updateRgn)) {
+ if (bounds.top > updateBounds->bottom ||
+ updateBounds->top > bounds.bottom ||
+ bounds.left > updateBounds->right ||
+ updateBounds->left > bounds.right) {
return 0;
}
if (!RectInRgn(&bounds, updateRgn)) {
return 0;
}
+ /*
+ * Compute the bounding box of the area that the damage occured in.
+ */
+
+ if (damageRgn == NULL) {
+ damageRgn = NewRgn();
+ }
+ RectRgn(damageRgn, &bounds);
+ SectRgn(damageRgn, updateRgn, damageRgn);
+ OffsetRgn(damageRgn, -bounds.left, -bounds.top);
+ GetRegionBounds(damageRgn, &damageBounds);
+ SetEmptyRgn(damageRgn);
+
event.xany.serial = Tk_Display(winPtr)->request;
event.xany.send_event = false;
event.xany.window = Tk_WindowId(winPtr);
event.xany.display = Tk_Display(winPtr);
-
event.type = Expose;
-
- /*
- * Compute the bounding box of the area that the damage occured in.
- */
-
- /*
- * CopyRgn(TkMacOSXVisableClipRgn(winPtr), rgn);
- * TODO: this call doesn't work doing resizes!!!
- */
- RectRgn(gDamageRgn, &bounds);
- SectRgn(gDamageRgn, updateRgn, gDamageRgn);
- OffsetRgn(gDamageRgn, -bounds.left, -bounds.top);
- GetRegionBounds(gDamageRgn,&damageBounds);
event.xexpose.x = damageBounds.left;
event.xexpose.y = damageBounds.top;
event.xexpose.width = damageBounds.right-damageBounds.left;
event.xexpose.height = damageBounds.bottom-damageBounds.top;
event.xexpose.count = 0;
-
Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
/*
@@ -552,12 +541,11 @@ GenerateUpdates(
*/
for (childPtr = winPtr->childList; childPtr != NULL;
- childPtr = childPtr->nextPtr) {
+ childPtr = childPtr->nextPtr) {
if (!Tk_IsMapped(childPtr) || Tk_IsTopLevel(childPtr)) {
continue;
}
-
- GenerateUpdates(updateRgn, childPtr);
+ GenerateUpdates(updateRgn, updateBounds, childPtr);
}
/*
@@ -567,7 +555,7 @@ GenerateUpdates(
if (Tk_IsContainer(winPtr)) {
childPtr = TkpGetOtherWindow(winPtr);
if (childPtr != NULL && Tk_IsMapped(childPtr)) {
- GenerateUpdates(updateRgn, childPtr);
+ GenerateUpdates(updateRgn, updateBounds, childPtr);
}
/*
@@ -922,7 +910,7 @@ TkWmProtocolEventProc(
*/
int
-Tk_MacOSXIsAppInFront (void)
+Tk_MacOSXIsAppInFront(void)
{
return tkMacOSXAppInFront;
}
@@ -943,13 +931,19 @@ Tk_MacOSXIsAppInFront (void)
*----------------------------------------------------------------------
*/
static void
-ClearPort(CGrafPtr port) {
+ClearPort(
+ CGrafPtr port,
+ RgnHandle updateRgn)
+{
CGContextRef context;
Rect bounds;
CGRect rect;
GetPortBounds(port, &bounds);
QDBeginCGContext(port, &context);
+ if (updateRgn) {
+ ClipCGContextToRegion(context, &bounds, updateRgn);
+ }
rect = CGRectMake(0, 0, bounds.right, bounds.bottom);
CGContextClearRect(context, rect);
QDEndCGContext(port, &context);
diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c
index b344f04..cb5d49b 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.49 2007/04/23 21:24:34 das Exp $
+ * RCS: @(#) $Id: tkMacOSXWm.c,v 1.50 2007/05/30 06:35:55 das Exp $
*/
#include "tkMacOSXInt.h"
@@ -5211,7 +5211,7 @@ TkMacOSXMakeRealWindowExist(
if (wmPtr->attributes & kWindowResizableAttribute) {
HIViewRef growBoxView;
- err = ChkErr(HIViewFindByID, HIViewGetRoot(newWindow),
+ err = HIViewFindByID(HIViewGetRoot(newWindow),
kHIViewWindowGrowBoxID, &growBoxView);
if (err == noErr && !HIGrowBoxViewIsTransparent(growBoxView)) {
ChkErr(HIGrowBoxViewSetTransparent, growBoxView, true);
@@ -5855,14 +5855,15 @@ ApplyWindowClassAttributeChanges(
oldAttributes & (newAttributes ^ oldAttributes));
}
ChkErr(GetWindowAttributes, macWindow, &(wmPtr->attributes));
- if (wmPtr->attributes & kWindowResizableAttribute) {
- OSStatus err;
- HIViewRef growBoxView;
+ if ((wmPtr->attributes ^ oldAttributes) & kWindowResizableAttribute) {
+ if (wmPtr->attributes & kWindowResizableAttribute) {
+ HIViewRef growBoxView;
+ OSStatus err = HIViewFindByID(HIViewGetRoot(macWindow),
+ kHIViewWindowGrowBoxID, &growBoxView);
- err = ChkErr(HIViewFindByID, HIViewGetRoot(macWindow),
- kHIViewWindowGrowBoxID, &growBoxView);
- if (err == noErr && !HIGrowBoxViewIsTransparent(growBoxView)) {
- ChkErr(HIGrowBoxViewSetTransparent, growBoxView, true);
+ if (err == noErr && !HIGrowBoxViewIsTransparent(growBoxView)) {
+ ChkErr(HIGrowBoxViewSetTransparent, growBoxView, true);
+ }
}
}
diff --git a/macosx/tkMacOSXXStubs.c b/macosx/tkMacOSXXStubs.c
index 32886ce..3b5e50a 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.17 2007/04/23 21:24:34 das Exp $
+ * RCS: @(#) $Id: tkMacOSXXStubs.c,v 1.18 2007/05/30 06:35:55 das Exp $
*/
#include "tkMacOSXInt.h"
@@ -780,7 +780,7 @@ XForceScreenSaver(
}
void
-Tk_FreeXId (
+Tk_FreeXId(
Display *display,
XID xid)
{
@@ -788,12 +788,48 @@ Tk_FreeXId (
}
int
-XSync (Display *display, Bool flag)
+XSync(
+ Display *display,
+ Bool flag)
{
TkMacOSXFlushWindows();
display->request++;
return 0;
}
+
+#if 0
+int
+XSetClipRectangles(
+ Display *d,
+ GC gc,
+ int clip_x_origin,
+ int clip_y_origin,
+ XRectangle* rectangles,
+ int n,
+ int ordering)
+{
+ TkRegion clipRgn;
+
+ if (gc->clip_mask && ((TkpClipMask*)gc->clip_mask)->type
+ == TKP_CLIP_REGION) {
+ clipRgn = ((TkpClipMask*)gc->clip_mask)->value.region;
+ SetEmptyRgn((RgnHandle) clipRgn);
+ } else {
+ clipRgn = TkCreateRegion(); /* LEAK! */
+ }
+
+ while (n--) {
+ XRectangle rect = *rectangles;
+
+ rect.x += clip_x_origin;
+ rect.y += clip_y_origin;
+ TkUnionRectWithRegion(&rect, clipRgn, clipRgn);
+ rectangles++;
+ }
+ TkSetRegion(d, gc, clipRgn);
+ return 1;
+}
+#endif
/*
*----------------------------------------------------------------------
diff --git a/xlib/xgc.c b/xlib/xgc.c
index 307617f..6f96df8 100644
--- a/xlib/xgc.c
+++ b/xlib/xgc.c
@@ -9,19 +9,19 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: xgc.c,v 1.11 2007/01/03 08:22:08 das Exp $
+ * RCS: @(#) $Id: xgc.c,v 1.12 2007/05/30 06:35:55 das Exp $
*/
#include <tkInt.h>
#if !defined(MAC_OSX_TK)
-# include <X11/Xlib.h>
+# include <X11/Xlib.h>
#endif
#ifdef MAC_OSX_TK
-# include <X11/Xlib.h>
-# include <X11/X.h>
-# define Cursor XCursor
-# define Region XRegion
+# include <X11/Xlib.h>
+# include <X11/X.h>
+# define Cursor XCursor
+# define Region XRegion
#endif
/*
@@ -342,8 +342,9 @@ XSetClipOrigin(
* Sets the clipping region/pixmap for a GC.
*
* Note that unlike the Xlib equivalent, it is not safe to delete the
- * region after setting it into the GC. The only use of TkSetRegion is
- * currently in ImgPhotoDisplay, which uses the GC immediately.
+ * region after setting it into the GC. The only uses of TkSetRegion
+ * are currently in DisplayFrame and in ImgPhotoDisplay, which use the
+ * GC immediately.
*
* Results:
* None.
@@ -360,6 +361,8 @@ TkSetRegion(
GC gc,
TkRegion r)
{
+ TkpClipMask *clip_mask;
+
if (r == None) {
if (gc->clip_mask) {
ckfree((char*) gc->clip_mask);
@@ -371,8 +374,9 @@ TkSetRegion(
if (gc->clip_mask == None) {
gc->clip_mask = (Pixmap)ckalloc(sizeof(TkpClipMask));
}
- ((TkpClipMask*) gc->clip_mask)->type = TKP_CLIP_REGION;
- ((TkpClipMask*) gc->clip_mask)->value.region = r;
+ clip_mask = (TkpClipMask*) gc->clip_mask;
+ clip_mask->type = TKP_CLIP_REGION;
+ clip_mask->value.region = r;
}
void
@@ -381,6 +385,8 @@ XSetClipMask(
GC gc,
Pixmap pixmap)
{
+ TkpClipMask *clip_mask;
+
if (pixmap == None) {
if (gc->clip_mask) {
ckfree((char*) gc->clip_mask);
@@ -392,8 +398,9 @@ XSetClipMask(
if (gc->clip_mask == None) {
gc->clip_mask = (Pixmap)ckalloc(sizeof(TkpClipMask));
}
- ((TkpClipMask*) gc->clip_mask)->type = TKP_CLIP_PIXMAP;
- ((TkpClipMask*) gc->clip_mask)->value.pixmap = pixmap;
+ clip_mask = (TkpClipMask*) gc->clip_mask;
+ clip_mask->type = TKP_CLIP_PIXMAP;
+ clip_mask->value.pixmap = pixmap;
}
/*