Skip to content

Commit

Permalink
feat: Support side buttons on mouse #82
Browse files Browse the repository at this point in the history
  • Loading branch information
Xtr126 committed Mar 5, 2024
1 parent 5ccb616 commit 9300b6c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/src/main/cpp/mouse_read.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/xtr/keymapper/InputEventCodes.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 9300b6c

Please sign in to comment.