summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tkTest.c11
-rw-r--r--macosx/tkMacOSXDraw.c8
-rw-r--r--macosx/tkMacOSXEvent.c5
-rw-r--r--macosx/tkMacOSXInit.c5
-rw-r--r--macosx/tkMacOSXInt.h2
-rw-r--r--macosx/tkMacOSXPrivate.h2
-rw-r--r--macosx/tkMacOSXTest.c20
-rw-r--r--macosx/tkMacOSXWindowEvent.c4
8 files changed, 19 insertions, 38 deletions
diff --git a/generic/tkTest.c b/generic/tkTest.c
index 5609391..6712017 100644
--- a/generic/tkTest.c
+++ b/generic/tkTest.c
@@ -31,9 +31,9 @@
#if defined(MAC_OSX_TK)
#include "tkMacOSXInt.h"
#include "tkScrollbar.h"
-#define SIMULATE_DRAWING TkTestSimulateDrawing(true);
+#define APP_IS_DRAWING TkTestAppIsDrawing()
#else
-#define SIMULATE_DRAWING
+#define APP_IS_DRAWING 0
#endif
#ifdef __UNIX__
@@ -1572,8 +1572,10 @@ ImageDisplay(
sprintf(buffer, "%s display %d %d %d %d",
instPtr->masterPtr->imageName, imageX, imageY, width, height);
- Tcl_SetVar2(instPtr->masterPtr->interp, instPtr->masterPtr->varName, NULL,
- buffer, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
+ if (!APP_IS_DRAWING) {
+ Tcl_SetVar2(instPtr->masterPtr->interp, instPtr->masterPtr->varName,
+ NULL, buffer, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT);
+ }
if (width > (instPtr->masterPtr->width - imageX)) {
width = instPtr->masterPtr->width - imageX;
}
@@ -1581,7 +1583,6 @@ ImageDisplay(
height = instPtr->masterPtr->height - imageY;
}
- SIMULATE_DRAWING
XDrawRectangle(display, drawable, instPtr->gc, drawableX, drawableY,
(unsigned) (width-1), (unsigned) (height-1));
XDrawLine(display, drawable, instPtr->gc, drawableX, drawableY,
diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c
index 984e2e5..faad137 100644
--- a/macosx/tkMacOSXDraw.c
+++ b/macosx/tkMacOSXDraw.c
@@ -1496,14 +1496,6 @@ TkMacOSXSetupDrawingContext(
CGRect clipBounds;
/*
- * If we are simulating drawing for tests, just return false.
- */
-
- if ([NSApp simulateDrawing]) {
- return false;
- }
-
- /*
* If the drawable is not a pixmap and it has an associated
* NSWindow then we know we are drawing to a window.
*/
diff --git a/macosx/tkMacOSXEvent.c b/macosx/tkMacOSXEvent.c
index 798c73c..c03a6fb 100644
--- a/macosx/tkMacOSXEvent.c
+++ b/macosx/tkMacOSXEvent.c
@@ -137,10 +137,7 @@ MODULE_SCOPE void
TkMacOSXFlushWindows(void)
{
NSArray *macWindows = [NSApp orderedWindows];
- if ([NSApp simulateDrawing]) {
- [NSApp setSimulateDrawing:NO];
- return;
- }
+ while (Tcl_DoOneEvent(TCL_IDLE_EVENTS)){}
for (NSWindow *w in macWindows) {
if (TkMacOSXGetXWindow(w)) {
[w displayIfNeeded];
diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c
index 8e9c600..3a212c4 100644
--- a/macosx/tkMacOSXInit.c
+++ b/macosx/tkMacOSXInit.c
@@ -47,7 +47,6 @@ static char scriptPath[PATH_MAX + 1] = "";
@synthesize poolLock = _poolLock;
@synthesize macMinorVersion = _macMinorVersion;
@synthesize isDrawing = _isDrawing;
-@synthesize simulateDrawing = _simulateDrawing;
@end
/*
@@ -166,15 +165,15 @@ static char scriptPath[PATH_MAX + 1] = "";
[NSApp setMacMinorVersion: minorVersion];
/*
- * We are not drawing yet.
+ * We are not drawing right now.
*/
[NSApp setIsDrawing:NO];
- [NSApp setSimulateDrawing:NO];
/*
* Be our own delegate.
*/
+
[self setDelegate:self];
/*
diff --git a/macosx/tkMacOSXInt.h b/macosx/tkMacOSXInt.h
index 4e1e689..d942286 100644
--- a/macosx/tkMacOSXInt.h
+++ b/macosx/tkMacOSXInt.h
@@ -200,7 +200,7 @@ MODULE_SCOPE void TkpReleaseRegion(TkRegion r);
MODULE_SCOPE void TkpShiftButton(NSButton *button, NSPoint delta);
MODULE_SCOPE Bool TkpAppIsDrawing(void);
MODULE_SCOPE void TkpDisplayWindow(Tk_Window tkwin);
-MODULE_SCOPE void TkTestSimulateDrawing(Bool);
+MODULE_SCOPE Bool TkTestAppIsDrawing(void);
/*
* Include the stubbed internal platform-specific API.
diff --git a/macosx/tkMacOSXPrivate.h b/macosx/tkMacOSXPrivate.h
index d804ca0..f3228c4 100644
--- a/macosx/tkMacOSXPrivate.h
+++ b/macosx/tkMacOSXPrivate.h
@@ -265,13 +265,11 @@ VISIBILITY_HIDDEN
int _poolLock;
int _macMinorVersion;
Bool _isDrawing;
- Bool _simulateDrawing;
#endif
}
@property int poolLock;
@property int macMinorVersion;
@property Bool isDrawing;
-@property Bool simulateDrawing;
@end
@interface TKApplication(TKInit)
diff --git a/macosx/tkMacOSXTest.c b/macosx/tkMacOSXTest.c
index 5576c44..b7923b0 100644
--- a/macosx/tkMacOSXTest.c
+++ b/macosx/tkMacOSXTest.c
@@ -82,30 +82,28 @@ DebuggerObjCmd(
/*
*----------------------------------------------------------------------
*
- * TkTestSimulateDrawing --
+ * TkTestAppIsDrawing --
*
* A test widget display procedure which records calls can use this to
- * avoid duplicate calls which would occur due to fact that no valid
- * graphics context is available to the idle task which is running the
- * display proc. Note that no actual drawing to the screen will take
- * place when this flag is set. This is just a wrapper for the NSApp
+ * detect whether it is being called from within [NSView drawRect].
+ * If so, it probably should not be recording the call since it was
+ * probably generated spontaneously by the window manager rather than
+ * by an explicit call to update. This is just a wrapper for the NSApp
* property.
*
*
* Results:
- * Calls to low level drawing routines will return without actually
- * drawing anything to the screen.
+ * Returns true if and only if called from within [NSView drawRect].
*
* Side effects:
* None
*
*----------------------------------------------------------------------
*/
-MODULE_SCOPE void
-TkTestSimulateDrawing(Bool yesno) {
- [NSApp setSimulateDrawing:yesno];
+MODULE_SCOPE Bool
+TkTestAppIsDrawing(void) {
+ return [NSApp isDrawing];
}
-
/*
diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c
index a1a3d1a..4532b0c 100644
--- a/macosx/tkMacOSXWindowEvent.c
+++ b/macosx/tkMacOSXWindowEvent.c
@@ -832,10 +832,6 @@ ConfigureRestrictProc(
Tk_PathName(winPtr));
#endif
- if ([NSApp simulateDrawing]) {
- return;
- }
-
/*
* We do not allow recursive calls to drawRect, but we only log
* them on OSX > 10.13, where they should never happen.