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)
commite2cfeef3d094ca6695592ae442e009f7273efc62 (patch)
tree5ba434e56186b2b09ce45c5a7a138931a470ad2b /generic/tkText.c
parentd8062d0651a7c250ad771a866a71625fa590a8cb (diff)
downloadtk-e2cfeef3d094ca6695592ae442e009f7273efc62.zip
tk-e2cfeef3d094ca6695592ae442e009f7273efc62.tar.gz
tk-e2cfeef3d094ca6695592ae442e009f7273efc62.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,