浏览代码

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.
Frank Praznik 1 年之前
父节点
当前提交
06dd70bc8b
共有 1 个文件被更改,包括 15 次插入14 次删除
  1. 15 14
      src/video/SDL_video.c

+ 15 - 14
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.
-                     */
-
-                    /* 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
+                    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);
+                    }
+
                 } else {
                     SDL_OnWindowResized(other);
                 }