Subject: Addressed issue B (see artifact [9d48a9c212] of ticket [3f456a5bb9])

From: fvogel <[email-masked]>
Date: Sat, 16 Jan 2016 14:20:40 +0000

---
 generic/tkListbox.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/generic/tkListbox.c b/generic/tkListbox.c
index a57650b..4f20d44 100644
--- a/generic/tkListbox.c
+++ b/generic/tkListbox.c
@@ -1096,6 +1096,7 @@ ListboxBboxSubCmd(
     Listbox *listPtr,		/* Information about the listbox */
     int index)			/* Index of the element to get bbox info on */
 {
+    register Tk_Window tkwin = listPtr->tkwin;
     int lastVisibleIndex;
 
     /*
@@ -1131,7 +1132,15 @@ ListboxBboxSubCmd(
 	Tk_GetFontMetrics(listPtr->tkfont, &fm);
 	pixelWidth = Tk_TextWidth(listPtr->tkfont, stringRep, stringLen);
 
-	x = listPtr->inset + listPtr->selBorderWidth - listPtr->xOffset;
+        if (listPtr->justify == TK_JUSTIFY_LEFT) {
+            x = (listPtr->inset + listPtr->selBorderWidth) - listPtr->xOffset;
+        } else if (listPtr->justify == TK_JUSTIFY_RIGHT) {
+            x = Tk_Width(tkwin) - (listPtr->inset + listPtr->selBorderWidth)
+                    - pixelWidth - listPtr->xOffset + GetMaxOffset(listPtr);
+        } else {
+            x = (Tk_Width(tkwin) - pixelWidth)/2
+                    - listPtr->xOffset + GetMaxOffset(listPtr)/2;
+        }
 	y = ((index - listPtr->topIndex)*listPtr->lineHeight)
 		+ listPtr->inset + listPtr->selBorderWidth;
 	results[0] = Tcl_NewIntObj(x);
-- 
cgit v0.12