diff mbox series

[2/7] sdl2: Do not quit the emulator when an auxilliary window is closed

Message ID 20171023210803.20998-3-makovick@gmail.com
State New
Headers show
Series [1/7] sdl2: Fix broken display updating after the window is hidden | expand

Commit Message

Jindřich Makovička Oct. 23, 2017, 9:07 p.m. UTC
---
 ui/sdl2.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

Comments

Gerd Hoffmann Nov. 1, 2017, 10:39 a.m. UTC | #1
On Mon, 2017-10-23 at 23:07 +0200, Jindrich Makovicka wrote:
> ---
>  ui/sdl2.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/ui/sdl2.c b/ui/sdl2.c
> index 7f51933234..aa37b39547 100644
> --- a/ui/sdl2.c
> +++ b/ui/sdl2.c
> @@ -566,9 +566,13 @@ static void handle_windowevent(SDL_Event *ev)
>          update_displaychangelistener(&scon->dcl, 500);
>          break;
>      case SDL_WINDOWEVENT_CLOSE:
> -        if (!no_quit) {
> -            no_shutdown = 0;
> -            qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_UI);
> +        if (qemu_console_is_graphic(scon->dcl.con)) {
> +            if (!no_quit) {
> +                no_shutdown = 0;
> +                qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_UI)
> ;
> +            }
> +        } else {
> +            SDL_HideWindow(scon->real_window);

scon->hidden should be update here.

>          }
>          break;
>      case SDL_WINDOWEVENT_SHOWN:
diff mbox series

Patch

diff --git a/ui/sdl2.c b/ui/sdl2.c
index 7f51933234..aa37b39547 100644
--- a/ui/sdl2.c
+++ b/ui/sdl2.c
@@ -566,9 +566,13 @@  static void handle_windowevent(SDL_Event *ev)
         update_displaychangelistener(&scon->dcl, 500);
         break;
     case SDL_WINDOWEVENT_CLOSE:
-        if (!no_quit) {
-            no_shutdown = 0;
-            qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_UI);
+        if (qemu_console_is_graphic(scon->dcl.con)) {
+            if (!no_quit) {
+                no_shutdown = 0;
+                qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_UI);
+            }
+        } else {
+            SDL_HideWindow(scon->real_window);
         }
         break;
     case SDL_WINDOWEVENT_SHOWN: