summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hofmann <scm@uninformativ.de>2014-06-15 06:01:58 +0200
committerPeter Hofmann <scm@uninformativ.de>2014-06-15 06:01:58 +0200
commitbbf7c49ff2e37dd206d0461ec3fac6f2bc394e12 (patch)
tree112286d1f94e8f67fa476af323f594a2606dbfed
parentedb6f6794f34543e9a734b30384d7a8ceb6cb465 (diff)
downloadlariza-bbf7c49ff2e37dd206d0461ec3fac6f2bc394e12.tar.gz
Deal with embedding failures
Now, that's a real issue. :-)
-rw-r--r--zea.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/zea.c b/zea.c
index 6ffe994..845b37e 100644
--- 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. */