From 79b28eb68ff87110fad9b4b08db56fd56c9ec0a2 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Thu, 1 Feb 2018 20:50:28 +0100 Subject: [PATCH] Enable mouse focus clickthrough Consider a click to gain focus as a click on the device. --- app/src/scrcpy.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/src/scrcpy.c b/app/src/scrcpy.c index 7b50e8be..bbc8e5bf 100644 --- a/app/src/scrcpy.c +++ b/app/src/scrcpy.c @@ -518,6 +518,12 @@ SDL_bool scrcpy(const char *serial, Uint16 local_port, Uint16 max_size, Uint32 b SDL_LogWarn(SDL_LOG_CATEGORY_VIDEO, "Could not enable bilinear filtering"); } + // Handle a click to gain focus as any other click + if (!SDL_SetHint(SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH, "1")) { + SDL_LogWarn(SDL_LOG_CATEGORY_VIDEO, "Could not enable mouse focus clickthrough"); + + } + struct size window_size = get_initial_optimal_size(frame_size); window = SDL_CreateWindow(device_name, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, window_size.width, window_size.height, SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE);