vcl/osx/salnativewidgets.cxx | 58 +++++++++++++++++-------------------------- 1 file changed, 23 insertions(+), 35 deletions(-)
New commits: commit bb5e7c43b48a1866a402990d5d1395436273dbee Author: Patrick Luby <[email protected]> AuthorDate: Wed Dec 24 19:15:29 2025 -0500 Commit: Patrick Luby <[email protected]> CommitDate: Thu Jan 8 15:23:19 2026 +0100 Use macOS Tahoe's native control bounds for macOS 26.2 In macOS 26.0 and 26.1, macOS would only use Tahoe's native control bounds if LibreOffice was built with Xcode 26. However, macOS 26.2 now uses Tahoe's native bounds even if LibreOffice was built with an earlier version of Xcode. So move all the compiler and macOS version checks that were added in commit 764799befcb927f68f78e904213e3db7195554cb as well as the new macOS 16.2 check into a new useTahoeNativeBounds() function. Change-Id: Ib3d3c57223b6599b1954459aafcf304e07bf2d32 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196204 Reviewed-by: Patrick Luby <[email protected]> Tested-by: Jenkins diff --git a/vcl/osx/salnativewidgets.cxx b/vcl/osx/salnativewidgets.cxx index e75462a17910..75677a7cb590 100644 --- a/vcl/osx/salnativewidgets.cxx +++ b/vcl/osx/salnativewidgets.cxx @@ -454,13 +454,23 @@ static void drawEditableBackground(CGContextRef context, const NSRect& rc) CGContextRestoreGState(context); } -static constexpr int spinButtonWidth() +static bool useTahoeNativeBounds() { + if (@available(macOS 26.2, *)) + return true; #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 260000 - if (@available(macOS 26, *)) + else if (@available(macOS 26, *)) + return true; +#endif + + return false; +} + +static int spinButtonWidth() +{ + if (useTahoeNativeBounds()) return 23; else -#endif return 16; } @@ -633,8 +643,7 @@ bool AquaGraphicsBackendBase::performDrawNativeControl(ControlType nType, rc.origin.x -= nMargin; rc.size.width += nMargin * 2; -#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 260000 - if (@available(macOS 26, *)) + if (useTahoeNativeBounds()) { rc.origin.x += FOCUS_RING_WIDTH * 2; rc.size.width -= FOCUS_RING_WIDTH * 4; @@ -645,7 +654,6 @@ bool AquaGraphicsBackendBase::performDrawNativeControl(ControlType nType, } } else -#endif { if (eBezelStyle == NSBezelStyleFlexiblePush) { @@ -947,24 +955,20 @@ bool AquaGraphicsBackendBase::performDrawNativeControl(ControlType nType, [pCtrl setSegmentCount: nCells]; if (bSolo) { -#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 260000 - if (@available(macOS 26, *)) + if (useTahoeNativeBounds()) [pCtrl setWidth: rc.size.width forSegment: 0]; else -#endif [pCtrl setWidth: rc.size.width + FOCUS_RING_WIDTH forSegment: 0]; } else { -#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 260000 - if (@available(macOS 26, *)) + if (useTahoeNativeBounds()) { [pCtrl setWidth: rc.size.width - FOCUS_RING_WIDTH/2 forSegment: 0]; [pCtrl setWidth: rc.size.width - FOCUS_RING_WIDTH/4 forSegment: 1]; [pCtrl setWidth: rc.size.width - FOCUS_RING_WIDTH/2 forSegment: 2]; } else -#endif { [pCtrl setWidth: rc.size.width + FOCUS_RING_WIDTH/2 forSegment: 0]; @@ -1043,18 +1047,15 @@ bool AquaGraphicsBackendBase::performDrawNativeControl(ControlType nType, { if (bSolo) { -#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 260000 - if (@available(macOS 26, *)) + if (useTahoeNativeBounds()) { rc.origin.y += FOCUS_RING_WIDTH / 4; rc.size.height -= FOCUS_RING_WIDTH / 2; } -#endif } else { -#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 260000 - if (@available(macOS 26, *)) + if (useTahoeNativeBounds()) { if (nPaintIndex == 0) rc.origin.x += FOCUS_RING_WIDTH / 2; @@ -1068,7 +1069,6 @@ bool AquaGraphicsBackendBase::performDrawNativeControl(ControlType nType, rc.size.height -= FOCUS_RING_WIDTH; } else -#endif { if (nPaintIndex == 0) { @@ -1137,11 +1137,9 @@ bool AquaGraphicsBackendBase::performDrawNativeControl(ControlType nType, { rc.origin.x += 2; -#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 260000 - if (@available(macOS 26, *)) + if (useTahoeNativeBounds()) rc.size.width -= 4; else -#endif rc.size.width -= 1; } @@ -1173,14 +1171,12 @@ bool AquaGraphicsBackendBase::performDrawNativeControl(ControlType nType, else [pBtn setKeyEquivalent: @""]; -#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 260000 - if (@available(macOS 26, *)) + if (useTahoeNativeBounds()) { rc.origin.x += 2; rc.size.width -= 4; } else -#endif { rc.size.width += 1; } @@ -1250,11 +1246,7 @@ bool AquaGraphicsBackendBase::performDrawNativeControl(ControlType nType, ControlState nLowerState = pSpinButtonVal->mnLowerState; rc.origin.x += rc.size.width + FOCUS_RING_WIDTH + 1; -#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 260000 - if (@available(macOS 26, *)) - ; - else -#endif + if (!useTahoeNativeBounds()) rc.origin.y -= 1; rc.size.width = SPIN_BUTTON_WIDTH; rc.size.height = SPIN_UPPER_BUTTON_HEIGHT + SPIN_LOWER_BUTTON_HEIGHT; @@ -1406,11 +1398,9 @@ bool AquaSalGraphics::getNativeControlRegion(ControlType nType, case ControlType::TabItem: { w = aCtrlBoundRect.GetWidth() + 2 * TAB_TEXT_MARGIN; -#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 260000 - if (@available(macOS 26, *)) + if (useTahoeNativeBounds()) h = TAB_HEIGHT + 2 + FOCUS_RING_WIDTH; else -#endif h = TAB_HEIGHT + 2; rNativeContentRegion = tools::Rectangle(Point(x, y), Size(w, h)); rNativeBoundingRegion = tools::Rectangle(Point(x, y), Size(w, h)); @@ -1506,11 +1496,9 @@ bool AquaSalGraphics::getNativeControlRegion(ControlType nType, if (nPart == ControlPart::Entire) { w = aCtrlBoundRect.GetWidth(); -#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 260000 - if (@available(macOS 26, *)) + if (useTahoeNativeBounds()) h = EDITBOX_HEIGHT + 2 * FOCUS_RING_WIDTH + 1; else -#endif h = EDITBOX_HEIGHT + 2 * FOCUS_RING_WIDTH; x += SPINBOX_OFFSET; rNativeBoundingRegion = tools::Rectangle(Point(x, y), Size(w, h));
