aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Dieter Plaetinck <dieter@plaetinck.be>2009-09-03 17:11:28 +0200
committerGravatar Dieter Plaetinck <dieter@plaetinck.be>2009-09-03 17:11:28 +0200
commit0b991a89942a4d157b4ad64f6dc03708bd2c6586 (patch)
treeeb899f2311a684f57ba3c6abe325d15f4f36290a
parent7c7bd642757cad50e2d08b054e59e75ca4c3cfb2 (diff)
first steps towards docs, (improved) todo, add key_release skeleton
-rw-r--r--README14
-rw-r--r--docs/TODO20
-rw-r--r--uzbl.c64
-rw-r--r--uzbl.h2
4 files changed, 41 insertions, 59 deletions
diff --git a/README b/README
index d696733..2f939fa 100644
--- a/README
+++ b/README
@@ -410,6 +410,20 @@ This way, everything is kept private. It also turns Uzbl into a local variable,
Copying the Uzbl object and creating public functions should be taken with care to avoid creating security holes. Keep in mind that the "f" function above would be defined in the `window` object, and as such any javascript in the current page can call it.
+### EVENTS ###
+
+unlike commands, events are not handled in uzbl itself, but are propagated asynchronously through text stream on
+stdout. You'll usually use uzbl by piping it's output to a so called 'dispatcher'
+- makes it possible to use whichever language you want for event handling (python, perl, bash, .. you name it).
+ you'll usually send commands (see above) back to uzbl through its fifo or socket
+- keybindings use x keysyms
+- many finegrained events (hover_over_link, key_press, key_down,..)
+- see example dispatcher.sh
+
+Note: cookie events are not sent to a dispatcher but handled internally through the cookie handler because of their synchronous nature.
+Cookie events are really something completely different from all other events. maybe someday we'll use http proxies or something for cookies, but
+for now we still use the handler code)
+
### COMMAND LINE ARGUMENTS
uzbl [ uri ]
-u, --uri=URI Uri to load at startup (equivalent to 'uzbl <uri>' or 'set uri = URI' after uzbl has launched)
diff --git a/docs/TODO b/docs/TODO
index 45f4539..3c61b14 100644
--- a/docs/TODO
+++ b/docs/TODO
@@ -1,3 +1,23 @@
+== event-messages specific ==
+* throw out all old code
+* document the dispatching mechanism, all events, how to get started with sample dispatcher
+* add key_release callback and event
+* remove all binding ('bind = ' etc.) stuff and port to new system
+
+= key handling (example dispatcher.sh) =
+* on escape:
+if insert mode: set_insert_mode(uzbl.behave.always_insert_mode); update_title
+else: clear_keycmd(); update_title; dehilight(uzbl.gui.web_view, NULL, NULL);
+* demonstrate separate key_press and key_release (eg press 'z' to zoom in, on release reset zoom to what it was before. use "locking boolean" as discussed on irc)
+* port the Modkey concept
+* BackSpace -> keycmd_bs
+
+* Insert: insert from clipboard -> keycmd + update_title
+* shift+Insert: insert from primary -> keycmd + update_title
+* handle Return and/or KP_Enter
+
+
+
More or less in order of importance/urgency
* improve cookie handler.
diff --git a/uzbl.c b/uzbl.c
index 78c8791..0765d13 100644
--- a/uzbl.c
+++ b/uzbl.c
@@ -201,7 +201,8 @@ const char *event_table[LAST_EVENT] = {
"LOAD_COMMIT" ,
"LOAD_FINISH" ,
"LOAD_ERROR" ,
- "KEYPRESS" ,
+ "KEY_PRESS" ,
+ "KEY_RELEASE" ,
"DOWNLOAD_REQUEST" ,
"COMMAND_EXECUTED" ,
"LINK_HOVER" ,
@@ -412,14 +413,8 @@ expand(const char *s, guint recurse) {
return g_string_free(buf, FALSE);
}
-/* send events as strings over any of our interfaces
- *
- * TODO: - also use an output fifo and the socket
- * - probably we also want a variable/CL option
- * that specifies wether to send events and through
- * which interface to send them
- * - let the user select which event types
- * to report
+/* send events as strings to stdout (do we need to support fifo/socket as output mechanism?)
+ * we send all events to the output. it's the users task to filter out what he cares about.
*/
void
send_event(int type, const gchar *details) {
@@ -617,7 +612,7 @@ mime_policy_cb(WebKitWebView *web_view, WebKitWebFrame *frame, WebKitNetworkRequ
return TRUE;
}
- /* ...everything we can't displayed is downloaded */
+ /* ...everything we can't display is downloaded */
webkit_web_policy_decision_download (policy_decision);
return TRUE;
}
@@ -2301,7 +2296,7 @@ key_press_cb (GtkWidget* window, GdkEventKey* event)
(void) window;
if(event->type == GDK_KEY_PRESS)
- send_event(KEYPRESS, 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 ||
@@ -2316,13 +2311,6 @@ key_press_cb (GtkWidget* window, GdkEventKey* event)
event->keyval == GDK_Shift_R)
return FALSE;
- /* turn off insert mode (if always_insert_mode is not used) */
- if (uzbl.behave.insert_mode && (event->keyval == GDK_Escape)) {
- set_insert_mode(uzbl.behave.always_insert_mode);
- update_title();
- return TRUE;
- }
-
if (uzbl.behave.insert_mode &&
( ((event->state & uzbl.behave.modmask) != uzbl.behave.modmask) ||
(!uzbl.behave.modmask)
@@ -2330,46 +2318,6 @@ key_press_cb (GtkWidget* window, GdkEventKey* event)
)
return FALSE;
- if (event->keyval == GDK_Escape) {
- clear_keycmd();
- update_title();
- dehilight(uzbl.gui.web_view, NULL, NULL);
- return TRUE;
- }
-
- //Insert without shift - insert from clipboard; Insert with shift - insert from primary
- if (event->keyval == GDK_Insert) {
- gchar * str;
- if ((event->state & GDK_SHIFT_MASK) == GDK_SHIFT_MASK) {
- str = gtk_clipboard_wait_for_text (gtk_clipboard_get (GDK_SELECTION_PRIMARY));
- } else {
- str = gtk_clipboard_wait_for_text (gtk_clipboard_get (GDK_SELECTION_CLIPBOARD));
- }
- if (str) {
- GString* keycmd = g_string_new(uzbl.state.keycmd);
- g_string_append (keycmd, str);
- uzbl.state.keycmd = g_string_free(keycmd, FALSE);
- update_title ();
- g_free (str);
- }
- return TRUE;
- }
-
- if (event->keyval == GDK_BackSpace)
- keycmd_bs(NULL, NULL, NULL);
-
- gboolean key_ret = FALSE;
- if ((event->keyval == GDK_Return) || (event->keyval == GDK_KP_Enter))
- key_ret = TRUE;
- if (!key_ret) {
- GString* keycmd = g_string_new(uzbl.state.keycmd);
- g_string_append(keycmd, event->string);
- uzbl.state.keycmd = g_string_free(keycmd, FALSE);
- }
-
- run_keycmd(key_ret);
- update_title();
- if (key_ret) return (!uzbl.behave.insert_mode);
return TRUE;
}
diff --git a/uzbl.h b/uzbl.h
index cc0c845..986d080 100644
--- a/uzbl.h
+++ b/uzbl.h
@@ -187,7 +187,7 @@ typedef void sigfunc(int);
/* Event system */
enum event_type {
LOAD_START, LOAD_COMMIT, LOAD_FINISH, LOAD_ERROR,
- KEYPRESS, DOWNLOAD_REQ, COMMAND_EXECUTED,
+ KEY_PRESS, KEY_RELEASE, DOWNLOAD_REQ, COMMAND_EXECUTED,
LINK_HOVER, TITLE_CHANGED, GEOMETRY_CHANGED,
WEBINSPECTOR, COOKIE, NEW_WINDOW, SELECTION_CHANGED,