Browse Source

Fixed warning C4245: 'initializing': conversion from 'int' to 'Uint32', signed/unsigned mismatch in SDL_video.c

Sam Lantinga 1 year ago
parent
commit
ebd7f9adbd
3 changed files with 28 additions and 31 deletions
  1. 2 1
      docs/README-migration.md
  2. 23 27
      include/SDL3/SDL_video.h
  3. 3 3
      test/testautomation_video.c

+ 2 - 1
docs/README-migration.md

@@ -1408,7 +1408,8 @@ The following functions have been removed:
 * SDL_SetWindowData() - use SDL_GetWindowProperties() instead
 * SDL_CreateWindowFrom() - use SDL_CreateWindowWithProperties() with the properties that allow you to wrap an existing window
 
-SDL_Window id type is named SDL_WindowID
+The SDL_Window id type is named SDL_WindowID
+The SDL_WindowFlags enum should be replaced with Uint32
 
 The following symbols have been renamed:
 * SDL_WINDOW_ALLOW_HIGHDPI => SDL_WINDOW_HIGH_PIXEL_DENSITY

+ 23 - 27
include/SDL3/SDL_video.h

@@ -125,33 +125,29 @@ typedef struct SDL_Window SDL_Window;
  *
  *  \sa SDL_GetWindowFlags
  */
