Thank you, I'll try it.
But yeah, it's really missing by default, and it doesn't seems to be
too much code lines.
Le 08:38:15 le 24 mai 2012 , stanio_AT_cs.tu-berlin.de a écrit :
> * Thuban <thuban_AT_singularity.fr> [2012-05-24 07:53]:
> > I was wondering if there is any way to have a keybind to scroll left or
> > right, just like you can scroll up and down with C-k and C-j?
>
> sure. Here an example:
> ----- config.h -----
> { MODKEY, GDK_j, scroll_v, { .i = +1 } },
> { MODKEY, GDK_k, scroll_v, { .i = -1 } },
> { MODKEY, GDK_g, scroll_v, { .i = -20000 } },
> { MODKEY|GDK_SHIFT_MASK,GDK_g, scroll_v, { .i = +20000 } },
> { MODKEY, GDK_b, scroll_v, { .i = -10000 } },
> { MODKEY, GDK_space, scroll_v, { .i = +10000 } },
> { MODKEY, GDK_l, scroll_h, { .i = +1 } },
> { MODKEY, GDK_h, scroll_h, { .i = -1 } },
> ----- -------- -----
>
>
> ------ surf.c ------
> void
> scroll_h(Client *c, const Arg *arg) {
> scroll(gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(c->scroll)), arg);
> }
>
> void
> scroll_v(Client *c, const Arg *arg) {
> scroll(gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(c->scroll)), arg);
> }
>
> void
> scroll(GtkAdjustment *a, const Arg *arg) {
> gdouble v;
>
> v = gtk_adjustment_get_value(a);
> switch (arg->i){
> case +10000:
> case -10000:
> v += gtk_adjustment_get_page_increment(a) * (arg->i / 10000); break;
> case +20000:
> case -20000:
> default:
> v += gtk_adjustment_get_step_increment(a) * arg->i;
> }
> v = MAX(v, 0.0);
> v = MIN(v, gtk_adjustment_get_upper(a) - gtk_adjustment_get_page_size(a));
> gtk_adjustment_set_value(a, v);
> }
> ----- -------- -----
>
> --s_
>
--
,--. Xavier Cartron , /(
: /` ) M1 MEFPC o **}=\\,\(,,
| `-' Debian user <0-- (___(_\\
\_ jabber : thuban_AT_jabber.fr / > ,) ,/ ``==>
Received on Fri May 25 2012 - 16:01:19 CEST