summaryrefslogtreecommitdiffstats
path: root/generic/tkText.c
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2015-11-12 21:59:18 (GMT)
committerfvogel <fvogelnew1@free.fr>2015-11-12 21:59:18 (GMT)
commitb9c5c010586da8c59bec01cd2e2d21835ef7916b (patch)
tree5ba434e56186b2b09ce45c5a7a138931a470ad2b /generic/tkText.c
parentb4ab9d79f99aab6cfb1014e82271308f4d6184c9 (diff)
downloadtk-b9c5c010586da8c59bec01cd2e2d21835ef7916b.zip
tk-b9c5c010586da8c59bec01cd2e2d21835ef7916b.tar.gz
tk-b9c5c010586da8c59bec01cd2e2d21835ef7916b.tar.bz2
Koen Danckaert's patch to speed up line metrics update
Diffstat (limited to 'generic/tkText.c')
-rw-r--r--generic/tkText.c8
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,