I am using GNOME on Xorg. Normally, when I lock the screen, the display will
be turned off. Only when I move the mouse / press the keyboard, the display
will turn back on.
However, when I am running a SDL2 application and lock the screen, the display
turns off at first. However, after less than 1 minute, the display turns on by
itself. The display stays on even after waiting for a few minutes.
Way to reproduce (demo video: <https://youtu.be/Tfs2amLXogI>):
1. Switch to "GNOME on Xorg", the default for Debian is Wayland.
2. Open an SDL2 application. For example this bug is reproducible using
<https://gitlab.com/aminosbh/basic-c-sdl-game>. Can also reproduce this problem
using PPSSPP. My SDL version is 2.26.5.
3. Lock the screen using Super+L. See that the display is turned off.
4. Wait for a few minutes, notice that the display is turned on, even without
any user input. The display stays on forever.
Expected behavior:
4. The display should be off when there is no user input. (This is the behavior
of GNOME on Wayland).
Workaround: Use SDL_VIDEO_ALLOW_SCREENSAVER=1 to prevent SDL2 from disabling
screensaver.
Note: this bug is previously reported to SDL at <https://github.com/libsdl-
org/SDL/issues/8443>, but is considered likely a bug of GNOME.