Commit ead85e28 authored by Géraud Le Falher's avatar Géraud Le Falher Committed by Sebastian Ramacher

add the ability to horizontally scroll half or full screen

parent d85d6a19
......@@ -162,10 +162,14 @@ config_load_default(zathura_t* zathura)
girara_shortcut_add(gsession, 0, GDK_KEY_Up, NULL, sc_scroll, NORMAL, UP, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_Down, NULL, sc_scroll, NORMAL, DOWN, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_Right, NULL, sc_scroll, NORMAL, RIGHT, NULL);
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_t, NULL, sc_scroll, NORMAL, HALF_LEFT, NULL);
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_d, NULL, sc_scroll, NORMAL, HALF_DOWN, NULL);
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_u, NULL, sc_scroll, NORMAL, HALF_UP, NULL);
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_y, NULL, sc_scroll, NORMAL, HALF_RIGHT, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_t, NULL, sc_scroll, NORMAL, FULL_LEFT, NULL);
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_f, NULL, sc_scroll, NORMAL, FULL_DOWN, NULL);
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_b, NULL, sc_scroll, NORMAL, FULL_UP, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_y, NULL, sc_scroll, NORMAL, FULL_RIGHT, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_space, NULL, sc_scroll, NORMAL, FULL_DOWN, NULL);
girara_shortcut_add(gsession, GDK_SHIFT_MASK, GDK_KEY_space, NULL, sc_scroll, NORMAL, FULL_UP, NULL);
......@@ -257,6 +261,10 @@ config_load_default(zathura_t* zathura)
girara_argument_mapping_add(gsession, "full-up", FULL_UP);
girara_argument_mapping_add(gsession, "half-down", HALF_DOWN);
girara_argument_mapping_add(gsession, "half-up", HALF_UP);
girara_argument_mapping_add(gsession, "full-right", FULL_RIGHT);
girara_argument_mapping_add(gsession, "full-left", FULL_LEFT);
girara_argument_mapping_add(gsession, "half-right", HALF_RIGHT);
girara_argument_mapping_add(gsession, "half-left", HALF_LEFT);
girara_argument_mapping_add(gsession, "in", ZOOM_IN);
girara_argument_mapping_add(gsession, "left", LEFT);
girara_argument_mapping_add(gsession, "next", NEXT);
......
......@@ -423,7 +423,8 @@ sc_scroll(girara_session_t* session, girara_argument_t* argument,
}
GtkAdjustment* adjustment = NULL;
if ( (argument->n == LEFT) || (argument->n == RIGHT) ) {
if ( (argument->n == LEFT) || (argument->n == FULL_LEFT) || (argument->n == HALF_LEFT) ||
(argument->n == RIGHT) || (argument->n == FULL_RIGHT) || (argument->n == HALF_RIGHT)) {
adjustment = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(session->gtk.view));
} else {
adjustment = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(session->gtk.view));
......@@ -441,15 +442,19 @@ sc_scroll(girara_session_t* session, girara_argument_t* argument,
switch(argument->n) {
case FULL_UP:
case FULL_LEFT:
new_value = value - view_size - padding;
break;
case FULL_DOWN:
case FULL_RIGHT:
new_value = value + view_size + padding;
break;
case HALF_UP:
case HALF_LEFT:
new_value = value - ((view_size + padding) / 2);
break;
case HALF_DOWN:
case HALF_RIGHT:
new_value = value + ((view_size + padding) / 2);
break;
case LEFT:
......
......@@ -49,10 +49,10 @@ h, k, j, l
Scroll to the left, down, up or right direction
Left, Down, Up, Right
Scroll to the left, down, up or right direction
^d, ^u
Scroll a half page down or up
^f, ^b, space, <S-space>
Scroll a full page down or up
^t, ^d, ^u, ^y
Scroll a half page left, down, up or right
t, ^f, ^b, space, <S-space>, y
Scroll a full page left, down, up or right
gg, G, nG
Goto to the first, the last or to the nth page
^c, Escape
......
......@@ -16,7 +16,8 @@ enum { NEXT, PREVIOUS, LEFT, RIGHT, UP, DOWN, BOTTOM, TOP, HIDE, HIGHLIGHT,
BACKWARD, ADJUST_BESTFIT, ADJUST_WIDTH, ADJUST_NONE, CONTINUOUS, DELETE_LAST,
ADD_MARKER, EVAL_MARKER, EXPAND, EXPAND_ALL, COLLAPSE_ALL, COLLAPSE, SELECT,
GOTO_DEFAULT, GOTO_LABELS, GOTO_OFFSET, HALF_UP, HALF_DOWN, FULL_UP,
FULL_DOWN, NEXT_CHAR, PREVIOUS_CHAR, DELETE_TO_LINE_START, APPEND_FILEPATH };
FULL_DOWN, HALF_LEFT, HALF_RIGHT, FULL_LEFT, FULL_RIGHT, NEXT_CHAR, PREVIOUS_CHAR,
DELETE_TO_LINE_START, APPEND_FILEPATH };
/* forward declaration for types from document.h */
struct zathura_document_s;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment