From e1cbceb01e519a625c998bbcdfc4299c8ddcb22b Mon Sep 17 00:00:00 2001 From: Iordan Iordanov Date: Mon, 19 Feb 2024 18:20:34 -0500 Subject: [PATCH] Bugfix for drag/drop on Ubuntu 22.04 remote desktop sharing. --- .../iiordanov/bVNC/input/RemotePointer.java | 4 +- .../bVNC/input/RemoteRdpPointer.java | 39 +++++++++---------- .../undatech/opaque/input/RemotePointer.java | 2 +- 3 files changed, 21 insertions(+), 24 deletions(-) diff --git a/bVNC/src/main/java/com/iiordanov/bVNC/input/RemotePointer.java b/bVNC/src/main/java/com/iiordanov/bVNC/input/RemotePointer.java index 109bbe002..2c23b63d2 100644 --- a/bVNC/src/main/java/com/iiordanov/bVNC/input/RemotePointer.java +++ b/bVNC/src/main/java/com/iiordanov/bVNC/input/RemotePointer.java @@ -9,9 +9,9 @@ public abstract class RemotePointer extends com.undatech.opaque.input.RemotePointer { public RemotePointer( - RfbConnectable protocomm, Context context, InputCarriable remoteInput, + RfbConnectable rfbConnectable, Context context, InputCarriable remoteInput, Viewable canvas, Handler handler, boolean debugLogging ) { - super(protocomm, context, remoteInput, canvas, handler, debugLogging); + super(rfbConnectable, context, remoteInput, canvas, handler, debugLogging); } } diff --git a/bVNC/src/main/java/com/iiordanov/bVNC/input/RemoteRdpPointer.java b/bVNC/src/main/java/com/iiordanov/bVNC/input/RemoteRdpPointer.java index db9d5a7b8..06561c764 100644 --- a/bVNC/src/main/java/com/iiordanov/bVNC/input/RemoteRdpPointer.java +++ b/bVNC/src/main/java/com/iiordanov/bVNC/input/RemoteRdpPointer.java @@ -11,24 +11,24 @@ public class RemoteRdpPointer extends RemotePointer { private static final String TAG = "RemoteRdpPointer"; - private final static int PTRFLAGS_WHEEL = 0x0200; - private final static int PTRFLAGS_WHEEL_NEGATIVE = 0x0100; - //private final static int PTRFLAGS_DOWN = 0x8000; - + private final static int POINTER_FLAGS_WHEEL = 0x0200; // 512 + private final static int POINTER_FLAGS_WHEEL_NEGATIVE = 0x0100; // 256 + /* private final static int MOUSE_BUTTON_NONE = 0x0000; - private final static int MOUSE_BUTTON_MOVE = 0x0800; - private final static int MOUSE_BUTTON_LEFT = 0x1000; - private final static int MOUSE_BUTTON_RIGHT = 0x2000; + */ + private final static int MOUSE_BUTTON_MOVE = 0x0800; // 2048 + private final static int MOUSE_BUTTON_LEFT = 0x1000; // 4096 + private final static int MOUSE_BUTTON_RIGHT = 0x2000; // 8192 - private static final int MOUSE_BUTTON_MIDDLE = 0x4000; - private static final int MOUSE_BUTTON_SCROLL_UP = PTRFLAGS_WHEEL | 0x0078; - private static final int MOUSE_BUTTON_SCROLL_DOWN = PTRFLAGS_WHEEL | PTRFLAGS_WHEEL_NEGATIVE | 0x0088; + private static final int MOUSE_BUTTON_MIDDLE = 0x4000; // 16384 + private static final int MOUSE_BUTTON_SCROLL_UP = POINTER_FLAGS_WHEEL | 0x0078; + private static final int MOUSE_BUTTON_SCROLL_DOWN = POINTER_FLAGS_WHEEL | POINTER_FLAGS_WHEEL_NEGATIVE | 0x0088; public RemoteRdpPointer( - RfbConnectable spicecomm, Context context, InputCarriable remoteInput, + RfbConnectable rfbConnectable, Context context, InputCarriable remoteInput, Viewable canvas, Handler handler, boolean debugLogging ) { - super(spicecomm, context, remoteInput, canvas, handler, debugLogging); + super(rfbConnectable, context, remoteInput, canvas, handler, debugLogging); } private void sendButtonDownOrMoveButtonDown(int x, int y, int metaState) { @@ -106,11 +106,6 @@ public void releaseButton(int x, int y, int metaState) { /** * Sends a pointer event to the server. - * - * @param x - * @param y - * @param metaState - * @param isMoving */ private void sendPointerEvent(int x, int y, int metaState, boolean isMoving) { @@ -121,9 +116,10 @@ private void sendPointerEvent(int x, int y, int metaState, boolean isMoving) { if (!isMoving) { // If this is a new mouse down event, release previous button pressed to avoid confusing the remote OS. if (prevPointerMask != 0 && prevPointerMask != pointerMask) { - protocomm.writePointerEvent(pointerX, pointerY, - combinedMetaState, - prevPointerMask & ~POINTER_DOWN_MASK, false); + int upPointerMask = prevPointerMask & ~POINTER_DOWN_MASK; + GeneralUtils.debugLog(this.debugLogging, TAG, "Sending mouse up event at: " + pointerX + + ", " + pointerY + " with prevPointerMask: " + prevPointerMask + ", upPointerMask: " + upPointerMask); + protocomm.writePointerEvent(pointerX, pointerY, combinedMetaState, upPointerMask, false); } prevPointerMask = pointerMask; } @@ -145,7 +141,8 @@ private void sendPointerEvent(int x, int y, int metaState, boolean isMoving) { } canvas.invalidateMousePosition(); GeneralUtils.debugLog(this.debugLogging, TAG, "Sending absolute mouse event at: " + pointerX + - ", " + pointerY + ", pointerMask: " + pointerMask); + ", " + pointerY + " with pointerMask: " + pointerMask); + protocomm.writePointerEvent(pointerX, pointerY, combinedMetaState, MOUSE_BUTTON_MOVE | pointerMask, false); protocomm.writePointerEvent(pointerX, pointerY, combinedMetaState, pointerMask, false); } diff --git a/remoteClientLib/src/main/java/com/undatech/opaque/input/RemotePointer.java b/remoteClientLib/src/main/java/com/undatech/opaque/input/RemotePointer.java index fd3d608f7..d2f42b57c 100644 --- a/remoteClientLib/src/main/java/com/undatech/opaque/input/RemotePointer.java +++ b/remoteClientLib/src/main/java/com/undatech/opaque/input/RemotePointer.java @@ -15,7 +15,7 @@ public abstract class RemotePointer { - public static final int POINTER_DOWN_MASK = 0x8000; + public static final int POINTER_DOWN_MASK = 0x8000; // 32768 public static float DEFAULT_SENSITIVITY = 2.0f; public static boolean DEFAULT_ACCELERATED = true; /**