SDL: Don't cleanup clipboard in SDL_SendClipboardUpdate on Wayland

From bb748ef2d90da7a8cd28a8a1aa6da8ade480fb6e Mon Sep 17 00:00:00 2001
From: hwsmm <[EMAIL REDACTED]>
Date: Tue, 25 Feb 2025 23:12:28 +0900
Subject: [PATCH] Don't cleanup clipboard in SDL_SendClipboardUpdate on Wayland

---
 src/events/SDL_clipboardevents.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/events/SDL_clipboardevents.c b/src/events/SDL_clipboardevents.c
index 96bfd041bc610..61b926bd75d21 100644
--- a/src/events/SDL_clipboardevents.c
+++ b/src/events/SDL_clipboardevents.c
@@ -30,7 +30,10 @@ void SDL_SendClipboardUpdate(bool owner, char **mime_types, size_t num_mime_type
 {
     if (!owner) {
         // Clear our internal clipboard contents when external clipboard is set
-        SDL_CancelClipboardData(0);
+        // Wayland: https://github.com/libsdl-org/SDL/issues/12152
+        if (SDL_strcmp(SDL_GetCurrentVideoDriver(), "wayland") != 0)
+            SDL_CancelClipboardData(0);
+
         SDL_SaveClipboardMimeTypes((const char **)mime_types, num_mime_types);
     }