diff --git a/app/src/main/java/xtr/keymapper/server/InputService.java b/app/src/main/java/xtr/keymapper/server/InputService.java index 2b37a49a..c2f84781 100644 --- a/app/src/main/java/xtr/keymapper/server/InputService.java +++ b/app/src/main/java/xtr/keymapper/server/InputService.java @@ -25,7 +25,7 @@ public class InputService implements IInputInterface { private final boolean isWaylandClient; private final String touchpadInputMode; - public InputService(KeymapProfile profile, KeymapConfig keymapConfig, IRemoteServiceCallback mCallback, int screenWidth, int screenHeight, boolean isWaylandClient){ + public InputService(KeymapProfile profile, KeymapConfig keymapConfig, IRemoteServiceCallback mCallback, int screenWidth, int screenHeight, boolean isWaylandClient) throws RemoteException { this.keymapProfile = profile; this.keymapConfig = keymapConfig; this.mCallback = mCallback; @@ -43,6 +43,11 @@ else if (touchpadInputMode.equals(KeymapConfig.TOUCHPAD_RELATIVE)) keyEventHandler = new KeyEventHandler(this); keyEventHandler.init(); + + if (isWaylandClient) { + mCallback.cursorSetX(0); + mCallback.cursorSetY(0); + } } public void injectEvent(float x, float y, int action, int pointerId) { @@ -95,19 +100,23 @@ public IRemoteServiceCallback getCallback() { } public void moveCursorX(float x) { + if (isWaylandClient) return; try { mCallback.cursorSetX((int) x); } catch (RemoteException ignored) { } + // To avoid conflict with touch input when moving virtual pointer if (input.pointerCount < 1) cursorSetX((int) x); else if (input.pointerCount == 1 && pointerUp) cursorSetX((int) x); } public void moveCursorY(float y) { + if (isWaylandClient) return; try { mCallback.cursorSetY((int) y); } catch (RemoteException ignored) { } + // To avoid conflict with touch input when moving virtual pointer if (input.pointerCount < 1) cursorSetY((int) y); else if (input.pointerCount == 1 && pointerUp) cursorSetY((int) y); } diff --git a/app/src/main/java/xtr/keymapper/server/RemoteService.java b/app/src/main/java/xtr/keymapper/server/RemoteService.java index 98e520f9..e142392a 100644 --- a/app/src/main/java/xtr/keymapper/server/RemoteService.java +++ b/app/src/main/java/xtr/keymapper/server/RemoteService.java @@ -105,7 +105,7 @@ public boolean isRoot() { } @Override - public void startServer(KeymapProfile profile, KeymapConfig keymapConfig, IRemoteServiceCallback cb, int screenWidth, int screenHeight) { + public void startServer(KeymapProfile profile, KeymapConfig keymapConfig, IRemoteServiceCallback cb, int screenWidth, int screenHeight) throws RemoteException { if (inputService != null) stopServer(); inputService = new InputService(profile, keymapConfig, cb, screenWidth, screenHeight, isWaylandClient); if (!isWaylandClient) {