2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-31 14:15:14 +00:00

add option for Left click to be triggered when pressing two or three fingers

This commit is contained in:
Piyush Aggarwal
2021-07-16 05:47:33 +05:30
committed by Albert Vaca Cintora
parent bf40545e11
commit 9b4c4ff9cb
2 changed files with 15 additions and 1 deletions

View File

@@ -70,6 +70,7 @@
<string name="mousepad_scroll_direction_title">Reverse Scrolling Direction</string> <string name="mousepad_scroll_direction_title">Reverse Scrolling Direction</string>
<string name="mousepad_scroll_direction" translatable="false">mousepad_scroll_direction</string> <string name="mousepad_scroll_direction" translatable="false">mousepad_scroll_direction</string>
<string-array name="mousepad_tap_entries"> <string-array name="mousepad_tap_entries">
<item>Left click</item>
<item>Right click</item> <item>Right click</item>
<item>Middle click</item> <item>Middle click</item>
<item>Nothing</item> <item>Nothing</item>
@@ -79,6 +80,7 @@
<string name="mousepad_default_sensitivity" translatable="false">default</string> <string name="mousepad_default_sensitivity" translatable="false">default</string>
<string name="mousepad_default_acceleration_profile" translatable="false">medium</string> <string name="mousepad_default_acceleration_profile" translatable="false">medium</string>
<string-array name="mousepad_tap_values" translatable="false"> <string-array name="mousepad_tap_values" translatable="false">
<item>left</item>
<item>right</item> <item>right</item>
<item>middle</item> <item>middle</item>
<item>none</item> <item>none</item>

View File

@@ -55,10 +55,12 @@ public class MousePadActivity extends AppCompatActivity implements GestureDetect
private KeyListenerView keyListenerView; private KeyListenerView keyListenerView;
enum ClickType { enum ClickType {
RIGHT, MIDDLE, NONE; LEFT, RIGHT, MIDDLE, NONE;
static ClickType fromString(String s) { static ClickType fromString(String s) {
switch (s) { switch (s) {
case "left":
return LEFT;
case "right": case "right":
return RIGHT; return RIGHT;
case "middle": case "middle":
@@ -320,6 +322,9 @@ public class MousePadActivity extends AppCompatActivity implements GestureDetect
@Override @Override
public boolean onTripleFingerTap(MotionEvent ev) { public boolean onTripleFingerTap(MotionEvent ev) {
switch (tripleTapAction) { switch (tripleTapAction) {
case LEFT:
sendLeftClick();
break;
case RIGHT: case RIGHT:
sendRightClick(); sendRightClick();
break; break;
@@ -334,6 +339,9 @@ public class MousePadActivity extends AppCompatActivity implements GestureDetect
@Override @Override
public boolean onDoubleFingerTap(MotionEvent ev) { public boolean onDoubleFingerTap(MotionEvent ev) {
switch (doubleTapAction) { switch (doubleTapAction) {
case LEFT:
sendLeftClick();
break;
case RIGHT: case RIGHT:
sendRightClick(); sendRightClick();
break; 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() { private void sendMiddleClick() {
BackgroundService.RunWithPlugin(this, deviceId, MousePadPlugin.class, MousePadPlugin::sendMiddleClick); BackgroundService.RunWithPlugin(this, deviceId, MousePadPlugin.class, MousePadPlugin::sendMiddleClick);
} }