Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

identify the game by its name in SDL #1503

Merged
merged 1 commit into from
Jan 17, 2025

Conversation

cu-kai
Copy link
Contributor

@cu-kai cu-kai commented Jan 16, 2025

The comment in the code is pretty self explanatory. This has been tested on KDE only.

Screenshots demonstrating what this fixes are below. I do not believe this has any effect on macOS or Windows, documentation suggests this relates to dbus. Hopefully I have done this correctly.

Documentation here:
https://discourse.libsdl.org/t/sdl-add-sdl-hint-app-name-and-dbus-inhibition-hint/32698
https://wiki.libsdl.org/SDL2/SDL_HINT_APP_NAME

OLD:
old

NEW:
new

@illwieckz
Copy link
Member

/usr/bin/clang++ -DARCH_STRING=amd64 -DBUILD_ENGINE -DBUILD_TTY_CLIENT -DDAEMON_ARCH_amd64 -DDAEMON_BUILD_Release -DDAEMON_CXX_COMPILER_Clang=1 -DDAEMON_CXX_COMPILER_STRING="Clang 11.0.0 clang++" -DDAEMON_C_COMPILER_Clang=1 -DDAEMON_C_COMPILER_STRING="Clang 11.0.0 clang" -DDAEMON_OpenGL_ABI=LEGACY -DDAEMON_OpenGL_ABI_LEGACY -DDAEMON_USE_ARCH_INTRINSICS=1 -DDAEMON_USE_ARCH_INTRINSICS_amd64=1 -DDAEMON_USE_ARCH_INTRINSICS_i686=1 -DDAEMON_USE_COMPILER_CUSTOMIZATION=1 -DDAEMON_USE_COMPILER_INTRINSICS=1 -DNACL_ANDROID=0 -DNACL_ARCH_STRING=amd64 -DNACL_BUILD_ARCH=x86 -DNACL_BUILD_SUBARCH=64 -DNACL_FREEBSD=0 -DNACL_LINUX=1 -DNACL_OSX=0 -DNACL_WINDOWS=0 -DTHIS_IS_NOT_A_DEBUG_BUILD -DUSE_CURSES -DUSE_CURSES_NCURSES -DUSE_MUMBLE -I/home/vsts/work/1/s/src -I/home/vsts/work/1/s/libs -I/home/vsts/work/1/s/libs/nacl -I/usr/include/ncursesw -I/usr/include/SDL2 -I/usr/include/opus -I/usr/include/freetype2 -I/usr/include/AL -I/home/vsts/work/1/s/src/engine -std=gnu++14 -ffast-math -fvisibility=hidden -fno-strict-aliasing -pthread -march=x86-64 -mtune=generic -mcx16 -O3 -DNDEBUG -D_FORTIFY_SOURCE=2 -Wall -Wextra -Werror -Wno-pragmas -Wno-unknown-pragmas -Wno-error=old-style-cast -Woverloaded-virtual -Wno-error=sign-compare -MD -MT CMakeFiles/ttyclient.dir/src/engine/client/ClientApplication.cpp.o -MF CMakeFiles/ttyclient.dir/src/engine/client/ClientApplication.cpp.o.d -o CMakeFiles/ttyclient.dir/src/engine/client/ClientApplication.cpp.o -c /home/vsts/work/1/s/src/engine/client/ClientApplication.cpp
/home/vsts/work/1/s/src/engine/client/ClientApplication.cpp:95:25: error: use of undeclared identifier 'SDL_HINT_APP_NAME'
            SDL_SetHint(SDL_HINT_APP_NAME, PRODUCT_NAME);
                        ^
1 error generated.

The SDL used in the CI (and then in possible users's computer) is probably too old, we may ifdef the SDL version too.

@slipher
Copy link
Member

slipher commented Jan 16, 2025

Or just write the string literal for SDL_HINT_APP_NAME instead of using the macro

@cu-kai cu-kai force-pushed the cu-kai/sdlhintname branch 4 times, most recently from 74b37c8 to 2692589 Compare January 17, 2025 01:28
@cu-kai
Copy link
Contributor Author

cu-kai commented Jan 17, 2025

So now I check for SDL 2.0.22 as that is where this feature was introduced. Also made sure I don't try to reference SDL in the TTY build, oops. I've left some comments explaining what this does and why the version is checked.

@slipher
Copy link
Member

slipher commented Jan 17, 2025

Might that fix Unvanquished/Unvanquished#1384 ?

@cu-kai cu-kai force-pushed the cu-kai/sdlhintname branch from 2692589 to c90bb13 Compare January 17, 2025 11:25
@cu-kai
Copy link
Contributor Author

cu-kai commented Jan 17, 2025

Might that fix Unvanquished/Unvanquished#1384 ?

No, I rather suspect this is a different problem.

@slipher
Copy link
Member

slipher commented Jan 17, 2025

LGTM

Might that fix Unvanquished/Unvanquished#1384 ?

No, I rather suspect this is a different problem.

Maybe if SDL is < 2.022 it does not set anything for this and the KDE thing defaults to using the application name but if you have the newer version, SDL sets "My SDL Application".

@cu-kai
Copy link
Contributor Author

cu-kai commented Jan 17, 2025

LGTM

Might that fix Unvanquished/Unvanquished#1384 ?

No, I rather suspect this is a different problem.

Maybe if SDL is < 2.022 it does not set anything for this and the KDE thing defaults to using the application name but if you have the newer version, SDL sets "My SDL Application".

Looks like old versions of SDL simply don't block sleep. I don't get any sleep blockage when running the 0.55.2 release daemon. I also can't use wayland mode for that version: Warn: SDL_Init( SDL_INIT_VIDEO ) failed: wayland not available

@cu-kai cu-kai merged commit b8e7775 into DaemonEngine:master Jan 17, 2025
9 checks passed
@cu-kai cu-kai deleted the cu-kai/sdlhintname branch January 17, 2025 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants