aboutsummaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
Diffstat (limited to 'ui')
-rw-r--r--ui/gtk.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/ui/gtk.c b/ui/gtk.c
index 1537751afa..ad4910c70d 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -230,6 +230,8 @@ struct GtkDisplayState {
bool modifier_pressed[ARRAY_SIZE(modifier_keycode)];
bool ignore_keys;
+
+ DisplayOptions *opts;
};
typedef struct VCChardev {
@@ -778,9 +780,14 @@ static gboolean gd_window_close(GtkWidget *widget, GdkEvent *event,
void *opaque)
{
GtkDisplayState *s = opaque;
+ bool allow_close = true;
int i;
- if (!no_quit) {
+ if (s->opts->has_window_close && !s->opts->window_close) {
+ allow_close = false;
+ }
+
+ if (allow_close) {
for (i = 0; i < s->nb_vcs; i++) {
if (s->vc[i].type != GD_VC_GFX) {
continue;
@@ -2290,7 +2297,7 @@ static void gd_create_menus(GtkDisplayState *s)
static gboolean gtkinit;
-void gtk_display_init(DisplayState *ds, bool full_screen, bool grab_on_hover)
+void gtk_display_init(DisplayState *ds, DisplayOptions *opts)
{
VirtualConsole *vc;
@@ -2302,6 +2309,8 @@ void gtk_display_init(DisplayState *ds, bool full_screen, bool grab_on_hover)
fprintf(stderr, "gtk initialization failed\n");
exit(1);
}
+ assert(opts->type == DISPLAY_TYPE_GTK);
+ s->opts = opts;
#if !GTK_CHECK_VERSION(3, 0, 0)
g_printerr("Running QEMU with GTK 2.x is deprecated, and will be removed\n"
@@ -2388,15 +2397,17 @@ void gtk_display_init(DisplayState *ds, bool full_screen, bool grab_on_hover)
vc && vc->type == GD_VC_VTE);
#endif
- if (full_screen) {
+ if (opts->has_full_screen &&
+ opts->full_screen) {
gtk_menu_item_activate(GTK_MENU_ITEM(s->full_screen_item));
}
- if (grab_on_hover) {
+ if (opts->u.gtk.has_grab_on_hover &&
+ opts->u.gtk.grab_on_hover) {
gtk_menu_item_activate(GTK_MENU_ITEM(s->grab_on_hover_item));
}
}
-void early_gtk_display_init(int opengl)
+void early_gtk_display_init(DisplayOptions *opts)
{
/* The QEMU code relies on the assumption that it's always run in
* the C locale. Therefore it is not prepared to deal with
@@ -2422,11 +2433,8 @@ void early_gtk_display_init(int opengl)
return;
}
- switch (opengl) {
- case -1: /* default */
- case 0: /* off */
- break;
- case 1: /* on */
+ assert(opts->type == DISPLAY_TYPE_GTK);
+ if (opts->has_gl && opts->gl) {
#if defined(CONFIG_OPENGL)
#if defined(CONFIG_GTK_GL)
gtk_gl_area_init();
@@ -2434,10 +2442,6 @@ void early_gtk_display_init(int opengl)
gtk_egl_init();
#endif
#endif
- break;
- default:
- g_assert_not_reached();
- break;
}
keycode_map = gd_get_keymap(&keycode_maplen);