From 9b4c4ff9cb9c54cc05036fa510e23d4cf003840e Mon Sep 17 00:00:00 2001 From: Piyush Aggarwal Date: Fri, 16 Jul 2021 05:47:33 +0530 Subject: [PATCH] add option for Left click to be triggered when pressing two or three fingers --- res/values/strings.xml | 2 ++ .../Plugins/MousePadPlugin/MousePadActivity.java | 14 +++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 4604d604..ad85e7e1 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -70,6 +70,7 @@ Reverse Scrolling Direction mousepad_scroll_direction + Left click Right click Middle click Nothing @@ -79,6 +80,7 @@ default medium + left right middle none diff --git a/src/org/kde/kdeconnect/Plugins/MousePadPlugin/MousePadActivity.java b/src/org/kde/kdeconnect/Plugins/MousePadPlugin/MousePadActivity.java index 450aec74..0035deaa 100644 --- a/src/org/kde/kdeconnect/Plugins/MousePadPlugin/MousePadActivity.java +++ b/src/org/kde/kdeconnect/Plugins/MousePadPlugin/MousePadActivity.java @@ -55,10 +55,12 @@ public class MousePadActivity extends AppCompatActivity implements GestureDetect private KeyListenerView keyListenerView; enum ClickType { - RIGHT, MIDDLE, NONE; + LEFT, RIGHT, MIDDLE, NONE; static ClickType fromString(String s) { switch (s) { + case "left": + return LEFT; case "right": return RIGHT; case "middle": @@ -320,6 +322,9 @@ public class MousePadActivity extends AppCompatActivity implements GestureDetect @Override public boolean onTripleFingerTap(MotionEvent ev) { switch (tripleTapAction) { + case LEFT: + sendLeftClick(); + break; case RIGHT: sendRightClick(); break; @@ -334,6 +339,9 @@ public class MousePadActivity extends AppCompatActivity implements GestureDetect @Override public boolean onDoubleFingerTap(MotionEvent ev) { switch (doubleTapAction) { + case LEFT: + sendLeftClick(); + break; case RIGHT: sendRightClick(); break; @@ -346,6 +354,10 @@ public class MousePadActivity extends AppCompatActivity implements GestureDetect } + private void sendLeftClick() { + BackgroundService.RunWithPlugin(this, deviceId, MousePadPlugin.class, MousePadPlugin::sendLeftClick); + } + private void sendMiddleClick() { BackgroundService.RunWithPlugin(this, deviceId, MousePadPlugin.class, MousePadPlugin::sendMiddleClick); }