SDL: add libdecor_dispatch

From e59cba95a0813c2536c3c932c360c47d00c26265 Mon Sep 17 00:00:00 2001
From: Christian Rauch <[EMAIL REDACTED]>
Date: Sat, 21 May 2022 13:50:56 +0100
Subject: [PATCH] add libdecor_dispatch

---
 src/video/wayland/SDL_waylanddyn.h    | 1 +
 src/video/wayland/SDL_waylandevents.c | 4 ++++
 src/video/wayland/SDL_waylandsym.h    | 1 +
 3 files changed, 6 insertions(+)

diff --git a/src/video/wayland/SDL_waylanddyn.h b/src/video/wayland/SDL_waylanddyn.h
index 3d8d973ccd4..43a3372d650 100644
--- a/src/video/wayland/SDL_waylanddyn.h
+++ b/src/video/wayland/SDL_waylanddyn.h
@@ -153,6 +153,7 @@ void SDL_WAYLAND_UnloadSymbols(void);
 #define libdecor_state_free (*WAYLAND_libdecor_state_free)
 #define libdecor_configuration_get_content_size (*WAYLAND_libdecor_configuration_get_content_size)
 #define libdecor_configuration_get_window_state (*WAYLAND_libdecor_configuration_get_window_state)
+#define libdecor_dispatch (*WAYLAND_libdecor_dispatch)
 #endif
 
 #else /* SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC */
diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c
index 80ef3fd987c..20fe6022e1e 100644
--- a/src/video/wayland/SDL_waylandevents.c
+++ b/src/video/wayland/SDL_waylandevents.c
@@ -294,6 +294,10 @@ Wayland_WaitEventTimeout(_THIS, int timeout)
         }
     }
 
+#ifdef HAVE_LIBDECOR_H
+    libdecor_dispatch(d->shell.libdecor, timeout);
+#endif
+
     /* wl_display_prepare_read() will return -1 if the default queue is not empty.
      * If the default queue is empty, it will prepare us for our SDL_IOReady() call. */
     if (WAYLAND_wl_display_prepare_read(d->display) == 0) {
diff --git a/src/video/wayland/SDL_waylandsym.h b/src/video/wayland/SDL_waylandsym.h
index a7a5a170c7e..0473fa1b179 100644
--- a/src/video/wayland/SDL_waylandsym.h
+++ b/src/video/wayland/SDL_waylandsym.h
@@ -204,6 +204,7 @@ SDL_WAYLAND_SYM(bool, libdecor_configuration_get_content_size, (struct libdecor_
                                                                 int *))
 SDL_WAYLAND_SYM(bool, libdecor_configuration_get_window_state, (struct libdecor_configuration *,\
                                                                 enum libdecor_window_state *))
+SDL_WAYLAND_SYM(bool, libdecor_dispatch, (struct libdecor *, int))
 #endif
 
 #undef SDL_WAYLAND_MODULE