qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ui/sdl2: Allow host to power down screen
@ 2024-05-12  9:59 Bernhard Beschow
  2024-05-13  8:30 ` Marc-André Lureau
  2024-05-17 10:20 ` Daniel P. Berrangé
  0 siblings, 2 replies; 3+ messages in thread
From: Bernhard Beschow @ 2024-05-12  9:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: Marc-André Lureau, Gerd Hoffmann, 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.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
 ui/sdl2.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ui/sdl2.c b/ui/sdl2.c
index 4971963f00..0a0eb5a42d 100644
--- a/ui/sdl2.c
+++ b/ui/sdl2.c
@@ -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



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ui/sdl2: Allow host to power down screen
  2024-05-12  9:59 [PATCH] ui/sdl2: Allow host to power down screen Bernhard Beschow
@ 2024-05-13  8:30 ` Marc-André Lureau
  2024-05-17 10:20 ` Daniel P. Berrangé
  1 sibling, 0 replies; 3+ messages in thread
From: Marc-André Lureau @ 2024-05-13  8:30 UTC (permalink / raw)
  To: Bernhard Beschow; +Cc: qemu-devel, Gerd Hoffmann

On Sun, May 12, 2024 at 2:00 PM Bernhard Beschow <shentey@gmail.com> wrote:
>
> 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.
>
> Signed-off-by: Bernhard Beschow <shentey@gmail.com>

Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com>

> ---
>  ui/sdl2.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/ui/sdl2.c b/ui/sdl2.c
> index 4971963f00..0a0eb5a42d 100644
> --- a/ui/sdl2.c
> +++ b/ui/sdl2.c
> @@ -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
>



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ui/sdl2: Allow host to power down screen
  2024-05-12  9:59 [PATCH] ui/sdl2: Allow host to power down screen Bernhard Beschow
  2024-05-13  8:30 ` Marc-André Lureau
@ 2024-05-17 10:20 ` Daniel P. Berrangé
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel P. Berrangé @ 2024-05-17 10:20 UTC (permalink / raw)
  To: Bernhard Beschow
  Cc: qemu-devel, Marc-André Lureau, Gerd Hoffmann, qemu-stable

Cc stable - candidate for backport perhaps.

On Sun, May 12, 2024 at 11:59:45AM +0200, Bernhard Beschow wrote:
> 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.
> 
> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> ---
>  ui/sdl2.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/ui/sdl2.c b/ui/sdl2.c
> index 4971963f00..0a0eb5a42d 100644
> --- a/ui/sdl2.c
> +++ b/ui/sdl2.c
> @@ -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
> 
> 

With regards,
Daniel
-- 
|: 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 :|



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-05-17 10:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-12  9:59 [PATCH] ui/sdl2: Allow host to power down screen Bernhard Beschow
2024-05-13  8:30 ` Marc-André Lureau
2024-05-17 10:20 ` Daniel P. Berrangé

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).