Skip to contentSkip to conversation

ui/sdl2: Allow host to power down screen

PATCH In review Bernhard Beschow 3 participants 3 messages May 12, 2024 – May 17, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ui/sdl2: Allow host to power down screen

By default, SDL disables the screen saver which prevents the host from powering down the screen even if the screen is locked. This results in draining the battery needlessly when the host isn't connected to a wall charger. Fix that by enabling the screen saver.

---
 ui/sdl2.c | 1 +
 1 file changed, 1 insertion(+)
ui/sdl2.c +1 -0
index 4971963f00..0a0eb5a42d 100644
@@ -874,6 +874,7 @@ static void sdl2_display_init(DisplayState *ds, DisplayOptions *o)
     SDL_SetHint(SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED, "0");
 #endif
     SDL_SetHint(SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4, "1");
+    SDL_EnableScreenSaver();
     memset(&info, 0, sizeof(info));
     SDL_VERSION(&info.version);
 
Signature · 1 line
2.45.0
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Bernhard Beschow

By default, SDL disables the screen saver which prevents the host from powering down the screen even if the screen is locked. This results in draining the battery needlessly when the host isn't connected to a wall charger. Fix that by enabling the screen saver.

Quoted 19 lines
---
 ui/sdl2.c | 1 +
 1 file changed, 1 insertion(+)
ui/sdl2.c +1 -1
index 4971963f00..0a0eb5a42d 100644
@@ -874,6 +874,7 @@ static void sdl2_display_init(DisplayState *ds, DisplayOptions *o)
     SDL_SetHint(SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED, "0");
 #endif
     SDL_SetHint(SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4, "1");
+    SDL_EnableScreenSaver();
     memset(&info, 0, sizeof(info));
     SDL_VERSION(&info.version);
 
--

2.45.0

#2 lore raw
In reply to Bernhard Beschow

Cc stable - candidate for backport perhaps.

Quoted 26 lines · Bernhard Beschow

By default, SDL disables the screen saver which prevents the host from powering down the screen even if the screen is locked. This results in draining the battery needlessly when the host isn't connected to a wall charger. Fix that by enabling the screen saver.

---
 ui/sdl2.c | 1 +
 1 file changed, 1 insertion(+)
ui/sdl2.c +1 -0
index 4971963f00..0a0eb5a42d 100644
@@ -874,6 +874,7 @@ static void sdl2_display_init(DisplayState *ds, DisplayOptions *o)
     SDL_SetHint(SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED, "0");
 #endif
     SDL_SetHint(SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4, "1");
+    SDL_EnableScreenSaver();
     memset(&info, 0, sizeof(info));
     SDL_VERSION(&info.version);
 
Signature · 1 line
2.45.0

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|