diff options
author | 2009-05-03 12:21:16 +0100 | |
---|---|---|
committer | 2009-05-03 12:21:16 +0100 | |
commit | 7c19691ca1c9c8b191ca8b2670beae33ad81f823 (patch) | |
tree | a95e3afebff9d91f7258c7200808ba1f8d24dbbd | |
parent | d8728e61b587e80efe30f0fc198ed195b8067b3e (diff) | |
parent | 83987209217f9b3157c26565fa5521259dea140c (diff) |
Merge branch 'dieter/experimental' into experimental
Conflicts:
uzbl.c
-rw-r--r-- | CHECKLIST | 5 | ||||
-rwxr-xr-x | misc/fifotest.sh | 4 | ||||
-rw-r--r-- | uzbl.c | 59 | ||||
-rw-r--r-- | uzbl.h | 2 |
4 files changed, 53 insertions, 17 deletions
@@ -10,7 +10,8 @@ Also testers and interested people can use this list to see what uzbl is about, * fifo: type this in your shell after starting uzbl: echo 'uri http://www...' > <fifo path here>' where <fifo path> is printed on stdout during program startup. Also "back" , "forward", "refresh" (basically all actions defined in `static Command commands` should behave as expected) - -> temporarily changed to socket io with uzblctrl. see examples in scripts + ^^ TEMPORARILY BROKEN +* socket: uzblctrl -s <socketname> -c <command> (same commands as with fifo) * history logging: the script as defined in sample config should write history entries (date,time, url) into the file defined in the script (by default ./extra/history.sh and /tmp/uzbl.history) * invocations of external commands: you'll see it on stdout everytime uzbl calls an external script/program. the invocations should work and none of the arguments passed should be null/garbage/.. . all should be valid strings and contain things like the pid, fifo file, config file,.. (see README for details). @@ -29,3 +30,5 @@ Also testers and interested people can use this list to see what uzbl is about, * commands with parameters: any key sequence that ends with underscore _ expects parameter. Undersore marks exact location where parameter begins. Command part can have %s that will be replaced with parameter. :o _ = uri %s - user needs to type :o www.google.com :O_ = uri %s - user needs to type :Owww.google.com +* when typing command, press insert (paste X cliboard) or shift insert (paste primary selection buffer) +* proxy and other network settings can be set in config
\ No newline at end of file diff --git a/misc/fifotest.sh b/misc/fifotest.sh index d6f90d5..8ad0593 100755 --- a/misc/fifotest.sh +++ b/misc/fifotest.sh @@ -9,8 +9,8 @@ do echo 'uri dns.be' echo 'uri dns.be' > $1 sleep 2 - echo 'uri www.archlinx.org' - echo 'uri www.archlinx.org' > $1 + echo 'uri www.archlinux.org' + echo 'uri www.archlinux.org' > $1 sleep 2 echo 'uri icanhascheezburger.com' echo 'uri icanhascheezburger.com' > $1 @@ -479,13 +479,26 @@ build_stream_name(int type) { } static void -control_fifo(GIOChannel *fd) { +control_fifo(GIOChannel *gio, GIOCondition condition) { + printf("triggered\n"); gchar *ctl_line; - if(!fd) - return; - g_io_channel_read_line(fd, &ctl_line, NULL, NULL, NULL); + GIOStatus ret; + GError *err = NULL; + + if (condition & G_IO_HUP) + g_error ("Fifo: Read end of pipe died!\n"); + + if(!gio) + g_error ("Fifo: GIOChannel broke\n"); + + ret = g_io_channel_read_line(gio, &ctl_line, NULL, NULL, &err); + if (ret == G_IO_STATUS_ERROR) + g_error ("Fifo: Error reading: %s\n", err->message); + + parse_line(ctl_line); g_free(ctl_line); + printf("...done\n"); return; } @@ -496,18 +509,22 @@ create_fifo() { build_stream_name(FIFO); if (file_exists(fifo_path)) { - printf ("Fifo: disabled. Error when creating %s: File exists\n", fifo_path); + g_error ("Fifo: Error when creating %s: File exists\n", fifo_path); return; } - if (mkfifo (fifo_path, 0666) == -1) { //TODO: mkfifo blocks (waits for writer) - printf ("Fifo: disabled. Error when creating %s: %s\n", fifo_path, strerror(errno)); + if (mkfifo (fifo_path, 0666) == -1) { + g_error ("Fifo: Error when creating %s: %s\n", fifo_path, strerror(errno)); } else { - chan = g_io_channel_new_file((gchar *) fifo_path, "r", &error); + // we don't really need to write to the file, but if we open the file as 'r' we will block here, waiting for a writer to open the file. + chan = g_io_channel_new_file((gchar *) fifo_path, "r+", &error); if (chan) { - printf ("Fifo: created successfully as %s\n", fifo_path); - g_io_add_watch(chan, G_IO_IN|G_IO_HUP, (GIOFunc) control_fifo, chan); + if (!g_io_add_watch(chan, G_IO_IN|G_IO_HUP, (GIOFunc) control_fifo, NULL)) { + g_error ("Fifo: could not add watch on %s\n", fifo_path); + } else { + printf ("Fifo: created successfully as %s\n", fifo_path); + } } else { - g_error ("Fifo: error while opening: %s\n", error->message); + g_error ("Fifo: Error while opening: %s\n", error->message); } } return; @@ -640,7 +657,7 @@ update_title (void) { g_free (title_long); g_free (title_short); } - + static gboolean key_press_cb (WebKitWebView* page, GdkEventKey* event) { @@ -660,7 +677,7 @@ key_press_cb (WebKitWebView* page, GdkEventKey* event) return TRUE; } - if (insert_mode && event->state != modmask) + if (insert_mode && (event->state & modmask)) return FALSE; if (event->keyval == GDK_Escape) { @@ -669,6 +686,22 @@ key_press_cb (WebKitWebView* page, GdkEventKey* event) 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) { + g_string_append_printf (keycmd, "%s", str); + update_title (); + free (str); + } + return TRUE; + } + if ((event->keyval == GDK_BackSpace) && (keycmd->len > 0)) { g_string_truncate(keycmd, keycmd->len - 1); update_title(); @@ -83,7 +83,7 @@ void build_stream_name(int type); static void -control_fifo(GIOChannel *fd); +control_fifo(GIOChannel *gio, GIOCondition condition); static void create_fifo(); |