diff --git a/app/src/compat.h b/app/src/compat.h index 8e2d18f4..9f66ce95 100644 --- a/app/src/compat.h +++ b/app/src/compat.h @@ -43,6 +43,11 @@ # define SCRCPY_SDL_HAS_WINDOW_ALWAYS_ON_TOP #endif +#if SDL_VERSION_ATLEAST(2, 0, 6) +// +# define SCRCPY_SDL_HAS_HINT_TOUCH_MOUSE_EVENTS +#endif + #if SDL_VERSION_ATLEAST(2, 0, 8) // # define SCRCPY_SDL_HAS_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR diff --git a/app/src/scrcpy.c b/app/src/scrcpy.c index 2235f727..2efc043a 100644 --- a/app/src/scrcpy.c +++ b/app/src/scrcpy.c @@ -98,6 +98,15 @@ sdl_set_hints(const char *render_driver) { } #endif +#ifdef SCRCPY_SDL_HAS_HINT_TOUCH_MOUSE_EVENTS + // Disable synthetic mouse events from touch events + // Touch events with id SDL_TOUCH_MOUSEID are ignored anyway, but it is + // better not to generate them in the first place. + if (!SDL_SetHint(SDL_HINT_TOUCH_MOUSE_EVENTS, "0")) { + LOGW("Could not disable synthetic mouse events"); + } +#endif + #ifdef SCRCPY_SDL_HAS_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR // Disable compositor bypassing on X11 if (!SDL_SetHint(SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR, "0")) {