gtk: don't exit early in case gtk init fails
PATCH 1/1 gtk: don't exit early in case gtk init fails
Signed-off-by Gerd Hoffmann <[email protected]>
--- ui/gtk.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
ui/gtk.c +12 -1
@@ -1917,12 +1917,19 @@ static void gd_set_keycode_type(GtkDisplayState *s)#endif } +static gboolean gtkinit; +void gtk_display_init (DisplayState *ds,bool full_screen,bool grab_on_hover) {GtkDisplayState *s =g_malloc0 (sizeof (*s));char *filename;GdkDisplay *window_display; +if (!gtkinit) { +fprintf (stderr,"gtk initialization failed\n" ); +exit (1 ); + } + s->window =gtk_window_new (GTK_WINDOW_TOPLEVEL );#if GTK_CHECK_VERSION (3 ,2 ,0 ) s->vbox =gtk_box_new (GTK_ORIENTATION_VERTICAL ,0 );
@@ -2003,7 +2010,11 @@ void gtk_display_init(DisplayState *ds, bool full_screen, bool grab_on_hover)void early_gtk_display_init (int opengl) { -gtk_init (NULL ,NULL ); + gtkinit =gtk_init_check (NULL ,NULL ); +if (!gtkinit) { +/* don't exit yet, that'll break -help */ +return ; + }switch (opengl) {case -1 :/* default */
Signature · 1 line
1.8.3.1
Quoted 4 lines · Gerd Hoffmann
Signed-off-by Gerd Hoffmann <[email protected]>--- ui/gtk.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
Reviewed-by Daniel P. Berrange <[email protected]>
Regards,
Daniel
Signature · 4 lines
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|