summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
Diffstat (limited to 'macosx')
-rw-r--r--macosx/tkMacOSXDialog.c2
-rw-r--r--macosx/tkMacOSXDraw.c16
-rw-r--r--macosx/tkMacOSXInit.c6
-rw-r--r--macosx/tkMacOSXNotify.c3
-rw-r--r--macosx/tkMacOSXSubwindows.c3
-rw-r--r--macosx/tkMacOSXWm.c46
-rw-r--r--macosx/tkMacOSXXStubs.c7
7 files changed, 63 insertions, 20 deletions
diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c
index ca17195..0889ee5 100644
--- a/macosx/tkMacOSXDialog.c
+++ b/macosx/tkMacOSXDialog.c
@@ -1161,7 +1161,7 @@ Tk_MessageBoxObjCmd(
[NSApp tkAlertDidEnd:alert returnCode:modalReturnCode
contextInfo:callbackInfo];
}
- result = (modalReturnCode < 1) ? TCL_OK : TCL_ERROR;
+ result = (modalReturnCode >= NSAlertFirstButtonReturn) ? TCL_OK : TCL_ERROR;
end:
[alert release];
return result;
diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c
index ed8c428..bcc7afe 100644
--- a/macosx/tkMacOSXDraw.c
+++ b/macosx/tkMacOSXDraw.c
@@ -138,6 +138,7 @@ BitmapRepFromDrawableRect(
CGImageRef cg_image=NULL, sub_cg_image=NULL;
NSBitmapImageRep *bitmap_rep=NULL;
NSView *view=NULL;
+ NSAutoreleasePool *pool = [NSAutoreleasePool new];
if ( mac_drawable->flags & TK_IS_PIXMAP ) {
/*
This means that the MacDrawable is functioning as a Tk Pixmap, so its view
@@ -174,6 +175,7 @@ BitmapRepFromDrawableRect(
} else {
TkMacOSXDbgMsg("Invalid source drawable");
}
+ [pool drain];
return bitmap_rep;
}
@@ -1568,7 +1570,6 @@ TkScrollWindow(
/* Belt and suspenders: make the AppKit request a redraw
when it gets control again. */
- [view setNeedsDisplay:YES];
}
} else {
dmgRgn = HIShapeCreateEmpty();
@@ -1635,6 +1636,7 @@ TkMacOSXSetupDrawingContext(
int dontDraw = 0, isWin = 0;
TkMacOSXDrawingContext dc = {};
CGRect clipBounds;
+ NSAutoreleasePool *pool = [NSAutoreleasePool new];
dc.clipRgn = TkMacOSXGetClipRgn(d);
if (!dontDraw) {
@@ -1765,6 +1767,7 @@ end:
dc.clipRgn = NULL;
}
*dcPtr = dc;
+ [pool drain];
return !dontDraw;
}
@@ -1788,6 +1791,7 @@ void
TkMacOSXRestoreDrawingContext(
TkMacOSXDrawingContext *dcPtr)
{
+ NSAutoreleasePool *pool = [NSAutoreleasePool new];
if (dcPtr->context) {
CGContextSynchronize(dcPtr->context);
[[dcPtr->view window] setViewsNeedDisplay:YES];
@@ -1804,6 +1808,7 @@ TkMacOSXRestoreDrawingContext(
#ifdef TK_MAC_DEBUG
bzero(dcPtr, sizeof(TkMacOSXDrawingContext));
#endif /* TK_MAC_DEBUG */
+ [pool drain];
}
/*
@@ -1829,7 +1834,8 @@ TkMacOSXGetClipRgn(
{
MacDrawable *macDraw = (MacDrawable *) drawable;
HIShapeRef clipRgn = NULL;
-
+ NSAutoreleasePool *pool = [NSAutoreleasePool new];
+
if (macDraw->winPtr && macDraw->flags & TK_CLIP_INVALID) {
TkMacOSXUpdateClipRgn(macDraw->winPtr);
#ifdef TK_MAC_DEBUG_DRAWING
@@ -1854,7 +1860,7 @@ TkMacOSXGetClipRgn(
} else if (macDraw->visRgn) {
clipRgn = HIShapeCreateCopy(macDraw->visRgn);
}
-
+ [pool drain];
return clipRgn;
}
@@ -1907,7 +1913,8 @@ TkpClipDrawableToRect(
{
MacDrawable *macDraw = (MacDrawable *) d;
NSView *view = TkMacOSXDrawableView(macDraw);
-
+ NSAutoreleasePool *pool = [NSAutoreleasePool new];
+
if (macDraw->drawRgn) {
CFRelease(macDraw->drawRgn);
macDraw->drawRgn = NULL;
@@ -1940,6 +1947,7 @@ TkpClipDrawableToRect(
macDraw->flags &= ~TK_FOCUSED_VIEW;
}
}
+ [pool drain];
}
/*
diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c
index e861089..98e6824 100644
--- a/macosx/tkMacOSXInit.c
+++ b/macosx/tkMacOSXInit.c
@@ -253,10 +253,7 @@ TkpInit(
}
#endif
- static NSAutoreleasePool *pool = nil;
- if (!pool) {
- pool = [NSAutoreleasePool new];
- }
+ NSAutoreleasePool *pool = [NSAutoreleasePool new];
[[NSUserDefaults standardUserDefaults] registerDefaults:
[NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:YES],
@@ -327,7 +324,6 @@ TkpInit(
TkMacOSXUseAntialiasedText(interp, -1);
TkMacOSXInitCGDrawing(interp, TRUE, 0);
[pool drain];
- pool = [NSAutoreleasePool new];
/*
* FIXME: Close stdin & stdout for remote debugging otherwise we will
diff --git a/macosx/tkMacOSXNotify.c b/macosx/tkMacOSXNotify.c
index 1d4c6c5..3fe59bd 100644
--- a/macosx/tkMacOSXNotify.c
+++ b/macosx/tkMacOSXNotify.c
@@ -220,7 +220,7 @@ TkMacOSXEventsSetupProc(
if (flags & TCL_WINDOW_EVENTS &&
![[NSRunLoop currentRunLoop] currentMode]) {
static const Tcl_Time zeroBlockTime = { 0, 0 };
-
+ NSAutoreleasePool *pool = [NSAutoreleasePool new];
/* Call this with dequeue=NO -- just checking if the queue is empty. */
NSEvent *currentEvent = [NSApp nextEventMatchingMask:NSAnyEventMask
untilDate:[NSDate distantPast]
@@ -229,6 +229,7 @@ TkMacOSXEventsSetupProc(
if (currentEvent && currentEvent.type > 0) {
Tcl_SetMaxBlockTime(&zeroBlockTime);
}
+ [pool drain];
}
}
diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c
index 72ef39c..d23ba85 100644
--- a/macosx/tkMacOSXSubwindows.c
+++ b/macosx/tkMacOSXSubwindows.c
@@ -318,7 +318,7 @@ XResizeWindow(
unsigned int height)
{
MacDrawable *macWin = (MacDrawable *) window;
-
+ NSAutoreleasePool *pool= [NSAutoreleasePool new];
display->request++;
if (Tk_IsTopLevel(macWin->winPtr) && !Tk_IsEmbedded(macWin->winPtr)) {
NSWindow *w = macWin->winPtr->wmInfoPtr->window;
@@ -333,6 +333,7 @@ XResizeWindow(
} else {
MoveResizeWindow(macWin);
}
+ [pool drain];
}
/*
diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c
index fb58904..5ec38ca 100644
--- a/macosx/tkMacOSXWm.c
+++ b/macosx/tkMacOSXWm.c
@@ -386,6 +386,7 @@ static void RemapWindows(TkWindow *winPtr,
@end
@implementation TKWindow(TKWm)
+
- (BOOL) canBecomeKeyWindow
{
TkWindow *winPtr = TkMacOSXGetTkWindow(self);
@@ -395,16 +396,38 @@ static void RemapWindows(TkWindow *winPtr,
kWindowNoActivatesAttribute)) ? NO : YES;
}
+#if DEBUG_ZOMBIES
- (id) retain
{
-#if DEBUG_ZOMBIES
+ id result = [super retain];
const char *title = [[self title] UTF8String];
- if (title != NULL) {
- printf("Retaining %s with count %lu\n", title, [self retainCount]);
+ if (title == nil) {
+ title = "unnamed window";
}
-#endif
- return [super retain];
+ printf("Retained <%s>. Count is: %lu\n", title, [self retainCount]);
+ return result;
+}
+
+- (id) autorelease
+{
+ id result = [super autorelease];
+ const char *title = [[self title] UTF8String];
+ if (title == nil) {
+ title = "unnamed window";
+ }
+ printf("Autoreleased <%s>. Count is %lu\n", title, [self retainCount]);
+ return result;
+}
+
+- (oneway void) release {
+ const char *title = [[self title] UTF8String];
+ if (title == nil) {
+ title = "unnamed window";
+ }
+ printf("Releasing <%s>. Count is %lu\n", title, [self retainCount]);
+ [super release];
}
+#endif
@end
#pragma mark -
@@ -842,6 +865,15 @@ TkWmDeadWindow(
if (winPtr->window) {
((MacDrawable *) winPtr->window)->view = nil;
}
+#if DEBUG_ZOMBIES
+ {
+ const char *title = [[window title] UTF8String];
+ if (title == nil) {
+ title = "unnamed window";
+ }
+ printf("Closing <%s>. Count is: %lu\n", title, [window retainCount]);
+ }
+#endif
[window release];
wmPtr->window = NULL;
/* Activate the highest window left on the screen. */
@@ -5507,6 +5539,8 @@ TkMacOSXMakeRealWindowExist(
*/
}
+ NSAutoreleasePool *pool = [NSAutoreleasePool new];
+
WindowClass macClass = wmPtr->macClass;
wmPtr->attributes &= (tkAlwaysValidAttributes |
macClassAttrs[macClass].validAttrs);
@@ -5590,6 +5624,8 @@ TkMacOSXMakeRealWindowExist(
TkMacOSXRegisterOffScreenWindow((Window) macWin, window);
macWin->flags |= TK_HOST_EXISTS;
+
+ [pool drain];
}
/*
diff --git a/macosx/tkMacOSXXStubs.c b/macosx/tkMacOSXXStubs.c
index e87bb39..c39d42d 100644
--- a/macosx/tkMacOSXXStubs.c
+++ b/macosx/tkMacOSXXStubs.c
@@ -142,7 +142,7 @@ TkpOpenDisplay(
static NSRect maxBounds = {{0, 0}, {0, 0}};
static char vendor[25] = "";
NSArray *cgVers;
- NSAutoreleasePool *pool;
+
if (gMacDisplay != NULL) {
if (strcmp(gMacDisplay->display->display_name, display_name) == 0) {
@@ -152,6 +152,8 @@ TkpOpenDisplay(
}
}
+ NSAutoreleasePool *pool = [NSAutoreleasePool new];
+
display = ckalloc(sizeof(Display));
screen = ckalloc(sizeof(Screen));
bzero(display, sizeof(Display));
@@ -166,7 +168,6 @@ TkpOpenDisplay(
display->default_screen = 0;
display->display_name = (char *) macScreenName;
- pool = [NSAutoreleasePool new];
cgVers = [[[NSBundle bundleWithIdentifier:@"com.apple.CoreGraphics"]
objectForInfoDictionaryKey:@"CFBundleShortVersionString"]
componentsSeparatedByString:@"."];
@@ -184,7 +185,7 @@ TkpOpenDisplay(
{
int major, minor, patch;
-#if MAC_OS_X_VERSION_MIN_REQUIRED < 1080
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 10100
Gestalt(gestaltSystemVersionMajor, (SInt32*)&major);
Gestalt(gestaltSystemVersionMinor, (SInt32*)&minor);
Gestalt(gestaltSystemVersionBugFix, (SInt32*)&patch);