diff options
author | culler <culler> | 2020-08-19 16:15:22 (GMT) |
---|---|---|
committer | culler <culler> | 2020-08-19 16:15:22 (GMT) |
commit | 682f94fbcea40aea5bdba7feda99af154d48c25a (patch) | |
tree | 7d538fff8682db2bc6cfd079a145b4abe0db2751 /macosx | |
parent | 7cdbb6ae499b0cb38c23d528ff89bba646c52c14 (diff) | |
download | tk-682f94fbcea40aea5bdba7feda99af154d48c25a.zip tk-682f94fbcea40aea5bdba7feda99af154d48c25a.tar.gz tk-682f94fbcea40aea5bdba7feda99af154d48c25a.tar.bz2 |
Make TkpReleaseRegion and TkpRetainRegion static; remove mac-specific code from xgc.c; remove call to XSetClipMask; add debug logging
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/tkMacOSXInt.h | 2 | ||||
-rw-r--r-- | macosx/tkMacOSXRegion.c | 32 | ||||
-rw-r--r-- | macosx/tkMacOSXSubwindows.c | 2 | ||||
-rw-r--r-- | macosx/tkMacOSXXStubs.c | 1 |
4 files changed, 25 insertions, 12 deletions
diff --git a/macosx/tkMacOSXInt.h b/macosx/tkMacOSXInt.h index 89d76ce..6f44014 100644 --- a/macosx/tkMacOSXInt.h +++ b/macosx/tkMacOSXInt.h @@ -197,8 +197,6 @@ MODULE_SCOPE int XSetClipRectangles(Display *d, GC gc, int clip_x_origin, #endif MODULE_SCOPE void TkpClipDrawableToRect(Display *display, Drawable d, int x, int y, int width, int height); -MODULE_SCOPE void TkpRetainRegion(TkRegion r); -MODULE_SCOPE void TkpReleaseRegion(TkRegion r); MODULE_SCOPE void TkpShiftButton(NSButton *button, NSPoint delta); MODULE_SCOPE Bool TkTestLogDisplay(Drawable drawable); MODULE_SCOPE Bool TkMacOSXInDarkMode(Tk_Window tkwin); diff --git a/macosx/tkMacOSXRegion.c b/macosx/tkMacOSXRegion.c index 4baa3e8..00521e8 100644 --- a/macosx/tkMacOSXRegion.c +++ b/macosx/tkMacOSXRegion.c @@ -12,6 +12,16 @@ */ #include "tkMacOSXPrivate.h" +static void RetainRegion(TkRegion r); +static void ReleaseRegion(TkRegion r); + +#ifdef DEBUG +static int totalRegions = 0; +static int totalRegionRetainCount = 0; +#define DebugLog(msg, ...) fprintf(stderr, (msg), ##__VA_ARGS__) +#else +#define DebugLog(msg, ...) +#endif /* @@ -34,7 +44,10 @@ TkRegion TkCreateRegion(void) { - return (TkRegion) HIShapeCreateMutable(); + TkRegion region = (TkRegion) HIShapeCreateMutable(); + DebugLog("Created region: total regions = %d\n", ++totalRegions); + RetainRegion(region); + return region; } /* @@ -59,7 +72,8 @@ TkDestroyRegion( TkRegion r) { if (r) { - CFRelease(r); + DebugLog("Destroyed region: total regions = %d\n", --totalRegions); + ReleaseRegion(r); } return Success; } @@ -320,7 +334,7 @@ TkpBuildRegionFromAlphaData( /* *---------------------------------------------------------------------- * - * TkpRetainRegion -- + * RetainRegion -- * * Increases reference count of region. * @@ -333,17 +347,18 @@ TkpBuildRegionFromAlphaData( *---------------------------------------------------------------------- */ -void -TkpRetainRegion( +static void +RetainRegion( TkRegion r) { CFRetain(r); + DebugLog("Retained region: total count is %d\n", ++totalRegionRetainCount); } /* *---------------------------------------------------------------------- * - * TkpReleaseRegion -- + * ReleaseRegion -- * * Decreases reference count of region. * @@ -356,11 +371,12 @@ TkpRetainRegion( *---------------------------------------------------------------------- */ -void -TkpReleaseRegion( +static void +ReleaseRegion( TkRegion r) { CFRelease(r); + DebugLog("Released region: total count is %d\n", --totalRegionRetainCount); } /* diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c index 899832b..64db1b1 100644 --- a/macosx/tkMacOSXSubwindows.c +++ b/macosx/tkMacOSXSubwindows.c @@ -874,7 +874,7 @@ TkMacOSXUpdateClipRgn( visRgn = TkMacOSXGetNativeRegion(r); ChkErr(HIShapeIntersect, visRgn, rgn, rgn); CFRelease(visRgn); - TkpReleaseRegion(r); + TkDestroyRegion(r); } /* diff --git a/macosx/tkMacOSXXStubs.c b/macosx/tkMacOSXXStubs.c index 00dc028..e685e9f 100644 --- a/macosx/tkMacOSXXStubs.c +++ b/macosx/tkMacOSXXStubs.c @@ -729,7 +729,6 @@ XSetClipRectangles( int ordering) { TkRegion clipRgn = TkCreateRegion(); - XSetClipMask(d, gc, None); while (n--) { XRectangle rect = *rectangles; |