Renamed driverdata to internal

This was done to SDL_DisplayMode for consistency with SDL_Surface and gives it a type so we don't have to do casts in SDL code.

I considered switching to an ID and hashing the driver data, etc. but all of that involved a lot of internal code churn and this solution gives us flexibility in how we handle this in the future.

After consideration, I made this renaming global across the project, for consistency.

Fixes https://github.com/libsdl-org/SDL/issues/10198
This commit is contained in:
Sam Lantinga committed 2024-07-16 17:17:13 -07:00
1 parent fe183872ee
commit 9ca1792848
138 files changed
+1454 -1456

No files matched your search

+4 -4
View File
@@ -44,7 +44,7 @@ static void android_egl_context_restore(SDL_Window *window)
{
if (window) {
SDL_Event event;
SDL_WindowData *data = window->driverdata;
SDL_WindowData *data = window->internal;
SDL_GL_MakeCurrent(window, NULL);
if (SDL_GL_MakeCurrent(window, (SDL_GLContext)data->egl_context) < 0) {
/* The context is no longer valid, create a new one */
@@ -68,7 +68,7 @@ static void android_egl_context_backup(SDL_Window *window)
if (window) {
int interval = 0;
/* Keep a copy of the EGL Context so we can try to restore it when we resume */
SDL_WindowData *data = window->driverdata;
SDL_WindowData *data = window->internal;
data->egl_context = SDL_GL_GetCurrentContext();
/* Save/Restore the swap interval / vsync */
@@ -93,7 +93,7 @@ static void android_egl_context_backup(SDL_Window *window)
void Android_PumpEvents_Blocking(SDL_VideoDevice *_this)
{
SDL_VideoData *videodata = _this->driverdata;
SDL_VideoData *videodata = _this->internal;
if (videodata->isPaused) {
#ifdef SDL_VIDEO_OPENGL_EGL
@@ -162,7 +162,7 @@ void Android_PumpEvents_Blocking(SDL_VideoDevice *_this)
void Android_PumpEvents_NonBlocking(SDL_VideoDevice *_this)
{
SDL_VideoData *videodata = _this->driverdata;
SDL_VideoData *videodata = _this->internal;
static int backup_context = 0;
if (videodata->isPaused) {
+3 -3
View File
@@ -38,7 +38,7 @@
int Android_GLES_MakeCurrent(SDL_VideoDevice *_this, SDL_Window *window, SDL_GLContext context)
{
if (window && context) {
return SDL_EGL_MakeCurrent(_this, window->driverdata->egl_surface, context);
return SDL_EGL_MakeCurrent(_this, window->internal->egl_surface, context);
} else {
return SDL_EGL_MakeCurrent(_this, NULL, NULL);
}
@@ -50,7 +50,7 @@ SDL_GLContext Android_GLES_CreateContext(SDL_VideoDevice *_this, SDL_Window *win
Android_ActivityMutex_Lock_Running();
ret = SDL_EGL_CreateContext(_this, window->driverdata->egl_surface);
ret = SDL_EGL_CreateContext(_this, window->internal->egl_surface);
SDL_UnlockMutex(Android_ActivityMutex);
@@ -70,7 +70,7 @@ int Android_GLES_SwapWindow(SDL_VideoDevice *_this, SDL_Window *window)
/*_this->egl_data->eglWaitNative(EGL_CORE_NATIVE_ENGINE);
_this->egl_data->eglWaitGL();*/
retval = SDL_EGL_SwapBuffers(_this, window->driverdata->egl_surface);
retval = SDL_EGL_SwapBuffers(_this, window->internal->egl_surface);
SDL_UnlockMutex(Android_ActivityMutex);
+4 -4
View File
@@ -64,7 +64,7 @@ static SDL_Cursor *Android_WrapCursor(int custom_cursor, int system_cursor)
if (data) {
data->custom_cursor = custom_cursor;
data->system_cursor = system_cursor;
cursor->driverdata = data;
cursor->internal = data;
} else {
SDL_free(cursor);
cursor = NULL;
@@ -104,11 +104,11 @@ static SDL_Cursor *Android_CreateSystemCursor(SDL_SystemCursor id)
static void Android_FreeCursor(SDL_Cursor *cursor)
{
SDL_AndroidCursorData *data = (SDL_AndroidCursorData *)cursor->driverdata;
SDL_AndroidCursorData *data = (SDL_AndroidCursorData *)cursor->internal;
if (data->custom_cursor != 0) {
Android_JNI_DestroyCustomCursor(data->custom_cursor);
}
SDL_free(cursor->driverdata);
SDL_free(cursor->internal);
SDL_free(cursor);
}
@@ -139,7 +139,7 @@ static int Android_ShowCursor(SDL_Cursor *cursor)
cursor = Android_CreateEmptyCursor();
}
if (cursor) {
SDL_AndroidCursorData *data = (SDL_AndroidCursorData *)cursor->driverdata;
SDL_AndroidCursorData *data = (SDL_AndroidCursorData *)cursor->internal;
if (data->custom_cursor) {
if (!Android_JNI_SetCustomCursor(data->custom_cursor)) {
return SDL_Unsupported();
+3 -4
View File
@@ -75,7 +75,7 @@ static int Android_SuspendScreenSaver(SDL_VideoDevice *_this)
static void Android_DeleteDevice(SDL_VideoDevice *device)
{
SDL_free(device->driverdata);
SDL_free(device->internal);
SDL_free(device);
}
@@ -97,7 +97,7 @@ static SDL_VideoDevice *Android_CreateDevice(void)
return NULL;
}
device->driverdata = data;
device->internal = data;
device->system_theme = Android_SystemTheme;
/* Set the function pointers */
@@ -167,7 +167,7 @@ VideoBootStrap Android_bootstrap = {
int Android_VideoInit(SDL_VideoDevice *_this)
{
SDL_VideoData *videodata = _this->driverdata;
SDL_VideoData *videodata = _this->internal;
SDL_DisplayID displayID;
SDL_VideoDisplay *display;
SDL_DisplayMode mode;
@@ -181,7 +181,6 @@ int Android_VideoInit(SDL_VideoDevice *_this)
mode.w = Android_DeviceWidth;
mode.h = Android_DeviceHeight;
mode.refresh_rate = Android_ScreenRate;
mode.driverdata = NULL;
displayID = SDL_AddBasicVideoDisplay(&mode);
if (displayID == 0) {
+1 -1
View File
@@ -128,7 +128,7 @@ int Android_Vulkan_CreateSurface(SDL_VideoDevice *_this,
const struct VkAllocationCallbacks *allocator,
VkSurfaceKHR *surface)
{
SDL_WindowData *windowData = window->driverdata;
SDL_WindowData *windowData = window->internal;
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr =
(PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr;
PFN_vkCreateAndroidSurfaceKHR vkCreateAndroidSurfaceKHR =
+6 -6
View File
@@ -90,7 +90,7 @@ int Android_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Propert
SDL_SetPointerProperty(SDL_GetWindowProperties(window), SDL_PROP_WINDOW_ANDROID_SURFACE_POINTER, data->egl_surface);
#endif
window->driverdata = data;
window->internal = data;
Android_Window = window;
endfunction:
@@ -128,7 +128,7 @@ int Android_SetWindowFullscreen(SDL_VideoDevice *_this, SDL_Window *window, SDL_
goto endfunction;
}
data = window->driverdata;
data = window->internal;
if (!data || !data->native_window) {
if (data && !data->native_window) {
SDL_SetError("Missing native window");
@@ -175,8 +175,8 @@ void Android_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
if (window == Android_Window) {
Android_Window = NULL;
if (window->driverdata) {
SDL_WindowData *data = window->driverdata;
if (window->internal) {
SDL_WindowData *data = window->internal;
#ifdef SDL_VIDEO_OPENGL_EGL
if (data->egl_surface != EGL_NO_SURFACE) {
@@ -187,8 +187,8 @@ void Android_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
if (data->native_window) {
ANativeWindow_release(data->native_window);
}
SDL_free(window->driverdata);
window->driverdata = NULL;
SDL_free(window->internal);
window->internal = NULL;
}
}