Skip to content

Display and control your Android device

Require SDL >= 2.0.5

Romain Vimontdca2c5f94fd0
diff --git a/app/meson.build b/app/meson.build
index 7d9c2b5c..1907812d 100644
--- a/app/meson.build
+++ b/app/meson.build
@@ -87,7 +87,7 @@ if not get_option('crossbuild_windows')
dependency('libavformat'),
dependency('libavcodec'),
dependency('libavutil'),
- dependency('sdl2'),
+ dependency('sdl2', version: '>= 2.0.5'),
]
if v4l2_support
diff --git a/app/src/compat.h b/app/src/compat.h
index 3ab56049..311d617d 100644
--- a/app/src/compat.h
+++ b/app/src/compat.h
@@ -35,15 +35,6 @@
# define SCRCPY_LAVF_HAS_AVFORMATCONTEXT_URL
#endif
-#if SDL_VERSION_ATLEAST(2, 0, 5)
-// <https://wiki.libsdl.org/SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH>
-# define SCRCPY_SDL_HAS_HINT_MOUSE_FOCUS_CLICKTHROUGH
-// <https://wiki.libsdl.org/SDL_GetDisplayUsableBounds>
-# define SCRCPY_SDL_HAS_GET_DISPLAY_USABLE_BOUNDS
-// <https://wiki.libsdl.org/SDL_WindowFlags>
-# define SCRCPY_SDL_HAS_WINDOW_ALWAYS_ON_TOP
-#endif
-
#if SDL_VERSION_ATLEAST(2, 0, 6)
// <https://github.com/libsdl-org/SDL/commit/d7a318de563125e5bb465b1000d6bc9576fbc6fc>
# define SCRCPY_SDL_HAS_HINT_TOUCH_MOUSE_EVENTS
diff --git a/app/src/scrcpy.c b/app/src/scrcpy.c
index 99317ffc..9c2bd03b 100644
--- a/app/src/scrcpy.c
+++ b/app/src/scrcpy.c
@@ -94,12 +94,10 @@ sdl_set_hints(const char *render_driver) {
LOGW("Could not enable linear filtering");
}
-#ifdef SCRCPY_SDL_HAS_HINT_MOUSE_FOCUS_CLICKTHROUGH
// Handle a click to gain focus as any other click
if (!SDL_SetHint(SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH, "1")) {
LOGW("Could not enable mouse focus clickthrough");
}
-#endif
#ifdef SCRCPY_SDL_HAS_HINT_TOUCH_MOUSE_EVENTS
// Disable synthetic mouse events from touch events
diff --git a/app/src/screen.c b/app/src/screen.c
index 34a2d5d9..c72fdf44 100644
--- a/app/src/screen.c
+++ b/app/src/screen.c
@@ -64,12 +64,7 @@ set_window_size(struct screen *screen, struct sc_size new_size) {
static bool
get_preferred_display_bounds(struct sc_size *bounds) {
SDL_Rect rect;
-#ifdef SCRCPY_SDL_HAS_GET_DISPLAY_USABLE_BOUNDS
-# define GET_DISPLAY_BOUNDS(i, r) SDL_GetDisplayUsableBounds((i), (r))
-#else
-# define GET_DISPLAY_BOUNDS(i, r) SDL_GetDisplayBounds((i), (r))
-#endif
- if (GET_DISPLAY_BOUNDS(0, &rect)) {
+ if (SDL_GetDisplayUsableBounds(0, &rect)) {
LOGW("Could not get display usable bounds: %s", SDL_GetError());
return false;
}
@@ -394,12 +389,7 @@ screen_init(struct screen *screen, const struct screen_params *params) {
| SDL_WINDOW_RESIZABLE
| SDL_WINDOW_ALLOW_HIGHDPI;
if (params->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
}
if (params->window_borderless) {
window_flags |= SDL_WINDOW_BORDERLESS;