commit:     380ca721deb83c60564370ee909796a120fe2d54
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 24 23:03:43 2022 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Tue Jul 26 12:04:51 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=380ca721

kde-plasma/breeze: kstyle: fix qqc2 desktop style sliders in RtL

Upstream commits:
c7bfd1c728c603464cab9a43a0627a82d1ab0933
b51316269ff02c84648667df97563bacd2538b6c

KDE-bug: https://bugs.kde.org/show_bug.cgi?id=430101
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 kde-plasma/breeze/breeze-5.24.6-r1.ebuild          | 54 +++++++++++++++
 ...-5.24.6-fix-qqc2-progressbar-style-in-rtl.patch | 58 +++++++++++++++++
 .../breeze-5.24.6-fix-qqc2-sliders-in-rtl.patch    | 76 ++++++++++++++++++++++
 3 files changed, 188 insertions(+)

diff --git a/kde-plasma/breeze/breeze-5.24.6-r1.ebuild 
b/kde-plasma/breeze/breeze-5.24.6-r1.ebuild
new file mode 100644
index 000000000000..503fdca4df41
--- /dev/null
+++ b/kde-plasma/breeze/breeze-5.24.6-r1.ebuild
@@ -0,0 +1,54 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+KFMIN=5.92.0
+PVCUT=$(ver_cut 1-3)
+QTMIN=5.15.4
+inherit ecm plasma.kde.org
+
+DESCRIPTION="Breeze visual style for the Plasma desktop"
+HOMEPAGE="https://invent.kde.org/plasma/breeze";
+
+LICENSE="GPL-2" # TODO: CHECK
+SLOT="5"
+KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc64 ~riscv ~x86"
+IUSE="X"
+
+RDEPEND="
+       >=dev-qt/qtdbus-${QTMIN}:5
+       >=dev-qt/qtdeclarative-${QTMIN}:5
+       >=dev-qt/qtgui-${QTMIN}:5
+       >=dev-qt/qtwidgets-${QTMIN}:5
+       >=dev-qt/qtx11extras-${QTMIN}:5
+       >=kde-frameworks/frameworkintegration-${KFMIN}:5
+       >=kde-frameworks/kcmutils-${KFMIN}:5
+       >=kde-frameworks/kconfig-${KFMIN}:5
+       >=kde-frameworks/kconfigwidgets-${KFMIN}:5
+       >=kde-frameworks/kcoreaddons-${KFMIN}:5
+       >=kde-frameworks/kguiaddons-${KFMIN}:5
+       >=kde-frameworks/ki18n-${KFMIN}:5
+       >=kde-frameworks/kiconthemes-${KFMIN}:5
+       >=kde-frameworks/kwidgetsaddons-${KFMIN}:5
+       >=kde-frameworks/kwindowsystem-${KFMIN}:5
+       >=kde-plasma/kdecoration-${PVCUT}:5
+       X? ( x11-libs/libxcb )
+"
+DEPEND="${RDEPEND}"
+PDEPEND="
+       >=kde-frameworks/breeze-icons-${KFMIN}:5
+       >=kde-plasma/kde-cli-tools-${PVCUT}:5
+"
+
+PATCHES=(
+       "${FILESDIR}/${P}-fix-qqc2-sliders-in-rtl.patch" # KDE-bug #430101
+       "${FILESDIR}/${P}-fix-qqc2-progressbar-style-in-rtl.patch" # KDE-bug 
#430101
+)
+
+src_configure() {
+       local mycmakeargs=(
+               $(cmake_use_find_package X XCB)
+       )
+       ecm_src_configure
+}

