summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordas <das>2007-05-30 06:39:37 (GMT)
committerdas <das>2007-05-30 06:39:37 (GMT)
commit354d7ea3b9178402bf28ae063c5e62f647f7d087 (patch)
treebbd79c7a2b425288ac6c592cd05b8613c3dbdfd7
parent48d6dbc41b0b9cd9e07d7ad699bd0e90a90424c7 (diff)
downloadtk-354d7ea3b9178402bf28ae063c5e62f647f7d087.zip
tk-354d7ea3b9178402bf28ae063c5e62f647f7d087.tar.gz
tk-354d7ea3b9178402bf28ae063c5e62f647f7d087.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:
-rw-r--r--ChangeLog29
-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/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.c24
12 files changed, 275 insertions, 275 deletions
diff --git a/ChangeLog b/ChangeLog
index 767928a..eb1e8d7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,32 @@
+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.
+
+ * generic/tkFileFilter.c (AddClause): fix warning.
+
+ * 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:
+
2007-05-25 Don Porter <dgp@users.sourceforge.net>
*** 8.4.15 TAGGED FOR RELEASE ***
diff --git a/macosx/tkMacOSXDebug.c b/macosx/tkMacOSXDebug.c
index 9f53276..fccc8bb 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.2.2.11 2007/04/29 02:26:48 das Exp $
+ * RCS: @(#) $Id: tkMacOSXDebug.c,v 1.2.2.12 2007/05/30 06:39:37 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 56a9631..b25d3d9 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.2.2.8 2007/04/29 02:26:48 das Exp $
+ * RCS: @(#) $Id: tkMacOSXDebug.h,v 1.2.2.9 2007/05/30 06:39:37 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 2f8464b..6d1d064 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.2.2.21 2007/04/29 02:26:48 das Exp $
+ * RCS: @(#) $Id: tkMacOSXDraw.c,v 1.2.2.22 2007/05/30 06:39:38 das Exp $
*/
#include "tkMacOSXInt.h"
@@ -163,9 +163,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);
@@ -209,42 +207,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);
@@ -310,13 +302,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 {
@@ -425,14 +416,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 {
@@ -1598,8 +1587,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;
@@ -1633,14 +1625,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);
@@ -1657,6 +1649,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
@@ -1671,8 +1664,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);
@@ -1685,21 +1676,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,
@@ -1769,17 +1764,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);
@@ -1867,17 +1862,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 960c676..be7ba56 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.3.2.10 2007/04/29 02:26:49 das Exp $
+ * RCS: @(#) $Id: tkMacOSXEvent.c,v 1.3.2.11 2007/05/30 06:39:38 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/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c
index 9c79ffc..5728d9e 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.6.2.24 2007/04/29 02:26:49 das Exp $
+ * RCS: @(#) $Id: tkMacOSXMenu.c,v 1.6.2.25 2007/05/30 06:39:38 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 c64a45d..8bf2a6f 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.2.2.3 2007/04/29 02:26:50 das Exp $
+ * RCS: @(#) $Id: tkMacOSXRegion.c,v 1.2.2.4 2007/05/30 06:39:38 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,74 +210,11 @@ 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;
rect_return->height = rect.bottom-rect.top;
}
-
-/*
- *----------------------------------------------------------------------
- *
- * 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);
-}
-
-#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 564ad77..21ecce7 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.2.2.15 2007/05/09 12:57:47 das Exp $
+ * RCS: @(#) $Id: tkMacOSXSubwindows.c,v 1.2.2.16 2007/05/30 06:39:38 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 2002739..69c8ebb 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.3.2.19 2007/05/09 12:57:47 das Exp $
+ * RCS: @(#) $Id: tkMacOSXWindowEvent.c,v 1.3.2.20 2007/05/30 06:39:38 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 799af66..478dc7c 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.7.2.36 2007/04/29 02:26:50 das Exp $
+ * RCS: @(#) $Id: tkMacOSXWm.c,v 1.7.2.37 2007/05/30 06:39:38 das Exp $
*/
#include "tkMacOSXInt.h"
@@ -5217,7 +5217,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);
@@ -5861,14 +5861,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 6891a3d..a217593 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.2.2.14 2007/04/29 02:26:51 das Exp $
+ * RCS: @(#) $Id: tkMacOSXXStubs.c,v 1.2.2.15 2007/05/30 06:39:39 das Exp $
*/
#include "tkMacOSXInt.h"
@@ -778,7 +778,7 @@ XForceScreenSaver(
}
void
-Tk_FreeXId (
+Tk_FreeXId(
Display *display,
XID xid)
{
@@ -786,12 +786,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 17a86c7..f2aeb2f 100644
--- a/xlib/xgc.c
+++ b/xlib/xgc.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: xgc.c,v 1.6.2.2 2005/11/27 02:44:26 das Exp $
+ * RCS: @(#) $Id: xgc.c,v 1.6.2.3 2007/05/30 06:39:39 das Exp $
*/
#include <tkInt.h>
@@ -338,10 +338,10 @@ XSetClipOrigin(display, gc, clip_x_origin, clip_y_origin)
*
* 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.
+ * Note that unlike the Xlib equivalent, it is not safe to delete the
+ * 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.
@@ -358,6 +358,8 @@ TkSetRegion(display, gc, r)
GC gc;
TkRegion r;
{
+ TkpClipMask *clip_mask;
+
if (r == None) {
if (gc->clip_mask) {
ckfree((char*) gc->clip_mask);
@@ -369,8 +371,9 @@ TkSetRegion(display, gc, r)
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
@@ -379,6 +382,8 @@ XSetClipMask(display, gc, pixmap)
GC gc;
Pixmap pixmap;
{
+ TkpClipMask *clip_mask;
+
if (pixmap == None) {
if (gc->clip_mask) {
ckfree((char*) gc->clip_mask);
@@ -390,8 +395,9 @@ XSetClipMask(display, gc, pixmap)
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;
}
/*