diff options
author | culler <culler> | 2024-06-18 12:17:43 (GMT) |
---|---|---|
committer | culler <culler> | 2024-06-18 12:17:43 (GMT) |
commit | 5175b17dce9102ec83c6f8a3db45ac1a0725a01c (patch) | |
tree | e261109d420b33d5cbb13bc7251c6edae5440848 | |
parent | 4ef53d757fa6987eeb638dfc02192c2afd1899c1 (diff) | |
download | tk-5175b17dce9102ec83c6f8a3db45ac1a0725a01c.zip tk-5175b17dce9102ec83c6f8a3db45ac1a0725a01c.tar.gz tk-5175b17dce9102ec83c6f8a3db45ac1a0725a01c.tar.bz2 |
Remove inner loop in setFrameSize, tame the chaos with UpdateClipRgn, deal with the artifacts later.
-rw-r--r-- | macosx/tkMacOSXDraw.c | 12 | ||||
-rw-r--r-- | macosx/tkMacOSXSubwindows.c | 4 | ||||
-rw-r--r-- | macosx/tkMacOSXWindowEvent.c | 21 | ||||
-rw-r--r-- | macosx/tkMacOSXWm.c | 1 |
4 files changed, 14 insertions, 24 deletions
diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c index 0e0a35e..66140fe 100644 --- a/macosx/tkMacOSXDraw.c +++ b/macosx/tkMacOSXDraw.c @@ -1538,10 +1538,13 @@ TkMacOSXGetClipRgn( } if (macDraw->drawRgn) { + // The drawRgn is the visRgn intersected with a rectangle which + // may be smaller than the widget bounds. clipRgn = HIShapeCreateCopy(macDraw->drawRgn); } else if (macDraw->visRgn) { clipRgn = HIShapeCreateCopy(macDraw->visRgn); } + // A NULL clipRgn does not allow any drawing at all. return clipRgn; } @@ -1551,7 +1554,9 @@ TkMacOSXGetClipRgn( * Tk_ClipDrawableToRect -- * * Clip all drawing into the drawable d to the given rectangle. If width - * or height are negative, reset to no clipping. + * or height are negative, reset to no clipping.bThis is called by the + * Text widget to display each DLine, and by the Canvas widget when it + * is updating a sub rectangle in the canvas. * * Results: * None. @@ -1580,7 +1585,10 @@ Tk_ClipDrawableToRect( width, height); HIShapeRef drawRgn = HIShapeCreateWithRect(&clipRect); - if (macDraw->winPtr && macDraw->flags & TK_CLIP_INVALID) { + // When drawing a Text widget we can reuse the + // clipping region for different DLines, so we don't want to + // update unless necessary. + if (macDraw->winPtr && (macDraw->flags & TK_CLIP_INVALID)) { TkMacOSXUpdateClipRgn(macDraw->winPtr); } if (macDraw->visRgn) { diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c index 8cfdaf2..d571d8a 100644 --- a/macosx/tkMacOSXSubwindows.c +++ b/macosx/tkMacOSXSubwindows.c @@ -367,7 +367,8 @@ XUnmapWindow( * redraw the window. */ - TkMacOSXInvalidateWindow(macWin, TK_PARENT_WINDOW); + TkMacOSXInvalClipRgns((Tk_Window)winPtr->parentPtr); + //TkMacOSXInvalidateWindow(macWin, TK_PARENT_WINDOW); // if (parentPtr && parentPtr->privatePtr->visRgn) { // TkMacOSXInvalidateViewRegion( // TkMacOSXGetNSViewForDrawable(parentPtr->window), @@ -966,6 +967,7 @@ TkMacOSXUpdateClipRgn( } } +// Unused and misspelled stub function /* *---------------------------------------------------------------------- * diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c index c247573..6030564 100644 --- a/macosx/tkMacOSXWindowEvent.c +++ b/macosx/tkMacOSXWindowEvent.c @@ -1072,29 +1072,10 @@ ConfigureRestrictProc( TkGenWMConfigureEvent(tkwin, Tk_X(tkwin), Tk_Y(tkwin), width, height, TK_SIZE_CHANGED | TK_MACOSX_HANDLE_EVENT_IMMEDIATELY); oldProc = Tk_RestrictEvents(ConfigureRestrictProc, NULL, &oldArg); + while (Tcl_DoOneEvent(TCL_WINDOW_EVENTS|TCL_DONT_WAIT)) {} Tk_RestrictEvents(oldProc, oldArg, &oldArg); /* - * To make the reconfiguration actually happen we need to process idle - * tasks generated when processing the ConfigureNotify events. We also - * process timer events because the Text widget updates line metrics - * asynchronously using timer tasks. Skipping those updates can (but - * shouldn't) cause crashes when resizing a complex Text widget with - * embedded windows. The crash occurs if an embedded window is mapped - * for the first time while the window is being resized. - */ - - while (Tcl_DoOneEvent(TCL_TIMER_EVENTS|TCL_IDLE_EVENTS|TCL_DONT_WAIT)) {} - - /* - * Now that Tk has configured all subwindows, create the clip regions. - */ - - TkMacOSXInvalClipRgns(tkwin); - TkMacOSXUpdateClipRgn(winPtr); - //TkMacOSXSetDrawingEnabled(winPtr, 1); - - /* * Redraw the entire content view. */ diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index 857524c..dfa5701 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -292,7 +292,6 @@ static void syncLayout(NSWindow *macWindow) wmPtr->parentHeight = winPtr->changes.height + frameRect.size.height - contentRect.size.height; TkMacOSXInvalClipRgns((Tk_Window)winPtr); - TkMacOSXUpdateClipRgn(winPtr); } } #endif |