diff options
author | Kevin Walzer <kw@codebykevin.com> | 2015-01-04 23:24:23 (GMT) |
---|---|---|
committer | Kevin Walzer <kw@codebykevin.com> | 2015-01-04 23:24:23 (GMT) |
commit | 526838c498310083108c2dce3c2d9a71dd924d89 (patch) | |
tree | 37538e8b156b71bd915e84f67cf05a62719fdac1 /generic | |
parent | 94446123f6728f30f9bae4c73ad5d242e249ee0b (diff) | |
download | tk-526838c498310083108c2dce3c2d9a71dd924d89.zip tk-526838c498310083108c2dce3c2d9a71dd924d89.tar.gz tk-526838c498310083108c2dce3c2d9a71dd924d89.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 a0cbc52..4391f0c 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -3885,6 +3885,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( @@ -3899,6 +3914,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)) { /* @@ -4100,6 +4118,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); |