diff options
author | culler <culler> | 2024-06-13 02:31:46 (GMT) |
---|---|---|
committer | culler <culler> | 2024-06-13 02:31:46 (GMT) |
commit | 31e1c7993caffba710f061daef4aaa36b89845b8 (patch) | |
tree | d44b611e5f4b3425ee0e492e6ad18e0e8300c94d | |
parent | 218f3320e0f1e48e5644aa8199479f0bb1360159 (diff) | |
download | tk-31e1c7993caffba710f061daef4aaa36b89845b8.zip tk-31e1c7993caffba710f061daef4aaa36b89845b8.tar.gz tk-31e1c7993caffba710f061daef4aaa36b89845b8.tar.bz2 |
Make place-14.1 and textDisp-10.6 pass.
-rw-r--r-- | macosx/tkMacOSXWindowEvent.c | 31 | ||||
-rw-r--r-- | tests/textDisp.test | 11 |
2 files changed, 28 insertions, 14 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; } diff --git a/tests/textDisp.test b/tests/textDisp.test index f5ee1ef..ffb2b2a 100644 --- a/tests/textDisp.test +++ b/tests/textDisp.test @@ -1107,21 +1107,26 @@ test textDisp-6.9 {DisplayText, horizontal scrollbar updates} { set scrollInfo } [list 0.0 [expr {4.0/11}]] test textDisp-6.10 {DisplayText, redisplay embedded windows after scroll} {aqua} { + # For this test to pass line 8 must be out of the text widget. + # With macOS 14 this requires making the buttons a little larger. + # So we set the pady option. This may depend on the OS version. .t configure -wrap char + update .t delete 1.0 end + update .t insert 1.0 "Line 1" foreach i {2 3 4} { .t insert end "\nLine $i" } .t insert end "\n" .t window create end -create { - button %W.button_one -text "Button 1"} + button %W.button_one -text "Button 1" -pady 5} .t insert end "\nLine 6\n" .t window create end -create { - button %W.button_two -text "Button 2"} + button %W.button_two -text "Button 2" -pady 5} .t insert end "\nLine 8\n" .t window create end -create { - button %W.button_three -text "Button 3"} + button %W.button_three -text "Button 3" -pady 5} update set tk_textEmbWinDisplay {} .t delete 2.0 3.0 |