Merge commit 'e9b86eebf3018dd3653af53fc47cb772ab85059f' into main

main
Sam Lantinga 2023-01-10 10:18:32 -08:00
commit 053c377893
43 changed files with 272 additions and 356 deletions

View File

@ -406,6 +406,10 @@ The following symbols have been renamed:
* KMOD_SCROLL => SDL_KMOD_SCROLL * KMOD_SCROLL => SDL_KMOD_SCROLL
* KMOD_SHIFT => SDL_KMOD_SHIFT * KMOD_SHIFT => SDL_KMOD_SHIFT
## SDL_loadso.h
SDL_LoadFunction() now returns `SDL_FunctionPointer` instead of `void *`, and should be cast to the appropriate function type. You can define SDL_FUNCTION_POINTER_IS_VOID_POINTER in your project to restore the previous behavior.
## SDL_main.h ## SDL_main.h
SDL3 doesn't have a static libSDLmain to link against anymore. SDL3 doesn't have a static libSDLmain to link against anymore.
@ -867,6 +871,8 @@ Programs which have access to shaders can implement more robust versions of thos
Removed SDL_GL_CONTEXT_EGL from OpenGL configuration attributes. You can instead use `SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);` Removed SDL_GL_CONTEXT_EGL from OpenGL configuration attributes. You can instead use `SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);`
SDL_GL_GetProcAddress() and SDL_EGL_GetProcAddress() now return `SDL_FunctionPointer` instead of `void *`, and should be cast to the appropriate function type. You can define SDL_FUNCTION_POINTER_IS_VOID_POINTER in your project to restore the previous behavior.
SDL_GL_SwapWindow() returns 0 if the function succeeds or a negative error code if there was an error. SDL_GL_SwapWindow() returns 0 if the function succeeds or a negative error code if there was an error.
SDL_GL_GetSwapInterval() takes the interval as an output parameter and returns 0 if the function succeeds or a negative error code if there was an error. SDL_GL_GetSwapInterval() takes the interval as an output parameter and returns 0 if the function succeeds or a negative error code if there was an error.
@ -882,3 +888,5 @@ SDL_Window id type is named SDL_WindowID
SDL_Vulkan_GetInstanceExtensions() no longer takes a window parameter. SDL_Vulkan_GetInstanceExtensions() no longer takes a window parameter.
SDL_Vulkan_GetVkGetInstanceProcAddr() now returns `SDL_FunctionPointer` instead of `void *`, and should be cast to PFN_vkGetInstanceProcAddr.

View File

