Added a helper function to tell whether or not a window can be minimized
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c
index e8a1f95..a2856dd 100644
--- a/src/video/SDL_video.c
+++ b/src/video/SDL_video.c
@@ -2207,6 +2207,15 @@ SDL_MaximizeWindow(SDL_Window * window)
}
}
+static SDL_bool
+CanMinimizeWindow(SDL_Window * window)
+{
+ if (!_this->MinimizeWindow) {
+ return SDL_FALSE;
+ }
+ return SDL_TRUE;
+}
+
void
SDL_MinimizeWindow(SDL_Window * window)
{
@@ -2216,10 +2225,13 @@ SDL_MinimizeWindow(SDL_Window * window)
return;
}
- if (_this->MinimizeWindow) {
- /* Only leave fullscreen mode if we're actually going to minimize */
- SDL_UpdateFullscreenMode(window, SDL_FALSE);
+ if (!CanMinimizeWindow(window)) {
+ return;
+ }
+ SDL_UpdateFullscreenMode(window, SDL_FALSE);
+
+ if (_this->MinimizeWindow) {
_this->MinimizeWindow(_this, window);
}
}