From 9300b6cba60745d3a956017559dd4096ed70fc71 Mon Sep 17 00:00:00 2001 From: Xtr126 Date: Tue, 5 Mar 2024 21:48:46 +0530 Subject: [PATCH] feat: Support side buttons on mouse #82 --- app/src/main/cpp/mouse_read.c | 2 ++ app/src/main/java/xtr/keymapper/InputEventCodes.java | 2 ++ .../java/xtr/keymapper/touchpointer/MouseEventHandler.java | 6 ++++++ 3 files changed, 10 insertions(+) diff --git a/app/src/main/cpp/mouse_read.c b/app/src/main/cpp/mouse_read.c index e084ce6f..bab65f9a 100644 --- a/app/src/main/cpp/mouse_read.c +++ b/app/src/main/cpp/mouse_read.c @@ -90,6 +90,8 @@ void* send_mouse_events(void* context) { case REL_WHEEL : case BTN_MOUSE : case BTN_RIGHT : + case BTN_EXTRA : + case BTN_SIDE : if (mouse_lock) (*env)->CallVoidMethod(env, pctx->inputServiceObj, mouseEvent, ie.code, ie.value); break; } diff --git a/app/src/main/java/xtr/keymapper/InputEventCodes.java b/app/src/main/java/xtr/keymapper/InputEventCodes.java index e1a687f4..75d222ac 100644 --- a/app/src/main/java/xtr/keymapper/InputEventCodes.java +++ b/app/src/main/java/xtr/keymapper/InputEventCodes.java @@ -6,4 +6,6 @@ public class InputEventCodes { public static final int REL_WHEEL = 8; public static final int BTN_MOUSE = 272; public static final int BTN_RIGHT = 273; + public static final int BTN_SIDE = 275; + public static final int BTN_EXTRA = 276; } diff --git a/app/src/main/java/xtr/keymapper/touchpointer/MouseEventHandler.java b/app/src/main/java/xtr/keymapper/touchpointer/MouseEventHandler.java index 2cb300ff..c5477b6a 100644 --- a/app/src/main/java/xtr/keymapper/touchpointer/MouseEventHandler.java +++ b/app/src/main/java/xtr/keymapper/touchpointer/MouseEventHandler.java @@ -1,7 +1,9 @@ package xtr.keymapper.touchpointer; +import static xtr.keymapper.InputEventCodes.BTN_EXTRA; import static xtr.keymapper.InputEventCodes.BTN_MOUSE; import static xtr.keymapper.InputEventCodes.BTN_RIGHT; +import static xtr.keymapper.InputEventCodes.BTN_SIDE; import static xtr.keymapper.InputEventCodes.REL_WHEEL; import static xtr.keymapper.InputEventCodes.REL_X; import static xtr.keymapper.InputEventCodes.REL_Y; @@ -132,6 +134,10 @@ public void handleEvent(int code, int value) { handleRightClick(value); break; + case BTN_EXTRA: + case BTN_SIDE: + if (value == 1 && mInput.getKeymapConfig().rightClickMouseAim) triggerMouseAim(); + case REL_WHEEL: if (mInput.getKeyEventHandler().ctrlKeyPressed && keymapConfig.ctrlMouseWheelZoom) scrollZoomHandler.onScrollEvent(value, x1, y1);