فهرست منبع

Remove _THIS in src/video and in src/events (also VideoDevice)

Sylvain 1 سال پیش
والد
کامیت
81ff49f4b5
100فایلهای تغییر یافته به همراه672 افزوده شده و 675 حذف شده
  1. 1 1
      src/events/SDL_events.c
  2. 21 21
      src/video/SDL_egl.c
  3. 22 22
      src/video/SDL_egl_c.h
  4. 82 85
      src/video/SDL_sysvideo.h
  5. 2 2
      src/video/SDL_video.c
  6. 3 3
      src/video/android/SDL_androidclipboard.c
  7. 3 3
      src/video/android/SDL_androidclipboard.h
  8. 2 2
      src/video/android/SDL_androidevents.c
  9. 2 2
      src/video/android/SDL_androidevents.h
  10. 4 4
      src/video/android/SDL_androidgl.c
  11. 4 4
      src/video/android/SDL_androidgl.h
  12. 5 5
      src/video/android/SDL_androidkeyboard.c
  13. 5 5
      src/video/android/SDL_androidkeyboard.h
  14. 5 5
      src/video/android/SDL_androidvideo.c
  15. 4 4
      src/video/android/SDL_androidvulkan.c
  16. 4 4
      src/video/android/SDL_androidvulkan.h
  17. 7 7
      src/video/android/SDL_androidwindow.c
  18. 8 8
      src/video/android/SDL_androidwindow.h
  19. 3 3
      src/video/cocoa/SDL_cocoaclipboard.h
  20. 3 3
      src/video/cocoa/SDL_cocoaclipboard.m
  21. 4 4
      src/video/cocoa/SDL_cocoaevents.h
  22. 5 5
      src/video/cocoa/SDL_cocoaevents.m
  23. 7 7
      src/video/cocoa/SDL_cocoakeyboard.h
  24. 8 8
      src/video/cocoa/SDL_cocoakeyboard.m
  25. 3 3
      src/video/cocoa/SDL_cocoametalview.h
  26. 3 3
      src/video/cocoa/SDL_cocoametalview.m
  27. 6 6
      src/video/cocoa/SDL_cocoamodes.h
  28. 7 7
      src/video/cocoa/SDL_cocoamodes.m
  29. 3 3
      src/video/cocoa/SDL_cocoamouse.h
  30. 4 4
      src/video/cocoa/SDL_cocoamouse.m
  31. 9 9
      src/video/cocoa/SDL_cocoaopengl.h
  32. 9 9
      src/video/cocoa/SDL_cocoaopengl.m
  33. 7 7
      src/video/cocoa/SDL_cocoaopengles.h
  34. 7 7
      src/video/cocoa/SDL_cocoaopengles.m
  35. 4 4
      src/video/cocoa/SDL_cocoavideo.m
  36. 4 4
      src/video/cocoa/SDL_cocoavulkan.h
  37. 5 5
      src/video/cocoa/SDL_cocoavulkan.m
  38. 27 27
      src/video/cocoa/SDL_cocoawindow.h
  39. 28 28
      src/video/cocoa/SDL_cocoawindow.m
  40. 1 1
      src/video/dummy/SDL_nullevents.c
  41. 1 1
      src/video/dummy/SDL_nullevents_c.h
  42. 3 3
      src/video/dummy/SDL_nullframebuffer.c
  43. 3 3
      src/video/dummy/SDL_nullframebuffer_c.h
  44. 8 8
      src/video/dummy/SDL_nullvideo.c
  45. 3 3
      src/video/emscripten/SDL_emscriptenframebuffer.c
  46. 3 3
      src/video/emscripten/SDL_emscriptenframebuffer.h
  47. 9 9
      src/video/emscripten/SDL_emscriptenopengles.c
  48. 9 9
      src/video/emscripten/SDL_emscriptenopengles.h
  49. 23 23
      src/video/emscripten/SDL_emscriptenvideo.c
  50. 3 3
      src/video/haiku/SDL_bclipboard.cc
  51. 3 3
      src/video/haiku/SDL_bclipboard.h
  52. 1 1
      src/video/haiku/SDL_bevents.cc
  53. 1 1
      src/video/haiku/SDL_bevents.h
  54. 3 3
      src/video/haiku/SDL_bframebuffer.cc
  55. 3 3
      src/video/haiku/SDL_bframebuffer.h
  56. 5 5
      src/video/haiku/SDL_bmodes.cc
  57. 5 5
      src/video/haiku/SDL_bmodes.h
  58. 10 10
      src/video/haiku/SDL_bopengl.cc
  59. 10 10
      src/video/haiku/SDL_bopengl.h
  60. 3 3
      src/video/haiku/SDL_bvideo.cc
  61. 3 3
      src/video/haiku/SDL_bvideo.h
  62. 19 19
      src/video/haiku/SDL_bwindow.cc
  63. 18 18
      src/video/haiku/SDL_bwindow.h
  64. 1 1
      src/video/kmsdrm/SDL_kmsdrmevents.c
  65. 3 3
      src/video/kmsdrm/SDL_kmsdrmevents.h
  66. 3 3
      src/video/kmsdrm/SDL_kmsdrmmouse.c
  67. 3 3
      src/video/kmsdrm/SDL_kmsdrmmouse.h
  68. 5 5
      src/video/kmsdrm/SDL_kmsdrmopengles.c
  69. 6 6
      src/video/kmsdrm/SDL_kmsdrmopengles.h
  70. 27 27
      src/video/kmsdrm/SDL_kmsdrmvideo.c
  71. 31 31
      src/video/kmsdrm/SDL_kmsdrmvideo.h
  72. 4 4
      src/video/kmsdrm/SDL_kmsdrmvulkan.c
  73. 4 4
      src/video/kmsdrm/SDL_kmsdrmvulkan.h
  74. 1 1
      src/video/n3ds/SDL_n3dsevents.c
  75. 1 1
      src/video/n3ds/SDL_n3dsevents_c.h
  76. 3 3
      src/video/n3ds/SDL_n3dsframebuffer.c
  77. 3 3
      src/video/n3ds/SDL_n3dsframebuffer_c.h
  78. 3 3
      src/video/n3ds/SDL_n3dsswkb.c
  79. 3 3
      src/video/n3ds/SDL_n3dsswkb.h
  80. 10 10
      src/video/n3ds/SDL_n3dsvideo.c
  81. 6 6
      src/video/ngage/SDL_ngageevents.cpp
  82. 1 1
      src/video/ngage/SDL_ngageevents_c.h
  83. 11 11
      src/video/ngage/SDL_ngageframebuffer.cpp
  84. 3 3
      src/video/ngage/SDL_ngageframebuffer_c.h
  85. 4 4
      src/video/ngage/SDL_ngagevideo.cpp
  86. 1 1
      src/video/ngage/SDL_ngagevideo.h
  87. 6 6
      src/video/ngage/SDL_ngagewindow.cpp
  88. 2 2
      src/video/ngage/SDL_ngagewindow.h
  89. 1 1
      src/video/offscreen/SDL_offscreenevents.c
  90. 1 1
      src/video/offscreen/SDL_offscreenevents_c.h
  91. 3 3
      src/video/offscreen/SDL_offscreenframebuffer.c
  92. 3 3
      src/video/offscreen/SDL_offscreenframebuffer_c.h
  93. 4 4
      src/video/offscreen/SDL_offscreenopengles.c
  94. 4 4
      src/video/offscreen/SDL_offscreenopengles.h
  95. 6 6
      src/video/offscreen/SDL_offscreenvideo.c
  96. 2 2
      src/video/offscreen/SDL_offscreenwindow.c
  97. 2 2
      src/video/offscreen/SDL_offscreenwindow.h
  98. 5 5
      src/video/ps2/SDL_ps2video.c
  99. 4 4
      src/video/psp/SDL_pspevents.c
  100. 2 2
      src/video/psp/SDL_pspevents_c.h

+ 1 - 1
src/events/SDL_events.c

@@ -900,7 +900,7 @@ static SDL_bool SDL_events_need_periodic_poll(void)
     return need_periodic_poll;
 }
 