-typedef enum
-{
-    SDL_WINDOW_FULLSCREEN           = 0x00000001,   /**< window is in fullscreen mode */
-    SDL_WINDOW_OPENGL               = 0x00000002,   /**< window usable with OpenGL context */
-    SDL_WINDOW_OCCLUDED             = 0x00000004,   /**< window is occluded */
-    SDL_WINDOW_HIDDEN               = 0x00000008,   /**< window is neither mapped onto the desktop nor shown in the taskbar/dock/window list; SDL_ShowWindow() is required for it to become visible */
-    SDL_WINDOW_BORDERLESS           = 0x00000010,   /**< no window decoration */
-    SDL_WINDOW_RESIZABLE            = 0x00000020,   /**< window can be resized */
-    SDL_WINDOW_MINIMIZED            = 0x00000040,   /**< window is minimized */
-    SDL_WINDOW_MAXIMIZED            = 0x00000080,   /**< window is maximized */
-    SDL_WINDOW_MOUSE_GRABBED        = 0x00000100,   /**< window has grabbed mouse input */
-    SDL_WINDOW_INPUT_FOCUS          = 0x00000200,   /**< window has input focus */
-    SDL_WINDOW_MOUSE_FOCUS          = 0x00000400,   /**< window has mouse focus */
-    SDL_WINDOW_EXTERNAL             = 0x00000800,   /**< window not created by SDL */
-    SDL_WINDOW_HIGH_PIXEL_DENSITY   = 0x00002000,   /**< window uses high pixel density back buffer if possible */
-    SDL_WINDOW_MOUSE_CAPTURE        = 0x00004000,   /**< window has mouse captured (unrelated to MOUSE_GRABBED) */
-    SDL_WINDOW_ALWAYS_ON_TOP        = 0x00008000,   /**< window should always be above others */
-    SDL_WINDOW_UTILITY              = 0x00020000,   /**< window should be treated as a utility window, not showing in the task bar and window list */
-    SDL_WINDOW_TOOLTIP              = 0x00040000,   /**< window should be treated as a tooltip */
-    SDL_WINDOW_POPUP_MENU           = 0x00080000,   /**< window should be treated as a popup menu */
-    SDL_WINDOW_KEYBOARD_GRABBED     = 0x00100000,   /**< window has grabbed keyboard input */
-    SDL_WINDOW_VULKAN               = 0x10000000,   /**< window usable for Vulkan surface */
-    SDL_WINDOW_METAL                = 0x20000000,   /**< window usable for Metal view */
-    SDL_WINDOW_TRANSPARENT          = 0x40000000,   /**< window with transparent buffer */
-    SDL_WINDOW_NOT_FOCUSABLE        = 0x80000000,   /**< window should not be focusable */
-
-} SDL_WindowFlags;
+#define SDL_WINDOW_FULLSCREEN           0x00000001U /**< window is in fullscreen mode */
+#define SDL_WINDOW_OPENGL               0x00000002U /**< window usable with OpenGL context */
+#define SDL_WINDOW_OCCLUDED             0x00000004U /**< window is occluded */
+#define SDL_WINDOW_HIDDEN               0x00000008U /**< window is neither mapped onto the desktop nor shown in the taskbar/dock/window list; SDL_ShowWindow() is required for it to become visible */
+#define SDL_WINDOW_BORDERLESS           0x00000010U /**< no window decoration */
+#define SDL_WINDOW_RESIZABLE            0x00000020U /**< window can be resized */
+#define SDL_WINDOW_MINIMIZED            0x00000040U /**< window is minimized */
+#define SDL_WINDOW_MAXIMIZED            0x00000080U /**< window is maximized */
+#define SDL_WINDOW_MOUSE_GRABBED        0x00000100U /**< window has grabbed mouse input */
+#define SDL_WINDOW_INPUT_FOCUS          0x00000200U /**< window has input focus */
+#define SDL_WINDOW_MOUSE_FOCUS          0x00000400U /**< window has mouse focus */
+#define SDL_WINDOW_EXTERNAL             0x00000800U /**< window not created by SDL */
+#define SDL_WINDOW_HIGH_PIXEL_DENSITY   0x00002000U /**< window uses high pixel density back buffer if possible */
+#define SDL_WINDOW_MOUSE_CAPTURE        0x00004000U /**< window has mouse captured (unrelated to MOUSE_GRABBED) */
+#define SDL_WINDOW_ALWAYS_ON_TOP        0x00008000U /**< window should always be above others */
+#define SDL_WINDOW_UTILITY              0x00020000U /**< window should be treated as a utility window, not showing in the task bar and window list */
+#define SDL_WINDOW_TOOLTIP              0x00040000U /**< window should be treated as a tooltip */
+#define SDL_WINDOW_POPUP_MENU           0x00080000U /**< window should be treated as a popup menu */
+#define SDL_WINDOW_KEYBOARD_GRABBED     0x00100000U /**< window has grabbed keyboard input */
+#define SDL_WINDOW_VULKAN               0x10000000U /**< window usable for Vulkan surface */
+#define SDL_WINDOW_METAL                0x20000000U /**< window usable for Metal view */
+#define SDL_WINDOW_TRANSPARENT          0x40000000U /**< window with transparent buffer */
+#define SDL_WINDOW_NOT_FOCUSABLE        0x80000000U /**< window should not be focusable */
 
 /**
  *  Used to indicate that you don't care what the window position is.

+ 3 - 3
test/testautomation_video.c

@@ -15,7 +15,7 @@ static SDL_Window *createVideoSuiteTestWindow(const char *title)
     SDL_Window *window;
     SDL_Event event;
     int w, h;
-    SDL_WindowFlags flags;
+    Uint32 flags;
     SDL_bool needs_renderer = SDL_FALSE;
     SDL_bool needs_events_pumped = SDL_FALSE;
 
@@ -197,7 +197,7 @@ static int video_createWindowVariousFlags(void *arg)
     const char *title = "video_createWindowVariousFlags Test Window";
     int w, h;
     int fVariation;
-    SDL_WindowFlags flags;
+    Uint32 flags;
 
     /* Standard window */
     w = SDLTest_RandomIntegerInRange(320, 1024);
@@ -269,7 +269,7 @@ static int video_getWindowFlags(void *arg)
 {
     SDL_Window *window;
     const char *title = "video_getWindowFlags Test Window";
-    SDL_WindowFlags flags;
+    Uint32 flags;
     Uint32 actualFlags;
 
     /* Reliable flag set always set in test window */