From 13942d96415a277f71439ca9c2e25d0a32abadb7 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Wed, 25 Jan 2023 23:40:02 +0300
Subject: [PATCH] dynapi: change SDL_DisplayMode to SDL2_DisplayMode for
correct signatures
---
src/dynapi/SDL_dynapi_procs.h | 12 ++++++------
src/sdl2_compat.c | 4 ++--
src/sdl2_compat.h | 4 ++--
3 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h
index 6bf3233..be85563 100644
--- a/src/dynapi/SDL_dynapi_procs.h
+++ b/src/dynapi/SDL_dynapi_procs.h
@@ -534,13 +534,13 @@ SDL_DYNAPI_PROC(int,SDL_GetNumVideoDisplays,(void),(),return)
SDL_DYNAPI_PROC(const char*,SDL_GetDisplayName,(int a),(a),return)
SDL_DYNAPI_PROC(int,SDL_GetDisplayBounds,(int a, SDL_Rect *b),(a,b),return)
SDL_DYNAPI_PROC(int,SDL_GetNumDisplayModes,(int a),(a),return)
-SDL_DYNAPI_PROC(int,SDL_GetDisplayMode,(int a, int b, SDL_DisplayMode *c),(a,b,c),return)
-SDL_DYNAPI_PROC(int,SDL_GetDesktopDisplayMode,(int a, SDL_DisplayMode *b),(a,b),return)
-SDL_DYNAPI_PROC(int,SDL_GetCurrentDisplayMode,(int a, SDL_DisplayMode *b),(a,b),return)
-SDL_DYNAPI_PROC(SDL_DisplayMode*,SDL_GetClosestDisplayMode,(int a, const SDL_DisplayMode *b, SDL_DisplayMode *c),(a,b,c),return)
+SDL_DYNAPI_PROC(int,SDL_GetDisplayMode,(int a, int b, SDL2_DisplayMode *c),(a,b,c),return)
+SDL_DYNAPI_PROC(int,SDL_GetDesktopDisplayMode,(int a, SDL2_DisplayMode *b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_GetCurrentDisplayMode,(int a, SDL2_DisplayMode *b),(a,b),return)
+SDL_DYNAPI_PROC(SDL2_DisplayMode*,SDL_GetClosestDisplayMode,(int a, const SDL2_DisplayMode *b, SDL2_DisplayMode *c),(a,b,c),return)
SDL_DYNAPI_PROC(int,SDL_GetWindowDisplayIndex,(SDL_Window *a),(a),return)
-SDL_DYNAPI_PROC(int,SDL_SetWindowDisplayMode,(SDL_Window *a, const SDL_DisplayMode *b),(a,b),return)
-SDL_DYNAPI_PROC(int,SDL_GetWindowDisplayMode,(SDL_Window *a, SDL_DisplayMode *b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_SetWindowDisplayMode,(SDL_Window *a, const SDL2_DisplayMode *b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_GetWindowDisplayMode,(SDL_Window *a, SDL2_DisplayMode *b),(a,b),return)
SDL_DYNAPI_PROC(Uint32,SDL_GetWindowPixelFormat,(SDL_Window *a),(a),return)
SDL_DYNAPI_PROC(SDL_Window*,SDL_CreateWindow,(const char *a, int b, int c, int d, int e, Uint32 f),(a,b,c,d,e,f),return)
SDL_DYNAPI_PROC(SDL_Window*,SDL_CreateWindowFrom,(const void *a),(a),return)
diff --git a/src/sdl2_compat.c b/src/sdl2_compat.c
index 623375a..71d76c4 100644
--- a/src/sdl2_compat.c
+++ b/src/sdl2_compat.c
@@ -3205,14 +3205,14 @@ SDL_UnlockSensors(void)
}
-typedef struct
+struct SDL2_DisplayMode
{
Uint32 format; /**< pixel format */
int w; /**< width, in screen coordinates */
int h; /**< height, in screen coordinates */
int refresh_rate; /**< refresh rate (or zero for unspecified) */
void *driverdata; /**< driver-specific data, initialize to 0 */
-} SDL2_DisplayMode;
+};
static void
DisplayMode_2to3(const SDL2_DisplayMode *in, SDL_DisplayMode *out) {
diff --git a/src/sdl2_compat.h b/src/sdl2_compat.h
index fcc3abd..b771794 100644
--- a/src/sdl2_compat.h
+++ b/src/sdl2_compat.h
@@ -36,10 +36,10 @@ typedef Sint32 SDL2_SensorID; /* this became unsigned in SDL3, but we'll just h
typedef Sint64 SDL2_GestureID;
typedef struct SDL2_RWops SDL2_RWops;
+typedef struct SDL2_DisplayMode SDL2_DisplayMode;
struct SDL_AudioCVT;
-typedef void (SDLCALL * SDL_AudioFilter) (struct SDL_AudioCVT * cvt,
- SDL_AudioFormat format);
+typedef void (SDLCALL * SDL_AudioFilter) (struct SDL_AudioCVT *cvt, SDL_AudioFormat format);
/**
* \brief Upper limit of filters in SDL_AudioCVT