-static int SDL_WaitEventTimeout_Device(_THIS, SDL_Window *wakeup_window, SDL_Event *event, Uint64 start, Sint64 timeoutNS)
+static int SDL_WaitEventTimeout_Device(SDL_VideoDevice *_this, SDL_Window *wakeup_window, SDL_Event *event, Uint64 start, Sint64 timeoutNS)
 {
     Sint64 loop_timeoutNS = timeoutNS;
     SDL_bool need_periodic_poll = SDL_events_need_periodic_poll();

+ 21 - 21
src/video/SDL_egl.c

@@ -176,7 +176,7 @@ int SDL_EGL_SetErrorEx(const char *message, const char *eglFunctionName, EGLint
 
 /* EGL implementation of SDL OpenGL ES support */
 
-SDL_bool SDL_EGL_HasExtension(_THIS, SDL_EGL_ExtensionType type, const char *ext)
+SDL_bool SDL_EGL_HasExtension(SDL_VideoDevice *_this, SDL_EGL_ExtensionType type, const char *ext)
 {
     size_t ext_len;
     const char *ext_override;
@@ -248,7 +248,7 @@ SDL_bool SDL_EGL_HasExtension(_THIS, SDL_EGL_ExtensionType type, const char *ext
     return SDL_FALSE;
 }
 
-SDL_FunctionPointer SDL_EGL_GetProcAddressInternal(_THIS, const char *proc)
+SDL_FunctionPointer SDL_EGL_GetProcAddressInternal(SDL_VideoDevice *_this, const char *proc)
 {
     SDL_FunctionPointer retval = NULL;
     if (_this->egl_data != NULL) {
@@ -275,7 +275,7 @@ SDL_FunctionPointer SDL_EGL_GetProcAddressInternal(_THIS, const char *proc)
     return retval;
 }
 
-void SDL_EGL_UnloadLibrary(_THIS)
+void SDL_EGL_UnloadLibrary(SDL_VideoDevice *_this)
 {
     if (_this->egl_data) {
         if (_this->egl_data->egl_display) {
@@ -297,7 +297,7 @@ void SDL_EGL_UnloadLibrary(_THIS)
     }
 }
 
-static int SDL_EGL_LoadLibraryInternal(_THIS, const char *egl_path)
+static int SDL_EGL_LoadLibraryInternal(SDL_VideoDevice *_this, const char *egl_path)
 {
     void *egl_dll_handle = NULL, *opengl_dll_handle = NULL;
     const char *path = NULL;
@@ -468,7 +468,7 @@ static int SDL_EGL_LoadLibraryInternal(_THIS, const char *egl_path)
     return 0;
 }
 
-int SDL_EGL_LoadLibraryOnly(_THIS, const char *egl_path)
+int SDL_EGL_LoadLibraryOnly(SDL_VideoDevice *_this, const char *egl_path)
 {
     if (_this->egl_data) {
         return SDL_SetError("EGL context already created");
@@ -487,7 +487,7 @@ int SDL_EGL_LoadLibraryOnly(_THIS, const char *egl_path)
     return 0;
 }
 
-static void SDL_EGL_GetVersion(_THIS)
+static void SDL_EGL_GetVersion(SDL_VideoDevice *_this)
 {
     if (_this->egl_data->eglQueryString) {
         const char *egl_version = _this->egl_data->eglQueryString(_this->egl_data->egl_display, EGL_VERSION);
@@ -503,7 +503,7 @@ static void SDL_EGL_GetVersion(_THIS)
     }
 }
 
-int SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_display, EGLenum platform)
+int SDL_EGL_LoadLibrary(SDL_VideoDevice *_this, const char *egl_path, NativeDisplayType native_display, EGLenum platform)
 {
     int library_load_retcode = SDL_EGL_LoadLibraryOnly(_this, egl_path);
     if (library_load_retcode != 0) {
@@ -583,7 +583,7 @@ int SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_di
    valid available GPU for EGL to use.
 */
 
-int SDL_EGL_InitializeOffscreen(_THIS, int device)
+int SDL_EGL_InitializeOffscreen(SDL_VideoDevice *_this, int device)
 {
     void *egl_devices[SDL_EGL_MAX_DEVICES];
     EGLint num_egl_devices = 0;
@@ -661,7 +661,7 @@ int SDL_EGL_InitializeOffscreen(_THIS, int device)
     return 0;
 }
 
-void SDL_EGL_SetRequiredVisualId(_THIS, int visual_id)
+void SDL_EGL_SetRequiredVisualId(SDL_VideoDevice *_this, int visual_id)
 {
     _this->egl_data->egl_required_visual_id = visual_id;
 }
@@ -715,7 +715,7 @@ static Attribute all_attributes[] = {
     ATTRIBUTE(EGL_CONFORMANT),
 };
 
-static void dumpconfig(_THIS, EGLConfig config)
+static void dumpconfig(SDL_VideoDevice *_this, EGLConfig config)
 {
     int attr;
     for (attr = 0; attr < sizeof(all_attributes) / sizeof(Attribute); attr++) {
@@ -727,7 +727,7 @@ static void dumpconfig(_THIS, EGLConfig config)
 
 #endif /* DUMP_EGL_CONFIG */
 
-static int SDL_EGL_PrivateChooseConfig(_THIS, SDL_bool set_config_caveat_none)
+static int SDL_EGL_PrivateChooseConfig(SDL_VideoDevice *_this, SDL_bool set_config_caveat_none)
 {
     /* 64 seems nice. */
     EGLint attribs[64];
@@ -925,7 +925,7 @@ static int SDL_EGL_PrivateChooseConfig(_THIS, SDL_bool set_config_caveat_none)
     return 0;
 }
 
-int SDL_EGL_ChooseConfig(_THIS)
+int SDL_EGL_ChooseConfig(SDL_VideoDevice *_this)
 {
     int ret;
 
@@ -950,7 +950,7 @@ int SDL_EGL_ChooseConfig(_THIS)
 }
 
 SDL_GLContext
-SDL_EGL_CreateContext(_THIS, EGLSurface egl_surface)
+SDL_EGL_CreateContext(SDL_VideoDevice *_this, EGLSurface egl_surface)
 {
     /* max 16 key+value pairs plus terminator. */
     EGLint attribs[33];
@@ -1123,7 +1123,7 @@ SDL_EGL_CreateContext(_THIS, EGLSurface egl_surface)
     return (SDL_GLContext)egl_context;
 }
 
-int SDL_EGL_MakeCurrent(_THIS, EGLSurface egl_surface, SDL_GLContext context)
+int SDL_EGL_MakeCurrent(SDL_VideoDevice *_this, EGLSurface egl_surface, SDL_GLContext context)
 {
     EGLContext egl_context = (EGLContext)context;
 
@@ -1160,7 +1160,7 @@ int SDL_EGL_MakeCurrent(_THIS, EGLSurface egl_surface, SDL_GLContext context)
     return 0;
 }
 
-int SDL_EGL_SetSwapInterval(_THIS, int interval)
+int SDL_EGL_SetSwapInterval(SDL_VideoDevice *_this, int interval)
 {
     EGLBoolean status;
 
@@ -1184,7 +1184,7 @@ int SDL_EGL_SetSwapInterval(_THIS, int interval)
     return SDL_EGL_SetError("Unable to set the EGL swap interval", "eglSwapInterval");
 }
 
-int SDL_EGL_GetSwapInterval(_THIS, int *interval)
+int SDL_EGL_GetSwapInterval(SDL_VideoDevice *_this, int *interval)
 {
     if (!_this->egl_data) {
         return SDL_SetError("EGL not initialized");
@@ -1194,7 +1194,7 @@ int SDL_EGL_GetSwapInterval(_THIS, int *interval)
     return 0;
 }
 
-int SDL_EGL_SwapBuffers(_THIS, EGLSurface egl_surface)
+int SDL_EGL_SwapBuffers(SDL_VideoDevice *_this, EGLSurface egl_surface)
 {
     if (!_this->egl_data->eglSwapBuffers(_this->egl_data->egl_display, egl_surface)) {
         return SDL_EGL_SetError("unable to show color buffer in an OS-native window", "eglSwapBuffers");
@@ -1202,7 +1202,7 @@ int SDL_EGL_SwapBuffers(_THIS, EGLSurface egl_surface)
     return 0;
 }
 
-int SDL_EGL_DeleteContext(_THIS, SDL_GLContext context)
+int SDL_EGL_DeleteContext(SDL_VideoDevice *_this, SDL_GLContext context)
 {
     EGLContext egl_context = (EGLContext)context;
 
@@ -1218,7 +1218,7 @@ int SDL_EGL_DeleteContext(_THIS, SDL_GLContext context)
 }
 
 EGLSurface *
-SDL_EGL_CreateSurface(_THIS, SDL_Window *window, NativeWindowType nw)
+SDL_EGL_CreateSurface(SDL_VideoDevice *_this, SDL_Window *window, NativeWindowType nw)
 {
 #ifdef SDL_VIDEO_DRIVER_ANDROID
     EGLint format_wanted;
@@ -1311,7 +1311,7 @@ SDL_EGL_CreateSurface(_THIS, SDL_Window *window, NativeWindowType nw)
 }
 
 EGLSurface
-SDL_EGL_CreateOffscreenSurface(_THIS, int width, int height)
+SDL_EGL_CreateOffscreenSurface(SDL_VideoDevice *_this, int width, int height)
 {
     EGLint attributes[] = {
         EGL_WIDTH, 0,
@@ -1331,7 +1331,7 @@ SDL_EGL_CreateOffscreenSurface(_THIS, int width, int height)
         attributes);
 }
 
-void SDL_EGL_DestroySurface(_THIS, EGLSurface egl_surface)
+void SDL_EGL_DestroySurface(SDL_VideoDevice *_this, EGLSurface egl_surface)
 {
     if (!_this->egl_data) {
         return;

+ 22 - 22
src/video/SDL_egl_c.h

@@ -114,32 +114,32 @@ typedef enum SDL_EGL_ExtensionType
     SDL_EGL_CLIENT_EXTENSION
 } SDL_EGL_ExtensionType;
 
-extern SDL_bool SDL_EGL_HasExtension(_THIS, SDL_EGL_ExtensionType type, const char *ext);
+extern SDL_bool SDL_EGL_HasExtension(SDL_VideoDevice *_this, SDL_EGL_ExtensionType type, const char *ext);
 
-extern int SDL_EGL_GetAttribute(_THIS, SDL_GLattr attrib, int *value);
+extern int SDL_EGL_GetAttribute(SDL_VideoDevice *_this, SDL_GLattr attrib, int *value);
 /* SDL_EGL_LoadLibrary can get a display for a specific platform (EGL_PLATFORM_*)
  * or, if 0 is passed, let the implementation decide.
  */
-extern int SDL_EGL_LoadLibraryOnly(_THIS, const char *path);
-extern int SDL_EGL_LoadLibrary(_THIS, const char *path, NativeDisplayType native_display, EGLenum platform);
-extern SDL_FunctionPointer SDL_EGL_GetProcAddressInternal(_THIS, const char *proc);
-extern void SDL_EGL_UnloadLibrary(_THIS);
-extern void SDL_EGL_SetRequiredVisualId(_THIS, int visual_id);
-extern int SDL_EGL_ChooseConfig(_THIS);
-extern int SDL_EGL_SetSwapInterval(_THIS, int interval);
-extern int SDL_EGL_GetSwapInterval(_THIS, int *interval);
-extern int SDL_EGL_DeleteContext(_THIS, SDL_GLContext context);
-extern EGLSurface *SDL_EGL_CreateSurface(_THIS, SDL_Window *window, NativeWindowType nw);
-extern void SDL_EGL_DestroySurface(_THIS, EGLSurface egl_surface);
-
-extern EGLSurface SDL_EGL_CreateOffscreenSurface(_THIS, int width, int height);
+extern int SDL_EGL_LoadLibraryOnly(SDL_VideoDevice *_this, const char *path);
+extern int SDL_EGL_LoadLibrary(SDL_VideoDevice *_this, const char *path, NativeDisplayType native_display, EGLenum platform);
+extern SDL_FunctionPointer SDL_EGL_GetProcAddressInternal(SDL_VideoDevice *_this, const char *proc);
+extern void SDL_EGL_UnloadLibrary(SDL_VideoDevice *_this);
+extern void SDL_EGL_SetRequiredVisualId(SDL_VideoDevice *_this, int visual_id);
+extern int SDL_EGL_ChooseConfig(SDL_VideoDevice *_this);
+extern int SDL_EGL_SetSwapInterval(SDL_VideoDevice *_this, int interval);
+extern int SDL_EGL_GetSwapInterval(SDL_VideoDevice *_this, int *interval);
+extern int SDL_EGL_DeleteContext(SDL_VideoDevice *_this, SDL_GLContext context);
+extern EGLSurface *SDL_EGL_CreateSurface(SDL_VideoDevice *_this, SDL_Window *window, NativeWindowType nw);
+extern void SDL_EGL_DestroySurface(SDL_VideoDevice *_this, EGLSurface egl_surface);
+
+extern EGLSurface SDL_EGL_CreateOffscreenSurface(SDL_VideoDevice *_this, int width, int height);
 /* Assumes that LoadLibraryOnly() has succeeded */
-extern int SDL_EGL_InitializeOffscreen(_THIS, int device);
+extern int SDL_EGL_InitializeOffscreen(SDL_VideoDevice *_this, int device);
 
 /* These need to be wrapped to get the surface for the window by the platform GLES implementation */
-extern SDL_GLContext SDL_EGL_CreateContext(_THIS, EGLSurface egl_surface);
-extern int SDL_EGL_MakeCurrent(_THIS, EGLSurface egl_surface, SDL_GLContext context);
-extern int SDL_EGL_SwapBuffers(_THIS, EGLSurface egl_surface);
+extern SDL_GLContext SDL_EGL_CreateContext(SDL_VideoDevice *_this, EGLSurface egl_surface);
+extern int SDL_EGL_MakeCurrent(SDL_VideoDevice *_this, EGLSurface egl_surface, SDL_GLContext context);
+extern int SDL_EGL_SwapBuffers(SDL_VideoDevice *_this, EGLSurface egl_surface);
 
 /* SDL Error-reporting */
 extern int SDL_EGL_SetErrorEx(const char *message, const char *eglFunctionName, EGLint eglErrorCode);
@@ -148,19 +148,19 @@ extern int SDL_EGL_SetErrorEx(const char *message, const char *eglFunctionName,
 /* A few of useful macros */
 
 #define SDL_EGL_SwapWindow_impl(BACKEND)                                                        \
-    int BACKEND##_GLES_SwapWindow(_THIS, SDL_Window *window)                                    \
+    int BACKEND##_GLES_SwapWindow(SDL_VideoDevice *_this, SDL_Window *window)                                    \
     {                                                                                           \
         return SDL_EGL_SwapBuffers(_this, window->driverdata->egl_surface);                     \
     }
 
 #define SDL_EGL_MakeCurrent_impl(BACKEND)                                                                                          \
-    int BACKEND##_GLES_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context)                                               \
+    int BACKEND##_GLES_MakeCurrent(SDL_VideoDevice *_this, SDL_Window *window, SDL_GLContext context)                                               \
     {                                                                                                                              \
         return SDL_EGL_MakeCurrent(_this, window ? window->driverdata->egl_surface : EGL_NO_SURFACE, context); \
     }
 
 #define SDL_EGL_CreateContext_impl(BACKEND)                                                     \
-    SDL_GLContext BACKEND##_GLES_CreateContext(_THIS, SDL_Window *window)                       \
+    SDL_GLContext BACKEND##_GLES_CreateContext(SDL_VideoDevice *_this, SDL_Window *window)                       \
     {                                                                                           \
         return SDL_EGL_CreateContext(_this, window->driverdata->egl_surface);                   \
     }

+ 82 - 85
src/video/SDL_sysvideo.h

@@ -155,9 +155,6 @@ struct SDL_VideoDisplay
 /* Forward declaration */
 struct SDL_SysWMinfo;
 
-/* Define the SDL video driver structure */
-#define _THIS SDL_VideoDevice *_this
-
 /* Video device flags */
 typedef enum
 {
@@ -179,18 +176,18 @@ struct SDL_VideoDevice
      * Initialize the native video subsystem, filling in the list of
      * displays for this driver, returning 0 or -1 if there's an error.
      */
-    int (*VideoInit)(_THIS);
+    int (*VideoInit)(SDL_VideoDevice *_this);
 
     /*
      * Reverse the effects VideoInit() -- called if VideoInit() fails or
      * if the application is shutting down the video subsystem.
      */
-    void (*VideoQuit)(_THIS);
+    void (*VideoQuit)(SDL_VideoDevice *_this);
 
     /*
      * Reinitialize the touch devices -- called if an unknown touch ID occurs.
      */
-    void (*ResetTouch)(_THIS);
+    void (*ResetTouch)(SDL_VideoDevice *_this);
 
     /* * * */
     /*
@@ -200,22 +197,22 @@ struct SDL_VideoDevice
     /*
      * Refresh the display list
      */
-    void (*RefreshDisplays)(_THIS);
+    void (*RefreshDisplays)(SDL_VideoDevice *_this);
 
     /*
      * Get the bounds of a display
      */
-    int (*GetDisplayBounds)(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect);
+    int (*GetDisplayBounds)(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL_Rect *rect);
 
     /*
      * Get the usable bounds of a display (bounds minus menubar or whatever)
      */
-    int (*GetDisplayUsableBounds)(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect);
+    int (*GetDisplayUsableBounds)(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL_Rect *rect);
 
     /*
      * Get a list of the available display modes for a display.
      */
-    int (*GetDisplayModes)(_THIS, SDL_VideoDisplay *display);
+    int (*GetDisplayModes)(SDL_VideoDevice *_this, SDL_VideoDisplay *display);
 
     /*
      * Setting the display mode is independent of creating windows, so
@@ -223,46 +220,46 @@ struct SDL_VideoDevice
      * their data updated accordingly, including the display surfaces
      * associated with them.
      */
-    int (*SetDisplayMode)(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode);
+    int (*SetDisplayMode)(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL_DisplayMode *mode);
 
     /* * * */
     /*
      * Window functions
      */
-    int (*CreateSDLWindow)(_THIS, SDL_Window *window);
-    int (*CreateSDLWindowFrom)(_THIS, SDL_Window *window, const void *data);
-    void (*SetWindowTitle)(_THIS, SDL_Window *window);
-    int (*SetWindowIcon)(_THIS, SDL_Window *window, SDL_Surface *icon);
-    int (*SetWindowPosition)(_THIS, SDL_Window *window);
-    void (*SetWindowSize)(_THIS, SDL_Window *window);
-    void (*SetWindowMinimumSize)(_THIS, SDL_Window *window);
-    void (*SetWindowMaximumSize)(_THIS, SDL_Window *window);
-    int (*GetWindowBordersSize)(_THIS, SDL_Window *window, int *top, int *left, int *bottom, int *right);
-    void (*GetWindowSizeInPixels)(_THIS, SDL_Window *window, int *w, int *h);
-    int (*SetWindowOpacity)(_THIS, SDL_Window *window, float opacity);
-    int (*SetWindowModalFor)(_THIS, SDL_Window *modal_window, SDL_Window *parent_window);
-    int (*SetWindowInputFocus)(_THIS, SDL_Window *window);
-    void (*ShowWindow)(_THIS, SDL_Window *window);
-    void (*HideWindow)(_THIS, SDL_Window *window);
-    void (*RaiseWindow)(_THIS, SDL_Window *window);
-    void (*MaximizeWindow)(_THIS, SDL_Window *window);
-    void (*MinimizeWindow)(_THIS, SDL_Window *window);
-    void (*RestoreWindow)(_THIS, SDL_Window *window);
-    void (*SetWindowBordered)(_THIS, SDL_Window *window, SDL_bool bordered);
-    void (*SetWindowResizable)(_THIS, SDL_Window *window, SDL_bool resizable);
-    void (*SetWindowAlwaysOnTop)(_THIS, SDL_Window *window, SDL_bool on_top);
-    void (*SetWindowFullscreen)(_THIS, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen);
-    void *(*GetWindowICCProfile)(_THIS, SDL_Window *window, size_t *size);
-    SDL_DisplayID (*GetDisplayForWindow)(_THIS, SDL_Window *window);
-    void (*SetWindowMouseRect)(_THIS, SDL_Window *window);
-    void (*SetWindowMouseGrab)(_THIS, SDL_Window *window, SDL_bool grabbed);
-    void (*SetWindowKeyboardGrab)(_THIS, SDL_Window *window, SDL_bool grabbed);
-    void (*DestroyWindow)(_THIS, SDL_Window *window);
-    int (*CreateWindowFramebuffer)(_THIS, SDL_Window *window, Uint32 *format, void **pixels, int *pitch);
-    int (*UpdateWindowFramebuffer)(_THIS, SDL_Window *window, const SDL_Rect *rects, int numrects);
-    void (*DestroyWindowFramebuffer)(_THIS, SDL_Window *window);
-    void (*OnWindowEnter)(_THIS, SDL_Window *window);
-    int (*FlashWindow)(_THIS, SDL_Window *window, SDL_FlashOperation operation);
+    int (*CreateSDLWindow)(SDL_VideoDevice *_this, SDL_Window *window);
+    int (*CreateSDLWindowFrom)(SDL_VideoDevice *_this, SDL_Window *window, const void *data);
+    void (*SetWindowTitle)(SDL_VideoDevice *_this, SDL_Window *window);
+    int (*SetWindowIcon)(SDL_VideoDevice *_this, SDL_Window *window, SDL_Surface *icon);
+    int (*SetWindowPosition)(SDL_VideoDevice *_this, SDL_Window *window);
+    void (*SetWindowSize)(SDL_VideoDevice *_this, SDL_Window *window);
+    void (*SetWindowMinimumSize)(SDL_VideoDevice *_this, SDL_Window *window);
+    void (*SetWindowMaximumSize)(SDL_VideoDevice *_this, SDL_Window *window);
+    int (*GetWindowBordersSize)(SDL_VideoDevice *_this, SDL_Window *window, int *top, int *left, int *bottom, int *right);
+    void (*GetWindowSizeInPixels)(SDL_VideoDevice *_this, SDL_Window *window, int *w, int *h);
+    int (*SetWindowOpacity)(SDL_VideoDevice *_this, SDL_Window *window, float opacity);
+    int (*SetWindowModalFor)(SDL_VideoDevice *_this, SDL_Window *modal_window, SDL_Window *parent_window);
+    int (*SetWindowInputFocus)(SDL_VideoDevice *_this, SDL_Window *window);
+    void (*ShowWindow)(SDL_VideoDevice *_this, SDL_Window *window);
+    void (*HideWindow)(SDL_VideoDevice *_this, SDL_Window *window);
+    void (*RaiseWindow)(SDL_VideoDevice *_this, SDL_Window *window);
+    void (*MaximizeWindow)(SDL_VideoDevice *_this, SDL_Window *window);
+    void (*MinimizeWindow)(SDL_VideoDevice *_this, SDL_Window *window);
+    void (*RestoreWindow)(SDL_VideoDevice *_this, SDL_Window *window);
+    void (*SetWindowBordered)(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool bordered);
+    void (*SetWindowResizable)(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool resizable);
+    void (*SetWindowAlwaysOnTop)(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool on_top);
+    void (*SetWindowFullscreen)(SDL_VideoDevice *_this, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen);
+    void *(*GetWindowICCProfile)(SDL_VideoDevice *_this, SDL_Window *window, size_t *size);
+    SDL_DisplayID (*GetDisplayForWindow)(SDL_VideoDevice *_this, SDL_Window *window);
+    void (*SetWindowMouseRect)(SDL_VideoDevice *_this, SDL_Window *window);
+    void (*SetWindowMouseGrab)(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool grabbed);
+    void (*SetWindowKeyboardGrab)(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool grabbed);
+    void (*DestroyWindow)(SDL_VideoDevice *_this, SDL_Window *window);
+    int (*CreateWindowFramebuffer)(SDL_VideoDevice *_this, SDL_Window *window, Uint32 *format, void **pixels, int *pitch);
+    int (*UpdateWindowFramebuffer)(SDL_VideoDevice *_this, SDL_Window *window, const SDL_Rect *rects, int numrects);
+    void (*DestroyWindowFramebuffer)(SDL_VideoDevice *_this, SDL_Window *window);
+    void (*OnWindowEnter)(SDL_VideoDevice *_this, SDL_Window *window);
+    int (*FlashWindow)(SDL_VideoDevice *_this, SDL_Window *window, SDL_FlashOperation operation);
 
     /* * * */
     /*
@@ -271,75 +268,75 @@ struct SDL_VideoDevice
     SDL_ShapeDriver shape_driver;
 
     /* Get some platform dependent window information */
-    int (*GetWindowWMInfo)(_THIS, SDL_Window *window, struct SDL_SysWMinfo *info);
+    int (*GetWindowWMInfo)(SDL_VideoDevice *_this, SDL_Window *window, struct SDL_SysWMinfo *info);
 
     /* * * */
     /*
      * OpenGL support
      */
-    int (*GL_LoadLibrary)(_THIS, const char *path);
-    SDL_FunctionPointer (*GL_GetProcAddress)(_THIS, const char *proc);
-    void (*GL_UnloadLibrary)(_THIS);
-    SDL_GLContext (*GL_CreateContext)(_THIS, SDL_Window *window);
-    int (*GL_MakeCurrent)(_THIS, SDL_Window *window, SDL_GLContext context);
-    SDL_EGLSurface (*GL_GetEGLSurface)(_THIS, SDL_Window *window);
-    int (*GL_SetSwapInterval)(_THIS, int interval);
-    int (*GL_GetSwapInterval)(_THIS, int *interval);
-    int (*GL_SwapWindow)(_THIS, SDL_Window *window);
-    int (*GL_DeleteContext)(_THIS, SDL_GLContext context);
-    void (*GL_DefaultProfileConfig)(_THIS, int *mask, int *major, int *minor);
+    int (*GL_LoadLibrary)(SDL_VideoDevice *_this, const char *path);
+    SDL_FunctionPointer (*GL_GetProcAddress)(SDL_VideoDevice *_this, const char *proc);
+    void (*GL_UnloadLibrary)(SDL_VideoDevice *_this);
+    SDL_GLContext (*GL_CreateContext)(SDL_VideoDevice *_this, SDL_Window *window);
+    int (*GL_MakeCurrent)(SDL_VideoDevice *_this, SDL_Window *window, SDL_GLContext context);
+    SDL_EGLSurface (*GL_GetEGLSurface)(SDL_VideoDevice *_this, SDL_Window *window);
+    int (*GL_SetSwapInterval)(SDL_VideoDevice *_this, int interval);
+    int (*GL_GetSwapInterval)(SDL_VideoDevice *_this, int *interval);
+    int (*GL_SwapWindow)(SDL_VideoDevice *_this, SDL_Window *window);
+    int (*GL_DeleteContext)(SDL_VideoDevice *_this, SDL_GLContext context);
+    void (*GL_DefaultProfileConfig)(SDL_VideoDevice *_this, int *mask, int *major, int *minor);
 
     /* * * */
     /*
      * Vulkan support
      */
-    int (*Vulkan_LoadLibrary)(_THIS, const char *path);
-    void (*Vulkan_UnloadLibrary)(_THIS);
-    SDL_bool (*Vulkan_GetInstanceExtensions)(_THIS, unsigned *count, const char **names);
-    SDL_bool (*Vulkan_CreateSurface)(_THIS, SDL_Window *window, VkInstance instance, VkSurfaceKHR *surface);
+    int (*Vulkan_LoadLibrary)(SDL_VideoDevice *_this, const char *path);
+    void (*Vulkan_UnloadLibrary)(SDL_VideoDevice *_this);
+    SDL_bool (*Vulkan_GetInstanceExtensions)(SDL_VideoDevice *_this, unsigned *count, const char **names);
+    SDL_bool (*Vulkan_CreateSurface)(SDL_VideoDevice *_this, SDL_Window *window, VkInstance instance, VkSurfaceKHR *surface);
 
     /* * * */
     /*
      * Metal support
      */
-    SDL_MetalView (*Metal_CreateView)(_THIS, SDL_Window *window);
-    void (*Metal_DestroyView)(_THIS, SDL_MetalView view);
-    void *(*Metal_GetLayer)(_THIS, SDL_MetalView view);
+    SDL_MetalView (*Metal_CreateView)(SDL_VideoDevice *_this, SDL_Window *window);
+    void (*Metal_DestroyView)(SDL_VideoDevice *_this, SDL_MetalView view);
+    void *(*Metal_GetLayer)(SDL_VideoDevice *_this, SDL_MetalView view);
 
     /* * * */
     /*
      * Event manager functions
      */
-    int (*WaitEventTimeout)(_THIS, Sint64 timeoutNS);
-    void (*SendWakeupEvent)(_THIS, SDL_Window *window);
-    void (*PumpEvents)(_THIS);
+    int (*WaitEventTimeout)(SDL_VideoDevice *_this, Sint64 timeoutNS);
+    void (*SendWakeupEvent)(SDL_VideoDevice *_this, SDL_Window *window);
+    void (*PumpEvents)(SDL_VideoDevice *_this);
 
     /* Suspend the screensaver */
-    int (*SuspendScreenSaver)(_THIS);
+    int (*SuspendScreenSaver)(SDL_VideoDevice *_this);
 
     /* Text input */
-    void (*StartTextInput)(_THIS);
-    void (*StopTextInput)(_THIS);
-    int (*SetTextInputRect)(_THIS, const SDL_Rect *rect);
-    void (*ClearComposition)(_THIS);
-    SDL_bool (*IsTextInputShown)(_THIS);
+    void (*StartTextInput)(SDL_VideoDevice *_this);
+    void (*StopTextInput)(SDL_VideoDevice *_this);
+    int (*SetTextInputRect)(SDL_VideoDevice *_this, const SDL_Rect *rect);
+    void (*ClearComposition)(SDL_VideoDevice *_this);
+    SDL_bool (*IsTextInputShown)(SDL_VideoDevice *_this);
 
     /* Screen keyboard */
-    SDL_bool (*HasScreenKeyboardSupport)(_THIS);
-    void (*ShowScreenKeyboard)(_THIS, SDL_Window *window);
-    void (*HideScreenKeyboard)(_THIS, SDL_Window *window);
-    SDL_bool (*IsScreenKeyboardShown)(_THIS, SDL_Window *window);
+    SDL_bool (*HasScreenKeyboardSupport)(SDL_VideoDevice *_this);
+    void (*ShowScreenKeyboard)(SDL_VideoDevice *_this, SDL_Window *window);
+    void (*HideScreenKeyboard)(SDL_VideoDevice *_this, SDL_Window *window);
+    SDL_bool (*IsScreenKeyboardShown)(SDL_VideoDevice *_this, SDL_Window *window);
 
     /* Clipboard */
-    int (*SetClipboardText)(_THIS, const char *text);
-    char *(*GetClipboardText)(_THIS);
-    SDL_bool (*HasClipboardText)(_THIS);
-    int (*SetPrimarySelectionText)(_THIS, const char *text);
-    char *(*GetPrimarySelectionText)(_THIS);
-    SDL_bool (*HasPrimarySelectionText)(_THIS);
+    int (*SetClipboardText)(SDL_VideoDevice *_this, const char *text);
+    char *(*GetClipboardText)(SDL_VideoDevice *_this);
+    SDL_bool (*HasClipboardText)(SDL_VideoDevice *_this);
+    int (*SetPrimarySelectionText)(SDL_VideoDevice *_this, const char *text);
+    char *(*GetPrimarySelectionText)(SDL_VideoDevice *_this);
+    SDL_bool (*HasPrimarySelectionText)(SDL_VideoDevice *_this);
 
     /* MessageBox */
-    int (*ShowMessageBox)(_THIS, const SDL_MessageBoxData *messageboxdata, int *buttonid);
+    int (*ShowMessageBox)(SDL_VideoDevice *_this, const SDL_MessageBoxData *messageboxdata, int *buttonid);
 
     /* Hit-testing */
     int (*SetWindowHitTest)(SDL_Window *window, SDL_bool enabled);
@@ -449,7 +446,7 @@ struct SDL_VideoDevice
 
     /* * * */
     /* The function used to dispose of this structure */
-    void (*free)(_THIS);
+    void (*free)(SDL_VideoDevice *_this);
 };
 
 typedef struct VideoBootStrap

+ 2 - 2
src/video/SDL_video.c

@@ -161,7 +161,7 @@ extern SDL_bool Cocoa_SetWindowFullscreenSpace(SDL_Window *window, SDL_bool stat
 #endif
 
 /* Convenience functions for reading driver flags */
-static SDL_bool ModeSwitchingEmulated(_THIS)
+static SDL_bool ModeSwitchingEmulated(SDL_VideoDevice *_this)
 {
     if (_this->quirk_flags & VIDEO_DEVICE_QUIRK_MODE_SWITCHING_EMULATED) {
         return SDL_TRUE;
@@ -169,7 +169,7 @@ static SDL_bool ModeSwitchingEmulated(_THIS)
     return SDL_FALSE;
 }
 
-static SDL_bool DisableUnsetFullscreenOnMinimize(_THIS)
+static SDL_bool DisableUnsetFullscreenOnMinimize(SDL_VideoDevice *_this)
 {
     if (_this->quirk_flags & VIDEO_DEVICE_QUIRK_DISABLE_UNSET_FULLSCREEN_ON_MINIMIZE) {
         return SDL_TRUE;

+ 3 - 3
src/video/android/SDL_androidclipboard.c

@@ -26,18 +26,18 @@
 #include "SDL_androidclipboard.h"
 #include "../../core/android/SDL_android.h"
 
-int Android_SetClipboardText(_THIS, const char *text)
+int Android_SetClipboardText(SDL_VideoDevice *_this, const char *text)
 {
     return Android_JNI_SetClipboardText(text);
 }
 
 char *
-Android_GetClipboardText(_THIS)
+Android_GetClipboardText(SDL_VideoDevice *_this)
 {
     return Android_JNI_GetClipboardText();
 }
 
-SDL_bool Android_HasClipboardText(_THIS)
+SDL_bool Android_HasClipboardText(SDL_VideoDevice *_this)
 {
     return Android_JNI_HasClipboardText();
 }

+ 3 - 3
src/video/android/SDL_androidclipboard.h

@@ -23,8 +23,8 @@
 #ifndef SDL_androidclipboard_h_
 #define SDL_androidclipboard_h_
 
-extern int Android_SetClipboardText(_THIS, const char *text);
-extern char *Android_GetClipboardText(_THIS);
-extern SDL_bool Android_HasClipboardText(_THIS);
+extern int Android_SetClipboardText(SDL_VideoDevice *_this, const char *text);
+extern char *Android_GetClipboardText(SDL_VideoDevice *_this);
+extern SDL_bool Android_HasClipboardText(SDL_VideoDevice *_this);
 
 #endif /* SDL_androidclipboard_h_ */

+ 2 - 2
src/video/android/SDL_androidevents.c

@@ -118,7 +118,7 @@ static void android_egl_context_backup(SDL_Window *window)
  * No polling necessary
  */
 
-void Android_PumpEvents_Blocking(_THIS)
+void Android_PumpEvents_Blocking(SDL_VideoDevice *_this)
 {
     SDL_VideoData *videodata = _this->driverdata;
 
@@ -193,7 +193,7 @@ void Android_PumpEvents_Blocking(_THIS)
     }
 }
 
-void Android_PumpEvents_NonBlocking(_THIS)
+void Android_PumpEvents_NonBlocking(SDL_VideoDevice *_this)
 {
     SDL_VideoData *videodata = _this->driverdata;
     static int backup_context = 0;

+ 2 - 2
src/video/android/SDL_androidevents.h

@@ -22,5 +22,5 @@
 
 #include "SDL_androidvideo.h"
 
-extern void Android_PumpEvents_Blocking(_THIS);
-extern void Android_PumpEvents_NonBlocking(_THIS);
+extern void Android_PumpEvents_Blocking(SDL_VideoDevice *_this);
+extern void Android_PumpEvents_NonBlocking(SDL_VideoDevice *_this);

+ 4 - 4
src/video/android/SDL_androidgl.c

@@ -35,7 +35,7 @@
 
 #include <dlfcn.h>
 
-int Android_GLES_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context)
+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);
@@ -45,7 +45,7 @@ int Android_GLES_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context)
 }
 
 SDL_GLContext
-Android_GLES_CreateContext(_THIS, SDL_Window *window)
+Android_GLES_CreateContext(SDL_VideoDevice *_this, SDL_Window *window)
 {
     SDL_GLContext ret;
 
@@ -58,7 +58,7 @@ Android_GLES_CreateContext(_THIS, SDL_Window *window)
     return ret;
 }
 
-int Android_GLES_SwapWindow(_THIS, SDL_Window *window)
+int Android_GLES_SwapWindow(SDL_VideoDevice *_this, SDL_Window *window)
 {
     int retval;
 
@@ -78,7 +78,7 @@ int Android_GLES_SwapWindow(_THIS, SDL_Window *window)
     return retval;
 }
 
-int Android_GLES_LoadLibrary(_THIS, const char *path)
+int Android_GLES_LoadLibrary(SDL_VideoDevice *_this, const char *path)
 {
     return SDL_EGL_LoadLibrary(_this, path, (NativeDisplayType)0, 0);
 }

+ 4 - 4
src/video/android/SDL_androidgl.h

@@ -23,9 +23,9 @@
 #ifndef SDL_androidgl_h_
 #define SDL_androidgl_h_
 
-SDL_GLContext Android_GLES_CreateContext(_THIS, SDL_Window *window);
-int Android_GLES_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context);
-int Android_GLES_SwapWindow(_THIS, SDL_Window *window);
-int Android_GLES_LoadLibrary(_THIS, const char *path);
+SDL_GLContext Android_GLES_CreateContext(SDL_VideoDevice *_this, SDL_Window *window);
+int Android_GLES_MakeCurrent(SDL_VideoDevice *_this, SDL_Window *window, SDL_GLContext context);
+int Android_GLES_SwapWindow(SDL_VideoDevice *_this, SDL_Window *window);
+int Android_GLES_LoadLibrary(SDL_VideoDevice *_this, const char *path);
 
 #endif /* SDL_androidgl_h_ */

+ 5 - 5
src/video/android/SDL_androidkeyboard.c

@@ -337,29 +337,29 @@ int Android_OnKeyUp(int keycode)
 }
 
 SDL_bool
-Android_HasScreenKeyboardSupport(_THIS)
+Android_HasScreenKeyboardSupport(SDL_VideoDevice *_this)
 {
     return SDL_TRUE;
 }
 
 SDL_bool
-Android_IsScreenKeyboardShown(_THIS, SDL_Window *window)
+Android_IsScreenKeyboardShown(SDL_VideoDevice *_this, SDL_Window *window)
 {
     return Android_JNI_IsScreenKeyboardShown();
 }
 
-void Android_StartTextInput(_THIS)
+void Android_StartTextInput(SDL_VideoDevice *_this)
 {
     SDL_VideoData *videodata = _this->driverdata;
     Android_JNI_ShowTextInput(&videodata->textRect);
 }
 
-void Android_StopTextInput(_THIS)
+void Android_StopTextInput(SDL_VideoDevice *_this)
 {
     Android_JNI_HideTextInput();
 }
 
-int Android_SetTextInputRect(_THIS, const SDL_Rect *rect)
+int Android_SetTextInputRect(SDL_VideoDevice *_this, const SDL_Rect *rect)
 {
     SDL_VideoData *videodata = _this->driverdata;
     videodata->textRect = *rect;

+ 5 - 5
src/video/android/SDL_androidkeyboard.h

@@ -25,9 +25,9 @@
 extern int Android_OnKeyDown(int keycode);
 extern int Android_OnKeyUp(int keycode);
 
-extern SDL_bool Android_HasScreenKeyboardSupport(_THIS);
-extern SDL_bool Android_IsScreenKeyboardShown(_THIS, SDL_Window *window);
+extern SDL_bool Android_HasScreenKeyboardSupport(SDL_VideoDevice *_this);
+extern SDL_bool Android_IsScreenKeyboardShown(SDL_VideoDevice *_this, SDL_Window *window);
 
-extern void Android_StartTextInput(_THIS);
-extern void Android_StopTextInput(_THIS);
-extern int Android_SetTextInputRect(_THIS, const SDL_Rect *rect);
+extern void Android_StartTextInput(SDL_VideoDevice *_this);
+extern void Android_StopTextInput(SDL_VideoDevice *_this);
+extern int Android_SetTextInputRect(SDL_VideoDevice *_this, const SDL_Rect *rect);

+ 5 - 5
src/video/android/SDL_androidvideo.c

@@ -42,8 +42,8 @@
 #define ANDROID_VID_DRIVER_NAME "Android"
 
 /* Initialization/Query functions */
-static int Android_VideoInit(_THIS);
-static void Android_VideoQuit(_THIS);
+static int Android_VideoInit(SDL_VideoDevice *_this);
+static void Android_VideoQuit(SDL_VideoDevice *_this);
 
 #include "../SDL_egl_c.h"
 #define Android_GLES_GetProcAddress  SDL_EGL_GetProcAddressInternal
@@ -67,7 +67,7 @@ SDL_Semaphore *Android_ResumeSem = NULL;
 SDL_Mutex *Android_ActivityMutex = NULL;
 static SDL_SystemTheme Android_SystemTheme;
 
-static int Android_SuspendScreenSaver(_THIS)
+static int Android_SuspendScreenSaver(SDL_VideoDevice *_this)
 {
     return Android_JNI_SuspendScreenSaver(_this->suspend_screensaver);
 }
@@ -166,7 +166,7 @@ VideoBootStrap Android_bootstrap = {
     Android_CreateDevice
 };
 
-int Android_VideoInit(_THIS)
+int Android_VideoInit(SDL_VideoDevice *_this)
 {
     SDL_VideoData *videodata = _this->driverdata;
     SDL_DisplayID displayID;
@@ -200,7 +200,7 @@ int Android_VideoInit(_THIS)
     return 0;
 }
 
-void Android_VideoQuit(_THIS)
+void Android_VideoQuit(SDL_VideoDevice *_this)
 {
     Android_QuitMouse();
     Android_QuitTouch();

+ 4 - 4
src/video/android/SDL_androidvulkan.c

@@ -35,7 +35,7 @@
 
 #include <SDL3/SDL_syswm.h>
 
-int Android_Vulkan_LoadLibrary(_THIS, const char *path)
+int Android_Vulkan_LoadLibrary(SDL_VideoDevice *_this, const char *path)
 {
     VkExtensionProperties *extensions = NULL;
     Uint32 i, extensionCount = 0;
@@ -101,7 +101,7 @@ fail:
     return -1;
 }
 
-void Android_Vulkan_UnloadLibrary(_THIS)
+void Android_Vulkan_UnloadLibrary(SDL_VideoDevice *_this)
 {
     if (_this->vulkan_config.loader_handle) {
         SDL_UnloadObject(_this->vulkan_config.loader_handle);
@@ -109,7 +109,7 @@ void Android_Vulkan_UnloadLibrary(_THIS)
     }
 }
 
-SDL_bool Android_Vulkan_GetInstanceExtensions(_THIS,
+SDL_bool Android_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this,
                                               unsigned *count,
                                               const char **names)
 {
@@ -125,7 +125,7 @@ SDL_bool Android_Vulkan_GetInstanceExtensions(_THIS,
         extensionsForAndroid);
 }
 
-SDL_bool Android_Vulkan_CreateSurface(_THIS,
+SDL_bool Android_Vulkan_CreateSurface(SDL_VideoDevice *_this,
                                       SDL_Window *window,
                                       VkInstance instance,
                                       VkSurfaceKHR *surface)

+ 4 - 4
src/video/android/SDL_androidvulkan.h

@@ -34,12 +34,12 @@
 
 #if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_ANDROID)
 
-int Android_Vulkan_LoadLibrary(_THIS, const char *path);
-void Android_Vulkan_UnloadLibrary(_THIS);
-SDL_bool Android_Vulkan_GetInstanceExtensions(_THIS,
+int Android_Vulkan_LoadLibrary(SDL_VideoDevice *_this, const char *path);
+void Android_Vulkan_UnloadLibrary(SDL_VideoDevice *_this);
+SDL_bool Android_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this,
                                               unsigned *count,
                                               const char **names);
-SDL_bool Android_Vulkan_CreateSurface(_THIS,
+SDL_bool Android_Vulkan_CreateSurface(SDL_VideoDevice *_this,
                                       SDL_Window *window,
                                       VkInstance instance,
                                       VkSurfaceKHR *surface);

+ 7 - 7
src/video/android/SDL_androidwindow.c

@@ -36,7 +36,7 @@
 /* Currently only one window */
 SDL_Window *Android_Window = NULL;
 
-int Android_CreateWindow(_THIS, SDL_Window *window)
+int Android_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window)
 {
     SDL_WindowData *data;
     int retval = 0;
@@ -100,12 +100,12 @@ endfunction:
     return retval;
 }
 
-void Android_SetWindowTitle(_THIS, SDL_Window *window)
+void Android_SetWindowTitle(SDL_VideoDevice *_this, SDL_Window *window)
 {
     Android_JNI_SetActivityTitle(window->title);
 }
 
-void Android_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen)
+void Android_SetWindowFullscreen(SDL_VideoDevice *_this, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen)
 {
     SDL_LockMutex(Android_ActivityMutex);
 
@@ -156,18 +156,18 @@ endfunction:
     SDL_UnlockMutex(Android_ActivityMutex);
 }
 
-void Android_MinimizeWindow(_THIS, SDL_Window *window)
+void Android_MinimizeWindow(SDL_VideoDevice *_this, SDL_Window *window)
 {
     Android_JNI_MinizeWindow();
 }
 
-void Android_SetWindowResizable(_THIS, SDL_Window *window, SDL_bool resizable)
+void Android_SetWindowResizable(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool resizable)
 {
     /* Set orientation */
     Android_JNI_SetOrientation(window->w, window->h, window->flags & SDL_WINDOW_RESIZABLE, SDL_GetHint(SDL_HINT_ORIENTATIONS));
 }
 
-void Android_DestroyWindow(_THIS, SDL_Window *window)
+void Android_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
 {
     SDL_LockMutex(Android_ActivityMutex);
 
@@ -194,7 +194,7 @@ void Android_DestroyWindow(_THIS, SDL_Window *window)
     SDL_UnlockMutex(Android_ActivityMutex);
 }
 
-int Android_GetWindowWMInfo(_THIS, SDL_Window *window, SDL_SysWMinfo *info)
+int Android_GetWindowWMInfo(SDL_VideoDevice *_this, SDL_Window *window, SDL_SysWMinfo *info)
 {
     SDL_WindowData *data = window->driverdata;
 

+ 8 - 8
src/video/android/SDL_androidwindow.h

@@ -26,14 +26,14 @@
 #include "../../core/android/SDL_android.h"
 #include "../SDL_egl_c.h"
 
-extern int Android_CreateWindow(_THIS, SDL_Window *window);
-extern void Android_SetWindowTitle(_THIS, SDL_Window *window);
-extern void Android_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen);
-extern void Android_MinimizeWindow(_THIS, SDL_Window *window);
-extern void Android_SetWindowResizable(_THIS, SDL_Window *window, SDL_bool resizable);
-
-extern void Android_DestroyWindow(_THIS, SDL_Window *window);
-extern int Android_GetWindowWMInfo(_THIS, SDL_Window *window, struct SDL_SysWMinfo *info);
+extern int Android_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window);
+extern void Android_SetWindowTitle(SDL_VideoDevice *_this, SDL_Window *window);
+extern void Android_SetWindowFullscreen(SDL_VideoDevice *_this, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen);
+extern void Android_MinimizeWindow(SDL_VideoDevice *_this, SDL_Window *window);
+extern void Android_SetWindowResizable(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool resizable);
+
+extern void Android_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window);
+extern int Android_GetWindowWMInfo(SDL_VideoDevice *_this, SDL_Window *window, struct SDL_SysWMinfo *info);
 extern SDL_Window *Android_Window;
 
 struct SDL_WindowData

+ 3 - 3
src/video/cocoa/SDL_cocoaclipboard.h

@@ -26,9 +26,9 @@
 /* Forward declaration */
 @class SDL_CocoaVideoData;
 
-extern int Cocoa_SetClipboardText(_THIS, const char *text);
-extern char *Cocoa_GetClipboardText(_THIS);
-extern SDL_bool Cocoa_HasClipboardText(_THIS);
+extern int Cocoa_SetClipboardText(SDL_VideoDevice *_this, const char *text);
+extern char *Cocoa_GetClipboardText(SDL_VideoDevice *_this);
+extern SDL_bool Cocoa_HasClipboardText(SDL_VideoDevice *_this);
 extern void Cocoa_CheckClipboardUpdate(SDL_CocoaVideoData *data);
 
 #endif /* SDL_cocoaclipboard_h_ */

+ 3 - 3
src/video/cocoa/SDL_cocoaclipboard.m

@@ -25,7 +25,7 @@
 #include "SDL_cocoavideo.h"
 #include "../../events/SDL_clipboardevents_c.h"
 
-int Cocoa_SetClipboardText(_THIS, const char *text)
+int Cocoa_SetClipboardText(SDL_VideoDevice *_this, const char *text)
 {
     @autoreleasepool {
         SDL_CocoaVideoData *data = (__bridge SDL_CocoaVideoData *)_this->driverdata;
@@ -45,7 +45,7 @@ int Cocoa_SetClipboardText(_THIS, const char *text)
 }
 
 char *
-Cocoa_GetClipboardText(_THIS)
+Cocoa_GetClipboardText(SDL_VideoDevice *_this)
 {
     @autoreleasepool {
         NSPasteboard *pasteboard;
@@ -75,7 +75,7 @@ Cocoa_GetClipboardText(_THIS)
 }
 
 SDL_bool
-Cocoa_HasClipboardText(_THIS)
+Cocoa_HasClipboardText(SDL_VideoDevice *_this)
 {
     SDL_bool result = SDL_FALSE;
     char *text = Cocoa_GetClipboardText(_this);

+ 4 - 4
src/video/cocoa/SDL_cocoaevents.h

@@ -25,9 +25,9 @@
 
 extern void Cocoa_RegisterApp(void);
 extern Uint64 Cocoa_GetEventTimestamp(NSTimeInterval nsTimestamp);
-extern void Cocoa_PumpEvents(_THIS);
-extern int Cocoa_WaitEventTimeout(_THIS, Sint64 timeoutNS);
-extern void Cocoa_SendWakeupEvent(_THIS, SDL_Window *window);
-extern int Cocoa_SuspendScreenSaver(_THIS);
+extern void Cocoa_PumpEvents(SDL_VideoDevice *_this);
+extern int Cocoa_WaitEventTimeout(SDL_VideoDevice *_this, Sint64 timeoutNS);
+extern void Cocoa_SendWakeupEvent(SDL_VideoDevice *_this, SDL_Window *window);
+extern int Cocoa_SuspendScreenSaver(SDL_VideoDevice *_this);
 
 #endif /* SDL_cocoaevents_h_ */

+ 5 - 5
src/video/cocoa/SDL_cocoaevents.m

@@ -524,7 +524,7 @@ Uint64 Cocoa_GetEventTimestamp(NSTimeInterval nsTimestamp)
     return timestamp;
 }
 
-int Cocoa_PumpEventsUntilDate(_THIS, NSDate *expiration, bool accumulate)
+int Cocoa_PumpEventsUntilDate(SDL_VideoDevice *_this, NSDate *expiration, bool accumulate)
 {
     for (;;) {
         NSEvent *event = [NSApp nextEventMatchingMask:NSEventMaskAny untilDate:expiration inMode:NSDefaultRunLoopMode dequeue:YES];
@@ -545,7 +545,7 @@ int Cocoa_PumpEventsUntilDate(_THIS, NSDate *expiration, bool accumulate)
     return 1;
 }
 
-int Cocoa_WaitEventTimeout(_THIS, Sint64 timeoutNS)
+int Cocoa_WaitEventTimeout(SDL_VideoDevice *_this, Sint64 timeoutNS)
 {
     @autoreleasepool {
         if (timeoutNS > 0) {
@@ -561,14 +561,14 @@ int Cocoa_WaitEventTimeout(_THIS, Sint64 timeoutNS)
     }
 }
 
-void Cocoa_PumpEvents(_THIS)
+void Cocoa_PumpEvents(SDL_VideoDevice *_this)
 {
     @autoreleasepool {
         Cocoa_PumpEventsUntilDate(_this, [NSDate distantPast], true);
     }
 }
 
-void Cocoa_SendWakeupEvent(_THIS, SDL_Window *window)
+void Cocoa_SendWakeupEvent(SDL_VideoDevice *_this, SDL_Window *window)
 {
     @autoreleasepool {
         NSEvent *event = [NSEvent otherEventWithType:NSEventTypeApplicationDefined
@@ -585,7 +585,7 @@ void Cocoa_SendWakeupEvent(_THIS, SDL_Window *window)
     }
 }
 
-int Cocoa_SuspendScreenSaver(_THIS)
+int Cocoa_SuspendScreenSaver(SDL_VideoDevice *_this)
 {
     @autoreleasepool {
         SDL_CocoaVideoData *data = (__bridge SDL_CocoaVideoData *)_this->driverdata;

+ 7 - 7
src/video/cocoa/SDL_cocoakeyboard.h

@@ -23,14 +23,14 @@
 #ifndef SDL_cocoakeyboard_h_
 #define SDL_cocoakeyboard_h_
 
-extern void Cocoa_InitKeyboard(_THIS);
-extern void Cocoa_HandleKeyEvent(_THIS, NSEvent *event);
-extern void Cocoa_QuitKeyboard(_THIS);
+extern void Cocoa_InitKeyboard(SDL_VideoDevice *_this);
+extern void Cocoa_HandleKeyEvent(SDL_VideoDevice *_this, NSEvent *event);
+extern void Cocoa_QuitKeyboard(SDL_VideoDevice *_this);
 
-extern void Cocoa_StartTextInput(_THIS);
-extern void Cocoa_StopTextInput(_THIS);
-extern int Cocoa_SetTextInputRect(_THIS, const SDL_Rect *rect);
+extern void Cocoa_StartTextInput(SDL_VideoDevice *_this);
+extern void Cocoa_StopTextInput(SDL_VideoDevice *_this);
+extern int Cocoa_SetTextInputRect(SDL_VideoDevice *_this, const SDL_Rect *rect);
 
-extern void Cocoa_SetWindowKeyboardGrab(_THIS, SDL_Window *window, SDL_bool grabbed);
+extern void Cocoa_SetWindowKeyboardGrab(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool grabbed);
 
 #endif /* SDL_cocoakeyboard_h_ */

+ 8 - 8
src/video/cocoa/SDL_cocoakeyboard.m

@@ -198,7 +198,7 @@ static bool IsModifierKeyPressed(unsigned int flags,
     return target_pressed;
 }
 
-static void HandleModifiers(_THIS, SDL_Scancode code, unsigned int modifierFlags)
+static void HandleModifiers(SDL_VideoDevice *_this, SDL_Scancode code, unsigned int modifierFlags)
 {
     bool pressed = false;
 
@@ -312,7 +312,7 @@ cleanup:
     CFRelease(key_layout);
 }
 
-void Cocoa_InitKeyboard(_THIS)
+void Cocoa_InitKeyboard(SDL_VideoDevice *_this)
 {
     SDL_CocoaVideoData *data = (__bridge SDL_CocoaVideoData *)_this->driverdata;
 
@@ -330,7 +330,7 @@ void Cocoa_InitKeyboard(_THIS)
     SDL_ToggleModState(SDL_KMOD_CAPS, (data.modifierFlags & NSEventModifierFlagCapsLock) ? SDL_TRUE : SDL_FALSE);
 }
 
-void Cocoa_StartTextInput(_THIS)
+void Cocoa_StartTextInput(SDL_VideoDevice *_this)
 {
     @autoreleasepool {
         NSView *parentView;
@@ -362,7 +362,7 @@ void Cocoa_StartTextInput(_THIS)
     }
 }
 
-void Cocoa_StopTextInput(_THIS)
+void Cocoa_StopTextInput(SDL_VideoDevice *_this)
 {
     @autoreleasepool {
         SDL_CocoaVideoData *data = (__bridge SDL_CocoaVideoData *)_this->driverdata;
@@ -374,14 +374,14 @@ void Cocoa_StopTextInput(_THIS)
     }
 }
 
-int Cocoa_SetTextInputRect(_THIS, const SDL_Rect *rect)
+int Cocoa_SetTextInputRect(SDL_VideoDevice *_this, const SDL_Rect *rect)
 {
     SDL_CocoaVideoData *data = (__bridge SDL_CocoaVideoData *)_this->driverdata;
     [data.fieldEdit setInputRect:rect];
     return 0;
 }
 
-void Cocoa_HandleKeyEvent(_THIS, NSEvent *event)
+void Cocoa_HandleKeyEvent(SDL_VideoDevice *_this, NSEvent *event)
 {
     unsigned short scancode;
     SDL_Scancode code;
@@ -443,7 +443,7 @@ void Cocoa_HandleKeyEvent(_THIS, NSEvent *event)
     }
 }
 
-void Cocoa_QuitKeyboard(_THIS)
+void Cocoa_QuitKeyboard(SDL_VideoDevice *_this)
 {
 }
 
@@ -457,7 +457,7 @@ typedef enum
 extern CGSConnection _CGSDefaultConnection(void);
 extern CGError CGSSetGlobalHotKeyOperatingMode(CGSConnection connection, CGSGlobalHotKeyOperatingMode mode);
 
-void Cocoa_SetWindowKeyboardGrab(_THIS, SDL_Window *window, SDL_bool grabbed)
+void Cocoa_SetWindowKeyboardGrab(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool grabbed)
 {
 #ifdef SDL_MAC_NO_SANDBOX
     CGSSetGlobalHotKeyOperatingMode(_CGSDefaultConnection(), grabbed ? CGSGlobalHotKeyDisable : CGSGlobalHotKeyEnable);

+ 3 - 3
src/video/cocoa/SDL_cocoametalview.h

@@ -57,9 +57,9 @@
 
 @end
 
-SDL_MetalView Cocoa_Metal_CreateView(_THIS, SDL_Window *window);
-void Cocoa_Metal_DestroyView(_THIS, SDL_MetalView view);
-void *Cocoa_Metal_GetLayer(_THIS, SDL_MetalView view);
+SDL_MetalView Cocoa_Metal_CreateView(SDL_VideoDevice *_this, SDL_Window *window);
+void Cocoa_Metal_DestroyView(SDL_VideoDevice *_this, SDL_MetalView view);
+void *Cocoa_Metal_GetLayer(SDL_VideoDevice *_this, SDL_MetalView view);
 
 #endif /* SDL_VIDEO_DRIVER_COCOA && (SDL_VIDEO_VULKAN || SDL_VIDEO_METAL) */
 

+ 3 - 3
src/video/cocoa/SDL_cocoametalview.m

@@ -133,7 +133,7 @@ static int SDLCALL SDL_MetalViewEventWatch(void *userdata, SDL_Event *event)
 @end
 
 SDL_MetalView
-Cocoa_Metal_CreateView(_THIS, SDL_Window *window)
+Cocoa_Metal_CreateView(SDL_VideoDevice *_this, SDL_Window *window)
 {
     @autoreleasepool {
         SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->driverdata;
@@ -164,7 +164,7 @@ Cocoa_Metal_CreateView(_THIS, SDL_Window *window)
     }
 }
 
-void Cocoa_Metal_DestroyView(_THIS, SDL_MetalView view)
+void Cocoa_Metal_DestroyView(SDL_VideoDevice *_this, SDL_MetalView view)
 {
     @autoreleasepool {
         SDL_cocoametalview *metalview = CFBridgingRelease(view);
@@ -173,7 +173,7 @@ void Cocoa_Metal_DestroyView(_THIS, SDL_MetalView view)
 }
 
 void *
-Cocoa_Metal_GetLayer(_THIS, SDL_MetalView view)
+Cocoa_Metal_GetLayer(SDL_VideoDevice *_this, SDL_MetalView view)
 {
     @autoreleasepool {
         SDL_cocoametalview *cocoaview = (__bridge SDL_cocoametalview *)view;

+ 6 - 6
src/video/cocoa/SDL_cocoamodes.h

@@ -33,11 +33,11 @@ struct SDL_DisplayModeData
     CFMutableArrayRef modes;
 };
 
-extern void Cocoa_InitModes(_THIS);
-extern int Cocoa_GetDisplayBounds(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect);
-extern int Cocoa_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect);
-extern int Cocoa_GetDisplayModes(_THIS, SDL_VideoDisplay *display);
-extern int Cocoa_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode);
-extern void Cocoa_QuitModes(_THIS);
+extern void Cocoa_InitModes(SDL_VideoDevice *_this);
+extern int Cocoa_GetDisplayBounds(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL_Rect *rect);
+extern int Cocoa_GetDisplayUsableBounds(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL_Rect *rect);
+extern int Cocoa_GetDisplayModes(SDL_VideoDevice *_this, SDL_VideoDisplay *display);
+extern int Cocoa_SetDisplayMode(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL_DisplayMode *mode);
+extern void Cocoa_QuitModes(SDL_VideoDevice *_this);
 
 #endif /* SDL_cocoamodes_h_ */

+ 7 - 7
src/video/cocoa/SDL_cocoamodes.m

@@ -139,7 +139,7 @@ static Uint32 GetDisplayModePixelFormat(CGDisplayModeRef vidmode)
     return pixelformat;
 }
 
-static SDL_bool GetDisplayMode(_THIS, CGDisplayModeRef vidmode, SDL_bool vidmodeCurrent, CFArrayRef modelist, CVDisplayLinkRef link, SDL_DisplayMode *mode)
+static SDL_bool GetDisplayMode(SDL_VideoDevice *_this, CGDisplayModeRef vidmode, SDL_bool vidmodeCurrent, CFArrayRef modelist, CVDisplayLinkRef link, SDL_DisplayMode *mode)
 {
     SDL_DisplayModeData *data;
     bool usableForGUI = CGDisplayModeIsUsableForDesktopGUI(vidmode);
@@ -277,7 +277,7 @@ static const char *Cocoa_GetDisplayName(CGDirectDisplayID displayID)
     return displayName;
 }
 
-void Cocoa_InitModes(_THIS)
+void Cocoa_InitModes(SDL_VideoDevice *_this)
 {
     @autoreleasepool {
         CGDisplayErr result;
@@ -361,7 +361,7 @@ void Cocoa_InitModes(_THIS)
     }
 }
 
-int Cocoa_GetDisplayBounds(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect)
+int Cocoa_GetDisplayBounds(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL_Rect *rect)
 {
     SDL_DisplayData *displaydata = (SDL_DisplayData *)display->driverdata;
     CGRect cgrect;
@@ -374,7 +374,7 @@ int Cocoa_GetDisplayBounds(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect)
     return 0;
 }
 
-int Cocoa_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect)
+int Cocoa_GetDisplayUsableBounds(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL_Rect *rect)
 {
     SDL_DisplayData *displaydata = (SDL_DisplayData *)display->driverdata;
     const CGDirectDisplayID cgdisplay = displaydata->display;
@@ -406,7 +406,7 @@ int Cocoa_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay *display, SDL_Rect *rec
     return 0;
 }
 
-int Cocoa_GetDisplayModes(_THIS, SDL_VideoDisplay *display)
+int Cocoa_GetDisplayModes(SDL_VideoDevice *_this, SDL_VideoDisplay *display)
 {
     SDL_DisplayData *data = (SDL_DisplayData *)display->driverdata;
     CVDisplayLinkRef link = NULL;
@@ -483,7 +483,7 @@ static CGError SetDisplayModeForDisplay(CGDirectDisplayID display, SDL_DisplayMo
     return result;
 }
 
-int Cocoa_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
+int Cocoa_SetDisplayMode(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
 {
     SDL_DisplayData *displaydata = (SDL_DisplayData *)display->driverdata;
     SDL_DisplayModeData *data = (SDL_DisplayModeData *)mode->driverdata;
@@ -548,7 +548,7 @@ ERR_NO_CAPTURE:
     return -1;
 }
 
-void Cocoa_QuitModes(_THIS)
+void Cocoa_QuitModes(SDL_VideoDevice *_this)
 {
     int i, j;
 

+ 3 - 3
src/video/cocoa/SDL_cocoamouse.h

@@ -25,11 +25,11 @@
 
 #include "SDL_cocoavideo.h"
 
-extern int Cocoa_InitMouse(_THIS);
-extern void Cocoa_HandleMouseEvent(_THIS, NSEvent *event);
+extern int Cocoa_InitMouse(SDL_VideoDevice *_this);
+extern void Cocoa_HandleMouseEvent(SDL_VideoDevice *_this, NSEvent *event);
 extern void Cocoa_HandleMouseWheel(SDL_Window *window, NSEvent *event);
 extern void Cocoa_HandleMouseWarp(CGFloat x, CGFloat y);
-extern void Cocoa_QuitMouse(_THIS);
+extern void Cocoa_QuitMouse(SDL_VideoDevice *_this);
 
 typedef struct
 {

+ 4 - 4
src/video/cocoa/SDL_cocoamouse.m

@@ -362,7 +362,7 @@ static Uint32 Cocoa_GetGlobalMouseState(float *x, float *y)
     return retval;
 }
 
-int Cocoa_InitMouse(_THIS)
+int Cocoa_InitMouse(SDL_VideoDevice *_this)
 {
     NSPoint location;
     SDL_Mouse *mouse = SDL_GetMouse();
@@ -390,7 +390,7 @@ int Cocoa_InitMouse(_THIS)
     return 0;
 }
 
-static void Cocoa_HandleTitleButtonEvent(_THIS, NSEvent *event)
+static void Cocoa_HandleTitleButtonEvent(SDL_VideoDevice *_this, NSEvent *event)
 {
     SDL_Window *window;
     NSWindow *nswindow = [event window];
@@ -423,7 +423,7 @@ static void Cocoa_HandleTitleButtonEvent(_THIS, NSEvent *event)
     }
 }
 
-void Cocoa_HandleMouseEvent(_THIS, NSEvent *event)
+void Cocoa_HandleMouseEvent(SDL_VideoDevice *_this, NSEvent *event)
 {
     SDL_Mouse *mouse;
     SDL_MouseData *driverdata;
@@ -552,7 +552,7 @@ void Cocoa_HandleMouseWarp(CGFloat x, CGFloat y)
     DLog("(%g, %g)", x, y);
 }
 
-void Cocoa_QuitMouse(_THIS)
+void Cocoa_QuitMouse(SDL_VideoDevice *_this)
 {
     SDL_Mouse *mouse = SDL_GetMouse();
     if (mouse) {

+ 9 - 9
src/video/cocoa/SDL_cocoaopengl.h

@@ -69,16 +69,16 @@ struct SDL_GLDriverData
 @end
 
 /* OpenGL functions */
-extern int Cocoa_GL_LoadLibrary(_THIS, const char *path);
-extern SDL_FunctionPointer Cocoa_GL_GetProcAddress(_THIS, const char *proc);
-extern void Cocoa_GL_UnloadLibrary(_THIS);
-extern SDL_GLContext Cocoa_GL_CreateContext(_THIS, SDL_Window *window);
-extern int Cocoa_GL_MakeCurrent(_THIS, SDL_Window *window,
+extern int Cocoa_GL_LoadLibrary(SDL_VideoDevice *_this, const char *path);
+extern SDL_FunctionPointer Cocoa_GL_GetProcAddress(SDL_VideoDevice *_this, const char *proc);
+extern void Cocoa_GL_UnloadLibrary(SDL_VideoDevice *_this);
+extern SDL_GLContext Cocoa_GL_CreateContext(SDL_VideoDevice *_this, SDL_Window *window);
+extern int Cocoa_GL_MakeCurrent(SDL_VideoDevice *_this, SDL_Window *window,
                                 SDL_GLContext context);
-extern int Cocoa_GL_SetSwapInterval(_THIS, int interval);
-extern int Cocoa_GL_GetSwapInterval(_THIS, int *interval);
-extern int Cocoa_GL_SwapWindow(_THIS, SDL_Window *window);
-extern int Cocoa_GL_DeleteContext(_THIS, SDL_GLContext context);
+extern int Cocoa_GL_SetSwapInterval(SDL_VideoDevice *_this, int interval);
+extern int Cocoa_GL_GetSwapInterval(SDL_VideoDevice *_this, int *interval);
+extern int Cocoa_GL_SwapWindow(SDL_VideoDevice *_this, SDL_Window *window);
+extern int Cocoa_GL_DeleteContext(SDL_VideoDevice *_this, SDL_GLContext context);
 
 #ifdef __clang__
 #pragma clang diagnostic pop

+ 9 - 9
src/video/cocoa/SDL_cocoaopengl.m

@@ -225,7 +225,7 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt
 
 @end
 
-int Cocoa_GL_LoadLibrary(_THIS, const char *path)
+int Cocoa_GL_LoadLibrary(SDL_VideoDevice *_this, const char *path)
 {
     /* Load the OpenGL library */
     if (path == NULL) {
@@ -243,18 +243,18 @@ int Cocoa_GL_LoadLibrary(_THIS, const char *path)
     return 0;
 }
 
-SDL_FunctionPointer Cocoa_GL_GetProcAddress(_THIS, const char *proc)
+SDL_FunctionPointer Cocoa_GL_GetProcAddress(SDL_VideoDevice *_this, const char *proc)
 {
     return SDL_LoadFunction(_this->gl_config.dll_handle, proc);
 }
 
-void Cocoa_GL_UnloadLibrary(_THIS)
+void Cocoa_GL_UnloadLibrary(SDL_VideoDevice *_this)
 {
     SDL_UnloadObject(_this->gl_config.dll_handle);
     _this->gl_config.dll_handle = NULL;
 }
 
-SDL_GLContext Cocoa_GL_CreateContext(_THIS, SDL_Window *window)
+SDL_GLContext Cocoa_GL_CreateContext(SDL_VideoDevice *_this, SDL_Window *window)
 {
     @autoreleasepool {
         SDL_VideoDisplay *display = SDL_GetVideoDisplayForWindow(window);
@@ -435,7 +435,7 @@ SDL_GLContext Cocoa_GL_CreateContext(_THIS, SDL_Window *window)
     }
 }
 
-int Cocoa_GL_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context)
+int Cocoa_GL_MakeCurrent(SDL_VideoDevice *_this, SDL_Window *window, SDL_GLContext context)
 {
     @autoreleasepool {
         if (context) {
@@ -453,7 +453,7 @@ int Cocoa_GL_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context)
     }
 }
 
-int Cocoa_GL_SetSwapInterval(_THIS, int interval)
+int Cocoa_GL_SetSwapInterval(SDL_VideoDevice *_this, int interval)
 {
     @autoreleasepool {
         SDLOpenGLContext *nscontext = (__bridge SDLOpenGLContext *)SDL_GL_GetCurrentContext();
@@ -473,7 +473,7 @@ int Cocoa_GL_SetSwapInterval(_THIS, int interval)
     }
 }
 
-int Cocoa_GL_GetSwapInterval(_THIS, int *interval)
+int Cocoa_GL_GetSwapInterval(SDL_VideoDevice *_this, int *interval)
 {
     @autoreleasepool {
         SDLOpenGLContext *nscontext = (__bridge SDLOpenGLContext *)SDL_GL_GetCurrentContext();
@@ -486,7 +486,7 @@ int Cocoa_GL_GetSwapInterval(_THIS, int *interval)
     }
 }
 
-int Cocoa_GL_SwapWindow(_THIS, SDL_Window *window)
+int Cocoa_GL_SwapWindow(SDL_VideoDevice *_this, SDL_Window *window)
 {
     @autoreleasepool {
         SDLOpenGLContext *nscontext = (__bridge SDLOpenGLContext *)SDL_GL_GetCurrentContext();
@@ -523,7 +523,7 @@ int Cocoa_GL_SwapWindow(_THIS, SDL_Window *window)
     }
 }
 
-int Cocoa_GL_DeleteContext(_THIS, SDL_GLContext context)
+int Cocoa_GL_DeleteContext(SDL_VideoDevice *_this, SDL_GLContext context)
 {
     @autoreleasepool {
         SDLOpenGLContext *nscontext = (__bridge SDLOpenGLContext *)context;

+ 7 - 7
src/video/cocoa/SDL_cocoaopengles.h

@@ -35,13 +35,13 @@
 #define Cocoa_GLES_GetSwapInterval SDL_EGL_GetSwapInterval
 #define Cocoa_GLES_SetSwapInterval SDL_EGL_SetSwapInterval
 
-extern int Cocoa_GLES_LoadLibrary(_THIS, const char *path);
-extern SDL_GLContext Cocoa_GLES_CreateContext(_THIS, SDL_Window *window);
-extern int Cocoa_GLES_SwapWindow(_THIS, SDL_Window *window);
-extern int Cocoa_GLES_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context);
-extern int Cocoa_GLES_DeleteContext(_THIS, SDL_GLContext context);
-extern int Cocoa_GLES_SetupWindow(_THIS, SDL_Window *window);
-extern SDL_EGLSurface Cocoa_GLES_GetEGLSurface(_THIS, SDL_Window *window);
+extern int Cocoa_GLES_LoadLibrary(SDL_VideoDevice *_this, const char *path);
+extern SDL_GLContext Cocoa_GLES_CreateContext(SDL_VideoDevice *_this, SDL_Window *window);
+extern int Cocoa_GLES_SwapWindow(SDL_VideoDevice *_this, SDL_Window *window);
+extern int Cocoa_GLES_MakeCurrent(SDL_VideoDevice *_this, SDL_Window *window, SDL_GLContext context);
+extern int Cocoa_GLES_DeleteContext(SDL_VideoDevice *_this, SDL_GLContext context);
+extern int Cocoa_GLES_SetupWindow(SDL_VideoDevice *_this, SDL_Window *window);
+extern SDL_EGLSurface Cocoa_GLES_GetEGLSurface(SDL_VideoDevice *_this, SDL_Window *window);
 
 #endif /* SDL_VIDEO_OPENGL_EGL */
 

+ 7 - 7
src/video/cocoa/SDL_cocoaopengles.m

@@ -28,7 +28,7 @@
 
 /* EGL implementation of SDL OpenGL support */
 
-int Cocoa_GLES_LoadLibrary(_THIS, const char *path)
+int Cocoa_GLES_LoadLibrary(SDL_VideoDevice *_this, const char *path)
 {
     /* If the profile requested is not GL ES, switch over to WIN_GL functions  */
     if (_this->gl_config.profile_mask != SDL_GL_CONTEXT_PROFILE_ES) {
@@ -58,7 +58,7 @@ int Cocoa_GLES_LoadLibrary(_THIS, const char *path)
 }
 
 SDL_GLContext
-Cocoa_GLES_CreateContext(_THIS, SDL_Window *window)
+Cocoa_GLES_CreateContext(SDL_VideoDevice *_this, SDL_Window *window)
 {
     @autoreleasepool {
         SDL_GLContext context;
@@ -92,7 +92,7 @@ Cocoa_GLES_CreateContext(_THIS, SDL_Window *window)
     }
 }
 
-int Cocoa_GLES_DeleteContext(_THIS, SDL_GLContext context)
+int Cocoa_GLES_DeleteContext(SDL_VideoDevice *_this, SDL_GLContext context)
 {
     @autoreleasepool {
         SDL_EGL_DeleteContext(_this, context);
@@ -100,21 +100,21 @@ int Cocoa_GLES_DeleteContext(_THIS, SDL_GLContext context)
     return 0;
 }
 
-int Cocoa_GLES_SwapWindow(_THIS, SDL_Window *window)
+int Cocoa_GLES_SwapWindow(SDL_VideoDevice *_this, SDL_Window *window)
 {
     @autoreleasepool {
         return SDL_EGL_SwapBuffers(_this, ((__bridge SDL_CocoaWindowData *)window->driverdata).egl_surface);
     }
 }
 
-int Cocoa_GLES_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context)
+int Cocoa_GLES_MakeCurrent(SDL_VideoDevice *_this, SDL_Window *window, SDL_GLContext context)
 {
     @autoreleasepool {
         return SDL_EGL_MakeCurrent(_this, window ? ((__bridge SDL_CocoaWindowData *)window->driverdata).egl_surface : EGL_NO_SURFACE, context);
     }
 }
 
-int Cocoa_GLES_SetupWindow(_THIS, SDL_Window *window)
+int Cocoa_GLES_SetupWindow(SDL_VideoDevice *_this, SDL_Window *window)
 {
     @autoreleasepool {
         NSView *v;
@@ -148,7 +148,7 @@ int Cocoa_GLES_SetupWindow(_THIS, SDL_Window *window)
 }
 
 SDL_EGLSurface
-Cocoa_GLES_GetEGLSurface(_THIS, SDL_Window *window)
+Cocoa_GLES_GetEGLSurface(SDL_VideoDevice *_this, SDL_Window *window)
 {
     @autoreleasepool {
         return ((__bridge SDL_CocoaWindowData *)window->driverdata).egl_surface;

+ 4 - 4
src/video/cocoa/SDL_cocoavideo.m

@@ -37,8 +37,8 @@
 @end
 
 /* Initialization/Query functions */
-static int Cocoa_VideoInit(_THIS);
-static void Cocoa_VideoQuit(_THIS);
+static int Cocoa_VideoInit(SDL_VideoDevice *_this);
+static void Cocoa_VideoQuit(SDL_VideoDevice *_this);
 
 /* Cocoa driver bootstrap functions */
 
@@ -188,7 +188,7 @@ VideoBootStrap COCOA_bootstrap = {
     Cocoa_CreateDevice
 };
 
-int Cocoa_VideoInit(_THIS)
+int Cocoa_VideoInit(SDL_VideoDevice *_this)
 {
     @autoreleasepool {
         SDL_CocoaVideoData *data = (__bridge SDL_CocoaVideoData *)_this->driverdata;
@@ -211,7 +211,7 @@ int Cocoa_VideoInit(_THIS)
     }
 }
 
-void Cocoa_VideoQuit(_THIS)
+void Cocoa_VideoQuit(SDL_VideoDevice *_this)
 {
     @autoreleasepool {
         SDL_CocoaVideoData *data = (__bridge SDL_CocoaVideoData *)_this->driverdata;

+ 4 - 4
src/video/cocoa/SDL_cocoavulkan.h

@@ -34,12 +34,12 @@
 
 #if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_COCOA)
 
-int Cocoa_Vulkan_LoadLibrary(_THIS, const char *path);
-void Cocoa_Vulkan_UnloadLibrary(_THIS);
-SDL_bool Cocoa_Vulkan_GetInstanceExtensions(_THIS,
+int Cocoa_Vulkan_LoadLibrary(SDL_VideoDevice *_this, const char *path);
+void Cocoa_Vulkan_UnloadLibrary(SDL_VideoDevice *_this);
+SDL_bool Cocoa_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this,
                                             unsigned *count,
                                             const char **names);
-SDL_bool Cocoa_Vulkan_CreateSurface(_THIS,
+SDL_bool Cocoa_Vulkan_CreateSurface(SDL_VideoDevice *_this,
                                     SDL_Window *window,
                                     VkInstance instance,
                                     VkSurfaceKHR *surface);

+ 5 - 5
src/video/cocoa/SDL_cocoavulkan.m

@@ -48,7 +48,7 @@ const char *defaultPaths[] = {
 /* Since libSDL is most likely a .dylib, need RTLD_DEFAULT not RTLD_SELF. */
 #define DEFAULT_HANDLE RTLD_DEFAULT
 
-int Cocoa_Vulkan_LoadLibrary(_THIS, const char *path)
+int Cocoa_Vulkan_LoadLibrary(SDL_VideoDevice *_this, const char *path)
 {
     VkExtensionProperties *extensions = NULL;
     Uint32 extensionCount = 0;
@@ -153,7 +153,7 @@ fail:
     return -1;
 }
 
-void Cocoa_Vulkan_UnloadLibrary(_THIS)
+void Cocoa_Vulkan_UnloadLibrary(SDL_VideoDevice *_this)
 {
     if (_this->vulkan_config.loader_handle) {
         if (_this->vulkan_config.loader_handle != DEFAULT_HANDLE) {
@@ -163,7 +163,7 @@ void Cocoa_Vulkan_UnloadLibrary(_THIS)
     }
 }
 
-SDL_bool Cocoa_Vulkan_GetInstanceExtensions(_THIS,
+SDL_bool Cocoa_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this,
                                             unsigned *count,
                                             const char **names)
 {
@@ -179,7 +179,7 @@ SDL_bool Cocoa_Vulkan_GetInstanceExtensions(_THIS,
         extensionsForCocoa);
 }
 
-static SDL_bool Cocoa_Vulkan_CreateSurfaceViaMetalView(_THIS,
+static SDL_bool Cocoa_Vulkan_CreateSurfaceViaMetalView(SDL_VideoDevice *_this,
                                                        SDL_Window *window,
                                                        VkInstance instance,
                                                        VkSurfaceKHR *surface,
@@ -232,7 +232,7 @@ static SDL_bool Cocoa_Vulkan_CreateSurfaceViaMetalView(_THIS,
     return SDL_TRUE;
 }
 
-SDL_bool Cocoa_Vulkan_CreateSurface(_THIS,
+SDL_bool Cocoa_Vulkan_CreateSurface(SDL_VideoDevice *_this,
                                     SDL_Window *window,
                                     VkInstance instance,
                                     VkSurfaceKHR *surface)

+ 27 - 27
src/video/cocoa/SDL_cocoawindow.h

@@ -139,35 +139,35 @@ typedef enum
 #endif
 @end
 
-extern int Cocoa_CreateWindow(_THIS, SDL_Window *window);
-extern int Cocoa_CreateWindowFrom(_THIS, SDL_Window *window,
+extern int Cocoa_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window);
+extern int Cocoa_CreateWindowFrom(SDL_VideoDevice *_this, SDL_Window *window,
                                   const void *data);
-extern void Cocoa_SetWindowTitle(_THIS, SDL_Window *window);
-extern int Cocoa_SetWindowIcon(_THIS, SDL_Window *window, SDL_Surface *icon);
-extern int Cocoa_SetWindowPosition(_THIS, SDL_Window *window);
-extern void Cocoa_SetWindowSize(_THIS, SDL_Window *window);
-extern void Cocoa_SetWindowMinimumSize(_THIS, SDL_Window *window);
-extern void Cocoa_SetWindowMaximumSize(_THIS, SDL_Window *window);
-extern void Cocoa_GetWindowSizeInPixels(_THIS, SDL_Window *window, int *w, int *h);
-extern int Cocoa_SetWindowOpacity(_THIS, SDL_Window *window, float opacity);
-extern void Cocoa_ShowWindow(_THIS, SDL_Window *window);
-extern void Cocoa_HideWindow(_THIS, SDL_Window *window);
-extern void Cocoa_RaiseWindow(_THIS, SDL_Window *window);
-extern void Cocoa_MaximizeWindow(_THIS, SDL_Window *window);
-extern void Cocoa_MinimizeWindow(_THIS, SDL_Window *window);
-extern void Cocoa_RestoreWindow(_THIS, SDL_Window *window);
-extern void Cocoa_SetWindowBordered(_THIS, SDL_Window *window, SDL_bool bordered);
-extern void Cocoa_SetWindowResizable(_THIS, SDL_Window *window, SDL_bool resizable);
-extern void Cocoa_SetWindowAlwaysOnTop(_THIS, SDL_Window *window, SDL_bool on_top);
-extern void Cocoa_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen);
-extern void *Cocoa_GetWindowICCProfile(_THIS, SDL_Window *window, size_t *size);
-extern SDL_DisplayID Cocoa_GetDisplayForWindow(_THIS, SDL_Window *window);
-extern void Cocoa_SetWindowMouseRect(_THIS, SDL_Window *window);
-extern void Cocoa_SetWindowMouseGrab(_THIS, SDL_Window *window, SDL_bool grabbed);
-extern void Cocoa_DestroyWindow(_THIS, SDL_Window *window);
-extern int Cocoa_GetWindowWMInfo(_THIS, SDL_Window *window, struct SDL_SysWMinfo *info);
+extern void Cocoa_SetWindowTitle(SDL_VideoDevice *_this, SDL_Window *window);
+extern int Cocoa_SetWindowIcon(SDL_VideoDevice *_this, SDL_Window *window, SDL_Surface *icon);
+extern int Cocoa_SetWindowPosition(SDL_VideoDevice *_this, SDL_Window *window);
+extern void Cocoa_SetWindowSize(SDL_VideoDevice *_this, SDL_Window *window);
+extern void Cocoa_SetWindowMinimumSize(SDL_VideoDevice *_this, SDL_Window *window);
+extern void Cocoa_SetWindowMaximumSize(SDL_VideoDevice *_this, SDL_Window *window);
+extern void Cocoa_GetWindowSizeInPixels(SDL_VideoDevice *_this, SDL_Window *window, int *w, int *h);
+extern int Cocoa_SetWindowOpacity(SDL_VideoDevice *_this, SDL_Window *window, float opacity);
+extern void Cocoa_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window);
+extern void Cocoa_HideWindow(SDL_VideoDevice *_this, SDL_Window *window);
+extern void Cocoa_RaiseWindow(SDL_VideoDevice *_this, SDL_Window *window);
+extern void Cocoa_MaximizeWindow(SDL_VideoDevice *_this, SDL_Window *window);
+extern void Cocoa_MinimizeWindow(SDL_VideoDevice *_this, SDL_Window *window);
+extern void Cocoa_RestoreWindow(SDL_VideoDevice *_this, SDL_Window *window);
+extern void Cocoa_SetWindowBordered(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool bordered);
+extern void Cocoa_SetWindowResizable(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool resizable);
+extern void Cocoa_SetWindowAlwaysOnTop(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool on_top);
+extern void Cocoa_SetWindowFullscreen(SDL_VideoDevice *_this, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen);
+extern void *Cocoa_GetWindowICCProfile(SDL_VideoDevice *_this, SDL_Window *window, size_t *size);
+extern SDL_DisplayID Cocoa_GetDisplayForWindow(SDL_VideoDevice *_this, SDL_Window *window);
+extern void Cocoa_SetWindowMouseRect(SDL_VideoDevice *_this, SDL_Window *window);
+extern void Cocoa_SetWindowMouseGrab(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool grabbed);
+extern void Cocoa_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window);
+extern int Cocoa_GetWindowWMInfo(SDL_VideoDevice *_this, SDL_Window *window, struct SDL_SysWMinfo *info);
 extern int Cocoa_SetWindowHitTest(SDL_Window *window, SDL_bool enabled);
 extern void Cocoa_AcceptDragAndDrop(SDL_Window *window, SDL_bool accept);
-extern int Cocoa_FlashWindow(_THIS, SDL_Window *window, SDL_FlashOperation operation);
+extern int Cocoa_FlashWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_FlashOperation operation);
 
 #endif /* SDL_cocoawindow_h_ */

+ 28 - 28
src/video/cocoa/SDL_cocoawindow.m

@@ -1655,7 +1655,7 @@ static int Cocoa_SendMouseButtonClicks(SDL_Mouse *mouse, NSEvent *theEvent, SDL_
 
 @end
 
-static int SetupWindowData(_THIS, SDL_Window *window, NSWindow *nswindow, NSView *nsview, SDL_bool created)
+static int SetupWindowData(SDL_VideoDevice *_this, SDL_Window *window, NSWindow *nswindow, NSView *nsview, SDL_bool created)
 {
     @autoreleasepool {
         SDL_CocoaVideoData *videodata = (__bridge SDL_CocoaVideoData *)_this->driverdata;
@@ -1772,7 +1772,7 @@ static int SetupWindowData(_THIS, SDL_Window *window, NSWindow *nswindow, NSView
     }
 }
 
-int Cocoa_CreateWindow(_THIS, SDL_Window *window)
+int Cocoa_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window)
 {
     @autoreleasepool {
         SDL_CocoaVideoData *videodata = (__bridge SDL_CocoaVideoData *)_this->driverdata;
@@ -1919,7 +1919,7 @@ int Cocoa_CreateWindow(_THIS, SDL_Window *window)
     }
 }
 
-int Cocoa_CreateWindowFrom(_THIS, SDL_Window *window, const void *data)
+int Cocoa_CreateWindowFrom(SDL_VideoDevice *_this, SDL_Window *window, const void *data)
 {
     @autoreleasepool {
         NSView *nsview = nil;
@@ -1960,7 +1960,7 @@ int Cocoa_CreateWindowFrom(_THIS, SDL_Window *window, const void *data)
     }
 }
 
-void Cocoa_SetWindowTitle(_THIS, SDL_Window *window)
+void Cocoa_SetWindowTitle(SDL_VideoDevice *_this, SDL_Window *window)
 {
     @autoreleasepool {
         const char *title = window->title ? window->title : "";
@@ -1970,7 +1970,7 @@ void Cocoa_SetWindowTitle(_THIS, SDL_Window *window)
     }
 }
 
-int Cocoa_SetWindowIcon(_THIS, SDL_Window *window, SDL_Surface *icon)
+int Cocoa_SetWindowIcon(SDL_VideoDevice *_this, SDL_Window *window, SDL_Surface *icon)
 {
     @autoreleasepool {
         NSImage *nsimage = Cocoa_CreateImage(icon);
@@ -1985,7 +1985,7 @@ int Cocoa_SetWindowIcon(_THIS, SDL_Window *window, SDL_Surface *icon)
     }
 }
 
-int Cocoa_SetWindowPosition(_THIS, SDL_Window *window)
+int Cocoa_SetWindowPosition(SDL_VideoDevice *_this, SDL_Window *window)
 {
     @autoreleasepool {
         SDL_CocoaWindowData *windata = (__bridge SDL_CocoaWindowData *)window->driverdata;
@@ -2029,7 +2029,7 @@ int Cocoa_SetWindowPosition(_THIS, SDL_Window *window)
     return 0;
 }
 
-void Cocoa_SetWindowSize(_THIS, SDL_Window *window)
+void Cocoa_SetWindowSize(SDL_VideoDevice *_this, SDL_Window *window)
 {
     @autoreleasepool {
         SDL_CocoaWindowData *windata = (__bridge SDL_CocoaWindowData *)window->driverdata;
@@ -2058,7 +2058,7 @@ void Cocoa_SetWindowSize(_THIS, SDL_Window *window)
     }
 }
 
-void Cocoa_SetWindowMinimumSize(_THIS, SDL_Window *window)
+void Cocoa_SetWindowMinimumSize(SDL_VideoDevice *_this, SDL_Window *window)
 {
     @autoreleasepool {
         SDL_CocoaWindowData *windata = (__bridge SDL_CocoaWindowData *)window->driverdata;
@@ -2071,7 +2071,7 @@ void Cocoa_SetWindowMinimumSize(_THIS, SDL_Window *window)
     }
 }
 
-void Cocoa_SetWindowMaximumSize(_THIS, SDL_Window *window)
+void Cocoa_SetWindowMaximumSize(SDL_VideoDevice *_this, SDL_Window *window)
 {
     @autoreleasepool {
         SDL_CocoaWindowData *windata = (__bridge SDL_CocoaWindowData *)window->driverdata;
@@ -2084,7 +2084,7 @@ void Cocoa_SetWindowMaximumSize(_THIS, SDL_Window *window)
     }
 }
 
-void Cocoa_GetWindowSizeInPixels(_THIS, SDL_Window *window, int *w, int *h)
+void Cocoa_GetWindowSizeInPixels(SDL_VideoDevice *_this, SDL_Window *window, int *w, int *h)
 {
     @autoreleasepool {
         SDL_CocoaWindowData *windata = (__bridge SDL_CocoaWindowData *)window->driverdata;
@@ -2101,7 +2101,7 @@ void Cocoa_GetWindowSizeInPixels(_THIS, SDL_Window *window, int *w, int *h)
     }
 }
 
-void Cocoa_ShowWindow(_THIS, SDL_Window *window)
+void Cocoa_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
 {
     @autoreleasepool {
         SDL_CocoaWindowData *windowData = ((__bridge SDL_CocoaWindowData *)window->driverdata);
@@ -2115,7 +2115,7 @@ void Cocoa_ShowWindow(_THIS, SDL_Window *window)
     }
 }
 
-void Cocoa_HideWindow(_THIS, SDL_Window *window)
+void Cocoa_HideWindow(SDL_VideoDevice *_this, SDL_Window *window)
 {
     @autoreleasepool {
         NSWindow *nswindow = ((__bridge SDL_CocoaWindowData *)window->driverdata).nswindow;
@@ -2138,7 +2138,7 @@ void Cocoa_HideWindow(_THIS, SDL_Window *window)
     }
 }
 
-void Cocoa_RaiseWindow(_THIS, SDL_Window *window)
+void Cocoa_RaiseWindow(SDL_VideoDevice *_this, SDL_Window *window)
 {
     @autoreleasepool {
         SDL_CocoaWindowData *windowData = ((__bridge SDL_CocoaWindowData *)window->driverdata);
@@ -2156,7 +2156,7 @@ void Cocoa_RaiseWindow(_THIS, SDL_Window *window)
     }
 }
 
-void Cocoa_MaximizeWindow(_THIS, SDL_Window *window)
+void Cocoa_MaximizeWindow(SDL_VideoDevice *_this, SDL_Window *window)
 {
     @autoreleasepool {
         SDL_CocoaWindowData *windata = (__bridge SDL_CocoaWindowData *)window->driverdata;
@@ -2168,7 +2168,7 @@ void Cocoa_MaximizeWindow(_THIS, SDL_Window *window)
     }
 }
 
-void Cocoa_MinimizeWindow(_THIS, SDL_Window *window)
+void Cocoa_MinimizeWindow(SDL_VideoDevice *_this, SDL_Window *window)
 {
     @autoreleasepool {
         SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->driverdata;
@@ -2181,7 +2181,7 @@ void Cocoa_MinimizeWindow(_THIS, SDL_Window *window)
     }
 }
 
-void Cocoa_RestoreWindow(_THIS, SDL_Window *window)
+void Cocoa_RestoreWindow(SDL_VideoDevice *_this, SDL_Window *window)
 {
     @autoreleasepool {
         NSWindow *nswindow = ((__bridge SDL_CocoaWindowData *)window->driverdata).nswindow;
@@ -2194,7 +2194,7 @@ void Cocoa_RestoreWindow(_THIS, SDL_Window *window)
     }
 }
 
-void Cocoa_SetWindowBordered(_THIS, SDL_Window *window, SDL_bool bordered)
+void Cocoa_SetWindowBordered(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool bordered)
 {
     @autoreleasepool {
         if (SetWindowStyle(window, GetWindowStyle(window))) {
@@ -2205,7 +2205,7 @@ void Cocoa_SetWindowBordered(_THIS, SDL_Window *window, SDL_bool bordered)
     }
 }
 
-void Cocoa_SetWindowResizable(_THIS, SDL_Window *window, SDL_bool resizable)
+void Cocoa_SetWindowResizable(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool resizable)
 {
     @autoreleasepool {
         /* Don't set this if we're in a space!
@@ -2230,7 +2230,7 @@ void Cocoa_SetWindowResizable(_THIS, SDL_Window *window, SDL_bool resizable)
     }
 }
 
-void Cocoa_SetWindowAlwaysOnTop(_THIS, SDL_Window *window, SDL_bool on_top)
+void Cocoa_SetWindowAlwaysOnTop(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool on_top)
 {
     @autoreleasepool {
         NSWindow *nswindow = ((__bridge SDL_CocoaWindowData *)window->driverdata).nswindow;
@@ -2242,7 +2242,7 @@ void Cocoa_SetWindowAlwaysOnTop(_THIS, SDL_Window *window, SDL_bool on_top)
     }
 }
 
-void Cocoa_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen)
+void Cocoa_SetWindowFullscreen(SDL_VideoDevice *_this, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen)
 {
     @autoreleasepool {
         SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->driverdata;
@@ -2332,7 +2332,7 @@ void Cocoa_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *disp
 }
 
 void *
-Cocoa_GetWindowICCProfile(_THIS, SDL_Window *window, size_t *size)
+Cocoa_GetWindowICCProfile(SDL_VideoDevice *_this, SDL_Window *window, size_t *size)
 {
     @autoreleasepool {
         SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->driverdata;
@@ -2369,7 +2369,7 @@ Cocoa_GetWindowICCProfile(_THIS, SDL_Window *window, size_t *size)
     }
 }
 
-SDL_DisplayID Cocoa_GetDisplayForWindow(_THIS, SDL_Window *window)
+SDL_DisplayID Cocoa_GetDisplayForWindow(SDL_VideoDevice *_this, SDL_Window *window)
 {
     @autoreleasepool {
         NSScreen *screen;
@@ -2405,12 +2405,12 @@ SDL_DisplayID Cocoa_GetDisplayForWindow(_THIS, SDL_Window *window)
     }
 }
 
-void Cocoa_SetWindowMouseRect(_THIS, SDL_Window *window)
+void Cocoa_SetWindowMouseRect(SDL_VideoDevice *_this, SDL_Window *window)
 {
     Cocoa_UpdateClipCursor(window);
 }
 
-void Cocoa_SetWindowMouseGrab(_THIS, SDL_Window *window, SDL_bool grabbed)
+void Cocoa_SetWindowMouseGrab(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool grabbed)
 {
     @autoreleasepool {
         SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->driverdata;
@@ -2431,7 +2431,7 @@ void Cocoa_SetWindowMouseGrab(_THIS, SDL_Window *window, SDL_bool grabbed)
     }
 }
 
-void Cocoa_DestroyWindow(_THIS, SDL_Window *window)
+void Cocoa_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
 {
     @autoreleasepool {
         SDL_CocoaWindowData *data = (SDL_CocoaWindowData *)CFBridgingRelease(window->driverdata);
@@ -2474,7 +2474,7 @@ void Cocoa_DestroyWindow(_THIS, SDL_Window *window)
     }
 }
 
-int Cocoa_GetWindowWMInfo(_THIS, SDL_Window *window, SDL_SysWMinfo *info)
+int Cocoa_GetWindowWMInfo(SDL_VideoDevice *_this, SDL_Window *window, SDL_SysWMinfo *info)
 {
     @autoreleasepool {
         NSWindow *nswindow = ((__bridge SDL_CocoaWindowData *)window->driverdata).nswindow;
@@ -2562,7 +2562,7 @@ void Cocoa_AcceptDragAndDrop(SDL_Window *window, SDL_bool accept)
     }
 }
 
-int Cocoa_FlashWindow(_THIS, SDL_Window *window, SDL_FlashOperation operation)
+int Cocoa_FlashWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_FlashOperation operation)
 {
     @autoreleasepool {
         /* Note that this is app-wide and not window-specific! */
@@ -2590,7 +2590,7 @@ int Cocoa_FlashWindow(_THIS, SDL_Window *window, SDL_FlashOperation operation)
     }
 }
 
-int Cocoa_SetWindowOpacity(_THIS, SDL_Window *window, float opacity)
+int Cocoa_SetWindowOpacity(SDL_VideoDevice *_this, SDL_Window *window, float opacity)
 {
     @autoreleasepool {
         SDL_CocoaWindowData *data = (__bridge SDL_CocoaWindowData *)window->driverdata;

+ 1 - 1
src/video/dummy/SDL_nullevents.c

@@ -30,7 +30,7 @@
 #include "SDL_nullvideo.h"
 #include "SDL_nullevents_c.h"
 
-void DUMMY_PumpEvents(_THIS)
+void DUMMY_PumpEvents(SDL_VideoDevice *_this)
 {
     /* do nothing. */
 }

+ 1 - 1
src/video/dummy/SDL_nullevents_c.h

@@ -26,6 +26,6 @@
 
 #include "SDL_nullvideo.h"
 
-extern void DUMMY_PumpEvents(_THIS);
+extern void DUMMY_PumpEvents(SDL_VideoDevice *_this);
 
 #endif /* SDL_nullevents_c_h_ */

+ 3 - 3
src/video/dummy/SDL_nullframebuffer.c

@@ -27,7 +27,7 @@
 
 #define DUMMY_SURFACE "_SDL_DummySurface"
 
-int SDL_DUMMY_CreateWindowFramebuffer(_THIS, SDL_Window *window, Uint32 *format, void **pixels, int *pitch)
+int SDL_DUMMY_CreateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window, Uint32 *format, void **pixels, int *pitch)
 {
     SDL_Surface *surface;
     const Uint32 surface_format = SDL_PIXELFORMAT_RGB888;
@@ -51,7 +51,7 @@ int SDL_DUMMY_CreateWindowFramebuffer(_THIS, SDL_Window *window, Uint32 *format,
     return 0;
 }
 
-int SDL_DUMMY_UpdateWindowFramebuffer(_THIS, SDL_Window *window, const SDL_Rect *rects, int numrects)
+int SDL_DUMMY_UpdateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window, const SDL_Rect *rects, int numrects)
 {
     static int frame_number;
     SDL_Surface *surface;
@@ -71,7 +71,7 @@ int SDL_DUMMY_UpdateWindowFramebuffer(_THIS, SDL_Window *window, const SDL_Rect
     return 0;
 }
 
-void SDL_DUMMY_DestroyWindowFramebuffer(_THIS, SDL_Window *window)
+void SDL_DUMMY_DestroyWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window)
 {
     SDL_Surface *surface;
 

+ 3 - 3
src/video/dummy/SDL_nullframebuffer_c.h

@@ -24,8 +24,8 @@
 
 #include "SDL_internal.h"
 
-extern int SDL_DUMMY_CreateWindowFramebuffer(_THIS, SDL_Window *window, Uint32 *format, void **pixels, int *pitch);
-extern int SDL_DUMMY_UpdateWindowFramebuffer(_THIS, SDL_Window *window, const SDL_Rect *rects, int numrects);
-extern void SDL_DUMMY_DestroyWindowFramebuffer(_THIS, SDL_Window *window);
+extern int SDL_DUMMY_CreateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window, Uint32 *format, void **pixels, int *pitch);
+extern int SDL_DUMMY_UpdateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window, const SDL_Rect *rects, int numrects);
+extern void SDL_DUMMY_DestroyWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window);
 
 #endif /* SDL_nullframebuffer_c_h_ */

+ 8 - 8
src/video/dummy/SDL_nullvideo.c

@@ -49,13 +49,13 @@
 #define DUMMYVID_DRIVER_EVDEV_NAME "evdev"
 
 /* Initialization/Query functions */
-static int DUMMY_VideoInit(_THIS);
-static int DUMMY_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode);
-static void DUMMY_VideoQuit(_THIS);
+static int DUMMY_VideoInit(SDL_VideoDevice *_this);
+static int DUMMY_SetDisplayMode(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL_DisplayMode *mode);
+static void DUMMY_VideoQuit(SDL_VideoDevice *_this);
 
 #ifdef SDL_INPUT_LINUXEV
 static int evdev = 0;
-static void DUMMY_EVDEV_Poll(_THIS);
+static void DUMMY_EVDEV_Poll(SDL_VideoDevice *_this);
 #endif
 
 /* DUMMY driver bootstrap functions */
@@ -130,14 +130,14 @@ VideoBootStrap DUMMY_evdev_bootstrap = {
 void SDL_EVDEV_Init(void);
 void SDL_EVDEV_Poll(void);
 void SDL_EVDEV_Quit(void);
-static void DUMMY_EVDEV_Poll(_THIS)
+static void DUMMY_EVDEV_Poll(SDL_VideoDevice *_this)
 {
     (void)_this;
     SDL_EVDEV_Poll();
 }
 #endif
 
-int DUMMY_VideoInit(_THIS)
+int DUMMY_VideoInit(SDL_VideoDevice *_this)
 {
     SDL_DisplayMode mode;
 
@@ -158,12 +158,12 @@ int DUMMY_VideoInit(_THIS)
     return 0;
 }
 
-static int DUMMY_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
+static int DUMMY_SetDisplayMode(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
 {
     return 0;
 }
 
-void DUMMY_VideoQuit(_THIS)
+void DUMMY_VideoQuit(SDL_VideoDevice *_this)
 {
 #ifdef SDL_INPUT_LINUXEV
     SDL_EVDEV_Quit();

+ 3 - 3
src/video/emscripten/SDL_emscriptenframebuffer.c

@@ -27,7 +27,7 @@
 
 #include <emscripten/threading.h>
 
-int Emscripten_CreateWindowFramebuffer(_THIS, SDL_Window *window, Uint32 *format, void **pixels, int *pitch)
+int Emscripten_CreateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window, Uint32 *format, void **pixels, int *pitch)
 {
     SDL_Surface *surface;
     const Uint32 surface_format = SDL_PIXELFORMAT_BGR888;
@@ -54,7 +54,7 @@ int Emscripten_CreateWindowFramebuffer(_THIS, SDL_Window *window, Uint32 *format
     return 0;
 }
 
-int Emscripten_UpdateWindowFramebuffer(_THIS, SDL_Window *window, const SDL_Rect *rects, int numrects)
+int Emscripten_UpdateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window, const SDL_Rect *rects, int numrects)
 {
     SDL_Surface *surface;
 
@@ -150,7 +150,7 @@ int Emscripten_UpdateWindowFramebuffer(_THIS, SDL_Window *window, const SDL_Rect
     return 0;
 }
 
-void Emscripten_DestroyWindowFramebuffer(_THIS, SDL_Window *window)
+void Emscripten_DestroyWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window)
 {
     SDL_WindowData *data = window->driverdata;
 

+ 3 - 3
src/video/emscripten/SDL_emscriptenframebuffer.h

@@ -23,8 +23,8 @@
 #ifndef SDL_emscriptenframebuffer_h_
 #define SDL_emscriptenframebuffer_h_
 
-extern int Emscripten_CreateWindowFramebuffer(_THIS, SDL_Window *window, Uint32 *format, void **pixels, int *pitch);
-extern int Emscripten_UpdateWindowFramebuffer(_THIS, SDL_Window *window, const SDL_Rect *rects, int numrects);
-extern void Emscripten_DestroyWindowFramebuffer(_THIS, SDL_Window *window);
+extern int Emscripten_CreateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window, Uint32 *format, void **pixels, int *pitch);
+extern int Emscripten_UpdateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window, const SDL_Rect *rects, int numrects);
+extern void Emscripten_DestroyWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window);
 
 #endif /* SDL_emscriptenframebuffer_h_ */

+ 9 - 9
src/video/emscripten/SDL_emscriptenopengles.c

@@ -29,21 +29,21 @@
 #include "SDL_emscriptenvideo.h"
 #include "SDL_emscriptenopengles.h"
 
-int Emscripten_GLES_LoadLibrary(_THIS, const char *path)
+int Emscripten_GLES_LoadLibrary(SDL_VideoDevice *_this, const char *path)
 {
     return 0;
 }
 
-void Emscripten_GLES_UnloadLibrary(_THIS)
+void Emscripten_GLES_UnloadLibrary(SDL_VideoDevice *_this)
 {
 }
 
-SDL_FunctionPointer Emscripten_GLES_GetProcAddress(_THIS, const char *proc)
+SDL_FunctionPointer Emscripten_GLES_GetProcAddress(SDL_VideoDevice *_this, const char *proc)
 {
     return emscripten_webgl_get_proc_address(proc);
 }
 
-int Emscripten_GLES_SetSwapInterval(_THIS, int interval)
+int Emscripten_GLES_SetSwapInterval(SDL_VideoDevice *_this, int interval)
 {
     if (interval < 0) {
         return SDL_SetError("Late swap tearing currently unsupported");
@@ -56,7 +56,7 @@ int Emscripten_GLES_SetSwapInterval(_THIS, int interval)
     return 0;
 }
 
-int Emscripten_GLES_GetSwapInterval(_THIS, int *interval)
+int Emscripten_GLES_GetSwapInterval(SDL_VideoDevice *_this, int *interval)
 {
     int mode, value;
 
@@ -71,7 +71,7 @@ int Emscripten_GLES_GetSwapInterval(_THIS, int *interval)
     }
 }
 
-SDL_GLContext Emscripten_GLES_CreateContext(_THIS, SDL_Window *window)
+SDL_GLContext Emscripten_GLES_CreateContext(SDL_VideoDevice *_this, SDL_Window *window)
 {
     SDL_WindowData *window_data;
 
@@ -112,7 +112,7 @@ SDL_GLContext Emscripten_GLES_CreateContext(_THIS, SDL_Window *window)
     return (SDL_GLContext)context;
 }
 
-int Emscripten_GLES_DeleteContext(_THIS, SDL_GLContext context)
+int Emscripten_GLES_DeleteContext(SDL_VideoDevice *_this, SDL_GLContext context)
 {
     SDL_Window *window;
 
@@ -129,7 +129,7 @@ int Emscripten_GLES_DeleteContext(_THIS, SDL_GLContext context)
     return 0;
 }
 
-int Emscripten_GLES_SwapWindow(_THIS, SDL_Window *window)
+int Emscripten_GLES_SwapWindow(SDL_VideoDevice *_this, SDL_Window *window)
 {
     if (emscripten_has_asyncify() && SDL_GetHintBoolean(SDL_HINT_EMSCRIPTEN_ASYNCIFY, SDL_TRUE)) {
         /* give back control to browser for screen refresh */
@@ -138,7 +138,7 @@ int Emscripten_GLES_SwapWindow(_THIS, SDL_Window *window)
     return 0;
 }
 
-int Emscripten_GLES_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context)
+int Emscripten_GLES_MakeCurrent(SDL_VideoDevice *_this, SDL_Window *window, SDL_GLContext context)
 {
     /* it isn't possible to reuse contexts across canvases */
     if (window && context) {

+ 9 - 9
src/video/emscripten/SDL_emscriptenopengles.h

@@ -28,15 +28,15 @@
 #include "../SDL_sysvideo.h"
 
 /* OpenGLES functions */
-extern int Emscripten_GLES_LoadLibrary(_THIS, const char *path);
-extern void Emscripten_GLES_UnloadLibrary(_THIS);
-extern SDL_FunctionPointer Emscripten_GLES_GetProcAddress(_THIS, const char *proc);
-extern int Emscripten_GLES_SetSwapInterval(_THIS, int interval);
-extern int Emscripten_GLES_GetSwapInterval(_THIS, int *interval);
-extern SDL_GLContext Emscripten_GLES_CreateContext(_THIS, SDL_Window *window);
-extern int Emscripten_GLES_DeleteContext(_THIS, SDL_GLContext context);
-extern int Emscripten_GLES_SwapWindow(_THIS, SDL_Window *window);
-extern int Emscripten_GLES_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context);
+extern int Emscripten_GLES_LoadLibrary(SDL_VideoDevice *_this, const char *path);
+extern void Emscripten_GLES_UnloadLibrary(SDL_VideoDevice *_this);
+extern SDL_FunctionPointer Emscripten_GLES_GetProcAddress(SDL_VideoDevice *_this, const char *proc);
+extern int Emscripten_GLES_SetSwapInterval(SDL_VideoDevice *_this, int interval);
+extern int Emscripten_GLES_GetSwapInterval(SDL_VideoDevice *_this, int *interval);
+extern SDL_GLContext Emscripten_GLES_CreateContext(SDL_VideoDevice *_this, SDL_Window *window);
+extern int Emscripten_GLES_DeleteContext(SDL_VideoDevice *_this, SDL_GLContext context);
+extern int Emscripten_GLES_SwapWindow(SDL_VideoDevice *_this, SDL_Window *window);
+extern int Emscripten_GLES_MakeCurrent(SDL_VideoDevice *_this, SDL_Window *window, SDL_GLContext context);
 
 #endif /* SDL_VIDEO_DRIVER_EMSCRIPTEN */
 

+ 23 - 23
src/video/emscripten/SDL_emscriptenvideo.c

@@ -35,18 +35,18 @@
 #define EMSCRIPTENVID_DRIVER_NAME "emscripten"
 
 /* Initialization/Query functions */
-static int Emscripten_VideoInit(_THIS);
-static int Emscripten_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode);
-static void Emscripten_VideoQuit(_THIS);
-static int Emscripten_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect);
-
-static int Emscripten_CreateWindow(_THIS, SDL_Window *window);
-static void Emscripten_SetWindowSize(_THIS, SDL_Window *window);
-static void Emscripten_GetWindowSizeInPixels(_THIS, SDL_Window *window, int *w, int *h);
-static void Emscripten_DestroyWindow(_THIS, SDL_Window *window);
-static void Emscripten_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen);
-static void Emscripten_PumpEvents(_THIS);
-static void Emscripten_SetWindowTitle(_THIS, SDL_Window *window);
+static int Emscripten_VideoInit(SDL_VideoDevice *_this);
+static int Emscripten_SetDisplayMode(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL_DisplayMode *mode);
+static void Emscripten_VideoQuit(SDL_VideoDevice *_this);
+static int Emscripten_GetDisplayUsableBounds(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL_Rect *rect);
+
+static int Emscripten_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window);
+static void Emscripten_SetWindowSize(SDL_VideoDevice *_this, SDL_Window *window);
+static void Emscripten_GetWindowSizeInPixels(SDL_VideoDevice *_this, SDL_Window *window, int *w, int *h);
+static void Emscripten_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window);
+static void Emscripten_SetWindowFullscreen(SDL_VideoDevice *_this, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen);
+static void Emscripten_PumpEvents(SDL_VideoDevice *_this);
+static void Emscripten_SetWindowTitle(SDL_VideoDevice *_this, SDL_Window *window);
 
 /* Emscripten driver bootstrap functions */
 
@@ -120,7 +120,7 @@ VideoBootStrap Emscripten_bootstrap = {
     Emscripten_CreateDevice
 };
 
-int Emscripten_VideoInit(_THIS)
+int Emscripten_VideoInit(SDL_VideoDevice *_this)
 {
     SDL_DisplayMode mode;
 
@@ -140,18 +140,18 @@ int Emscripten_VideoInit(_THIS)
     return 0;
 }
 
-static int Emscripten_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
+static int Emscripten_SetDisplayMode(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
 {
     /* can't do this */
     return 0;
 }
 
-static void Emscripten_VideoQuit(_THIS)
+static void Emscripten_VideoQuit(SDL_VideoDevice *_this)
 {
     Emscripten_FiniMouse();
 }
 
-static int Emscripten_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect)
+static int Emscripten_GetDisplayUsableBounds(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL_Rect *rect)
 {
     if (rect) {
         rect->x = 0;
@@ -166,12 +166,12 @@ static int Emscripten_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay *display, S
     return 0;
 }
 
-static void Emscripten_PumpEvents(_THIS)
+static void Emscripten_PumpEvents(SDL_VideoDevice *_this)
 {
     /* do nothing. */
 }
 
-static int Emscripten_CreateWindow(_THIS, SDL_Window *window)
+static int Emscripten_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window)
 {
     SDL_WindowData *wdata;
     double scaled_w, scaled_h;
@@ -238,7 +238,7 @@ static int Emscripten_CreateWindow(_THIS, SDL_Window *window)
     return 0;
 }
 
-static void Emscripten_SetWindowSize(_THIS, SDL_Window *window)
+static void Emscripten_SetWindowSize(SDL_VideoDevice *_this, SDL_Window *window)
 {
     SDL_WindowData *data;
 
@@ -257,7 +257,7 @@ static void Emscripten_SetWindowSize(_THIS, SDL_Window *window)
     }
 }
 
-static void Emscripten_GetWindowSizeInPixels(_THIS, SDL_Window *window, int *w, int *h)
+static void Emscripten_GetWindowSizeInPixels(SDL_VideoDevice *_this, SDL_Window *window, int *w, int *h)
 {
     SDL_WindowData *data;
     if (window->driverdata) {
@@ -267,7 +267,7 @@ static void Emscripten_GetWindowSizeInPixels(_THIS, SDL_Window *window, int *w,
     }
 }
 
-static void Emscripten_DestroyWindow(_THIS, SDL_Window *window)
+static void Emscripten_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
 {
     SDL_WindowData *data;
 
@@ -285,7 +285,7 @@ static void Emscripten_DestroyWindow(_THIS, SDL_Window *window)
     }
 }
 
-static void Emscripten_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen)
+static void Emscripten_SetWindowFullscreen(SDL_VideoDevice *_this, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen)
 {
     SDL_WindowData *data;
     if (window->driverdata) {
@@ -324,7 +324,7 @@ static void Emscripten_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoD
     }
 }
 
-static void Emscripten_SetWindowTitle(_THIS, SDL_Window *window)
+static void Emscripten_SetWindowTitle(SDL_VideoDevice *_this, SDL_Window *window)
 {
     emscripten_set_window_title(window->title);
 }

+ 3 - 3
src/video/haiku/SDL_bclipboard.cc

@@ -34,7 +34,7 @@
 extern "C" {
 #endif
 
-int HAIKU_SetClipboardText(_THIS, const char *text) {
+int HAIKU_SetClipboardText(SDL_VideoDevice *_this, const char *text) {
     BMessage *clip = NULL;
     if (be_clipboard->Lock()) {
         be_clipboard->Clear();
@@ -50,7 +50,7 @@ int HAIKU_SetClipboardText(_THIS, const char *text) {
     return 0;
 }
 
-char *HAIKU_GetClipboardText(_THIS) {
+char *HAIKU_GetClipboardText(SDL_VideoDevice *_this) {
     BMessage *clip = NULL;
     const char *text = NULL;
     ssize_t length;
@@ -75,7 +75,7 @@ char *HAIKU_GetClipboardText(_THIS) {
     return result;
 }
 
-SDL_bool HAIKU_HasClipboardText(_THIS) {
+SDL_bool HAIKU_HasClipboardText(SDL_VideoDevice *_this) {
     SDL_bool result = SDL_FALSE;
     char *text = HAIKU_GetClipboardText(_this);
     if (text) {

+ 3 - 3
src/video/haiku/SDL_bclipboard.h

@@ -24,8 +24,8 @@
 #ifndef SDL_BCLIPBOARD_H
 #define SDL_BCLIPBOARD_H
 
-extern int HAIKU_SetClipboardText(_THIS, const char *text);
-extern char *HAIKU_GetClipboardText(_THIS);
-extern SDL_bool HAIKU_HasClipboardText(_THIS);
+extern int HAIKU_SetClipboardText(SDL_VideoDevice *_this, const char *text);
+extern char *HAIKU_GetClipboardText(SDL_VideoDevice *_this);
+extern SDL_bool HAIKU_HasClipboardText(SDL_VideoDevice *_this);
 
 #endif

+ 1 - 1
src/video/haiku/SDL_bevents.cc

@@ -28,7 +28,7 @@
 extern "C" {
 #endif
 
-void HAIKU_PumpEvents(_THIS) {
+void HAIKU_PumpEvents(SDL_VideoDevice *_this) {
     /* Since the event thread is its own thread, this isn't really necessary */
 }
 

+ 1 - 1
src/video/haiku/SDL_bevents.h

@@ -28,7 +28,7 @@
 extern "C" {
 #endif
 
-extern void HAIKU_PumpEvents(_THIS);
+extern void HAIKU_PumpEvents(SDL_VideoDevice *_this);
 
 #ifdef __cplusplus
 }

+ 3 - 3
src/video/haiku/SDL_bframebuffer.cc

@@ -43,7 +43,7 @@ static SDL_INLINE SDL_BLooper *_GetBeLooper() {
     return SDL_Looper;
 }
 
-int HAIKU_CreateWindowFramebuffer(_THIS, SDL_Window * window,
+int HAIKU_CreateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window * window,
                                        Uint32 * format,
                                        void ** pixels, int *pitch) {
     SDL_BWin *bwin = _ToBeWin(window);
@@ -92,7 +92,7 @@ int HAIKU_CreateWindowFramebuffer(_THIS, SDL_Window * window,
 
 
 
-int HAIKU_UpdateWindowFramebuffer(_THIS, SDL_Window * window,
+int HAIKU_UpdateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window * window,
                                       const SDL_Rect * rects, int numrects) {
     if (window == NULL) {
         return 0;
@@ -105,7 +105,7 @@ int HAIKU_UpdateWindowFramebuffer(_THIS, SDL_Window * window,
     return 0;
 }
 
-void HAIKU_DestroyWindowFramebuffer(_THIS, SDL_Window * window) {
+void HAIKU_DestroyWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window * window) {
     SDL_BWin *bwin = _ToBeWin(window);
 
     bwin->LockBuffer();

+ 3 - 3
src/video/haiku/SDL_bframebuffer.h

@@ -30,12 +30,12 @@ extern "C" {
 
 #include "../SDL_sysvideo.h"
 
-extern int HAIKU_CreateWindowFramebuffer(_THIS, SDL_Window *window,
+extern int HAIKU_CreateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window,
                                          Uint32 *format,
                                          void **pixels, int *pitch);
-extern int HAIKU_UpdateWindowFramebuffer(_THIS, SDL_Window *window,
+extern int HAIKU_UpdateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window,
                                          const SDL_Rect *rects, int numrects);
-extern void HAIKU_DestroyWindowFramebuffer(_THIS, SDL_Window *window);
+extern void HAIKU_DestroyWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window);
 extern int32 HAIKU_DrawThread(void *data);
 
 #ifdef __cplusplus

+ 5 - 5
src/video/haiku/SDL_bmodes.cc

@@ -201,7 +201,7 @@ static void _AddDisplay(BScreen *screen) {
  * Functions called by SDL
  */
 
-int HAIKU_InitModes(_THIS) {
+int HAIKU_InitModes(SDL_VideoDevice *_this) {
     BScreen screen;
 
     /* TODO: When Haiku supports multiple display screens, call
@@ -210,13 +210,13 @@ int HAIKU_InitModes(_THIS) {
     return 0;
 }
 
-int HAIKU_QuitModes(_THIS) {
+int HAIKU_QuitModes(SDL_VideoDevice *_this) {
     /* FIXME: Nothing really needs to be done here at the moment? */
     return 0;
 }
 
 
-int HAIKU_GetDisplayBounds(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect) {
+int HAIKU_GetDisplayBounds(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL_Rect *rect) {
     BScreen bscreen;
     BRect rc = bscreen.Frame();
     rect->x = (int)rc.left;
@@ -226,7 +226,7 @@ int HAIKU_GetDisplayBounds(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect) {
     return 0;
 }
 
-int HAIKU_GetDisplayModes(_THIS, SDL_VideoDisplay *display) {
+int HAIKU_GetDisplayModes(SDL_VideoDevice *_this, SDL_VideoDisplay *display) {
     /* Get the current screen */
     BScreen bscreen;
 
@@ -252,7 +252,7 @@ int HAIKU_GetDisplayModes(_THIS, SDL_VideoDisplay *display) {
 }
 
 
-int HAIKU_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode) {
+int HAIKU_SetDisplayMode(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL_DisplayMode *mode) {
     /* Get the current screen */
     BScreen bscreen;
     if (!bscreen.IsValid()) {

+ 5 - 5
src/video/haiku/SDL_bmodes.h

@@ -30,12 +30,12 @@ extern "C" {
 
 extern int32 HAIKU_ColorSpaceToSDLPxFormat(uint32 colorspace);
 
-extern int HAIKU_InitModes(_THIS);
-extern int HAIKU_QuitModes(_THIS);
-extern int HAIKU_GetDisplayBounds(_THIS, SDL_VideoDisplay *display,
+extern int HAIKU_InitModes(SDL_VideoDevice *_this);
+extern int HAIKU_QuitModes(SDL_VideoDevice *_this);
+extern int HAIKU_GetDisplayBounds(SDL_VideoDevice *_this, SDL_VideoDisplay *display,
                                   SDL_Rect *rect);
-extern int HAIKU_GetDisplayModes(_THIS, SDL_VideoDisplay *display);
-extern int HAIKU_SetDisplayMode(_THIS, SDL_VideoDisplay *display,
+extern int HAIKU_GetDisplayModes(SDL_VideoDevice *_this, SDL_VideoDisplay *display);
+extern int HAIKU_SetDisplayMode(SDL_VideoDevice *_this, SDL_VideoDisplay *display,
                                 SDL_DisplayMode *mode);
 
 #ifdef __cplusplus

+ 10 - 10
src/video/haiku/SDL_bopengl.cc

@@ -44,7 +44,7 @@ static SDL_INLINE SDL_BLooper *_GetBeLooper() {
 }
 
 /* Passing a NULL path means load pointers from the application */
-int HAIKU_GL_LoadLibrary(_THIS, const char *path)
+int HAIKU_GL_LoadLibrary(SDL_VideoDevice *_this, const char *path)
 {
 /* FIXME: Is this working correctly? */
     image_info info;
@@ -63,7 +63,7 @@ int HAIKU_GL_LoadLibrary(_THIS, const char *path)
     return 0;
 }
 
-SDL_FunctionPointer HAIKU_GL_GetProcAddress(_THIS, const char *proc)
+SDL_FunctionPointer HAIKU_GL_GetProcAddress(SDL_VideoDevice *_this, const char *proc)
 {
     if (_this->gl_config.dll_handle != NULL) {
         void *location = NULL;
@@ -84,12 +84,12 @@ SDL_FunctionPointer HAIKU_GL_GetProcAddress(_THIS, const char *proc)
 }
 
 
-int HAIKU_GL_SwapWindow(_THIS, SDL_Window * window) {
+int HAIKU_GL_SwapWindow(SDL_VideoDevice *_this, SDL_Window * window) {
     _ToBeWin(window)->SwapBuffers();
     return 0;
 }
 
-int HAIKU_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) {
+int HAIKU_GL_MakeCurrent(SDL_VideoDevice *_this, SDL_Window * window, SDL_GLContext context) {
     BGLView* glView = (BGLView*)context;
     // printf("HAIKU_GL_MakeCurrent(%llx), win = %llx, thread = %d\n", (uint64)context, (uint64)window, find_thread(NULL));
     if (glView != NULL) {
@@ -102,7 +102,7 @@ int HAIKU_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) {
 }
 
 
-SDL_GLContext HAIKU_GL_CreateContext(_THIS, SDL_Window * window) {
+SDL_GLContext HAIKU_GL_CreateContext(SDL_VideoDevice *_this, SDL_Window * window) {
     /* FIXME: Not sure what flags should be included here; may want to have
        most of them */
     SDL_BWin *bwin = _ToBeWin(window);
@@ -142,7 +142,7 @@ SDL_GLContext HAIKU_GL_CreateContext(_THIS, SDL_Window * window) {
     return (SDL_GLContext)(bwin->GetGLView());
 }
 
-int HAIKU_GL_DeleteContext(_THIS, SDL_GLContext context) {
+int HAIKU_GL_DeleteContext(SDL_VideoDevice *_this, SDL_GLContext context) {
     // printf("HAIKU_GL_DeleteContext(%llx), thread = %d\n", (uint64)context, find_thread(NULL));
     BGLView* glView = (BGLView*)context;
     SDL_BWin *bwin = (SDL_BWin*)glView->Window();
@@ -155,17 +155,17 @@ int HAIKU_GL_DeleteContext(_THIS, SDL_GLContext context) {
 }
 
 
-int HAIKU_GL_SetSwapInterval(_THIS, int interval) {
+int HAIKU_GL_SetSwapInterval(SDL_VideoDevice *_this, int interval) {
     /* TODO: Implement this, if necessary? */
     return SDL_Unsupported();
 }
 
-int HAIKU_GL_GetSwapInterval(_THIS, int *interval) {
+int HAIKU_GL_GetSwapInterval(SDL_VideoDevice *_this, int *interval) {
     return SDL_Unsupported();
 }
 
 
-void HAIKU_GL_UnloadLibrary(_THIS) {
+void HAIKU_GL_UnloadLibrary(SDL_VideoDevice *_this) {
     /* TODO: Implement this, if necessary? */
 }
 
@@ -173,7 +173,7 @@ void HAIKU_GL_UnloadLibrary(_THIS) {
 /* FIXME: This function is meant to clear the OpenGL context when the video
    mode changes (see SDL_bmodes.cc), but it doesn't seem to help, and is not
    currently in use. */
-void HAIKU_GL_RebootContexts(_THIS) {
+void HAIKU_GL_RebootContexts(SDL_VideoDevice *_this) {
     SDL_Window *window = _this->windows;
     while (window) {
         SDL_BWin *bwin = _ToBeWin(window);

+ 10 - 10
src/video/haiku/SDL_bopengl.h

@@ -30,18 +30,18 @@ extern "C" {
 
 #include "../SDL_sysvideo.h"
 
-extern int HAIKU_GL_LoadLibrary(_THIS, const char *path);      /* FIXME */
-extern SDL_FunctionPointer HAIKU_GL_GetProcAddress(_THIS, const char *proc); /* FIXME */
-extern void HAIKU_GL_UnloadLibrary(_THIS);                     /* TODO */
-extern int HAIKU_GL_MakeCurrent(_THIS, SDL_Window *window,
+extern int HAIKU_GL_LoadLibrary(SDL_VideoDevice *_this, const char *path);      /* FIXME */
+extern SDL_FunctionPointer HAIKU_GL_GetProcAddress(SDL_VideoDevice *_this, const char *proc); /* FIXME */
+extern void HAIKU_GL_UnloadLibrary(SDL_VideoDevice *_this);                     /* TODO */
+extern int HAIKU_GL_MakeCurrent(SDL_VideoDevice *_this, SDL_Window *window,
                                 SDL_GLContext context);
-extern int HAIKU_GL_SetSwapInterval(_THIS, int interval); /* TODO */
-extern int HAIKU_GL_GetSwapInterval(_THIS, int *interval); /* TODO */
-extern int HAIKU_GL_SwapWindow(_THIS, SDL_Window *window);
-extern SDL_GLContext HAIKU_GL_CreateContext(_THIS, SDL_Window *window);
-extern int HAIKU_GL_DeleteContext(_THIS, SDL_GLContext context);
+extern int HAIKU_GL_SetSwapInterval(SDL_VideoDevice *_this, int interval); /* TODO */
+extern int HAIKU_GL_GetSwapInterval(SDL_VideoDevice *_this, int *interval); /* TODO */
+extern int HAIKU_GL_SwapWindow(SDL_VideoDevice *_this, SDL_Window *window);
+extern SDL_GLContext HAIKU_GL_CreateContext(SDL_VideoDevice *_this, SDL_Window *window);
+extern int HAIKU_GL_DeleteContext(SDL_VideoDevice *_this, SDL_GLContext context);
 
-extern void HAIKU_GL_RebootContexts(_THIS);
+extern void HAIKU_GL_RebootContexts(SDL_VideoDevice *_this);
 
 #ifdef __cplusplus
 }

+ 3 - 3
src/video/haiku/SDL_bvideo.cc

@@ -243,7 +243,7 @@ static int HAIKU_SetRelativeMouseMode(SDL_bool enabled)
     return 0;
 }
 
-static void HAIKU_MouseInit(_THIS)
+static void HAIKU_MouseInit(SDL_VideoDevice *_this)
 {
 	SDL_Mouse *mouse = SDL_GetMouse();
 	if (mouse == NULL) {
@@ -258,7 +258,7 @@ static void HAIKU_MouseInit(_THIS)
 	SDL_SetDefaultCursor(HAIKU_CreateDefaultCursor());
 }
 
-int HAIKU_VideoInit(_THIS)
+int HAIKU_VideoInit(SDL_VideoDevice *_this)
 {
     /* Initialize the Be Application for appserver interaction */
     if (SDL_InitBeApp() < 0) {
@@ -283,7 +283,7 @@ int HAIKU_VideoInit(_THIS)
     return 0;
 }
 
-void HAIKU_VideoQuit(_THIS)
+void HAIKU_VideoQuit(SDL_VideoDevice *_this)
 {
 
     HAIKU_QuitModes(_this);

+ 3 - 3
src/video/haiku/SDL_bvideo.h

@@ -29,9 +29,9 @@ extern "C" {
 #include "../../core/haiku/SDL_BeApp.h"
 #include "../SDL_sysvideo.h"
 
-extern void HAIKU_VideoQuit(_THIS);
-extern int HAIKU_VideoInit(_THIS);
-extern void HAIKU_DeleteDevice(_THIS);
+extern void HAIKU_VideoQuit(SDL_VideoDevice *_this);
+extern int HAIKU_VideoInit(SDL_VideoDevice *_this);
+extern void HAIKU_DeleteDevice(SDL_VideoDevice *_this);
 
 #ifdef __cplusplus
 }

+ 19 - 19
src/video/haiku/SDL_bwindow.cc

@@ -41,7 +41,7 @@ static SDL_INLINE SDL_BLooper *_GetBeLooper() {
     return SDL_Looper;
 }
 
-static int _InitWindow(_THIS, SDL_Window *window) {
+static int _InitWindow(SDL_VideoDevice *_this, SDL_Window *window) {
     uint32 flags = 0;
     window_look look = B_TITLED_WINDOW_LOOK;
 
@@ -78,7 +78,7 @@ static int _InitWindow(_THIS, SDL_Window *window) {
     return 0;
 }
 
-int HAIKU_CreateWindow(_THIS, SDL_Window *window) {
+int HAIKU_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window) {
     if (_InitWindow(_this, window) < 0) {
         return -1;
     }
@@ -88,7 +88,7 @@ int HAIKU_CreateWindow(_THIS, SDL_Window *window) {
     return 0;
 }
 
-int HAIKU_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) {
+int HAIKU_CreateWindowFrom(SDL_VideoDevice *_this, SDL_Window * window, const void *data) {
 
     SDL_BWin *otherBWin = (SDL_BWin*)data;
     if (!otherBWin->LockLooper()) {
@@ -121,69 +121,69 @@ int HAIKU_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) {
     return 0;
 }
 
-void HAIKU_SetWindowTitle(_THIS, SDL_Window * window) {
+void HAIKU_SetWindowTitle(SDL_VideoDevice *_this, SDL_Window * window) {
     BMessage msg(BWIN_SET_TITLE);
     msg.AddString("window-title", window->title);
     _ToBeWin(window)->PostMessage(&msg);
 }
 
-void HAIKU_SetWindowPosition(_THIS, SDL_Window * window) {
+void HAIKU_SetWindowPosition(SDL_VideoDevice *_this, SDL_Window * window) {
     BMessage msg(BWIN_MOVE_WINDOW);
     msg.AddInt32("window-x", window->x);
     msg.AddInt32("window-y", window->y);
     _ToBeWin(window)->PostMessage(&msg);
 }
 
-void HAIKU_SetWindowSize(_THIS, SDL_Window * window) {
+void HAIKU_SetWindowSize(SDL_VideoDevice *_this, SDL_Window * window) {
     BMessage msg(BWIN_RESIZE_WINDOW);
     msg.AddInt32("window-w", window->w - 1);
     msg.AddInt32("window-h", window->h - 1);
     _ToBeWin(window)->PostMessage(&msg);
 }
 
-void HAIKU_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered) {
+void HAIKU_SetWindowBordered(SDL_VideoDevice *_this, SDL_Window * window, SDL_bool bordered) {
     BMessage msg(BWIN_SET_BORDERED);
     msg.AddBool("window-border", bordered != SDL_FALSE);
     _ToBeWin(window)->PostMessage(&msg);
 }
 
-void HAIKU_SetWindowResizable(_THIS, SDL_Window * window, SDL_bool resizable) {
+void HAIKU_SetWindowResizable(SDL_VideoDevice *_this, SDL_Window * window, SDL_bool resizable) {
     BMessage msg(BWIN_SET_RESIZABLE);
     msg.AddBool("window-resizable", resizable != SDL_FALSE);
     _ToBeWin(window)->PostMessage(&msg);
 }
 
-void HAIKU_ShowWindow(_THIS, SDL_Window * window) {
+void HAIKU_ShowWindow(SDL_VideoDevice *_this, SDL_Window * window) {
     BMessage msg(BWIN_SHOW_WINDOW);
     _ToBeWin(window)->PostMessage(&msg);
 }
 
-void HAIKU_HideWindow(_THIS, SDL_Window * window) {
+void HAIKU_HideWindow(SDL_VideoDevice *_this, SDL_Window * window) {
     BMessage msg(BWIN_HIDE_WINDOW);
     _ToBeWin(window)->PostMessage(&msg);
 }
 
-void HAIKU_RaiseWindow(_THIS, SDL_Window * window) {
+void HAIKU_RaiseWindow(SDL_VideoDevice *_this, SDL_Window * window) {
     BMessage msg(BWIN_SHOW_WINDOW);    /* Activate this window and move to front */
     _ToBeWin(window)->PostMessage(&msg);
 }
 
-void HAIKU_MaximizeWindow(_THIS, SDL_Window * window) {
+void HAIKU_MaximizeWindow(SDL_VideoDevice *_this, SDL_Window * window) {
     BMessage msg(BWIN_MAXIMIZE_WINDOW);
     _ToBeWin(window)->PostMessage(&msg);
 }
 
-void HAIKU_MinimizeWindow(_THIS, SDL_Window * window) {
+void HAIKU_MinimizeWindow(SDL_VideoDevice *_this, SDL_Window * window) {
     BMessage msg(BWIN_MINIMIZE_WINDOW);
     _ToBeWin(window)->PostMessage(&msg);
 }
 
-void HAIKU_RestoreWindow(_THIS, SDL_Window * window) {
+void HAIKU_RestoreWindow(SDL_VideoDevice *_this, SDL_Window * window) {
     BMessage msg(BWIN_RESTORE_WINDOW);
     _ToBeWin(window)->PostMessage(&msg);
 }
 
-void HAIKU_SetWindowFullscreen(_THIS, SDL_Window * window,
+void HAIKU_SetWindowFullscreen(SDL_VideoDevice *_this, SDL_Window * window,
         SDL_VideoDisplay * display, SDL_bool fullscreen) {
     /* Haiku tracks all video display information */
     BMessage msg(BWIN_FULLSCREEN);
@@ -193,25 +193,25 @@ void HAIKU_SetWindowFullscreen(_THIS, SDL_Window * window,
 }
 
 
-void HAIKU_SetWindowMinimumSize(_THIS, SDL_Window * window) {
+void HAIKU_SetWindowMinimumSize(SDL_VideoDevice *_this, SDL_Window * window) {
     BMessage msg(BWIN_MINIMUM_SIZE_WINDOW);
     msg.AddInt32("window-w", window->w -1);
     msg.AddInt32("window-h", window->h -1);
     _ToBeWin(window)->PostMessage(&msg);
 }
 
-void HAIKU_SetWindowMouseGrab(_THIS, SDL_Window * window, SDL_bool grabbed) {
+void HAIKU_SetWindowMouseGrab(SDL_VideoDevice *_this, SDL_Window * window, SDL_bool grabbed) {
     /* TODO: Implement this! */
 }
 
-void HAIKU_DestroyWindow(_THIS, SDL_Window * window) {
+void HAIKU_DestroyWindow(SDL_VideoDevice *_this, SDL_Window * window) {
     _ToBeWin(window)->LockLooper();    /* This MUST be locked */
     _GetBeLooper()->ClearID(_ToBeWin(window));
     _ToBeWin(window)->Quit();
     window->driverdata = NULL;
 }
 
-int HAIKU_GetWindowWMInfo(_THIS, SDL_Window *window, struct SDL_SysWMinfo *info)
+int HAIKU_GetWindowWMInfo(SDL_VideoDevice *_this, SDL_Window *window, struct SDL_SysWMinfo *info)
 {
     info->subsystem = SDL_SYSWM_HAIKU;
     return 0;

+ 18 - 18
src/video/haiku/SDL_bwindow.h

@@ -24,23 +24,23 @@
 
 #include "../SDL_sysvideo.h"
 
-extern int HAIKU_CreateWindow(_THIS, SDL_Window *window);
-extern int HAIKU_CreateWindowFrom(_THIS, SDL_Window *window, const void *data);
-extern void HAIKU_SetWindowTitle(_THIS, SDL_Window *window);
-extern int HAIKU_SetWindowPosition(_THIS, SDL_Window *window);
-extern void HAIKU_SetWindowSize(_THIS, SDL_Window *window);
-extern void HAIKU_SetWindowMinimumSize(_THIS, SDL_Window *window);
-extern void HAIKU_ShowWindow(_THIS, SDL_Window *window);
-extern void HAIKU_HideWindow(_THIS, SDL_Window *window);
-extern void HAIKU_RaiseWindow(_THIS, SDL_Window *window);
-extern void HAIKU_MaximizeWindow(_THIS, SDL_Window *window);
-extern void HAIKU_MinimizeWindow(_THIS, SDL_Window *window);
-extern void HAIKU_RestoreWindow(_THIS, SDL_Window *window);
-extern void HAIKU_SetWindowBordered(_THIS, SDL_Window *window, SDL_bool bordered);
-extern void HAIKU_SetWindowResizable(_THIS, SDL_Window *window, SDL_bool resizable);
-extern void HAIKU_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen);
-extern void HAIKU_SetWindowMouseGrab(_THIS, SDL_Window *window, SDL_bool grabbed);
-extern void HAIKU_DestroyWindow(_THIS, SDL_Window *window);
-extern int HAIKU_GetWindowWMInfo(_THIS, SDL_Window *window, struct SDL_SysWMinfo *info);
+extern int HAIKU_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window);
+extern int HAIKU_CreateWindowFrom(SDL_VideoDevice *_this, SDL_Window *window, const void *data);
+extern void HAIKU_SetWindowTitle(SDL_VideoDevice *_this, SDL_Window *window);
+extern int HAIKU_SetWindowPosition(SDL_VideoDevice *_this, SDL_Window *window);
+extern void HAIKU_SetWindowSize(SDL_VideoDevice *_this, SDL_Window *window);
+extern void HAIKU_SetWindowMinimumSize(SDL_VideoDevice *_this, SDL_Window *window);
+extern void HAIKU_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window);
+extern void HAIKU_HideWindow(SDL_VideoDevice *_this, SDL_Window *window);
+extern void HAIKU_RaiseWindow(SDL_VideoDevice *_this, SDL_Window *window);
+extern void HAIKU_MaximizeWindow(SDL_VideoDevice *_this, SDL_Window *window);
+extern void HAIKU_MinimizeWindow(SDL_VideoDevice *_this, SDL_Window *window);
+extern void HAIKU_RestoreWindow(SDL_VideoDevice *_this, SDL_Window *window);
+extern void HAIKU_SetWindowBordered(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool bordered);
+extern void HAIKU_SetWindowResizable(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool resizable);
+extern void HAIKU_SetWindowFullscreen(SDL_VideoDevice *_this, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen);
+extern void HAIKU_SetWindowMouseGrab(SDL_VideoDevice *_this, SDL_Window *window, SDL_bool grabbed);
+extern void HAIKU_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window);
+extern int HAIKU_GetWindowWMInfo(SDL_VideoDevice *_this, SDL_Window *window, struct SDL_SysWMinfo *info);
 
 #endif

+ 1 - 1
src/video/kmsdrm/SDL_kmsdrmevents.c

@@ -32,7 +32,7 @@
 #include "../../core/openbsd/SDL_wscons.h"
 #endif
 
-void KMSDRM_PumpEvents(_THIS)
+void KMSDRM_PumpEvents(SDL_VideoDevice *_this)
 {
 #ifdef SDL_INPUT_LINUXEV
     SDL_EVDEV_Poll();

+ 3 - 3
src/video/kmsdrm/SDL_kmsdrmevents.h

@@ -24,8 +24,8 @@
 #ifndef SDL_kmsdrmevents_h_
 #define SDL_kmsdrmevents_h_
 
-extern void KMSDRM_PumpEvents(_THIS);
-extern void KMSDRM_EventInit(_THIS);
-extern void KMSDRM_EventQuit(_THIS);
+extern void KMSDRM_PumpEvents(SDL_VideoDevice *_this);
+extern void KMSDRM_EventInit(SDL_VideoDevice *_this);
+extern void KMSDRM_EventQuit(SDL_VideoDevice *_this);
 
 #endif /* SDL_kmsdrmevents_h_ */

+ 3 - 3
src/video/kmsdrm/SDL_kmsdrmmouse.c

@@ -61,7 +61,7 @@ static SDL_Cursor *KMSDRM_CreateDefaultCursor(void)
 /* Given a display's driverdata, destroy the cursor BO for it.
    To be called from KMSDRM_DestroyWindow(), as that's where we
    destroy the driverdata for the window's display. */
-void KMSDRM_DestroyCursorBO(_THIS, SDL_VideoDisplay *display)
+void KMSDRM_DestroyCursorBO(SDL_VideoDevice *_this, SDL_VideoDisplay *display)
 {
     SDL_DisplayData *dispdata = display->driverdata;
 
@@ -383,7 +383,7 @@ static int KMSDRM_WarpMouse(SDL_Window *window, float x, float y)
     return KMSDRM_WarpMouseGlobal(x, y);
 }
 
-void KMSDRM_InitMouse(_THIS, SDL_VideoDisplay *display)
+void KMSDRM_InitMouse(SDL_VideoDevice *_this, SDL_VideoDisplay *display)
 {
     SDL_Mouse *mouse = SDL_GetMouse();
     SDL_DisplayData *dispdata = display->driverdata;
@@ -403,7 +403,7 @@ void KMSDRM_InitMouse(_THIS, SDL_VideoDisplay *display)
     }
 }
 
-void KMSDRM_QuitMouse(_THIS)
+void KMSDRM_QuitMouse(SDL_VideoDevice *_this)
 {
     /* TODO: ? */
 }

+ 3 - 3
src/video/kmsdrm/SDL_kmsdrmmouse.h

@@ -43,11 +43,11 @@ typedef struct KMSDRM_CursorData
 
 } KMSDRM_CursorData;
 
-extern void KMSDRM_InitMouse(_THIS, SDL_VideoDisplay *display);
-extern void KMSDRM_QuitMouse(_THIS);
+extern void KMSDRM_InitMouse(SDL_VideoDevice *_this, SDL_VideoDisplay *display);
+extern void KMSDRM_QuitMouse(SDL_VideoDevice *_this);
 
 extern int KMSDRM_CreateCursorBO(SDL_VideoDisplay *display);
-extern void KMSDRM_DestroyCursorBO(_THIS, SDL_VideoDisplay *display);
+extern void KMSDRM_DestroyCursorBO(SDL_VideoDevice *_this, SDL_VideoDisplay *display);
 extern void KMSDRM_InitCursor(void);
 
 #endif /* SDL_KMSDRM_mouse_h_ */

+ 5 - 5
src/video/kmsdrm/SDL_kmsdrmopengles.c

@@ -34,7 +34,7 @@
 
 /* EGL implementation of SDL OpenGL support */
 
-void KMSDRM_GLES_DefaultProfileConfig(_THIS, int *mask, int *major, int *minor)
+void KMSDRM_GLES_DefaultProfileConfig(SDL_VideoDevice *_this, int *mask, int *major, int *minor)
 {
     /* if SDL was _also_ built with the Raspberry Pi driver (so we're
        definitely a Pi device) or with the ROCKCHIP video driver
@@ -46,7 +46,7 @@ void KMSDRM_GLES_DefaultProfileConfig(_THIS, int *mask, int *major, int *minor)
 #endif
 }
 
-int KMSDRM_GLES_LoadLibrary(_THIS, const char *path)
+int KMSDRM_GLES_LoadLibrary(SDL_VideoDevice *_this, const char *path)
 {
     /* Just pretend you do this here, but don't do it until KMSDRM_CreateWindow(),
        where we do the same library load we would normally do here.
@@ -60,7 +60,7 @@ int KMSDRM_GLES_LoadLibrary(_THIS, const char *path)
     return 0;
 }
 
-void KMSDRM_GLES_UnloadLibrary(_THIS)
+void KMSDRM_GLES_UnloadLibrary(SDL_VideoDevice *_this)
 {
     /* As with KMSDRM_GLES_LoadLibrary(), we define our own "dummy" unloading function
        so we manually unload the library whenever we want. */
@@ -68,7 +68,7 @@ void KMSDRM_GLES_UnloadLibrary(_THIS)
 
 SDL_EGL_CreateContext_impl(KMSDRM)
 
-    int KMSDRM_GLES_SetSwapInterval(_THIS, int interval)
+    int KMSDRM_GLES_SetSwapInterval(SDL_VideoDevice *_this, int interval)
 {
 
     if (!_this->egl_data) {
@@ -84,7 +84,7 @@ SDL_EGL_CreateContext_impl(KMSDRM)
     return 0;
 }
 
-int KMSDRM_GLES_SwapWindow(_THIS, SDL_Window *window)
+int KMSDRM_GLES_SwapWindow(SDL_VideoDevice *_this, SDL_Window *window)
 {
     SDL_WindowData *windata = window->driverdata;
     SDL_DisplayData *dispdata = SDL_GetDisplayDriverDataForWindow(window);

+ 6 - 6
src/video/kmsdrm/SDL_kmsdrmopengles.h

@@ -34,12 +34,12 @@
 #define KMSDRM_GLES_DeleteContext   SDL_EGL_DeleteContext
 #define KMSDRM_GLES_GetSwapInterval SDL_EGL_GetSwapInterval
 
-extern void KMSDRM_GLES_DefaultProfileConfig(_THIS, int *mask, int *major, int *minor);
-extern int KMSDRM_GLES_SetSwapInterval(_THIS, int interval);
-extern int KMSDRM_GLES_LoadLibrary(_THIS, const char *path);
-extern SDL_GLContext KMSDRM_GLES_CreateContext(_THIS, SDL_Window *window);
-extern int KMSDRM_GLES_SwapWindow(_THIS, SDL_Window *window);
-extern int KMSDRM_GLES_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context);
+extern void KMSDRM_GLES_DefaultProfileConfig(SDL_VideoDevice *_this, int *mask, int *major, int *minor);
+extern int KMSDRM_GLES_SetSwapInterval(SDL_VideoDevice *_this, int interval);
+extern int KMSDRM_GLES_LoadLibrary(SDL_VideoDevice *_this, const char *path);
+extern SDL_GLContext KMSDRM_GLES_CreateContext(SDL_VideoDevice *_this, SDL_Window *window);
+extern int KMSDRM_GLES_SwapWindow(SDL_VideoDevice *_this, SDL_Window *window);
+extern int KMSDRM_GLES_MakeCurrent(SDL_VideoDevice *_this, SDL_Window *window, SDL_GLContext context);
 
 #endif /* SDL_VIDEO_DRIVER_KMSDRM */
 

+ 27 - 27
src/video/kmsdrm/SDL_kmsdrmvideo.c

@@ -350,7 +350,7 @@ static void KMSDRM_FBDestroyCallback(struct gbm_bo *bo, void *data)
 }
 
 KMSDRM_FBInfo *
-KMSDRM_FBFromBO(_THIS, struct gbm_bo *bo)
+KMSDRM_FBFromBO(SDL_VideoDevice *_this, struct gbm_bo *bo)
 {
     SDL_VideoData *viddata = _this->driverdata;
     unsigned w, h;
@@ -402,7 +402,7 @@ static void KMSDRM_FlipHandler(int fd, unsigned int frame, unsigned int sec, uns
 }
 
 SDL_bool
-KMSDRM_WaitPageflip(_THIS, SDL_WindowData *windata)
+KMSDRM_WaitPageflip(SDL_VideoDevice *_this, SDL_WindowData *windata)
 {
 
     SDL_VideoData *viddata = _this->driverdata;
@@ -514,7 +514,7 @@ static drmModeModeInfo *KMSDRM_GetClosestDisplayMode(SDL_VideoDisplay *display,
 /*****************************************************************************/
 
 /* Deinitializes the driverdata of the SDL Displays in the SDL display list. */
-static void KMSDRM_DeinitDisplays(_THIS)
+static void KMSDRM_DeinitDisplays(SDL_VideoDevice *_this)
 {
     SDL_DisplayID *displays;
     SDL_DisplayData *dispdata;
@@ -680,7 +680,7 @@ static SDL_bool KMSDRM_CrtcGetVrr(uint32_t drm_fd, uint32_t crtc_id)
 
 /* Gets a DRM connector, builds an SDL_Display with it, and adds it to the
    list of SDL Displays in _this->displays[]  */
-static void KMSDRM_AddDisplay(_THIS, drmModeConnector *connector, drmModeRes *resources)
+static void KMSDRM_AddDisplay(SDL_VideoDevice *_this, drmModeConnector *connector, drmModeRes *resources)
 {
     SDL_VideoData *viddata = _this->driverdata;
     SDL_DisplayData *dispdata = NULL;
@@ -903,7 +903,7 @@ cleanup:
    closed when we get to the end of this function.
    This is to be called early, in VideoInit(), because it gets us
    the videomode information, which SDL needs immediately after VideoInit(). */
-static int KMSDRM_InitDisplays(_THIS)
+static int KMSDRM_InitDisplays(SDL_VideoDevice *_this)
 {
 
     SDL_VideoData *viddata = _this->driverdata;
@@ -999,7 +999,7 @@ cleanup:
    These things are incompatible with Vulkan, which accesses the same resources
    internally so they must be free when trying to build a Vulkan surface.
 */
-static int KMSDRM_GBMInit(_THIS, SDL_DisplayData *dispdata)
+static int KMSDRM_GBMInit(SDL_VideoDevice *_this, SDL_DisplayData *dispdata)
 {
     SDL_VideoData *viddata = _this->driverdata;
     int ret = 0;
@@ -1022,7 +1022,7 @@ static int KMSDRM_GBMInit(_THIS, SDL_DisplayData *dispdata)
 }
 
 /* Deinit the Vulkan-incompatible KMSDRM stuff. */
-static void KMSDRM_GBMDeinit(_THIS, SDL_DisplayData *dispdata)
+static void KMSDRM_GBMDeinit(SDL_VideoDevice *_this, SDL_DisplayData *dispdata)
 {
     SDL_VideoData *viddata = _this->driverdata;
 
@@ -1042,7 +1042,7 @@ static void KMSDRM_GBMDeinit(_THIS, SDL_DisplayData *dispdata)
     viddata->gbm_init = SDL_FALSE;
 }
 
-static void KMSDRM_DestroySurfaces(_THIS, SDL_Window *window)
+static void KMSDRM_DestroySurfaces(SDL_VideoDevice *_this, SDL_Window *window)
 {
     SDL_VideoData *viddata = _this->driverdata;
     SDL_WindowData *windata = window->driverdata;
@@ -1144,7 +1144,7 @@ static void KMSDRM_DirtySurfaces(SDL_Window *window)
 
 /* This determines the size of the fb, which comes from the GBM surface
    that we create here. */
-int KMSDRM_CreateSurfaces(_THIS, SDL_Window *window)
+int KMSDRM_CreateSurfaces(SDL_VideoDevice *_this, SDL_Window *window)
 {
     SDL_VideoData *viddata = _this->driverdata;
     SDL_WindowData *windata = window->driverdata;
@@ -1228,7 +1228,7 @@ cleanup:
     return ret;
 }
 
-int KMSDRM_VideoInit(_THIS)
+int KMSDRM_VideoInit(SDL_VideoDevice *_this)
 {
     int ret = 0;
 
@@ -1259,7 +1259,7 @@ int KMSDRM_VideoInit(_THIS)
 
 /* The driverdata pointers, like dispdata, viddata, windata, etc...
    are freed by SDL internals, so not our job. */
-void KMSDRM_VideoQuit(_THIS)
+void KMSDRM_VideoQuit(SDL_VideoDevice *_this)
 {
     SDL_VideoData *viddata = _this->driverdata;
 
@@ -1280,7 +1280,7 @@ void KMSDRM_VideoQuit(_THIS)
 }
 
 /* Read modes from the connector modes, and store them in display->display_modes. */
-int KMSDRM_GetDisplayModes(_THIS, SDL_VideoDisplay *display)
+int KMSDRM_GetDisplayModes(SDL_VideoDevice *_this, SDL_VideoDisplay *display)
 {
     SDL_DisplayData *dispdata = display->driverdata;
     drmModeConnector *conn = dispdata->connector;
@@ -1308,7 +1308,7 @@ int KMSDRM_GetDisplayModes(_THIS, SDL_VideoDisplay *display)
     return 0;
 }
 
-int KMSDRM_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
+int KMSDRM_SetDisplayMode(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
 {
     /* Set the dispdata->mode to the new mode and leave actual modesetting
        pending to be done on SwapWindow() via drmModeSetCrtc() */
@@ -1339,7 +1339,7 @@ int KMSDRM_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mod
     return 0;
 }
 
-void KMSDRM_DestroyWindow(_THIS, SDL_Window *window)
+void KMSDRM_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
 {
     SDL_WindowData *windata = window->driverdata;
     SDL_DisplayData *dispdata = SDL_GetDisplayDriverDataForWindow(window);
@@ -1417,7 +1417,7 @@ void KMSDRM_DestroyWindow(_THIS, SDL_Window *window)
 /* reflect it: if it's fullscreen, KMSDRM_SetWindwoFullscreen() will  */
 /* be called by SDL later, and we can manage it there.                */
 /**********************************************************************/
-int KMSDRM_CreateWindow(_THIS, SDL_Window *window)
+int KMSDRM_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window)
 {
     SDL_WindowData *windata = NULL;
     SDL_VideoData *viddata = _this->driverdata;
@@ -1551,26 +1551,26 @@ int KMSDRM_CreateWindow(_THIS, SDL_Window *window)
     return ret;
 }
 
-int KMSDRM_CreateWindowFrom(_THIS, SDL_Window *window, const void *data)
+int KMSDRM_CreateWindowFrom(SDL_VideoDevice *_this, SDL_Window *window, const void *data)
 {
     return -1;
 }
 
-void KMSDRM_SetWindowTitle(_THIS, SDL_Window *window)
+void KMSDRM_SetWindowTitle(SDL_VideoDevice *_this, SDL_Window *window)
 {
 }
-int KMSDRM_SetWindowPosition(_THIS, SDL_Window *window)
+int KMSDRM_SetWindowPosition(SDL_VideoDevice *_this, SDL_Window *window)
 {
     return SDL_Unsupported();
 }
-void KMSDRM_SetWindowSize(_THIS, SDL_Window *window)
+void KMSDRM_SetWindowSize(SDL_VideoDevice *_this, SDL_Window *window)
 {
     SDL_VideoData *viddata = _this->driverdata;
     if (!viddata->vulkan_mode) {
         KMSDRM_DirtySurfaces(window);
     }
 }
-void KMSDRM_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen)
+void KMSDRM_SetWindowFullscreen(SDL_VideoDevice *_this, SDL_Window *window, SDL_VideoDisplay *display, SDL_bool fullscreen)
 
 {
     SDL_VideoData *viddata = _this->driverdata;
@@ -1578,29 +1578,29 @@ void KMSDRM_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *dis
         KMSDRM_DirtySurfaces(window);
     }
 }
-void KMSDRM_ShowWindow(_THIS, SDL_Window *window)
+void KMSDRM_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
 {
 }
-void KMSDRM_HideWindow(_THIS, SDL_Window *window)
+void KMSDRM_HideWindow(SDL_VideoDevice *_this, SDL_Window *window)
 {
 }
-void KMSDRM_RaiseWindow(_THIS, SDL_Window *window)
+void KMSDRM_RaiseWindow(SDL_VideoDevice *_this, SDL_Window *window)
 {
 }
-void KMSDRM_MaximizeWindow(_THIS, SDL_Window *window)
+void KMSDRM_MaximizeWindow(SDL_VideoDevice *_this, SDL_Window *window)
 {
 }
-void KMSDRM_MinimizeWindow(_THIS, SDL_Window *window)
+void KMSDRM_MinimizeWindow(SDL_VideoDevice *_this, SDL_Window *window)
 {
 }
-void KMSDRM_RestoreWindow(_THIS, SDL_Window *window)
+void KMSDRM_RestoreWindow(SDL_VideoDevice *_this, SDL_Window *window)
 {
 }
 
 /*****************************************************************************/
 /* SDL Window Manager function                                               */
 /*****************************************************************************/
-int KMSDRM_GetWindowWMInfo(_THIS, SDL_Window *window, struct SDL_SysWMinfo *info)
+int KMSDRM_GetWindowWMInfo(SDL_VideoDevice *_this, SDL_Window *window, struct SDL_SysWMinfo *info)
 {
     SDL_VideoData *viddata = _this->driverdata;
 

+ 31 - 31
src/video/kmsdrm/SDL_kmsdrmvideo.h

@@ -107,46 +107,46 @@ typedef struct KMSDRM_FBInfo
 } KMSDRM_FBInfo;
 
 /* Helper functions */
-int KMSDRM_CreateSurfaces(_THIS, SDL_Window *window);
-KMSDRM_FBInfo *KMSDRM_FBFromBO(_THIS, struct gbm_bo *bo);
-KMSDRM_FBInfo *KMSDRM_FBFromBO2(_THIS, struct gbm_bo *bo, int w, int h);
-SDL_bool KMSDRM_WaitPageflip(_THIS, SDL_WindowData *windata);
+int KMSDRM_CreateSurfaces(SDL_VideoDevice *_this, SDL_Window *window);
+KMSDRM_FBInfo *KMSDRM_FBFromBO(SDL_VideoDevice *_this, struct gbm_bo *bo);
+KMSDRM_FBInfo *KMSDRM_FBFromBO2(SDL_VideoDevice *_this, struct gbm_bo *bo, int w, int h);
+SDL_bool KMSDRM_WaitPageflip(SDL_VideoDevice *_this, SDL_WindowData *windata);
 
 /****************************************************************************/
 /* SDL_VideoDevice functions declaration                                    */
 /****************************************************************************/
 
 /* Display and window functions */
-int KMSDRM_VideoInit(_THIS);
-void KMSDRM_VideoQuit(_THIS);
-int KMSDRM_GetDisplayModes(_THIS, SDL_VideoDisplay *display);
-int KMSDRM_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode);
-int KMSDRM_CreateWindow(_THIS, SDL_Window *window);
-int KMSDRM_CreateWindowFrom(_THIS, SDL_Window *window, const void *data);
-void KMSDRM_SetWindowTitle(_THIS, SDL_Window *window);
-int KMSDRM_SetWindowPosition(_THIS, SDL_Window *window);
-void KMSDRM_SetWindowSize(_THIS, SDL_Window *window);
-void KMSDRM_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *_display, SDL_bool fullscreen);
-void KMSDRM_ShowWindow(_THIS, SDL_Window *window);
-void KMSDRM_HideWindow(_THIS, SDL_Window *window);
-void KMSDRM_RaiseWindow(_THIS, SDL_Window *window);
-void KMSDRM_MaximizeWindow(_THIS, SDL_Window *window);
-void KMSDRM_MinimizeWindow(_THIS, SDL_Window *window);
-void KMSDRM_RestoreWindow(_THIS, SDL_Window *window);
-void KMSDRM_DestroyWindow(_THIS, SDL_Window *window);
+int KMSDRM_VideoInit(SDL_VideoDevice *_this);
+void KMSDRM_VideoQuit(SDL_VideoDevice *_this);
+int KMSDRM_GetDisplayModes(SDL_VideoDevice *_this, SDL_VideoDisplay *display);
+int KMSDRM_SetDisplayMode(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL_DisplayMode *mode);
+int KMSDRM_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window);
+int KMSDRM_CreateWindowFrom(SDL_VideoDevice *_this, SDL_Window *window, const void *data);
+void KMSDRM_SetWindowTitle(SDL_VideoDevice *_this, SDL_Window *window);
+int KMSDRM_SetWindowPosition(SDL_VideoDevice *_this, SDL_Window *window);
+void KMSDRM_SetWindowSize(SDL_VideoDevice *_this, SDL_Window *window);
+void KMSDRM_SetWindowFullscreen(SDL_VideoDevice *_this, SDL_Window *window, SDL_VideoDisplay *_display, SDL_bool fullscreen);
+void KMSDRM_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window);
+void KMSDRM_HideWindow(SDL_VideoDevice *_this, SDL_Window *window);
+void KMSDRM_RaiseWindow(SDL_VideoDevice *_this, SDL_Window *window);
+void KMSDRM_MaximizeWindow(SDL_VideoDevice *_this, SDL_Window *window);
+void KMSDRM_MinimizeWindow(SDL_VideoDevice *_this, SDL_Window *window);
+void KMSDRM_RestoreWindow(SDL_VideoDevice *_this, SDL_Window *window);
+void KMSDRM_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window);
 
 /* Window manager function */
-int KMSDRM_GetWindowWMInfo(_THIS, SDL_Window *window, struct SDL_SysWMinfo *info);
+int KMSDRM_GetWindowWMInfo(SDL_VideoDevice *_this, SDL_Window *window, struct SDL_SysWMinfo *info);
 
 /* OpenGL/OpenGL ES functions */
-int KMSDRM_GLES_LoadLibrary(_THIS, const char *path);
-SDL_FunctionPointer KMSDRM_GLES_GetProcAddress(_THIS, const char *proc);
-void KMSDRM_GLES_UnloadLibrary(_THIS);
-SDL_GLContext KMSDRM_GLES_CreateContext(_THIS, SDL_Window *window);
-int KMSDRM_GLES_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context);
-int KMSDRM_GLES_SetSwapInterval(_THIS, int interval);
-int KMSDRM_GLES_GetSwapInterval(_THIS);
-int KMSDRM_GLES_SwapWindow(_THIS, SDL_Window *window);
-int KMSDRM_GLES_DeleteContext(_THIS, SDL_GLContext context);
+int KMSDRM_GLES_LoadLibrary(SDL_VideoDevice *_this, const char *path);
+SDL_FunctionPointer KMSDRM_GLES_GetProcAddress(SDL_VideoDevice *_this, const char *proc);
+void KMSDRM_GLES_UnloadLibrary(SDL_VideoDevice *_this);
+SDL_GLContext KMSDRM_GLES_CreateContext(SDL_VideoDevice *_this, SDL_Window *window);
+int KMSDRM_GLES_MakeCurrent(SDL_VideoDevice *_this, SDL_Window *window, SDL_GLContext context);
+int KMSDRM_GLES_SetSwapInterval(SDL_VideoDevice *_this, int interval);
+int KMSDRM_GLES_GetSwapInterval(SDL_VideoDevice *_this);
+int KMSDRM_GLES_SwapWindow(SDL_VideoDevice *_this, SDL_Window *window);
+int KMSDRM_GLES_DeleteContext(SDL_VideoDevice *_this, SDL_GLContext context);
 
 #endif /* SDL_kmsdrmvideo_h */

+ 4 - 4
src/video/kmsdrm/SDL_kmsdrmvulkan.c

@@ -42,7 +42,7 @@
 #define DEFAULT_VULKAN "libvulkan.so.1"
 #endif
 
-int KMSDRM_Vulkan_LoadLibrary(_THIS, const char *path)
+int KMSDRM_Vulkan_LoadLibrary(SDL_VideoDevice *_this, const char *path)
 {
     VkExtensionProperties *extensions = NULL;
     Uint32 i, extensionCount = 0;
@@ -122,7 +122,7 @@ fail:
     return -1;
 }
 
-void KMSDRM_Vulkan_UnloadLibrary(_THIS)
+void KMSDRM_Vulkan_UnloadLibrary(SDL_VideoDevice *_this)
 {
     if (_this->vulkan_config.loader_handle) {
         SDL_UnloadObject(_this->vulkan_config.loader_handle);
@@ -140,7 +140,7 @@ void KMSDRM_Vulkan_UnloadLibrary(_THIS)
 /* members of the VkInstanceCreateInfo struct passed to              */
 /* vkCreateInstance().                                               */
 /*********************************************************************/
-SDL_bool KMSDRM_Vulkan_GetInstanceExtensions(_THIS,
+SDL_bool KMSDRM_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this,
                                              unsigned *count,
                                              const char **names)
 {
@@ -164,7 +164,7 @@ SDL_bool KMSDRM_Vulkan_GetInstanceExtensions(_THIS,
 /* KMSDRM_Vulkan_GetInstanceExtensions(), like we do with              */
 /* VK_KHR_DISPLAY_EXTENSION_NAME, which is what we need for x-less VK. */
 /***********************************************************************/
-SDL_bool KMSDRM_Vulkan_CreateSurface(_THIS,
+SDL_bool KMSDRM_Vulkan_CreateSurface(SDL_VideoDevice *_this,
                                      SDL_Window *window,
                                      VkInstance instance,
                                      VkSurfaceKHR *surface)

+ 4 - 4
src/video/kmsdrm/SDL_kmsdrmvulkan.h

@@ -34,12 +34,12 @@
 
 #if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_KMSDRM)
 
-int KMSDRM_Vulkan_LoadLibrary(_THIS, const char *path);
-void KMSDRM_Vulkan_UnloadLibrary(_THIS);
-SDL_bool KMSDRM_Vulkan_GetInstanceExtensions(_THIS,
+int KMSDRM_Vulkan_LoadLibrary(SDL_VideoDevice *_this, const char *path);
+void KMSDRM_Vulkan_UnloadLibrary(SDL_VideoDevice *_this);
+SDL_bool KMSDRM_Vulkan_GetInstanceExtensions(SDL_VideoDevice *_this,
                                              unsigned *count,
                                              const char **names);
-SDL_bool KMSDRM_Vulkan_CreateSurface(_THIS,
+SDL_bool KMSDRM_Vulkan_CreateSurface(SDL_VideoDevice *_this,
                                      SDL_Window *window,
                                      VkInstance instance,
                                      VkSurfaceKHR *surface);

+ 1 - 1
src/video/n3ds/SDL_n3dsevents.c

@@ -28,7 +28,7 @@
 #include "SDL_n3dsevents_c.h"
 #include "SDL_n3dstouch.h"
 
-void N3DS_PumpEvents(_THIS)
+void N3DS_PumpEvents(SDL_VideoDevice *_this)
 {
     hidScanInput();
     N3DS_PollTouch();

+ 1 - 1
src/video/n3ds/SDL_n3dsevents_c.h

@@ -24,6 +24,6 @@
 
 #include "SDL_internal.h"
 
-extern void N3DS_PumpEvents(_THIS);
+extern void N3DS_PumpEvents(SDL_VideoDevice *_this);
 
 #endif /* SDL_n3dsevents_c_h_ */

+ 3 - 3
src/video/n3ds/SDL_n3dsframebuffer.c

@@ -40,7 +40,7 @@ SDL_FORCE_INLINE int GetDestOffset(int x, int y, int dest_width);
 SDL_FORCE_INLINE int GetSourceOffset(int x, int y, int source_width);
 SDL_FORCE_INLINE void FlushN3DSBuffer(const void *buffer, u32 bufsize, gfxScreen_t screen);
 
-int SDL_N3DS_CreateWindowFramebuffer(_THIS, SDL_Window *window, Uint32 *format, void **pixels, int *pitch)
+int SDL_N3DS_CreateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window, Uint32 *format, void **pixels, int *pitch)
 {
     SDL_Surface *framebuffer;
 
@@ -73,7 +73,7 @@ CreateNewWindowFramebuffer(SDL_Window *window)
     return SDL_CreateSurface(w, h, FRAMEBUFFER_FORMAT);
 }
 
-int SDL_N3DS_UpdateWindowFramebuffer(_THIS, SDL_Window *window, const SDL_Rect *rects, int numrects)
+int SDL_N3DS_UpdateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window, const SDL_Rect *rects, int numrects)
 {
     SDL_WindowData *drv_data = window->driverdata;
     SDL_Surface *surface;
@@ -131,7 +131,7 @@ FlushN3DSBuffer(const void *buffer, u32 bufsize, gfxScreen_t screen)
     gfxScreenSwapBuffers(screen, false);
 }
 
-void SDL_N3DS_DestroyWindowFramebuffer(_THIS, SDL_Window *window)
+void SDL_N3DS_DestroyWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window)
 {
     SDL_Surface *surface;
     surface = (SDL_Surface *)SDL_SetWindowData(window, N3DS_SURFACE, NULL);

+ 3 - 3
src/video/n3ds/SDL_n3dsframebuffer_c.h

@@ -24,8 +24,8 @@
 
 #include "SDL_internal.h"
 
-int SDL_N3DS_CreateWindowFramebuffer(_THIS, SDL_Window *window, Uint32 *format, void **pixels, int *pitch);
-int SDL_N3DS_UpdateWindowFramebuffer(_THIS, SDL_Window *window, const SDL_Rect *rects, int numrects);
-void SDL_N3DS_DestroyWindowFramebuffer(_THIS, SDL_Window *window);
+int SDL_N3DS_CreateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window, Uint32 *format, void **pixels, int *pitch);
+int SDL_N3DS_UpdateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window, const SDL_Rect *rects, int numrects);
+void SDL_N3DS_DestroyWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window);
 
 #endif /* SDL_n3dsframebuffer_c_h_ */

+ 3 - 3
src/video/n3ds/SDL_n3dsswkb.c

@@ -46,12 +46,12 @@ void N3DS_SwkbQuit()
 }
 
 SDL_bool
-N3DS_HasScreenKeyboardSupport(_THIS)
+N3DS_HasScreenKeyboardSupport(SDL_VideoDevice *_this)
 {
     return SDL_TRUE;
 }
 
-void N3DS_StartTextInput(_THIS)
+void N3DS_StartTextInput(SDL_VideoDevice *_this)
 {
     char buffer[BUFFER_SIZE];
     SwkbdButton button_pressed;
@@ -61,7 +61,7 @@ void N3DS_StartTextInput(_THIS)
     }
 }
 
-void N3DS_StopTextInput(_THIS)
+void N3DS_StopTextInput(SDL_VideoDevice *_this)
 {
     return;
 }

+ 3 - 3
src/video/n3ds/SDL_n3dsswkb.h

@@ -28,9 +28,9 @@ void N3DS_SwkbInit();
 void N3DS_SwkbPoll();
 void N3DS_SwkbQuit();
 
-SDL_bool N3DS_HasScreenKeyboardSupport(_THIS);
+SDL_bool N3DS_HasScreenKeyboardSupport(SDL_VideoDevice *_this);
 
-void N3DS_StartTextInput(_THIS);
-void N3DS_StopTextInput(_THIS);
+void N3DS_StartTextInput(SDL_VideoDevice *_this);
+void N3DS_StopTextInput(SDL_VideoDevice *_this);
 
 #endif /* SDL_n3dskeyboard_h_ */

+ 10 - 10
src/video/n3ds/SDL_n3dsvideo.c

@@ -33,11 +33,11 @@
 
 SDL_FORCE_INLINE int AddN3DSDisplay(gfxScreen_t screen);
 
-static int N3DS_VideoInit(_THIS);
-static void N3DS_VideoQuit(_THIS);
-static int N3DS_GetDisplayBounds(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect);
-static int N3DS_CreateWindow(_THIS, SDL_Window *window);
-static void N3DS_DestroyWindow(_THIS, SDL_Window *window);
+static int N3DS_VideoInit(SDL_VideoDevice *_this);
+static void N3DS_VideoQuit(SDL_VideoDevice *_this);
+static int N3DS_GetDisplayBounds(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL_Rect *rect);
+static int N3DS_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window);
+static void N3DS_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window);
 
 struct SDL_DisplayData
 {
@@ -86,7 +86,7 @@ static SDL_VideoDevice *N3DS_CreateDevice(void)
 
 VideoBootStrap N3DS_bootstrap = { N3DSVID_DRIVER_NAME, "N3DS Video Driver", N3DS_CreateDevice };
 
-static int N3DS_VideoInit(_THIS)
+static int N3DS_VideoInit(SDL_VideoDevice *_this)
 {
     gfxInit(GSP_RGBA8_OES, GSP_RGBA8_OES, false);
     hidInit();
@@ -127,7 +127,7 @@ static int AddN3DSDisplay(gfxScreen_t screen)
     return 0;
 }
 
-static void N3DS_VideoQuit(_THIS)
+static void N3DS_VideoQuit(SDL_VideoDevice *_this)
 {
     N3DS_SwkbQuit();
     N3DS_QuitTouch();
@@ -136,7 +136,7 @@ static void N3DS_VideoQuit(_THIS)
     gfxExit();
 }
 
-static int N3DS_GetDisplayBounds(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect)
+static int N3DS_GetDisplayBounds(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL_Rect *rect)
 {
     SDL_DisplayData *driver_data = display->driverdata;
 
@@ -151,7 +151,7 @@ static int N3DS_GetDisplayBounds(_THIS, SDL_VideoDisplay *display, SDL_Rect *rec
     return 0;
 }
 
-static int N3DS_CreateWindow(_THIS, SDL_Window *window)
+static int N3DS_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window)
 {
     SDL_DisplayData *display_data;
     SDL_WindowData *window_data = (SDL_WindowData *)SDL_calloc(1, sizeof(SDL_WindowData));
@@ -165,7 +165,7 @@ static int N3DS_CreateWindow(_THIS, SDL_Window *window)
     return 0;
 }
 
-static void N3DS_DestroyWindow(_THIS, SDL_Window *window)
+static void N3DS_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
 {
     if (window == NULL) {
         return;

+ 6 - 6
src/video/ngage/SDL_ngageevents.cpp

@@ -40,9 +40,9 @@ extern "C" {
 #include "SDL_ngagevideo.h"
 #include "SDL_ngageevents_c.h"
 
-int HandleWsEvent(_THIS, const TWsEvent &aWsEvent);
+int HandleWsEvent(SDL_VideoDevice *_this, const TWsEvent &aWsEvent);
 
-void NGAGE_PumpEvents(_THIS)
+void NGAGE_PumpEvents(SDL_VideoDevice *_this)
 {
     SDL_VideoData *phdata = _this->driverdata;
 
@@ -63,12 +63,12 @@ void NGAGE_PumpEvents(_THIS)
 #include <bautils.h>
 #include <hal.h>
 
-extern void DisableKeyBlocking(_THIS);
-extern void RedrawWindowL(_THIS);
+extern void DisableKeyBlocking(SDL_VideoDevice *_this);
+extern void RedrawWindowL(SDL_VideoDevice *_this);
 
 TBool isCursorVisible = EFalse;
 
-static SDL_Scancode ConvertScancode(_THIS, int key)
+static SDL_Scancode ConvertScancode(SDL_VideoDevice *_this, int key)
 {
     SDL_Keycode keycode;
 
@@ -147,7 +147,7 @@ static SDL_Scancode ConvertScancode(_THIS, int key)
     return SDL_GetScancodeFromKey(keycode);
 }
 
-int HandleWsEvent(_THIS, const TWsEvent &aWsEvent)
+int HandleWsEvent(SDL_VideoDevice *_this, const TWsEvent &aWsEvent)
 {
     SDL_VideoData *phdata = _this->driverdata;
     int posted = 0;

+ 1 - 1
src/video/ngage/SDL_ngageevents_c.h

@@ -23,4 +23,4 @@
 
 #include "SDL_ngagevideo.h"
 
-extern void NGAGE_PumpEvents(_THIS);
+extern void NGAGE_PumpEvents(SDL_VideoDevice *_this);

+ 11 - 11
src/video/ngage/SDL_ngageframebuffer.cpp

@@ -39,12 +39,12 @@
 static TUint32 NGAGE_HWPalette_256_to_Screen[256];
 
 int GetBpp(TDisplayMode displaymode);
-void DirectUpdate(_THIS, int numrects, SDL_Rect *rects);
-void DrawBackground(_THIS);
-void DirectDraw(_THIS, int numrects, SDL_Rect *rects, TUint16 *screenBuffer);
-void RedrawWindowL(_THIS);
+void DirectUpdate(SDL_VideoDevice *_this, int numrects, SDL_Rect *rects);
+void DrawBackground(SDL_VideoDevice *_this);
+void DirectDraw(SDL_VideoDevice *_this, int numrects, SDL_Rect *rects, TUint16 *screenBuffer);
+void RedrawWindowL(SDL_VideoDevice *_this);
 
-int SDL_NGAGE_CreateWindowFramebuffer(_THIS, SDL_Window *window, Uint32 *format, void **pixels, int *pitch)
+int SDL_NGAGE_CreateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window, Uint32 *format, void **pixels, int *pitch)
 {
     SDL_VideoData *phdata = _this->driverdata;
     SDL_Surface *surface;
@@ -143,7 +143,7 @@ int SDL_NGAGE_CreateWindowFramebuffer(_THIS, SDL_Window *window, Uint32 *format,
     return 0;
 }
 
-int SDL_NGAGE_UpdateWindowFramebuffer(_THIS, SDL_Window *window, const SDL_Rect *rects, int numrects)
+int SDL_NGAGE_UpdateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window, const SDL_Rect *rects, int numrects)
 {
     static int frame_number;
     SDL_Surface *surface;
@@ -166,7 +166,7 @@ int SDL_NGAGE_UpdateWindowFramebuffer(_THIS, SDL_Window *window, const SDL_Rect
     return 0;
 }
 
-void SDL_NGAGE_DestroyWindowFramebuffer(_THIS, SDL_Window *window)
+void SDL_NGAGE_DestroyWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window)
 {
     SDL_Surface *surface;
 
@@ -197,7 +197,7 @@ int GetBpp(TDisplayMode displaymode)
     return TDisplayModeUtils::NumDisplayModeBitsPerPixel(displaymode);
 }
 
-void DrawBackground(_THIS)
+void DrawBackground(SDL_VideoDevice *_this)
 {
     SDL_VideoData *phdata = _this->driverdata;
     /* Draw background */
@@ -206,7 +206,7 @@ void DrawBackground(_THIS)
     Mem::FillZ(screenBuffer, phdata->NGAGE_BytesPerScreen);
 }
 
-void DirectDraw(_THIS, int numrects, SDL_Rect *rects, TUint16 *screenBuffer)
+void DirectDraw(SDL_VideoDevice *_this, int numrects, SDL_Rect *rects, TUint16 *screenBuffer)
 {
     SDL_VideoData *phdata = _this->driverdata;
     SDL_Surface *screen = (SDL_Surface *)SDL_GetWindowData(_this->windows, NGAGE_SURFACE);
@@ -331,7 +331,7 @@ void DirectDraw(_THIS, int numrects, SDL_Rect *rects, TUint16 *screenBuffer)
     }
 }
 
-void DirectUpdate(_THIS, int numrects, SDL_Rect *rects)
+void DirectUpdate(SDL_VideoDevice *_this, int numrects, SDL_Rect *rects)
 {
     SDL_VideoData *phdata = _this->driverdata;
 
@@ -366,7 +366,7 @@ void DirectUpdate(_THIS, int numrects, SDL_Rect *rects)
     }
 }
 
-void RedrawWindowL(_THIS)
+void RedrawWindowL(SDL_VideoDevice *_this)
 {
     SDL_VideoData *phdata = _this->driverdata;
     SDL_Surface *screen = (SDL_Surface *)SDL_GetWindowData(_this->windows, NGAGE_SURFACE);

+ 3 - 3
src/video/ngage/SDL_ngageframebuffer_c.h

@@ -21,9 +21,9 @@
 
 #include "SDL_internal.h"
 
-extern int SDL_NGAGE_CreateWindowFramebuffer(_THIS, SDL_Window *window, Uint32 *format, void **pixels, int *pitch);
-extern int SDL_NGAGE_UpdateWindowFramebuffer(_THIS, SDL_Window *window, const SDL_Rect *rects, int numrects);
-extern void SDL_NGAGE_DestroyWindowFramebuffer(_THIS, SDL_Window *window);
+extern int SDL_NGAGE_CreateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window, Uint32 *format, void **pixels, int *pitch);
+extern int SDL_NGAGE_UpdateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window, const SDL_Rect *rects, int numrects);
+extern void SDL_NGAGE_DestroyWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window);
 
 /****************************************************************************/
 /* Runtime                                                                  */

+ 4 - 4
src/video/ngage/SDL_ngagevideo.cpp

@@ -47,8 +47,8 @@ extern "C" {
 #define NGAGEVID_DRIVER_NAME "ngage"
 
 /* Initialization/Query functions */
-static int NGAGE_VideoInit(_THIS);
-static void NGAGE_VideoQuit(_THIS);
+static int NGAGE_VideoInit(SDL_VideoDevice *_this);
+static void NGAGE_VideoQuit(SDL_VideoDevice *_this);
 
 /* NGAGE driver bootstrap functions */
 
@@ -141,7 +141,7 @@ VideoBootStrap NGAGE_bootstrap = {
     NGAGE_CreateDevice
 };
 
-int NGAGE_VideoInit(_THIS)
+int NGAGE_VideoInit(SDL_VideoDevice *_this)
 {
     SDL_DisplayMode mode;
 
@@ -158,7 +158,7 @@ int NGAGE_VideoInit(_THIS)
     return 0;
 }
 
-void NGAGE_VideoQuit(_THIS)
+void NGAGE_VideoQuit(SDL_VideoDevice *_this)
 {
 }
 

+ 1 - 1
src/video/ngage/SDL_ngagevideo.h

@@ -32,7 +32,7 @@
 #include <w32std.h>
 #include "bitdraw.h" // CFbsDrawDevice
 
-#define _THIS SDL_VideoDevice *_this
+#define SDL_VideoDevice *_this SDL_VideoDevice *_this
 
 struct SDL_VideoData
 {

+ 6 - 6
src/video/ngage/SDL_ngagewindow.cpp

@@ -29,10 +29,10 @@
 
 const TUint32 WindowClientHandle = 9210;
 
-void DisableKeyBlocking(_THIS);
-void ConstructWindowL(_THIS);
+void DisableKeyBlocking(SDL_VideoDevice *_this);
+void ConstructWindowL(SDL_VideoDevice *_this);
 
-int NGAGE_CreateWindow(_THIS, SDL_Window *window)
+int NGAGE_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window)
 {
     NGAGE_Window *ngage_window = (NGAGE_Window *)SDL_calloc(1, sizeof(NGAGE_Window));
 
@@ -57,7 +57,7 @@ int NGAGE_CreateWindow(_THIS, SDL_Window *window)
     return 0;
 }
 
-void NGAGE_DestroyWindow(_THIS, SDL_Window *window)
+void NGAGE_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
 {
     NGAGE_Window *ngage_window = (NGAGE_Window *)window->driverdata;
 
@@ -72,7 +72,7 @@ void NGAGE_DestroyWindow(_THIS, SDL_Window *window)
 /* Internal                                                                  */
 /*****************************************************************************/
 
-void DisableKeyBlocking(_THIS)
+void DisableKeyBlocking(SDL_VideoDevice *_this)
 {
     SDL_VideoData *phdata = _this->driverdata;
     TRawEvent event;
@@ -81,7 +81,7 @@ void DisableKeyBlocking(_THIS)
     phdata->NGAGE_WsSession.SimulateRawEvent(event);
 }
 
-void ConstructWindowL(_THIS)
+void ConstructWindowL(SDL_VideoDevice *_this)
 {
     SDL_VideoData *phdata = _this->driverdata;
     TInt error;

+ 2 - 2
src/video/ngage/SDL_ngagewindow.h

@@ -35,9 +35,9 @@ typedef struct
 } NGAGE_Window;
 
 extern int
-NGAGE_CreateWindow(_THIS, SDL_Window *window);
+NGAGE_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window);
 
 extern void
-NGAGE_DestroyWindow(_THIS, SDL_Window *window);
+NGAGE_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window);
 
 #endif /* SDL_ngagewindow */

+ 1 - 1
src/video/offscreen/SDL_offscreenevents.c

@@ -30,7 +30,7 @@
 #include "SDL_offscreenvideo.h"
 #include "SDL_offscreenevents_c.h"
 
-void OFFSCREEN_PumpEvents(_THIS)
+void OFFSCREEN_PumpEvents(SDL_VideoDevice *_this)
 {
     /* do nothing. */
 }

+ 1 - 1
src/video/offscreen/SDL_offscreenevents_c.h

@@ -20,4 +20,4 @@
 */
 #include "SDL_internal.h"
 
-extern void OFFSCREEN_PumpEvents(_THIS);
+extern void OFFSCREEN_PumpEvents(SDL_VideoDevice *_this);

+ 3 - 3
src/video/offscreen/SDL_offscreenframebuffer.c

@@ -27,7 +27,7 @@
 
 #define OFFSCREEN_SURFACE "_SDL_DummySurface"
 
-int SDL_OFFSCREEN_CreateWindowFramebuffer(_THIS, SDL_Window *window, Uint32 *format, void **pixels, int *pitch)
+int SDL_OFFSCREEN_CreateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window, Uint32 *format, void **pixels, int *pitch)
 {
     SDL_Surface *surface;
     const Uint32 surface_format = SDL_PIXELFORMAT_RGB888;
@@ -52,7 +52,7 @@ int SDL_OFFSCREEN_CreateWindowFramebuffer(_THIS, SDL_Window *window, Uint32 *for
     return 0;
 }
 
-int SDL_OFFSCREEN_UpdateWindowFramebuffer(_THIS, SDL_Window *window, const SDL_Rect *rects, int numrects)
+int SDL_OFFSCREEN_UpdateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window, const SDL_Rect *rects, int numrects)
 {
     static int frame_number;
     SDL_Surface *surface;
@@ -72,7 +72,7 @@ int SDL_OFFSCREEN_UpdateWindowFramebuffer(_THIS, SDL_Window *window, const SDL_R
     return 0;
 }
 
-void SDL_OFFSCREEN_DestroyWindowFramebuffer(_THIS, SDL_Window *window)
+void SDL_OFFSCREEN_DestroyWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window)
 {
     SDL_Surface *surface;
 

+ 3 - 3
src/video/offscreen/SDL_offscreenframebuffer_c.h

@@ -20,6 +20,6 @@
 */
 #include "SDL_internal.h"
 
-extern int SDL_OFFSCREEN_CreateWindowFramebuffer(_THIS, SDL_Window *window, Uint32 *format, void **pixels, int *pitch);
-extern int SDL_OFFSCREEN_UpdateWindowFramebuffer(_THIS, SDL_Window *window, const SDL_Rect *rects, int numrects);
-extern void SDL_OFFSCREEN_DestroyWindowFramebuffer(_THIS, SDL_Window *window);
+extern int SDL_OFFSCREEN_CreateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window, Uint32 *format, void **pixels, int *pitch);
+extern int SDL_OFFSCREEN_UpdateWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window, const SDL_Rect *rects, int numrects);
+extern void SDL_OFFSCREEN_DestroyWindowFramebuffer(SDL_VideoDevice *_this, SDL_Window *window);

+ 4 - 4
src/video/offscreen/SDL_offscreenopengles.c

@@ -28,7 +28,7 @@
 
 /* EGL implementation of SDL OpenGL support */
 
-int OFFSCREEN_GLES_LoadLibrary(_THIS, const char *path)
+int OFFSCREEN_GLES_LoadLibrary(SDL_VideoDevice *_this, const char *path)
 {
     int ret = SDL_EGL_LoadLibraryOnly(_this, path);
     if (ret != 0) {
@@ -55,7 +55,7 @@ int OFFSCREEN_GLES_LoadLibrary(_THIS, const char *path)
 }
 
 SDL_GLContext
-OFFSCREEN_GLES_CreateContext(_THIS, SDL_Window *window)
+OFFSCREEN_GLES_CreateContext(SDL_VideoDevice *_this, SDL_Window *window)
 {
     SDL_WindowData *offscreen_window = window->driverdata;
 
@@ -65,7 +65,7 @@ OFFSCREEN_GLES_CreateContext(_THIS, SDL_Window *window)
     return context;
 }
 
-int OFFSCREEN_GLES_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context)
+int OFFSCREEN_GLES_MakeCurrent(SDL_VideoDevice *_this, SDL_Window *window, SDL_GLContext context)
 {
     if (window) {
         EGLSurface egl_surface = window->driverdata->egl_surface;
@@ -75,7 +75,7 @@ int OFFSCREEN_GLES_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context)
     }
 }
 
-int OFFSCREEN_GLES_SwapWindow(_THIS, SDL_Window *window)
+int OFFSCREEN_GLES_SwapWindow(SDL_VideoDevice *_this, SDL_Window *window)
 {
     SDL_WindowData *offscreen_wind = window->driverdata;
 

+ 4 - 4
src/video/offscreen/SDL_offscreenopengles.h

@@ -34,10 +34,10 @@
 #define OFFSCREEN_GLES_SetSwapInterval SDL_EGL_SetSwapInterval
 #define OFFSCREEN_GLES_DeleteContext   SDL_EGL_DeleteContext
 
-extern int OFFSCREEN_GLES_LoadLibrary(_THIS, const char *path);
-extern SDL_GLContext OFFSCREEN_GLES_CreateContext(_THIS, SDL_Window *window);
-extern int OFFSCREEN_GLES_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context);
-extern int OFFSCREEN_GLES_SwapWindow(_THIS, SDL_Window *window);
+extern int OFFSCREEN_GLES_LoadLibrary(SDL_VideoDevice *_this, const char *path);
+extern SDL_GLContext OFFSCREEN_GLES_CreateContext(SDL_VideoDevice *_this, SDL_Window *window);
+extern int OFFSCREEN_GLES_MakeCurrent(SDL_VideoDevice *_this, SDL_Window *window, SDL_GLContext context);
+extern int OFFSCREEN_GLES_SwapWindow(SDL_VideoDevice *_this, SDL_Window *window);
 
 #endif /* SDL_VIDEO_DRIVER_OFFSCREEN && SDL_VIDEO_OPENGL_EGL */
 

+ 6 - 6
src/video/offscreen/SDL_offscreenvideo.c

@@ -39,9 +39,9 @@
 #define OFFSCREENVID_DRIVER_NAME "offscreen"
 
 /* Initialization/Query functions */
-static int OFFSCREEN_VideoInit(_THIS);
-static int OFFSCREEN_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode);
-static void OFFSCREEN_VideoQuit(_THIS);
+static int OFFSCREEN_VideoInit(SDL_VideoDevice *_this);
+static int OFFSCREEN_SetDisplayMode(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL_DisplayMode *mode);
+static void OFFSCREEN_VideoQuit(SDL_VideoDevice *_this);
 
 /* OFFSCREEN driver bootstrap functions */
 
@@ -96,7 +96,7 @@ VideoBootStrap OFFSCREEN_bootstrap = {
     OFFSCREEN_CreateDevice
 };
 
-int OFFSCREEN_VideoInit(_THIS)
+int OFFSCREEN_VideoInit(SDL_VideoDevice *_this)
 {
     SDL_DisplayMode mode;
 
@@ -113,12 +113,12 @@ int OFFSCREEN_VideoInit(_THIS)
     return 0;
 }
 
-static int OFFSCREEN_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
+static int OFFSCREEN_SetDisplayMode(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
 {
     return 0;
 }
 
-void OFFSCREEN_VideoQuit(_THIS)
+void OFFSCREEN_VideoQuit(SDL_VideoDevice *_this)
 {
 }
 

+ 2 - 2
src/video/offscreen/SDL_offscreenwindow.c

@@ -27,7 +27,7 @@
 
 #include "SDL_offscreenwindow.h"
 
-int OFFSCREEN_CreateWindow(_THIS, SDL_Window *window)
+int OFFSCREEN_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window)
 {
     SDL_WindowData *offscreen_window = (SDL_WindowData *)SDL_calloc(1, sizeof(SDL_WindowData));
 
@@ -68,7 +68,7 @@ int OFFSCREEN_CreateWindow(_THIS, SDL_Window *window)
     return 0;
 }
 
-void OFFSCREEN_DestroyWindow(_THIS, SDL_Window *window)
+void OFFSCREEN_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
 {
     SDL_WindowData *offscreen_window = window->driverdata;
 

+ 2 - 2
src/video/offscreen/SDL_offscreenwindow.h

@@ -33,7 +33,7 @@ struct SDL_WindowData
 #endif
 };
 
-extern int OFFSCREEN_CreateWindow(_THIS, SDL_Window *window);
-extern void OFFSCREEN_DestroyWindow(_THIS, SDL_Window *window);
+extern int OFFSCREEN_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window);
+extern void OFFSCREEN_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window);
 
 #endif /* SDL_offscreenwindow_h */

+ 5 - 5
src/video/ps2/SDL_ps2video.c

@@ -45,7 +45,7 @@
 
 /* PS2 driver bootstrap functions */
 
-static int PS2_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
+static int PS2_SetDisplayMode(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
 {
     return 0;
 }
@@ -55,7 +55,7 @@ static void PS2_DeleteDevice(SDL_VideoDevice *device)
     SDL_free(device);
 }
 
-static int PS2_CreateWindow(_THIS, SDL_Window *window)
+static int PS2_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window)
 {
     SDL_SetKeyboardFocus(window);
 
@@ -63,7 +63,7 @@ static int PS2_CreateWindow(_THIS, SDL_Window *window)
     return 0;
 }
 
-static int PS2_VideoInit(_THIS)
+static int PS2_VideoInit(SDL_VideoDevice *_this)
 {
     SDL_DisplayMode mode;
 
@@ -80,11 +80,11 @@ static int PS2_VideoInit(_THIS)
     return 1;
 }
 
-static void PS2_VideoQuit(_THIS)
+static void PS2_VideoQuit(SDL_VideoDevice *_this)
 {
 }
 
-static void PS2_PumpEvents(_THIS)
+static void PS2_PumpEvents(SDL_VideoDevice *_this)
 {
     /* do nothing. */
 }

+ 4 - 4
src/video/psp/SDL_pspevents.c

@@ -73,7 +73,7 @@ int EventUpdate(void *data)
     return 0;
 }
 
-void PSP_PumpEvents(_THIS)
+void PSP_PumpEvents(SDL_VideoDevice *_this)
 {
     int i;
     enum PspHprmKeys keys;
@@ -124,7 +124,7 @@ void PSP_PumpEvents(_THIS)
     return;
 }
 
-void PSP_InitOSKeymap(_THIS)
+void PSP_InitOSKeymap(SDL_VideoDevice *_this)
 {
 #ifdef PSPIRKEYB
     int i;
@@ -235,7 +235,7 @@ void PSP_InitOSKeymap(_THIS)
 #endif
 }
 
-int PSP_EventInit(_THIS)
+int PSP_EventInit(SDL_VideoDevice *_this)
 {
 #ifdef PSPIRKEYB
     int outputmode = PSP_IRKBD_OUTPUT_MODE_SCANCODE;
@@ -258,7 +258,7 @@ int PSP_EventInit(_THIS)
     return 0;
 }
 
-void PSP_EventQuit(_THIS)
+void PSP_EventQuit(SDL_VideoDevice *_this)
 {
     running = 0;
     SDL_WaitThread(thread, NULL);

+ 2 - 2
src/video/psp/SDL_pspevents_c.h

@@ -21,7 +21,7 @@
 
 #include "SDL_pspvideo.h"
 
-extern void PSP_InitOSKeymap(_THIS);
-extern void PSP_PumpEvents(_THIS);
+extern void PSP_InitOSKeymap(SDL_VideoDevice *_this);
+extern void PSP_PumpEvents(SDL_VideoDevice *_this);
 
 /* end of SDL_pspevents_c.h ... */

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است