Commit ee52ad08cdfcab03450e6a04f2e5e84a4b253f9e

Ethan Lee 2022-03-24T15:32:25

wayland: Minor fixes for old compilers

diff --git a/src/video/wayland/SDL_waylandvideo.c b/src/video/wayland/SDL_waylandvideo.c
index 9ceb9aa..6a55e7b 100644
--- a/src/video/wayland/SDL_waylandvideo.c
+++ b/src/video/wayland/SDL_waylandvideo.c
@@ -640,7 +640,8 @@ Wayland_free_display(uint32_t id)
 static void
 Wayland_init_xdg_output(SDL_VideoData *d)
 {
-    for (SDL_WaylandOutputData *node = (SDL_WaylandOutputData*)d->output_list; node != NULL; node = (SDL_WaylandOutputData*)node->next) {
+    SDL_WaylandOutputData *node;
+    for (node = (SDL_WaylandOutputData*)d->output_list; node != NULL; node = (SDL_WaylandOutputData*)node->next) {
         node->xdg_output = zxdg_output_manager_v1_get_xdg_output(node->videodata->xdg_output_manager, node->output);
         zxdg_output_v1_add_listener(node->xdg_output, &xdg_output_listener, node);
     }
diff --git a/src/video/wayland/SDL_waylandvideo.h b/src/video/wayland/SDL_waylandvideo.h
index cab8aca..c3a8c13 100644
--- a/src/video/wayland/SDL_waylandvideo.h
+++ b/src/video/wayland/SDL_waylandvideo.h
@@ -47,6 +47,8 @@ typedef struct {
     int size;
 } SDL_WaylandCursorTheme;
 
+typedef struct SDL_WaylandOutputData SDL_WaylandOutputData;
+
 typedef struct {
     SDL_bool initializing;
     struct wl_display *display;
@@ -80,7 +82,7 @@ typedef struct {
     struct xkb_context *xkb_context;
     struct SDL_WaylandInput *input;
     struct SDL_WaylandTabletManager *tablet_manager;
-    struct SDL_WaylandOutputData *output_list;
+    SDL_WaylandOutputData *output_list;
 
 #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
     struct SDL_WaylandTouch *touch;
@@ -93,7 +95,7 @@ typedef struct {
     int relative_mouse_mode;
 } SDL_VideoData;
 
-typedef struct {
+struct SDL_WaylandOutputData {
     SDL_VideoData *videodata;
     struct wl_output *output;
     struct zxdg_output_v1 *xdg_output;
@@ -106,8 +108,8 @@ typedef struct {
     int index;
     SDL_VideoDisplay placeholder;
     int wl_output_done_count;
-    struct SDL_WaylandOutputData *next;
-} SDL_WaylandOutputData;
+    SDL_WaylandOutputData *next;
+};
 
 /* Needed here to get wl_surface declaration, fixes GitHub#4594 */
 #include "SDL_waylanddyn.h"