[network/kdeconnect-android] src/main/java/org/kde/kdeconnect/plugins/mousepad: plugins/mousepad: Prevent additional buttons event when dragging

Albert Vaca Cintora <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit cd3efced931744f0cd3088b15b3f03b5205a9d07 by Albert Vaca Cintora, on behalf of David Leppla-Weber.
Committed on 02/08/2026 at 20:00.
Pushed by albertvaka into branch 'master'.

plugins/mousepad: Prevent additional buttons event when dragging

Having double tap drag enabled, I often saw repeated single hold events
witout a release in between, leading to undefined buttons states and
ultimately me filtering such events in my RemoteDesktop implementation
of xdpw [1].

Specifically, two double taps in a row lead to two single hold events
being sent. This commit makes sure that while dragging no such repeated
events are sent.

[1]: https://github.com/emersion/xdg-desktop-portal-wlr/pull/325

M  +8    -6    src/main/java/org/kde/kdeconnect/plugins/mousepad/MousePadActivity.java

https://invent.kde.org/network/kdeconnect-android/-/commit/cd3efced931744f0cd3088b15b3f03b5205a9d07

diff --git a/src/main/java/org/kde/kdeconnect/plugins/mousepad/MousePadActivity.java b/src/main/java/org/kde/kdeconnect/plugins/mousepad/MousePadActivity.java
index 4512b634d..c8ce6f9db 100644
--- a/src/main/java/org/kde/kdeconnect/plugins/mousepad/MousePadActivity.java
+++ b/src/main/java/org/kde/kdeconnect/plugins/mousepad/MousePadActivity.java
@@ -406,7 +406,7 @@ public class MousePadActivity
 
     @Override
     public void onLongPress(MotionEvent e) {
-        if (!doubleTapDragEnabled) {
+        if (!doubleTapDragEnabled && !dragging) {
             getWindow().getDecorView().performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
             MousePadPlugin plugin = KdeConnect.getInstance().getDevicePlugin(deviceId, MousePadPlugin.class);
             if (plugin == null) {
@@ -447,11 +447,13 @@ public class MousePadActivity
             finish();
             return true;
         }
-        if (doubleTapDragEnabled) {
-            plugin.sendSingleHold();
-            dragging = true;
-        } else {
-            plugin.sendDoubleClick();
+        if (!dragging) {
+            if (doubleTapDragEnabled) {
+                plugin.sendSingleHold();
+                dragging = true;
+            } else {
+                plugin.sendDoubleClick();
+            }
         }
         return true;
     }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.