diff --git a/app/src/compat.h b/app/src/compat.h index fd68d61ab9ce1e8fa1d38040916316dfbcdc56c7..de667bbfe93c8595c940e28871add3fb6d59e3e5 100644 --- a/app/src/compat.h +++ b/app/src/compat.h @@ -43,4 +43,9 @@ # define SCRCPY_SDL_HAS_WINDOW_ALWAYS_ON_TOP #endif +#if SDL_VERSION_ATLEAST(2, 0, 8) +// +# define SCRCPY_SDL_HAS_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR +#endif + #endif diff --git a/app/src/scrcpy.c b/app/src/scrcpy.c index 61b3f8d9e8a2b79a06a94c876b095233be76d712..b777b7701c3d2ea0282dcfbb2faf48563f28b766 100644 --- a/app/src/scrcpy.c +++ b/app/src/scrcpy.c @@ -9,6 +9,7 @@ #include "command.h" #include "common.h" +#include "compat.h" #include "controller.h" #include "decoder.h" #include "device.h" @@ -68,6 +69,13 @@ sdl_init_and_configure(bool display) { } #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")) { + LOGW("Could not disable X11 compositor bypass"); + } +#endif + // Do not disable the screensaver when scrcpy is running SDL_EnableScreenSaver();