summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXTest.c
diff options
context:
space:
mode:
authorculler <culler>2020-07-16 14:32:06 (GMT)
committerculler <culler>2020-07-16 14:32:06 (GMT)
commitf6c1908879a22fd92cbcd008c9b05bcae14aab7c (patch)
tree57ef6aa44dd07850782a772d7005874745b0c1ab /macosx/tkMacOSXTest.c
parent3a4dab519f8f01cd8d16d28af150bb2b07894b5f (diff)
downloadtk-f6c1908879a22fd92cbcd008c9b05bcae14aab7c.zip
tk-f6c1908879a22fd92cbcd008c9b05bcae14aab7c.tar.gz
tk-f6c1908879a22fd92cbcd008c9b05bcae14aab7c.tar.bz2
Fix stupid error with isDrawing - thanks Christopher, Nicolas and Kevin.
Diffstat (limited to 'macosx/tkMacOSXTest.c')
-rw-r--r--macosx/tkMacOSXTest.c30
1 files changed, 26 insertions, 4 deletions
diff --git a/macosx/tkMacOSXTest.c b/macosx/tkMacOSXTest.c
index a5d1d83..39f50e6 100644
--- a/macosx/tkMacOSXTest.c
+++ b/macosx/tkMacOSXTest.c
@@ -14,6 +14,8 @@
#include "tkMacOSXPrivate.h"
#include "tkMacOSXConstants.h"
+#include "tkMacOSXWm.h"
+
/*
* Forward declarations of procedures defined later in this file:
@@ -108,7 +110,8 @@ DebuggerObjCmd(
* first call will usually not occur inside of drawRect.
*
* Results:
- * On OSX 10.14 and later, returns true if and only if called from
+ * On OSX 10.14 and later, returns true if and only if the NSView of the
+ * drawable is the current focusView, which can only be the case when
* within [NSView drawRect]. On earlier systems returns false if
* and only if called from with [NSView drawRect].
*
@@ -118,9 +121,28 @@ DebuggerObjCmd(
*----------------------------------------------------------------------
*/
MODULE_SCOPE Bool
-TkTestLogDisplay(void) {
- if ([NSApp macOSVersion] >= 101400) {
- return [NSApp isDrawing];
+TkTestLogDisplay(
+ Drawable drawable)
+{
+ MacDrawable *macWin = (MacDrawable *) drawable;
+ NSWindow *win = nil;
+ if (macWin->toplevel && macWin->toplevel->winPtr &&
+ macWin->toplevel->winPtr->wmInfoPtr &&
+ macWin->toplevel->winPtr->wmInfoPtr->window) {
+ win = macWin->toplevel->winPtr->wmInfoPtr->window;
+ } else if (macWin->winPtr && macWin->winPtr->wmInfoPtr &&
+ macWin->winPtr->wmInfoPtr->window) {
+ win = macWin->winPtr->wmInfoPtr->window;
+ }/*
+ else if (macWin->toplevel && (macWin->toplevel->flags & TK_EMBEDDED)) {
+ TkWindow *contWinPtr = TkpGetOtherWindow(macWin->toplevel->winPtr);
+ if (contWinPtr) {
+ win = TkMacOSXDrawableWindow((Drawable) contWinPtr->privatePtr);
+ }
+ }*/
+ if (win && [NSApp macOSVersion] >= 101400) {
+ TKContentView *view = [win contentView];
+ return (view == [NSView focusView]);
} else {
return ![NSApp isDrawing];
}