From: Twaik Yont <9674930+twaik@users.noreply.github.com> Some Android devices report primary mouse button clicks through both touch down/up and generic motion button press/release events. Forwarding both paths to Wine produces duplicate mouse button input, which can desynchronize button state and interfere with capture or window activation after dragging windows. Ignore generic motion primary button press/release events and keep using the touch path for the primary button. Leave non-primary buttons on the generic motion path, since they may not be reported as touch events. Signed-off-by: Twaik Yont <9674930+twaik@users.noreply.github.com> --- dlls/wineandroid.drv/WineActivity.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dlls/wineandroid.drv/WineActivity.java b/dlls/wineandroid.drv/WineActivity.java index 5a1063f96cd..1f1d12d7ee4 100644 --- a/dlls/wineandroid.drv/WineActivity.java +++ b/dlls/wineandroid.drv/WineActivity.java @@ -704,6 +704,16 @@ public boolean onGenericMotionEvent( MotionEvent event ) if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0) { + /* Primary button press/release is also reported through touch down/up + * on some Android devices. Sending both paths to Wine leaves it with + * duplicate mouse button events, which can desynchronize button state + * and break capture/activation after window moves. + */ + if ((event.getActionMasked() == MotionEvent.ACTION_BUTTON_PRESS || + event.getActionMasked() == MotionEvent.ACTION_BUTTON_RELEASE) && + event.getActionButton() == MotionEvent.BUTTON_PRIMARY) + return true; + int[] pos = new int[2]; window.get_event_pos( event, pos ); Log.i( LOGTAG, String.format( "view motion event win %08x action %d pos %d,%d buttons %04x view %d,%d", -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10951