Skip to content

Commit 65a8b21

Browse files
committed
sdl_glimp: properly set the APPID the SDL3 way, drop the SDL2 setting
- Drop the SDL2 way of doing things. - The SDL3 environment variable wasn't SDL_HINT_APP_ID but SDL_APP_ID. - For some reasons SetEnv() doesn't work (SDL3 bug?) - We can use SDL_SetAppMetadataProperty() instead, and it works. - We can probably don't have to care about being on X11/Wayland or not. - Use SDL_SetAppMetadataProperty() for other things too.
1 parent 7d11074 commit 65a8b21

File tree

2 files changed

+6
-22
lines changed

2 files changed

+6
-22
lines changed

src/engine/client/ClientApplication.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -80,19 +80,6 @@ class ClientApplication : public Application {
8080
}
8181

8282
void Initialize() override {
83-
#if defined(__linux__) && defined(BUILD_GRAPHICAL_CLIENT)
84-
// identify the game by its name in certain
85-
// volume control / power control applets,
86-
// for example, the one found on KDE:
87-
// "Unvanquished is currently blocking sleep."
88-
// instead of "My SDL application ..."
89-
// this feature was introduced in SDL 2.0.22
90-
SDL_SetHint("SDL_APP_NAME", PRODUCT_NAME);
91-
// SDL_hints.h: #define SDL_HINT_APP_NAME "SDL_APP_NAME"
92-
// don't use the macro here, in case
93-
// SDL doesn't use current headers.
94-
#endif
95-
9683
Hunk_Init();
9784

9885
Com_Init();

src/engine/sys/sdl_glimp.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1722,19 +1722,16 @@ GLimp_StartDriverAndSetMode
17221722
*/
17231723
static rserr_t GLimp_StartDriverAndSetMode( int mode, bool fullscreen, bool bordered )
17241724
{
1725-
#if !defined(_WIN32) && !defined(__APPLE__)
1725+
// See the SDL wiki page for details: https://wiki.libsdl.org/SDL3/SDL_SetAppMetadataProperty
1726+
SDL_SetAppMetadataProperty( SDL_PROP_APP_METADATA_NAME_STRING, PRODUCT_NAME );
1727+
SDL_SetAppMetadataProperty( SDL_PROP_APP_METADATA_VERSION_STRING, PRODUCT_VERSION );
1728+
SDL_SetAppMetadataProperty( SDL_PROP_APP_METADATA_TYPE_STRING, "game" );
1729+
17261730
/* Let X11 and Wayland desktops (Linux, FreeBSD…) associate the game
17271731
window with the XDG .desktop file, with the proper name and icon.
17281732
The .desktop file should have PRODUCT_APPID as base name or set the
17291733
StartupWMClass variable to PRODUCT_APPID. */
1730-
1731-
// SDL2.
1732-
Sys::SetEnv( "SDL_VIDEO_X11_WMCLASS", PRODUCT_APPID );
1733-
Sys::SetEnv( "SDL_VIDEO_WAYLAND_WMCLASS", PRODUCT_APPID );
1734-
1735-
// SDL3.
1736-
Sys::SetEnv( "SDL_HINT_APP_ID", PRODUCT_APPID );
1737-
#endif
1734+
SDL_SetAppMetadataProperty( SDL_PROP_APP_METADATA_IDENTIFIER_STRING, PRODUCT_APPID );
17381735

17391736
if ( !SDL_WasInit( SDL_INIT_VIDEO ) )
17401737
{

0 commit comments

Comments
 (0)