mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-02 09:46:52 -05:00
build, qt: Fix regression in rendering on macOS Big Sur
This commit is contained in:
parent
c870027cc2
commit
1732eaba4f
2 changed files with 92 additions and 0 deletions
|
@ -12,6 +12,7 @@ $(package)_patches += fix_qt_pkgconfig.patch mac-qmake.conf fix_no_printer.patch
|
|||
$(package)_patches += dont_hardcode_x86_64.patch fix_montery_include.patch
|
||||
$(package)_patches += fix_android_jni_static.patch dont_hardcode_pwd.patch
|
||||
$(package)_patches += qtbase-moc-ignore-gcc-macro.patch fix_limits_header.patch
|
||||
$(package)_patches += fix_bigsur_style.patch
|
||||
|
||||
$(package)_qttranslations_file_name=qttranslations-$($(package)_suffix)
|
||||
$(package)_qttranslations_sha256_hash=d5788e86257b21d5323f1efd94376a213e091d1e5e03b45a95dd052b5f570db8
|
||||
|
@ -235,6 +236,7 @@ define $(package)_preprocess_cmds
|
|||
patch -p1 -i $($(package)_patch_dir)/qtbase-moc-ignore-gcc-macro.patch && \
|
||||
patch -p1 -i $($(package)_patch_dir)/fix_limits_header.patch && \
|
||||
patch -p1 -i $($(package)_patch_dir)/fix_montery_include.patch && \
|
||||
patch -p1 -i $($(package)_patch_dir)/fix_bigsur_style.patch && \
|
||||
mkdir -p qtbase/mkspecs/macx-clang-linux &&\
|
||||
cp -f qtbase/mkspecs/macx-clang/qplatformdefs.h qtbase/mkspecs/macx-clang-linux/ &&\
|
||||
cp -f $($(package)_patch_dir)/mac-qmake.conf qtbase/mkspecs/macx-clang-linux/qmake.conf && \
|
||||
|
|
90
depends/patches/qt/fix_bigsur_style.patch
Normal file
90
depends/patches/qt/fix_bigsur_style.patch
Normal file
|
@ -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;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
Loading…
Add table
Reference in a new issue