diff --git 
a/kde-plasma/breeze/files/breeze-5.24.6-fix-qqc2-progressbar-style-in-rtl.patch 
b/kde-plasma/breeze/files/breeze-5.24.6-fix-qqc2-progressbar-style-in-rtl.patch
new file mode 100644
index 000000000000..36e4f952d980
--- /dev/null
+++ 
b/kde-plasma/breeze/files/breeze-5.24.6-fix-qqc2-progressbar-style-in-rtl.patch
@@ -0,0 +1,58 @@
+From d7c0ab28df83eb4a4c39495a25e609047c735d59 Mon Sep 17 00:00:00 2001
+From: ivan tkachenko <m...@ratijas.tk>
+Date: Sat, 4 Jun 2022 05:00:53 +0300
+Subject: [PATCH] KStyle: Fix QQC2 ProgressBar desktop style in RTL layout
+ direction
+
+BUG: 430101
+
+(cherry picked from commit 2bf9fc4c7be280e2b77f7c150855e0fca0b80d9a)
+
+* asturm 2022-07-26: Merged with clang-format changes in commit
+  32149dc002ae574ed41f111bf52712b1765b906b
+
+---
+ kstyle/breezestyle.cpp | 16 ++++++++++------
+ 1 file changed, 10 insertions(+), 6 deletions(-)
+
+diff --git a/kstyle/breezestyle.cpp b/kstyle/breezestyle.cpp
+index c9fba292..0d7a8432 100644
+--- a/kstyle/breezestyle.cpp
++++ b/kstyle/breezestyle.cpp
+@@ -1749,23 +1749,27 @@ namespace Breeze
+         const bool horizontal( BreezePrivate::isProgressBarHorizontal( 
progressBarOption ) );
+ 
+         // check inverted appearance
+-        const bool inverted( progressBarOption->invertedAppearance );
++        bool inverted(progressBarOption->invertedAppearance);
++        if (horizontal) {
++            // un-invert in RTL layout
++            inverted ^= option->direction == Qt::RightToLeft;
++        }
+ 
+         // get progress and steps
+-        const qreal progress( progressBarOption->progress - 
progressBarOption->minimum );
++        const int progress(progressBarOption->progress - 
progressBarOption->minimum);
+         const int steps( qMax( progressBarOption->maximum  - 
progressBarOption->minimum, 1 ) );
+ 
+         //Calculate width fraction
+-        const qreal widthFrac = qMin( qreal(1), progress/steps );
++        const qreal position = qreal(progress) / qreal(steps);
++        const qreal visualPosition = inverted ? 1 - position : position;
+ 
+         // convert the pixel width
+-        const int indicatorSize( widthFrac*( horizontal ? 
rect.width():rect.height() ) );
++        const int indicatorSize(visualPosition * (horizontal ? rect.width() : 
rect.height()));
+ 
+         QRect indicatorRect;
+         if( horizontal )
+         {
+-
+-            indicatorRect = QRect( inverted ? ( rect.right() - indicatorSize 
+ 1):rect.left(), rect.y(), indicatorSize, rect.height() );
++            indicatorRect = QRect(rect.left(), rect.y(), indicatorSize, 
rect.height());
+             indicatorRect = visualRect( option->direction, rect, 
indicatorRect );
+ 
+         } else indicatorRect = QRect( rect.x(), inverted ? rect.top() : 
(rect.bottom() - indicatorSize + 1), rect.width(), indicatorSize );
+-- 
+2.35.1
+

