diff options
-rw-r--r-- | macosx/tkMacOSXScrlbr.c | 9 | ||||
-rw-r--r-- | tests/scrollbar.test | 1 | ||||
-rw-r--r-- | unix/tkUnixScrlbr.c | 5 |
3 files changed, 11 insertions, 4 deletions
diff --git a/macosx/tkMacOSXScrlbr.c b/macosx/tkMacOSXScrlbr.c index a8018a5..f7f9489 100644 --- a/macosx/tkMacOSXScrlbr.c +++ b/macosx/tkMacOSXScrlbr.c @@ -231,17 +231,18 @@ TkpComputeScrollbarGeometry( * Using code from tkUnixScrlbr.c because Unix scroll bindings are * driving the display at the script level. All the Mac scrollbar * has to do is re-draw itself. + * There is a difference with Unix however: on macOS later than 10.6 + * (Snow Leopard) the scrollbars have no arrows at all. This is + * handled by having scrollPtr->arrowLength set to zero. */ - int width, fieldLength; + int fieldLength; if (scrollPtr->highlightWidth < 0) { scrollPtr->highlightWidth = 0; } scrollPtr->inset = scrollPtr->highlightWidth + scrollPtr->borderWidth; - width = (scrollPtr->vertical) ? Tk_Width(scrollPtr->tkwin) - : Tk_Height(scrollPtr->tkwin); - scrollPtr->arrowLength = width - 2*scrollPtr->inset + 1; + scrollPtr->arrowLength = 0; fieldLength = (scrollPtr->vertical ? Tk_Height(scrollPtr->tkwin) : Tk_Width(scrollPtr->tkwin)) - 2*(scrollPtr->arrowLength + scrollPtr->inset); diff --git a/tests/scrollbar.test b/tests/scrollbar.test index bd14067..af83e93 100644 --- a/tests/scrollbar.test +++ b/tests/scrollbar.test @@ -24,6 +24,7 @@ proc getTroughSize {w} { return [expr [winfo width $w] - 2*[testmetrics cxhscroll $w]] } } else { + # Calculations here assume that the arrow area is a square. if [string match v* [$w cget -orient]] { return [expr [winfo height $w] \ - ([winfo width $w] \ diff --git a/unix/tkUnixScrlbr.c b/unix/tkUnixScrlbr.c index 0507211..2446c3f 100644 --- a/unix/tkUnixScrlbr.c +++ b/unix/tkUnixScrlbr.c @@ -289,6 +289,11 @@ TkpComputeScrollbarGeometry( scrollPtr->inset = scrollPtr->highlightWidth + scrollPtr->borderWidth; width = (scrollPtr->vertical) ? Tk_Width(scrollPtr->tkwin) : Tk_Height(scrollPtr->tkwin); + + /* + * Next line assumes that the arrow area is a square. + */ + scrollPtr->arrowLength = width - 2*scrollPtr->inset + 1; fieldLength = (scrollPtr->vertical ? Tk_Height(scrollPtr->tkwin) : Tk_Width(scrollPtr->tkwin)) |