From 0111fe9f2ac1e72826fa42027280bc900e79ecc4 Mon Sep 17 00:00:00 2001 From: keis Date: Thu, 19 Aug 2010 20:04:45 +0200 Subject: configure to build with gtk+-3.0 --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index a995f76..0b99d21 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,10 @@ # first entries are for gnu make, 2nd for BSD make. see http://lists.uzbl.org/pipermail/uzbl-dev-uzbl.org/2009-July/000177.html -CFLAGS:=-std=c99 $(shell pkg-config --cflags gtk+-2.0 webkit-1.0 libsoup-2.4 gthread-2.0) -ggdb -Wall -W -DARCH="\"$(shell uname -m)\"" -lgthread-2.0 -DCOMMIT="\"$(shell ./misc/hash.sh)\"" $(CPPFLAGS) -fPIC -W -Wall -Wextra -pedantic -CFLAGS!=echo -std=c99 `pkg-config --cflags gtk+-2.0 webkit-1.0 libsoup-2.4 gthread-2.0` -ggdb -Wall -W -DARCH='"\""'`uname -m`'"\""' -lgthread-2.0 -DCOMMIT='"\""'`./misc/hash.sh`'"\""' $(CPPFLAGS) -fPIC -W -Wall -Wextra -pedantic +CFLAGS:=-std=c99 $(shell pkg-config --cflags gtk+-3.0 webkitgtk-3.0 libsoup-2.4 gthread-2.0) -ggdb -Wall -W -DARCH="\"$(shell uname -m)\"" -lgthread-2.0 -DCOMMIT="\"$(shell ./misc/hash.sh)\"" $(CPPFLAGS) -fPIC -W -Wall -Wextra -pedantic +CFLAGS!=echo -std=c99 `pkg-config --cflags gtk+-3.0 webkitgtk-3.0 libsoup-2.4 gthread-2.0` -ggdb -Wall -W -DARCH='"\""'`uname -m`'"\""' -lgthread-2.0 -DCOMMIT='"\""'`./misc/hash.sh`'"\""' $(CPPFLAGS) -fPIC -W -Wall -Wextra -pedantic -LDFLAGS:=$(shell pkg-config --libs gtk+-2.0 webkit-1.0 libsoup-2.4 gthread-2.0) -pthread $(LDFLAGS) -LDFLAGS!=echo `pkg-config --libs gtk+-2.0 webkit-1.0 libsoup-2.4 gthread-2.0` -pthread $(LDFLAGS) +LDFLAGS:=$(shell pkg-config --libs gtk+-3.0 webkitgtk-3.0 libsoup-2.4 gthread-2.0) -pthread $(LDFLAGS) +LDFLAGS!=echo `pkg-config --libs gtk+-3.0 webkitgtk-3.0 libsoup-2.4 gthread-2.0` -pthread $(LDFLAGS) SRC = $(wildcard src/*.c) HEAD = $(wildcard src/*.h) -- cgit v1.2.3 From d7af40c7c462a148c51c8f20f455df3859551e2e Mon Sep 17 00:00:00 2001 From: keis Date: Thu, 19 Aug 2010 20:05:08 +0200 Subject: initial fixes for gtk+-3.0 --- src/callbacks.c | 8 ++++---- src/uzbl-core.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/callbacks.c b/src/callbacks.c index d2352b2..85653be 100644 --- a/src/callbacks.c +++ b/src/callbacks.c @@ -798,14 +798,14 @@ populate_popup_cb(WebKitWebView *v, GtkMenu *m, void *c) { (context & mi->context)) { if(mi->issep) { item = gtk_separator_menu_item_new(); - gtk_menu_append(GTK_MENU(m), item); + gtk_menu_shell_append(GTK_MENU_SHELL(m), item); gtk_widget_show(item); } else { item = gtk_menu_item_new_with_label(mi->name); g_signal_connect(item, "activate", G_CALLBACK(run_menu_command), mi->cmd); - gtk_menu_append(GTK_MENU(m), item); + gtk_menu_shell_append(GTK_MENU_SHELL(m), item); gtk_widget_show(item); } hit++; @@ -816,14 +816,14 @@ populate_popup_cb(WebKitWebView *v, GtkMenu *m, void *c) { !hit) { if(mi->issep) { item = gtk_separator_menu_item_new(); - gtk_menu_append(GTK_MENU(m), item); + gtk_menu_shell_append(GTK_MENU_SHELL(m), item); gtk_widget_show(item); } else { item = gtk_menu_item_new_with_label(mi->name); g_signal_connect(item, "activate", G_CALLBACK(run_menu_command), mi->cmd); - gtk_menu_append(GTK_MENU(m), item); + gtk_menu_shell_append(GTK_MENU_SHELL(m), item); gtk_widget_show(item); } } diff --git a/src/uzbl-core.c b/src/uzbl-core.c index 7be98c3..42412ef 100644 --- a/src/uzbl-core.c +++ b/src/uzbl-core.c @@ -2620,7 +2620,7 @@ main (int argc, char* argv[]) { 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); - uzbl.xwin = GDK_WINDOW_XID (GTK_WIDGET (uzbl.gui.main_window)->window); + uzbl.xwin = GDK_WINDOW_XID (gtk_widget_get_window (GTK_WIDGET (uzbl.gui.main_window))); } uzbl.gui.scbar_v = (GtkScrollbar*) gtk_vscrollbar_new (NULL); -- cgit v1.2.3 From 2fc3f2846f873f3d3700b30697e2f9f5979e36ce Mon Sep 17 00:00:00 2001 From: keis Date: Tue, 30 Nov 2010 14:21:35 +0100 Subject: use GtkScrollable interface --- src/callbacks.c | 3 ++- src/uzbl-core.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/callbacks.c b/src/callbacks.c index d763fa9..fcd7a8c 100644 --- a/src/callbacks.c +++ b/src/callbacks.c @@ -324,7 +324,8 @@ cmd_scrollbars_visibility() { uzbl.gui.bar_v = gtk_range_get_adjustment (GTK_RANGE (uzbl.gui.scbar_v)); uzbl.gui.bar_h = gtk_range_get_adjustment (GTK_RANGE (uzbl.gui.scbar_h)); } - gtk_widget_set_scroll_adjustments (GTK_WIDGET (uzbl.gui.web_view), uzbl.gui.bar_h, uzbl.gui.bar_v); + gtk_scrollable_set_hadjustment (GTK_SCROLLABLE(uzbl.gui.web_view), uzbl.gui.bar_h); + gtk_scrollable_set_vadjustment (GTK_SCROLLABLE(uzbl.gui.web_view), uzbl.gui.bar_v); } /* requires webkit >=1.1.14 */ diff --git a/src/uzbl-core.c b/src/uzbl-core.c index 794257f..9a9af23 100644 --- a/src/uzbl-core.c +++ b/src/uzbl-core.c @@ -2345,7 +2345,8 @@ main (int argc, char* argv[]) { uzbl.gui.bar_v = gtk_range_get_adjustment((GtkRange*) uzbl.gui.scbar_v); uzbl.gui.scbar_h = (GtkScrollbar*) gtk_hscrollbar_new (NULL); uzbl.gui.bar_h = gtk_range_get_adjustment((GtkRange*) uzbl.gui.scbar_h); - gtk_widget_set_scroll_adjustments ((GtkWidget*) uzbl.gui.web_view, uzbl.gui.bar_h, uzbl.gui.bar_v); + gtk_scrollable_set_hadjustment (GTK_SCROLLABLE(uzbl.gui.web_view), uzbl.gui.bar_h); + gtk_scrollable_set_vadjustment (GTK_SCROLLABLE(uzbl.gui.web_view), uzbl.gui.bar_v); g_object_connect((GObject*)uzbl.gui.bar_v, "signal::value-changed", (GCallback)scroll_vert_cb, NULL, -- cgit v1.2.3 From 4fbba2d523ba65b2dad15cf264eb168157cf0f15 Mon Sep 17 00:00:00 2001 From: Brendan Taylor Date: Mon, 29 Nov 2010 20:11:54 -0700 Subject: remove the positional arguments entirely (breaks backward compatibility) --- examples/config/config | 8 ++-- examples/data/scripts/auth.py | 2 +- examples/data/scripts/scheme.py | 2 +- src/uzbl-core.c | 90 +++++++++++++++-------------------------- src/uzbl-core.h | 4 +- 5 files changed, 41 insertions(+), 65 deletions(-) diff --git a/examples/config/config b/examples/config/config index 22414ad..3c1a2fe 100644 --- a/examples/config/config +++ b/examples/config/config @@ -47,7 +47,7 @@ set authentication_handler = sync_spawn @scripts_dir/auth.py # === Dynamic event handlers ================================================= # Open link in new window -@on_event NEW_WINDOW sh 'uzbl-browser ${8:+-u "$8"}' %r +@on_event NEW_WINDOW sh 'uzbl-browser ${1:+-u "$1"}' %r # Open in current window #@on_event NEW_WINDOW uri %s # Open in new tab @@ -181,7 +181,7 @@ set ebind = @mode_bind global,-insert # --- Mouse bindings --------------------------------------------------------- # Middle click open in new window -@bind = sh 'if [ "$8" ]; then uzbl-browser -u "$8"; else echo "uri $(xclip -o | sed s/\\\@/%40/g)" > "$UZBL_FIFO"; fi' \@SELECTED_URI +@bind = sh 'if [ "$1" ]; then uzbl-browser -u "$1"; else echo "uri $(xclip -o | sed s/\\\@/%40/g)" > "$UZBL_FIFO"; fi' \@SELECTED_URI # --- Keyboard bindings ------------------------------------------------------ @@ -268,9 +268,9 @@ set ebind = @mode_bind global,-insert # Yanking & pasting binds @cbind yu = sh 'echo -n "$UZBL_URI" | xclip' -@cbind yU = sh 'echo -n $8 | xclip' \@SELECTED_URI +@cbind yU = sh 'echo -n "$1" | xclip' \@SELECTED_URI @cbind yy = sh 'echo -n "$UZBL_TITLE" | xclip' -@cbind yY = sh 'echo -n $8 | xclip' \@SELECTED_URI +@cbind yY = sh 'echo -n "$1" | xclip' \@SELECTED_URI # Clone current window @cbind c = sh 'uzbl-browser -u "$UZBL_URI"' diff --git a/examples/data/scripts/auth.py b/examples/data/scripts/auth.py index 9c1b4fc..592a2c6 100755 --- a/examples/data/scripts/auth.py +++ b/examples/data/scripts/auth.py @@ -46,7 +46,7 @@ def getText(authInfo, authHost, authRealm): return rv, output if __name__ == '__main__': - rv, output = getText(sys.argv[8], sys.argv[9], sys.argv[10]) + rv, output = getText(sys.argv[1], sys.argv[2], sys.argv[3]) if (rv == gtk.RESPONSE_OK): print output; else: diff --git a/examples/data/scripts/scheme.py b/examples/data/scripts/scheme.py index 0916466..4b0b7ca 100755 --- a/examples/data/scripts/scheme.py +++ b/examples/data/scripts/scheme.py @@ -13,7 +13,7 @@ def detach_open(cmd): print 'USED' if __name__ == '__main__': - uri = sys.argv[8] + uri = sys.argv[1] u = urlparse.urlparse(uri) if u.scheme == 'mailto': detach_open(['xterm', '-e', 'mail', u.path]) diff --git a/src/uzbl-core.c b/src/uzbl-core.c index 3a04027..dcdd4c7 100644 --- a/src/uzbl-core.c +++ b/src/uzbl-core.c @@ -1209,30 +1209,19 @@ sharg_append(GArray *a, const gchar *str) { g_array_append_val(a, s); } -// make sure that the args string you pass can properly be interpreted (eg properly escaped against whitespace, quotes etc) +/* make sure that the args string you pass can properly be interpreted (eg + * properly escaped against whitespace, quotes etc) */ gboolean -run_command (const gchar *command, const guint npre, const gchar **args, - const gboolean sync, char **output_stdout) { - //command [args] +run_command (const gchar *command, const gchar **args, const gboolean sync, + char **output_stdout) { GError *err = NULL; GArray *a = g_array_new (TRUE, FALSE, sizeof(gchar*)); - gchar *pid = itos(getpid()); - gchar *xwin = itos(uzbl.xwin); guint i; sharg_append(a, command); - for (i = 0; i < npre; i++) /* add n args before the default vars */ - sharg_append(a, args[i]); - sharg_append(a, uzbl.state.config_file); - sharg_append(a, pid); - sharg_append(a, xwin); - sharg_append(a, uzbl.comm.fifo_path); - sharg_append(a, uzbl.comm.socket_path); - sharg_append(a, uzbl.state.uri); - sharg_append(a, uzbl.gui.main_title); - - for (i = npre; i < g_strv_length((gchar**)args); i++) + + for (i = 0; i < g_strv_length((gchar**)args); i++) sharg_append(a, args[i]); gboolean result; @@ -1263,8 +1252,6 @@ run_command (const gchar *command, const guint npre, const gchar **args, g_printerr("error on run_command: %s\n", err->message); g_error_free (err); } - g_free (pid); - g_free (xwin); g_array_free (a, TRUE); return result; } @@ -1307,75 +1294,64 @@ split_quoted(const gchar* src, const gboolean unquote) { } void -spawn(WebKitWebView *web_view, GArray *argv, GString *result) { - (void)web_view; (void)result; +_spawn(GArray *argv, char **output_stdout) { gchar *path = NULL; + gchar *arg_car = argv_idx(argv, 0); + const gchar **arg_cdr = &g_array_index(argv, const gchar *, 1); - //TODO: allow more control over argument order so that users can have some arguments before the default ones from run_command, and some after - if (argv_idx(argv, 0) && - ((path = find_existing_file(argv_idx(argv, 0)))) ) { - run_command(path, 0, - ((const gchar **) (argv->data + sizeof(gchar*))), - FALSE, NULL); + if (arg_car && (path = find_existing_file(arg_car))) { + run_command(path, arg_cdr, (output_stdout != NULL), output_stdout); g_free(path); } } void -spawn_sync(WebKitWebView *web_view, GArray *argv, GString *result) { +spawn(WebKitWebView *web_view, GArray *argv, GString *result) { (void)web_view; (void)result; - gchar *path = NULL; - if (argv_idx(argv, 0) && - ((path = find_existing_file(argv_idx(argv, 0)))) ) { - run_command(path, 0, - ((const gchar **) (argv->data + sizeof(gchar*))), - TRUE, &uzbl.comm.sync_stdout); - g_free(path); - } + _spawn(argv, NULL); } void -spawn_sh(WebKitWebView *web_view, GArray *argv, GString *result) { +spawn_sync(WebKitWebView *web_view, GArray *argv, GString *result) { (void)web_view; (void)result; + + _spawn(argv, &uzbl.comm.sync_stdout); +} + +void +_spawn_sh(GArray *argv, char **output_stdout) { if (!uzbl.behave.shell_cmd) { g_printerr ("spawn_sh: shell_cmd is not set!\n"); return; } - guint i; - gchar *spacer = g_strdup(""); - g_array_insert_val(argv, 1, spacer); + gchar **cmd = split_quoted(uzbl.behave.shell_cmd, TRUE); + gchar *cmdname = g_strdup(cmd[0]); + g_array_insert_val(argv, 1, cmdname); for (i = 1; i < g_strv_length(cmd); i++) g_array_prepend_val(argv, cmd[i]); - if (cmd) run_command(cmd[0], g_strv_length(cmd) + 1, (const gchar **) argv->data, FALSE, NULL); - g_free (spacer); + if (cmd) run_command(cmd[0], (const gchar **) argv->data, + (output_stdout != NULL), output_stdout); + g_free (cmdname); g_strfreev (cmd); } void -spawn_sh_sync(WebKitWebView *web_view, GArray *argv, GString *result) { +spawn_sh(WebKitWebView *web_view, GArray *argv, GString *result) { (void)web_view; (void)result; - if (!uzbl.behave.shell_cmd) { - g_printerr ("spawn_sh_sync: shell_cmd is not set!\n"); - return; - } - guint i; - gchar *spacer = g_strdup(""); - g_array_insert_val(argv, 1, spacer); - gchar **cmd = split_quoted(uzbl.behave.shell_cmd, TRUE); + _spawn_sh(argv, NULL); +} - for (i = 1; i < g_strv_length(cmd); i++) - g_array_prepend_val(argv, cmd[i]); +void +spawn_sh_sync(WebKitWebView *web_view, GArray *argv, GString *result) { + (void)web_view; (void)result; - if (cmd) run_command(cmd[0], g_strv_length(cmd) + 1, (const gchar **) argv->data, - TRUE, &uzbl.comm.sync_stdout); - g_free (spacer); - g_strfreev (cmd); + _spawn_sh(argv, &uzbl.comm.sync_stdout); } void diff --git a/src/uzbl-core.h b/src/uzbl-core.h index b5a502e..412d9fc 100644 --- a/src/uzbl-core.h +++ b/src/uzbl-core.h @@ -262,8 +262,8 @@ void close_uzbl (WebKitWebView *page, GArray *argv, GString *result); gboolean -run_command(const gchar *command, const guint npre, - const gchar **args, const gboolean sync, char **output_stdout); +run_command(const gchar *command, const gchar **args, const gboolean sync, + char **output_stdout); void spawn(WebKitWebView *web_view, GArray *argv, GString *result); -- cgit v1.2.3 From f8c065feb6d420994c159073c0fce10ef6adc876 Mon Sep 17 00:00:00 2001 From: Jochen Sprickerhof Date: Sat, 11 Dec 2010 13:50:47 +0100 Subject: Quote URI when using middle click to open in new window @SELECTED_URI is not encoded, so a URI with spaces would expand to more than one parameter. --- examples/config/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/config/config b/examples/config/config index c5a0e86..a6651bf 100644 --- a/examples/config/config +++ b/examples/config/config @@ -183,7 +183,7 @@ set ebind = @mode_bind global,-insert # --- Mouse bindings --------------------------------------------------------- # Middle click open in new window -@bind = sh 'if [ "$8" ]; then uzbl-browser -u "$8"; else echo "uri $(xclip -o | sed s/\\\@/%40/g)" > "$UZBL_FIFO"; fi' \@SELECTED_URI +@bind = sh 'if [ "$8" ]; then uzbl-browser -u "$8"; else echo "uri $(xclip -o | sed s/\\\@/%40/g)" > "$UZBL_FIFO"; fi' '\@SELECTED_URI' # --- Keyboard bindings ------------------------------------------------------ -- cgit v1.2.3 From 11bd506166ef90eef7854257fba85f6daa249200 Mon Sep 17 00:00:00 2001 From: keis Date: Tue, 14 Dec 2010 13:03:38 +0100 Subject: fix leak in add_to_menu --- src/uzbl-core.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/uzbl-core.c b/src/uzbl-core.c index cb20fd7..a82c4e2 100644 --- a/src/uzbl-core.c +++ b/src/uzbl-core.c @@ -716,7 +716,7 @@ add_to_menu(GArray *argv, guint context) { g->menu_items = g_ptr_array_new(); if(split[1]) - item_cmd = g_strdup(split[1]); + item_cmd = split[1]; if(split[0]) { m = malloc(sizeof(MenuItem)); @@ -726,8 +726,6 @@ add_to_menu(GArray *argv, guint context) { m->issep = FALSE; g_ptr_array_add(g->menu_items, m); } - else - g_free(item_cmd); g_strfreev(split); } -- cgit v1.2.3 From 869e18866ca14d858f488159202e2bbb5f7dde0c Mon Sep 17 00:00:00 2001 From: keis Date: Tue, 14 Dec 2010 13:10:53 +0100 Subject: fix leak in get_click_context --- src/uzbl-core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/uzbl-core.c b/src/uzbl-core.c index a82c4e2..4dc3562 100644 --- a/src/uzbl-core.c +++ b/src/uzbl-core.c @@ -489,8 +489,9 @@ get_click_context() { if(!uzbl.state.last_button) return -1; - ht = webkit_web_view_get_hit_test_result(g->web_view, uzbl.state.last_button); - g_object_get(ht, "context", &context, NULL); + ht = webkit_web_view_get_hit_test_result (g->web_view, uzbl.state.last_button); + g_object_get (ht, "context", &context, NULL); + g_object_unref (ht); return (gint)context; } -- cgit v1.2.3 From e1b0861dd6c56bf39df5ee3fdad996ef14a42dd5 Mon Sep 17 00:00:00 2001 From: keis Date: Tue, 14 Dec 2010 13:42:00 +0100 Subject: fix leak in parse_command --- src/uzbl-core.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/uzbl-core.c b/src/uzbl-core.c index 4dc3562..7d8b079 100644 --- a/src/uzbl-core.c +++ b/src/uzbl-core.c @@ -1413,14 +1413,13 @@ parse_command(const char *cmd, const char *param, GString *result) { strcmp("request", cmd)) { g_string_printf(tmp, "%s %s", cmd, param?param:""); send_event(COMMAND_EXECUTED, tmp->str, NULL); - g_string_free(tmp, TRUE); } } else { - gchar *tmp = g_strdup_printf("%s %s", cmd, param?param:""); - send_event(COMMAND_ERROR, tmp, NULL); - g_free(tmp); + g_string_printf (tmp, "%s %s", cmd, param?param:""); + send_event(COMMAND_ERROR, tmp->str, NULL); } + g_string_free(tmp, TRUE); } -- cgit v1.2.3 From 5d6dae503e09b3581dafbbd83364943334937166 Mon Sep 17 00:00:00 2001 From: Brendan Taylor Date: Mon, 27 Dec 2010 09:43:56 -0700 Subject: Makefile: add (commented) lines for using gtk+ 3 --- Makefile | 18 ++++++++++++++---- docs/INSTALL | 1 + tests/Makefile | 18 ++++++++++++++---- 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 35e8f66..44a07a1 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,20 @@ # first entries are for gnu make, 2nd for BSD make. see http://lists.uzbl.org/pipermail/uzbl-dev-uzbl.org/2009-July/000177.html -CFLAGS:=-std=c99 $(shell pkg-config --cflags gtk+-3.0 webkitgtk-3.0 libsoup-2.4 gthread-2.0 glib-2.0) -ggdb -Wall -W -DARCH="\"$(shell uname -m)\"" -lgthread-2.0 -DCOMMIT="\"$(shell ./misc/hash.sh)\"" $(CPPFLAGS) -fPIC -W -Wall -Wextra -pedantic -CFLAGS!=echo -std=c99 `pkg-config --cflags gtk+-3.0 webkitgtk-3.0 libsoup-2.4 gthread-2.0 glib-2.0` -ggdb -Wall -W -DARCH='"\""'`uname -m`'"\""' -lgthread-2.0 -DCOMMIT='"\""'`./misc/hash.sh`'"\""' $(CPPFLAGS) -fPIC -W -Wall -Wextra -pedantic +REQ_PKGS = libsoup-2.4 gthread-2.0 glib-2.0 -UZBL_LDFLAGS:=$(shell pkg-config --libs gtk+-3.0 webkitgtk-3.0 libsoup-2.4 gthread-2.0 x11) -pthread $(LDFLAGS) -UZBL_LDFLAGS!=echo `pkg-config --libs gtk+-3.0 webkitgtk-3.0 libsoup-2.4 gthread-2.0 x11` -pthread $(LDFLAGS) +# gtk2 +REQ_PKGS += gtk+-2.0 webkit-1.0 +CPPFLAGS = + +# gtk3 +#REQ_PKGS += gtk+-3.0 webkitgtk-3.0 +#CPPFLAGS = -DGTK3 + +CFLAGS:=-std=c99 $(shell pkg-config --cflags $(REQ_PKGS)) -ggdb -Wall -W -DARCH="\"$(shell uname -m)\"" -lgthread-2.0 -DCOMMIT="\"$(shell ./misc/hash.sh)\"" $(CPPFLAGS) -fPIC -W -Wall -Wextra -pedantic +CFLAGS!=echo -std=c99 `pkg-config --cflags $(REQ_PKGS)` -ggdb -Wall -W -DARCH='"\""'`uname -m`'"\""' -lgthread-2.0 -DCOMMIT='"\""'`./misc/hash.sh`'"\""' $(CPPFLAGS) -fPIC -W -Wall -Wextra -pedantic + +UZBL_LDFLAGS:=$(shell pkg-config --libs $(REQ_PKGS) x11) -pthread $(LDFLAGS) +UZBL_LDFLAGS!=echo `pkg-config --libs $(REQ_PKGS) x11` -pthread $(LDFLAGS) SRC = $(wildcard src/*.c) HEAD = $(wildcard src/*.h) diff --git a/docs/INSTALL b/docs/INSTALL index accd383..0f6a662 100644 --- a/docs/INSTALL +++ b/docs/INSTALL @@ -13,6 +13,7 @@ You can pull the code from git or get a tagged tarball. [ $ git checkout origin/experimental ] # optional. see below $ make $ sudo make install + If you want to remove uzbl again, you can issue: $ make uninstall diff --git a/tests/Makefile b/tests/Makefile index 3f63adf..c35a2f2 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -1,8 +1,18 @@ -CFLAGS:=-std=c99 -I$(shell pwd)/../ -L$(shell pwd) -luzbl-core $(shell pkg-config --cflags gtk+-2.0 webkit-1.0 libsoup-2.4 gthread-2.0) -ggdb -Wall -W -DARCH="\"$(shell uname -m)\"" -lgthread-2.0 -DG_ERRORCHECK_MUTEXES -DCOMMIT="\"$(shell git log | head -n1 | sed "s/.* //")\"" $(CPPFLAGS) -CFLAGS!=echo -std=c99 `pkg-config --cflags gtk+-2.0 webkit-1.0 libsoup-2.4 gthread-2.0` -ggdb -Wall -W -DARCH='"\""'`uname -m`'"\""' -lgthread-2.0 -DG_ERRORCHECK_MUTEXES -DCOMMIT='"\""'`git log | head -n1 | sed "s/.* //"`'"\""' $(CPPFLAGS) +REQ_PKGS = libsoup-2.4 gthread-2.0 glib-2.0 -LDFLAGS:=$(shell pkg-config --libs gtk+-2.0 webkit-1.0 libsoup-2.4 gthread-2.0) -pthread $(LDFLAGS) -LDFLAGS!=echo `pkg-config --libs gtk+-2.0 webkit-1.0 libsoup-2.4 gthread-2.0` -pthread $(LDFLAGS) +# gtk2 +REQ_PKGS += gtk+-2.0 webkit-1.0 +CPPFLAGS = + +# gtk3 +#REQ_PKGS += gtk+-3.0 webkitgtk-3.0 +#CPPFLAGS = -DGTK3 + +CFLAGS:=-std=c99 -I$(shell pwd)/../ -L$(shell pwd) -luzbl-core $(shell pkg-config --cflags $(REQ_PKGS)) -ggdb -Wall -W -DARCH="\"$(shell uname -m)\"" -lgthread-2.0 -DG_ERRORCHECK_MUTEXES -DCOMMIT="\"$(shell git log | head -n1 | sed "s/.* //")\"" $(CPPFLAGS) +CFLAGS!=echo -std=c99 `pkg-config --cflags $(REQ_PKGS)` -ggdb -Wall -W -DARCH='"\""'`uname -m`'"\""' -lgthread-2.0 -DG_ERRORCHECK_MUTEXES -DCOMMIT='"\""'`git log | head -n1 | sed "s/.* //"`'"\""' $(CPPFLAGS) + +LDFLAGS:=$(shell pkg-config --libs $(REQ_PKGS)) -pthread $(LDFLAGS) +LDFLAGS!=echo `pkg-config --libs $(REQ_PKGS)` -pthread $(LDFLAGS) GTESTER:=gtester GTESTER_REPORT:=gtester-report -- cgit v1.2.3 From 6a357cfa2b005cd594ba1183c71531acd4b09556 Mon Sep 17 00:00:00 2001 From: Brendan Taylor Date: Mon, 27 Dec 2010 09:44:25 -0700 Subject: add an ifdef for GTK3 scrollable changes --- src/callbacks.c | 4 ++-- src/uzbl-core.c | 33 ++++++++++++++++++++++----------- src/uzbl-core.h | 3 +++ 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/src/callbacks.c b/src/callbacks.c index ee6cf58..673979e 100644 --- a/src/callbacks.c +++ b/src/callbacks.c @@ -324,8 +324,8 @@ cmd_scrollbars_visibility() { uzbl.gui.bar_v = gtk_range_get_adjustment (GTK_RANGE (uzbl.gui.scbar_v)); uzbl.gui.bar_h = gtk_range_get_adjustment (GTK_RANGE (uzbl.gui.scbar_h)); } - gtk_scrollable_set_hadjustment (GTK_SCROLLABLE(uzbl.gui.web_view), uzbl.gui.bar_h); - gtk_scrollable_set_vadjustment (GTK_SCROLLABLE(uzbl.gui.web_view), uzbl.gui.bar_v); + + set_webview_scroll_adjustments(); } /* requires webkit >=1.1.14 */ diff --git a/src/uzbl-core.c b/src/uzbl-core.c index cc680c2..73ed5c6 100644 --- a/src/uzbl-core.c +++ b/src/uzbl-core.c @@ -2277,6 +2277,27 @@ retrieve_geometry() { uzbl.gui.geometry = g_string_free(buf, FALSE); } +void +set_webview_scroll_adjustments() { +#ifdef GTK3 + gtk_scrollable_set_hadjustment (GTK_SCROLLABLE(uzbl.gui.web_view), uzbl.gui.bar_h); + gtk_scrollable_set_vadjustment (GTK_SCROLLABLE(uzbl.gui.web_view), uzbl.gui.bar_v); +#else + gtk_widget_set_scroll_adjustments (GTK_WIDGET (uzbl.gui.web_view), + uzbl.gui.bar_h, uzbl.gui.bar_v); +#endif + + g_object_connect((GObject*)uzbl.gui.bar_v, + "signal::value-changed", (GCallback)scroll_vert_cb, NULL, + "signal::changed", (GCallback)scroll_vert_cb, NULL, + NULL); + + g_object_connect((GObject*)uzbl.gui.bar_h, + "signal::value-changed", (GCallback)scroll_horiz_cb, NULL, + "signal::changed", (GCallback)scroll_horiz_cb, NULL, + NULL); +} + /* set up gtk, gobject, variable defaults and other things that tests and other * external applications need to do anyhow */ void @@ -2418,18 +2439,8 @@ main (int argc, char* argv[]) { uzbl.gui.bar_v = gtk_range_get_adjustment((GtkRange*) uzbl.gui.scbar_v); uzbl.gui.scbar_h = (GtkScrollbar*) gtk_hscrollbar_new (NULL); uzbl.gui.bar_h = gtk_range_get_adjustment((GtkRange*) uzbl.gui.scbar_h); - gtk_scrollable_set_hadjustment (GTK_SCROLLABLE(uzbl.gui.web_view), uzbl.gui.bar_h); - gtk_scrollable_set_vadjustment (GTK_SCROLLABLE(uzbl.gui.web_view), uzbl.gui.bar_v); - g_object_connect((GObject*)uzbl.gui.bar_v, - "signal::value-changed", (GCallback)scroll_vert_cb, NULL, - "signal::changed", (GCallback)scroll_vert_cb, NULL, - NULL); - - g_object_connect((GObject*)uzbl.gui.bar_h, - "signal::value-changed", (GCallback)scroll_horiz_cb, NULL, - "signal::changed", (GCallback)scroll_horiz_cb, NULL, - NULL); + set_webview_scroll_adjustments(); gchar *xwin = g_strdup_printf("%d", (int)uzbl.xwin); g_setenv("UZBL_XID", xwin, TRUE); diff --git a/src/uzbl-core.h b/src/uzbl-core.h index 98ae342..097fbfc 100644 --- a/src/uzbl-core.h +++ b/src/uzbl-core.h @@ -397,6 +397,9 @@ dump_config_as_events(); void retrieve_geometry(); +void +set_webview_scroll_adjustments(); + void event(WebKitWebView *page, GArray *argv, GString *result); -- cgit v1.2.3 From 734ab102a6b6aa67bcdeb70174d1e2a7fa50b7be Mon Sep 17 00:00:00 2001 From: Brendan Taylor Date: Mon, 27 Dec 2010 14:48:57 -0700 Subject: delete all .o files in 'make clean' --- Makefile | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 44a07a1..a0d7655 100644 --- a/Makefile +++ b/Makefile @@ -100,12 +100,7 @@ test-uzbl-tabbed-sandbox: uzbl-browser clean: rm -f uzbl-core rm -f uzbl-cookie-manager - rm -f uzbl-core.o - rm -f events.o - rm -f callbacks.o - rm -f inspector.o - rm -f cookie-jar.o - rm -f util.o + rm -f *.o find ./examples/ -name "*.pyc" -delete cd ./tests/; $(MAKE) clean rm -rf ./sandbox/ -- cgit v1.2.3 From db5c6864ca7765b01d904ff1179d6522198c6d70 Mon Sep 17 00:00:00 2001 From: Brendan Taylor Date: Mon, 27 Dec 2010 17:49:40 -0700 Subject: untangle the CFLAGS mess --- Makefile | 34 ++++++++++++++++++++++------------ tests/Makefile | 32 ++++++++++++++++++++++---------- 2 files changed, 44 insertions(+), 22 deletions(-) diff --git a/Makefile b/Makefile index a0d7655..832b531 100644 --- a/Makefile +++ b/Makefile @@ -1,20 +1,30 @@ # first entries are for gnu make, 2nd for BSD make. see http://lists.uzbl.org/pipermail/uzbl-dev-uzbl.org/2009-July/000177.html -REQ_PKGS = libsoup-2.4 gthread-2.0 glib-2.0 - # gtk2 -REQ_PKGS += gtk+-2.0 webkit-1.0 -CPPFLAGS = +REQ_PKGS = gtk+-2.0 webkit-1.0 +CPPFLAGS = # gtk3 -#REQ_PKGS += gtk+-3.0 webkitgtk-3.0 -#CPPFLAGS = -DGTK3 +#REQ_PKGS = gtk+-3.0 webkitgtk-3.0 +#CPPFLAGS = -DGTK3 + +REQ_PKGS += libsoup-2.4 gthread-2.0 glib-2.0 + +ARCH:=$(shell uname -m) +ARCH!=echo `uname -m` + +COMMIT_HASH:=$(shell ./misc/hash.sh) +COMMIT_HASH!=echo `./misc/hash.sh` + +CPPFLAGS += -DARCH=\"$(ARCH)\" -DCOMMIT=\"$(COMMIT_HASH)\" + +PKG_CFLAGS:=$(shell pkg-config --cflags $(REQ_PKGS)) +PKG_CFLAGS!=echo pkg-config --cflags $(REQ_PKGS) -CFLAGS:=-std=c99 $(shell pkg-config --cflags $(REQ_PKGS)) -ggdb -Wall -W -DARCH="\"$(shell uname -m)\"" -lgthread-2.0 -DCOMMIT="\"$(shell ./misc/hash.sh)\"" $(CPPFLAGS) -fPIC -W -Wall -Wextra -pedantic -CFLAGS!=echo -std=c99 `pkg-config --cflags $(REQ_PKGS)` -ggdb -Wall -W -DARCH='"\""'`uname -m`'"\""' -lgthread-2.0 -DCOMMIT='"\""'`./misc/hash.sh`'"\""' $(CPPFLAGS) -fPIC -W -Wall -Wextra -pedantic +PKG_LDFLAGS:=$(shell pkg-config --libs $(REQ_PKGS) x11) +PKG_LDFLAGS!=echo pkg-config --libs $(REQ_PKGS) x11 -UZBL_LDFLAGS:=$(shell pkg-config --libs $(REQ_PKGS) x11) -pthread $(LDFLAGS) -UZBL_LDFLAGS!=echo `pkg-config --libs $(REQ_PKGS) x11` -pthread $(LDFLAGS) +CFLAGS = -std=c99 $(PKG_CFLAGS) -ggdb -Wall -W -lgthread-2.0 $(CPPFLAGS) -fPIC -W -Wall -Wextra -pedantic SRC = $(wildcard src/*.c) HEAD = $(wildcard src/*.h) @@ -31,8 +41,8 @@ VPATH:=src ${OBJ}: ${HEAD} uzbl-core: ${OBJ} - @echo -e "\n${CC} -o $@ ${OBJ} ${UZBL_LDFLAGS}" - @${CC} -o $@ ${OBJ} ${UZBL_LDFLAGS} + @echo -e "\n${CC} -o $@ ${OBJ} ${PKG_LDFLAGS} -pthread ${LDFLAGS}" + @${CC} -o $@ ${OBJ} ${PKG_LDFLAGS} -pthread ${LDFLAGS} uzbl-cookie-manager: examples/uzbl-cookie-manager.o src/util.o @echo -e "\n${CC} -o $@ uzbl-cookie-manager.o util.o ${LDFLAGS} ${shell pkg-config --libs glib-2.0 libsoup-2.4}" diff --git a/tests/Makefile b/tests/Makefile index c35a2f2..f87964b 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -1,18 +1,30 @@ -REQ_PKGS = libsoup-2.4 gthread-2.0 glib-2.0 - # gtk2 -REQ_PKGS += gtk+-2.0 webkit-1.0 -CPPFLAGS = +REQ_PKGS = gtk+-2.0 webkit-1.0 +CPPFLAGS = -DERRORCHECK_MUTEXES -I ../ # gtk3 -#REQ_PKGS += gtk+-3.0 webkitgtk-3.0 -#CPPFLAGS = -DGTK3 +#REQ_PKGS = gtk+-3.0 webkitgtk-3.0 +#CPPFLAGS = -DERRORCHECK_MUTEXES -DGTK3 -I ../ + +REQ_PKGS += libsoup-2.4 gthread-2.0 glib-2.0 + +ARCH:=$(shell uname -m) +ARCH!=echo `uname -m` + +COMMIT_HASH:=$(shell cd .. && ./misc/hash.sh) +COMMIT_HASH!=echo `cd .. && ./misc/hash.sh` + +CPPFLAGS += -DARCH=\"$(ARCH)\" -DCOMMIT=\"$(COMMIT_HASH)\" + +PKG_CFLAGS:=$(shell pkg-config --cflags $(REQ_PKGS)) +PKG_CFLAGS!=echo pkg-config --cflags $(REQ_PKGS) + +PKG_LDFLAGS:=$(shell pkg-config --libs $(REQ_PKGS) x11) +PKG_LDFLAGS!=echo pkg-config --libs $(REQ_PKGS) x11 -CFLAGS:=-std=c99 -I$(shell pwd)/../ -L$(shell pwd) -luzbl-core $(shell pkg-config --cflags $(REQ_PKGS)) -ggdb -Wall -W -DARCH="\"$(shell uname -m)\"" -lgthread-2.0 -DG_ERRORCHECK_MUTEXES -DCOMMIT="\"$(shell git log | head -n1 | sed "s/.* //")\"" $(CPPFLAGS) -CFLAGS!=echo -std=c99 `pkg-config --cflags $(REQ_PKGS)` -ggdb -Wall -W -DARCH='"\""'`uname -m`'"\""' -lgthread-2.0 -DG_ERRORCHECK_MUTEXES -DCOMMIT='"\""'`git log | head -n1 | sed "s/.* //"`'"\""' $(CPPFLAGS) +CFLAGS = -std=c99 $(PKG_CFLAGS) -ggdb -Wall -W -lgthread-2.0 -fPIC -W -Wall -Wextra -pedantic -LDFLAGS:=$(shell pkg-config --libs $(REQ_PKGS)) -pthread $(LDFLAGS) -LDFLAGS!=echo `pkg-config --libs $(REQ_PKGS)` -pthread $(LDFLAGS) +LDFLAGS = $(PKG_LDFLAGS) -pthread -L . -luzbl-core GTESTER:=gtester GTESTER_REPORT:=gtester-report -- cgit v1.2.3 From 78b038182f33a22196289e4a34cb411b7ca96543 Mon Sep 17 00:00:00 2001 From: Brendan Taylor Date: Mon, 27 Dec 2010 17:50:30 -0700 Subject: separate makefile configuration section from rules section --- Makefile | 18 ++++++++++-------- tests/Makefile | 2 ++ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 832b531..6ce0c69 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,13 @@ # first entries are for gnu make, 2nd for BSD make. see http://lists.uzbl.org/pipermail/uzbl-dev-uzbl.org/2009-July/000177.html +# packagers, set DESTDIR to your "package directory" and PREFIX to the prefix you want to have on the end-user system +# end-users who build from source: don't care about DESTDIR, update PREFIX if you want to +# RUN_PREFIX : what the prefix is when the software is run. usually the same as PREFIX +PREFIX?=/usr/local +INSTALLDIR?=$(DESTDIR)$(PREFIX) +DOCDIR?=$(INSTALLDIR)/share/uzbl/docs +RUN_PREFIX?=$(PREFIX) + # gtk2 REQ_PKGS = gtk+-2.0 webkit-1.0 CPPFLAGS = @@ -8,6 +16,8 @@ CPPFLAGS = #REQ_PKGS = gtk+-3.0 webkitgtk-3.0 #CPPFLAGS = -DGTK3 +# --- configuration ends here --- + REQ_PKGS += libsoup-2.4 gthread-2.0 glib-2.0 ARCH:=$(shell uname -m) @@ -50,14 +60,6 @@ uzbl-cookie-manager: examples/uzbl-cookie-manager.o src/util.o uzbl-browser: uzbl-core uzbl-cookie-manager -# packagers, set DESTDIR to your "package directory" and PREFIX to the prefix you want to have on the end-user system -# end-users who build from source: don't care about DESTDIR, update PREFIX if you want to -# RUN_PREFIX : what the prefix is when the software is run. usually the same as PREFIX -PREFIX?=/usr/local -INSTALLDIR?=$(DESTDIR)$(PREFIX) -DOCDIR?=$(INSTALLDIR)/share/uzbl/docs -RUN_PREFIX?=$(PREFIX) - # the 'tests' target can never be up to date .PHONY: tests force: diff --git a/tests/Makefile b/tests/Makefile index f87964b..016315e 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -6,6 +6,8 @@ CPPFLAGS = -DERRORCHECK_MUTEXES -I ../ #REQ_PKGS = gtk+-3.0 webkitgtk-3.0 #CPPFLAGS = -DERRORCHECK_MUTEXES -DGTK3 -I ../ +# --- configuration ends here --- + REQ_PKGS += libsoup-2.4 gthread-2.0 glib-2.0 ARCH:=$(shell uname -m) -- cgit v1.2.3 From 86ce4a2a57bb6da093c66b4855a36dcd50aa55d3 Mon Sep 17 00:00:00 2001 From: Brendan Taylor Date: Mon, 27 Dec 2010 18:23:06 -0700 Subject: remove redundant CFLAGS --- Makefile | 2 +- tests/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 6ce0c69..c4e6ad6 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,7 @@ PKG_CFLAGS!=echo pkg-config --cflags $(REQ_PKGS) PKG_LDFLAGS:=$(shell pkg-config --libs $(REQ_PKGS) x11) PKG_LDFLAGS!=echo pkg-config --libs $(REQ_PKGS) x11 -CFLAGS = -std=c99 $(PKG_CFLAGS) -ggdb -Wall -W -lgthread-2.0 $(CPPFLAGS) -fPIC -W -Wall -Wextra -pedantic +CFLAGS = -std=c99 $(PKG_CFLAGS) -ggdb $(CPPFLAGS) -fPIC -W -Wall -Wextra -pedantic SRC = $(wildcard src/*.c) HEAD = $(wildcard src/*.h) diff --git a/tests/Makefile b/tests/Makefile index 016315e..0da12ba 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -24,7 +24,7 @@ PKG_CFLAGS!=echo pkg-config --cflags $(REQ_PKGS) PKG_LDFLAGS:=$(shell pkg-config --libs $(REQ_PKGS) x11) PKG_LDFLAGS!=echo pkg-config --libs $(REQ_PKGS) x11 -CFLAGS = -std=c99 $(PKG_CFLAGS) -ggdb -Wall -W -lgthread-2.0 -fPIC -W -Wall -Wextra -pedantic +CFLAGS = -std=c99 $(PKG_CFLAGS) -ggdb -fPIC -W -Wall -Wextra -pedantic LDFLAGS = $(PKG_LDFLAGS) -pthread -L . -luzbl-core -- cgit v1.2.3 From 0db4606fc4daa63f63b30a44832cbc0b99cbd1fa Mon Sep 17 00:00:00 2001 From: Brendan Taylor Date: Mon, 27 Dec 2010 19:00:35 -0700 Subject: take advantage of implicit Makefile rules --- Makefile | 18 ++++++------------ tests/Makefile | 16 ++++++++-------- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/Makefile b/Makefile index c4e6ad6..9a8454d 100644 --- a/Makefile +++ b/Makefile @@ -31,10 +31,10 @@ CPPFLAGS += -DARCH=\"$(ARCH)\" -DCOMMIT=\"$(COMMIT_HASH)\" PKG_CFLAGS:=$(shell pkg-config --cflags $(REQ_PKGS)) PKG_CFLAGS!=echo pkg-config --cflags $(REQ_PKGS) -PKG_LDFLAGS:=$(shell pkg-config --libs $(REQ_PKGS) x11) -PKG_LDFLAGS!=echo pkg-config --libs $(REQ_PKGS) x11 +LDLIBS:=$(shell pkg-config --libs $(REQ_PKGS) x11) +LDLIBS!=echo pkg-config --libs $(REQ_PKGS) x11 -CFLAGS = -std=c99 $(PKG_CFLAGS) -ggdb $(CPPFLAGS) -fPIC -W -Wall -Wextra -pedantic +CFLAGS += -std=c99 $(PKG_CFLAGS) -ggdb -W -Wall -Wextra -pedantic -fPIC -pthread SRC = $(wildcard src/*.c) HEAD = $(wildcard src/*.h) @@ -44,19 +44,13 @@ all: uzbl-browser uzbl-cookie-manager VPATH:=src -.c.o: - @echo -e "${CC} -c ${CFLAGS} $<" - @${CC} -c ${CFLAGS} $< - ${OBJ}: ${HEAD} uzbl-core: ${OBJ} - @echo -e "\n${CC} -o $@ ${OBJ} ${PKG_LDFLAGS} -pthread ${LDFLAGS}" - @${CC} -o $@ ${OBJ} ${PKG_LDFLAGS} -pthread ${LDFLAGS} -uzbl-cookie-manager: examples/uzbl-cookie-manager.o src/util.o - @echo -e "\n${CC} -o $@ uzbl-cookie-manager.o util.o ${LDFLAGS} ${shell pkg-config --libs glib-2.0 libsoup-2.4}" - @${CC} -o $@ uzbl-cookie-manager.o util.o ${LDFLAGS} $(shell pkg-config --libs glib-2.0 libsoup-2.4) +uzbl-cookie-manager: examples/uzbl-cookie-manager.o util.o + @echo -e "\n${CC} -o $@ examples/uzbl-cookie-manager.o util.o ${shell pkg-config --libs glib-2.0 libsoup-2.4}" + @${CC} -o $@ examples/uzbl-cookie-manager.o util.o $(shell pkg-config --libs glib-2.0 libsoup-2.4) uzbl-browser: uzbl-core uzbl-cookie-manager diff --git a/tests/Makefile b/tests/Makefile index 0da12ba..bfe74c5 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -21,21 +21,21 @@ CPPFLAGS += -DARCH=\"$(ARCH)\" -DCOMMIT=\"$(COMMIT_HASH)\" PKG_CFLAGS:=$(shell pkg-config --cflags $(REQ_PKGS)) PKG_CFLAGS!=echo pkg-config --cflags $(REQ_PKGS) -PKG_LDFLAGS:=$(shell pkg-config --libs $(REQ_PKGS) x11) -PKG_LDFLAGS!=echo pkg-config --libs $(REQ_PKGS) x11 +LDLIBS:=$(shell pkg-config --libs $(REQ_PKGS) x11) +LDLIBS!=echo pkg-config --libs $(REQ_PKGS) x11 -CFLAGS = -std=c99 $(PKG_CFLAGS) -ggdb -fPIC -W -Wall -Wextra -pedantic +CFLAGS += -std=c99 $(PKG_CFLAGS) -ggdb -fPIC -W -Wall -Wextra -pedantic -pthread -LDFLAGS = $(PKG_LDFLAGS) -pthread -L . -luzbl-core +GTESTER = gtester +GTESTER_REPORT = gtester-report -GTESTER:=gtester -GTESTER_REPORT:=gtester-report - -TEST_PROGS:=test-expand test-command +TEST_PROGS = test-expand test-command all: $(TEST_PROGS) LD_LIBRARY_PATH="$(LD_LIBRARY_PATH):." $(GTESTER) --verbose $(TEST_PROGS) +${TEST_PROGS}: libuzbl-core.so + clean: rm -f $(TEST_PROGS) rm -f libuzbl-core.so -- cgit v1.2.3 From b88cac232712ede3235e3ceb33a3d3993fa5c7bb Mon Sep 17 00:00:00 2001 From: Brendan Taylor Date: Mon, 27 Dec 2010 19:17:31 -0700 Subject: only compile with -fPIC when needed --- Makefile | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 9a8454d..ee23065 100644 --- a/Makefile +++ b/Makefile @@ -34,11 +34,12 @@ PKG_CFLAGS!=echo pkg-config --cflags $(REQ_PKGS) LDLIBS:=$(shell pkg-config --libs $(REQ_PKGS) x11) LDLIBS!=echo pkg-config --libs $(REQ_PKGS) x11 -CFLAGS += -std=c99 $(PKG_CFLAGS) -ggdb -W -Wall -Wextra -pedantic -fPIC -pthread +CFLAGS += -std=c99 $(PKG_CFLAGS) -ggdb -W -Wall -Wextra -pedantic -pthread SRC = $(wildcard src/*.c) HEAD = $(wildcard src/*.h) -OBJ = $(foreach obj, $(SRC:.c=.o), $(notdir $(obj))) +OBJ = $(foreach obj, $(SRC:.c=.o), $(notdir $(obj))) +LOBJ = $(foreach obj, $(SRC:.c=.lo), $(notdir $(obj))) all: uzbl-browser uzbl-cookie-manager @@ -46,6 +47,9 @@ VPATH:=src ${OBJ}: ${HEAD} +${LOBJ}: + $(CC) $(CPPFLAGS) $(CFLAGS) -fPIC -c src/$(@:.lo=.c) -o $@ + uzbl-core: ${OBJ} uzbl-cookie-manager: examples/uzbl-cookie-manager.o util.o @@ -59,8 +63,8 @@ uzbl-browser: uzbl-core uzbl-cookie-manager force: # When compiling unit tests, compile uzbl as a library first -tests: ${OBJ} force - $(CC) -shared -Wl ${OBJ} -o ./tests/libuzbl-core.so +tests: ${LOBJ} force + $(CC) -shared -Wl ${LOBJ} -o ./tests/libuzbl-core.so cd ./tests/; $(MAKE) test-uzbl-core: uzbl-core @@ -106,7 +110,7 @@ test-uzbl-tabbed-sandbox: uzbl-browser clean: rm -f uzbl-core rm -f uzbl-cookie-manager - rm -f *.o + rm -f *.o *.lo find ./examples/ -name "*.pyc" -delete cd ./tests/; $(MAKE) clean rm -rf ./sandbox/ -- cgit v1.2.3 From f18f3318d8a62656ccfef8f983e1629c2ab1c986 Mon Sep 17 00:00:00 2001 From: Brendan Taylor Date: Mon, 27 Dec 2010 19:52:00 -0700 Subject: explain the .lo Makefile rules --- Makefile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index ee23065..7724303 100644 --- a/Makefile +++ b/Makefile @@ -47,9 +47,6 @@ VPATH:=src ${OBJ}: ${HEAD} -${LOBJ}: - $(CC) $(CPPFLAGS) $(CFLAGS) -fPIC -c src/$(@:.lo=.c) -o $@ - uzbl-core: ${OBJ} uzbl-cookie-manager: examples/uzbl-cookie-manager.o util.o @@ -62,6 +59,10 @@ uzbl-browser: uzbl-core uzbl-cookie-manager .PHONY: tests force: +# this is here because the .so needs to be compiled with -fPIC on x86_64 +${LOBJ}: ${SRC} ${HEAD} + $(CC) $(CPPFLAGS) $(CFLAGS) -fPIC -c src/$(@:.lo=.c) -o $@ + # When compiling unit tests, compile uzbl as a library first tests: ${LOBJ} force $(CC) -shared -Wl ${LOBJ} -o ./tests/libuzbl-core.so -- cgit v1.2.3 From 771dfb3e4c29b7389478ae427de720864d155e38 Mon Sep 17 00:00:00 2001 From: keis Date: Tue, 28 Dec 2010 09:28:08 +0100 Subject: use gtk version check macro --- Makefile | 2 +- src/uzbl-core.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 44a07a1..87d00c3 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ CPPFLAGS = # gtk3 #REQ_PKGS += gtk+-3.0 webkitgtk-3.0 -#CPPFLAGS = -DGTK3 +#CPPFLAG = CFLAGS:=-std=c99 $(shell pkg-config --cflags $(REQ_PKGS)) -ggdb -Wall -W -DARCH="\"$(shell uname -m)\"" -lgthread-2.0 -DCOMMIT="\"$(shell ./misc/hash.sh)\"" $(CPPFLAGS) -fPIC -W -Wall -Wextra -pedantic CFLAGS!=echo -std=c99 `pkg-config --cflags $(REQ_PKGS)` -ggdb -Wall -W -DARCH='"\""'`uname -m`'"\""' -lgthread-2.0 -DCOMMIT='"\""'`./misc/hash.sh`'"\""' $(CPPFLAGS) -fPIC -W -Wall -Wextra -pedantic diff --git a/src/uzbl-core.c b/src/uzbl-core.c index 73ed5c6..a33d51d 100644 --- a/src/uzbl-core.c +++ b/src/uzbl-core.c @@ -2279,7 +2279,7 @@ retrieve_geometry() { void set_webview_scroll_adjustments() { -#ifdef GTK3 +#if GTK_CHECK_VERSION(2,91,0) gtk_scrollable_set_hadjustment (GTK_SCROLLABLE(uzbl.gui.web_view), uzbl.gui.bar_h); gtk_scrollable_set_vadjustment (GTK_SCROLLABLE(uzbl.gui.web_view), uzbl.gui.bar_v); #else -- cgit v1.2.3 From 4164140730a92a5abfda5545a9ff5ce2e44776cb Mon Sep 17 00:00:00 2001 From: keis Date: Tue, 28 Dec 2010 10:43:24 +0100 Subject: disable deprecated symbols when using gtk+ 3 --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 87d00c3..0c2881f 100644 --- a/Makefile +++ b/Makefile @@ -4,11 +4,11 @@ REQ_PKGS = libsoup-2.4 gthread-2.0 glib-2.0 # gtk2 REQ_PKGS += gtk+-2.0 webkit-1.0 -CPPFLAGS = +CPPFLAGS = # gtk3 #REQ_PKGS += gtk+-3.0 webkitgtk-3.0 -#CPPFLAG = +#CPPFLAG = -DG_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED CFLAGS:=-std=c99 $(shell pkg-config --cflags $(REQ_PKGS)) -ggdb -Wall -W -DARCH="\"$(shell uname -m)\"" -lgthread-2.0 -DCOMMIT="\"$(shell ./misc/hash.sh)\"" $(CPPFLAGS) -fPIC -W -Wall -Wextra -pedantic CFLAGS!=echo -std=c99 `pkg-config --cflags $(REQ_PKGS)` -ggdb -Wall -W -DARCH='"\""'`uname -m`'"\""' -lgthread-2.0 -DCOMMIT='"\""'`./misc/hash.sh`'"\""' $(CPPFLAGS) -fPIC -W -Wall -Wextra -pedantic -- cgit v1.2.3 From 5b78756e9a395f79db4416ac1b93f440153acefd Mon Sep 17 00:00:00 2001 From: Brendan Taylor Date: Thu, 30 Dec 2010 18:21:14 -0700 Subject: remove positional argument support from examples --- examples/data/scripts/download.sh | 1 - examples/data/scripts/follow.sh | 2 -- examples/data/scripts/formfiller.sh | 2 -- examples/data/scripts/load_cookies.sh | 4 ++-- examples/data/scripts/per-site-settings.py | 2 +- examples/data/scripts/session.sh | 6 ------ 6 files changed, 3 insertions(+), 14 deletions(-) diff --git a/examples/data/scripts/download.sh b/examples/data/scripts/download.sh index df7a571..c410ad2 100755 --- a/examples/data/scripts/download.sh +++ b/examples/data/scripts/download.sh @@ -6,7 +6,6 @@ # that path. # if nothing is printed to stdout, the download will be cancelled. -shift 7 . $UZBL_UTIL_DIR/uzbl-dir.sh # the URL that is being downloaded diff --git a/examples/data/scripts/follow.sh b/examples/data/scripts/follow.sh index 2d666a2..d1560bf 100755 --- a/examples/data/scripts/follow.sh +++ b/examples/data/scripts/follow.sh @@ -3,8 +3,6 @@ # This script is just a wrapper around follow.js that lets us change uzbl's mode # after a link is selected. -shift 7 - # if socat is installed then we can change Uzbl's input mode once a link is # selected; otherwise we just select a link. if ! which socat >/dev/null 2>&1; then diff --git a/examples/data/scripts/formfiller.sh b/examples/data/scripts/formfiller.sh index 6e04573..c6822e6 100755 --- a/examples/data/scripts/formfiller.sh +++ b/examples/data/scripts/formfiller.sh @@ -53,8 +53,6 @@ MODELINE="> vim:ft=formfiller" [ -d "$(dirname $UZBL_FORMS_DIR)" ] || exit 1 [ -d $UZBL_FORMS_DIR ] || mkdir $UZBL_FORMS_DIR || exit 1 -shift 7 - action=$1 domain=$(echo $UZBL_URI | sed 's/\(http\|https\):\/\/\([^\/]\+\)\/.*/\2/') diff --git a/examples/data/scripts/load_cookies.sh b/examples/data/scripts/load_cookies.sh index f4c6886..17ec2ad 100755 --- a/examples/data/scripts/load_cookies.sh +++ b/examples/data/scripts/load_cookies.sh @@ -1,7 +1,7 @@ #!/bin/sh -if [ "$8" != "" ]; then - cookie_file=$8 +if [ "$1" != "" ]; then + cookie_file=$1 else cookie_file=${XDG_DATA_HOME:-$HOME/.local/share}/uzbl/cookies.txt fi diff --git a/examples/data/scripts/per-site-settings.py b/examples/data/scripts/per-site-settings.py index febfd0f..89df4e6 100755 --- a/examples/data/scripts/per-site-settings.py +++ b/examples/data/scripts/per-site-settings.py @@ -100,7 +100,7 @@ def write_to_socket(commands, sockpath): if __name__ == '__main__': sockpath = os.environ['UZBL_SOCKET'] url = urlparse.urlparse(os.environ['UZBL_URI']) - filepath = sys.argv[8] + filepath = sys.argv[1] mode = os.stat(filepath)[stat.ST_MODE] diff --git a/examples/data/scripts/session.sh b/examples/data/scripts/session.sh index 36e0c19..ee09cf2 100755 --- a/examples/data/scripts/session.sh +++ b/examples/data/scripts/session.sh @@ -30,12 +30,6 @@ fi UZBL="uzbl-browser -c $UZBL_CONFIG_FILE" # add custom flags and whatever here. -if [ $# -gt 1 ]; then - # this script is being run from uzbl, rather than standalone - # discard the uzbl arguments - shift 7 -fi - scriptfile=$(readlink -f $0) # this script act="$1" -- cgit v1.2.3 From 5692aed1d470553a8c7f5c731162bb9f4c7360fb Mon Sep 17 00:00:00 2001 From: Brendan Taylor Date: Thu, 30 Dec 2010 18:21:45 -0700 Subject: change tests that expected positional arguments --- tests/test-command.c | 38 ++------------------------------------ 1 file changed, 2 insertions(+), 36 deletions(-) diff --git a/tests/test-command.c b/tests/test-command.c index 6194081..7b33405 100644 --- a/tests/test-command.c +++ b/tests/test-command.c @@ -29,33 +29,6 @@ extern UzblCore uzbl; #define INSTANCE_NAME "testing" -gchar* -assert_str_beginswith(GString *expected, gchar *actual) { - gchar *actual_beginning = g_strndup(actual, expected->len); - g_assert_cmpstr(expected->str, ==, actual_beginning); - g_free(actual_beginning); - - /* return the part of the actual string that hasn't been compared yet */ - return &actual[expected->len]; -} - -/* compare the contents of uzbl.comm.sync_stdout to the standard arguments that - * should have been passed. This is meant to be called after something like "sync echo". */ -gchar* -assert_sync_beginswith_stdarg() { - GString *stdargs = g_string_new(""); - - g_string_append_printf(stdargs, "%s %d %d ", uzbl.state.config_file, getpid(), (int)uzbl.xwin); - g_string_append_printf(stdargs, "%s %s ", uzbl.comm.fifo_path, uzbl.comm.socket_path); - g_string_append_printf(stdargs, "%s %s ", uzbl.state.uri, uzbl.gui.main_title); - - gchar *rest = assert_str_beginswith(stdargs, uzbl.comm.sync_stdout); - - g_string_free(stdargs, TRUE); - - return rest; -} - #define ASSERT_EVENT(EF, STR) { read_event(ef); \ g_assert_cmpstr("EVENT [" INSTANCE_NAME "] " STR "\n", ==, ef->event_buffer); } @@ -314,13 +287,10 @@ test_run_handler_arg_order (void) { assert(uzbl.comm.sync_stdout); - /* the result should begin with the standard handler arguments */ - gchar *rest = assert_sync_beginswith_stdarg(); - /* the rest of the result should be the arguments passed to run_handler. */ /* the arguments in the second argument to run_handler should be placed before any * included in the first argument to run handler. */ - g_assert_cmpstr("abc def uvw xyz\n", ==, rest); + g_assert_cmpstr("abc def uvw xyz\n", ==, uzbl.comm.sync_stdout); } void @@ -330,12 +300,8 @@ test_run_handler_expand (void) { assert(uzbl.comm.sync_stdout); - /* the result should begin with the standard handler arguments */ - gchar *rest = assert_sync_beginswith_stdarg(); - - /* the rest of the result should be the arguments passed to run_handler. */ /* the user-specified arguments to the handler should have been expanded */ - g_assert_cmpstr("result: Test uzbl uzr agent\n", ==, rest); + g_assert_cmpstr("result: Test uzbl uzr agent\n", ==, uzbl.comm.sync_stdout); } int -- cgit v1.2.3 From 718c13eb7528348f50b37a16599cec876d512cfa Mon Sep 17 00:00:00 2001 From: Brendan Taylor Date: Thu, 30 Dec 2010 18:24:22 -0700 Subject: remove positional arguments from README --- README | 43 ++++++++++++++++++++----------------------- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/README b/README index 35492da..e4e3cab 100644 --- a/README +++ b/README @@ -499,39 +499,36 @@ access to the following environment variables: * `$UZBL_URI`: The URI of the current page. * `$UZBL_TITLE`: The current page title. -These variables are also available as positional arguments `$1` through `$7`, -but this is deprecated and will be removed. - Handler scripts (`download_handler`, `cookie_handler`, `scheme_handler` and `authentication_handler`) are called with special arguments: * download handler - - `$8 url`: The URL of the item to be downloaded. - - `$9 suggested_filename`: A filename suggested by the server or based on the URL. - - `$10 content_type`: The mimetype of the file to be downloaded. - - `$11 total_size`: The size of the file to be downloaded in bytes. This may be inaccurate. + - `$1 url`: The URL of the item to be downloaded. + - `$2 suggested_filename`: A filename suggested by the server or based on the URL. + - `$3 content_type`: The mimetype of the file to be downloaded. + - `$4 total_size`: The size of the file to be downloaded in bytes. This may be inaccurate. * cookie handler - - `$8 GET/PUT`: Whether a cookie should be sent to the server (`GET`) or + - `$1 GET/PUT`: Whether a cookie should be sent to the server (`GET`) or stored by the browser (`PUT`). - - `$9 scheme`: Either `http` or `https`. - - `$10 host`: If current page URL is `www.example.com/somepage`, this could be + - `$2 scheme`: Either `http` or `https`. + - `$3 host`: If current page URL is `www.example.com/somepage`, this could be something else than `example.com`, eg advertising from another host. - - `$11 path`: The request address path. - - `$12 data`: The cookie data. Only included for `PUT` requests. + - `$4 path`: The request address path. + - `$5 data`: The cookie data. Only included for `PUT` requests. * scheme handler - - `$8 URI` of the page to be navigated to + - `$1 URI` of the page to be navigated to * authentication handler: - - `$8`: authentication zone unique identifier - - `$9`: domain part of URL that requests authentication - - `$10`: authentication realm - - `$11`: FALSE if this is the first attempt to authenticate, TRUE otherwise + - `$1`: authentication zone unique identifier + - `$2`: domain part of URL that requests authentication + - `$3`: authentication realm + - `$4`: FALSE if this is the first attempt to authenticate, TRUE otherwise ### Formfiller.sh @@ -577,15 +574,15 @@ Example: Script will be executed on each authentication request. It will receive four auth-related parameters: - $8 authentication zone unique identifier (may be used as 'key') - $9 domain part of URL that requests authentication - $10 authentication realm - $11 FALSE if this is the first attempt to authenticate, TRUE otherwise + $1 authentication zone unique identifier (may be used as 'key') + $2 domain part of URL that requests authentication + $3 authentication realm + $4 FALSE if this is the first attempt to authenticate, TRUE otherwise Script is expected to print exactly two lines of text on stdout (that means its output must contain exactly two '\n' bytes). The first line contains username, the second one - password. -If authentication fails, script will be executed again (with $11 = TRUE). +If authentication fails, script will be executed again (with $4 = TRUE). Non-interactive scripts should handle this case and do not try to authenticate again to avoid loops. If number of '\n' characters in scripts output does not equal 2, authentication will fail. @@ -594,7 +591,7 @@ That means 401 error will be displayed and uzbl won't try to authenticate anymor The simplest example of authentication handler script is: #!/bin/sh -[ "$11" == "TRUE ] && exit +[ "$4" == "TRUE ] && exit echo alice echo wonderland -- cgit v1.2.3 From 8c8bd0fbd5644d91ff3cdd2b13c07f28e7e0f716 Mon Sep 17 00:00:00 2001 From: Brendan Taylor Date: Fri, 31 Dec 2010 19:05:31 -0700 Subject: support the dmenu-4.2.1 tok patch --- examples/data/scripts/util/dmenu.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/examples/data/scripts/util/dmenu.sh b/examples/data/scripts/util/dmenu.sh index da61cae..354d7d1 100644 --- a/examples/data/scripts/util/dmenu.sh +++ b/examples/data/scripts/util/dmenu.sh @@ -60,10 +60,16 @@ fi if dmenu --help 2>&1 | grep -q '\[-xs\]'; then DMENU_XMMS_ARGS="-xs" DMENU_HAS_XMMS=1 +fi - if echo $DMENU_OPTIONS | grep -q -w 'xmms'; then - DMENU_ARGS="$DMENU_ARGS $DMENU_XMMS_ARGS" - fi +# Detect the tok patch +if dmenu --help 2>&1 | grep -q '\[-t\]'; then + DMENU_XMMS_ARGS="-t" + DMENU_HAS_XMMS=1 +fi + +if echo $DMENU_OPTIONS | grep -q -w 'xmms'; then + DMENU_ARGS="$DMENU_ARGS $DMENU_XMMS_ARGS" fi # Detect the vertical patch -- cgit v1.2.3 From 0f3d7ef6f8150e30ebab28895ddb4c4c3beefb8c Mon Sep 17 00:00:00 2001 From: Brendan Taylor Date: Mon, 3 Jan 2011 10:52:41 -0700 Subject: add accept_languages setting --- README | 1 + src/callbacks.c | 11 +++++++++++ src/callbacks.h | 3 +++ src/uzbl-core.c | 1 + src/uzbl-core.h | 1 + 5 files changed, 17 insertions(+) diff --git a/README b/README index e4e3cab..98ae22c 100644 --- a/README +++ b/README @@ -329,6 +329,7 @@ file). rendered content. * `useragent`: The User-Agent to send to the browser, expands variables in its definition. +* `accept_languages`: The Accept-Language header to send with HTTP requests. * `zoom_level`: The factor by which elements in the page are scaled with respect to their original size. Setting this will resize the currently displayed page. * `zoom_type`: Whether to use "full-content" zoom (defaults to true). With diff --git a/src/callbacks.c b/src/callbacks.c index 673979e..7b06873 100644 --- a/src/callbacks.c +++ b/src/callbacks.c @@ -308,6 +308,17 @@ cmd_useragent() { } } +void +set_accept_languages() { + if (*uzbl.net.accept_languages == ' ') { + g_free (uzbl.net.accept_languages); + uzbl.net.accept_languages = NULL; + } else { + g_object_set(G_OBJECT(uzbl.net.soup_session), + SOUP_SESSION_ACCEPT_LANGUAGE, uzbl.net.accept_languages, NULL); + } +} + void cmd_javascript_windows() { g_object_set (G_OBJECT(view_settings()), "javascript-can-open-windows-automatically", diff --git a/src/callbacks.h b/src/callbacks.h index 40fa80d..899e959 100644 --- a/src/callbacks.h +++ b/src/callbacks.h @@ -82,6 +82,9 @@ cmd_socket_dir(); void cmd_useragent() ; +void +set_accept_languages(); + void cmd_autoload_img(); diff --git a/src/uzbl-core.c b/src/uzbl-core.c index b7b8b00..2a91563 100644 --- a/src/uzbl-core.c +++ b/src/uzbl-core.c @@ -102,6 +102,7 @@ const struct var_name_to_ptr_t { { "max_conns", PTR_V_INT(uzbl.net.max_conns, 1, cmd_max_conns)}, { "max_conns_host", PTR_V_INT(uzbl.net.max_conns_host, 1, cmd_max_conns_host)}, { "useragent", PTR_V_STR(uzbl.net.useragent, 1, cmd_useragent)}, + { "accept_languages", PTR_V_STR(uzbl.net.accept_languages, 1, set_accept_languages)}, { "javascript_windows", PTR_V_INT(uzbl.behave.javascript_windows, 1, cmd_javascript_windows)}, /* requires webkit >=1.1.14 */ { "view_source", PTR_V_INT(uzbl.behave.view_source, 0, cmd_view_source)}, diff --git a/src/uzbl-core.h b/src/uzbl-core.h index 129c6a5..7076095 100644 --- a/src/uzbl-core.h +++ b/src/uzbl-core.h @@ -111,6 +111,7 @@ typedef struct { SoupLogger *soup_logger; char *proxy_url; char *useragent; + char *accept_languages; gint max_conns; gint max_conns_host; } Network; -- cgit v1.2.3 From 0e40979506f1c82e6cc9182416962370d787e9b3 Mon Sep 17 00:00:00 2001 From: Brendan Taylor Date: Tue, 4 Jan 2011 10:50:37 -0700 Subject: use NEW_WINDOW event in examples that open new windows --- examples/config/config | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/examples/config/config b/examples/config/config index f2d55b0..7bc0087 100644 --- a/examples/config/config +++ b/examples/config/config @@ -48,13 +48,19 @@ set download_handler = sync_spawn @scripts_dir/download.sh # === Dynamic event handlers ================================================= +# What to do when a website wants to open a new window: # Open link in new window @on_event NEW_WINDOW sh 'uzbl-browser ${1:+-u "$1"}' %r -# Open in current window +# Open in current window (also see the REQ_NEW_WINDOW event handler below) #@on_event NEW_WINDOW uri %s -# Open in new tab +# Open in new tab. Other options are NEW_TAB_NEXT, NEW_BG_TAB and NEW_BG_TAB_NEXT. #@on_event NEW_WINDOW event NEW_TAB %s +# What to do when the user requests a new window: +# If your the NEW_WINDOW handler opens the uri in the current window, you'll +# probably want to change this handler to open a new window or tab. +@on_event REQ_NEW_WINDOW event NEW_WINDOW %s + # Load start handler @on_event LOAD_START @set_status wait # Reset the keycmd on navigation @@ -186,7 +192,7 @@ set ebind = @mode_bind global,-insert # --- Mouse bindings --------------------------------------------------------- # Middle click open in new window -@bind = sh 'if [ "$1" ]; then uzbl-browser -u "$1"; else echo "uri $(xclip -o | sed s/\\\@/%40/g)" > "$UZBL_FIFO"; fi' '\@SELECTED_URI' +@bind = sh 'if [ "$1" ]; then echo "event REQ_NEW_WINDOW $1" > "$UZBL_FIFO"; else echo "uri $(xclip -o | sed s/\\\@/%40/g)" > "$UZBL_FIFO"; fi' '\@SELECTED_URI' # --- Keyboard bindings ------------------------------------------------------ @@ -195,7 +201,7 @@ set ebind = @mode_bind global,-insert @cbind :_ = %s # open a new window or a new tab (see the on_event NEW_WINDOW settings above) -@cbind w = event NEW_WINDOW +@cbind w = event REQ_NEW_WINDOW # Page movement binds @cbind j = scroll vertical 20 @@ -275,18 +281,17 @@ set ebind = @mode_bind global,-insert @cbind yu = sh 'echo -n "$UZBL_URI" | xclip' @cbind yU = sh 'echo -n "$1" | xclip' \@SELECTED_URI @cbind yy = sh 'echo -n "$UZBL_TITLE" | xclip' -@cbind yY = sh 'echo -n "$1" | xclip' \@SELECTED_URI # Clone current window -@cbind c = sh 'uzbl-browser -u "$UZBL_URI"' +@cbind c = event REQ_NEW_WINDOW \@uri # Go the page from primary selection -@cbind p = sh 'echo "uri `xclip -selection primary -o | sed s/\\\@/%40/g`" > "$UZBL_FIFO"' +@cbind p = sh 'echo "uri $(xclip -o | sed s/\\\@/%40/g)" > "$UZBL_FIFO"' # Go to the page in clipboard -@cbind P = sh 'echo "uri `xclip -selection clipboard -o | sed s/\\\@/%40/g`" > "$UZBL_FIFO"' +@cbind P = sh 'echo "uri $(xclip -selection clipboard -o | sed s/\\\@/%40/g)" > "$UZBL_FIFO"' # Start a new uzbl instance from the page in primary selection -@cbind 'p = sh 'exec uzbl-browser --uri "$(xclip -o)"' +@cbind 'p = sh 'echo "event REQ_NEW_WINDOW $(xclip -o)" > "$UZBL_FIFO"' # paste primary selection into keycmd at the cursor position -@bind = sh 'echo "event INJECT_KEYCMD `xclip -o | sed s/\\\@/%40/g`" > "$UZBL_FIFO"' +@bind = sh 'echo "event INJECT_KEYCMD $(xclip -o | sed s/\\\@/%40/g)" > "$UZBL_FIFO"' # Bookmark inserting binds @cbind b_ = sh 'echo `printf "$UZBL_URI %s"` >> "$XDG_DATA_HOME"/uzbl/bookmarks' @@ -324,12 +329,6 @@ set formfiller = spawn @scripts_dir/formfiller.sh @cbind gN = event NEW_TAB_NEXT @cbind go_ = event NEW_TAB %s @cbind gO_ = event NEW_TAB_NEXT %s -@cbind gy = sh 'echo "event NEW_TAB `xclip -selection primary -o | sed s/\\\@/%40/g`" > "$UZBL_FIFO"' -@cbind gY = sh 'echo "event NEW_TAB_NEXT `xclip -selection primary -o | sed s/\\\@/%40/g`" > "$UZBL_FIFO"' - -# Clone current tab -@cbind gd = sh 'echo "event NEW_TAB $UZBL_URI" > "$UZBL_FIFO"' -@cbind gD = sh 'echo "event NEW_TAB_NEXT $UZBL_URI" > "$UZBL_FIFO"' # Closing / resting @cbind gC = exit -- cgit v1.2.3 From 597c1051c36a51bc730c9684a1a7a6d9535001cb Mon Sep 17 00:00:00 2001 From: keis Date: Wed, 5 Jan 2011 00:18:58 +0100 Subject: clear GError before reusing --- src/uzbl-core.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/uzbl-core.c b/src/uzbl-core.c index 592a8dd..c5e9832 100644 --- a/src/uzbl-core.c +++ b/src/uzbl-core.c @@ -1771,13 +1771,16 @@ control_client_socket(GIOChannel *clientchan) { ret = g_io_channel_read_line(clientchan, &ctl_line, &len, NULL, &error); if (ret == G_IO_STATUS_ERROR) { g_warning ("Error reading: %s\n", error->message); + g_clear_error (&error); remove_socket_from_array(clientchan); g_io_channel_shutdown(clientchan, TRUE, &error); + g_clear_error (&error); return FALSE; } else if (ret == G_IO_STATUS_EOF) { remove_socket_from_array(clientchan); /* shutdown and remove channel watch from main loop */ g_io_channel_shutdown(clientchan, TRUE, &error); + g_clear_error (&error); return FALSE; } @@ -1788,11 +1791,12 @@ control_client_socket(GIOChannel *clientchan) { &len, &error); if (ret == G_IO_STATUS_ERROR) { g_warning ("Error writing: %s", error->message); + g_clear_error (&error); } g_io_channel_flush(clientchan, &error); + g_clear_error (&error); } - if (error) g_error_free (error); g_string_free(result, TRUE); g_free(ctl_line); return TRUE; -- cgit v1.2.3 From 55ce375945db478c563ed3e04dd2db86049ed20e Mon Sep 17 00:00:00 2001 From: keis Date: Wed, 5 Jan 2011 00:41:46 +0100 Subject: print the error message received --- src/uzbl-core.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/uzbl-core.c b/src/uzbl-core.c index c5e9832..c6813ea 100644 --- a/src/uzbl-core.c +++ b/src/uzbl-core.c @@ -1770,17 +1770,23 @@ control_client_socket(GIOChannel *clientchan) { ret = g_io_channel_read_line(clientchan, &ctl_line, &len, NULL, &error); if (ret == G_IO_STATUS_ERROR) { - g_warning ("Error reading: %s\n", error->message); - g_clear_error (&error); - remove_socket_from_array(clientchan); - g_io_channel_shutdown(clientchan, TRUE, &error); + g_warning ("Error reading: %s", error->message); g_clear_error (&error); + remove_socket_from_array (clientchan); + ret = g_io_channel_shutdown (clientchan, TRUE, &error); + if (ret == G_IO_STATUS_ERROR) { + g_warning ("Error closing: %s", error->message); + g_clear_error (&error); + } return FALSE; } else if (ret == G_IO_STATUS_EOF) { - remove_socket_from_array(clientchan); + remove_socket_from_array (clientchan); /* shutdown and remove channel watch from main loop */ - g_io_channel_shutdown(clientchan, TRUE, &error); - g_clear_error (&error); + ret = g_io_channel_shutdown (clientchan, TRUE, &error); + if (ret == G_IO_STATUS_ERROR) { + g_warning ("Error closing: %s", error->message); + g_clear_error (&error); + } return FALSE; } @@ -1793,8 +1799,10 @@ control_client_socket(GIOChannel *clientchan) { g_warning ("Error writing: %s", error->message); g_clear_error (&error); } - g_io_channel_flush(clientchan, &error); - g_clear_error (&error); + if (g_io_channel_flush(clientchan, &error) == G_IO_STATUS_ERROR) { + g_warning ("Error flushing: %s", error->message); + g_clear_error (&error); + } } g_string_free(result, TRUE); -- cgit v1.2.3 From f2f0b1b3cf6b9b6f0ac51d6a20a9b739b2d4c006 Mon Sep 17 00:00:00 2001 From: keis Date: Wed, 5 Jan 2011 02:19:40 +0100 Subject: unref IOChannel after shutdown --- src/uzbl-core.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/uzbl-core.c b/src/uzbl-core.c index c6813ea..c451f86 100644 --- a/src/uzbl-core.c +++ b/src/uzbl-core.c @@ -1692,13 +1692,12 @@ gboolean remove_socket_from_array(GIOChannel *chan) { gboolean ret = 0; - /* TODO: Do wee need to manually free the IO channel or is this - * happening implicitly on unref? - */ ret = g_ptr_array_remove_fast(uzbl.comm.connect_chan, chan); if(!ret) ret = g_ptr_array_remove_fast(uzbl.comm.client_chan, chan); + if(ret) + g_io_channel_unref (chan); return ret; } @@ -1772,17 +1771,17 @@ control_client_socket(GIOChannel *clientchan) { if (ret == G_IO_STATUS_ERROR) { g_warning ("Error reading: %s", error->message); g_clear_error (&error); - remove_socket_from_array (clientchan); ret = g_io_channel_shutdown (clientchan, TRUE, &error); + remove_socket_from_array (clientchan); if (ret == G_IO_STATUS_ERROR) { g_warning ("Error closing: %s", error->message); g_clear_error (&error); } return FALSE; } else if (ret == G_IO_STATUS_EOF) { - remove_socket_from_array (clientchan); /* shutdown and remove channel watch from main loop */ ret = g_io_channel_shutdown (clientchan, TRUE, &error); + remove_socket_from_array (clientchan); if (ret == G_IO_STATUS_ERROR) { g_warning ("Error closing: %s", error->message); g_clear_error (&error); -- cgit v1.2.3 From 2a53b3b14765af687312ebf36d19171189359b22 Mon Sep 17 00:00:00 2001 From: keis Date: Wed, 5 Jan 2011 02:27:35 +0100 Subject: gerror fix in send_event_sockets --- src/events.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/events.c b/src/events.c index baaf8f3..31a95d5 100644 --- a/src/events.c +++ b/src/events.c @@ -78,10 +78,15 @@ send_event_sockets(GPtrArray *sockets, GString *msg) { msg->str, msg->len, &len, &error); - if (ret == G_IO_STATUS_ERROR) + if (ret == G_IO_STATUS_ERROR) { g_warning ("Error sending event to socket: %s", error->message); - else - g_io_channel_flush(gio, &error); + g_clear_error (&error); + } else { + if (g_io_channel_flush(gio, &error) == G_IO_STATUS_ERROR) { + g_warning ("Error flushing: %s", error->message); + g_clear_error (&error); + } + } } } } -- cgit v1.2.3 From 14115e3414aee7103c4a4fe81c35fa69a60227e0 Mon Sep 17 00:00:00 2001 From: keis Date: Wed, 5 Jan 2011 02:36:00 +0100 Subject: fix memory leak in search_text --- src/uzbl-core.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/uzbl-core.c b/src/uzbl-core.c index 2a91563..bd0bb2c 100644 --- a/src/uzbl-core.c +++ b/src/uzbl-core.c @@ -1145,6 +1145,7 @@ search_text (WebKitWebView *page, GArray *argv, const gboolean forward) { if (g_strcmp0 (uzbl.state.searchtx, argv_idx(argv, 0)) != 0) { webkit_web_view_unmark_text_matches (page); webkit_web_view_mark_text_matches (page, argv_idx(argv, 0), FALSE, 0); + g_free (uzbl.state.searchtx); uzbl.state.searchtx = g_strdup(argv_idx(argv, 0)); } } @@ -1164,10 +1165,7 @@ search_clear(WebKitWebView *page, GArray *argv, GString *result) { (void) result; webkit_web_view_unmark_text_matches (page); - if(uzbl.state.searchtx) { - g_free(uzbl.state.searchtx); - uzbl.state.searchtx = NULL; - } + uzbl.state.searchtx = strfree (uzbl.state.searchtx); } void -- cgit v1.2.3 From b869e6a8e127ff674600a1141fc2bae9b77067cb Mon Sep 17 00:00:00 2001 From: Brendan Taylor Date: Thu, 6 Jan 2011 16:41:30 -0700 Subject: split the status bar into left-aligned and right-aligned parts (thanks k0ral) --- AUTHORS | 1 + README | 12 +++++---- src/uzbl-core.c | 75 +++++++++++++++++++++++++++++++++------------------------ src/uzbl-core.h | 13 ++++++++-- 4 files changed, 63 insertions(+), 38 deletions(-) diff --git a/AUTHORS b/AUTHORS index f7e4a16..6522237 100644 --- a/AUTHORS +++ b/AUTHORS @@ -52,6 +52,7 @@ In alphabetical order: Jan Kolkmeier (jouz) - scrolling, link following Jason Woofenden (JasonWoof) - geometry=maximized, link following Jochen Sprickerhof - session.sh enhancements + k0ral - split status bar Lars-Dominik Braun (PromyLOPh) - added ability to enable/disable the webkit page cache Laurence Withers (lwithers) - talk_to_socket Luca Bruno - bashims fixes diff --git a/README b/README index 98ae22c..051fe6b 100644 --- a/README +++ b/README @@ -291,8 +291,10 @@ file). * `keycmd`: Holds the input buffer (callback: update input buffer). * `show_status`: Show statusbar or not. * `status_top`: statusbar on top? -* `status_format`: Marked up, to be expanded string for statusbar (callback: - update statusbar). +* `status_format`: Marked up, to be expanded string for statusbar's left side + (callback: update statusbar). +* `status_format_right`: Marked up, to be expanded string for statusbar's right side + (callback: update statusbar). * `status_background`: color which can be used to override Gtk theme. * `title_format_long`: titlebar string when no statusbar shown (will be expanded). @@ -470,10 +472,10 @@ that should be evaluated on every update need to be escaped: set title_format_short = \\\@(date)\\\@ # the title will stay constant as a literal "@(date)@" -The `status_format` variable can contain +The `status_format` and `status_format_right` variables can contain [Pango](http://library.gnome.org/devel/pango/stable/PangoMarkupFormat.html) -markup . In the `status_format`, variables that might contain characters like -`<`, `&` and `>`, should be wrapped in a `@[ ]@` substitution so that they don't +markup . In these variables, expansions that might produce the characters `<`, +`&` or `>` should be wrapped in `@[ ]@` substitutions so that they don't interfere with the status bar's markup; see the sample config for examples. ### EXTERNAL SCRIPTS diff --git a/src/uzbl-core.c b/src/uzbl-core.c index 2a91563..4a1b071 100644 --- a/src/uzbl-core.c +++ b/src/uzbl-core.c @@ -85,6 +85,7 @@ const struct var_name_to_ptr_t { { "show_status", PTR_V_INT(uzbl.behave.show_status, 1, cmd_set_status)}, { "status_top", PTR_V_INT(uzbl.behave.status_top, 1, move_statusbar)}, { "status_format", PTR_V_STR(uzbl.behave.status_format, 1, NULL)}, + { "status_format_right", PTR_V_STR(uzbl.behave.status_format_right, 1, NULL)}, { "status_background", PTR_V_STR(uzbl.behave.status_background, 1, set_status_background)}, { "title_format_long", PTR_V_STR(uzbl.behave.title_format_long, 1, NULL)}, { "title_format_short", PTR_V_STR(uzbl.behave.title_format_short, 1, NULL)}, @@ -1873,42 +1874,43 @@ init_socket(gchar *dir) { /* return dir or, on error, free dir and return NULL * return NULL; } -/* - NOTE: we want to keep variables like b->title_format_long in their "unprocessed" state - it will probably improve performance if we would "cache" the processed variant, but for now it works well enough... -*/ -// this function may be called very early when the templates are not set (yet), hence the checks void update_title (void) { Behaviour *b = &uzbl.behave; - gchar *parsed; - const gchar *current_title; - /* this check is here because if we're starting up or shutting down it might not be a window */ - gboolean have_main_window = !uzbl.state.plug_mode && GTK_IS_WINDOW(uzbl.gui.main_window); - if(have_main_window) - current_title = gtk_window_get_title (GTK_WINDOW(uzbl.gui.main_window)); + const gchar *title_format = b->title_format_long; + /* Update the status bar if shown */ if (b->show_status) { - if (b->title_format_short && have_main_window) { - parsed = expand(b->title_format_short, 0); - if(!current_title || strcmp(current_title, parsed)) - gtk_window_set_title (GTK_WINDOW(uzbl.gui.main_window), parsed); - g_free(parsed); - } - if (b->status_format && GTK_IS_LABEL(uzbl.gui.mainbar_label)) { - parsed = expand(b->status_format, 0); - gtk_label_set_markup(GTK_LABEL(uzbl.gui.mainbar_label), parsed); + title_format = b->title_format_short; + + /* Left side */ + if (b->status_format && GTK_IS_LABEL(uzbl.gui.mainbar_label_left)) { + gchar *parsed = expand(b->status_format, 0); + gtk_label_set_markup(GTK_LABEL(uzbl.gui.mainbar_label_left), parsed); g_free(parsed); } - } else { - if (b->title_format_long && have_main_window) { - parsed = expand(b->title_format_long, 0); - if(!current_title || strcmp(current_title, parsed)) - gtk_window_set_title (GTK_WINDOW(uzbl.gui.main_window), parsed); + + /* Right side */ + if (b->status_format_right && GTK_IS_LABEL(uzbl.gui.mainbar_label_right)) { + gchar *parsed = expand(b->status_format_right, 0); + gtk_label_set_markup(GTK_LABEL(uzbl.gui.mainbar_label_right), parsed); g_free(parsed); } } + + /* Update window title */ + /* If we're starting up or shutting down there might not be a window yet. */ + gboolean have_main_window = !uzbl.state.plug_mode && GTK_IS_WINDOW(uzbl.gui.main_window); + if (title_format && have_main_window) { + gchar *parsed = expand(title_format, 0); + const gchar *current_title = gtk_window_get_title (GTK_WINDOW(uzbl.gui.main_window)); + /* xmonad hogs CPU if the window title updates too frequently, so we + * don't set it unless we need to. */ + if(!current_title || strcmp(current_title, parsed)) + gtk_window_set_title (GTK_WINDOW(uzbl.gui.main_window), parsed); + g_free(parsed); + } } void @@ -1946,12 +1948,23 @@ create_mainbar () { GUI *g = &uzbl.gui; g->mainbar = gtk_hbox_new (FALSE, 0); - g->mainbar_label = gtk_label_new (""); - gtk_label_set_selectable((GtkLabel *)g->mainbar_label, TRUE); - gtk_label_set_ellipsize(GTK_LABEL(g->mainbar_label), PANGO_ELLIPSIZE_END); - gtk_misc_set_alignment (GTK_MISC(g->mainbar_label), 0, 0); - gtk_misc_set_padding (GTK_MISC(g->mainbar_label), 2, 2); - gtk_box_pack_start (GTK_BOX (g->mainbar), g->mainbar_label, TRUE, TRUE, 0); + + /* Left panel */ + g->mainbar_label_left = gtk_label_new (""); + gtk_label_set_selectable(GTK_LABEL(g->mainbar_label_left), TRUE); + gtk_misc_set_alignment (GTK_MISC(g->mainbar_label_left), 0, 0); + gtk_misc_set_padding (GTK_MISC(g->mainbar_label_left), 2, 2); + + gtk_box_pack_start (GTK_BOX (g->mainbar), g->mainbar_label_left, FALSE, FALSE, 0); + + /* Right panel */ + g->mainbar_label_right = gtk_label_new (""); + gtk_label_set_selectable(GTK_LABEL(g->mainbar_label_right), TRUE); + gtk_misc_set_alignment (GTK_MISC(g->mainbar_label_right), 1, 0); + gtk_misc_set_padding (GTK_MISC(g->mainbar_label_right), 2, 2); + gtk_label_set_ellipsize(GTK_LABEL(g->mainbar_label_right), PANGO_ELLIPSIZE_START); + + gtk_box_pack_start (GTK_BOX (g->mainbar), g->mainbar_label_right, TRUE, TRUE, 0); g_object_connect((GObject*)g->mainbar, "signal::key-press-event", (GCallback)key_press_cb, NULL, diff --git a/src/uzbl-core.h b/src/uzbl-core.h index 7076095..f81722d 100644 --- a/src/uzbl-core.h +++ b/src/uzbl-core.h @@ -51,8 +51,12 @@ typedef struct { GtkPlug* plug; GtkWidget* scrolled_win; GtkWidget* vbox; + + /* Mainbar */ GtkWidget* mainbar; - GtkWidget* mainbar_label; + GtkWidget* mainbar_label_left; + GtkWidget* mainbar_label_right; + GtkScrollbar* scbar_v; // Horizontal and Vertical Scrollbar GtkScrollbar* scbar_h; // (These are still hidden) GtkAdjustment* bar_v; // Information about document length @@ -119,10 +123,15 @@ typedef struct { /* behaviour */ typedef struct { + /* Status bar */ gchar* status_format; + gchar* status_format_right; + gchar* status_background; + + /* Window title */ gchar* title_format_short; gchar* title_format_long; - gchar* status_background; + gchar* fifo_dir; gchar* socket_dir; gchar* cookie_handler; -- cgit v1.2.3 From c60e5b1c082b2322567e32d31d010a29e79f97b1 Mon Sep 17 00:00:00 2001 From: Brendan Taylor Date: Thu, 6 Jan 2011 16:47:01 -0700 Subject: use new status_format_right in the example config now long URLs won't push everything else off the status bar! --- examples/config/config | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/config/config b/examples/config/config index 7bc0087..46a3ae4 100644 --- a/examples/config/config +++ b/examples/config/config @@ -111,7 +111,8 @@ set selected_section = \@[\@SELECTED_URI]\@ set download_section = \@downloads -set status_format = @mode_section @keycmd_section @progress_section @uri_section @name_section @status_section @scroll_section @selected_section @download_section +set status_format = @mode_section @keycmd_section @progress_section @name_section @status_section @scroll_section @selected_section @download_section +set status_format_right = uri: @uri_section set title_format_long = \@keycmd_prompt \@raw_modcmd \@raw_keycmd \@TITLE - Uzbl browser <\@NAME> \@SELECTED_URI -- cgit v1.2.3 From 47d0b30b3345a8128d1b064cf9bbdc379a45dfa5 Mon Sep 17 00:00:00 2001 From: Brendan Taylor Date: Thu, 6 Jan 2011 17:44:22 -0700 Subject: we don't need to be that specific in the useragent header. --- examples/config/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/config/config b/examples/config/config index 46a3ae4..a2ecdb8 100644 --- a/examples/config/config +++ b/examples/config/config @@ -126,7 +126,7 @@ set progress.pending = # === Useragent setup ======================================================== -set useragent = Uzbl (Webkit @{WEBKIT_MAJOR}.@{WEBKIT_MINOR}.@{WEBKIT_MICRO}) (@(+uname -sm)@ [@ARCH_UZBL]) (Commit @COMMIT) +set useragent = Uzbl (Webkit @{WEBKIT_MAJOR}.@{WEBKIT_MINOR}) (@(+uname -sm)@ [@ARCH_UZBL]) # === Configure cookie blacklist ======================================================== # Drop google analytics tracking cookies -- cgit v1.2.3 From 89850b773de8b4fe5053c7ce87846691b8e931d2 Mon Sep 17 00:00:00 2001 From: koral Date: Mon, 10 Jan 2011 10:49:39 -0700 Subject: Correctly updates URI and tab title of each uzbl instance. --- examples/data/scripts/uzbl-tabbed | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/data/scripts/uzbl-tabbed b/examples/data/scripts/uzbl-tabbed index 0086c04..1d64436 100755 --- a/examples/data/scripts/uzbl-tabbed +++ b/examples/data/scripts/uzbl-tabbed @@ -452,7 +452,7 @@ class UzblInstance: type, args = args.split(" ", 1) if type == "TITLE_CHANGED": self.title = args.strip() - self.title_changed() + self.title_changed(False) elif type == "VARIABLE_SET": var, _, val = args.split(" ", 2) @@ -485,6 +485,8 @@ class UzblInstance: if var == "uri": self.uri = val.strip() self.parent.update_tablist() + elif type == "LOAD_COMMIT": + self.uri = args elif type == "NEW_TAB": self.parent.new_tab(args) elif type == "NEW_BG_TAB": -- cgit v1.2.3 From 422375d57659732dd8d975498ca2ae09edd4c125 Mon Sep 17 00:00:00 2001 From: Brendan Taylor Date: Mon, 10 Jan 2011 10:50:23 -0700 Subject: update k0ral in AUTHORS --- AUTHORS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AUTHORS b/AUTHORS index 6522237..f5144a1 100644 --- a/AUTHORS +++ b/AUTHORS @@ -52,7 +52,7 @@ In alphabetical order: Jan Kolkmeier (jouz) - scrolling, link following Jason Woofenden (JasonWoof) - geometry=maximized, link following Jochen Sprickerhof - session.sh enhancements - k0ral - split status bar + k0ral - split status bar, cleanup and bugfix patches Lars-Dominik Braun (PromyLOPh) - added ability to enable/disable the webkit page cache Laurence Withers (lwithers) - talk_to_socket Luca Bruno - bashims fixes -- cgit v1.2.3 From f2c7c41f6cc70e1d509967c7487aec5126495557 Mon Sep 17 00:00:00 2001 From: Brendan Taylor Date: Thu, 13 Jan 2011 11:59:23 -0700 Subject: remove the vestiges of Uzbl.run --- README | 19 ------------------- src/uzbl-core.c | 48 ------------------------------------------------ 2 files changed, 67 deletions(-) diff --git a/README b/README index 051fe6b..d1f2357 100644 --- a/README +++ b/README @@ -602,25 +602,6 @@ This script tries to authenticate as user alice with password wonderland once and never retries authentication. See examples for more sofisticated, interactive authentication handler. -### JAVASCRIPT HELPER OBJECT DISABLED BECAUSE OF SECURITY LEAK - -JavaScript code run from `uzbl` is given a special object in the global -namespace which gives special privileges to these scripts. This object is called -`Uzbl`, and it is added and removed before and after the script execution so -that it is hidden to web JavaScript code (there is no race condition, since all -the JavaScript code runs in a single thread). - -Currently, the `Uzbl` object provides only one function: - -* `Uzbl.run( )` - - Command is any `uzbl` command as defined above. - - Return value: a string, either empty or containing the output of the - command. Very few commands return their output currently, including `js`, - `script`, and `print`. - - Examples: - * `Uzbl.run("spawn insert_bookmark.sh")` - * `uri = Uzbl.run("print @uri")` (see variable expansion below) - ### EVENTS Unlike commands, events are not handled in `uzbl` itself, but are propagated diff --git a/src/uzbl-core.c b/src/uzbl-core.c index 6bbed3c..c6443cc 100644 --- a/src/uzbl-core.c +++ b/src/uzbl-core.c @@ -979,52 +979,6 @@ load_uri (WebKitWebView *web_view, GArray *argv, GString *result) { } /* Javascript*/ - -JSValueRef -js_run_command (JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, - size_t argumentCount, const JSValueRef arguments[], - JSValueRef* exception) { - (void) function; - (void) thisObject; - (void) exception; - - JSStringRef js_result_string; - GString *result = g_string_new(""); - - if (argumentCount >= 1) { - JSStringRef arg = JSValueToStringCopy(ctx, arguments[0], NULL); - size_t arg_size = JSStringGetMaximumUTF8CStringSize(arg); - char ctl_line[arg_size]; - JSStringGetUTF8CString(arg, ctl_line, arg_size); - - parse_cmd_line(ctl_line, result); - - JSStringRelease(arg); - } - js_result_string = JSStringCreateWithUTF8CString(result->str); - - g_string_free(result, TRUE); - - return JSValueMakeString(ctx, js_result_string); -} - -JSStaticFunction js_static_functions[] = { - {"run", js_run_command, kJSPropertyAttributeNone}, -}; - -void -js_init() { - /* This function creates the class and its definition, only once */ - if (!uzbl.js.initialized) { - /* it would be pretty cool to make this dynamic */ - uzbl.js.classdef = kJSClassDefinitionEmpty; - uzbl.js.classdef.staticFunctions = js_static_functions; - - uzbl.js.classref = JSClassCreate(&uzbl.js.classdef); - } -} - - void eval_js(WebKitWebView * web_view, gchar *script, GString *result, const char *file) { WebKitWebFrame *frame; @@ -1037,8 +991,6 @@ eval_js(WebKitWebView * web_view, gchar *script, GString *result, const char *fi JSStringRef js_result_string; size_t js_result_size; - js_init(); - frame = webkit_web_view_get_main_frame(WEBKIT_WEB_VIEW(web_view)); context = webkit_web_frame_get_global_context(frame); globalobject = JSContextGetGlobalObject(context); -- cgit v1.2.3 From 3c1697ff57a8fb4b01969da16d66ed37f0652d9b Mon Sep 17 00:00:00 2001 From: Brendan Taylor Date: Thu, 13 Jan 2011 17:44:40 -0700 Subject: don't make the window bigger to accomodate a long status_format --- src/uzbl-core.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/uzbl-core.c b/src/uzbl-core.c index c6443cc..147a9ae 100644 --- a/src/uzbl-core.c +++ b/src/uzbl-core.c @@ -1943,6 +1943,12 @@ create_window () { gtk_window_set_default_size (GTK_WINDOW (window), 800, 600); gtk_widget_set_name (window, "Uzbl browser"); + /* if the window has been made small, it shouldn't try to resize itself due + * to a long statusbar. */ + GdkGeometry hints; + hints.min_width = 1; + gtk_window_set_geometry_hints (GTK_WINDOW (window), window, &hints, GDK_HINT_MIN_SIZE); + g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (destroy_cb), NULL); g_signal_connect (G_OBJECT (window), "configure-event", G_CALLBACK (configure_event_cb), NULL); -- cgit v1.2.3 From 63f77587bcc44c0edef74690d82555425d59d79a Mon Sep 17 00:00:00 2001 From: Brendan Taylor Date: Sun, 16 Jan 2011 12:23:58 -0700 Subject: explicitly set geometry min_height (fixes a bug in the last commit) --- src/uzbl-core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/uzbl-core.c b/src/uzbl-core.c index 147a9ae..877dbda 100644 --- a/src/uzbl-core.c +++ b/src/uzbl-core.c @@ -1946,7 +1946,8 @@ create_window () { /* if the window has been made small, it shouldn't try to resize itself due * to a long statusbar. */ GdkGeometry hints; - hints.min_width = 1; + hints.min_height = -1; + hints.min_width = 1; gtk_window_set_geometry_hints (GTK_WINDOW (window), window, &hints, GDK_HINT_MIN_SIZE); g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (destroy_cb), NULL); -- cgit v1.2.3 From 835f5d8d09b429a4776192dbe00be5ae20704b16 Mon Sep 17 00:00:00 2001 From: Brendan Taylor Date: Sun, 16 Jan 2011 12:31:21 -0700 Subject: don't crash when a download content-type can't be found --- src/callbacks.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/callbacks.c b/src/callbacks.c index 7b06873..fa2ed1f 100644 --- a/src/callbacks.c +++ b/src/callbacks.c @@ -825,16 +825,19 @@ download_cb(WebKitWebView *web_view, WebKitDownload *download, gpointer user_dat g_object_get(download, "suggested-filename", &suggested_filename, NULL); /* get the mimetype of the download */ - const gchar *content_type; + const gchar *content_type = NULL; WebKitNetworkResponse *r = webkit_download_get_network_response(download); /* downloads can be initiated from the context menu, in that case there is no network response yet and trying to get one would crash. */ if(WEBKIT_IS_NETWORK_RESPONSE(r)) { - SoupMessage *m = webkit_network_response_get_message(r); - SoupMessageHeaders *h; + SoupMessage *m = webkit_network_response_get_message(r); + SoupMessageHeaders *h = NULL; g_object_get(m, "response-headers", &h, NULL); - content_type = soup_message_headers_get_one(h, "Content-Type"); - } else + if(h) /* some versions of libsoup don't have "response-headers" here */ + content_type = soup_message_headers_get_one(h, "Content-Type"); + } + + if(!content_type) content_type = "application/octet-stream"; /* get the filesize of the download, as given by the server. -- cgit v1.2.3