mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-11-10 22:43:46 +01:00
Add numeric prefix to sc_zoom
One can zoom to a specific zoom value (between 10% and 1000%) by passing a number before the = sign Fixes: #105
This commit is contained in:
parent
a2b92e6440
commit
5c93ebcb8c
2
config.c
2
config.c
@ -132,6 +132,8 @@ config_load_default(zathura_t* zathura)
|
||||
girara_shortcut_add(gsession, 0, 0, "zO", sc_zoom, FULLSCREEN, ZOOM_OUT, NULL);
|
||||
girara_shortcut_add(gsession, 0, 0, "z0", sc_zoom, NORMAL, ZOOM_ORIGINAL, NULL);
|
||||
girara_shortcut_add(gsession, 0, 0, "z0", sc_zoom, FULLSCREEN, ZOOM_ORIGINAL, NULL);
|
||||
girara_shortcut_add(gsession, 0, GDK_equal, NULL, sc_zoom, NORMAL, ZOOM_SPECIFIC, NULL);
|
||||
girara_shortcut_add(gsession, 0, GDK_equal, NULL, sc_zoom, FULLSCREEN, ZOOM_SPECIFIC, NULL);
|
||||
|
||||
/* mouse events */
|
||||
girara_mouse_event_add(gsession, 0, 0, sc_mouse_scroll, NORMAL, 0, NULL);
|
||||
|
13
shortcuts.c
13
shortcuts.c
@ -728,7 +728,7 @@ sc_quit(girara_session_t* session, girara_argument_t* UNUSED(argument),
|
||||
|
||||
bool
|
||||
sc_zoom(girara_session_t* session, girara_argument_t* argument, girara_event_t*
|
||||
UNUSED(event), unsigned int UNUSED(t))
|
||||
UNUSED(event), unsigned int t)
|
||||
{
|
||||
g_return_val_if_fail(session != NULL, false);
|
||||
g_return_val_if_fail(session->global.data != NULL, false);
|
||||
@ -742,14 +742,25 @@ sc_zoom(girara_session_t* session, girara_argument_t* argument, girara_event_t*
|
||||
|
||||
float zoom_step = value / 100.0f;
|
||||
|
||||
/* specify new zoom value */
|
||||
if (argument->n == ZOOM_IN) {
|
||||
zathura->document->scale += zoom_step;
|
||||
} else if (argument->n == ZOOM_OUT) {
|
||||
zathura->document->scale -= zoom_step;
|
||||
} else if (argument->n == ZOOM_SPECIFIC) {
|
||||
fprintf(stderr, "t: %d\n", t);
|
||||
zathura->document->scale = t / 100.0f;
|
||||
} else {
|
||||
zathura->document->scale = 1.0;
|
||||
}
|
||||
|
||||
/* zoom limitations */
|
||||
if (zathura->document->scale < 0.1f) {
|
||||
zathura->document->scale = 0.1f;
|
||||
} else if (zathura->document->scale > 10.0f) {
|
||||
zathura->document->scale = 10.0f;
|
||||
}
|
||||
|
||||
render_all(zathura);
|
||||
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user