From 97348882c8eeac6919ada99bdc5b55b86f99ee1f Mon Sep 17 00:00:00 2001 From: Premysl 'Anydot' Hruby Date: Fri, 1 May 2009 15:07:06 +0200 Subject: Use only 2 scrolling function --- uzbl.c | 38 +++++++++++++------------------------- 1 file changed, 13 insertions(+), 25 deletions(-) (limited to 'uzbl.c') diff --git a/uzbl.c b/uzbl.c index ca6c6ae..6a17480 100644 --- a/uzbl.c +++ b/uzbl.c @@ -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, }, -- cgit v1.2.3