diff options
-rw-r--r-- | generic/tkTextDisp.c | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index d2b6147..24184e3 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -4443,18 +4443,28 @@ DisplayText( #ifdef MAC_OSX_TK } else if (dlPtr->chunkPtr != NULL) { /* - * On the Mac we need to redisplay all embedded windows which - * were moved in order to make sure that the clipping region - * for the Text widget is maintained correctly. If an embedded - * window is moved but its bounding rectangle is not added back - * to the clipping region of the Text widget then drawing into - * the old bounding rectangle will not be allowed, causing an - * image of the embedded window to remain on the screen in the - * old position. In other words, a "ghost window" will appear. + * On macOS we need to redisplay all embedded windows which + * were moved by the call to TkScrollWindows above. This is + * not necessary on Unix or Windows because XScrollWindow will + * have included the bounding rectangles of all of these + * windows in the damage region. The macosx implementation of + * TkScrollWindow does not do this. It simply generates a + * damage region which is the scroll source rectangle minus + * the scroll destination rectangle. This is because there is + * no efficient process available for iterating through the + * subwindows which meet the scrolled area. (On Unix this is + * handled by GraphicsExpose events generated by XCopyArea and + * on Windows by ScrollWindowEx. On macOS the low level + * scrolling is accomplished by calling [view scrollRect:by:]. + * This method does not provide any damage information and, in + * any case, could not be aware of Tk windows which were not + * based on NSView objects. * - * Perhaps all platforms should do this, rather than allow the - * embedded windows to have incorrect values for Tk_X and Tk_Y. - * But apparently this is not known to cause problems. + * On the other hand, this loop is already iterating through + * all embedded windows which could possibly have been moved + * by the scrolling. So it is as efficient to redisplay them + * here as it would have been if they had been redisplayed by + * the call to TextInvalidateRegion above. */ #else } else if (dlPtr->chunkPtr != NULL && ((dlPtr->y < 0) |