summaryrefslogtreecommitdiffstats
path: root/generic/tkListbox.c
diff options
context:
space:
mode:
authorfvogel <fvogel@noemail.net>2016-01-16 14:16:00 (GMT)
committerfvogel <fvogel@noemail.net>2016-01-16 14:16:00 (GMT)
commitfdae993d0eb304f2f8ddccc894a9be963e02d63b (patch)
tree053c4cf036feedfa853b32d1faa32d48a19a6e8e /generic/tkListbox.c
parenta246ca1e22660ae161e4213f443884822f285269 (diff)
downloadtk-fdae993d0eb304f2f8ddccc894a9be963e02d63b.zip
tk-fdae993d0eb304f2f8ddccc894a9be963e02d63b.tar.gz
tk-fdae993d0eb304f2f8ddccc894a9be963e02d63b.tar.bz2
Addressed issue A and question 6 (see artifact [9d48a9c212] of ticket [3f456a5bb9])
FossilOrigin-Name: bfbd8ae654ab30cfda3ff3d4bc6fa7ea5e19c14f
Diffstat (limited to 'generic/tkListbox.c')
-rw-r--r--generic/tkListbox.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/generic/tkListbox.c b/generic/tkListbox.c
index 56e2c2f..a57650b 100644
--- a/generic/tkListbox.c
+++ b/generic/tkListbox.c
@@ -1857,7 +1857,7 @@ DisplayListbox(
* or right edge of the listbox is
* off-screen. */
Pixmap pixmap;
- int totalLength, height;
+ int textWidth;
listPtr->flags &= ~REDRAW_PENDING;
if (listPtr->flags & LISTBOX_DELETED) {
@@ -2079,21 +2079,19 @@ DisplayListbox(
Tcl_ListObjIndex(listPtr->interp, listPtr->listObj, i, &curElement);
stringRep = Tcl_GetStringFromObj(curElement, &stringLen);
- Tk_ComputeTextLayout(listPtr->tkfont, stringRep, stringLen, 0,
- listPtr->justify, TK_IGNORE_NEWLINES, &totalLength, &height);
+ textWidth = Tk_TextWidth(listPtr->tkfont, stringRep, stringLen);
Tk_GetFontMetrics(listPtr->tkfont, &fm);
y += fm.ascent + listPtr->selBorderWidth;
if (listPtr->justify == TK_JUSTIFY_LEFT) {
- x = listPtr->inset + listPtr->selBorderWidth - listPtr->xOffset;
+ x = (listPtr->inset + listPtr->selBorderWidth) - listPtr->xOffset;
} else if (listPtr->justify == TK_JUSTIFY_RIGHT) {
- x = width - totalLength - listPtr->inset -
- listPtr->selBorderWidth - listPtr->xOffset +
- GetMaxOffset(listPtr) - 1;
+ x = Tk_Width(tkwin) - (listPtr->inset + listPtr->selBorderWidth)
+ - textWidth - listPtr->xOffset + GetMaxOffset(listPtr);
} else {
- x = (width + GetMaxOffset(listPtr))/2 - totalLength/2 -
- listPtr->xOffset;
+ x = (Tk_Width(tkwin) - textWidth)/2
+ - listPtr->xOffset + GetMaxOffset(listPtr)/2;
}
Tk_DrawChars(listPtr->display, pixmap, gc, listPtr->tkfont,