summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXEvent.c
diff options
context:
space:
mode:
Diffstat (limited to 'macosx/tkMacOSXEvent.c')
-rw-r--r--macosx/tkMacOSXEvent.c49
1 files changed, 14 insertions, 35 deletions
diff --git a/macosx/tkMacOSXEvent.c b/macosx/tkMacOSXEvent.c
index af68eb6..66ca964 100644
--- a/macosx/tkMacOSXEvent.c
+++ b/macosx/tkMacOSXEvent.c
@@ -104,47 +104,26 @@ enum {
return processedEvent;
}
@end
-
#pragma mark -
-
-/*
- *----------------------------------------------------------------------
- *
- * XSync --
- *
- * This routine is a stub called XSync, which is called during the Tk
- * update command. The language specification does not require that the
- * update command be synchronous but many of the tests implicitly assume
- * that it is. It is definitely asynchronous on macOS since many idle
- * tasks are run inside of the drawRect method of a window's contentView,
- * which will not be called until after this function returns.
- *
- * Results:
- * None.
- *
- * Side effects: Processes all pending idle events then calls the display
- * method of each visible window.
- *
- *----------------------------------------------------------------------
- */
-
int
XSync(
Display *display,
- Bool discard)
+ TCL_UNUSED(Bool))
{
- (void)discard;
+ /*
+ * The main use of XSync is by the update command, which alternates
+ * between running an event loop to process all events without waiting and
+ * calling XSync on all displays until no events are left. There is
+ * nothing for the mac to do with respect to syncing its one display but
+ * it can (and, during regression testing, frequently does) happen that
+ * timer events fire during the event loop. Processing those here seems
+ * to make the update command work in a way that is more consistent with
+ * its behavior on other platforms.
+ */
- if (display) {
- display->request++;
- }
- if (Tk_GetNumMainWindows() != 0) {
- while (Tcl_DoOneEvent(TCL_IDLE_EVENTS)){}
- for (NSWindow *w in [NSApp orderedWindows]) {
- [w display];
- }
- }
- return Success;
+ while (Tcl_DoOneEvent(TCL_TIMER_EVENTS|TCL_DONT_WAIT)){}
+ display->request++;
+ return 0;
}
/*