mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-12-29 12:46:00 +01:00
Add argument to rotate to support counter-clockwise rotation (Closes: #154)
This commit is contained in:
parent
d4b92610de
commit
6cdc2b1974
3 changed files with 11 additions and 4 deletions
4
config.c
4
config.c
|
@ -175,7 +175,7 @@ config_load_default(zathura_t* zathura)
|
||||||
|
|
||||||
girara_shortcut_add(gsession, 0, GDK_KEY_R, NULL, sc_reload, NORMAL, 0, NULL);
|
girara_shortcut_add(gsession, 0, GDK_KEY_R, NULL, sc_reload, NORMAL, 0, NULL);
|
||||||
|
|
||||||
girara_shortcut_add(gsession, 0, GDK_KEY_r, NULL, sc_rotate, NORMAL, 0, NULL);
|
girara_shortcut_add(gsession, 0, GDK_KEY_r, NULL, sc_rotate, NORMAL, ROTATE_CW, NULL);
|
||||||
|
|
||||||
girara_shortcut_add(gsession, 0, GDK_KEY_h, NULL, sc_scroll, NORMAL, LEFT, NULL);
|
girara_shortcut_add(gsession, 0, GDK_KEY_h, NULL, sc_scroll, NORMAL, LEFT, NULL);
|
||||||
girara_shortcut_add(gsession, 0, GDK_KEY_j, NULL, sc_scroll, NORMAL, DOWN, NULL);
|
girara_shortcut_add(gsession, 0, GDK_KEY_j, NULL, sc_scroll, NORMAL, DOWN, NULL);
|
||||||
|
@ -299,6 +299,8 @@ config_load_default(zathura_t* zathura)
|
||||||
girara_argument_mapping_add(gsession, "up", UP);
|
girara_argument_mapping_add(gsession, "up", UP);
|
||||||
girara_argument_mapping_add(gsession, "best-fit", ADJUST_BESTFIT);
|
girara_argument_mapping_add(gsession, "best-fit", ADJUST_BESTFIT);
|
||||||
girara_argument_mapping_add(gsession, "width", ADJUST_WIDTH);
|
girara_argument_mapping_add(gsession, "width", ADJUST_WIDTH);
|
||||||
|
girara_argument_mapping_add(gsession, "rotate-cw", ROTATE_CW);
|
||||||
|
girara_argument_mapping_add(gsession, "rotate-ccw", ROTATE_CCW);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -421,7 +421,7 @@ sc_reload(girara_session_t* session, girara_argument_t* UNUSED(argument),
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
sc_rotate(girara_session_t* session, girara_argument_t* UNUSED(argument),
|
sc_rotate(girara_session_t* session, girara_argument_t* argument,
|
||||||
girara_event_t* UNUSED(event), unsigned int UNUSED(t))
|
girara_event_t* UNUSED(event), unsigned int UNUSED(t))
|
||||||
{
|
{
|
||||||
g_return_val_if_fail(session != NULL, false);
|
g_return_val_if_fail(session != NULL, false);
|
||||||
|
@ -431,8 +431,13 @@ sc_rotate(girara_session_t* session, girara_argument_t* UNUSED(argument),
|
||||||
|
|
||||||
unsigned int page_number = zathura->document->current_page_number;
|
unsigned int page_number = zathura->document->current_page_number;
|
||||||
|
|
||||||
|
int angle = 90;
|
||||||
|
if (argument != NULL && argument->n == ROTATE_CCW) {
|
||||||
|
angle = 270;
|
||||||
|
}
|
||||||
|
|
||||||
/* update rotate value */
|
/* update rotate value */
|
||||||
zathura->document->rotate = (zathura->document->rotate + 90) % 360;
|
zathura->document->rotate = (zathura->document->rotate + angle) % 360;
|
||||||
|
|
||||||
/* render all pages again */
|
/* render all pages again */
|
||||||
render_all(zathura);
|
render_all(zathura);
|
||||||
|
|
|
@ -15,7 +15,7 @@ enum { NEXT, PREVIOUS, LEFT, RIGHT, UP, DOWN, BOTTOM, TOP, HIDE, HIGHLIGHT,
|
||||||
ADD_MARKER, EVAL_MARKER, EXPAND, EXPAND_ALL, COLLAPSE_ALL, COLLAPSE, SELECT,
|
ADD_MARKER, EVAL_MARKER, EXPAND, EXPAND_ALL, COLLAPSE_ALL, COLLAPSE, SELECT,
|
||||||
GOTO_DEFAULT, GOTO_LABELS, GOTO_OFFSET, HALF_UP, HALF_DOWN, FULL_UP,
|
GOTO_DEFAULT, GOTO_LABELS, GOTO_OFFSET, HALF_UP, HALF_DOWN, FULL_UP,
|
||||||
FULL_DOWN, HALF_LEFT, HALF_RIGHT, FULL_LEFT, FULL_RIGHT, NEXT_CHAR, PREVIOUS_CHAR,
|
FULL_DOWN, HALF_LEFT, HALF_RIGHT, FULL_LEFT, FULL_RIGHT, NEXT_CHAR, PREVIOUS_CHAR,
|
||||||
DELETE_TO_LINE_START, APPEND_FILEPATH };
|
DELETE_TO_LINE_START, APPEND_FILEPATH, ROTATE_CW, ROTATE_CCW };
|
||||||
|
|
||||||
/* forward declaration for types from document.h */
|
/* forward declaration for types from document.h */
|
||||||
struct zathura_document_s;
|
struct zathura_document_s;
|
||||||
|
|
Loading…
Reference in a new issue