diff --git 
a/kde-plasma/breeze/files/breeze-5.24.6-fix-qqc2-sliders-in-rtl.patch 
b/kde-plasma/breeze/files/breeze-5.24.6-fix-qqc2-sliders-in-rtl.patch
new file mode 100644
index 000000000000..b8b3504a0a0e
--- /dev/null
+++ b/kde-plasma/breeze/files/breeze-5.24.6-fix-qqc2-sliders-in-rtl.patch
@@ -0,0 +1,76 @@
+From 53f24305536850b244b730f9a04024daf02e753b Mon Sep 17 00:00:00 2001
+From: Jan Blackquill <uhh...@gmail.com>
+Date: Fri, 3 Jun 2022 17:34:02 -0400
+Subject: [PATCH] kstyle: fix qqc2 desktop style sliders in RtL
+
+We don't do any mirroring of the slider groove rects or tickmarks based on 
layout direction,
+and this causes qqc2-desktop-style sliders to render in the wrong direction.
+Swapping the leftRect and the rightRect when option->direction == 
Qt::RightToLeft
+fixes this.
+
+This wasn't broken with QWidgets because QSlider relies on (ab)using the 
upsideDown option
+in order to achieve mirroring of the groove instead of option->direction, and 
consequently,
+this change doesn't affect Qt widgets apps at all.
+
+BUG: 430101
+(cherry picked from commit e8b1d4aa47daf99041332f43c29fabdf70f25004)
+
+* asturm 2022-07-26: Merged with clang-format changes in commit
+  32149dc002ae574ed41f111bf52712b1765b906b
+
+---
+ kstyle/breezestyle.cpp | 14 ++++++++++----
+ 1 file changed, 10 insertions(+), 4 deletions(-)
+
+diff --git a/kstyle/breezestyle.cpp b/kstyle/breezestyle.cpp
+index 2ef2ea98..c9fba292 100644
+--- a/kstyle/breezestyle.cpp
++++ b/kstyle/breezestyle.cpp
+@@ -51,6 +51,7 @@
+ #include <QDialogButtonBox>
+ #include <QGraphicsItem>
+ #include <QGraphicsProxyWidget>
++#include <qnamespace.h>
+ 
+ #if BREEZE_HAVE_QTQUICK
+ #include <QQuickWindow>
+@@ -6679,6 +6680,7 @@ namespace Breeze
+                 }
+ 
+                 // colors
++                const auto reverseTicks = option->direction == 
Qt::LeftToRight ? upsideDown : !upsideDown;
+                 const auto base( _helper->separatorColor( palette ) );
+                 const auto &highlight = hasHighlightNeutral( widget, option, 
mouseOver, hasFocus ) ? _helper->neutralText( palette ) : palette.color( 
QPalette::Highlight );
+ 
+@@ -6693,8 +6695,8 @@ namespace Breeze
+                     int position( sliderPositionFromValue( 
sliderOption->minimum, sliderOption->maximum, current, available ) + fudge );
+                     foreach( const QLine& tickLine, tickLines )
+                     {
+-                        if( horizontal ) painter->drawLine( 
tickLine.translated( upsideDown ? (rect.width() - position) : position, 0 ) );
+-                        else painter->drawLine( tickLine.translated( 0, 
upsideDown ? (rect.height() - position):position ) );
++                        if( horizontal ) 
painter->drawLine(tickLine.translated(reverseTicks ? (rect.width() - position) 
: position, 0));
++                        else painter->drawLine(tickLine.translated(0, 
reverseTicks ? (rect.height() - position) : position));
+                     }
+ 
+                     // go to next position
+@@ -6729,11 +6731,15 @@ namespace Breeze
+ 
+                     auto leftRect( grooveRect );
+                     leftRect.setRight( handleRect.right() - 
Metrics::Slider_ControlThickness/2 );
+-                    _helper->renderSliderGroove( painter, leftRect, 
upsideDown ? grooveColor:highlight );
+ 
+                     auto rightRect( grooveRect );
+                     rightRect.setLeft( handleRect.left() + 
Metrics::Slider_ControlThickness/2 );
+-                    _helper->renderSliderGroove( painter, rightRect, 
upsideDown ? highlight:grooveColor );
++
++                    if (option->direction == Qt::RightToLeft)
++                        std::swap(leftRect, rightRect);
++
++                    _helper->renderSliderGroove(painter, leftRect, upsideDown 
? grooveColor : highlight);
++                    _helper->renderSliderGroove(painter, rightRect, 
upsideDown ? highlight : grooveColor);
+ 
+                 } else {
+ 
+-- 
+2.35.1
+

Reply via email to