aboutsummaryrefslogtreecommitdiff
path: root/depends/patches/qt
diff options
context:
space:
mode:
authorHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2021-11-19 19:48:35 +0200
committerfanquake <fanquake@gmail.com>2021-12-03 14:07:12 +0800
commit1732eaba4f853814a3c3b770462f14eee55a8c98 (patch)
tree87f88b0933d6db594589a99f9f40773cadd1544b /depends/patches/qt
parentc870027cc261ebe6e0e2030df06619a8f663e80a (diff)
build, qt: Fix regression in rendering on macOS Big Sur
Diffstat (limited to 'depends/patches/qt')
-rw-r--r--depends/patches/qt/fix_bigsur_style.patch90
1 files changed, 90 insertions, 0 deletions
diff --git a/depends/patches/qt/fix_bigsur_style.patch b/depends/patches/qt/fix_bigsur_style.patch
new file mode 100644
index 0000000000..0f6c848bb0
--- /dev/null
+++ b/depends/patches/qt/fix_bigsur_style.patch
@@ -0,0 +1,90 @@
+Fix rendering in macOS BigSur
+
+See: https://bugreports.qt.io/browse/QTBUG-86513.
+
+Upstream commits (combined in this patch):
+ - Qt 6.0: 40fb97e97f550b8afd13ecc3a038d9d0c2d82bbb
+ - Qt 6.0: 3857f104cac127f62e64e55a20613f0ac2e6b843
+ - Qt 6.1: abee4cdd5925a8513f51784754fca8fa35031732
+
+--- old/qtbase/src/plugins/styles/mac/qmacstyle_mac.mm
++++ new/qtbase/src/plugins/styles/mac/qmacstyle_mac.mm
+@@ -3870,6 +3870,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
+ const auto cs = d->effectiveAquaSizeConstrain(opt, w);
+ // Extra hacks to get the proper pressed appreance when not selected or selected and inactive
+ const bool needsInactiveHack = (!isActive && isSelected);
++ const bool isBigSurOrAbove = QOperatingSystemVersion::current() >= QOperatingSystemVersion::MacOSBigSur;
+ const auto ct = !needsInactiveHack && (isSelected || tp == QStyleOptionTab::OnlyOneTab) ?
+ QMacStylePrivate::Button_PushButton :
+ QMacStylePrivate::Button_PopupButton;
+@@ -3878,6 +3879,12 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
+ auto *pb = static_cast<NSButton *>(d->cocoaControl(cw));
+
+ auto vOffset = isPopupButton ? 1 : 2;
++ if (isBigSurOrAbove) {
++ // Make it 1, otherwise, offset is very visible compared
++ // to selected tab (which is not a popup button).
++ vOffset = 1;
++ }
++
+ if (tabDirection == QMacStylePrivate::East)
+ vOffset -= 1;
+ const auto outerAdjust = isPopupButton ? 1 : 4;
+@@ -3894,9 +3901,22 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
+ frameRect = frameRect.adjusted(-innerAdjust, 0, outerAdjust, 0);
+ else
+ frameRect = frameRect.adjusted(-outerAdjust, 0, innerAdjust, 0);
++
++ if (isSelected && isBigSurOrAbove) {
++ // 1 pixed of 'roundness' is still visible on the right
++ // (the left is OK, it's rounded).
++ frameRect = frameRect.adjusted(0, 0, 1, 0);
++ }
++
+ break;
+ case QStyleOptionTab::Middle:
+ frameRect = frameRect.adjusted(-innerAdjust, 0, innerAdjust, 0);
++
++ if (isSelected && isBigSurOrAbove) {
++ // 1 pixel of 'roundness' is still visible on both
++ // sides - left and right.
++ frameRect = frameRect.adjusted(-1, 0, 1, 0);
++ }
+ break;
+ case QStyleOptionTab::End:
+ // Pressed state hack: tweak adjustments in preparation for flip below
+@@ -3904,6 +3924,11 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
+ frameRect = frameRect.adjusted(-innerAdjust, 0, outerAdjust, 0);
+ else
+ frameRect = frameRect.adjusted(-outerAdjust, 0, innerAdjust, 0);
++
++ if (isSelected && isBigSurOrAbove) {
++ // 1 pixel of 'roundness' is still visible on the left.
++ frameRect = frameRect.adjusted(-1, 0, 0, 0);
++ }
+ break;
+ case QStyleOptionTab::OnlyOneTab:
+ frameRect = frameRect.adjusted(-outerAdjust, 0, outerAdjust, 0);
+@@ -3951,7 +3976,10 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
+ NSPopUpArrowPosition oldPosition = NSPopUpArrowAtCenter;
+ NSPopUpButtonCell *pbCell = nil;
+ auto rAdjusted = r;
+- if (isPopupButton && tp == QStyleOptionTab::OnlyOneTab) {
++ if (isPopupButton && (tp == QStyleOptionTab::OnlyOneTab || isBigSurOrAbove)) {
++ // Note: starting from macOS BigSur NSPopupButton has this
++ // arrow 'button' in a different place and it became
++ // quite visible 'in between' inactive tabs.
+ pbCell = static_cast<NSPopUpButtonCell *>(pb.cell);
+ oldPosition = pbCell.arrowPosition;
+ pbCell.arrowPosition = NSPopUpNoArrow;
+@@ -3959,6 +3987,10 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
+ // NSPopUpButton in this state is smaller.
+ rAdjusted.origin.x -= 3;
+ rAdjusted.size.width += 6;
++ if (isBigSurOrAbove) {
++ if (tp == QStyleOptionTab::End)
++ rAdjusted.origin.x -= 2;
++ }
+ }
+ }
+