From 06dd70bc8b3871c21954e6b209d61b2c1870bc88 Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Sun, 15 Oct 2023 11:52:51 -0400 Subject: [PATCH] video: Use string comparison instead of #ifdefs for driver detection The dummy driver can be in use on these platforms, so check the actual driver name string. Fixes the automated video tests with the dummy driver on Win32. --- src/video/SDL_video.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 197bbadc4..ed5aba2a6 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -1496,20 +1496,21 @@ static int SDL_UpdateFullscreenMode(SDL_Window *window, SDL_bool fullscreen) /* Generate a mode change event here */ if (resized) { -#if !defined(__ANDROID__) && !defined(__WIN32__) - /* Android may not resize the window to exactly what our fullscreen mode is, especially on - * windowed Android environments like the Chromebook or Samsung DeX. Given this, we shouldn't - * use fullscreen_mode.w and fullscreen_mode.h, but rather get our current native size. As such, - * Android's SetWindowFullscreen will generate the window event for us with the proper final size. - */ + if (SDL_strcmp(_this->name, "Android") != 0 && SDL_strcmp(_this->name, "windows") != 0) { + /* Android may not resize the window to exactly what our fullscreen mode is, especially on + * windowed Android environments like the Chromebook or Samsung DeX. Given this, we shouldn't + * use fullscreen_mode.w and fullscreen_mode.h, but rather get our current native size. As such, + * Android's SetWindowFullscreen will generate the window event for us with the proper final size. + */ + + /* This is also unnecessary on Win32 (WIN_SetWindowFullscreen calls SetWindowPos, + * WM_WINDOWPOSCHANGED will send SDL_WINDOWEVENT_RESIZED). Also, on Windows with DPI scaling enabled, + * we're keeping modes in pixels, but window sizes in dpi-scaled points, so this would be a unit mismatch. + */ + SDL_SendWindowEvent(other, SDL_WINDOWEVENT_RESIZED, + fullscreen_mode.w, fullscreen_mode.h); + } - /* This is also unnecessary on Win32 (WIN_SetWindowFullscreen calls SetWindowPos, - * WM_WINDOWPOSCHANGED will send SDL_WINDOWEVENT_RESIZED). Also, on Windows with DPI scaling enabled, - * we're keeping modes in pixels, but window sizes in dpi-scaled points, so this would be a unit mismatch. - */ - SDL_SendWindowEvent(other, SDL_WINDOWEVENT_RESIZED, - fullscreen_mode.w, fullscreen_mode.h); -#endif } else { SDL_OnWindowResized(other); }