vcl/osx/salnativewidgets.cxx | 81 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 75 insertions(+), 6 deletions(-)
New commits: commit 2cddb7f648f80c28e080bebacc31a98333f77f2c Author: Patrick Luby <[email protected]> AuthorDate: Thu Jan 15 19:40:32 2026 -0500 Commit: Patrick Luby <[email protected]> CommitDate: Sat Jan 24 19:16:33 2026 +0100 Related: Use macOS Tahoe's native control bounds for macOS 26.2 Builds on pre-Tahoe macOS versions still render the pre-Tahoe style so further adjustments are needed when running on macOS Tahoe. Change-Id: Idef3555680020c1862b8d8c8c8b03a80497050a3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197411 Reviewed-by: Patrick Luby <[email protected]> Tested-by: Jenkins diff --git a/vcl/osx/salnativewidgets.cxx b/vcl/osx/salnativewidgets.cxx index 75677a7cb590..c8f73c723d50 100644 --- a/vcl/osx/salnativewidgets.cxx +++ b/vcl/osx/salnativewidgets.cxx @@ -466,9 +466,21 @@ static bool useTahoeNativeBounds() return false; } +static bool adjustPreTahoeBuildForTahoeNativeBounds() +{ +#if __MAC_OS_X_VERSION_MAX_ALLOWED < 260000 + if (@available(macOS 26.2, *)) + return true; +#endif + + return false; +} + static int spinButtonWidth() { - if (useTahoeNativeBounds()) + // Builds on pre-Tahoe macOS versions still render the pre-Tahoe style + // so further adjustments are needed when running on macOS Tahoe. + if (useTahoeNativeBounds() && !adjustPreTahoeBuildForTahoeNativeBounds()) return 23; else return 16; @@ -652,6 +664,27 @@ bool AquaGraphicsBackendBase::performDrawNativeControl(ControlType nType, rc.origin.y += 1; rc.size.height -= FOCUS_RING_WIDTH; } + + // Builds on pre-Tahoe macOS versions still render + // the pre-Tahoe style so further adjustments are + // needed when running on macOS Tahoe. + if (adjustPreTahoeBuildForTahoeNativeBounds()) + { + if (eBezelStyle == NSBezelStyleFlexiblePush) + { + rc.origin.x -= FOCUS_RING_WIDTH; + rc.size.width += FOCUS_RING_WIDTH * 2; + rc.origin.y -= (FOCUS_RING_WIDTH / 2) - 1; + rc.size.height += FOCUS_RING_WIDTH; + } + else + { + rc.origin.x -= FOCUS_RING_WIDTH * 2; + rc.size.width += FOCUS_RING_WIDTH * 4; + rc.origin.y -= FOCUS_RING_WIDTH * 2; + rc.size.height += FOCUS_RING_WIDTH * 4; + } + } } else { @@ -1051,6 +1084,20 @@ bool AquaGraphicsBackendBase::performDrawNativeControl(ControlType nType, { rc.origin.y += FOCUS_RING_WIDTH / 4; rc.size.height -= FOCUS_RING_WIDTH / 2; + + // Builds on pre-Tahoe macOS versions still render + // the pre-Tahoe style so further adjustments are + // needed when running on macOS Tahoe. + if (adjustPreTahoeBuildForTahoeNativeBounds()) + { + rc.size.width -= 1; + rc.origin.y += 1; + rc.size.height -= FOCUS_RING_WIDTH / 2; + } + } + else + { + rc.size.width -= 1; } } else @@ -1067,18 +1114,40 @@ bool AquaGraphicsBackendBase::performDrawNativeControl(ControlType nType, else rc.size.width -= FOCUS_RING_WIDTH * 3 / 4; rc.size.height -= FOCUS_RING_WIDTH; + + // Builds on pre-Tahoe macOS versions still render + // the pre-Tahoe style so further adjustments are + // needed when running on macOS Tahoe. + if (adjustPreTahoeBuildForTahoeNativeBounds()) + { + if (nPaintIndex == 0) + { + rc.origin.x -= FOCUS_RING_WIDTH / 2; + rc.size.width += FOCUS_RING_WIDTH / 2; + } + else if (nPaintIndex == 1) + { + rc.origin.x -= FOCUS_RING_WIDTH / 2 + 1; + rc.size.width += FOCUS_RING_WIDTH; + } + else if (nPaintIndex == 2) + { + rc.origin.x -= FOCUS_RING_WIDTH / 2; + rc.size.width += FOCUS_RING_WIDTH; + } + } } else { - if (nPaintIndex == 0) + if (nPaintIndex == 1) { - rc.origin.x += FOCUS_RING_WIDTH / 2; - rc.size.width -= FOCUS_RING_WIDTH / 2; + rc.origin.x -= 1; + rc.size.width += 1; } else if (nPaintIndex == 2) { - rc.size.width -= FOCUS_RING_WIDTH / 2; - rc.size.width -= FOCUS_RING_WIDTH / 2; + rc.origin.x -= 1; + rc.size.width += 1; } } }
