aboutsummaryrefslogtreecommitdiffhomepage
path: root/uzbl-core.c
diff options
context:
space:
mode:
authorGravatar Rob <rob.manea@gmail.com>2009-11-04 22:26:23 +0100
committerGravatar Rob <rob.manea@gmail.com>2009-11-04 22:26:23 +0100
commit57d0dd0f6bfc39a1f0624d6027a9cbb92a503ea5 (patch)
treef4bad6ae37b76ab9c3c20c7382e211c812807599 /uzbl-core.c
parentd9b8be00c5a7799e6d3f7be90679a1f12b1cc24b (diff)
generate random id for sockets/fifos in xembed mode
Diffstat (limited to 'uzbl-core.c')
-rw-r--r--uzbl-core.c16
1 files changed, 14 insertions, 2 deletions
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);