summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXTest.c
diff options
context:
space:
mode:
authormarc_culler <marc.culler@gmail.com>2020-07-18 18:11:23 (GMT)
committermarc_culler <marc.culler@gmail.com>2020-07-18 18:11:23 (GMT)
commit135c69972e594686104a8cda1c028c0b46e0f938 (patch)
tree7bf68d0717cbe89738dba62d8df01fd95d34cba9 /macosx/tkMacOSXTest.c
parent3954d71d18d5d5aa61f21d4137726beb13a0047c (diff)
parentb63b41199525b0e3e0e95f65e6991f75f8e31dd5 (diff)
downloadtk-135c69972e594686104a8cda1c028c0b46e0f938.zip
tk-135c69972e594686104a8cda1c028c0b46e0f938.tar.gz
tk-135c69972e594686104a8cda1c028c0b46e0f938.tar.bz2
Merge 8.6
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 09dc0b9..5358bc2 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];
}