aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Mason Larobina <mason.larobina@gmail.com>2009-09-07 04:42:03 +0800
committerGravatar Mason Larobina <mason.larobina@gmail.com>2009-09-07 04:42:03 +0800
commit6e72af4928f7c6f4b16a2a69ad44d8ccce49be88 (patch)
treeab4a4691e3fa2662f18268fb6d0f94181fcb2729
parent97f12f6eee2c7ae24ac195b9cb76e41e86f58863 (diff)
parente6cdd95b0f08de2a8b71df40f8cfedacbf8c58b5 (diff)
Merge branch 'event-messages' of git://github.com/Dieterbe/uzbl into event-messages
-rw-r--r--Makefile23
-rw-r--r--docs/TODO13
-rwxr-xr-xuzbl-browser36
-rw-r--r--uzbl-core.c15
-rw-r--r--uzbl-core.h3
5 files changed, 75 insertions, 15 deletions
diff --git a/Makefile b/Makefile
index 8bda961..cd39825 100644
--- a/Makefile
+++ b/Makefile
@@ -6,9 +6,9 @@ CFLAGS!=echo -std=c99 `pkg-config --cflags gtk+-2.0 webkit-1.0 libsoup-2.4 gthre
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)
-all: uzbl
+all: uzbl-browser
-uzbl: uzbl-core
+uzbl-browser: uzbl-core
PREFIX?=$(DESTDIR)/usr/local
@@ -17,18 +17,23 @@ tests: uzbl-core.o
$(CC) -DUZBL_LIBRARY -shared -Wl uzbl-core.o -o ./tests/libuzbl-core.so
cd ./tests/; $(MAKE)
-test: uzbl
+test: uzbl-core
+ ./uzbl-core --uri http://www.uzbl.org --verbose
+
+test-browser: uzbl-browser
PATH="`pwd`:$$PATH" ./uzbl-browser --uri http://www.uzbl.org --verbose
-test-dev: uzbl
- XDG_DATA_HOME=./examples/data XDG_CONFIG_HOME=./examples/config ./uzbl-browser --uri http://www.uzbl.org --verbose
+test-dev: uzbl-core
+ XDG_DATA_HOME=./examples/data XDG_CONFIG_HOME=./examples/config ./uzbl-core --uri http://www.uzbl.org --verbose
-test-dev-dispatched: uzbl
- XDG_DATA_HOME=./examples/data XDG_CONFIG_HOME=./examples/config ./uzbl-browser --uri http://www.uzbl.org --verbose | ./examples/data/uzbl/scripts/event_manager.py
+test-dev-browser: uzbl-browser
+ XDG_DATA_HOME=./examples/data XDG_CONFIG_HOME=./examples/config PATH="`pwd`:$$PATH" ./uzbl-browser --uri http://www.uzbl.org --verbose
-test-share: uzbl
- XDG_DATA_HOME=${PREFIX}/share/uzbl/examples/data XDG_CONFIG_HOME=${PREFIX}/share/uzbl/examples/config ./uzbl-browser --uri http://www.uzbl.org --verbose
+test-share: uzbl-core
+ XDG_DATA_HOME=${PREFIX}/share/uzbl/examples/data XDG_CONFIG_HOME=${PREFIX}/share/uzbl/examples/config ./uzbl-core --uri http://www.uzbl.org --verbose
+test-share-browser: uzbl-browser
+ XDG_DATA_HOME=${PREFIX}/share/uzbl/examples/data XDG_CONFIG_HOME=${PREFIX}/share/uzbl/examples/config PATH="`pwd`:$$PATH" ./uzbl-browser --uri http://www.uzbl.org --verbose
clean:
rm -f uzbl-core
diff --git a/docs/TODO b/docs/TODO
index 7da0fd6..f626fcd 100644
--- a/docs/TODO
+++ b/docs/TODO
@@ -1,3 +1,12 @@
+what if fifo/socket doesn't exist, or exists but nothing working behind it (anymore)?
+-> useful for both cookie handler and event manager
+-> implementing in uzbl-core needs refactoring of handler args, or some edge-case workarounds
+ (mason-l's proposal was not too bad: basically make cookie stuff more cookie specific.
+ we don't need a generic talk_to_socket. 3 vars: cookie_handler, cookie_handler_socket and
+ cookie_handler_launcher. act depending on which vars are set)
+-> for now, assume that we don't need to check for crashes, just make sure there is the initial socket/fifo -> can be done in uzbl-browser script
+
+
== event-messages specific ==
* throw out all old code
* document the event handling mechanism, all events, how to get started with sample event handler
@@ -9,6 +18,10 @@
* uzbl -> uzbl-core, uzbl-browser script like 'uzbl | $XDG.../event_manager.py'
* event manager dynamic config system that configures itself based on events from uzbl (eg to set vars in "uzbl slaves" such as this, set custom vars in uzbl which we react to)
* remove chain command
+* scalability -> 1 event manager per n uzbl-browser instances -> mkfifo and redirect uzbl-core stdout to fifo in uzbl-browser
+* event manager -> everything based on per instance basis (associative array with uzbl instance name as key)
+* why the need of queues in mason-l branch?
+
= keybinding features =
* use a datadriven config format to allow simple implementations in different languages.
diff --git a/uzbl-browser b/uzbl-browser
index 93ba2d7..1e950db 100755
--- a/uzbl-browser
+++ b/uzbl-browser
@@ -1,9 +1,35 @@
#!/bin/sh
-# this script implements are more useful "browsing experience". make sure to have the event manager in the appropriate place.
+# this script implements are more useful "browsing experience".
+# We are assuming you want to use the event_manager.py and cookie_daemon.py.
+# So, you must have them in the appropriate place, and cookie_daemon_socket must be configured in the default location
-if [ x"$XDG_DATA_HOME" != 'x' ]
+# Also, we assume existence of fifo/socket == correctly functioning cookie_daemon/event_manager.
+# Checking correct functioning of the daemons here would be too complex here, and it's not implemented in uzbl-core either.
+# But this shouldn't cause much problems..
+
+
+if [ x"$XDG_DATA_HOME" == 'x' ]
then
- uzbl-core "$@" | $XDG_DATA_HOME/uzbl/scripts/event_manager.py
-else
- uzbl-core "$@" | $HOME/.local/share/uzbl/scripts/event_manager.py
+ XDG_DATA_HOME=$HOME/.local/share
fi
+
+if [ x"$XDG_CACHE_HOME" == 'x' ]
+then
+ XDG_CACHE_HOME=$HOME/.cache
+fi
+
+if [ ! -S $XDG_CACHE_HOME/uzbl/cookie_daemon_socket ]
+then
+ $XDG_DATA_HOME/uzbl/scripts/cookie_daemon.py
+fi
+
+FIFO=/tmp/uzbl-fifo-eventmanager
+EVENT_MANAGER=$XDG_DATA_HOME/uzbl/scripts/event_manager.py
+
+if [ ! -p $FIFO ]
+then
+ mkfifo $FIFO
+ (cat $FIFO | $EVENT_MANAGER && rm $FIFO) &
+fi
+
+uzbl-core "$@" > $FIFO
diff --git a/uzbl-core.c b/uzbl-core.c
index fd4fb8d..5dd80a2 100644
--- a/uzbl-core.c
+++ b/uzbl-core.c
@@ -2322,7 +2322,7 @@ key_press_cb (GtkWidget* window, GdkEventKey* event)
(void) window;
if(event->type == GDK_KEY_PRESS)
- send_event(KEY_PRESS, gdk_keyval_name(event->keyval) );
+ send_event(KEY_PRESS, gdk_keyval_name(event->keyval));
if (event->type != GDK_KEY_PRESS ||
event->keyval == GDK_Page_Up ||
@@ -2347,6 +2347,16 @@ key_press_cb (GtkWidget* window, GdkEventKey* event)
return TRUE;
}
+gboolean
+key_release_cb (GtkWidget* window, GdkEventKey* event) {
+ (void) window;
+
+ if(event->type == GDK_KEY_RELEASE)
+ send_event(KEY_RELEASE, gdk_keyval_name(event->keyval));
+
+ return TRUE;
+}
+
void
run_keycmd(const gboolean key_ret) {
@@ -2455,6 +2465,7 @@ create_mainbar () {
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);
g_signal_connect (G_OBJECT (g->mainbar), "key-press-event", G_CALLBACK (key_press_cb), NULL);
+ g_signal_connect (G_OBJECT (g->mainbar), "key-release-event", G_CALLBACK (key_release_cb), NULL);
return g->mainbar;
}
@@ -2465,6 +2476,7 @@ create_window () {
gtk_widget_set_name (window, "Uzbl browser");
g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (destroy_cb), NULL);
g_signal_connect (G_OBJECT (window), "key-press-event", G_CALLBACK (key_press_cb), NULL);
+ g_signal_connect (G_OBJECT (window), "key-release-event", G_CALLBACK (key_release_cb), NULL);
g_signal_connect (G_OBJECT (window), "configure-event", G_CALLBACK (configure_event_cb), NULL);
return window;
@@ -2475,6 +2487,7 @@ create_plug () {
GtkPlug* plug = GTK_PLUG (gtk_plug_new (uzbl.state.socket_id));
g_signal_connect (G_OBJECT (plug), "destroy", G_CALLBACK (destroy_cb), NULL);
g_signal_connect (G_OBJECT (plug), "key-press-event", G_CALLBACK (key_press_cb), NULL);
+ g_signal_connect (G_OBJECT (plug), "key-release-event", G_CALLBACK (key_release_cb), NULL);
return plug;
}
diff --git a/uzbl-core.h b/uzbl-core.h
index a5470e1..9d22eb0 100644
--- a/uzbl-core.h
+++ b/uzbl-core.h
@@ -390,6 +390,9 @@ update_title (void);
gboolean
key_press_cb (GtkWidget* window, GdkEventKey* event);
+gboolean
+key_release_cb (GtkWidget* window, GdkEventKey* event);
+
void
run_keycmd(const gboolean key_ret);