From d41e70ea0e1bf7d7a5154cae75ba8f5639633bee Mon Sep 17 00:00:00 2001 From: Premysl 'Anydot' Hruby Date: Fri, 1 May 2009 00:20:40 +0200 Subject: Code simplification in insert_mode handling --- uzbl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'uzbl.c') diff --git a/uzbl.c b/uzbl.c index 016f66a..5493a59 100644 --- a/uzbl.c +++ b/uzbl.c @@ -579,9 +579,9 @@ key_press_cb (WebKitWebView* page, GdkEventKey* event) || event->keyval == GDK_Up || event->keyval == GDK_Down || event->keyval == GDK_Left || event->keyval == GDK_Right) return FALSE; - /* turn of insert mode */ + /* turn off insert mode (if always_insert_mode is not used) */ if (insert_mode && (event->keyval == GDK_Escape)) { - insert_mode = !insert_mode || always_insert_mode; + insert_mode = always_insert_mode; update_title(); return TRUE; } -- cgit v1.2.3 From 5850fa6e96823b56e60caf317a2531ff48ee1e62 Mon Sep 17 00:00:00 2001 From: Premysl 'Anydot' Hruby Date: Fri, 1 May 2009 00:37:29 +0200 Subject: Control thread wasn't detached --- uzbl.c | 1 + 1 file changed, 1 insertion(+) (limited to 'uzbl.c') diff --git a/uzbl.c b/uzbl.c index 5493a59..b767f4d 100644 --- a/uzbl.c +++ b/uzbl.c @@ -530,6 +530,7 @@ static void setup_threading () { pthread_t control_thread; pthread_create(&control_thread, NULL, control_socket, NULL); + pthread_detach(control_thread); } static void -- cgit v1.2.3 From b73df48c2c4c48c97bdce954669f4f82897da7ec Mon Sep 17 00:00:00 2001 From: Premysl 'Anydot' Hruby Date: Fri, 1 May 2009 14:35:32 +0200 Subject: scroll stuff, thx to jouz, with slight changes --- examples/configs/sampleconfig | 7 +++++- examples/configs/sampleconfig-dev | 6 ++++- uzbl.c | 51 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 62 insertions(+), 2 deletions(-) (limited to 'uzbl.c') diff --git a/examples/configs/sampleconfig b/examples/configs/sampleconfig index 230ef30..2f9df6f 100644 --- a/examples/configs/sampleconfig +++ b/examples/configs/sampleconfig @@ -21,6 +21,10 @@ show_status = 1 status_top = 0 [bindings] +j = scroll_down +k = scroll_up +h = scroll_left +l = scroll_right b = back m = forward s = stop @@ -33,10 +37,11 @@ w = follow_link_new_window + = zoom_in - = zoom_out t = toggle_status -k = exit +ZZ = exit i = insert_mode B = spawn /bin/bash /usr/share/uzbl/examples/scripts/insert_bookmark.sh u = spawn /bin/bash /usr/share/uzbl/examples/scripts/load_url_from_history.sh U = spawn /bin/bash /usr/share/uzbl/examples/scripts/load_url_from_bookmarks.sh + [network] diff --git a/examples/configs/sampleconfig-dev b/examples/configs/sampleconfig-dev index 35e7746..9fcc906 100644 --- a/examples/configs/sampleconfig-dev +++ b/examples/configs/sampleconfig-dev @@ -21,6 +21,10 @@ show_status = 1 status_top = 0 [bindings] +j = scroll_down +k = scroll_up +h = scroll_left +l = scroll_right b = back m = forward s = stop @@ -33,7 +37,7 @@ w = follow_link_new_window + = zoom_in - = zoom_out t = toggle_status -k = exit +ZZ = exit i = insert_mode B = spawn /bin/bash ./examples/scripts/insert_bookmark.sh u = spawn /bin/bash ./examples/scripts/load_url_from_history.sh diff --git a/uzbl.c b/uzbl.c index b767f4d..ca6c6ae 100644 --- a/uzbl.c +++ b/uzbl.c @@ -54,6 +54,10 @@ static GtkWidget* main_window; static GtkWidget* mainbar; static GtkWidget* mainbar_label; +static GtkScrollbar* scbar_v; // Horizontal and Vertical Scrollbar +static GtkScrollbar* scbar_h; // (These are still hidden) +static GtkAdjustment* bar_v; // Information about document length +static GtkAdjustment* bar_h; // and scrolling position static WebKitWebView* web_view; static gchar* main_title; static gchar selected_url[500] = "\0"; @@ -80,6 +84,8 @@ static gboolean insert_mode = FALSE; static gboolean status_top = FALSE; static gchar* modkey = NULL; static guint modmask = 0; +static gdouble hscroll = 20; +static gdouble vscroll = 20; /* settings from config: group bindings, key -> action */ static GHashTable *bindings; @@ -177,10 +183,45 @@ download_cb (WebKitWebView *web_view, GObject *download, gpointer user_data) { return (FALSE); } +/* scroll a bar in a given direction */ +static void +scroll (double i, GtkAdjustment* bar) { + gtk_adjustment_set_value (bar, gtk_adjustment_get_value(bar)+i); +} + +static void scroll_up (WebKitWebView* page, const char *param) { + (void) page; + (void) param; + + scroll (-vscroll, bar_v); +} + +static void scroll_left (WebKitWebView* page, const char *param) { + (void) page; + (void) param; + + scroll (-hscroll, bar_h); +} + +static void scroll_down (WebKitWebView* page, const char *param) { + (void) page; + (void) param; + + scroll (vscroll, bar_v); +} + +static void scroll_right (WebKitWebView* page, const char *param) { + (void) page; + (void) param; + + scroll (hscroll, bar_h); +} + static void toggle_status_cb (WebKitWebView* page, const char *param) { (void)page; (void)param; + if (show_status) { gtk_widget_hide(mainbar); } else { @@ -272,6 +313,10 @@ static struct {char *name; Command command;} cmdlist[] = { { "back", view_go_back }, { "forward", view_go_forward }, + { "scroll_down", scroll_down }, + { "scroll_up", scroll_up }, + { "scroll_left", scroll_left }, + { "scroll_right", scroll_right }, { "reload", view_reload, }, //Buggy { "refresh", view_reload, }, /* for convenience, will change */ { "stop", view_stop_loading, }, @@ -825,6 +870,12 @@ main (int argc, char* argv[]) { printf("window_id %i\n",(int) xwin); printf("pid %i\n", getpid ()); + scbar_v = (GtkScrollbar*) gtk_vscrollbar_new (NULL); + bar_v = gtk_range_get_adjustment((GtkRange*) scbar_v); + scbar_h = (GtkScrollbar*) gtk_hscrollbar_new (NULL); + bar_h = gtk_range_get_adjustment((GtkRange*) scbar_h); + gtk_widget_set_scroll_adjustments ((GtkWidget*) web_view, bar_h, bar_v); + if (!show_status) gtk_widget_hide(mainbar); -- cgit v1.2.3