summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authorculler <culler>2018-10-21 22:53:22 (GMT)
committerculler <culler>2018-10-21 22:53:22 (GMT)
commitcbe1934ea6df107ca09461c85ca4a85975d492e8 (patch)
treec4a76ca22926a5a1b883b8f1905f921386ee347c /macosx
parent8ea711d0aea88cecedd9fe9f32436e376da780ee (diff)
downloadtk-cbe1934ea6df107ca09461c85ca4a85975d492e8.zip
tk-cbe1934ea6df107ca09461c85ca4a85975d492e8.tar.gz
tk-cbe1934ea6df107ca09461c85ca4a85975d492e8.tar.bz2
Add a runtime check for the OS version, to decide whether to process idle events in drawRect.
Diffstat (limited to 'macosx')
-rw-r--r--macosx/tkMacOSXInit.c13
-rw-r--r--macosx/tkMacOSXPrivate.h4
-rw-r--r--macosx/tkMacOSXWindowEvent.c8
-rw-r--r--macosx/tkMacOSXWm.c2
4 files changed, 23 insertions, 4 deletions
diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c
index e03b5aa..c12c394 100644
--- a/macosx/tkMacOSXInit.c
+++ b/macosx/tkMacOSXInit.c
@@ -153,6 +153,19 @@ long tkMacOSXMacOSXVersion = 0;
[NSApp setPoolLock:0];
/*
+ * Record the OS version we are running on.
+ */
+ int minorVersion;
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 1080
+ Gestalt(gestaltSystemVersionMinor, (SInt32*)&minorVersion);
+#else
+ NSOperatingSystemVersion systemVersion;
+ systemVersion = [[NSProcessInfo processInfo] operatingSystemVersion];
+ minorVersion = systemVersion.minorVersion;
+#endif
+ [NSApp setMacMinorVersion: minorVersion];
+
+ /*
* Be our own delegate.
*/
[self setDelegate:self];
diff --git a/macosx/tkMacOSXPrivate.h b/macosx/tkMacOSXPrivate.h
index 796b4db..7337400 100644
--- a/macosx/tkMacOSXPrivate.h
+++ b/macosx/tkMacOSXPrivate.h
@@ -265,9 +265,11 @@ VISIBILITY_HIDDEN
#ifdef __i386__
/* The Objective C runtime used on i386 requires this. */
int _poolLock;
+ int _macMinorVersion;
#endif
}
@property int poolLock;
+@property int macMinorVersion;
@end
@interface TKApplication(TKInit)
@@ -344,7 +346,7 @@ VISIBILITY_HIDDEN
@end
@interface NSWindow(TKWm)
-#if MAC_OS_X_VERSION_MIN_REQUIRED < 1012
+#if MAC_OS_X_VERSION_MIN_REQUIRED < 101400
- (NSPoint) convertPointToScreen:(NSPoint)point;
- (NSPoint) convertPointFromScreen:(NSPoint)point;
#endif
diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c
index 36fc297..379e4a6 100644
--- a/macosx/tkMacOSXWindowEvent.c
+++ b/macosx/tkMacOSXWindowEvent.c
@@ -930,10 +930,14 @@ ConfigureRestrictProc(
*
* Fortunately, Tk schedules all drawing to be done while Tcl is idle.
* So we can do the drawing by processing all of the idle events that
- * were created when the expose events were processed.
+ * were created when the expose events were processed. Unfortunately,
+ * doing this on 10.13 or earlier causes hangs when drawRect is called
+ * while Tcl is waiting for events or variable changes.
*/
- while (Tcl_DoOneEvent(TCL_IDLE_EVENTS)) {}
+ if ([NSApp macMinorVersion] > 13 || [self inLiveResize]) {
+ while (Tcl_DoOneEvent(TCL_IDLE_EVENTS)) {}
+ }
}
}
diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c
index 9b76066..8bbaae0 100644
--- a/macosx/tkMacOSXWm.c
+++ b/macosx/tkMacOSXWm.c
@@ -212,7 +212,7 @@ static int windowHashInit = false;
{
return [self convertScreenToBase:point];
}
-#elif MAC_OS_X_VERSION_MIN_REQUIRED < 1012
+#elif MAC_OS_X_VERSION_MIN_REQUIRED < 101400
- (NSPoint) convertPointToScreen: (NSPoint) point
{
NSRect pointrect;