@ -89,7 +89,7 @@ extern DECLSPEC void *SDLCALL SDL_LoadObject(const char *sofile);
* \sa SDL_LoadObject * \sa SDL_LoadObject
* \sa SDL_UnloadObject * \sa SDL_UnloadObject
*/ */
extern DECLSPEC void *SDLCALL SDL_LoadFunction(void *handle, extern DECLSPEC SDL_FunctionPointer SDL_LoadFunction(void *handle,
const char *name); const char *name);
/** /**

View File

@ -738,6 +738,13 @@ SDL_FORCE_INLINE int SDL_size_add_overflow_builtin (size_t a,
#define SDL_size_add_overflow(a, b, ret) (SDL_size_add_overflow_builtin(a, b, ret)) #define SDL_size_add_overflow(a, b, ret) (SDL_size_add_overflow_builtin(a, b, ret))
#endif #endif
/* This is a generic function pointer which should be cast to the type you expect */
#ifdef SDL_FUNCTION_POINTER_IS_VOID_POINTER
typedef void *SDL_FunctionPointer;
#else
typedef void (*SDL_FunctionPointer)(void);
#endif
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -1723,7 +1723,7 @@ extern DECLSPEC int SDLCALL SDL_GL_LoadLibrary(const char *path);
* \sa SDL_GL_LoadLibrary * \sa SDL_GL_LoadLibrary
* \sa SDL_GL_UnloadLibrary * \sa SDL_GL_UnloadLibrary
*/ */
extern DECLSPEC void *SDLCALL SDL_GL_GetProcAddress(const char *proc); extern DECLSPEC SDL_FunctionPointer SDLCALL SDL_GL_GetProcAddress(const char *proc);
/** /**
* Get an EGL library function by name. * Get an EGL library function by name.
@ -1740,7 +1740,7 @@ extern DECLSPEC void *SDLCALL SDL_GL_GetProcAddress(const char *proc);
* *
* \sa SDL_GL_GetCurrentEGLDisplay * \sa SDL_GL_GetCurrentEGLDisplay
*/ */
extern DECLSPEC void *SDLCALL SDL_EGL_GetProcAddress(const char *proc); extern DECLSPEC SDL_FunctionPointer SDLCALL SDL_EGL_GetProcAddress(const char *proc);
/** /**
* Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary(). * Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary().

View File

@ -111,11 +111,17 @@ extern DECLSPEC int SDLCALL SDL_Vulkan_LoadLibrary(const char *path);
* This should be called after either calling SDL_Vulkan_LoadLibrary() or * This should be called after either calling SDL_Vulkan_LoadLibrary() or
* creating an SDL_Window with the `SDL_WINDOW_VULKAN` flag. * creating an SDL_Window with the `SDL_WINDOW_VULKAN` flag.
* *
* The actual type of the returned function pointer is PFN_vkGetInstanceProcAddr,
* but that isn't available because the Vulkan headers are not included here. You
* should cast the return value of this function to that type, e.g.
*
* `vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)SDL_Vulkan_GetVkGetInstanceProcAddr();`
*
* \returns the function pointer for `vkGetInstanceProcAddr` or NULL on error. * \returns the function pointer for `vkGetInstanceProcAddr` or NULL on error.
* *
* \since This function is available since SDL 3.0.0. * \since This function is available since SDL 3.0.0.
*/ */
extern DECLSPEC void *SDLCALL SDL_Vulkan_GetVkGetInstanceProcAddr(void); extern DECLSPEC SDL_FunctionPointer SDLCALL SDL_Vulkan_GetVkGetInstanceProcAddr(void);
/** /**
* Unload the Vulkan library previously loaded by SDL_Vulkan_LoadLibrary() * Unload the Vulkan library previously loaded by SDL_Vulkan_LoadLibrary()

View File

@ -50,7 +50,7 @@ static int aaudio_LoadFunctions(AAUDIO_Data *data)
{ {
#define SDL_PROC(ret, func, params) \ #define SDL_PROC(ret, func, params) \
do { \ do { \
data->func = SDL_LoadFunction(data->handle, #func); \ data->func = (ret (*) params)SDL_LoadFunction(data->handle, #func); \
if (!data->func) { \ if (!data->func) { \
return SDL_SetError("Couldn't load AAUDIO function %s: %s", #func, SDL_GetError()); \ return SDL_SetError("Couldn't load AAUDIO function %s: %s", #func, SDL_GetError()); \
} \ } \

View File

@ -33,53 +33,53 @@ static SDL_DBusContext dbus;
static int LoadDBUSSyms(void) static int LoadDBUSSyms(void)
{ {
#define SDL_DBUS_SYM2(x, y) \ #define SDL_DBUS_SYM2(TYPE, x, y) \
if (!(dbus.x = SDL_LoadFunction(dbus_handle, #y))) \ if (!(dbus.x = (TYPE)SDL_LoadFunction(dbus_handle, #y))) \
return -1 return -1
#define SDL_DBUS_SYM(x) \ #define SDL_DBUS_SYM(TYPE, x) \
SDL_DBUS_SYM2(x, dbus_##x) SDL_DBUS_SYM2(TYPE, x, dbus_##x)
SDL_DBUS_SYM(bus_get_private); SDL_DBUS_SYM(DBusConnection *(*)(DBusBusType, DBusError *), bus_get_private);
SDL_DBUS_SYM(bus_register); SDL_DBUS_SYM(dbus_bool_t (*)(DBusConnection *, DBusError *), bus_register);
SDL_DBUS_SYM(bus_add_match); SDL_DBUS_SYM(void (*)(DBusConnection *, const char *, DBusError *), bus_add_match);
SDL_DBUS_SYM(connection_open_private); SDL_DBUS_SYM(DBusConnection *(*)(const char *, DBusError *), connection_open_private);
SDL_DBUS_SYM(connection_set_exit_on_disconnect); SDL_DBUS_SYM(void (*)(DBusConnection *, dbus_bool_t), connection_set_exit_on_disconnect);
SDL_DBUS_SYM(connection_get_is_connected); SDL_DBUS_SYM(dbus_bool_t (*)(DBusConnection *), connection_get_is_connected);
SDL_DBUS_SYM(connection_add_filter); SDL_DBUS_SYM(dbus_bool_t (*)(DBusConnection *, DBusHandleMessageFunction, void *, DBusFreeFunction), connection_add_filter);
SDL_DBUS_SYM(connection_try_register_object_path); SDL_DBUS_SYM(dbus_bool_t (*)(DBusConnection *, const char *, const DBusObjectPathVTable *, void *, DBusError *), connection_try_register_object_path);
SDL_DBUS_SYM(connection_send); SDL_DBUS_SYM(dbus_bool_t (*)(DBusConnection *, DBusMessage *, dbus_uint32_t *), connection_send);
SDL_DBUS_SYM(connection_send_with_reply_and_block); SDL_DBUS_SYM(DBusMessage *(*)(DBusConnection *, DBusMessage *, int, DBusError *), connection_send_with_reply_and_block);
SDL_DBUS_SYM(connection_close); SDL_DBUS_SYM(void (*)(DBusConnection *), connection_close);
SDL_DBUS_SYM(connection_ref); SDL_DBUS_SYM(void (*)(DBusConnection *), connection_ref);
SDL_DBUS_SYM(connection_unref); SDL_DBUS_SYM(void (*)(DBusConnection *), connection_unref);
SDL_DBUS_SYM(connection_flush); SDL_DBUS_SYM(void (*)(DBusConnection *), connection_flush);
SDL_DBUS_SYM(connection_read_write); SDL_DBUS_SYM(dbus_bool_t (*)(DBusConnection *, int), connection_read_write);
SDL_DBUS_SYM(connection_dispatch); SDL_DBUS_SYM(DBusDispatchStatus (*)(DBusConnection *), connection_dispatch);
SDL_DBUS_SYM(message_is_signal); SDL_DBUS_SYM(dbus_bool_t (*)(DBusMessage *, const char *, const char *), message_is_signal);
SDL_DBUS_SYM(message_new_method_call); SDL_DBUS_SYM(DBusMessage *(*)(const char *, const char *, const char *, const char *), message_new_method_call);
SDL_DBUS_SYM(message_append_args); SDL_DBUS_SYM(dbus_bool_t (*)(DBusMessage *, int, ...), message_append_args);
SDL_DBUS_SYM(message_append_args_valist); SDL_DBUS_SYM(dbus_bool_t (*)(DBusMessage *, int, va_list), message_append_args_valist);
SDL_DBUS_SYM(message_iter_init_append); SDL_DBUS_SYM(void (*)(DBusMessage *, DBusMessageIter *), message_iter_init_append);
SDL_DBUS_SYM(message_iter_open_container); SDL_DBUS_SYM(dbus_bool_t (*)(DBusMessageIter *, int, const char *, DBusMessageIter *), message_iter_open_container);
SDL_DBUS_SYM(message_iter_append_basic); SDL_DBUS_SYM(dbus_bool_t (*)(DBusMessageIter *, int, const void *), message_iter_append_basic);
SDL_DBUS_SYM(message_iter_close_container); SDL_DBUS_SYM(dbus_bool_t (*)(DBusMessageIter *, DBusMessageIter *), message_iter_close_container);
SDL_DBUS_SYM(message_get_args); SDL_DBUS_SYM(dbus_bool_t (*)(DBusMessage *, DBusError *, int, ...), message_get_args);
SDL_DBUS_SYM(message_get_args_valist); SDL_DBUS_SYM(dbus_bool_t (*)(DBusMessage *, DBusError *, int, va_list), message_get_args_valist);
SDL_DBUS_SYM(message_iter_init); SDL_DBUS_SYM(dbus_bool_t (*)(DBusMessage *, DBusMessageIter *), message_iter_init);
SDL_DBUS_SYM(message_iter_next); SDL_DBUS_SYM(dbus_bool_t (*)(DBusMessageIter *), message_iter_next);
SDL_DBUS_SYM(message_iter_get_basic); SDL_DBUS_SYM(void (*)(DBusMessageIter *, void *), message_iter_get_basic);
SDL_DBUS_SYM(message_iter_get_arg_type); SDL_DBUS_SYM(int (*)(DBusMessageIter *), message_iter_get_arg_type);
SDL_DBUS_SYM(message_iter_recurse); SDL_DBUS_SYM(void (*)(DBusMessageIter *, DBusMessageIter *), message_iter_recurse);
SDL_DBUS_SYM(message_unref); SDL_DBUS_SYM(void (*)(DBusMessage *), message_unref);
SDL_DBUS_SYM(threads_init_default); SDL_DBUS_SYM(dbus_bool_t (*)(void), threads_init_default);
SDL_DBUS_SYM(error_init); SDL_DBUS_SYM(void (*)(DBusError *), error_init);
SDL_DBUS_SYM(error_is_set); SDL_DBUS_SYM(dbus_bool_t (*)(const DBusError *), error_is_set);
SDL_DBUS_SYM(error_free); SDL_DBUS_SYM(void (*)(DBusError *), error_free);
SDL_DBUS_SYM(get_local_machine_id); SDL_DBUS_SYM(char *(*)(void), get_local_machine_id);
SDL_DBUS_SYM(free); SDL_DBUS_SYM(void (*)(void *), free);
SDL_DBUS_SYM(free_string_array); SDL_DBUS_SYM(void (*)(char **), free_string_array);
SDL_DBUS_SYM(shutdown); SDL_DBUS_SYM(void (*)(void), shutdown);
#undef SDL_DBUS_SYM #undef SDL_DBUS_SYM
#undef SDL_DBUS_SYM2 #undef SDL_DBUS_SYM2

View File

@ -199,7 +199,7 @@ SDL_DYNAPI_PROC(void,SDL_DisableScreenSaver,(void),(),)
SDL_DYNAPI_PROC(SDL_Surface*,SDL_DuplicateSurface,(SDL_Surface *a),(a),return) SDL_DYNAPI_PROC(SDL_Surface*,SDL_DuplicateSurface,(SDL_Surface *a),(a),return)
SDL_DYNAPI_PROC(SDL_EGLConfig,SDL_EGL_GetCurrentEGLConfig,(void),(),return) SDL_DYNAPI_PROC(SDL_EGLConfig,SDL_EGL_GetCurrentEGLConfig,(void),(),return)
SDL_DYNAPI_PROC(SDL_EGLDisplay,SDL_EGL_GetCurrentEGLDisplay,(void),(),return) SDL_DYNAPI_PROC(SDL_EGLDisplay,SDL_EGL_GetCurrentEGLDisplay,(void),(),return)
SDL_DYNAPI_PROC(void*,SDL_EGL_GetProcAddress,(const char *a),(a),return) SDL_DYNAPI_PROC(SDL_FunctionPointer,SDL_EGL_GetProcAddress,(const char *a),(a),return)
SDL_DYNAPI_PROC(SDL_EGLSurface,SDL_EGL_GetWindowEGLSurface,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(SDL_EGLSurface,SDL_EGL_GetWindowEGLSurface,(SDL_Window *a),(a),return)
SDL_DYNAPI_PROC(void,SDL_EGL_SetEGLAttributeCallbacks,(SDL_EGLAttribArrayCallback a, SDL_EGLIntArrayCallback b, SDL_EGLIntArrayCallback c),(a,b,c),) SDL_DYNAPI_PROC(void,SDL_EGL_SetEGLAttributeCallbacks,(SDL_EGLAttribArrayCallback a, SDL_EGLIntArrayCallback b, SDL_EGLIntArrayCallback c),(a,b,c),)
SDL_DYNAPI_PROC(void,SDL_EnableScreenSaver,(void),(),) SDL_DYNAPI_PROC(void,SDL_EnableScreenSaver,(void),(),)
@ -222,7 +222,7 @@ SDL_DYNAPI_PROC(int,SDL_GL_GetAttribute,(SDL_GLattr a, int *b),(a,b),return)
SDL_DYNAPI_PROC(SDL_GLContext,SDL_GL_GetCurrentContext,(void),(),return) SDL_DYNAPI_PROC(SDL_GLContext,SDL_GL_GetCurrentContext,(void),(),return)
SDL_DYNAPI_PROC(SDL_Window*,SDL_GL_GetCurrentWindow,(void),(),return) SDL_DYNAPI_PROC(SDL_Window*,SDL_GL_GetCurrentWindow,(void),(),return)
SDL_DYNAPI_PROC(void,SDL_GL_GetDrawableSize,(SDL_Window *a, int *b, int *c),(a,b,c),) SDL_DYNAPI_PROC(void,SDL_GL_GetDrawableSize,(SDL_Window *a, int *b, int *c),(a,b,c),)
SDL_DYNAPI_PROC(void*,SDL_GL_GetProcAddress,(const char *a),(a),return) SDL_DYNAPI_PROC(SDL_FunctionPointer,SDL_GL_GetProcAddress,(const char *a),(a),return)
SDL_DYNAPI_PROC(int,SDL_GL_GetSwapInterval,(int *a),(a),return) SDL_DYNAPI_PROC(int,SDL_GL_GetSwapInterval,(int *a),(a),return)
SDL_DYNAPI_PROC(int,SDL_GL_LoadLibrary,(const char *a),(a),return) SDL_DYNAPI_PROC(int,SDL_GL_LoadLibrary,(const char *a),(a),return)
SDL_DYNAPI_PROC(int,SDL_GL_MakeCurrent,(SDL_Window *a, SDL_GLContext b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_GL_MakeCurrent,(SDL_Window *a, SDL_GLContext b),(a,b),return)
@ -536,7 +536,7 @@ SDL_DYNAPI_PROC(int,SDL_JoystickIsHaptic,(SDL_Joystick *a),(a),return)
SDL_DYNAPI_PROC(SDL_Surface*,SDL_LoadBMP_RW,(SDL_RWops *a, int b),(a,b),return) SDL_DYNAPI_PROC(SDL_Surface*,SDL_LoadBMP_RW,(SDL_RWops *a, int b),(a,b),return)
SDL_DYNAPI_PROC(void*,SDL_LoadFile,(const char *a, size_t *b),(a,b),return) SDL_DYNAPI_PROC(void*,SDL_LoadFile,(const char *a, size_t *b),(a,b),return)
SDL_DYNAPI_PROC(void*,SDL_LoadFile_RW,(SDL_RWops *a, size_t *b, int c),(a,b,c),return) SDL_DYNAPI_PROC(void*,SDL_LoadFile_RW,(SDL_RWops *a, size_t *b, int c),(a,b,c),return)
SDL_DYNAPI_PROC(void*,SDL_LoadFunction,(void *a, const char *b),(a,b),return) SDL_DYNAPI_PROC(SDL_FunctionPointer,SDL_LoadFunction,(void *a, const char *b),(a,b),return)
SDL_DYNAPI_PROC(void*,SDL_LoadObject,(const char *a),(a),return) SDL_DYNAPI_PROC(void*,SDL_LoadObject,(const char *a),(a),return)
SDL_DYNAPI_PROC(SDL_AudioSpec*,SDL_LoadWAV_RW,(SDL_RWops *a, int b, SDL_AudioSpec *c, Uint8 **d, Uint32 *e),(a,b,c,d,e),return) SDL_DYNAPI_PROC(SDL_AudioSpec*,SDL_LoadWAV_RW,(SDL_RWops *a, int b, SDL_AudioSpec *c, Uint8 **d, Uint32 *e),(a,b,c,d,e),return)
SDL_DYNAPI_PROC(void,SDL_LockAudioDevice,(SDL_AudioDeviceID a),(a),) SDL_DYNAPI_PROC(void,SDL_LockAudioDevice,(SDL_AudioDeviceID a),(a),)
@ -755,7 +755,7 @@ SDL_DYNAPI_PROC(int,SDL_UpdateYUVTexture,(SDL_Texture *a, const SDL_Rect *b, con
SDL_DYNAPI_PROC(SDL_bool,SDL_Vulkan_CreateSurface,(SDL_Window *a, VkInstance b, VkSurfaceKHR *c),(a,b,c),return) SDL_DYNAPI_PROC(SDL_bool,SDL_Vulkan_CreateSurface,(SDL_Window *a, VkInstance b, VkSurfaceKHR *c),(a,b,c),return)
SDL_DYNAPI_PROC(void,SDL_Vulkan_GetDrawableSize,(SDL_Window *a, int *b, int *c),(a,b,c),) SDL_DYNAPI_PROC(void,SDL_Vulkan_GetDrawableSize,(SDL_Window *a, int *b, int *c),(a,b,c),)
SDL_DYNAPI_PROC(SDL_bool,SDL_Vulkan_GetInstanceExtensions,(unsigned int *a, const char **b),(a,b),return) SDL_DYNAPI_PROC(SDL_bool,SDL_Vulkan_GetInstanceExtensions,(unsigned int *a, const char **b),(a,b),return)
SDL_DYNAPI_PROC(void*,SDL_Vulkan_GetVkGetInstanceProcAddr,(void),(),return) SDL_DYNAPI_PROC(SDL_FunctionPointer,SDL_Vulkan_GetVkGetInstanceProcAddr,(void),(),return)
SDL_DYNAPI_PROC(int,SDL_Vulkan_LoadLibrary,(const char *a),(a),return) SDL_DYNAPI_PROC(int,SDL_Vulkan_LoadLibrary,(const char *a),(a),return)
SDL_DYNAPI_PROC(void,SDL_Vulkan_UnloadLibrary,(void),(),) SDL_DYNAPI_PROC(void,SDL_Vulkan_UnloadLibrary,(void),(),)
SDL_DYNAPI_PROC(int,SDL_WaitEvent,(SDL_Event *a),(a),return) SDL_DYNAPI_PROC(int,SDL_WaitEvent,(SDL_Event *a),(a),return)

View File

@ -32,8 +32,7 @@
#include "../../video/uikit/SDL_uikitvideo.h" #include "../../video/uikit/SDL_uikitvideo.h"
#endif #endif
void * void *SDL_LoadObject(const char *sofile)
SDL_LoadObject(const char *sofile)
{ {
void *handle; void *handle;
const char *loaderror; const char *loaderror;
@ -53,8 +52,7 @@ SDL_LoadObject(const char *sofile)
return handle; return handle;
} }
void * SDL_FunctionPointer SDL_LoadFunction(void *handle, const char *name)
SDL_LoadFunction(void *handle, const char *name)
{ {
void *symbol = dlsym(handle, name); void *symbol = dlsym(handle, name);
if (symbol == NULL) { if (symbol == NULL) {

View File

@ -25,16 +25,14 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* System dependent library loading routines */ /* System dependent library loading routines */
void * void *SDL_LoadObject(const char *sofile)
SDL_LoadObject(const char *sofile)
{ {
const char *loaderror = "SDL_LoadObject() not implemented"; const char *loaderror = "SDL_LoadObject() not implemented";
SDL_SetError("Failed loading %s: %s", sofile, loaderror); SDL_SetError("Failed loading %s: %s", sofile, loaderror);
return NULL; return NULL;
} }
void * SDL_FunctionPointer SDL_LoadFunction(void *handle, const char *name)
SDL_LoadFunction(void *handle, const char *name)
{ {
const char *loaderror = "SDL_LoadFunction() not implemented"; const char *loaderror = "SDL_LoadFunction() not implemented";
SDL_SetError("Failed loading %s: %s", name, loaderror); SDL_SetError("Failed loading %s: %s", name, loaderror);

View File

@ -27,8 +27,7 @@
#include "../../core/windows/SDL_windows.h" #include "../../core/windows/SDL_windows.h"
void * void *SDL_LoadObject(const char *sofile)
SDL_LoadObject(const char *sofile)
{ {
void *handle; void *handle;
LPTSTR tstr; LPTSTR tstr;
@ -59,8 +58,7 @@ SDL_LoadObject(const char *sofile)
return handle; return handle;
} }
void * SDL_FunctionPointer SDL_LoadFunction(void *handle, const char *name)
SDL_LoadFunction(void *handle, const char *name)
{ {
void *symbol = (void *)GetProcAddress((HMODULE)handle, name); void *symbol = (void *)GetProcAddress((HMODULE)handle, name);
if (symbol == NULL) { if (symbol == NULL) {

View File

@ -242,7 +242,7 @@ static int GL_LoadFunctions(GL_RenderData *data)
int retval = 0; int retval = 0;
#define SDL_PROC(ret, func, params) \ #define SDL_PROC(ret, func, params) \
do { \ do { \
data->func = SDL_GL_GetProcAddress(#func); \ data->func = (ret (APIENTRY *) params)SDL_GL_GetProcAddress(#func); \
if (!data->func) { \ if (!data->func) { \
retval = SDL_SetError("Couldn't load GL function %s: %s", #func, SDL_GetError()); \ retval = SDL_SetError("Couldn't load GL function %s: %s", #func, SDL_GetError()); \
} \ } \

View File

@ -252,7 +252,7 @@ static int GLES2_LoadFunctions(GLES2_RenderData *data)
#else #else
#define SDL_PROC(ret, func, params) \ #define SDL_PROC(ret, func, params) \
do { \ do { \
data->func = SDL_GL_GetProcAddress(#func); \ data->func = (ret (APIENTRY *) params)SDL_GL_GetProcAddress(#func); \
if (!data->func) { \ if (!data->func) { \
return SDL_SetError("Couldn't load GLES2 function %s: %s", #func, SDL_GetError()); \ return SDL_SetError("Couldn't load GLES2 function %s: %s", #func, SDL_GetError()); \
} \ } \

View File

@ -115,20 +115,24 @@
#define EGL_PLATFORM_DEVICE_EXT 0x0 #define EGL_PLATFORM_DEVICE_EXT 0x0
#endif #endif
#if SDL_VIDEO_OPENGL
typedef void (APIENTRY* PFNGLGETINTEGERVPROC) (GLenum pname, GLint * params);
#endif
#if defined(SDL_VIDEO_STATIC_ANGLE) || defined(SDL_VIDEO_DRIVER_VITA) #if defined(SDL_VIDEO_STATIC_ANGLE) || defined(SDL_VIDEO_DRIVER_VITA)
#define LOAD_FUNC(NAME) \ #define LOAD_FUNC(TYPE, NAME) \
_this->egl_data->NAME = (void *)NAME; _this->egl_data->NAME = NAME;
#else #else
#define LOAD_FUNC(NAME) \ #define LOAD_FUNC(TYPE, NAME) \
_this->egl_data->NAME = SDL_LoadFunction(_this->egl_data->egl_dll_handle, #NAME); \ _this->egl_data->NAME = (TYPE)SDL_LoadFunction(_this->egl_data->egl_dll_handle, #NAME); \
if (!_this->egl_data->NAME) { \ if (!_this->egl_data->NAME) { \
return SDL_SetError("Could not retrieve EGL function " #NAME); \ return SDL_SetError("Could not retrieve EGL function " #NAME); \
} }
#endif #endif
/* it is allowed to not have some of the EGL extensions on start - attempts to use them will fail later. */ /* it is allowed to not have some of the EGL extensions on start - attempts to use them will fail later. */
#define LOAD_FUNC_EGLEXT(NAME) \ #define LOAD_FUNC_EGLEXT(TYPE, NAME) \
_this->egl_data->NAME = _this->egl_data->eglGetProcAddress(#NAME); _this->egl_data->NAME = (TYPE)_this->egl_data->eglGetProcAddress(#NAME);
static const char *SDL_EGL_GetErrorName(EGLint eglErrorCode) static const char *SDL_EGL_GetErrorName(EGLint eglErrorCode)
{ {
@ -241,10 +245,9 @@ SDL_bool SDL_EGL_HasExtension(_THIS, SDL_EGL_ExtensionType type, const char *ext
return SDL_FALSE; return SDL_FALSE;
} }
void * SDL_FunctionPointer SDL_EGL_GetProcAddressInternal(_THIS, const char *proc)
SDL_EGL_GetProcAddressInternal(_THIS, const char *proc)
{ {
void *retval = NULL; SDL_FunctionPointer retval = NULL;
if (_this->egl_data != NULL) { if (_this->egl_data != NULL) {
const Uint32 eglver = (((Uint32)_this->egl_data->egl_version_major) << 16) | ((Uint32)_this->egl_data->egl_version_minor); const Uint32 eglver = (((Uint32)_this->egl_data->egl_version_major) << 16) | ((Uint32)_this->egl_data->egl_version_minor);
const SDL_bool is_egl_15_or_later = eglver >= ((((Uint32)1) << 16) | 5); const SDL_bool is_egl_15_or_later = eglver >= ((((Uint32)1) << 16) | 5);
@ -424,34 +427,33 @@ static int SDL_EGL_LoadLibraryInternal(_THIS, const char *egl_path)
#endif #endif
/* Load new function pointers */ /* Load new function pointers */
LOAD_FUNC(eglGetDisplay); LOAD_FUNC(PFNEGLGETDISPLAYPROC, eglGetDisplay);
LOAD_FUNC(eglInitialize); LOAD_FUNC(PFNEGLINITIALIZEPROC, eglInitialize);
LOAD_FUNC(eglTerminate); LOAD_FUNC(PFNEGLTERMINATEPROC, eglTerminate);
LOAD_FUNC(eglGetProcAddress); LOAD_FUNC(PFNEGLGETPROCADDRESSPROC, eglGetProcAddress);
LOAD_FUNC(eglChooseConfig); LOAD_FUNC(PFNEGLCHOOSECONFIGPROC, eglChooseConfig);
LOAD_FUNC(eglGetConfigAttrib); LOAD_FUNC(PFNEGLCREATECONTEXTPROC, eglCreateContext);
LOAD_FUNC(eglCreateContext); LOAD_FUNC(PFNEGLDESTROYCONTEXTPROC, eglDestroyContext);
LOAD_FUNC(eglDestroyContext); LOAD_FUNC(PFNEGLCREATEPBUFFERSURFACEPROC, eglCreatePbufferSurface);
LOAD_FUNC(eglCreatePbufferSurface); LOAD_FUNC(PFNEGLCREATEWINDOWSURFACEPROC, eglCreateWindowSurface);
LOAD_FUNC(eglCreateWindowSurface); LOAD_FUNC(PFNEGLDESTROYSURFACEPROC, eglDestroySurface);
LOAD_FUNC(eglDestroySurface); LOAD_FUNC(PFNEGLMAKECURRENTPROC, eglMakeCurrent);
LOAD_FUNC(eglMakeCurrent); LOAD_FUNC(PFNEGLSWAPBUFFERSPROC, eglSwapBuffers);
LOAD_FUNC(eglSwapBuffers); LOAD_FUNC(PFNEGLSWAPINTERVALPROC, eglSwapInterval);
LOAD_FUNC(eglSwapInterval); LOAD_FUNC(PFNEGLQUERYSTRINGPROC, eglQueryString);
LOAD_FUNC(eglWaitNative); LOAD_FUNC(PFNEGLGETCONFIGATTRIBPROC, eglGetConfigAttrib);
LOAD_FUNC(eglWaitGL); LOAD_FUNC(PFNEGLWAITNATIVEPROC, eglWaitNative);
LOAD_FUNC(eglBindAPI); LOAD_FUNC(PFNEGLWAITGLPROC, eglWaitGL);
LOAD_FUNC(eglQueryAPI); LOAD_FUNC(PFNEGLBINDAPIPROC, eglBindAPI);
LOAD_FUNC(eglQueryString); LOAD_FUNC(PFNEGLGETERRORPROC, eglGetError);
LOAD_FUNC(eglGetError); LOAD_FUNC_EGLEXT(PFNEGLQUERYDEVICESEXTPROC, eglQueryDevicesEXT);
LOAD_FUNC_EGLEXT(eglQueryDevicesEXT); LOAD_FUNC_EGLEXT(PFNEGLGETPLATFORMDISPLAYEXTPROC, eglGetPlatformDisplayEXT);
LOAD_FUNC_EGLEXT(eglGetPlatformDisplayEXT);
/* Atomic functions */ /* Atomic functions */
LOAD_FUNC_EGLEXT(eglCreateSyncKHR); LOAD_FUNC_EGLEXT(PFNEGLCREATESYNCKHRPROC, eglCreateSyncKHR);
LOAD_FUNC_EGLEXT(eglDestroySyncKHR); LOAD_FUNC_EGLEXT(PFNEGLDESTROYSYNCKHRPROC, eglDestroySyncKHR);
LOAD_FUNC_EGLEXT(eglDupNativeFenceFDANDROID); LOAD_FUNC_EGLEXT(PFNEGLDUPNATIVEFENCEFDANDROIDPROC, eglDupNativeFenceFDANDROID);
LOAD_FUNC_EGLEXT(eglWaitSyncKHR); LOAD_FUNC_EGLEXT(PFNEGLWAITSYNCKHRPROC, eglWaitSyncKHR);
LOAD_FUNC_EGLEXT(eglClientWaitSyncKHR); LOAD_FUNC_EGLEXT(PFNEGLCLIENTWAITSYNCKHRPROC, eglClientWaitSyncKHR);
/* Atomic functions end */ /* Atomic functions end */
if (path) { if (path) {
@ -519,7 +521,7 @@ int SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_di
SDL_EGL_GetVersion(_this); SDL_EGL_GetVersion(_this);
if (_this->egl_data->egl_version_major == 1 && _this->egl_data->egl_version_minor == 5) { if (_this->egl_data->egl_version_major == 1 && _this->egl_data->egl_version_minor == 5) {
LOAD_FUNC(eglGetPlatformDisplay); LOAD_FUNC(PFNEGLGETPLATFORMDISPLAYPROC, eglGetPlatformDisplay);
} }
if (_this->egl_data->eglGetPlatformDisplay) { if (_this->egl_data->eglGetPlatformDisplay) {
@ -535,7 +537,7 @@ int SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_di
_this->egl_data->egl_display = _this->egl_data->eglGetPlatformDisplay(platform, (void *)(uintptr_t)native_display, attribs); _this->egl_data->egl_display = _this->egl_data->eglGetPlatformDisplay(platform, (void *)(uintptr_t)native_display, attribs);
} else { } else {
if (SDL_EGL_HasExtension(_this, SDL_EGL_CLIENT_EXTENSION, "EGL_EXT_platform_base")) { if (SDL_EGL_HasExtension(_this, SDL_EGL_CLIENT_EXTENSION, "EGL_EXT_platform_base")) {
_this->egl_data->eglGetPlatformDisplayEXT = SDL_EGL_GetProcAddressInternal(_this, "eglGetPlatformDisplayEXT"); _this->egl_data->eglGetPlatformDisplayEXT = (PFNEGLGETPLATFORMDISPLAYEXTPROC)SDL_EGL_GetProcAddressInternal(_this, "eglGetPlatformDisplayEXT");
if (_this->egl_data->eglGetPlatformDisplayEXT) { if (_this->egl_data->eglGetPlatformDisplayEXT) {
_this->egl_data->egl_display = _this->egl_data->eglGetPlatformDisplayEXT(platform, (void *)(uintptr_t)native_display, NULL); _this->egl_data->egl_display = _this->egl_data->eglGetPlatformDisplayEXT(platform, (void *)(uintptr_t)native_display, NULL);
} }
@ -1103,8 +1105,7 @@ SDL_EGL_CreateContext(_THIS, EGLSurface egl_surface)
#if SDL_VIDEO_OPENGL && !defined(SDL_VIDEO_DRIVER_VITA) #if SDL_VIDEO_OPENGL && !defined(SDL_VIDEO_DRIVER_VITA)
} else { } else {
/* Desktop OpenGL supports it by default from version 3.0 on. */ /* Desktop OpenGL supports it by default from version 3.0 on. */
void(APIENTRY * glGetIntegervFunc)(GLenum pname, GLint * params); PFNGLGETINTEGERVPROC glGetIntegervFunc = (PFNGLGETINTEGERVPROC)SDL_GL_GetProcAddress("glGetIntegerv");
glGetIntegervFunc = SDL_GL_GetProcAddress("glGetIntegerv");
if (glGetIntegervFunc) { if (glGetIntegervFunc) {
GLint v = 0; GLint v = 0;
glGetIntegervFunc(GL_MAJOR_VERSION, &v); glGetIntegervFunc(GL_MAJOR_VERSION, &v);

View File

@ -43,77 +43,35 @@ typedef struct SDL_EGL_VideoData
SDL_bool is_offscreen; /* whether EGL display was offscreen */ SDL_bool is_offscreen; /* whether EGL display was offscreen */
EGLenum apitype; /* EGL_OPENGL_ES_API, EGL_OPENGL_API, etc */ EGLenum apitype; /* EGL_OPENGL_ES_API, EGL_OPENGL_API, etc */
EGLDisplay(EGLAPIENTRY *eglGetDisplay)(NativeDisplayType display); PFNEGLGETDISPLAYPROC eglGetDisplay;
EGLDisplay(EGLAPIENTRY *eglGetPlatformDisplay)(EGLenum platform, PFNEGLINITIALIZEPROC eglInitialize;
void *native_display, PFNEGLTERMINATEPROC eglTerminate;
const EGLAttrib *attrib_list); PFNEGLGETPROCADDRESSPROC eglGetProcAddress;
EGLDisplay(EGLAPIENTRY *eglGetPlatformDisplayEXT)(EGLenum platform, PFNEGLCHOOSECONFIGPROC eglChooseConfig;
void *native_display, PFNEGLCREATECONTEXTPROC eglCreateContext;
const EGLint *attrib_list); PFNEGLDESTROYCONTEXTPROC eglDestroyContext;
EGLBoolean(EGLAPIENTRY *eglInitialize)(EGLDisplay dpy, EGLint *major, PFNEGLCREATEPBUFFERSURFACEPROC eglCreatePbufferSurface;
EGLint *minor); PFNEGLCREATEWINDOWSURFACEPROC eglCreateWindowSurface;
EGLBoolean(EGLAPIENTRY *eglTerminate)(EGLDisplay dpy); PFNEGLDESTROYSURFACEPROC eglDestroySurface;
PFNEGLMAKECURRENTPROC eglMakeCurrent;
void *(EGLAPIENTRY *eglGetProcAddress)(const char *procName); PFNEGLSWAPBUFFERSPROC eglSwapBuffers;
PFNEGLSWAPINTERVALPROC eglSwapInterval;
EGLBoolean(EGLAPIENTRY *eglChooseConfig)(EGLDisplay dpy, PFNEGLQUERYSTRINGPROC eglQueryString;
const EGLint *attrib_list, PFNEGLGETCONFIGATTRIBPROC eglGetConfigAttrib;
EGLConfig *configs, PFNEGLWAITNATIVEPROC eglWaitNative;
EGLint config_size, EGLint *num_config); PFNEGLWAITGLPROC eglWaitGL;
PFNEGLBINDAPIPROC eglBindAPI;
EGLContext(EGLAPIENTRY *eglCreateContext)(EGLDisplay dpy, PFNEGLGETERRORPROC eglGetError;
EGLConfig config, PFNEGLQUERYDEVICESEXTPROC eglQueryDevicesEXT;
EGLContext share_list, PFNEGLGETPLATFORMDISPLAYPROC eglGetPlatformDisplay;
const EGLint *attrib_list); PFNEGLGETPLATFORMDISPLAYEXTPROC eglGetPlatformDisplayEXT;
EGLBoolean(EGLAPIENTRY *eglDestroyContext)(EGLDisplay dpy, EGLContext ctx);
EGLSurface(EGLAPIENTRY *eglCreatePbufferSurface)(EGLDisplay dpy, EGLConfig config,
EGLint const *attrib_list);
EGLSurface(EGLAPIENTRY *eglCreateWindowSurface)(EGLDisplay dpy,
EGLConfig config,
NativeWindowType window,
const EGLint *attrib_list);
EGLBoolean(EGLAPIENTRY *eglDestroySurface)(EGLDisplay dpy, EGLSurface surface);
EGLBoolean(EGLAPIENTRY *eglMakeCurrent)(EGLDisplay dpy, EGLSurface draw,
EGLSurface read, EGLContext ctx);
EGLBoolean(EGLAPIENTRY *eglSwapBuffers)(EGLDisplay dpy, EGLSurface draw);
EGLBoolean(EGLAPIENTRY *eglSwapInterval)(EGLDisplay dpy, EGLint interval);
const char *(EGLAPIENTRY *eglQueryString)(EGLDisplay dpy, EGLint name);
EGLenum(EGLAPIENTRY *eglQueryAPI)(void);
EGLBoolean(EGLAPIENTRY *eglGetConfigAttrib)(EGLDisplay dpy, EGLConfig config,
EGLint attribute, EGLint *value);
EGLBoolean(EGLAPIENTRY *eglWaitNative)(EGLint engine);
EGLBoolean(EGLAPIENTRY *eglWaitGL)(void);
EGLBoolean(EGLAPIENTRY *eglBindAPI)(EGLenum);
EGLint(EGLAPIENTRY *eglGetError)(void);
EGLBoolean(EGLAPIENTRY *eglQueryDevicesEXT)(EGLint max_devices,
void **devices,
EGLint *num_devices);
/* Atomic functions */ /* Atomic functions */
PFNEGLCREATESYNCKHRPROC eglCreateSyncKHR;
EGLSyncKHR(EGLAPIENTRY *eglCreateSyncKHR)(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list); PFNEGLDESTROYSYNCKHRPROC eglDestroySyncKHR;
PFNEGLDUPNATIVEFENCEFDANDROIDPROC eglDupNativeFenceFDANDROID;
EGLBoolean(EGLAPIENTRY *eglDestroySyncKHR)(EGLDisplay dpy, EGLSyncKHR sync); PFNEGLWAITSYNCKHRPROC eglWaitSyncKHR;
PFNEGLCLIENTWAITSYNCKHRPROC eglClientWaitSyncKHR;
EGLint(EGLAPIENTRY *eglDupNativeFenceFDANDROID)(EGLDisplay dpy, EGLSyncKHR sync);
EGLint(EGLAPIENTRY *eglWaitSyncKHR)(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags);
EGLint(EGLAPIENTRY *eglClientWaitSyncKHR)(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
/* Atomic functions end */ /* Atomic functions end */
} SDL_EGL_VideoData; } SDL_EGL_VideoData;
@ -133,7 +91,7 @@ extern int SDL_EGL_GetAttribute(_THIS, SDL_GLattr attrib, int *value);
*/ */
extern int SDL_EGL_LoadLibraryOnly(_THIS, const char *path); extern int SDL_EGL_LoadLibraryOnly(_THIS, const char *path);
extern int SDL_EGL_LoadLibrary(_THIS, const char *path, NativeDisplayType native_display, EGLenum platform); extern int SDL_EGL_LoadLibrary(_THIS, const char *path, NativeDisplayType native_display, EGLenum platform);
extern void *SDL_EGL_GetProcAddressInternal(_THIS, const char *proc); extern SDL_FunctionPointer SDL_EGL_GetProcAddressInternal(_THIS, const char *proc);
extern void SDL_EGL_UnloadLibrary(_THIS); extern void SDL_EGL_UnloadLibrary(_THIS);
extern void SDL_EGL_SetRequiredVisualId(_THIS, int visual_id); extern void SDL_EGL_SetRequiredVisualId(_THIS, int visual_id);
extern int SDL_EGL_ChooseConfig(_THIS); extern int SDL_EGL_ChooseConfig(_THIS);

View File

@ -264,7 +264,7 @@ struct SDL_VideoDevice
* OpenGL support * OpenGL support
*/ */
int (*GL_LoadLibrary)(_THIS, const char *path); int (*GL_LoadLibrary)(_THIS, const char *path);
void *(*GL_GetProcAddress)(_THIS, const char *proc); SDL_FunctionPointer (*GL_GetProcAddress)(_THIS, const char *proc);
void (*GL_UnloadLibrary)(_THIS); void (*GL_UnloadLibrary)(_THIS);
SDL_GLContext (*GL_CreateContext)(_THIS, SDL_Window *window); SDL_GLContext (*GL_CreateContext)(_THIS, SDL_Window *window);
int (*GL_MakeCurrent)(_THIS, SDL_Window *window, SDL_GLContext context); int (*GL_MakeCurrent)(_THIS, SDL_Window *window, SDL_GLContext context);

View File

@ -402,8 +402,7 @@ int SDL_GetNumVideoDrivers(void)
return SDL_arraysize(bootstrap) - 1; return SDL_arraysize(bootstrap) - 1;
} }
const char * const char *SDL_GetVideoDriver(int index)
SDL_GetVideoDriver(int index)
{ {
if (index >= 0 && index < SDL_GetNumVideoDrivers()) { if (index >= 0 && index < SDL_GetNumVideoDrivers()) {
return bootstrap[index]->name; return bootstrap[index]->name;
@ -557,8 +556,7 @@ pre_driver_error:
return -1; return -1;
} }
const char * const char *SDL_GetCurrentVideoDriver()
SDL_GetCurrentVideoDriver()
{ {
if (_this == NULL) { if (_this == NULL) {
SDL_UninitializedVideo(); SDL_UninitializedVideo();
@ -567,14 +565,12 @@ SDL_GetCurrentVideoDriver()
return _this->name; return _this->name;
} }
SDL_VideoDevice * SDL_VideoDevice *SDL_GetVideoDevice(void)
SDL_GetVideoDevice(void)
{ {
return _this; return _this;
} }
SDL_bool SDL_bool SDL_OnVideoThread()
SDL_OnVideoThread()
{ {
return (_this && SDL_ThreadID() == _this->thread) ? SDL_TRUE : SDL_FALSE; return (_this && SDL_ThreadID() == _this->thread) ? SDL_TRUE : SDL_FALSE;
} }
@ -662,22 +658,19 @@ int SDL_GetIndexOfDisplay(SDL_VideoDisplay *display)
return 0; return 0;
} }
void * void *SDL_GetDisplayDriverData(int displayIndex)
SDL_GetDisplayDriverData(int displayIndex)
{ {
CHECK_DISPLAY_INDEX(displayIndex, NULL); CHECK_DISPLAY_INDEX(displayIndex, NULL);
return _this->displays[displayIndex].driverdata; return _this->displays[displayIndex].driverdata;
} }
SDL_bool SDL_bool SDL_IsVideoContextExternal(void)
SDL_IsVideoContextExternal(void)
{ {
return SDL_GetHintBoolean(SDL_HINT_VIDEO_EXTERNAL_CONTEXT, SDL_FALSE); return SDL_GetHintBoolean(SDL_HINT_VIDEO_EXTERNAL_CONTEXT, SDL_FALSE);
} }
const char * const char *SDL_GetDisplayName(int displayIndex)
SDL_GetDisplayName(int displayIndex)
{ {
CHECK_DISPLAY_INDEX(displayIndex, NULL); CHECK_DISPLAY_INDEX(displayIndex, NULL);
@ -766,8 +759,7 @@ int SDL_GetDisplayDPI(int displayIndex, float *ddpi, float *hdpi, float *vdpi)
return -1; return -1;
} }
SDL_DisplayOrientation SDL_DisplayOrientation SDL_GetDisplayOrientation(int displayIndex)
SDL_GetDisplayOrientation(int displayIndex)
{ {
SDL_VideoDisplay *display; SDL_VideoDisplay *display;
@ -777,8 +769,7 @@ SDL_GetDisplayOrientation(int displayIndex)
return display->orientation; return display->orientation;
} }
SDL_bool SDL_bool SDL_AddDisplayMode(SDL_VideoDisplay *display, const SDL_DisplayMode *mode)
SDL_AddDisplayMode(SDL_VideoDisplay *display, const SDL_DisplayMode *mode)
{ {
SDL_DisplayMode *modes; SDL_DisplayMode *modes;
int i, nmodes; int i, nmodes;
@ -1006,10 +997,7 @@ static SDL_DisplayMode *SDL_GetClosestDisplayModeForDisplay(SDL_VideoDisplay *di
return NULL; return NULL;
} }
SDL_DisplayMode * SDL_DisplayMode *SDL_GetClosestDisplayMode(int displayIndex, const SDL_DisplayMode *mode, SDL_DisplayMode *closest)
SDL_GetClosestDisplayMode(int displayIndex,
const SDL_DisplayMode *mode,
SDL_DisplayMode *closest)
{ {
SDL_VideoDisplay *display; SDL_VideoDisplay *display;
@ -1075,8 +1063,7 @@ static int SDL_SetDisplayModeForDisplay(SDL_VideoDisplay *display, const SDL_Dis
return 0; return 0;
} }
SDL_VideoDisplay * SDL_VideoDisplay *SDL_GetDisplay(int displayIndex)
SDL_GetDisplay(int displayIndex)
{ {
CHECK_DISPLAY_INDEX(displayIndex, NULL); CHECK_DISPLAY_INDEX(displayIndex, NULL);
@ -1220,8 +1207,7 @@ int SDL_GetWindowDisplayIndex(SDL_Window *window)
} }
} }
SDL_VideoDisplay * SDL_VideoDisplay *SDL_GetDisplayForWindow(SDL_Window *window)
SDL_GetDisplayForWindow(SDL_Window *window)
{ {
int displayIndex = SDL_GetWindowDisplayIndex(window); int displayIndex = SDL_GetWindowDisplayIndex(window);
if (displayIndex >= 0) { if (displayIndex >= 0) {
@ -1295,8 +1281,7 @@ int SDL_GetWindowDisplayMode(SDL_Window *window, SDL_DisplayMode *mode)
return 0; return 0;
} }
void * void *SDL_GetWindowICCProfile(SDL_Window *window, size_t *size)
SDL_GetWindowICCProfile(SDL_Window *window, size_t *size)
{ {
if (!_this->GetWindowICCProfile) { if (!_this->GetWindowICCProfile) {
SDL_Unsupported(); SDL_Unsupported();
@ -1305,8 +1290,7 @@ SDL_GetWindowICCProfile(SDL_Window *window, size_t *size)
return _this->GetWindowICCProfile(_this, window, size); return _this->GetWindowICCProfile(_this, window, size);
} }
Uint32 Uint32 SDL_GetWindowPixelFormat(SDL_Window *window)
SDL_GetWindowPixelFormat(SDL_Window *window)
{ {
SDL_VideoDisplay *display; SDL_VideoDisplay *display;
@ -1574,8 +1558,7 @@ static int SDL_DllNotSupported(const char *name)
return SDL_SetError("No dynamic %s support in current SDL video driver (%s)", name, _this->name); return SDL_SetError("No dynamic %s support in current SDL video driver (%s)", name, _this->name);
} }
SDL_Window * SDL_Window *SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags)
SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags)
{ {
SDL_Window *window; SDL_Window *window;
Uint32 type_flags, graphics_flags; Uint32 type_flags, graphics_flags;
@ -1775,8 +1758,7 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags)
return window; return window;
} }
SDL_Window * SDL_Window *SDL_CreateWindowFrom(const void *data)
SDL_CreateWindowFrom(const void *data)
{ {
SDL_Window *window; SDL_Window *window;
Uint32 flags = SDL_WINDOW_FOREIGN; Uint32 flags = SDL_WINDOW_FOREIGN;
@ -1984,22 +1966,19 @@ int SDL_RecreateWindow(SDL_Window *window, Uint32 flags)
return 0; return 0;
} }
SDL_bool SDL_bool SDL_HasWindows(void)
SDL_HasWindows(void)
{ {
return _this && _this->windows != NULL; return _this && _this->windows != NULL;
} }
SDL_WindowID SDL_WindowID SDL_GetWindowID(SDL_Window *window)
SDL_GetWindowID(SDL_Window *window)
{ {
CHECK_WINDOW_MAGIC(window, 0); CHECK_WINDOW_MAGIC(window, 0);
return window->id; return window->id;
} }
SDL_Window * SDL_Window *SDL_GetWindowFromID(SDL_WindowID id)
SDL_GetWindowFromID(SDL_WindowID id)
{ {
SDL_Window *window; SDL_Window *window;
@ -2014,8 +1993,7 @@ SDL_GetWindowFromID(SDL_WindowID id)
return NULL; return NULL;
} }
Uint32 Uint32 SDL_GetWindowFlags(SDL_Window *window)
SDL_GetWindowFlags(SDL_Window *window)
{ {
CHECK_WINDOW_MAGIC(window, 0); CHECK_WINDOW_MAGIC(window, 0);
@ -2038,8 +2016,7 @@ void SDL_SetWindowTitle(SDL_Window *window, const char *title)
} }
} }
const char * const char *SDL_GetWindowTitle(SDL_Window *window)
SDL_GetWindowTitle(SDL_Window *window)
{ {
CHECK_WINDOW_MAGIC(window, ""); CHECK_WINDOW_MAGIC(window, "");
@ -2067,8 +2044,7 @@ void SDL_SetWindowIcon(SDL_Window *window, SDL_Surface *icon)
} }
} }
void * void *SDL_SetWindowData(SDL_Window *window, const char *name, void *userdata)
SDL_SetWindowData(SDL_Window *window, const char *name, void *userdata)
{ {
SDL_WindowUserData *prev, *data; SDL_WindowUserData *prev, *data;
@ -2114,8 +2090,7 @@ SDL_SetWindowData(SDL_Window *window, const char *name, void *userdata)
return NULL; return NULL;
} }
void * void *SDL_GetWindowData(SDL_Window *window, const char *name)
SDL_GetWindowData(SDL_Window *window, const char *name)
{ {
SDL_WindowUserData *data; SDL_WindowUserData *data;
@ -2671,8 +2646,7 @@ static SDL_Surface *SDL_CreateWindowFramebuffer(SDL_Window *window)
return SDL_CreateSurfaceFrom(pixels, window->w, window->h, pitch, format); return SDL_CreateSurfaceFrom(pixels, window->w, window->h, pitch, format);
} }
SDL_Surface * SDL_Surface *SDL_GetWindowSurface(SDL_Window *window)
SDL_GetWindowSurface(SDL_Window *window)
{ {
CHECK_WINDOW_MAGIC(window, NULL); CHECK_WINDOW_MAGIC(window, NULL);
@ -2861,28 +2835,24 @@ void SDL_SetWindowMouseGrab(SDL_Window *window, SDL_bool grabbed)
SDL_UpdateWindowGrab(window); SDL_UpdateWindowGrab(window);
} }
SDL_bool SDL_bool SDL_GetWindowGrab(SDL_Window *window)
SDL_GetWindowGrab(SDL_Window *window)
{ {
return SDL_GetWindowKeyboardGrab(window) || SDL_GetWindowMouseGrab(window); return SDL_GetWindowKeyboardGrab(window) || SDL_GetWindowMouseGrab(window);
} }
SDL_bool SDL_bool SDL_GetWindowKeyboardGrab(SDL_Window *window)
SDL_GetWindowKeyboardGrab(SDL_Window *window)
{ {
CHECK_WINDOW_MAGIC(window, SDL_FALSE); CHECK_WINDOW_MAGIC(window, SDL_FALSE);
return window == _this->grabbed_window && ((_this->grabbed_window->flags & SDL_WINDOW_KEYBOARD_GRABBED) != 0); return window == _this->grabbed_window && ((_this->grabbed_window->flags & SDL_WINDOW_KEYBOARD_GRABBED) != 0);
} }
SDL_bool SDL_bool SDL_GetWindowMouseGrab(SDL_Window *window)
SDL_GetWindowMouseGrab(SDL_Window *window)
{ {
CHECK_WINDOW_MAGIC(window, SDL_FALSE); CHECK_WINDOW_MAGIC(window, SDL_FALSE);
return window == _this->grabbed_window && ((_this->grabbed_window->flags & SDL_WINDOW_MOUSE_GRABBED) != 0); return window == _this->grabbed_window && ((_this->grabbed_window->flags & SDL_WINDOW_MOUSE_GRABBED) != 0);
} }
SDL_Window * SDL_Window *SDL_GetGrabbedWindow(void)
SDL_GetGrabbedWindow(void)
{ {
if (_this->grabbed_window && if (_this->grabbed_window &&
(_this->grabbed_window->flags & (SDL_WINDOW_MOUSE_GRABBED | SDL_WINDOW_KEYBOARD_GRABBED)) != 0) { (_this->grabbed_window->flags & (SDL_WINDOW_MOUSE_GRABBED | SDL_WINDOW_KEYBOARD_GRABBED)) != 0) {
@ -2908,8 +2878,7 @@ int SDL_SetWindowMouseRect(SDL_Window *window, const SDL_Rect *rect)
return 0; return 0;
} }
const SDL_Rect * const SDL_Rect *SDL_GetWindowMouseRect(SDL_Window *window)
SDL_GetWindowMouseRect(SDL_Window *window)
{ {
CHECK_WINDOW_MAGIC(window, NULL); CHECK_WINDOW_MAGIC(window, NULL);
@ -3062,8 +3031,7 @@ void SDL_OnWindowFocusLost(SDL_Window *window)
/* !!! FIXME: is this different than SDL_GetKeyboardFocus()? /* !!! FIXME: is this different than SDL_GetKeyboardFocus()?
!!! FIXME: Also, SDL_GetKeyboardFocus() is O(1), this isn't. */ !!! FIXME: Also, SDL_GetKeyboardFocus() is O(1), this isn't. */
SDL_Window * SDL_Window *SDL_GetFocusWindow(void)
SDL_GetFocusWindow(void)
{ {
SDL_Window *window; SDL_Window *window;
@ -3161,8 +3129,7 @@ void SDL_DestroyWindow(SDL_Window *window)
SDL_free(window); SDL_free(window);
} }
SDL_bool SDL_bool SDL_ScreenSaverEnabled()
SDL_ScreenSaverEnabled()
{ {
if (_this == NULL) { if (_this == NULL) {
return SDL_TRUE; return SDL_TRUE;
@ -3270,8 +3237,7 @@ int SDL_GL_LoadLibrary(const char *path)
return retval; return retval;
} }
void * SDL_FunctionPointer SDL_GL_GetProcAddress(const char *proc)
SDL_GL_GetProcAddress(const char *proc)
{ {
void *func; void *func;
@ -3292,8 +3258,7 @@ SDL_GL_GetProcAddress(const char *proc)
return func; return func;
} }
void * SDL_FunctionPointer SDL_EGL_GetProcAddress(const char *proc)
SDL_EGL_GetProcAddress(const char *proc)
{ {
#if SDL_VIDEO_OPENGL_EGL #if SDL_VIDEO_OPENGL_EGL
void *func; void *func;
@ -3334,17 +3299,23 @@ void SDL_GL_UnloadLibrary(void)
} }
#if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 #if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
typedef GLenum (APIENTRY* PFNGLGETERRORPROC) (void);
typedef void (APIENTRY* PFNGLGETINTEGERVPROC) (GLenum pname, GLint * params);
typedef const GLubyte *(APIENTRY* PFNGLGETSTRINGPROC) (GLenum name);
#if !SDL_VIDEO_OPENGL
typedef const GLubyte *(APIENTRY* PFNGLGETSTRINGIPROC) (GLenum name, GLuint index);
#endif
static SDL_INLINE SDL_bool isAtLeastGL3(const char *verstr) static SDL_INLINE SDL_bool isAtLeastGL3(const char *verstr)
{ {
return verstr && (SDL_atoi(verstr) >= 3); return verstr && (SDL_atoi(verstr) >= 3);
} }
#endif #endif /* SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 */
SDL_bool SDL_bool SDL_GL_ExtensionSupported(const char *extension)
SDL_GL_ExtensionSupported(const char *extension)
{ {
#if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 #if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
const GLubyte *(APIENTRY * glGetStringFunc)(GLenum); PFNGLGETSTRINGPROC glGetStringFunc;
const char *extensions; const char *extensions;
const char *start; const char *start;
const char *where, *terminator; const char *where, *terminator;
@ -3362,19 +3333,19 @@ SDL_GL_ExtensionSupported(const char *extension)
/* Lookup the available extensions */ /* Lookup the available extensions */
glGetStringFunc = SDL_GL_GetProcAddress("glGetString"); glGetStringFunc = (PFNGLGETSTRINGPROC)SDL_GL_GetProcAddress("glGetString");
if (glGetStringFunc == NULL) { if (glGetStringFunc == NULL) {
return SDL_FALSE; return SDL_FALSE;
} }
if (isAtLeastGL3((const char *)glGetStringFunc(GL_VERSION))) { if (isAtLeastGL3((const char *)glGetStringFunc(GL_VERSION))) {
const GLubyte *(APIENTRY * glGetStringiFunc)(GLenum, GLuint); PFNGLGETSTRINGIPROC glGetStringiFunc;
void(APIENTRY * glGetIntegervFunc)(GLenum pname, GLint * params); PFNGLGETINTEGERVPROC glGetIntegervFunc;
GLint num_exts = 0; GLint num_exts = 0;
GLint i; GLint i;
glGetStringiFunc = SDL_GL_GetProcAddress("glGetStringi"); glGetStringiFunc = (PFNGLGETSTRINGIPROC)SDL_GL_GetProcAddress("glGetStringi");
glGetIntegervFunc = SDL_GL_GetProcAddress("glGetIntegerv"); glGetIntegervFunc = (PFNGLGETINTEGERVPROC)SDL_GL_GetProcAddress("glGetIntegerv");
if ((glGetStringiFunc == NULL) || (glGetIntegervFunc == NULL)) { if ((glGetStringiFunc == NULL) || (glGetIntegervFunc == NULL)) {
return SDL_FALSE; return SDL_FALSE;
} }
@ -3650,7 +3621,7 @@ int SDL_GL_SetAttribute(SDL_GLattr attr, int value)
int SDL_GL_GetAttribute(SDL_GLattr attr, int *value) int SDL_GL_GetAttribute(SDL_GLattr attr, int *value)
{ {
#if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 #if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2
GLenum(APIENTRY * glGetErrorFunc)(void); PFNGLGETERRORPROC glGetErrorFunc;
GLenum attrib = 0; GLenum attrib = 0;
GLenum error = 0; GLenum error = 0;
@ -3661,8 +3632,8 @@ int SDL_GL_GetAttribute(SDL_GLattr attr, int *value)
* the function itself doesn't exist prior to OpenGL 3 and OpenGL ES 2. * the function itself doesn't exist prior to OpenGL 3 and OpenGL ES 2.
*/ */
#if SDL_VIDEO_OPENGL #if SDL_VIDEO_OPENGL
const GLubyte *(APIENTRY * glGetStringFunc)(GLenum name); PFNGLGETSTRINGPROC glGetStringFunc;
void(APIENTRY * glGetFramebufferAttachmentParameterivFunc)(GLenum target, GLenum attachment, GLenum pname, GLint * params); PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC glGetFramebufferAttachmentParameterivFunc;
GLenum attachment = GL_BACK_LEFT; GLenum attachment = GL_BACK_LEFT;
GLenum attachmentattrib = 0; GLenum attachmentattrib = 0;
#endif #endif
@ -3844,7 +3815,7 @@ int SDL_GL_GetAttribute(SDL_GLattr attr, int *value)
} }
#if SDL_VIDEO_OPENGL #if SDL_VIDEO_OPENGL
glGetStringFunc = SDL_GL_GetProcAddress("glGetString"); glGetStringFunc = (PFNGLGETSTRINGPROC)SDL_GL_GetProcAddress("glGetString");
if (glGetStringFunc == NULL) { if (glGetStringFunc == NULL) {
return -1; return -1;
} }
@ -3852,13 +3823,13 @@ int SDL_GL_GetAttribute(SDL_GLattr attr, int *value)
if (attachmentattrib && isAtLeastGL3((const char *)glGetStringFunc(GL_VERSION))) { if (attachmentattrib && isAtLeastGL3((const char *)glGetStringFunc(GL_VERSION))) {
/* glGetFramebufferAttachmentParameteriv needs to operate on the window framebuffer for this, so bind FBO 0 if necessary. */ /* glGetFramebufferAttachmentParameteriv needs to operate on the window framebuffer for this, so bind FBO 0 if necessary. */
GLint current_fbo = 0; GLint current_fbo = 0;
void(APIENTRY * glGetIntegervFunc)(GLenum pname, GLint * params) = SDL_GL_GetProcAddress("glGetIntegerv"); PFNGLGETINTEGERVPROC glGetIntegervFunc = (PFNGLGETINTEGERVPROC) SDL_GL_GetProcAddress("glGetIntegerv");
void(APIENTRY * glBindFramebufferFunc)(GLenum target, GLuint fbo) = SDL_GL_GetProcAddress("glBindFramebuffer"); PFNGLBINDFRAMEBUFFERPROC glBindFramebufferFunc = (PFNGLBINDFRAMEBUFFERPROC)SDL_GL_GetProcAddress("glBindFramebuffer");
if (glGetIntegervFunc && glBindFramebufferFunc) { if (glGetIntegervFunc && glBindFramebufferFunc) {
glGetIntegervFunc(GL_DRAW_FRAMEBUFFER_BINDING, &current_fbo); glGetIntegervFunc(GL_DRAW_FRAMEBUFFER_BINDING, &current_fbo);
} }
glGetFramebufferAttachmentParameterivFunc = SDL_GL_GetProcAddress("glGetFramebufferAttachmentParameteriv"); glGetFramebufferAttachmentParameterivFunc = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC)SDL_GL_GetProcAddress("glGetFramebufferAttachmentParameteriv");
if (glGetFramebufferAttachmentParameterivFunc) { if (glGetFramebufferAttachmentParameterivFunc) {
if (glBindFramebufferFunc && (current_fbo != 0)) { if (glBindFramebufferFunc && (current_fbo != 0)) {
glBindFramebufferFunc(GL_DRAW_FRAMEBUFFER, 0); glBindFramebufferFunc(GL_DRAW_FRAMEBUFFER, 0);
@ -3873,8 +3844,7 @@ int SDL_GL_GetAttribute(SDL_GLattr attr, int *value)
} else } else
#endif #endif
{ {
void(APIENTRY * glGetIntegervFunc)(GLenum pname, GLint * params); PFNGLGETINTEGERVPROC glGetIntegervFunc = (PFNGLGETINTEGERVPROC)SDL_GL_GetProcAddress("glGetIntegerv");
glGetIntegervFunc = SDL_GL_GetProcAddress("glGetIntegerv");
if (glGetIntegervFunc) { if (glGetIntegervFunc) {
glGetIntegervFunc(attrib, (GLint *)value); glGetIntegervFunc(attrib, (GLint *)value);
} else { } else {
@ -3882,7 +3852,7 @@ int SDL_GL_GetAttribute(SDL_GLattr attr, int *value)
} }
} }
glGetErrorFunc = SDL_GL_GetProcAddress("glGetError"); glGetErrorFunc = (PFNGLGETERRORPROC)SDL_GL_GetProcAddress("glGetError");
if (glGetErrorFunc == NULL) { if (glGetErrorFunc == NULL) {
return -1; return -1;
} }
@ -3904,8 +3874,7 @@ int SDL_GL_GetAttribute(SDL_GLattr attr, int *value)
#define NOT_AN_OPENGL_WINDOW "The specified window isn't an OpenGL window" #define NOT_AN_OPENGL_WINDOW "The specified window isn't an OpenGL window"
SDL_GLContext SDL_GLContext SDL_GL_CreateContext(SDL_Window *window)
SDL_GL_CreateContext(SDL_Window *window)
{ {
SDL_GLContext ctx = NULL; SDL_GLContext ctx = NULL;
CHECK_WINDOW_MAGIC(window, NULL); CHECK_WINDOW_MAGIC(window, NULL);
@ -3963,8 +3932,7 @@ int SDL_GL_MakeCurrent(SDL_Window *window, SDL_GLContext context)
return retval; return retval;
} }
SDL_Window * SDL_Window *SDL_GL_GetCurrentWindow(void)
SDL_GL_GetCurrentWindow(void)
{ {
if (_this == NULL) { if (_this == NULL) {
SDL_UninitializedVideo(); SDL_UninitializedVideo();
@ -3973,8 +3941,7 @@ SDL_GL_GetCurrentWindow(void)
return (SDL_Window *)SDL_TLSGet(_this->current_glwin_tls); return (SDL_Window *)SDL_TLSGet(_this->current_glwin_tls);
} }
SDL_GLContext SDL_GLContext SDL_GL_GetCurrentContext(void)
SDL_GL_GetCurrentContext(void)
{ {
if (_this == NULL) { if (_this == NULL) {
SDL_UninitializedVideo(); SDL_UninitializedVideo();
@ -3983,8 +3950,7 @@ SDL_GL_GetCurrentContext(void)
return (SDL_GLContext)SDL_TLSGet(_this->current_glctx_tls); return (SDL_GLContext)SDL_TLSGet(_this->current_glctx_tls);
} }
SDL_EGLDisplay SDL_EGLDisplay SDL_EGL_GetCurrentEGLDisplay(void)
SDL_EGL_GetCurrentEGLDisplay(void)
{ {
#if SDL_VIDEO_OPENGL_EGL #if SDL_VIDEO_OPENGL_EGL
if (!_this) { if (!_this) {
@ -4002,8 +3968,7 @@ SDL_EGL_GetCurrentEGLDisplay(void)
#endif #endif
} }
SDL_EGLConfig SDL_EGLConfig SDL_EGL_GetCurrentEGLConfig(void)
SDL_EGL_GetCurrentEGLConfig(void)
{ {
#if SDL_VIDEO_OPENGL_EGL #if SDL_VIDEO_OPENGL_EGL
if (!_this) { if (!_this) {
@ -4021,8 +3986,7 @@ SDL_EGL_GetCurrentEGLConfig(void)
#endif #endif
} }
SDL_EGLConfig SDL_EGLConfig SDL_EGL_GetWindowEGLSurface(SDL_Window *window)
SDL_EGL_GetWindowEGLSurface(SDL_Window *window)
{ {
#if SDL_VIDEO_OPENGL_EGL #if SDL_VIDEO_OPENGL_EGL
if (!_this) { if (!_this) {
@ -4183,8 +4147,7 @@ static void CreateMaskFromColorKeyOrAlpha(SDL_Surface * icon, Uint8 * mask, int
/* /*
* Sets the window manager icon for the display window. * Sets the window manager icon for the display window.
*/ */
void void SDL_WM_SetIcon(SDL_Surface * icon, Uint8 * mask)
SDL_WM_SetIcon(SDL_Surface * icon, Uint8 * mask)
{ {
if (icon && _this->SetIcon) { if (icon && _this->SetIcon) {
/* Generate a mask if necessary, and create the icon! */ /* Generate a mask if necessary, and create the icon! */
@ -4266,8 +4229,7 @@ void SDL_ClearComposition(void)
} }
} }
SDL_bool SDL_bool SDL_TextInputShown(void)
SDL_TextInputShown(void)
{ {
if (_this && _this->IsTextInputShown) { if (_this && _this->IsTextInputShown) {
return _this->IsTextInputShown(_this); return _this->IsTextInputShown(_this);
@ -4276,8 +4238,7 @@ SDL_TextInputShown(void)
return SDL_FALSE; return SDL_FALSE;
} }
SDL_bool SDL_bool SDL_TextInputActive(void)
SDL_TextInputActive(void)
{ {
return SDL_EventEnabled(SDL_TEXTINPUT); return SDL_EventEnabled(SDL_TEXTINPUT);
} }
@ -4309,8 +4270,7 @@ void SDL_SetTextInputRect(const SDL_Rect *rect)
} }
} }
SDL_bool SDL_bool SDL_HasScreenKeyboardSupport(void)
SDL_HasScreenKeyboardSupport(void)
{ {
if (_this && _this->HasScreenKeyboardSupport) { if (_this && _this->HasScreenKeyboardSupport) {
return _this->HasScreenKeyboardSupport(_this); return _this->HasScreenKeyboardSupport(_this);
@ -4318,8 +4278,7 @@ SDL_HasScreenKeyboardSupport(void)
return SDL_FALSE; return SDL_FALSE;
} }
SDL_bool SDL_bool SDL_ScreenKeyboardShown(SDL_Window *window)
SDL_ScreenKeyboardShown(SDL_Window *window)
{ {
if (window && _this && _this->IsScreenKeyboardShown) { if (window && _this && _this->IsScreenKeyboardShown) {
return _this->IsScreenKeyboardShown(_this, window); return _this->IsScreenKeyboardShown(_this, window);
@ -4552,8 +4511,7 @@ int SDL_ShowSimpleMessageBox(Uint32 flags, const char *title, const char *messag
#endif #endif
} }
SDL_bool SDL_bool SDL_ShouldAllowTopmost(void)
SDL_ShouldAllowTopmost(void)
{ {
return SDL_GetHintBoolean(SDL_HINT_ALLOW_TOPMOST, SDL_TRUE); return SDL_GetHintBoolean(SDL_HINT_ALLOW_TOPMOST, SDL_TRUE);
} }
@ -4658,7 +4616,7 @@ int SDL_Vulkan_LoadLibrary(const char *path)
return retval; return retval;
} }
void *SDL_Vulkan_GetVkGetInstanceProcAddr(void) SDL_FunctionPointer SDL_Vulkan_GetVkGetInstanceProcAddr(void)
{ {
if (_this == NULL) { if (_this == NULL) {
SDL_UninitializedVideo(); SDL_UninitializedVideo();
@ -4668,7 +4626,7 @@ void *SDL_Vulkan_GetVkGetInstanceProcAddr(void)
SDL_SetError("No Vulkan loader has been loaded"); SDL_SetError("No Vulkan loader has been loaded");
return NULL; return NULL;
} }
return _this->vulkan_config.vkGetInstanceProcAddr; return (SDL_FunctionPointer)_this->vulkan_config.vkGetInstanceProcAddr;
} }
void SDL_Vulkan_UnloadLibrary(void) void SDL_Vulkan_UnloadLibrary(void)
@ -4732,8 +4690,7 @@ void SDL_Vulkan_GetDrawableSize(SDL_Window *window, int *w, int *h)
} }
} }
SDL_MetalView SDL_MetalView SDL_Metal_CreateView(SDL_Window *window)
SDL_Metal_CreateView(SDL_Window *window)
{ {
CHECK_WINDOW_MAGIC(window, NULL); CHECK_WINDOW_MAGIC(window, NULL);
@ -4760,8 +4717,7 @@ void SDL_Metal_DestroyView(SDL_MetalView view)
} }
} }
void * void *SDL_Metal_GetLayer(SDL_MetalView view)
SDL_Metal_GetLayer(SDL_MetalView view)
{ {
if (_this && _this->Metal_GetLayer) { if (_this && _this->Metal_GetLayer) {
if (view) { if (view) {

View File

@ -70,7 +70,7 @@ struct SDL_GLDriverData
/* OpenGL functions */ /* OpenGL functions */
extern int Cocoa_GL_LoadLibrary(_THIS, const char *path); extern int Cocoa_GL_LoadLibrary(_THIS, const char *path);
extern void *Cocoa_GL_GetProcAddress(_THIS, const char *proc); extern SDL_FunctionPointer Cocoa_GL_GetProcAddress(_THIS, const char *proc);
extern void Cocoa_GL_UnloadLibrary(_THIS); extern void Cocoa_GL_UnloadLibrary(_THIS);
extern SDL_GLContext Cocoa_GL_CreateContext(_THIS, SDL_Window *window); extern SDL_GLContext Cocoa_GL_CreateContext(_THIS, SDL_Window *window);
extern int Cocoa_GL_MakeCurrent(_THIS, SDL_Window *window, extern int Cocoa_GL_MakeCurrent(_THIS, SDL_Window *window,

View File

@ -239,8 +239,7 @@ int Cocoa_GL_LoadLibrary(_THIS, const char *path)
return 0; return 0;
} }
void * SDL_FunctionPointer Cocoa_GL_GetProcAddress(_THIS, const char *proc)
Cocoa_GL_GetProcAddress(_THIS, const char *proc)
{ {
return SDL_LoadFunction(_this->gl_config.dll_handle, proc); return SDL_LoadFunction(_this->gl_config.dll_handle, proc);
} }
@ -251,8 +250,7 @@ void Cocoa_GL_UnloadLibrary(_THIS)
_this->gl_config.dll_handle = NULL; _this->gl_config.dll_handle = NULL;
} }
SDL_GLContext SDL_GLContext Cocoa_GL_CreateContext(_THIS, SDL_Window *window)
Cocoa_GL_CreateContext(_THIS, SDL_Window *window)
{ {
@autoreleasepool { @autoreleasepool {
SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);

View File

@ -38,8 +38,7 @@ void Emscripten_GLES_UnloadLibrary(_THIS)
{ {
} }
void * SDL_FunctionPointer Emscripten_GLES_GetProcAddress(_THIS, const char *proc)
Emscripten_GLES_GetProcAddress(_THIS, const char *proc)
{ {
return emscripten_webgl_get_proc_address(proc); return emscripten_webgl_get_proc_address(proc);
} }
@ -72,8 +71,7 @@ int Emscripten_GLES_GetSwapInterval(_THIS, int *interval)
} }
} }
SDL_GLContext SDL_GLContext Emscripten_GLES_CreateContext(_THIS, SDL_Window *window)
Emscripten_GLES_CreateContext(_THIS, SDL_Window *window)
{ {
SDL_WindowData *window_data; SDL_WindowData *window_data;

View File

@ -30,7 +30,7 @@
/* OpenGLES functions */ /* OpenGLES functions */
extern int Emscripten_GLES_LoadLibrary(_THIS, const char *path); extern int Emscripten_GLES_LoadLibrary(_THIS, const char *path);
extern void Emscripten_GLES_UnloadLibrary(_THIS); extern void Emscripten_GLES_UnloadLibrary(_THIS);
extern void *Emscripten_GLES_GetProcAddress(_THIS, const char *proc); extern SDL_FunctionPointer Emscripten_GLES_GetProcAddress(_THIS, const char *proc);
extern int Emscripten_GLES_SetSwapInterval(_THIS, int interval); extern int Emscripten_GLES_SetSwapInterval(_THIS, int interval);
extern int Emscripten_GLES_GetSwapInterval(_THIS, int *interval); extern int Emscripten_GLES_GetSwapInterval(_THIS, int *interval);
extern SDL_GLContext Emscripten_GLES_CreateContext(_THIS, SDL_Window *window); extern SDL_GLContext Emscripten_GLES_CreateContext(_THIS, SDL_Window *window);

View File

@ -63,7 +63,7 @@ int HAIKU_GL_LoadLibrary(_THIS, const char *path)
return 0; return 0;
} }
void *HAIKU_GL_GetProcAddress(_THIS, const char *proc) SDL_FunctionPointer HAIKU_GL_GetProcAddress(_THIS, const char *proc)
{ {
if (_this->gl_config.dll_handle != NULL) { if (_this->gl_config.dll_handle != NULL) {
void *location = NULL; void *location = NULL;

View File

@ -31,7 +31,7 @@ extern "C" {
#include "../SDL_sysvideo.h" #include "../SDL_sysvideo.h"
extern int HAIKU_GL_LoadLibrary(_THIS, const char *path); /* FIXME */ extern int HAIKU_GL_LoadLibrary(_THIS, const char *path); /* FIXME */
extern void *HAIKU_GL_GetProcAddress(_THIS, const char *proc); /* FIXME */ extern SDL_FunctionPointer HAIKU_GL_GetProcAddress(_THIS, const char *proc); /* FIXME */
extern void HAIKU_GL_UnloadLibrary(_THIS); /* TODO */ extern void HAIKU_GL_UnloadLibrary(_THIS); /* TODO */
extern int HAIKU_GL_MakeCurrent(_THIS, SDL_Window *window, extern int HAIKU_GL_MakeCurrent(_THIS, SDL_Window *window,
SDL_GLContext context); SDL_GLContext context);

View File

@ -141,7 +141,7 @@ int KMSDRM_GetWindowWMInfo(_THIS, SDL_Window *window, struct SDL_SysWMinfo *info
/* OpenGL/OpenGL ES functions */ /* OpenGL/OpenGL ES functions */
int KMSDRM_GLES_LoadLibrary(_THIS, const char *path); int KMSDRM_GLES_LoadLibrary(_THIS, const char *path);
void *KMSDRM_GLES_GetProcAddress(_THIS, const char *proc); SDL_FunctionPointer KMSDRM_GLES_GetProcAddress(_THIS, const char *proc);
void KMSDRM_GLES_UnloadLibrary(_THIS); void KMSDRM_GLES_UnloadLibrary(_THIS);
SDL_GLContext KMSDRM_GLES_CreateContext(_THIS, SDL_Window *window); SDL_GLContext KMSDRM_GLES_CreateContext(_THIS, SDL_Window *window);
int KMSDRM_GLES_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context); int KMSDRM_GLES_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context);

View File

@ -54,8 +54,7 @@ int PSP_GL_LoadLibrary(_THIS, const char *path)
GLSTUB(glOrtho,(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLSTUB(glOrtho,(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top,
GLdouble zNear, GLdouble zFar)) GLdouble zNear, GLdouble zFar))
*/ */
void * SDL_FunctionPointer PSP_GL_GetProcAddress(_THIS, const char *proc)
PSP_GL_GetProcAddress(_THIS, const char *proc)
{ {
return eglGetProcAddress(proc); return eglGetProcAddress(proc);
} }
@ -68,8 +67,7 @@ void PSP_GL_UnloadLibrary(_THIS)
static EGLint width = 480; static EGLint width = 480;
static EGLint height = 272; static EGLint height = 272;
SDL_GLContext SDL_GLContext PSP_GL_CreateContext(_THIS, SDL_Window *window)
PSP_GL_CreateContext(_THIS, SDL_Window *window)
{ {
SDL_WindowData *wdata = (SDL_WindowData *)window->driverdata; SDL_WindowData *wdata = (SDL_WindowData *)window->driverdata;

View File

@ -35,7 +35,7 @@ typedef struct SDL_GLDriverData
uint32_t swapinterval; uint32_t swapinterval;
} SDL_GLDriverData; } SDL_GLDriverData;
extern void *PSP_GL_GetProcAddress(_THIS, const char *proc); extern SDL_FunctionPointer PSP_GL_GetProcAddress(_THIS, const char *proc);
extern int PSP_GL_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context); extern int PSP_GL_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context);
extern void PSP_GL_SwapBuffers(_THIS); extern void PSP_GL_SwapBuffers(_THIS);

View File

@ -70,7 +70,7 @@ void PSP_DestroyWindow(_THIS, SDL_Window *window);
/* OpenGL/OpenGL ES functions */ /* OpenGL/OpenGL ES functions */
int PSP_GL_LoadLibrary(_THIS, const char *path); int PSP_GL_LoadLibrary(_THIS, const char *path);
void *PSP_GL_GetProcAddress(_THIS, const char *proc); SDL_FunctionPointer PSP_GL_GetProcAddress(_THIS, const char *proc);
void PSP_GL_UnloadLibrary(_THIS); void PSP_GL_UnloadLibrary(_THIS);
SDL_GLContext PSP_GL_CreateContext(_THIS, SDL_Window *window); SDL_GLContext PSP_GL_CreateContext(_THIS, SDL_Window *window);
int PSP_GL_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context); int PSP_GL_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context);

View File

@ -82,7 +82,7 @@ void RPI_DestroyWindow(_THIS, SDL_Window *window);
/* OpenGL/OpenGL ES functions */ /* OpenGL/OpenGL ES functions */
int RPI_GLES_LoadLibrary(_THIS, const char *path); int RPI_GLES_LoadLibrary(_THIS, const char *path);
void *RPI_GLES_GetProcAddress(_THIS, const char *proc); SDL_FunctionPointer RPI_GLES_GetProcAddress(_THIS, const char *proc);
void RPI_GLES_UnloadLibrary(_THIS); void RPI_GLES_UnloadLibrary(_THIS);
SDL_GLContext RPI_GLES_CreateContext(_THIS, SDL_Window *window); SDL_GLContext RPI_GLES_CreateContext(_THIS, SDL_Window *window);
int RPI_GLES_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context); int RPI_GLES_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context);

View File

@ -32,7 +32,7 @@ extern void UIKit_GL_GetDrawableSize(_THIS, SDL_Window *window,
extern int UIKit_GL_SwapWindow(_THIS, SDL_Window *window); extern int UIKit_GL_SwapWindow(_THIS, SDL_Window *window);
extern SDL_GLContext UIKit_GL_CreateContext(_THIS, SDL_Window *window); extern SDL_GLContext UIKit_GL_CreateContext(_THIS, SDL_Window *window);
extern void UIKit_GL_DeleteContext(_THIS, SDL_GLContext context); extern void UIKit_GL_DeleteContext(_THIS, SDL_GLContext context);
extern void *UIKit_GL_GetProcAddress(_THIS, const char *proc); extern SDL_FunctionPointer UIKit_GL_GetProcAddress(_THIS, const char *proc);
extern int UIKit_GL_LoadLibrary(_THIS, const char *path); extern int UIKit_GL_LoadLibrary(_THIS, const char *path);
extern void UIKit_GL_RestoreCurrentContext(void); extern void UIKit_GL_RestoreCurrentContext(void);

View File

@ -51,8 +51,7 @@
@end @end
void * SDL_FunctionPointer UIKit_GL_GetProcAddress(_THIS, const char *proc)
UIKit_GL_GetProcAddress(_THIS, const char *proc)
{ {
/* Look through all SO's for the proc symbol. Here's why: /* Look through all SO's for the proc symbol. Here's why:
* -Looking for the path to the OpenGL Library seems not to work in the iOS Simulator. * -Looking for the path to the OpenGL Library seems not to work in the iOS Simulator.
@ -128,8 +127,7 @@ int UIKit_GL_SwapWindow(_THIS, SDL_Window *window)
return 0; return 0;
} }
SDL_GLContext SDL_GLContext UIKit_GL_CreateContext(_THIS, SDL_Window *window)
UIKit_GL_CreateContext(_THIS, SDL_Window *window)
{ {
@autoreleasepool { @autoreleasepool {
SDLEAGLContext *context = nil; SDLEAGLContext *context = nil;

View File

@ -26,6 +26,6 @@
extern SDL_GLContext VITA_GL_CreateContext(_THIS, SDL_Window *window); extern SDL_GLContext VITA_GL_CreateContext(_THIS, SDL_Window *window);
extern int VITA_GL_LoadLibrary(_THIS, const char *path); extern int VITA_GL_LoadLibrary(_THIS, const char *path);
extern void *VITA_GL_GetProcAddress(_THIS, const char *proc); extern SDL_FunctionPointer VITA_GL_GetProcAddress(_THIS, const char *proc);
#endif /* SDL_vitagl_pvr_c_h_ */ #endif /* SDL_vitagl_pvr_c_h_ */

View File

@ -64,8 +64,7 @@ int VITA_GLES_LoadLibrary(_THIS, const char *path)
return 0; return 0;
} }
void * SDL_FunctionPointer VITA_GLES_GetProcAddress(_THIS, const char *proc)
VITA_GLES_GetProcAddress(_THIS, const char *proc)
{ {
return eglGetProcAddress(proc); return eglGetProcAddress(proc);
} }
@ -78,8 +77,7 @@ void VITA_GLES_UnloadLibrary(_THIS)
static EGLint width = 960; static EGLint width = 960;
static EGLint height = 544; static EGLint height = 544;
SDL_GLContext SDL_GLContext VITA_GLES_CreateContext(_THIS, SDL_Window *window)
VITA_GLES_CreateContext(_THIS, SDL_Window *window)
{ {
SDL_WindowData *wdata = (SDL_WindowData *)window->driverdata; SDL_WindowData *wdata = (SDL_WindowData *)window->driverdata;

View File

@ -38,7 +38,7 @@ typedef struct SDL_GLDriverData
uint32_t swapinterval; uint32_t swapinterval;
} SDL_GLDriverData; } SDL_GLDriverData;
extern void *VITA_GLES_GetProcAddress(_THIS, const char *proc); extern SDL_FunctionPointer VITA_GLES_GetProcAddress(_THIS, const char *proc);
extern int VITA_GLES_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context); extern int VITA_GLES_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context);
extern void VITA_GLES_SwapBuffers(_THIS); extern void VITA_GLES_SwapBuffers(_THIS);

View File

@ -87,12 +87,12 @@ void VITA_DestroyWindow(_THIS, SDL_Window *window);
/* OpenGL functions */ /* OpenGL functions */
int VITA_GL_LoadLibrary(_THIS, const char *path); int VITA_GL_LoadLibrary(_THIS, const char *path);
SDL_GLContext VITA_GL_CreateContext(_THIS, SDL_Window *window); SDL_GLContext VITA_GL_CreateContext(_THIS, SDL_Window *window);
void *VITA_GL_GetProcAddress(_THIS, const char *proc); SDL_FunctionPointer VITA_GL_GetProcAddress(_THIS, const char *proc);
#endif #endif
/* OpenGLES functions */ /* OpenGLES functions */
int VITA_GLES_LoadLibrary(_THIS, const char *path); int VITA_GLES_LoadLibrary(_THIS, const char *path);
void *VITA_GLES_GetProcAddress(_THIS, const char *proc); SDL_FunctionPointer VITA_GLES_GetProcAddress(_THIS, const char *proc);
void VITA_GLES_UnloadLibrary(_THIS); void VITA_GLES_UnloadLibrary(_THIS);
SDL_GLContext VITA_GLES_CreateContext(_THIS, SDL_Window *window); SDL_GLContext VITA_GLES_CreateContext(_THIS, SDL_Window *window);
int VITA_GLES_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context); int VITA_GLES_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context);

View File

@ -131,7 +131,7 @@ int WIN_GL_LoadLibrary(_THIS, const char *path)
/* Load function pointers */ /* Load function pointers */
handle = _this->gl_config.dll_handle; handle = _this->gl_config.dll_handle;
/* *INDENT-OFF* */ /* clang-format off */ /* *INDENT-OFF* */ /* clang-format off */
_this->gl_data->wglGetProcAddress = (void *(WINAPI *)(const char *)) _this->gl_data->wglGetProcAddress = (PROC (WINAPI *)(const char *))
SDL_LoadFunction(handle, "wglGetProcAddress"); SDL_LoadFunction(handle, "wglGetProcAddress");
_this->gl_data->wglCreateContext = (HGLRC (WINAPI *)(HDC)) _this->gl_data->wglCreateContext = (HGLRC (WINAPI *)(HDC))
SDL_LoadFunction(handle, "wglCreateContext"); SDL_LoadFunction(handle, "wglCreateContext");
@ -212,8 +212,7 @@ int WIN_GL_LoadLibrary(_THIS, const char *path)
return 0; return 0;
} }
void * SDL_FunctionPointer WIN_GL_GetProcAddress(_THIS, const char *proc)
WIN_GL_GetProcAddress(_THIS, const char *proc)
{ {
void *func; void *func;
@ -477,8 +476,10 @@ void WIN_GL_InitExtensions(_THIS)
_this->gl_data->HAS_WGL_EXT_swap_control_tear = SDL_FALSE; _this->gl_data->HAS_WGL_EXT_swap_control_tear = SDL_FALSE;
if (HasExtension("WGL_EXT_swap_control", extensions)) { if (HasExtension("WGL_EXT_swap_control", extensions)) {
_this->gl_data->wglSwapIntervalEXT = _this->gl_data->wglSwapIntervalEXT =
(BOOL (WINAPI *)(int))
WIN_GL_GetProcAddress(_this, "wglSwapIntervalEXT"); WIN_GL_GetProcAddress(_this, "wglSwapIntervalEXT");
_this->gl_data->wglGetSwapIntervalEXT = _this->gl_data->wglGetSwapIntervalEXT =
(int (WINAPI *)(void))
WIN_GL_GetProcAddress(_this, "wglGetSwapIntervalEXT"); WIN_GL_GetProcAddress(_this, "wglGetSwapIntervalEXT");
if (HasExtension("WGL_EXT_swap_control_tear", extensions)) { if (HasExtension("WGL_EXT_swap_control_tear", extensions)) {
_this->gl_data->HAS_WGL_EXT_swap_control_tear = SDL_TRUE; _this->gl_data->HAS_WGL_EXT_swap_control_tear = SDL_TRUE;
@ -687,8 +688,7 @@ int WIN_GL_SetupWindow(_THIS, SDL_Window *window)
return retval; return retval;
} }
SDL_bool SDL_bool WIN_GL_UseEGL(_THIS)
WIN_GL_UseEGL(_THIS)
{ {
SDL_assert(_this->gl_data != NULL); SDL_assert(_this->gl_data != NULL);
SDL_assert(_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES); SDL_assert(_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES);
@ -696,8 +696,7 @@ WIN_GL_UseEGL(_THIS)
return SDL_GetHintBoolean(SDL_HINT_OPENGL_ES_DRIVER, SDL_FALSE) || _this->gl_config.major_version == 1 || _this->gl_config.major_version > _this->gl_data->es_profile_max_supported_version.major || (_this->gl_config.major_version == _this->gl_data->es_profile_max_supported_version.major && _this->gl_config.minor_version > _this->gl_data->es_profile_max_supported_version.minor); /* No WGL extension for OpenGL ES 1.x profiles. */ return SDL_GetHintBoolean(SDL_HINT_OPENGL_ES_DRIVER, SDL_FALSE) || _this->gl_config.major_version == 1 || _this->gl_config.major_version > _this->gl_data->es_profile_max_supported_version.major || (_this->gl_config.major_version == _this->gl_data->es_profile_max_supported_version.major && _this->gl_config.minor_version > _this->gl_data->es_profile_max_supported_version.minor); /* No WGL extension for OpenGL ES 1.x profiles. */
} }
SDL_GLContext SDL_GLContext WIN_GL_CreateContext(_THIS, SDL_Window *window)
WIN_GL_CreateContext(_THIS, SDL_Window *window)
{ {
HDC hdc = ((SDL_WindowData *)window->driverdata)->hdc; HDC hdc = ((SDL_WindowData *)window->driverdata)->hdc;
HGLRC context, share_context; HGLRC context, share_context;
@ -894,8 +893,7 @@ void WIN_GL_DeleteContext(_THIS, SDL_GLContext context)
_this->gl_data->wglDeleteContext((HGLRC)context); _this->gl_data->wglDeleteContext((HGLRC)context);
} }
SDL_bool SDL_bool WIN_GL_SetPixelFormatFrom(_THIS, SDL_Window *fromWindow, SDL_Window *toWindow)
WIN_GL_SetPixelFormatFrom(_THIS, SDL_Window *fromWindow, SDL_Window *toWindow)
{ {
HDC hfromdc = ((SDL_WindowData *)fromWindow->driverdata)->hdc; HDC hfromdc = ((SDL_WindowData *)fromWindow->driverdata)->hdc;
HDC htodc = ((SDL_WindowData *)toWindow->driverdata)->hdc; HDC htodc = ((SDL_WindowData *)toWindow->driverdata)->hdc;

View File

@ -76,7 +76,7 @@ struct SDL_GLDriverData
} es_profile_max_supported_version; } es_profile_max_supported_version;
/* *INDENT-OFF* */ /* clang-format off */ /* *INDENT-OFF* */ /* clang-format off */
void *(WINAPI *wglGetProcAddress)(const char *proc); PROC (WINAPI *wglGetProcAddress)(const char *proc);
HGLRC (WINAPI *wglCreateContext)(HDC hdc); HGLRC (WINAPI *wglCreateContext)(HDC hdc);
BOOL (WINAPI *wglDeleteContext)(HGLRC hglrc); BOOL (WINAPI *wglDeleteContext)(HGLRC hglrc);
BOOL (WINAPI *wglMakeCurrent)(HDC hdc, HGLRC hglrc); BOOL (WINAPI *wglMakeCurrent)(HDC hdc, HGLRC hglrc);
@ -103,7 +103,7 @@ struct SDL_GLDriverData
/* OpenGL functions */ /* OpenGL functions */
extern int WIN_GL_LoadLibrary(_THIS, const char *path); extern int WIN_GL_LoadLibrary(_THIS, const char *path);
extern void *WIN_GL_GetProcAddress(_THIS, const char *proc); extern SDL_FunctionPointer WIN_GL_GetProcAddress(_THIS, const char *proc);
extern void WIN_GL_UnloadLibrary(_THIS); extern void WIN_GL_UnloadLibrary(_THIS);
extern SDL_bool WIN_GL_UseEGL(_THIS); extern SDL_bool WIN_GL_UseEGL(_THIS);
extern int WIN_GL_SetupWindow(_THIS, SDL_Window *window); extern int WIN_GL_SetupWindow(_THIS, SDL_Window *window);

View File

@ -202,7 +202,7 @@ int X11_GL_LoadLibrary(_THIS, const char *path)
(Bool(*)(Display *, int *, int *)) (Bool(*)(Display *, int *, int *))
GL_LoadFunction(handle, "glXQueryExtension"); GL_LoadFunction(handle, "glXQueryExtension");
_this->gl_data->glXGetProcAddress = _this->gl_data->glXGetProcAddress =
(void *(*)(const GLubyte *)) (__GLXextFuncPtr (*)(const GLubyte *))
GL_LoadFunction(handle, "glXGetProcAddressARB"); GL_LoadFunction(handle, "glXGetProcAddressARB");
_this->gl_data->glXChooseVisual = _this->gl_data->glXChooseVisual =
(XVisualInfo * (*)(Display *, int, int *)) (XVisualInfo * (*)(Display *, int, int *))
@ -270,8 +270,7 @@ int X11_GL_LoadLibrary(_THIS, const char *path)
return 0; return 0;
} }
void * SDL_FunctionPointer X11_GL_GetProcAddress(_THIS, const char *proc)
X11_GL_GetProcAddress(_THIS, const char *proc)
{ {
if (_this->gl_data->glXGetProcAddress) { if (_this->gl_data->glXGetProcAddress) {
return _this->gl_data->glXGetProcAddress((const GLubyte *)proc); return _this->gl_data->glXGetProcAddress((const GLubyte *)proc);
@ -604,8 +603,7 @@ static int X11_GL_GetAttributes(_THIS, Display *display, int screen, int *attrib
return i; return i;
} }
XVisualInfo * XVisualInfo *X11_GL_GetVisual(_THIS, Display *display, int screen)
X11_GL_GetVisual(_THIS, Display *display, int screen)
{ {
/* 64 seems nice. */ /* 64 seems nice. */
int attribs[64]; int attribs[64];
@ -676,8 +674,7 @@ static int X11_GL_ErrorHandler(Display *d, XErrorEvent *e)
return (0); return (0);
} }
SDL_bool SDL_bool X11_GL_UseEGL(_THIS)
X11_GL_UseEGL(_THIS)
{ {
SDL_assert(_this->gl_data != NULL); SDL_assert(_this->gl_data != NULL);
if (SDL_GetHintBoolean(SDL_HINT_VIDEO_FORCE_EGL, SDL_FALSE)) { if (SDL_GetHintBoolean(SDL_HINT_VIDEO_FORCE_EGL, SDL_FALSE)) {
@ -690,8 +687,7 @@ X11_GL_UseEGL(_THIS)
|| _this->gl_config.major_version > _this->gl_data->es_profile_max_supported_version.major || (_this->gl_config.major_version == _this->gl_data->es_profile_max_supported_version.major && _this->gl_config.minor_version > _this->gl_data->es_profile_max_supported_version.minor)); || _this->gl_config.major_version > _this->gl_data->es_profile_max_supported_version.major || (_this->gl_config.major_version == _this->gl_data->es_profile_max_supported_version.major && _this->gl_config.minor_version > _this->gl_data->es_profile_max_supported_version.minor));
} }
SDL_GLContext SDL_GLContext X11_GL_CreateContext(_THIS, SDL_Window *window)
X11_GL_CreateContext(_THIS, SDL_Window *window)
{ {
SDL_WindowData *data = (SDL_WindowData *)window->driverdata; SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
Display *display = data->videodata->display; Display *display = data->videodata->display;

View File

@ -27,6 +27,8 @@
#include <SDL3/SDL_opengl.h> #include <SDL3/SDL_opengl.h>
#include <GL/glx.h> #include <GL/glx.h>
typedef void (*__GLXextFuncPtr)(void);
struct SDL_GLDriverData struct SDL_GLDriverData
{ {
int errorBase, eventBase; int errorBase, eventBase;
@ -49,7 +51,7 @@ struct SDL_GLDriverData
} es_profile_max_supported_version; } es_profile_max_supported_version;
Bool (*glXQueryExtension)(Display *, int *, int *); Bool (*glXQueryExtension)(Display *, int *, int *);
void *(*glXGetProcAddress)(const GLubyte *); __GLXextFuncPtr (*glXGetProcAddress)(const GLubyte *);
XVisualInfo *(*glXChooseVisual)(Display *, int, int *); XVisualInfo *(*glXChooseVisual)(Display *, int, int *);
GLXContext (*glXCreateContext)(Display *, XVisualInfo *, GLXContext, Bool); GLXContext (*glXCreateContext)(Display *, XVisualInfo *, GLXContext, Bool);
GLXContext (*glXCreateContextAttribsARB)(Display *, GLXFBConfig, GLXContext, Bool, const int *); GLXContext (*glXCreateContextAttribsARB)(Display *, GLXFBConfig, GLXContext, Bool, const int *);
@ -67,7 +69,7 @@ struct SDL_GLDriverData
/* OpenGL functions */ /* OpenGL functions */
extern int X11_GL_LoadLibrary(_THIS, const char *path); extern int X11_GL_LoadLibrary(_THIS, const char *path);
extern void *X11_GL_GetProcAddress(_THIS, const char *proc); extern SDL_FunctionPointer X11_GL_GetProcAddress(_THIS, const char *proc);
extern void X11_GL_UnloadLibrary(_THIS); extern void X11_GL_UnloadLibrary(_THIS);
extern SDL_bool X11_GL_UseEGL(_THIS); extern SDL_bool X11_GL_UseEGL(_THIS);
extern XVisualInfo *X11_GL_GetVisual(_THIS, Display *display, int screen); extern XVisualInfo *X11_GL_GetVisual(_THIS, Display *display, int screen);

View File

@ -114,7 +114,7 @@ int X11_Vulkan_LoadLibrary(_THIS, const char *path)
goto fail; goto fail;
} }
videoData->vulkan_XGetXCBConnection = videoData->vulkan_XGetXCBConnection =
SDL_LoadFunction(videoData->vulkan_xlib_xcb_library, "XGetXCBConnection"); (PFN_XGetXCBConnection)SDL_LoadFunction(videoData->vulkan_xlib_xcb_library, "XGetXCBConnection");
if (!videoData->vulkan_XGetXCBConnection) { if (!videoData->vulkan_XGetXCBConnection) {
SDL_UnloadObject(videoData->vulkan_xlib_xcb_library); SDL_UnloadObject(videoData->vulkan_xlib_xcb_library);
goto fail; goto fail;

View File

@ -45,7 +45,7 @@ static int LoadContext(GL_Context *data)
#else #else
#define SDL_PROC(ret, func, params) \ #define SDL_PROC(ret, func, params) \
do { \ do { \
data->func = SDL_GL_GetProcAddress(#func); \ data->func = (ret (APIENTRY *) params)SDL_GL_GetProcAddress(#func); \
if (!data->func) { \ if (!data->func) { \
return SDL_SetError("Couldn't load GL function %s: %s", #func, SDL_GetError()); \ return SDL_SetError("Couldn't load GL function %s: %s", #func, SDL_GetError()); \
} \ } \

View File

@ -71,7 +71,7 @@ static int LoadContext(GLES2_Context *data)
#else #else
#define SDL_PROC(ret, func, params) \ #define SDL_PROC(ret, func, params) \
do { \ do { \
data->func = SDL_GL_GetProcAddress(#func); \ data->func = (ret (APIENTRY *) params)SDL_GL_GetProcAddress(#func); \
if (!data->func) { \ if (!data->func) { \
return SDL_SetError("Couldn't load GLES2 function %s: %s", #func, SDL_GetError()); \ return SDL_SetError("Couldn't load GLES2 function %s: %s", #func, SDL_GetError()); \
} \ } \

View File

@ -73,7 +73,7 @@ static int LoadContext(GLES2_Context *data)
#else #else
#define SDL_PROC(ret, func, params) \ #define SDL_PROC(ret, func, params) \
do { \ do { \
data->func = SDL_GL_GetProcAddress(#func); \ data->func = (ret (APIENTRY *) params)SDL_GL_GetProcAddress(#func); \
if (!data->func) { \ if (!data->func) { \
return SDL_SetError("Couldn't load GLES2 function %s: %s", #func, SDL_GetError()); \ return SDL_SetError("Couldn't load GLES2 function %s: %s", #func, SDL_GetError()); \
} \ } \

View File

@ -192,7 +192,7 @@ static void quit(int rc)
static void loadGlobalFunctions(void) static void loadGlobalFunctions(void)
{ {
vkGetInstanceProcAddr = SDL_Vulkan_GetVkGetInstanceProcAddr(); vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)SDL_Vulkan_GetVkGetInstanceProcAddr();
if (!vkGetInstanceProcAddr) { if (!vkGetInstanceProcAddr) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
"SDL_Vulkan_GetVkGetInstanceProcAddr(): %s\n", "SDL_Vulkan_GetVkGetInstanceProcAddr(): %s\n",