diff options
author | fvogel <fvogelnew1@free.fr> | 2015-11-12 21:59:18 (GMT) |
---|---|---|
committer | fvogel <fvogelnew1@free.fr> | 2015-11-12 21:59:18 (GMT) |
commit | b9c5c010586da8c59bec01cd2e2d21835ef7916b (patch) | |
tree | 5ba434e56186b2b09ce45c5a7a138931a470ad2b | |
parent | b4ab9d79f99aab6cfb1014e82271308f4d6184c9 (diff) | |
download | tk-b9c5c010586da8c59bec01cd2e2d21835ef7916b.zip tk-b9c5c010586da8c59bec01cd2e2d21835ef7916b.tar.gz tk-b9c5c010586da8c59bec01cd2e2d21835ef7916b.tar.bz2 |
Koen Danckaert's patch to speed up line metrics update
-rw-r--r-- | generic/tkText.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/generic/tkText.c b/generic/tkText.c index cb89218..ac56c85 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -572,8 +572,6 @@ CreateWidget( * start,end do not require a total recalculation. */ - TkBTreeAddClient(sharedPtr->tree, textPtr, textPtr->charHeight); - textPtr->state = TK_TEXT_STATE_NORMAL; textPtr->relief = TK_RELIEF_FLAT; textPtr->cursor = None; @@ -583,6 +581,8 @@ CreateWidget( textPtr->prevWidth = Tk_Width(newWin); textPtr->prevHeight = Tk_Height(newWin); + TkBTreeAddClient(sharedPtr->tree, textPtr, textPtr->charHeight); + /* * This will add refCounts to textPtr. */ @@ -2319,6 +2319,7 @@ TextWorldChanged( { Tk_FontMetrics fm; int border; + int oldCharHeight = textPtr->charHeight; textPtr->charWidth = Tk_TextWidth(textPtr->tkfont, "0", 1); if (textPtr->charWidth <= 0) { @@ -2330,6 +2331,9 @@ TextWorldChanged( if (textPtr->charHeight <= 0) { textPtr->charHeight = 1; } + if (textPtr->charHeight != oldCharHeight) { + TkBTreeClientRangeChanged(textPtr, textPtr->charHeight); + } border = textPtr->borderWidth + textPtr->highlightWidth; Tk_GeometryRequest(textPtr->tkwin, textPtr->width * textPtr->charWidth + 2*textPtr->padX + 2*border, |