diff options
-rw-r--r-- | examples/configs/sampleconfig | 9 | ||||
-rw-r--r-- | examples/configs/sampleconfig-dev | 9 | ||||
-rw-r--r-- | uzbl.c | 38 |
3 files changed, 23 insertions, 33 deletions
diff --git a/examples/configs/sampleconfig b/examples/configs/sampleconfig index 2f9df6f..1e4d3ee 100644 --- a/examples/configs/sampleconfig +++ b/examples/configs/sampleconfig @@ -21,10 +21,11 @@ show_status = 1 status_top = 0 [bindings] -j = scroll_down -k = scroll_up -h = scroll_left -l = scroll_right +# scroll down/up/left/right +j = scroll_vert 20 +k = scroll_vert -20 +h = scroll_horz -20 +l = scroll_horz 20 b = back m = forward s = stop diff --git a/examples/configs/sampleconfig-dev b/examples/configs/sampleconfig-dev index 9fcc906..bcba2df 100644 --- a/examples/configs/sampleconfig-dev +++ b/examples/configs/sampleconfig-dev @@ -21,10 +21,11 @@ show_status = 1 status_top = 0 [bindings] -j = scroll_down -k = scroll_up -h = scroll_left -l = scroll_right +## scroll down/up/left/right +j = scroll_vert 20 +k = scroll_vert -20 +h = scroll_horz -20 +l = scroll_horz 20 b = back m = forward s = stop @@ -84,8 +84,6 @@ 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; @@ -185,36 +183,28 @@ download_cb (WebKitWebView *web_view, GObject *download, gpointer user_data) { /* 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); -} +scroll (GtkAdjustment* bar, const char *param) { + gdouble amount; + gchar *end; -static void scroll_up (WebKitWebView* page, const char *param) { - (void) page; - (void) param; + amount = g_ascii_strtod(param, &end); - scroll (-vscroll, bar_v); -} - -static void scroll_left (WebKitWebView* page, const char *param) { - (void) page; - (void) param; + if (*end) + fprintf(stderr, "found something after double: %s\n", end); - scroll (-hscroll, bar_h); + gtk_adjustment_set_value (bar, gtk_adjustment_get_value(bar)+amount); } -static void scroll_down (WebKitWebView* page, const char *param) { +static void scroll_vert(WebKitWebView* page, const char *param) { (void) page; - (void) param; - scroll (vscroll, bar_v); + scroll(bar_v, param); } -static void scroll_right (WebKitWebView* page, const char *param) { +static void scroll_horz(WebKitWebView* page, const char *param) { (void) page; - (void) param; - scroll (hscroll, bar_h); + scroll(bar_h, param); } static void @@ -313,10 +303,8 @@ 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 }, + { "scroll_vert", scroll_vert }, + { "scroll_horz", scroll_horz }, { "reload", view_reload, }, //Buggy { "refresh", view_reload, }, /* for convenience, will change */ { "stop", view_stop_loading, }, |