]> git.armaanb.net Git - chorizo.git/commitdiff
Deal with embedding failures
authorPeter Hofmann <scm@uninformativ.de>
Sun, 15 Jun 2014 04:01:58 +0000 (06:01 +0200)
committerPeter Hofmann <scm@uninformativ.de>
Sun, 15 Jun 2014 04:01:58 +0000 (06:01 +0200)
Now, that's a real issue. :-)

zea.c

diff --git a/zea.c b/zea.c
index 6ffe99431af5bc7bf91c60ed0dddea90d11c68f2..845b37efe9d58c4a1f080bd8c90a950174ae8e85 100644 (file)
--- a/zea.c
+++ b/zea.c
@@ -223,15 +223,22 @@ zea_new_client(const gchar *uri)
                exit(EXIT_FAILURE);
        }
 
-       if (embed == 0)
-       {
-               c->win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
-       }
-       else
+       c->win = NULL;
+       if (embed != 0)
        {
                c->win = gtk_plug_new(embed);
+               if (!gtk_plug_get_embedded(GTK_PLUG(c->win)))
+               {
+                       fprintf(stderr, "zea: Can't plug-in to XID %ld.\n", embed);
+                       gtk_widget_destroy(c->win);
+                       c->win = NULL;
+                       embed = 0;
+               }
        }
 
+       if (c->win == NULL)
+               c->win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+
        /* When using Gtk2, zea only shows a white area when run in
         * suckless' tabbed. It appears we need to set a default window size
         * for this to work. This is not needed when using Gtk3. */