From 41cf125f2eaee39f65f3c7ec2a04687fc22a082b Mon Sep 17 00:00:00 2001
From: David Gow <[EMAIL REDACTED]>
Date: Mon, 29 May 2023 16:02:54 +0800
Subject: [PATCH] Convert SDL_HINT_{X11,WAYLAND}_WMCLASS to SDL_HINT_APP_ID
These were unified and renamed in:
https://github.com/libsdl-org/SDL/pull/7741
---
src/sdl2_compat.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/src/sdl2_compat.c b/src/sdl2_compat.c
index e2b0b93..e0fd85d 100644
--- a/src/sdl2_compat.c
+++ b/src/sdl2_compat.c
@@ -398,6 +398,13 @@ SDL2_to_SDL3_hint(const char *name)
if (SDL3_strcmp(name, "SDL_AUDIODRIVER") == 0) {
return "SDL_AUDIO_DRIVER";
}
+ if (SDL3_strcmp(name, "SDL_VIDEO_X11_WMCLASS") == 0) {
+ return "SDL_APP_ID";
+ }
+ if (SDL3_strcmp(name, "SDL_VIDEO_WAYLAND_WMCLASS") == 0) {
+ return "SDL_APP_ID";
+ }
+
return name;
}
@@ -463,12 +470,20 @@ SDL2Compat_ApplyQuirks(SDL_bool force_x11)
*/
const char *videodriver_env = SDL3_getenv("SDL_VIDEODRIVER");
const char *audiodriver_env = SDL3_getenv("SDL_AUDIODRIVER");
+ const char *x11_wmclass_env = SDL3_getenv("SDL_VIDEO_X11_WMCLASS");
+ const char *wayland_wmclass_env = SDL3_getenv("SDL_VIDEO_WAYLAND_WMCLASS");
if (videodriver_env) {
SDL3_setenv("SDL_VIDEO_DRIVER", videodriver_env, 1);
}
if (audiodriver_env) {
SDL3_setenv("SDL_AUDIO_DRIVER", audiodriver_env, 1);
}
+ if (x11_wmclass_env) {
+ SDL3_setenv("SDL_APP_ID", x11_wmclass_env, 1);
+ }
+ if (wayland_wmclass_env) {
+ SDL3_setenv("SDL_APP_ID", wayland_wmclass_env, 1);
+ }
}
#ifdef __linux__