summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/ttk/ttkTheme.c8
-rw-r--r--macosx/tkMacOSXDraw.c2
-rw-r--r--macosx/tkMacOSXEvent.c35
-rw-r--r--macosx/tkMacOSXEvent.h4
-rw-r--r--macosx/tkMacOSXSubwindows.c3
-rw-r--r--macosx/tkMacOSXWindowEvent.c36
-rw-r--r--macosx/tkMacOSXXStubs.c15
-rw-r--r--tests/listbox.test10
8 files changed, 31 insertions, 82 deletions
diff --git a/generic/ttk/ttkTheme.c b/generic/ttk/ttkTheme.c
index 6bf48a3..7bde80e 100644
--- a/generic/ttk/ttkTheme.c
+++ b/generic/ttk/ttkTheme.c
@@ -15,13 +15,6 @@
#define PKG_ASSOC_KEY "Ttk"
-#ifdef MAC_OSX_TK
- extern void TkMacOSXFlushWindows(void);
- #define UPDATE_WINDOWS() TkMacOSXFlushWindows()
-#else
- #define UPDATE_WINDOWS()
-#endif
-
/*------------------------------------------------------------------------
* +++ Styles.
*
@@ -517,7 +510,6 @@ static void ThemeChangedProc(ClientData clientData)
Tcl_BackgroundException(pkgPtr->interp, code);
}
pkgPtr->themeChangePending = 0;
- UPDATE_WINDOWS();
}
/*
diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c
index f3d6ba4..4973bc2 100644
--- a/macosx/tkMacOSXDraw.c
+++ b/macosx/tkMacOSXDraw.c
@@ -1636,7 +1636,7 @@ TkMacOSXSetupDrawingContext(
HIShapeGetBounds(dc.clipRgn, &clipBounds);
clipBounds = CGRectApplyAffineTransform(clipBounds, t);
}
- if (![NSApp isDrawing] || view != [NSView focusView]) {
+ if (![NSApp isDrawing]) {
/*
* We can only draw into the view when the current CGContext is
diff --git a/macosx/tkMacOSXEvent.c b/macosx/tkMacOSXEvent.c
index c543b8d..31a7663 100644
--- a/macosx/tkMacOSXEvent.c
+++ b/macosx/tkMacOSXEvent.c
@@ -104,43 +104,8 @@ enum {
return processedEvent;
}
@end
-
#pragma mark -
-
-/*
- *----------------------------------------------------------------------
- *
- * TkMacOSXFlushWindows --
- *
- * This routine is a stub called by 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.
- *
- *----------------------------------------------------------------------
- */
-
-MODULE_SCOPE void
-TkMacOSXFlushWindows(void)
-{
- if (Tk_GetNumMainWindows() == 0) {
- return;
- }
- while (Tcl_DoOneEvent(TCL_IDLE_EVENTS|TCL_TIMER_EVENTS|TCL_DONT_WAIT)){}
- for (NSWindow *w in [NSApp orderedWindows]) {
- [w display];
- }
-}
-
/*
* Local Variables:
* mode: objc
diff --git a/macosx/tkMacOSXEvent.h b/macosx/tkMacOSXEvent.h
index 46d1585..850e9f6 100644
--- a/macosx/tkMacOSXEvent.h
+++ b/macosx/tkMacOSXEvent.h
@@ -18,6 +18,8 @@
#include "tkMacOSXInt.h"
#endif
-MODULE_SCOPE void TkMacOSXFlushWindows(void);
+/*
+ * Currently nothing needs to be declared here.
+ */
#endif
diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c
index a5fc097..77402a7 100644
--- a/macosx/tkMacOSXSubwindows.c
+++ b/macosx/tkMacOSXSubwindows.c
@@ -136,6 +136,9 @@ XMapWindow(
Display *display, /* Display. */
Window window) /* Window. */
{
+ if (!window) {
+ return BadWindow;
+ }
MacDrawable *macWin = (MacDrawable *) window;
TkWindow *winPtr = macWin->winPtr;
NSWindow *win = TkMacOSXDrawableWindow(window);
diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c
index 2b2f1a0..36a489b 100644
--- a/macosx/tkMacOSXWindowEvent.c
+++ b/macosx/tkMacOSXWindowEvent.c
@@ -34,7 +34,6 @@ static int GenerateUpdates(
CGRect *updateBounds, TkWindow *winPtr);
static int GenerateActivateEvents(TkWindow *winPtr,
int activeFlag);
-static void DoWindowActivate(ClientData clientData);
#pragma mark TKApplication(TKWindowEvent)
@@ -414,7 +413,7 @@ TkpWillDrawWidget(Tk_Window tkwin) {
winPtr->privatePtr);
result = ([NSApp isDrawing] && view == [NSView focusView]);
#if 0
- printf("TkAppCanDraw: %s %d %d \n", Tk_PathName(tkwin),
+ printf("TkpWillDrawWidget: %s %d %d \n", Tk_PathName(tkwin),
[NSApp isDrawing], (view == [NSView focusView]));
if (!result) {
NSRect dirtyRect;
@@ -548,29 +547,6 @@ GenerateActivateEvents(
/*
*----------------------------------------------------------------------
*
- * DoWindowActivate --
- *
- * Idle handler that calls GenerateActivateEvents().
- *
- * Results:
- * None.
- *
- * Side effects:
- * Additional events may be placed on the Tk event queue.
- *
- *----------------------------------------------------------------------
- */
-
-void
-DoWindowActivate(
- ClientData clientData)
-{
- GenerateActivateEvents(clientData, 1);
-}
-
-/*
- *----------------------------------------------------------------------
- *
* TkMacOSXGenerateFocusEvent --
*
* Given a Macintosh window activate event this function generates all
@@ -1068,12 +1044,12 @@ ConfigureRestrictProc(
serial = LastKnownRequestProcessed(Tk_Display(winPtr));
/*
- * First process all of the Expose events.
+ * Use the ExposeRestrictProc to process only the expose events. This
+ * will create idle drawing tasks, which we handle before we return.
*/
- while (Tcl_ServiceEvent(TCL_IDLE_EVENTS|TCL_TIMER_EVENTS|TCL_DONT_WAIT)) {};
oldProc = Tk_RestrictEvents(ExposeRestrictProc, UINT2PTR(serial), &oldArg);
- while (Tcl_ServiceEvent(TCL_WINDOW_EVENTS)) {};
+ while (Tcl_ServiceEvent(TCL_WINDOW_EVENTS|TCL_DONT_WAIT)) {};
Tk_RestrictEvents(oldProc, oldArg, &oldArg);
/*
@@ -1085,8 +1061,8 @@ ConfigureRestrictProc(
* effect.)
*
* Fortunately, Tk schedules all drawing to be done while Tcl is idle.
- * So we can do the drawing now by processing all of the idle events
- * that were created when the expose events were processed.
+ * So to run any display procs which were scheduled by the expose
+ * events we process all idle events before returning.
*/
while (Tcl_DoOneEvent(TCL_IDLE_EVENTS)) {}
diff --git a/macosx/tkMacOSXXStubs.c b/macosx/tkMacOSXXStubs.c
index 6aeec36..107f712 100644
--- a/macosx/tkMacOSXXStubs.c
+++ b/macosx/tkMacOSXXStubs.c
@@ -752,7 +752,18 @@ XSync(
Display *display,
Bool discard)
{
- TkMacOSXFlushWindows();
+ /*
+ * 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.
+ */
+
+ while (Tcl_DoOneEvent(TCL_TIMER_EVENTS|TCL_DONT_WAIT)){}
display->request++;
return 0;
}
@@ -945,7 +956,7 @@ XSynchronize(
Display *display,
Bool onoff)
{
- display->request++;
+ display->request++;
return NULL;
}
diff --git a/tests/listbox.test b/tests/listbox.test
index 0917e84..01cc397 100644
--- a/tests/listbox.test
+++ b/tests/listbox.test
@@ -2666,7 +2666,7 @@ test listbox-21.9 {ListboxListVarProc, test hscrollbar after listvar mod} -setup
listbox .l -font $fixed -width 10 -xscrollcommand "record x" -listvar x
set log {}
pack .l
- set timeout [after 500 {set log timeout}]
+ set timeout [after 500 {lappend log timeout1}]
vwait log
lappend x "0000000000"
update
@@ -2684,7 +2684,7 @@ test listbox-21.10 {ListboxListVarProc, test hscrollbar after listvar mod} -setu
listbox .l -font $fixed -width 10 -xscrollcommand "record x" -listvar x
set log {}
pack .l
- set timeout [after 500 {set log timeout}]
+ set timeout [after 500 {lappend log timeout2}]
vwait log
lappend x "0000000000"
update
@@ -2695,7 +2695,7 @@ test listbox-21.10 {ListboxListVarProc, test hscrollbar after listvar mod} -setu
set log
} -cleanup {
destroy .l
- after cancel timeout
+ after cancel $timeout
} -result [list {x 0 1} {x 0 1} {x 0 0.5} {x 0 1}]
test listbox-21.11 {ListboxListVarProc, bad list} -setup {
destroy .l
@@ -2764,7 +2764,7 @@ test listbox-21.15 {ListboxListVarProc, update vertical scrollbar} -setup {
update
set log {}
pack .l
- set timeout [after 500 {set log timeout}]
+ set timeout [after 500 {lappend log timeout3}]
vwait log
update
lappend x a b c d e f
@@ -2804,7 +2804,7 @@ test listbox-22.1 {UpdateHScrollbar} -setup {
pack .l
update idletasks
set log {}
- set timeout [after 500 {set log timeout}]
+ set timeout [after 500 {lappend log timeout4}]
.l insert end "0000000000"
vwait log
.l insert end "00000000000000000000"