mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-12-28 06:56:00 +01:00
Merge remote-tracking branch 'projedi/smooth-scroll' into develop
This commit is contained in:
commit
7a997ef88f
4 changed files with 32 additions and 7 deletions
14
config.c
14
config.c
|
@ -319,16 +319,18 @@ config_load_default(zathura_t* zathura)
|
|||
girara_shortcut_add(gsession, 0, 0, "zZ", sc_zoom, (mode), ZOOM_SPECIFIC, NULL);
|
||||
|
||||
#define DEFAULT_MOUSE_EVENTS(mode) \
|
||||
girara_mouse_event_add(gsession, 0, 0, sc_mouse_scroll, (mode), GIRARA_EVENT_SCROLL_UP, UP, NULL); \
|
||||
girara_mouse_event_add(gsession, 0, 0, sc_mouse_scroll, (mode), GIRARA_EVENT_SCROLL_DOWN, DOWN, NULL); \
|
||||
girara_mouse_event_add(gsession, 0, 0, sc_mouse_scroll, (mode), GIRARA_EVENT_SCROLL_LEFT, LEFT, NULL); \
|
||||
girara_mouse_event_add(gsession, 0, 0, sc_mouse_scroll, (mode), GIRARA_EVENT_SCROLL_RIGHT, RIGHT, NULL); \
|
||||
girara_mouse_event_add(gsession, 0, 0, sc_mouse_scroll, (mode), GIRARA_EVENT_SCROLL_UP, UP, NULL); \
|
||||
girara_mouse_event_add(gsession, 0, 0, sc_mouse_scroll, (mode), GIRARA_EVENT_SCROLL_DOWN, DOWN, NULL); \
|
||||
girara_mouse_event_add(gsession, 0, 0, sc_mouse_scroll, (mode), GIRARA_EVENT_SCROLL_LEFT, LEFT, NULL); \
|
||||
girara_mouse_event_add(gsession, 0, 0, sc_mouse_scroll, (mode), GIRARA_EVENT_SCROLL_RIGHT, RIGHT, NULL); \
|
||||
girara_mouse_event_add(gsession, 0, 0, sc_mouse_scroll, (mode), GIRARA_EVENT_SCROLL_BIDIRECTIONAL, BIDIRECTIONAL, NULL); \
|
||||
\
|
||||
girara_mouse_event_add(gsession, GDK_SHIFT_MASK, 0, sc_mouse_scroll, (mode), GIRARA_EVENT_SCROLL_UP, LEFT, NULL); \
|
||||
girara_mouse_event_add(gsession, GDK_SHIFT_MASK, 0, sc_mouse_scroll, (mode), GIRARA_EVENT_SCROLL_DOWN, RIGHT, NULL); \
|
||||
\
|
||||
girara_mouse_event_add(gsession, GDK_CONTROL_MASK, 0, sc_mouse_zoom, (mode), GIRARA_EVENT_SCROLL_UP, UP, NULL); \
|
||||
girara_mouse_event_add(gsession, GDK_CONTROL_MASK, 0, sc_mouse_zoom, (mode), GIRARA_EVENT_SCROLL_DOWN, DOWN, NULL); \
|
||||
girara_mouse_event_add(gsession, GDK_CONTROL_MASK, 0, sc_mouse_zoom, (mode), GIRARA_EVENT_SCROLL_UP, UP, NULL); \
|
||||
girara_mouse_event_add(gsession, GDK_CONTROL_MASK, 0, sc_mouse_zoom, (mode), GIRARA_EVENT_SCROLL_DOWN, DOWN, NULL); \
|
||||
girara_mouse_event_add(gsession, GDK_CONTROL_MASK, 0, sc_mouse_zoom, (mode), GIRARA_EVENT_SCROLL_BIDIRECTIONAL, BIDIRECTIONAL, NULL); \
|
||||
girara_mouse_event_add(gsession, 0, GIRARA_MOUSE_BUTTON2, sc_mouse_scroll, (mode), GIRARA_EVENT_BUTTON_PRESS, 0, NULL); \
|
||||
girara_mouse_event_add(gsession, GDK_BUTTON2_MASK, GIRARA_MOUSE_BUTTON2, sc_mouse_scroll, (mode), GIRARA_EVENT_BUTTON_RELEASE, 0, NULL); \
|
||||
girara_mouse_event_add(gsession, GDK_BUTTON2_MASK, 0, sc_mouse_scroll, (mode), GIRARA_EVENT_MOTION_NOTIFY, 0, NULL); \
|
||||
|
|
|
@ -798,6 +798,13 @@ Defines if scrolling by half or full pages stops at page boundaries.
|
|||
* Value type: Boolean
|
||||
* Default value: false
|
||||
|
||||
smooth-scroll
|
||||
^^^^^^^^^^^^^
|
||||
Defines if scrolling via touchpad should be smooth(only available with gtk >= 3.4).
|
||||
|
||||
* Value type: Boolean
|
||||
* Default value: false
|
||||
|
||||
link-zoom
|
||||
^^^^^^^^^
|
||||
En/Disables the ability of changing zoom when following links.
|
||||
|
|
14
shortcuts.c
14
shortcuts.c
|
@ -285,6 +285,7 @@ sc_mouse_scroll(girara_session_t* session, girara_argument_t* argument, girara_e
|
|||
case GIRARA_EVENT_SCROLL_DOWN:
|
||||
case GIRARA_EVENT_SCROLL_LEFT:
|
||||
case GIRARA_EVENT_SCROLL_RIGHT:
|
||||
case GIRARA_EVENT_SCROLL_BIDIRECTIONAL:
|
||||
return sc_scroll(session, argument, NULL, t);
|
||||
|
||||
/* drag */
|
||||
|
@ -339,6 +340,9 @@ sc_mouse_zoom(girara_session_t* session, girara_argument_t* argument, girara_eve
|
|||
case GIRARA_EVENT_SCROLL_DOWN:
|
||||
argument->n = ZOOM_OUT;
|
||||
break;
|
||||
case GIRARA_EVENT_SCROLL_BIDIRECTIONAL:
|
||||
argument->n = ZOOM_SMOOTH;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
@ -593,6 +597,13 @@ sc_scroll(girara_session_t* session, girara_argument_t* argument,
|
|||
case RIGHT:
|
||||
pos_x += direction * t * scroll_hstep / (double)doc_width;
|
||||
break;
|
||||
|
||||
case BIDIRECTIONAL: {
|
||||
double* movement = (double*)argument->data;
|
||||
pos_x += movement[0] * t * scroll_hstep / (double)doc_width;
|
||||
pos_y += movement[1] * t * scroll_step / (double)doc_height;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* handle boundaries */
|
||||
|
@ -1371,6 +1382,9 @@ sc_zoom(girara_session_t* session, girara_argument_t* argument, girara_event_t*
|
|||
} else {
|
||||
zathura_document_set_scale(zathura->document, t / 100.0);
|
||||
}
|
||||
} else if (argument->n == ZOOM_SMOOTH) {
|
||||
double dy = ((double*)argument->data)[1];
|
||||
zathura_document_set_scale(zathura->document, old_zoom + zoom_step * dy);
|
||||
} else {
|
||||
zathura_document_set_scale(zathura->document, 1.0);
|
||||
}
|
||||
|
|
|
@ -60,7 +60,9 @@ enum {
|
|||
ROTATE_CW,
|
||||
ROTATE_CCW,
|
||||
PAGE_BOTTOM,
|
||||
PAGE_TOP
|
||||
PAGE_TOP,
|
||||
BIDIRECTIONAL,
|
||||
ZOOM_SMOOTH
|
||||
};
|
||||
|
||||
/* unspecified page number */
|
||||
|
|
Loading…
Reference in a new issue