File: upstream_64f3fe1b_Only-start-drag-and-drop-from-Widget-Explorer-when-dragging-horizonally.patch

package info (click to toggle)
plasma-desktop 4%3A6.3.6-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 61,044 kB
  • sloc: cpp: 37,691; ansic: 2,617; python: 1,386; javascript: 1,163; xml: 1,082; sh: 128; makefile: 16
file content (74 lines) | stat: -rw-r--r-- 2,908 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
From 64f3fe1baf7dbfa0255f9ad226b84eeb597d8ed6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Niccol=C3=B2=20Venerandi?= <niccolo@venerandi.com>
Date: Mon, 10 Feb 2025 15:49:00 +0000
Subject: [PATCH] Only start drag and drop from Widget Explorer when dragging
 horizonally

This way, you can still drag vertically through the list of applets, and then horizontally to start a drag and drop.

BUG:474929
---
 .../contents/explorer/AppletDelegate.qml      | 26 ++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/desktoppackage/contents/explorer/AppletDelegate.qml b/desktoppackage/contents/explorer/AppletDelegate.qml
index 180e7eb447..7b07dc4741 100644
--- a/desktoppackage/contents/explorer/AppletDelegate.qml
+++ b/desktoppackage/contents/explorer/AppletDelegate.qml
@@ -55,6 +55,7 @@ Item {
         Drag.onDragStarted: {
             KWindowSystem.showingDesktop = true;
             main.draggingWidget = true;
+            delegate.forceActiveFocus()
         }
         Drag.onDragFinished: {
             main.draggingWidget = false;
@@ -62,6 +63,7 @@ Item {
 
         DragHandler {
             id: dragHandler
+            acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad
             enabled: !delegate.pendingUninstall && model.isSupported
 
             onActiveChanged: if (active) {
@@ -77,6 +79,28 @@ Item {
                 parent.Drag.imageSource = "";
             }
         }
+
+
+        DragHandler {
+            id: touchDragHandler
+            acceptedDevices: PointerDevice.Stylus | PointerDevice.TouchScreen
+            enabled: dragHandler.enabled
+            yAxis.enabled: false
+
+            onActiveChanged: if (active) {
+                iconContainer.grabToImage(function(result) {
+                    if (!touchDragHandler.active) {
+                        return;
+                    }
+                    parent.Drag.imageSource = result.url;
+                    parent.Drag.active = touchDragHandler.active;
+                }, Qt.size(Kirigami.Units.iconSizes.huge, Kirigami.Units.iconSizes.huge));
+            } else {
+                parent.Drag.active = false;
+                parent.Drag.imageSource = "";
+            }
+        }
+
     }
 
     ColumnLayout {
@@ -188,7 +212,7 @@ Item {
                 PlasmaComponents.ToolTip.text: delegate.pendingUninstall ? i18nd("plasma_shell_org.kde.plasma.desktop", "Undo uninstall")
                                                     : i18ndc("plasma_shell_org.kde.plasma.desktop","@info:tooltip uninstall a widget", "Uninstall")
                 flat: false
-                visible: model.local && delegate.GridView.isCurrentItem && !dragHandler.active
+                visible: model.local && delegate.GridView.isCurrentItem && !dragHandler.active && !touchDragHandler.active
 
                 onHoveredChanged: {
                     if (hovered) {
-- 
GitLab