From e0dadf73c0d42fd2a82e44d10b9d42f41d841114 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Tue, 26 May 2009 15:37:13 +0200 Subject: Makefile: Rebuilt uzbl if config.h was changed Signed-off-by: Uli Schlachter --- Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Makefile b/Makefile index d158a9b..f1ec7f5 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,11 @@ CPPFLAGS=$(shell pkg-config --cflags gtk+-2.0 webkit-1.0) -ggdb -Wall -W -DARCH= LDFLAGS=$(shell pkg-config --libs gtk+-2.0 webkit-1.0) all: uzbl uzblctrl +uzbl: uzbl.c uzbl.h config.h + +%: %.c + $(CC) $(CPPFLAGS) $(LDFLAGS) $(LIBS) -o $@ $< + test: uzbl ./uzbl --uri http://www.uzbl.org -- cgit v1.2.3 From c1e8c50b6a23a462fe650105b8460100d847dbb9 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Tue, 26 May 2009 16:11:08 +0200 Subject: Print a warning when a key binding is overwritten Signed-off-by: Uli Schlachter --- uzbl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/uzbl.c b/uzbl.c index ba6655a..1a71f33 100644 --- a/uzbl.c +++ b/uzbl.c @@ -2019,6 +2019,8 @@ add_binding (const gchar *key, const gchar *act) { printf ("Binding %-10s : %s\n", key, act); action = new_action(parts[0], parts[1]); + if (g_hash_table_remove (uzbl.bindings, key)) + g_warning ("Overwriting existing binding for \"%s\"", key); g_hash_table_replace(uzbl.bindings, g_strdup(key), action); g_strfreev(parts); } -- cgit v1.2.3 From fecb218597b3ef6129c4cfa51d9894a9170fcba0 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Tue, 26 May 2009 16:17:10 +0200 Subject: Fix all compiler warnings about invalid casts Signed-off-by: Uli Schlachter --- uzbl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/uzbl.c b/uzbl.c index 1a71f33..02a3dd0 100644 --- a/uzbl.c +++ b/uzbl.c @@ -842,7 +842,7 @@ expand_template(const char *template, gboolean escape_markup) { token = g_scanner_get_next_token(uzbl.scan); if(token == G_TOKEN_SYMBOL) { - sym = (int)g_scanner_cur_value(uzbl.scan).v_symbol; + sym = GPOINTER_TO_INT(g_scanner_cur_value(uzbl.scan).v_symbol); switch(sym) { case SYM_URI: if(escape_markup) { @@ -1181,7 +1181,7 @@ get_var_value(gchar *name) { if(c->type == TYPE_STR) printf("VAR: %s VALUE: %s\n", name, (char *)*c->ptr); else if(c->type == TYPE_INT) - printf("VAR: %s VALUE: %d\n", name, (int)*c->ptr); + printf("VAR: %s VALUE: %p\n", name, *c->ptr); } return TRUE; } @@ -1438,7 +1438,7 @@ set_var_value(gchar *name, gchar *val) { g_free(*c->ptr); *c->ptr = g_strdup(val); } else if(c->type == TYPE_INT) { - int *ip = (int *)c->ptr; + int *ip = (int *) c->ptr; *ip = (int)strtoul(val, &endp, 10); } -- cgit v1.2.3 From 16987b4c01df41cb85c7a9ecfc06c571110efacc Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Tue, 26 May 2009 18:05:27 +0200 Subject: Allow tabs as delimiters in 'set' commands Signed-off-by: Uli Schlachter --- uzbl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uzbl.c b/uzbl.c index 02a3dd0..5a96d2b 100644 --- a/uzbl.c +++ b/uzbl.c @@ -1163,7 +1163,7 @@ static void setup_regex() { uzbl.comm.get_regex = g_regex_new("^[Gg][a-zA-Z]*\\s+([^ \\n]+)$", G_REGEX_OPTIMIZE, 0, NULL); - uzbl.comm.set_regex = g_regex_new("^[Ss][a-zA-Z]*\\s+([^ ]+)\\s*=\\s*([^\\n].*)$", + uzbl.comm.set_regex = g_regex_new("^[Ss][a-zA-Z]*\\s+([^ \\t]+)\\s*=\\s*([^\\n].*)$", G_REGEX_OPTIMIZE, 0, NULL); uzbl.comm.bind_regex = g_regex_new("^[Bb][a-zA-Z]*\\s+?(.*[^ ])\\s*?=\\s*([a-z][^\\n].+)$", G_REGEX_UNGREEDY|G_REGEX_OPTIMIZE, 0, NULL); -- cgit v1.2.3 From 7d736c38eb82399aee003ce1602a72da8a56d22c Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Tue, 26 May 2009 18:35:42 +0200 Subject: Fix downloads This adds mime-type-policy-decision-requested callback which simply downloads everything which can't be displayed. Without this, nothing is ever downloaded. Google lead me to this: http://gitorious.org/qtwebkit/qtwebkit/commit/1f30e169cd379ac8917040e4734e11d8283bab5d https://bugs.webkit.org/show_bug.cgi?id=25987 Signed-off-by: Uli Schlachter --- uzbl.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/uzbl.c b/uzbl.c index 5a96d2b..6a6f77f 100644 --- a/uzbl.c +++ b/uzbl.c @@ -348,6 +348,23 @@ new_window_cb (WebKitWebView *web_view, WebKitWebFrame *frame, WebKitNetworkRequ return (FALSE); } +static gboolean +mime_policy_cb(WebKitWebView *web_view, WebKitWebFrame *frame, WebKitNetworkRequest *request, gchar *mime_type, WebKitWebPolicyDecision *policy_decision, gpointer user_data) { + (void) frame; + (void) request; + (void) user_data; + + /* If we can display it, let's display it... */ + if (webkit_web_view_can_show_mime_type (web_view, mime_type)) { + webkit_web_policy_decision_use (policy_decision); + return TRUE; + } + + /* ...everything we can't displayed is downloaded */ + webkit_web_policy_decision_download (policy_decision); + return TRUE; +} + WebKitWebView* create_web_view_cb (WebKitWebView *web_view, WebKitWebFrame *frame, gpointer user_data) { (void) web_view; @@ -1948,6 +1965,7 @@ create_browser () { g_signal_connect (G_OBJECT (g->web_view), "new-window-policy-decision-requested", G_CALLBACK (new_window_cb), g->web_view); g_signal_connect (G_OBJECT (g->web_view), "download-requested", G_CALLBACK (download_cb), g->web_view); g_signal_connect (G_OBJECT (g->web_view), "create-web-view", G_CALLBACK (create_web_view_cb), g->web_view); + g_signal_connect (G_OBJECT (g->web_view), "mime-type-policy-decision-requested", G_CALLBACK (mime_policy_cb), g->web_view); return scrolled_window; } -- cgit v1.2.3 From 8d3ba4e27da46a84fbc4df3960ce2c17d1106fca Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Thu, 28 May 2009 11:49:45 +0200 Subject: Prolly not a good idea, but adds e.g. PREFIX support to the Makefile But now bsd make most likely cannot parse this anymore... Signed-off-by: Uli Schlachter --- Makefile | 47 ++++++++++++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index f1ec7f5..e03fab7 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,24 @@ -CPPFLAGS=$(shell pkg-config --cflags gtk+-2.0 webkit-1.0) -ggdb -Wall -W -DARCH="\"$(shell uname -m)\"" -DG_ERRORCHECK_MUTEXES -DCOMMIT="\"$(shell git log | head -n1 | sed "s/.* //")\"" -LDFLAGS=$(shell pkg-config --libs gtk+-2.0 webkit-1.0) +LIBS := gtk+-2.0 webkit-1.0 +ARCH := $(shell uname -m) +COMMIT := $(shell git log | head -n1 | sed "s/.* //") +DEBUG := -ggdb -Wall -W -DG_ERRORCHECK_MUTEXES + +CFLAGS := $(shell --cflags $(LIBS)) $(DEBUG) -DARCH="$(ARCH)" -DCOMMIT="\"$(COMMIT)\"" +LDFLAGS := $(shell --libs $(LIBS)) + +PREFIX ?= /usr/local +BINDIR ?= $(PREFIX)/bin +DATADIR ?= $(PREFIX)/share +UZBLDATA?= $(DATADIR)/uzbl +DOCSDIR ?= $(UZBLDATA)/docs +EXMPLSDIR ?= $(UZBLDATA)/examples + all: uzbl uzblctrl uzbl: uzbl.c uzbl.h config.h %: %.c - $(CC) $(CPPFLAGS) $(LDFLAGS) $(LIBS) -o $@ $< + $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(LIBS) -o $@ $< test: uzbl ./uzbl --uri http://www.uzbl.org @@ -14,25 +27,25 @@ test-config: uzbl ./uzbl --uri http://www.uzbl.org < examples/configs/sampleconfig-dev test-config-real: uzbl - ./uzbl --uri http://www.uzbl.org < /usr/share/uzbl/examples/configs/sampleconfig + ./uzbl --uri http://www.uzbl.org < $(UZBLDATA)/examples/configs/sampleconfig clean: rm -f uzbl rm -f uzblctrl install: - install -d $(DESTDIR)/usr/bin - install -d $(DESTDIR)/usr/share/uzbl/docs - install -d $(DESTDIR)/usr/share/uzbl/examples - install -D -m755 uzbl $(DESTDIR)/usr/bin/uzbl - install -D -m755 uzblctrl $(DESTDIR)/usr/bin/uzblctrl - cp -ax docs $(DESTDIR)/usr/share/uzbl/ - cp -ax config.h $(DESTDIR)/usr/share/uzbl/docs/ - cp -ax examples $(DESTDIR)/usr/share/uzbl/ - install -D -m644 AUTHORS $(DESTDIR)/usr/share/uzbl/docs - install -D -m644 README $(DESTDIR)/usr/share/uzbl/docs + install -d $(DESTDIR)$(BINDIR) + install -d $(DESTDIR)$(DOCSDIR) + install -d $(DESTDIR)$(EXMPLSDIR) + install -D -m755 uzbl $(DESTDIR)$(BINDIR)/uzbl + install -D -m755 uzblctrl $(DESTDIR)$(BINDIR)/uzblctrl + cp -ax docs/* $(DESTDIR)$(DOCSDIR) + cp -ax config.h $(DESTDIR)$(DOCSDIR) + cp -ax examples/* $(DESTDIR)$(EXMPLSDIR) + install -D -m644 AUTHORS $(DESTDIR)$(DOCSDIR) + install -D -m644 README $(DESTDIR)$(DOCSDIR) uninstall: - rm -rf $(DESTDIR)/usr/bin/uzbl - rm -rf $(DESTDIR)/usr/bin/uzblctrl - rm -rf $(DESTDIR)/usr/share/uzbl + rm -rf $(DESTDIR)$(BINDIR)/uzbl + rm -rf $(DESTDIR)$(BINDIR)/uzblctrl + rm -rf $(DESTDIR)$(UZBLDATA) -- cgit v1.2.3