Heh. Looks like I forgot to attach it. How's it look now? There's also some changes to the default config file, but they are of course just suggested.
>On Sat, Aug 21, 2010 at 07:35:33PM +0100, Rob wrote: > On 21 August 2010 19:32, Alex Puterbaugh <puterbau...@gmail.com> wrote: > > Hey all, > > > > I've made a small patch that allows you to bind keys for > > horizontal scrolling. > > > > This approach (which imho is the least of many evils) requires > > the Arg union to be a struct, to allow the scroll() function > > to use both .b and .i as arguments. > > > > I think that horizontal scrolling via the keyboard is far from an > > "edge" use case for a web browser that already depends so heavily on > > the keyboard, so I propose that this patch be included in the > > next version of surf. > > > > > > Nice patch. >
diff -r dbb565b8d61c config.def.h --- a/config.def.h Fri Jun 25 09:42:58 2010 +0200 +++ b/config.def.h Sat Aug 21 13:47:33 2010 -0400 @@ -27,10 +27,12 @@ { MODKEY|GDK_SHIFT_MASK,GDK_j, zoom, { .i = -1 } }, { MODKEY|GDK_SHIFT_MASK,GDK_k, zoom, { .i = +1 } }, { MODKEY|GDK_SHIFT_MASK,GDK_i, zoom, { .i = 0 } }, - { MODKEY, GDK_l, navigate, { .i = +1 } }, - { MODKEY, GDK_h, navigate, { .i = -1 } }, - { MODKEY, GDK_j, scroll, { .i = +1 } }, - { MODKEY, GDK_k, scroll, { .i = -1 } }, + { MODKEY, GDK_f, navigate, { .i = +1 } }, + { MODKEY, GDK_b, navigate, { .i = -1 } }, + { MODKEY, GDK_h, scroll, { .i = -1, .b = FALSE } }, + { MODKEY, GDK_l, scroll, { .i = +1, .b = FALSE } }, + { MODKEY, GDK_j, scroll, { .i = +1, .b = TRUE } }, + { MODKEY, GDK_k, scroll, { .i = -1, .b = TRUE } }, { 0, GDK_Escape, stop, { 0 } }, { MODKEY, GDK_o, source, { 0 } }, { MODKEY, GDK_g, spawn, SETPROP("_SURF_URI", "_SURF_GO") }, diff -r dbb565b8d61c surf.c --- a/surf.c Fri Jun 25 09:42:58 2010 +0200 +++ b/surf.c Sat Aug 21 13:47:33 2010 -0400 @@ -25,8 +25,8 @@ enum { AtomFind, AtomGo, AtomUri, AtomLast }; -typedef union Arg Arg; -union Arg { +typedef struct Arg Arg; +struct Arg { gboolean b; gint i; const void *v; @@ -631,7 +631,8 @@ gdouble v; GtkAdjustment *a; - a = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(c->scroll)); + a = arg-> b? gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(c->scroll)): + gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(c->scroll)); v = gtk_adjustment_get_value(a); v += gtk_adjustment_get_step_increment(a) * arg->i; v = MAX(v, 0.0);