From 4557099e5d7a0c0b02424ea85d2a4b093911e048 Mon Sep 17 00:00:00 2001 From: Stephen Anthony Date: Fri, 2 Feb 2024 11:23:36 -0330 Subject: [PATCH] Refactor a little; SDL-specific header stuff should stay in SDL_lib.hxx. --- src/common/MediaFactory.hxx | 12 ++---------- src/common/SDL_lib.hxx | 5 +++++ 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/common/MediaFactory.hxx b/src/common/MediaFactory.hxx index 1febd113c..6e9ec061c 100644 --- a/src/common/MediaFactory.hxx +++ b/src/common/MediaFactory.hxx @@ -184,11 +184,7 @@ class MediaFactory static bool supportsURL() { #if defined(SDL_SUPPORT) - #if SDL_VERSION_ATLEAST(2, 0, 14) - return true; - #else - return false; - #endif + return SDLSupportsURL(); #else return false; #endif @@ -197,11 +193,7 @@ class MediaFactory static bool openURL(const string& url) { #if defined(SDL_SUPPORT) - #if SDL_VERSION_ATLEAST(2, 0, 14) - return SDLOpenURL(url); - #else - return false; - #endif + return SDLOpenURL(url); #else return false; #endif diff --git a/src/common/SDL_lib.hxx b/src/common/SDL_lib.hxx index 711ca0b7c..68ed1f267 100644 --- a/src/common/SDL_lib.hxx +++ b/src/common/SDL_lib.hxx @@ -60,6 +60,11 @@ static inline string SDLVersion() return buf.str(); } +static inline bool SDLSupportsURL() +{ + return static_cast(SDL_VERSION_ATLEAST(2,0,14)); +} + static inline bool SDLOpenURL(const string& url) { #if SDL_VERSION_ATLEAST(2,0,14)