diff options
author | Kevin Walzer <kw@codebykevin.com> | 2015-01-04 23:22:29 (GMT) |
---|---|---|
committer | Kevin Walzer <kw@codebykevin.com> | 2015-01-04 23:22:29 (GMT) |
commit | 6463c2c51887af62f6b7aeecd5aef8944a823378 (patch) | |
tree | 58746b380f8614729d11b0929b4e18062ecabd9e /generic | |
parent | 8e37eba6971e56f5c96285b8c3e41ec7853aa1ad (diff) | |
download | tk-6463c2c51887af62f6b7aeecd5aef8944a823378.zip tk-6463c2c51887af62f6b7aeecd5aef8944a823378.tar.gz tk-6463c2c51887af62f6b7aeecd5aef8944a823378.tar.bz2 |
Improved scrolling for text under Cocoa; thanks to Marc Culler for patch.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tkTextDisp.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index f16c45b..ac0b95a 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -3883,6 +3883,21 @@ TkTextUpdateOneLine( * *---------------------------------------------------------------------- */ +#ifdef MAC_OSX_TK +static void +RedisplayText( + ClientData clientData ) +{ + register TkText *textPtr = (TkText *) clientData; + TextDInfo *dInfoPtr = textPtr->dInfoPtr; + TkRegion damageRegion = TkCreateRegion(); + XRectangle rectangle = {0, 0, dInfoPtr->maxX, dInfoPtr->maxY}; + TkUnionRectWithRegion(&rectangle, damageRegion, damageRegion); + + TextInvalidateRegion(textPtr, damageRegion); + DisplayText(clientData); +} +#endif static void DisplayText( @@ -3897,6 +3912,9 @@ DisplayText( int bottomY = 0; /* Initialization needed only to stop compiler * warnings. */ Tcl_Interp *interp; +#ifdef MAC_OSX_TK + Tcl_TimerToken macRefreshTimer = NULL; +#endif if ((textPtr->tkwin == NULL) || (textPtr->flags & DESTROYED)) { /* @@ -4099,6 +4117,22 @@ DisplayText( oldY, dInfoPtr->maxX-dInfoPtr->x, height, 0, y-oldY, damageRgn)) { TextInvalidateRegion(textPtr, damageRgn); + +#ifdef MAC_OSX_TK + + /* + * On OS X large scrolls sometimes leave garbage on the screen. + * This attempts to clean it up by redisplaying the Text window + * after 200 milliseconds. + */ + if ( abs(y-oldY) > 14 ) { + Tcl_DeleteTimerHandler(macRefreshTimer); + macRefreshTimer = Tcl_CreateTimerHandler(200, + RedisplayText, + clientData); + } +#endif + } numCopies++; TkDestroyRegion(damageRgn); |