summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2016-01-18 10:08:58 (GMT)
committerfvogel <fvogelnew1@free.fr>2016-01-18 10:08:58 (GMT)
commit85c13e1d28d4bac711f3b92737b501207e261280 (patch)
tree9fd1929420bac3ed202522b0cedc0ddf61aa395a
parent53047ac807d37682c72abeb9a92fff3e41779108 (diff)
downloadtk-85c13e1d28d4bac711f3b92737b501207e261280.zip
tk-85c13e1d28d4bac711f3b92737b501207e261280.tar.gz
tk-85c13e1d28d4bac711f3b92737b501207e261280.tar.bz2
Use GetMaxOffset when possible to reduce code duplication. The change in ListboxScanTo is not exactly equivalent but I believe the previous version was a bug.
-rw-r--r--generic/tkListbox.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/generic/tkListbox.c b/generic/tkListbox.c
index ee6941e..795ec0f 100644
--- a/generic/tkListbox.c
+++ b/generic/tkListbox.c
@@ -2887,9 +2887,7 @@ ChangeListboxOffset(
*/
offset += listPtr->xScrollUnit / 2;
- maxOffset = listPtr->maxWidth - (Tk_Width(listPtr->tkwin) -
- 2*listPtr->inset - 2*listPtr->selBorderWidth)
- + listPtr->xScrollUnit - 1;
+ maxOffset = GetMaxOffset(listPtr);
if (offset > maxOffset) {
offset = maxOffset;
}
@@ -2930,9 +2928,7 @@ ListboxScanTo(
int newTopIndex, newOffset, maxIndex, maxOffset;
maxIndex = listPtr->nElements - listPtr->fullLines;
- maxOffset = listPtr->maxWidth + (listPtr->xScrollUnit - 1)
- - (Tk_Width(listPtr->tkwin) - 2*listPtr->inset
- - 2*listPtr->selBorderWidth - listPtr->xScrollUnit);
+ maxOffset = GetMaxOffset(listPtr);
/*
* Compute new top line for screen by amplifying the difference between