From ca44585f9642f300bd457a8dbf7a14c1d7d26aad Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Fri, 2 Feb 2018 09:26:25 +0100 Subject: [PATCH] Do not send simple mouse move events Moving the mouse without any button pressed has no effect on Android. Therefore, do not even send these very frequent events. --- app/src/scrcpy.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/scrcpy.c b/app/src/scrcpy.c index bbc8e5bf..cf035907 100644 --- a/app/src/scrcpy.c +++ b/app/src/scrcpy.c @@ -340,6 +340,10 @@ static void handle_key(const SDL_KeyboardEvent *event) { } static void handle_mouse_motion(const SDL_MouseMotionEvent *event, struct size screen_size) { + if (!event->state) { + // do not send motion events when no button is pressed + return; + } struct control_event control_event; if (mouse_motion_from_sdl_to_android(event, screen_size, &control_event)) { if (!controller_push_event(&controller, &control_event)) {