summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXWindowEvent.c
diff options
context:
space:
mode:
Diffstat (limited to 'macosx/tkMacOSXWindowEvent.c')
-rw-r--r--macosx/tkMacOSXWindowEvent.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c
index 6448732..3681d60 100644
--- a/macosx/tkMacOSXWindowEvent.c
+++ b/macosx/tkMacOSXWindowEvent.c
@@ -932,7 +932,6 @@ Tk_MacOSXIsAppInFront(void)
* Restrict event processing to Expose events.
*/
-#if 0
static Tk_RestrictAction
ExposeRestrictProc(
void *arg,
@@ -941,7 +940,6 @@ ExposeRestrictProc(
return (eventPtr->type==Expose && eventPtr->xany.serial==PTR2UINT(arg)
? TK_PROCESS_EVENT : TK_DEFER_EVENT);
}
-#endif
/*
* Restrict event processing to ConfigureNotify events.
@@ -1122,14 +1120,15 @@ ConfigureRestrictProc(
- (void) generateExposeEvents: (NSRect) rect
{
- int updatesNeeded;
CGRect updateBounds;
TkWindow *winPtr = TkMacOSXGetTkWindow([self window]);
- //void *oldArg;
- //Tk_RestrictProc *oldProc;
+ void *oldArg;
+ Tk_RestrictProc *oldProc;
static int reentered = 0;
- if (!winPtr) {
+ if (!winPtr ||
+ (winPtr->flags & (TK_ALREADY_DEAD)) ||
+ !Tk_IsMapped(winPtr)) {
return;
}
@@ -1141,7 +1140,7 @@ ConfigureRestrictProc(
* crashes or very poor performance. The reentered flag is
* used to detect this.
*/
- // fprintf(stderr, "Recursive call to generateExposeEvents\n");
+ //fprintf(stderr, "Recursive call to generateExposeEvents\n");
return;
}
reentered = 1;
@@ -1157,16 +1156,26 @@ ConfigureRestrictProc(
}
updateBounds.origin.y = ([self bounds].size.height - updateBounds.origin.y
- updateBounds.size.height);
- updatesNeeded = GenerateUpdates(&updateBounds, winPtr);
- if ([self inLiveResize] && updatesNeeded) {
+ if ( GenerateUpdates(&updateBounds, winPtr)) {
+ /*
+ * Use the ExposeRestrictProc to process the expose events we just
+ * generated. This will create idle drawing tasks, which we handle
+ * before we return in the case of a live resize.
+ */
+ unsigned int serial = LastKnownRequestProcessed(Tk_Display(winPtr));
+ oldProc = Tk_RestrictEvents(ExposeRestrictProc, UINT2PTR(serial), &oldArg);
+ while (Tcl_ServiceEvent(TCL_WINDOW_EVENTS|TCL_DONT_WAIT)) {};
+ Tk_RestrictEvents(oldProc, NULL, &oldArg);
/*
* During a LiveResize we process all idle tasks generated by the
* expose events to redraw the window while it is being resized.
*/
-
- while (Tcl_DoOneEvent(TCL_IDLE_EVENTS)) {}
+ if ([self inLiveResize]) {
+ while (Tcl_DoOneEvent(TCL_IDLE_EVENTS)) {}
+ }
}
+
reentered = 0;
}