diff --git a/src/controller_base.cpp b/src/controller_base.cpp index 16a37d331e1d..b3fe60a55e08 100644 --- a/src/controller_base.cpp +++ b/src/controller_base.cpp @@ -133,7 +133,7 @@ void controller_base::process_keyup_event(const SDL_Event& /*event*/) { bool controller_base::handle_scroll(int mousex, int mousey, int mouse_flags, double x_axis, double y_axis) { - bool mouse_in_window = (CVideo::get_singleton().window_state() & SDL_APPMOUSEFOCUS) != 0 + bool mouse_in_window = (CVideo::get_singleton().get_window()->get_flags() & SDL_WINDOW_MOUSE_FOCUS) != 0 || preferences::get("scroll_when_mouse_outside", true); int scroll_speed = preferences::scroll_speed(); int dx = 0, dy = 0; @@ -276,7 +276,7 @@ void controller_base::play_slice(bool is_delay_enabled) // be nice when window is not visible // NOTE should be handled by display instead, to only disable drawing - if (is_delay_enabled && (CVideo::get_singleton().window_state() & SDL_APPACTIVE) == 0) { + if (is_delay_enabled && (CVideo::get_singleton().get_window()->get_flags() & SDL_WINDOW_SHOWN) == 0) { CVideo::delay(200); } diff --git a/src/desktop/notifications.cpp b/src/desktop/notifications.cpp index 99dc32a2e680..22d8a2481c30 100644 --- a/src/desktop/notifications.cpp +++ b/src/desktop/notifications.cpp @@ -49,13 +49,13 @@ bool available() { return true; } void send(const std::string& owner, const std::string& message, type t) { - Uint8 app_state = CVideo::get_singleton().window_state(); + Uint8 app_state = CVideo::get_singleton().get_window()->get_flags(); // Do not show notifications when the window is visible... - if ((app_state & SDL_APPACTIVE) != 0) + if ((app_state & SDL_WINDOW_SHOWN) != 0) { // ... and it has a focus. - if ((app_state & (SDL_APPMOUSEFOCUS | SDL_APPINPUTFOCUS)) != 0) { + if ((app_state & (SDL_WINDOW_MOUSE_FOCUS | SDL_WINDOW_INPUT_FOCUS)) != 0) { return; } } diff --git a/src/video.cpp b/src/video.cpp index c3ee74345d52..6515b95e3d99 100644 --- a/src/video.cpp +++ b/src/video.cpp @@ -351,34 +351,6 @@ bool CVideo::update_locked() const return updatesLocked_ > 0; } -Uint8 CVideo::window_state() -{ - Uint8 state = 0; - Uint32 flags = 0; - - if(!window) { - return state; - } - - flags = SDL_GetWindowFlags(*window); - if ((flags & SDL_WINDOW_SHOWN) && !(flags & SDL_WINDOW_MINIMIZED)) { - state |= SDL_APPACTIVE; - } - if (flags & SDL_WINDOW_INPUT_FOCUS) { - state |= SDL_APPINPUTFOCUS; - } - if (flags & SDL_WINDOW_MOUSE_FOCUS) { - state |= SDL_APPMOUSEFOCUS; - } - if (flags & SDL_WINDOW_MAXIMIZED) { - state |= SDL_WINDOW_MAXIMIZED; - } - if (flags & SDL_WINDOW_FULLSCREEN_DESKTOP) { - state |= SDL_WINDOW_FULLSCREEN_DESKTOP; - } - return state; -} - void CVideo::set_window_title(const std::string& title) { assert(window); diff --git a/src/video.hpp b/src/video.hpp index 368892d15328..1506c2b552f3 100644 --- a/src/video.hpp +++ b/src/video.hpp @@ -24,11 +24,6 @@ class surface; -//possible flags when setting video modes -#define SDL_APPMOUSEFOCUS 0x01 /**< The app has mouse coverage */ -#define SDL_APPINPUTFOCUS 0x02 /**< The app has input focus */ -#define SDL_APPACTIVE 0x04 /**< The application is active */ - SDL_Rect screen_area(); class CVideo { @@ -149,11 +144,6 @@ class CVideo { //this needs to be invoked immediately after a resize event or the game will crash. void update_framebuffer(); - /** - * Wrapper for CVideo::get_singleton().window_state. - */ - Uint8 window_state(); - /** * Sets the title of the main window. *