summaryrefslogtreecommitdiffstats
path: root/desktop-plasma
diff options
context:
space:
mode:
Diffstat (limited to 'desktop-plasma')
-rw-r--r--desktop-plasma/patches/kde-apps/dolphin/0001-Kitemlistcontroller-only-accept-doubleclick-for-left.patch106
-rw-r--r--desktop-plasma/patches/kde-apps/dolphin/0002-Only-accept-left-mouse-button-for-double-click-actio.patch32
-rw-r--r--desktop-plasma/patches/kde-apps/dolphin/0003-Fix-double-click-view-background-feature.patch30
-rw-r--r--desktop-plasma/patches/kde-apps/dolphin/0004-kitemlistcontroller-process-forward-back-buttons-whe.patch47
4 files changed, 215 insertions, 0 deletions
diff --git a/desktop-plasma/patches/kde-apps/dolphin/0001-Kitemlistcontroller-only-accept-doubleclick-for-left.patch b/desktop-plasma/patches/kde-apps/dolphin/0001-Kitemlistcontroller-only-accept-doubleclick-for-left.patch
new file mode 100644
index 0000000..b8a53a1
--- /dev/null
+++ b/desktop-plasma/patches/kde-apps/dolphin/0001-Kitemlistcontroller-only-accept-doubleclick-for-left.patch
@@ -0,0 +1,106 @@
+From 531244611f11bfee9f6b9f2efd98ed418d860b3d Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?M=C3=A9ven=20Car?= <meven@kde.org>
+Date: Wed, 31 Jul 2024 11:00:32 +0200
+Subject: [PATCH 1/4] Kitemlistcontroller: only accept doubleclick for left
+ mouse button
+
+Add test for double-click activation.
+
+BUG: 485295
+---
+ src/kitemviews/kitemlistcontroller.cpp | 2 +-
+ src/tests/kitemlistcontrollertest.cpp | 58 ++++++++++++++++++++++++++
+ 2 files changed, 59 insertions(+), 1 deletion(-)
+
+diff --git a/src/kitemviews/kitemlistcontroller.cpp b/src/kitemviews/kitemlistcontroller.cpp
+index 392dc410e..997e6623b 100644
+--- a/src/kitemviews/kitemlistcontroller.cpp
++++ b/src/kitemviews/kitemlistcontroller.cpp
+@@ -713,7 +713,7 @@ bool KItemListController::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event,
+ }
+ }
+
+- if (event->button() & Qt::RightButton) {
++ if (event->button() & ~Qt::LeftButton) {
+ return false;
+ }
+
+diff --git a/src/tests/kitemlistcontrollertest.cpp b/src/tests/kitemlistcontrollertest.cpp
+index cb921781d..18ad1186d 100644
+--- a/src/tests/kitemlistcontrollertest.cpp
++++ b/src/tests/kitemlistcontrollertest.cpp
+@@ -620,6 +620,41 @@ void KItemListControllerTest::testMouseClickActivation()
+ mouseReleaseEvent.setButton(Qt::LeftButton);
+ mouseReleaseEvent.setButtons(Qt::NoButton);
+
++ QGraphicsSceneMouseEvent mouseDoubleClickEvent(QEvent::GraphicsSceneMouseDoubleClick);
++ mouseDoubleClickEvent.setPos(pos);
++ mouseDoubleClickEvent.setButton(Qt::LeftButton);
++ mouseDoubleClickEvent.setButtons(Qt::LeftButton);
++
++ QGraphicsSceneMouseEvent mouseRightPressEvent(QEvent::GraphicsSceneMousePress);
++ mouseRightPressEvent.setPos(pos);
++ mouseRightPressEvent.setButton(Qt::RightButton);
++ mouseRightPressEvent.setButtons(Qt::RightButton);
++
++ QGraphicsSceneMouseEvent mouseRightReleaseEvent(QEvent::GraphicsSceneMouseRelease);
++ mouseRightReleaseEvent.setPos(pos);
++ mouseRightReleaseEvent.setButton(Qt::RightButton);
++ mouseRightReleaseEvent.setButtons(Qt::NoButton);
++
++ QGraphicsSceneMouseEvent mouseRightDoubleClickEvent(QEvent::GraphicsSceneMouseDoubleClick);
++ mouseRightDoubleClickEvent.setPos(pos);
++ mouseRightDoubleClickEvent.setButton(Qt::RightButton);
++ mouseRightDoubleClickEvent.setButtons(Qt::RightButton);
++
++ QGraphicsSceneMouseEvent mouseBackPressEvent(QEvent::GraphicsSceneMousePress);
++ mouseBackPressEvent.setPos(pos);
++ mouseBackPressEvent.setButton(Qt::BackButton);
++ mouseBackPressEvent.setButtons(Qt::BackButton);
++
++ QGraphicsSceneMouseEvent mouseBackReleaseEvent(QEvent::GraphicsSceneMouseRelease);
++ mouseBackReleaseEvent.setPos(pos);
++ mouseBackReleaseEvent.setButton(Qt::BackButton);
++ mouseBackReleaseEvent.setButtons(Qt::NoButton);
++
++ QGraphicsSceneMouseEvent mouseBackDoubleClickEvent(QEvent::GraphicsSceneMouseDoubleClick);
++ mouseBackDoubleClickEvent.setPos(pos);
++ mouseBackDoubleClickEvent.setButton(Qt::BackButton);
++ mouseBackDoubleClickEvent.setButtons(Qt::BackButton);
++
+ QSignalSpy spyItemActivated(m_controller, &KItemListController::itemActivated);
+
+ // Default setting: single click activation.
+@@ -638,6 +673,29 @@ void KItemListControllerTest::testMouseClickActivation()
+ spyItemActivated.clear();
+ QVERIFY(m_view->controller()->selectionManager()->hasSelection());
+
++ // emulation of double click according to https://doc.qt.io/qt-6/qgraphicsscene.html#mouseDoubleClickEvent
++ m_view->event(&mousePressEvent);
++ m_view->event(&mouseReleaseEvent);
++ m_view->event(&mouseDoubleClickEvent);
++ m_view->event(&mouseReleaseEvent);
++ QCOMPARE(spyItemActivated.count(), 1);
++ spyItemActivated.clear();
++ QVERIFY2(!m_view->controller()->selectionManager()->hasSelection(), "An item should not be implicitly selected during activation. @see bug 424723");
++
++ // right mouse button should not trigger activation
++ m_view->event(&mouseRightPressEvent);
++ m_view->event(&mouseRightReleaseEvent);
++ m_view->event(&mouseRightDoubleClickEvent);
++ m_view->event(&mouseRightReleaseEvent);
++ QCOMPARE(spyItemActivated.count(), 0);
++
++ // back mouse button should not trigger activation
++ m_view->event(&mouseBackPressEvent);
++ m_view->event(&mouseBackReleaseEvent);
++ m_view->event(&mouseBackDoubleClickEvent);
++ m_view->event(&mouseBackReleaseEvent);
++ QCOMPARE(spyItemActivated.count(), 0);
++
+ // Enforce single click activation in the controller.
+ m_controller->setSingleClickActivationEnforced(true);
+ m_view->event(&mousePressEvent);
+--
+2.47.0
+
diff --git a/desktop-plasma/patches/kde-apps/dolphin/0002-Only-accept-left-mouse-button-for-double-click-actio.patch b/desktop-plasma/patches/kde-apps/dolphin/0002-Only-accept-left-mouse-button-for-double-click-actio.patch
new file mode 100644
index 0000000..9fd79a6
--- /dev/null
+++ b/desktop-plasma/patches/kde-apps/dolphin/0002-Only-accept-left-mouse-button-for-double-click-actio.patch
@@ -0,0 +1,32 @@
+From fbdbe93e3d6b25fc4a40af4c9c3fe337794452ba Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?M=C3=A9ven=20Car?= <meven@kde.org>
+Date: Tue, 13 Aug 2024 11:01:43 +0200
+Subject: [PATCH 2/4] Only accept left mouse button for double click actions
+
+Such
+ * double click background
+
+BUG: 485295
+---
+ src/dolphinmainwindow.cpp | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp
+index 8bc066455..bf605fa96 100644
+--- a/src/dolphinmainwindow.cpp
++++ b/src/dolphinmainwindow.cpp
+@@ -2922,7 +2922,10 @@ bool DolphinMainWindow::isItemVisibleInAnyView(const QString &urlOfItem)
+
+ void DolphinMainWindow::slotDoubleClickViewBackground(Qt::MouseButton button)
+ {
+- Q_UNUSED(button) // might be of use later
++ if (button == Qt::MouseButton::LeftButton) {
++ // only handle left mouse button for now
++ return;
++ }
+
+ GeneralSettings *settings = GeneralSettings::self();
+ QString clickAction = settings->doubleClickViewAction();
+--
+2.47.0
+
diff --git a/desktop-plasma/patches/kde-apps/dolphin/0003-Fix-double-click-view-background-feature.patch b/desktop-plasma/patches/kde-apps/dolphin/0003-Fix-double-click-view-background-feature.patch
new file mode 100644
index 0000000..ee6c343
--- /dev/null
+++ b/desktop-plasma/patches/kde-apps/dolphin/0003-Fix-double-click-view-background-feature.patch
@@ -0,0 +1,30 @@
+From 123eec787f0198b91c3bfdb17262df0c5e9a8c28 Mon Sep 17 00:00:00 2001
+From: Felix Ernst <felixernst@zohomail.eu>
+Date: Mon, 14 Oct 2024 14:44:47 +0200
+Subject: [PATCH 3/4] Fix double-click view background feature
+
+c934e803647674b4692668f047b6ffa18121982a was meant to change the
+double-click view background feature to only allow double-clicks
+with the left mouse button. However, it mistakenly did the exact
+opposite and allowed every double-click except ones with the left
+mouse button to trigger the feature. This one-liner fixes this.
+---
+ src/dolphinmainwindow.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp
+index bf605fa96..9b2c0f97e 100644
+--- a/src/dolphinmainwindow.cpp
++++ b/src/dolphinmainwindow.cpp
+@@ -2922,7 +2922,7 @@ bool DolphinMainWindow::isItemVisibleInAnyView(const QString &urlOfItem)
+
+ void DolphinMainWindow::slotDoubleClickViewBackground(Qt::MouseButton button)
+ {
+- if (button == Qt::MouseButton::LeftButton) {
++ if (button != Qt::MouseButton::LeftButton) {
+ // only handle left mouse button for now
+ return;
+ }
+--
+2.47.0
+
diff --git a/desktop-plasma/patches/kde-apps/dolphin/0004-kitemlistcontroller-process-forward-back-buttons-whe.patch b/desktop-plasma/patches/kde-apps/dolphin/0004-kitemlistcontroller-process-forward-back-buttons-whe.patch
new file mode 100644
index 0000000..d0fa8eb
--- /dev/null
+++ b/desktop-plasma/patches/kde-apps/dolphin/0004-kitemlistcontroller-process-forward-back-buttons-whe.patch
@@ -0,0 +1,47 @@
+From dd38c471458760b1795ac2cc0017bc5b5924b70b Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Wolfgang=20M=C3=BCller?= <wolf@oriole.systems>
+Date: Mon, 14 Oct 2024 18:43:28 +0200
+Subject: [PATCH 4/4] kitemlistcontroller: process forward/back buttons when
+ double-clicking
+
+Tapping the forward or back mouse buttons quickly enough makes Dolphin
+interpret the action as a double-click of the button in question and
+handle it in mouseDoubleClickEvent() instead of its normal button
+handler. This means that certain button presses might seem delayed or
+"swallowed" when quickly navigating forwards or backwards through the
+history.
+
+Since a double-click of the forward or back button is currently
+meaningless, fix this by emitting a normal mouseButtonPressed event for
+those buttons in the double-click handler and skipping any further event
+processing.
+
+Co-authored-by: Felix Ernst <felixernst@zohomail.eu>
+CCBUG: 485295
+---
+ src/kitemviews/kitemlistcontroller.cpp | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/src/kitemviews/kitemlistcontroller.cpp b/src/kitemviews/kitemlistcontroller.cpp
+index 997e6623b..821e1b75f 100644
+--- a/src/kitemviews/kitemlistcontroller.cpp
++++ b/src/kitemviews/kitemlistcontroller.cpp
+@@ -700,6 +700,15 @@ bool KItemListController::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event,
+ const QPointF pos = transform.map(event->pos());
+ const std::optional<int> index = m_view->itemAt(pos);
+
++ if (event->button() & (Qt::ForwardButton | Qt::BackButton)) {
++ // "Forward" and "Back" are reserved for quickly navigating through the
++ // history. Double-clicking those buttons should be interpreted as two
++ // separate button presses. We arrive here for the second click, which
++ // we now react to just as we would for a singular click
++ Q_EMIT mouseButtonPressed(index.value_or(-1), event->button());
++ return false;
++ }
++
+ if (!index.has_value()) {
+ Q_EMIT doubleClickViewBackground(event->button());
+ return false;
+--
+2.47.0
+