aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Makefile41
-rw-r--r--examples/config/config2
-rw-r--r--examples/data/scripts/follow.js4
-rwxr-xr-xexamples/data/scripts/follow.sh2
-rw-r--r--src/callbacks.c34
-rw-r--r--src/callbacks.h12
-rw-r--r--src/events.c4
-rw-r--r--src/events.h1
-rw-r--r--src/uzbl-core.c8
9 files changed, 77 insertions, 31 deletions
diff --git a/Makefile b/Makefile
index dad7e61..25991b8 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,3 @@
-# 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
@@ -8,31 +6,30 @@ INSTALLDIR?=$(DESTDIR)$(PREFIX)
DOCDIR?=$(INSTALLDIR)/share/uzbl/docs
RUN_PREFIX?=$(PREFIX)
-# gtk2
-REQ_PKGS += gtk+-2.0 webkit-1.0
-CPPFLAGS =
+# use GTK3-based webkit when it is available
+USE_GTK3 = $(shell pkg-config --exists gtk+-3.0 webkitgtk-3.0 && echo 1)
-# gtk3
-#REQ_PKGS += gtk+-3.0 webkitgtk-3.0
-#CPPFLAGS = -DG_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED
+ifeq ($(USE_GTK3),1)
+ REQ_PKGS += gtk+-3.0 webkitgtk-3.0
+ CPPFLAGS = -DG_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED
+else
+ REQ_PKGS += gtk+-2.0 webkit-1.0
+ CPPFLAGS =
+endif
# --- configuration ends here ---
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)
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 -pthread
@@ -79,7 +76,6 @@ test-uzbl-core-sandbox: uzbl-core
rm -rf ./sandbox/usr
test-uzbl-browser-sandbox: uzbl-browser
- make DESTDIR=./sandbox RUN_PREFIX=`pwd`/sandbox/usr/local install-uzbl-core
make DESTDIR=./sandbox RUN_PREFIX=`pwd`/sandbox/usr/local install-uzbl-browser
make DESTDIR=./sandbox RUN_PREFIX=`pwd`/sandbox/usr/local install-example-data
cp -np ./misc/env.sh ./sandbox/env.sh
@@ -90,7 +86,6 @@ test-uzbl-browser-sandbox: uzbl-browser
rm -rf ./sandbox/usr
test-uzbl-tabbed-sandbox: uzbl-browser
- make DESTDIR=./sandbox RUN_PREFIX=`pwd`/sandbox/usr/local install-uzbl-core
make DESTDIR=./sandbox RUN_PREFIX=`pwd`/sandbox/usr/local install-uzbl-browser
make DESTDIR=./sandbox RUN_PREFIX=`pwd`/sandbox/usr/local install-uzbl-tabbed
make DESTDIR=./sandbox RUN_PREFIX=`pwd`/sandbox/usr/local install-example-data
@@ -130,22 +125,24 @@ install-uzbl-core: all install-dirs
install -m644 src/config.h $(DOCDIR)/
install -m644 README $(DOCDIR)/
install -m644 AUTHORS $(DOCDIR)/
- cp -r examples $(INSTALLDIR)/share/uzbl/
- chmod 755 $(INSTALLDIR)/share/uzbl/examples/data/scripts/*
install -m755 uzbl-core $(INSTALLDIR)/bin/uzbl-core
-install-uzbl-browser: install-dirs
- install -m755 bin/uzbl-browser $(INSTALLDIR)/bin/uzbl-browser
+install-event-manager: install-dirs
install -m755 bin/uzbl-event-manager $(INSTALLDIR)/bin/uzbl-event-manager
- mv $(INSTALLDIR)/bin/uzbl-browser $(INSTALLDIR)/bin/uzbl-browser.bak
- sed 's#^PREFIX=.*#PREFIX=$(RUN_PREFIX)#' < $(INSTALLDIR)/bin/uzbl-browser.bak > $(INSTALLDIR)/bin/uzbl-browser
- chmod 755 $(INSTALLDIR)/bin/uzbl-browser
- rm $(INSTALLDIR)/bin/uzbl-browser.bak
mv $(INSTALLDIR)/bin/uzbl-event-manager $(INSTALLDIR)/bin/uzbl-event-manager.bak
sed "s#^PREFIX = .*#PREFIX = '$(RUN_PREFIX)'#" < $(INSTALLDIR)/bin/uzbl-event-manager.bak > $(INSTALLDIR)/bin/uzbl-event-manager
chmod 755 $(INSTALLDIR)/bin/uzbl-event-manager
rm $(INSTALLDIR)/bin/uzbl-event-manager.bak
+install-uzbl-browser: install-dirs install-uzbl-core install-event-manager
+ install -m755 bin/uzbl-browser $(INSTALLDIR)/bin/uzbl-browser
+ mv $(INSTALLDIR)/bin/uzbl-browser $(INSTALLDIR)/bin/uzbl-browser.bak
+ sed 's#^PREFIX=.*#PREFIX=$(RUN_PREFIX)#' < $(INSTALLDIR)/bin/uzbl-browser.bak > $(INSTALLDIR)/bin/uzbl-browser
+ chmod 755 $(INSTALLDIR)/bin/uzbl-browser
+ rm $(INSTALLDIR)/bin/uzbl-browser.bak
+ cp -r examples $(INSTALLDIR)/share/uzbl/
+ chmod 755 $(INSTALLDIR)/share/uzbl/examples/data/scripts/*
+
install-uzbl-tabbed: install-dirs
install -m755 bin/uzbl-tabbed $(INSTALLDIR)/bin/uzbl-tabbed
diff --git a/examples/config/config b/examples/config/config
index 029ce57..9507b95 100644
--- a/examples/config/config
+++ b/examples/config/config
@@ -83,7 +83,7 @@ set download_handler = sync_spawn @scripts_dir/download.sh
@on_event LOAD_FINISH spawn @scripts_dir/history.sh
# Switch to insert mode if a (editable) html form is clicked
-@on_event FORM_ACTIVE @set_mode insert
+@on_event FOCUS_ELEMENT sh 'if [ "$1" == INPUT ]; then echo "@set_mode insert" > $UZBL_FIFO; fi' %s
# Switch to command mode if anything else is clicked
@on_event ROOT_ACTIVE @set_mode command
diff --git a/examples/data/scripts/follow.js b/examples/data/scripts/follow.js
index 782b1d1..2d65489 100644
--- a/examples/data/scripts/follow.js
+++ b/examples/data/scripts/follow.js
@@ -16,10 +16,10 @@ uzbldivid = 'uzbl_link_hints';
uzbl.follow = function() {
// Export
charset = arguments[0];
- if (arguments[2] == 'click') {
+ if (arguments[2] == 0 || arguments[2] == 'click') {
newwindow = false;
returnuri = false;
- } else if (arguments[2] == 'newwindow') {
+ } else if (arguments[2] == 1 || arguments[2] == 'newwindow') {
newwindow = true;
returnuri = false;
} else if (arguments[2] == 'returnuri') {
diff --git a/examples/data/scripts/follow.sh b/examples/data/scripts/follow.sh
index f08bd29..3f61488 100755
--- a/examples/data/scripts/follow.sh
+++ b/examples/data/scripts/follow.sh
@@ -10,7 +10,7 @@ shift
case "$result" in
XXXEMIT_FORM_ACTIVEXXX)
# a form element was selected
- printf 'event FORM_ACTIVE\nevent KEYCMD_CLEAR\n' > "$UZBL_FIFO"
+ printf 'event KEYCMD_CLEAR\n' > "$UZBL_FIFO"
;;
XXXRESET_MODEXXX)
# a link was selected, reset uzbl's input mode
diff --git a/src/callbacks.c b/src/callbacks.c
index 14748c4..853edb2 100644
--- a/src/callbacks.c
+++ b/src/callbacks.c
@@ -1048,4 +1048,38 @@ scrollbars_policy_cb(WebKitWebView *view) {
return TRUE;
}
+void
+window_object_cleared_cb(WebKitWebView *webview, WebKitWebFrame *frame,
+ JSGlobalContextRef *context, JSObjectRef *object) {
+ (void) frame; (void) context; (void) object;
+#if WEBKIT_CHECK_VERSION (1, 3, 13)
+ // Take this opportunity to set some callbacks on the DOM
+ WebKitDOMDocument *document = webkit_web_view_get_dom_document (webview);
+ webkit_dom_event_target_add_event_listener (WEBKIT_DOM_EVENT_TARGET (document),
+ "focus", G_CALLBACK(dom_focus_cb), TRUE, NULL);
+ webkit_dom_event_target_add_event_listener (WEBKIT_DOM_EVENT_TARGET (document),
+ "blur", G_CALLBACK(dom_focus_cb), TRUE, NULL);
+#else
+ (void) webview;
+#endif
+}
+
+#if WEBKIT_CHECK_VERSION (1, 3, 13)
+void
+dom_focus_cb(WebKitDOMEventTarget *target, WebKitDOMEvent *event, gpointer user_data) {
+ (void) target; (void) user_data;
+ WebKitDOMEventTarget *etarget = webkit_dom_event_get_target (event);
+ gchar* name = webkit_dom_node_get_node_name (WEBKIT_DOM_NODE (etarget));
+ send_event (FOCUS_ELEMENT, NULL, TYPE_STR, name, NULL);
+}
+
+void
+dom_blur_cb(WebKitDOMEventTarget *target, WebKitDOMEvent *event, gpointer user_data) {
+ (void) target; (void) user_data;
+ WebKitDOMEventTarget *etarget = webkit_dom_event_get_target (event);
+ gchar* name = webkit_dom_node_get_node_name (WEBKIT_DOM_NODE (etarget));
+ send_event (BLUR_ELEMENT, NULL, TYPE_STR, name, NULL);
+}
+#endif
+
/* vi: set et ts=4: */
diff --git a/src/callbacks.h b/src/callbacks.h
index 20eaa92..79d7910 100644
--- a/src/callbacks.h
+++ b/src/callbacks.h
@@ -225,3 +225,15 @@ scroll_horiz_cb(GtkAdjustment *adjust, void *w);
gboolean
scrollbars_policy_cb(WebKitWebView *view);
+
+void
+window_object_cleared_cb(WebKitWebView *webview, WebKitWebFrame *frame,
+ JSGlobalContextRef *context, JSObjectRef *object);
+
+#if WEBKIT_CHECK_VERSION (1, 3, 13)
+void
+dom_focus_cb(WebKitDOMEventTarget *target, WebKitDOMEvent *event, gpointer user_data);
+
+void
+dom_blur_cb(WebKitDOMEventTarget *target, WebKitDOMEvent *event, gpointer user_data);
+#endif
diff --git a/src/events.c b/src/events.c
index 8f8b72a..a79a62a 100644
--- a/src/events.c
+++ b/src/events.c
@@ -54,7 +54,9 @@ const char *event_table[LAST_EVENT] = {
"DOWNLOAD_PROGRESS",
"DOWNLOAD_COMPLETE",
"ADD_COOKIE" ,
- "DELETE_COOKIE"
+ "DELETE_COOKIE" ,
+ "FOCUS_ELEMENT" ,
+ "BLUR_ELEMENT"
};
void
diff --git a/src/events.h b/src/events.h
index 0c40206..60ea8df 100644
--- a/src/events.h
+++ b/src/events.h
@@ -25,6 +25,7 @@ enum event_type {
PTR_MOVE, SCROLL_VERT, SCROLL_HORIZ,
DOWNLOAD_STARTED, DOWNLOAD_PROGRESS, DOWNLOAD_COMPLETE,
ADD_COOKIE, DELETE_COOKIE,
+ FOCUS_ELEMENT, BLUR_ELEMENT,
/* must be last entry */
LAST_EVENT
diff --git a/src/uzbl-core.c b/src/uzbl-core.c
index 046f596..eeae2ec 100644
--- a/src/uzbl-core.c
+++ b/src/uzbl-core.c
@@ -1477,6 +1477,7 @@ create_scrolled_win() {
"signal::populate-popup", (GCallback)populate_popup_cb, NULL,
"signal::focus-in-event", (GCallback)focus_cb, NULL,
"signal::focus-out-event", (GCallback)focus_cb, NULL,
+ "signal::window-object-cleared", (GCallback)window_object_cleared_cb,NULL,
NULL);
g_object_connect (G_OBJECT (wf),
@@ -1529,11 +1530,10 @@ create_window() {
gtk_window_set_has_resize_grip (GTK_WINDOW (window), FALSE);
#endif
- /* if the window has been made small, it shouldn't try to resize itself due
- * to a long statusbar. */
+ /* the window should never make itself bigger. */
GdkGeometry hints;
- hints.min_height = -1;
- 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);