Skip to contentSkip to conversation

gtk: implement -full-screen

PATCH In review Peter Wu 3 participants 3 messages Jun 10, 2013 – Jun 11, 2013

lore
Share & tools
lore

Peter Wu

author
#0 lore raw

PATCH v2 1/1 gtk: implement -full-screen

Aiming for GTK as replacement for SDL, a feature like -full-screen should also be implemented.

Bringing the window into full-screen mode is done by activating the "Fullscreen" menu item. This is done after showing the windows to make the cursor and menu hidden.

v2: drop -no-frame implementation, use booleans instead of ints and ensure
consistency between ui state and menu.

---
 include/ui/console.h | 2 +-
 ui/gtk.c             | 6 +++++-
 vl.c                 | 2 +-
 3 files changed, 7 insertions(+), 3 deletions(-)
include/ui/console.h +1 -1
index 4307b5f..f1d79f9 100644
@@ -339,6 +339,6 @@ int index_from_keycode(int code);
 
 /* gtk.c */
 void early_gtk_display_init(void);
-void gtk_display_init(DisplayState *ds);
+void gtk_display_init(DisplayState *ds, bool full_screen);
 
 #endif
ui/gtk.c +5 -1
index 3bc2842..1c625c0 100644
@@ -1433,7 +1433,7 @@ static const DisplayChangeListenerOps dcl_ops = {
     .dpy_cursor_define = gd_cursor_define,
 };
 
-void gtk_display_init(DisplayState *ds)
+void gtk_display_init(DisplayState *ds, bool full_screen)
 {
     GtkDisplayState *s = g_malloc0(sizeof(*s));
     char *filename;
@@ -1509,6 +1509,10 @@ void gtk_display_init(DisplayState *ds)
 
     gtk_widget_show_all(s->window);
 
+    if (full_screen) {
+        gtk_menu_item_activate(GTK_MENU_ITEM(s->full_screen_item));
+    }
+
     register_displaychangelistener(&s->dcl);
 
     global_state = s;
vl.c +1 -1
index 47ab45d..cfd2d3e 100644
@@ -4347,7 +4347,7 @@ int main(int argc, char **argv, char **envp)
 #endif
 #if defined(CONFIG_GTK)
     case DT_GTK:
-        gtk_display_init(ds);
+        gtk_display_init(ds, full_screen);
         break;
 #endif
     default:
Signature · 1 line
1.8.3
Reviewed-by on v2 1/1
#1 lore raw
Quoted 11 lines · Peter Wu

Aiming for GTK as replacement for SDL, a feature like -full-screen should also be implemented.

Bringing the window into full-screen mode is done by activating the "Fullscreen" menu item. This is done after showing the windows to make the cursor and menu hidden.

v2: drop -no-frame implementation, use booleans instead of ints and ensure
consistency between ui state and menu.

Regards,

Anthony Liguori

Quoted 57 lines
---
 include/ui/console.h | 2 +-
 ui/gtk.c             | 6 +++++-
 vl.c                 | 2 +-
 3 files changed, 7 insertions(+), 3 deletions(-)
include/ui/console.h +1 -1
index 4307b5f..f1d79f9 100644
@@ -339,6 +339,6 @@ int index_from_keycode(int code);
 
 /* gtk.c */
 void early_gtk_display_init(void);
-void gtk_display_init(DisplayState *ds);
+void gtk_display_init(DisplayState *ds, bool full_screen);
 
 #endif
ui/gtk.c +5 -1
index 3bc2842..1c625c0 100644
@@ -1433,7 +1433,7 @@ static const DisplayChangeListenerOps dcl_ops = {
     .dpy_cursor_define = gd_cursor_define,
 };
 
-void gtk_display_init(DisplayState *ds)
+void gtk_display_init(DisplayState *ds, bool full_screen)
 {
     GtkDisplayState *s = g_malloc0(sizeof(*s));
     char *filename;
@@ -1509,6 +1509,10 @@ void gtk_display_init(DisplayState *ds)
 
     gtk_widget_show_all(s->window);
 
+    if (full_screen) {
+        gtk_menu_item_activate(GTK_MENU_ITEM(s->full_screen_item));
+    }
+
     register_displaychangelistener(&s->dcl);
 
     global_state = s;
vl.c +1 -1
index 47ab45d..cfd2d3e 100644
@@ -4347,7 +4347,7 @@ int main(int argc, char **argv, char **envp)
 #endif
 #if defined(CONFIG_GTK)
     case DT_GTK:
-        gtk_display_init(ds);
+        gtk_display_init(ds, full_screen);
         break;
 #endif
     default:
Signature · 1 line
1.8.3
#2 lore raw
In reply to Peter Wu
Quoted 9 lines · Peter Wu

Aiming for GTK as replacement for SDL, a feature like -full-screen should also be implemented.

Bringing the window into full-screen mode is done by activating the "Fullscreen" menu item. This is done after showing the windows to make the cursor and menu hidden.

v2: drop -no-frame implementation, use booleans instead of ints and ensure
consistency between ui state and menu.

Thanks, applied to the trivial-patches queue.

/mjt