gtk: don't exit early in case gtk init fails

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJVeVcVAAoJEEy22O7T6HE4lGIQAJGWoevzTq/xus79SgVqKacs
 PiDLrjeNA9NbbmzJYb2mjJ7IqcrX51NIBbUasxUrzncOk6yREfXszeVOXhD1Am//
 YNB5U1KVkE+HWakxW8krMjHrtw0DRli7kRGxLLuKhXsawCe0K/kZsk1OSt0bPFEW
 uz7K06krB+VnOIABnHRcnZdAZOMG8K30tDlltii3t7JOdVlS6RZXIFQ/d/rO+RdE
 EdWubGHI40TFN00M/+vxZxYLJoqgAcLZl5nE0bPO5NjyoXkMJDpZjNI0MBClmG/y
 w1N/WAGzTaI/Nxv99ka7LnAnQ18OSovVKQ5aLiHseWk4BzDfPRbr8+9Qb/HRyLrx
 9Y3acqtK3GlQj9XRS0FY3VKcauYoXLmpzgxGVd4HAcc7c5m05ccETGSZUaCNhjTx
 nQT5fMOvh5ldj2VK+NgTIefz4INW7myqdQYhuguQkvR+QNhy9ofscLGVLcINWYR2
 xLoBCGdRrLLHcYruAcqFJwEMaeq57eF83k7TbjU7LSAEN7UIarS7cD3l3DjaguGb
 Tl80r8bXVzF01hhfLPuuHt2WDTVn/gRZXlA6nhHCwZYUfCmUpdRgb+uVVojVyaGO
 094TemMcB+z2d18lDgFrKPtpWhm5nUPzb55KK94s4d27ZYf1cBeiy0ESfx+IPsyH
 VlvKQn4LWd11jSpMWj2q
 =UggW
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/kraxel/tags/pull-gtk-20150611-1' into staging

gtk: don't exit early in case gtk init fails

# gpg: Signature made Thu Jun 11 10:38:29 2015 BST using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/kraxel/tags/pull-gtk-20150611-1:
  gtk: don't exit early in case gtk init fails

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2015-06-11 11:18:11 +01:00
commit 39e16a5b70

View File

@ -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 */