Add shortcuts for ^C and Esc in all modes

This should fix #392 and hopefully doesn't break anything else.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
This commit is contained in:
Sebastian Ramacher 2014-02-14 12:59:25 +01:00
parent 70f8e20e19
commit 35f278e1f3

View File

@ -129,6 +129,14 @@ config_load_default(zathura_t* zathura)
#define FULLSCREEN zathura->modes.fullscreen
#define PRESENTATION zathura->modes.presentation
const girara_mode_t all_modes[] = {
NORMAL,
INSERT,
INDEX,
FULLSCREEN,
PRESENTATION
};
/* Set default mode */
girara_mode_set(gsession, zathura->modes.normal);
@ -318,9 +326,13 @@ config_load_default(zathura_t* zathura)
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); \
/* Define mode-less shortcuts */
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_c, NULL, sc_abort, 0, 0, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_Escape, NULL, sc_abort, 0, 0, NULL);
/* Define mode-less shortcuts
* girara adds them only for normal mode, so passing 0 as mode is currently
* not enough. We need to add/override for every mode. */
for (size_t idx = 0; idx != LENGTH(all_modes); ++idx) {
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_c, NULL, sc_abort, all_modes[idx], 0, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_Escape, NULL, sc_abort, all_modes[idx], 0, NULL);
}
/* Normal mode */
girara_shortcut_add(gsession, 0, GDK_KEY_F5, NULL, sc_toggle_presentation, NORMAL, 0, NULL);