From 57d0dd0f6bfc39a1f0624d6027a9cbb92a503ea5 Mon Sep 17 00:00:00 2001 From: Rob Date: Wed, 4 Nov 2009 22:26:23 +0100 Subject: generate random id for sockets/fifos in xembed mode --- uzbl-core.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'uzbl-core.c') diff --git a/uzbl-core.c b/uzbl-core.c index f6ff1ab..1e248f2 100644 --- a/uzbl-core.c +++ b/uzbl-core.c @@ -840,8 +840,12 @@ void event(WebKitWebView *page, GArray *argv, GString *result) { (void) page; (void) result; GString *event_name; - gchar **split = g_strsplit(argv_idx(argv, 0), " ", 2); - + gchar **split = NULL; + + if(!argv_idx(argv, 0)) + return; + + split = g_strsplit(argv_idx(argv, 0), " ", 2); if(split[0]) event_name = g_string_ascii_up(g_string_new(split[0])); else @@ -2404,6 +2408,14 @@ main (int argc, char* argv[]) { uzbl.gui.plug = create_plug (); gtk_container_add (GTK_CONTAINER (uzbl.gui.plug), uzbl.gui.vbox); gtk_widget_show_all (GTK_WIDGET (uzbl.gui.plug)); + /* in xembed mode the window has now unique id and thus + * sockets/fifos don't either. + * we use a custom randomizer to create a random id + */ + struct timeval tv; + gettimeofday(&tv, NULL); + srand((unsigned int)tv.tv_sec*tv.tv_usec); + uzbl.xwin = rand()%65536; } else { uzbl.gui.main_window = create_window (); gtk_container_add (GTK_CONTAINER (uzbl.gui.main_window), uzbl.gui.vbox); -- cgit v1.2.3