Commit 6cdc2b19 authored by Sebastian Ramacher's avatar Sebastian Ramacher

Add argument to rotate to support counter-clockwise rotation (Closes: #154)

parent d4b92610
......@@ -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_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_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, "best-fit", ADJUST_BESTFIT);
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
......
......@@ -421,7 +421,7 @@ sc_reload(girara_session_t* session, girara_argument_t* UNUSED(argument),
}
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))
{
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;
int angle = 90;
if (argument != NULL && argument->n == ROTATE_CCW) {
angle = 270;
}
/* 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(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,
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,
DELETE_TO_LINE_START, APPEND_FILEPATH };
DELETE_TO_LINE_START, APPEND_FILEPATH, ROTATE_CW, ROTATE_CCW };
/* 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