Skip to contentSkip to conversation

ui/sdl2: Fix broken -full-screen CLI option

PATCH In review Thomas Huth 2 participants 3 messages Jul 9, 2018 – Aug 21, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ui/sdl2: Fix broken -full-screen CLI option

We've got to set the gui_fullscreen variable before creating the SDL2 window, otherwise the initial window will not be created in fullscreen mode.

---
 ui/sdl2.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
ui/sdl2.c +4 -5
index 76e5942..01571dc 100644
@@ -792,6 +792,8 @@ static void sdl2_display_init(DisplayState *ds, DisplayOptions *o)
     memset(&info, 0, sizeof(info));
     SDL_VERSION(&info.version);
 
+    gui_fullscreen = o->has_full_screen && o->full_screen;
+
     for (i = 0;; i++) {
         QemuConsole *con = qemu_console_lookup_by_index(i);
         if (!con) {
@@ -844,17 +846,14 @@ static void sdl2_display_init(DisplayState *ds, DisplayOptions *o)
         g_free(filename);
     }
 
-    if (sdl2_console->opts->has_full_screen &&
-        sdl2_console->opts->full_screen) {
-        gui_fullscreen = 1;
+    gui_grab = 0;
+    if (gui_fullscreen) {
         sdl_grab_start(0);
     }
 
     mouse_mode_notifier.notify = sdl_mouse_mode_change;
     qemu_add_mouse_mode_change_notifier(&mouse_mode_notifier);
 
-    gui_grab = 0;
-
     sdl_cursor_hidden = SDL_CreateCursor(&data, &data, 8, 1, 0, 0);
     sdl_cursor_normal = SDL_GetCursor();
 
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 34 lines · Thomas Huth

We've got to set the gui_fullscreen variable before creating the SDL2 window, otherwise the initial window will not be created in fullscreen mode.

---
 ui/sdl2.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
ui/sdl2.c +4 -3
index 76e5942..01571dc 100644
@@ -792,6 +792,8 @@ static void sdl2_display_init(DisplayState *ds, DisplayOptions *o)
     memset(&info, 0, sizeof(info));
     SDL_VERSION(&info.version);
 
+    gui_fullscreen = o->has_full_screen && o->full_screen;
+
     for (i = 0;; i++) {
         QemuConsole *con = qemu_console_lookup_by_index(i);
         if (!con) {
@@ -844,17 +846,14 @@ static void sdl2_display_init(DisplayState *ds, DisplayOptions *o)
         g_free(filename);
     }
 
-    if (sdl2_console->opts->has_full_screen &&
-        sdl2_console->opts->full_screen) {
-        gui_fullscreen = 1;
+    gui_grab = 0;
+    if (gui_fullscreen) {
         sdl_grab_start(0);

ui/sdl2.c static void sdl2_display_init(DisplayState *ds, DisplayOptions *o) · line 859

Quoted 10 lines
ui/sdl2.c +0 -2
     }
 
     mouse_mode_notifier.notify = sdl_mouse_mode_change;
     qemu_add_mouse_mode_change_notifier(&mouse_mode_notifier);
 
-    gui_grab = 0;
-
     sdl_cursor_hidden = SDL_CreateCursor(&data, &data, 8, 1, 0, 0);
     sdl_cursor_normal = SDL_GetCursor();
 

Ping?

Thomas

#2 lore raw
In reply to Thomas Huth
Quoted 3 lines · Thomas Huth

We've got to set the gui_fullscreen variable before creating the SDL2 window, otherwise the initial window will not be created in fullscreen mode.

Added to ui queue.

thanks,
Gerd