From 1c1fe5ec53173fcccb6767a3c45b816610a8c72a Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Sat, 16 Feb 2019 15:21:14 +0100 Subject: [PATCH] Use "always on top" only for SDL >= 2.0.5 The flag SDL_WINDOW_ALWAYS_ON_TOP is available since SDL 2.0.5. Do not use it if SDL is older, to fix compilation failure. Fixes --- app/src/compat.h | 2 ++ app/src/screen.c | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/app/src/compat.h b/app/src/compat.h index 4f709af6..fd68d61a 100644 --- a/app/src/compat.h +++ b/app/src/compat.h @@ -39,6 +39,8 @@ # define SCRCPY_SDL_HAS_HINT_MOUSE_FOCUS_CLICKTHROUGH // # define SCRCPY_SDL_HAS_GET_DISPLAY_USABLE_BOUNDS +// +# define SCRCPY_SDL_HAS_WINDOW_ALWAYS_ON_TOP #endif #endif diff --git a/app/src/screen.c b/app/src/screen.c index 4e9752c2..1632e27f 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -157,7 +157,12 @@ SDL_bool screen_init_rendering(struct screen *screen, window_flags |= SDL_WINDOW_ALLOW_HIGHDPI; #endif if (always_on_top) { +#ifdef SCRCPY_SDL_HAS_WINDOW_ALWAYS_ON_TOP window_flags |= SDL_WINDOW_ALWAYS_ON_TOP; +#else + LOGW("The 'always on top' flag is not available " + "(compile with SDL >= 2.0.5 to enable it)"); +#endif } screen->window = SDL_CreateWindow(device_name, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,