SDL: wayland: Don't create a new libdecor context if one already exists

From 6222bd3143073a325db6cea09eb622b976071a5e Mon Sep 17 00:00:00 2001
From: Ethan Lee <[EMAIL REDACTED]>
Date: Wed, 11 May 2022 16:26:43 -0400
Subject: [PATCH] wayland: Don't create a new libdecor context if one already
 exists

---
 src/video/wayland/SDL_waylandvideo.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/video/wayland/SDL_waylandvideo.c b/src/video/wayland/SDL_waylandvideo.c
index c7eaa6c8901..2992d52953d 100644
--- a/src/video/wayland/SDL_waylandvideo.c
+++ b/src/video/wayland/SDL_waylandvideo.c
@@ -908,6 +908,9 @@ SDL_bool
 Wayland_LoadLibdecor(SDL_VideoData *data, SDL_bool ignore_xdg)
 {
 #ifdef HAVE_LIBDECOR_H
+    if (data->shell.libdecor != NULL) {
+        return SDL_TRUE; /* Already loaded! */
+    }
     if (should_use_libdecor(data, ignore_xdg)) {
         data->shell.libdecor = libdecor_new(data->display, &libdecor_interface);
         return data->shell.libdecor != NULL;