diff options
author | Paul Colomiets <paul@colomiets.name> | 2011-07-02 18:51:58 +0300 |
---|---|---|
committer | Paul Colomiets <paul@colomiets.name> | 2011-07-02 18:51:58 +0300 |
commit | cd54fab7778c11606e915d2eebceeba8bc9a46fa (patch) | |
tree | 197332796ba1ea3d245ad65eee6817d378d3f797 | |
parent | 77dcee2aa32ca9ac348043b617b9722846adc9c1 (diff) |
Ensures that UZBL_URI is set when window is mapped
This will help window manager to sort windows when they are mapped,
instead of moving them back and forth when they are already shown. This
is theoretically incurs tiny delay of showing window, but it's shown
before main loop is started anyway, and you can't see anything useful
before, so the delay is negligible.
-rw-r--r-- | src/uzbl-core.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/src/uzbl-core.c b/src/uzbl-core.c index 1820623..91729f9 100644 --- a/src/uzbl-core.c +++ b/src/uzbl-core.c @@ -1545,7 +1545,7 @@ settings_init () { State* s = &uzbl.state; Network* n = &uzbl.net; int i; - + /* Load default config */ for (i = 0; default_config[i].command != NULL; i++) { parse_cmd_line(default_config[i].command, NULL); @@ -1751,7 +1751,7 @@ initialize(int argc, char** argv) { fprintf(stderr, "uzbl: error hooking %d: %s\n", SIGALRM, strerror(errno)); event_buffer_timeout(10); - + /* HTTP client */ uzbl.net.soup_session = webkit_get_default_session(); uzbl.net.soup_cookie_jar = uzbl_cookie_jar_new(); @@ -1810,6 +1810,15 @@ load_uri_imp(gchar *uri) { soup_uri_free(soup_uri); } + gdk_property_change( + gtk_widget_get_window (GTK_WIDGET (uzbl.gui.main_window)), + gdk_atom_intern_static_string("UZBL_URI"), + gdk_atom_intern_static_string("STRING"), + 8, + GDK_PROP_MODE_REPLACE, + (unsigned char *)newuri->str, + newuri->len); + /* if we do handle cookies, ask our handler for them */ webkit_web_view_load_uri (uzbl.gui.web_view, newuri->str); g_string_free (newuri, TRUE); @@ -1826,7 +1835,6 @@ main (int argc, char* argv[]) { if (uzbl.state.plug_mode) { 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 no unique id and thus * socket/fifo names aren't unique either. * we use a custom randomizer to create a random id @@ -1836,12 +1844,13 @@ main (int argc, char* argv[]) { srand((unsigned int)tv.tv_sec*tv.tv_usec); uzbl.xwin = rand(); } - + /* Windowed mode */ else { uzbl.gui.main_window = create_window(); gtk_container_add (GTK_CONTAINER (uzbl.gui.main_window), uzbl.gui.vbox); - gtk_widget_show_all (uzbl.gui.main_window); + /* We need to ensure there is a window, before we can get XID */ + gtk_widget_realize (GTK_WIDGET (uzbl.gui.main_window)); uzbl.xwin = GDK_WINDOW_XID (gtk_widget_get_window (GTK_WIDGET (uzbl.gui.main_window))); @@ -1910,6 +1919,13 @@ main (int argc, char* argv[]) { g_free(uri_override); } + /* Finally show the window */ + if (uzbl.gui.main_window) { + gtk_widget_show_all (uzbl.gui.main_window); + } else { + gtk_widget_show_all (GTK_WIDGET (uzbl.gui.plug)); + } + /* Verbose feedback */ if (uzbl.state.verbose) { printf("Uzbl start location: %s\n", argv[0]); |