diff --git a/config.c b/config.c index 101cb00..3f8306e 100644 --- a/config.c +++ b/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_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 diff --git a/shortcuts.c b/shortcuts.c index 1fb6e15..84e59c6 100644 --- a/shortcuts.c +++ b/shortcuts.c @@ -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); diff --git a/zathura.h b/zathura.h index f657f79..336f900 100644 --- a/zathura.h +++ b/zathura.h @@ -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;