summaryrefslogtreecommitdiffstats
path: root/generic/tkListbox.c
diff options
context:
space:
mode:
authorfvogel <fvogel@noemail.net>2016-01-18 10:08:58 (GMT)
committerfvogel <fvogel@noemail.net>2016-01-18 10:08:58 (GMT)
commite2313ed46fdb044645d4af90e5592caa2c42e428 (patch)
tree9fd1929420bac3ed202522b0cedc0ddf61aa395a /generic/tkListbox.c
parent06a4b22707ddd9ac5ae48c4aed6beda6a3fde51c (diff)
downloadtk-e2313ed46fdb044645d4af90e5592caa2c42e428.zip
tk-e2313ed46fdb044645d4af90e5592caa2c42e428.tar.gz
tk-e2313ed46fdb044645d4af90e5592caa2c42e428.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.
FossilOrigin-Name: 3bb0cf8815b77f344d47171a70c294114e571125
Diffstat (limited to 'generic/tkListbox.c')
-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