Commit a7b3d73f authored by Moritz Lipp's avatar Moritz Lipp

Merge branch 'release/0.2.7'

parents 6d22f33f 0f005c0d
......@@ -18,3 +18,4 @@ doc/
zathura.1
zathurarc.5
.version-checks/
dbus-interface-definitions.c
Copyright (c) 2009-2013 pwmt.org
Copyright (c) 2009-2014 pwmt.org
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
......
......@@ -4,22 +4,22 @@ include config.mk
include common.mk
PROJECT = zathura
OSOURCE = $(wildcard *.c)
OSOURCE = $(filter-out dbus-interface-definitions.c, $(wildcard *.c))
HEADER = $(wildcard *.h)
HEADERINST = version.h document.h macros.h page.h types.h plugin-api.h links.h
ifneq (${WITH_SQLITE},0)
INCS += $(SQLITE_INC)
LIBS += $(SQLITE_LIB)
SOURCE = $(OSOURCE)
INCS += $(SQLITE_INC)
LIBS += $(SQLITE_LIB)
SOURCE = $(OSOURCE)
CPPFLAGS += -DWITH_SQLITE
else
SOURCE = $(filter-out database-sqlite.c,$(OSOURCE))
SOURCE = $(filter-out database-sqlite.c,$(OSOURCE))
endif
ifneq ($(WITH_MAGIC),0)
INCS += $(MAGIC_INC)
LIBS += $(MAGIC_LIB)
INCS += $(MAGIC_INC)
LIBS += $(MAGIC_LIB)
CPPFLAGS += -DWITH_MAGIC
endif
......@@ -37,13 +37,13 @@ ifeq (,$(findstring -DLOCALEDIR,${CPPFLAGS}))
CPPFLAGS += -DLOCALEDIR=\"${LOCALEDIR}\"
endif
OBJECTS = $(patsubst %.c, %.o, $(SOURCE))
DOBJECTS = $(patsubst %.c, %.do, $(SOURCE))
OBJECTS = $(patsubst %.c, %.o, $(SOURCE)) dbus-interface-definitions.o
DOBJECTS = $(patsubst %.o, %.do, $(OBJECTS))
all: options ${PROJECT} po build-manpages
# pkg-config based version checks
.version-checks/%:
.version-checks/%: config.mk
$(QUIET)test $($(*)_VERSION_CHECK) -eq 0 || \
pkg-config --atleast-version $($(*)_MIN_VERSION) $($(*)_PKG_CONFIG_NAME) || ( \
echo "The minium required version of $(*) is $($(*)_MIN_VERSION)" && \
......@@ -64,7 +64,15 @@ version.h: version.h.in config.mk
-e 's/ZVMINOR/${ZATHURA_VERSION_MINOR}/' \
-e 's/ZVREV/${ZATHURA_VERSION_REV}/' \
-e 's/ZVAPI/${ZATHURA_API_VERSION}/' \
-e 's/ZVABI/${ZATHURA_ABI_VERSION}/' version.h.in > version.h
-e 's/ZVABI/${ZATHURA_ABI_VERSION}/' version.h.in > version.h.tmp
$(QUIET)mv version.h.tmp version.h
dbus-interface-definitions.c: data/org.pwmt.zathura.xml
$(QUIET)echo '#include "dbus-interface-definitions.h"' > dbus-interface-definitions.c.tmp
$(QUIET)echo 'const char* DBUS_INTERFACE_XML =' >> dbus-interface-definitions.c.tmp
$(QUIET)sed 's/^\(.*\)$$/"\1\\n"/' data/org.pwmt.zathura.xml >> dbus-interface-definitions.c.tmp
$(QUIET)echo ';' >> dbus-interface-definitions.c.tmp
$(QUIET)mv dbus-interface-definitions.c.tmp dbus-interface-definitions.c
%.o: %.c
$(ECHO) CC $<
......@@ -84,8 +92,18 @@ ${PROJECT}: ${OBJECTS}
$(QUIET)${CC} ${SFLAGS} ${LDFLAGS} -o $@ ${OBJECTS} ${LIBS}
clean:
$(QUIET)rm -rf ${PROJECT} ${OBJECTS} ${PROJECT}-${VERSION}.tar.gz \
${DOBJECTS} ${PROJECT}-debug .depend ${PROJECT}.pc doc version.h \
$(QUIET)rm -rf ${PROJECT} \
${OBJECTS} \
${PROJECT}-${VERSION}.tar.gz \
${DOBJECTS} \
${PROJECT}-debug \
.depend \
${PROJECT}.pc \
doc \
version.h \
version.h.tmp \
dbus-interface-definitions.c \
dbus-interface-definitions.c.tmp \
*gcda *gcno $(PROJECT).info gcov *.tmp \
.version-checks
ifneq "$(wildcard ${RSTTOMAN})" ""
......@@ -107,7 +125,7 @@ ${PROJECT}.pc: ${PROJECT}.pc.in config.mk
$(QUIET)echo abiversion=${ZATHURA_ABI_VERSION} >> ${PROJECT}.pc
$(QUIET)echo includedir=${INCLUDEDIR} >> ${PROJECT}.pc
$(QUIET)echo plugindir=${PLUGINDIR} >> ${PROJECT}.pc
$(QUIET)echo GTK_VERSION=${ZATHURA_GTK_VERSION} >> ${PROJECT}.pc
$(QUIET)echo GTK_VERSION=3 >> ${PROJECT}.pc
$(QUIET)cat ${PROJECT}.pc.in >> ${PROJECT}.pc
valgrind: debug
......@@ -129,6 +147,7 @@ dist: clean build-manpages
${PROJECT}.desktop version.h.in \
${PROJECT}.1 ${PROJECT}rc.5 \
${PROJECT}-${VERSION}
$(QUIET)cp -r data ${PROJECT}-${VERSION}
$(QUIET)cp tests/Makefile tests/config.mk tests/*.c \
${PROJECT}-${VERSION}/tests
$(QUIET)cp po/Makefile po/*.po ${PROJECT}-${VERSION}/po
......@@ -184,7 +203,12 @@ install-headers: ${PROJECT}.pc
$(QUIET)mkdir -m 755 -p ${DESTDIR}${LIBDIR}/pkgconfig
$(QUIET)install -m 644 ${PROJECT}.pc ${DESTDIR}${LIBDIR}/pkgconfig
install: all install-headers install-manpages
install-dbus:
$(ECHO) installing D-Bus interface definitions
$(QUIET)mkdir -m 755 -p $(DESTDIR)$(DBUSINTERFACEDIR)
$(QUIET)install -m 644 data/org.pwmt.zathura.xml $(DESTDIR)$(DBUSINTERFACEDIR)
install: all install-headers install-manpages install-dbus
$(ECHO) installing executable file
$(QUIET)mkdir -m 755 -p ${DESTDIR}${PREFIX}/bin
$(QUIET)install -m 755 ${PROJECT} ${DESTDIR}${PREFIX}/bin
......@@ -207,9 +231,12 @@ uninstall: uninstall-headers
$(QUIET)rm -f ${DESTDIR}${MANPREFIX}/man5/${PROJECT}rc.5
$(ECHO) removing desktop file
$(QUIET)rm -f ${DESTDIR}${DESKTOPPREFIX}/${PROJECT}.desktop
$(ECHO) removing D-Bus interface definitions
$(QUIET)rm -f $(DESTDIR)$(DBUSINTERFACEDIR)/org.pwmt.zathura.xml
$(MAKE) -C po uninstall
-include $(wildcard .depend/*.dep)
.PHONY: all options clean doc debug valgrind gdb dist doc install uninstall test \
po install-headers uninstall-headers update-po install-manpages build-manpages
.PHONY: all options clean doc debug valgrind gdb dist doc install uninstall \
test po install-headers uninstall-headers update-po install-manpages \
build-manpages install-dbus
......@@ -5,9 +5,9 @@ girara user interface library and several document libraries.
Requirements
------------
gtk2 (>= 2.18) or gtk3
gtk3
glib (>= 2.28)
girara
girara (>= 0.1.8)
sqlite3 (optional, >= 3.5.9)
check (for tests)
intltool
......
......@@ -146,20 +146,6 @@ page_is_visible(zathura_document_t *document, unsigned int page_number)
fabs(pos_y - page_y) < 0.5 * (double)(view_height + cell_height) / (double)doc_height);
}
GtkAdjustment*
zathura_adjustment_clone(GtkAdjustment* adjustment)
{
gdouble value = gtk_adjustment_get_value(adjustment);
gdouble lower = gtk_adjustment_get_lower(adjustment);
gdouble upper = gtk_adjustment_get_upper(adjustment);
gdouble step_increment = gtk_adjustment_get_step_increment(adjustment);
gdouble page_increment = gtk_adjustment_get_page_increment(adjustment);
gdouble page_size = gtk_adjustment_get_page_size(adjustment);
return GTK_ADJUSTMENT(gtk_adjustment_new(value, lower, upper, step_increment,
page_increment, page_size));
}
void
zathura_adjustment_set_value(GtkAdjustment* adjustment, gdouble value)
{
......
......@@ -69,17 +69,6 @@ void page_number_to_position(zathura_document_t* document, unsigned int page_num
*/
bool page_is_visible(zathura_document_t *document, unsigned int page_number);
/**
* Clone a GtkAdjustment
*
* Creates a new adjustment with the same value, lower and upper bounds, step
* and page increments and page_size as the original adjustment.
*
* @param adjustment Adjustment instance to be cloned
* @return Pointer to the new adjustment
*/
GtkAdjustment* zathura_adjustment_clone(GtkAdjustment* adjustment);
/**
* Set the adjustment value while enforcing its limits
*
......
......@@ -48,7 +48,10 @@ zathura_bookmark_add(zathura_t* zathura, const gchar* id, unsigned int page)
return old;
}
zathura_bookmark_t* bookmark = g_malloc0(sizeof(zathura_bookmark_t));
zathura_bookmark_t* bookmark = g_try_malloc0(sizeof(zathura_bookmark_t));
if (bookmark == NULL) {
return NULL;
}
bookmark->id = g_strdup(id);
bookmark->page = page;
......
......@@ -50,7 +50,8 @@ cb_buffer_changed(girara_session_t* session)
}
static void
update_visible_pages(zathura_t* zathura) {
update_visible_pages(zathura_t* zathura)
{
const unsigned int number_of_pages = zathura_document_get_number_of_pages(zathura->document);
for (unsigned int page_id = 0; page_id < number_of_pages; page_id++) {
......@@ -539,6 +540,11 @@ cb_page_widget_text_selected(ZathuraPage* page, const char* text, void* data)
g_return_if_fail(data != NULL);
zathura_t* zathura = data;
girara_mode_t mode = girara_mode_get(zathura->ui.session);
if (mode != zathura->modes.normal && mode != zathura->modes.fullscreen) {
return;
}
GdkAtom* selection = get_selection(zathura);
/* copy to clipboard */
......
......@@ -239,7 +239,7 @@ cmd_open(girara_session_t* session, girara_list_t* argument_list)
}
document_open(zathura, girara_list_nth(argument_list, 0),
(argc == 2) ? girara_list_nth(argument_list, 1) : NULL,
(argc == 2) ? girara_list_nth(argument_list, 1) : NULL,
ZATHURA_PAGE_NUMBER_UNSPECIFIED);
} else {
girara_notify(session, GIRARA_ERROR, _("No arguments given."));
......@@ -400,7 +400,10 @@ cmd_search(girara_session_t* session, const char* input, girara_argument_t* argu
}
}
girara_argument_t* arg = g_malloc0(sizeof(girara_argument_t));
girara_argument_t* arg = g_try_malloc0(sizeof(girara_argument_t));
if (arg == NULL) {
return false;
}
arg->n = FORWARD;
sc_search(session, arg, NULL, 0);
......
......@@ -15,9 +15,12 @@
#include <girara/shortcuts.h>
#include <girara/config.h>
#include <girara/commands.h>
#include <girara/gtk2-compat.h>
#include <girara/utils.h>
#include <glib/gi18n.h>
#define GLOBAL_RC "/etc/zathurarc"
#define ZATHURA_RC "zathurarc"
static void
cb_jumplist_change(girara_session_t* session, const char* name,
girara_setting_type_t UNUSED(type), void* value, void* UNUSED(data))
......@@ -51,11 +54,11 @@ cb_color_change(girara_session_t* session, const char* name,
g_return_if_fail(name != NULL);
zathura_t* zathura = session->global.data;
char* string_value = (char*) value;
const char* string_value = (const char*) value;
if (g_strcmp0(name, "highlight-color") == 0) {
gdk_color_parse(string_value, &(zathura->ui.colors.highlight_color));
gdk_rgba_parse(&(zathura->ui.colors.highlight_color), string_value);
} else if (g_strcmp0(name, "highlight-active-color") == 0) {
gdk_color_parse(string_value, &(zathura->ui.colors.highlight_color_active));
gdk_rgba_parse(&(zathura->ui.colors.highlight_color_active), string_value);
} else if (g_strcmp0(name, "recolor-darkcolor") == 0) {
if (zathura->sync.render_thread != NULL) {
zathura_renderer_set_recolor_colors_str(zathura->sync.render_thread, NULL, string_value);
......@@ -65,9 +68,9 @@ cb_color_change(girara_session_t* session, const char* name,
zathura_renderer_set_recolor_colors_str(zathura->sync.render_thread, string_value, NULL);
}
} else if (g_strcmp0(name, "render-loading-bg") == 0) {
gdk_color_parse(string_value, &(zathura->ui.colors.render_loading_bg));
gdk_rgba_parse(&(zathura->ui.colors.render_loading_bg), string_value);
} else if (g_strcmp0(name, "render-loading-fg") == 0) {
gdk_color_parse(string_value, &(zathura->ui.colors.render_loading_fg));
gdk_rgba_parse(&(zathura->ui.colors.render_loading_fg), string_value);
}
render_all(zathura);
......@@ -110,21 +113,31 @@ config_load_default(zathura_t* zathura)
int int_value = 0;
float float_value = 0;
bool bool_value = false;
bool inc_search = true;
char* string_value = NULL;
girara_session_t* gsession = zathura->ui.session;
/* mode settings */
zathura->modes.normal = gsession->modes.normal;
zathura->modes.fullscreen = girara_mode_add(gsession, "fullscreen");
zathura->modes.index = girara_mode_add(gsession, "index");
zathura->modes.insert = girara_mode_add(gsession, "insert");
zathura->modes.normal = gsession->modes.normal;
zathura->modes.fullscreen = girara_mode_add(gsession, "fullscreen");
zathura->modes.index = girara_mode_add(gsession, "index");
zathura->modes.insert = girara_mode_add(gsession, "insert");
zathura->modes.presentation = girara_mode_add(gsession, "presentation");
#define NORMAL zathura->modes.normal
#define INSERT zathura->modes.insert
#define INDEX zathura->modes.index
#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);
/* zathura settings */
......@@ -194,8 +207,9 @@ config_load_default(zathura_t* zathura)
girara_setting_add(gsession, "open-first-page", &bool_value, BOOLEAN, false, _("Always open on first page"), NULL, NULL);
bool_value = false;
girara_setting_add(gsession, "nohlsearch", &bool_value, BOOLEAN, false, _("Highlight search results"), cb_nohlsearch_changed, NULL);
inc_search = false;
girara_setting_add(gsession, "incremental-search", &inc_search, BOOLEAN, false, _("Enable incremental search"), cb_incsearch_changed, NULL);
#define INCREMENTAL_SEARCH false
bool_value = INCREMENTAL_SEARCH;
girara_setting_add(gsession, "incremental-search", &bool_value, BOOLEAN, false, _("Enable incremental search"), cb_incsearch_changed, NULL);
bool_value = true;
girara_setting_add(gsession, "abort-clear-search", &bool_value, BOOLEAN, false, _("Clear search results on abort"), NULL, NULL);
bool_value = false;
......@@ -206,165 +220,192 @@ config_load_default(zathura_t* zathura)
girara_setting_add(gsession, "statusbar-basename", &bool_value, BOOLEAN, false, _("Use basename of the file in the statusbar"), NULL, NULL);
bool_value = false;
girara_setting_add(gsession, "synctex", &bool_value, BOOLEAN, false, _("Enable synctex support"), NULL, NULL);
bool_value = true;
girara_setting_add(gsession, "dbus-service", &bool_value, BOOLEAN, false, _("Enable D-Bus service"), NULL, NULL);
string_value = "primary";
girara_setting_add(gsession, "selection-clipboard", string_value, STRING, false, _("The clipboard into which mouse-selected data will be written"), NULL, NULL);
/* define default 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);
girara_shortcut_add(gsession, 0, GDK_KEY_a, NULL, sc_adjust_window, NORMAL, ZATHURA_ADJUST_BESTFIT, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_s, NULL, sc_adjust_window, NORMAL, ZATHURA_ADJUST_WIDTH, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_F, NULL, sc_display_link, NORMAL, 0, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_slash, NULL, sc_focus_inputbar, NORMAL, 0, &("/"));
girara_shortcut_add(gsession, GDK_SHIFT_MASK, GDK_KEY_slash, NULL, sc_focus_inputbar, NORMAL, 0, &("/"));
girara_shortcut_add(gsession, 0, GDK_KEY_question, NULL, sc_focus_inputbar, NORMAL, 0, &("?"));
girara_shortcut_add(gsession, 0, GDK_KEY_colon, NULL, sc_focus_inputbar, NORMAL, 0, &(":"));
girara_shortcut_add(gsession, 0, GDK_KEY_o, NULL, sc_focus_inputbar, NORMAL, 0, &(":open "));
girara_shortcut_add(gsession, 0, GDK_KEY_O, NULL, sc_focus_inputbar, NORMAL, APPEND_FILEPATH, &(":open "));
girara_shortcut_add(gsession, 0, GDK_KEY_f, NULL, sc_follow, NORMAL, 0, NULL);
girara_shortcut_add(gsession, 0, 0, "gg", sc_goto, NORMAL, TOP, NULL);
girara_shortcut_add(gsession, 0, 0, "gg", sc_goto, FULLSCREEN, TOP, NULL);
girara_shortcut_add(gsession, 0, 0, "G", sc_goto, NORMAL, BOTTOM, NULL);
girara_shortcut_add(gsession, 0, 0, "G", sc_goto, FULLSCREEN, BOTTOM, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_m, NULL, sc_mark_add, NORMAL, 0, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_apostrophe, NULL, sc_mark_evaluate, NORMAL, 0, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_J, NULL, sc_navigate, NORMAL, NEXT, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_K, NULL, sc_navigate, NORMAL, PREVIOUS, NULL);
girara_shortcut_add(gsession, GDK_MOD1_MASK, GDK_KEY_Right, NULL, sc_navigate, NORMAL, NEXT, NULL);
girara_shortcut_add(gsession, GDK_MOD1_MASK, GDK_KEY_Left, NULL, sc_navigate, NORMAL, PREVIOUS, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_Page_Down, NULL, sc_navigate, NORMAL, NEXT, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_Page_Up, NULL, sc_navigate, NORMAL, PREVIOUS, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_J, NULL, sc_navigate, FULLSCREEN, NEXT, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_Down, NULL, sc_navigate, FULLSCREEN, NEXT, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_Right, NULL, sc_navigate, FULLSCREEN, NEXT, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_Page_Down, NULL, sc_navigate, FULLSCREEN, NEXT, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_space, NULL, sc_navigate, FULLSCREEN, NEXT, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_K, NULL, sc_navigate, FULLSCREEN, PREVIOUS, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_Left, NULL, sc_navigate, FULLSCREEN, PREVIOUS, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_Up, NULL, sc_navigate, FULLSCREEN, PREVIOUS, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_Page_Up, NULL, sc_navigate, FULLSCREEN, PREVIOUS, NULL);
girara_shortcut_add(gsession, GDK_SHIFT_MASK, GDK_KEY_space, NULL, sc_navigate, FULLSCREEN, PREVIOUS, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_BackSpace, NULL, sc_navigate, FULLSCREEN, PREVIOUS, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_k, NULL, sc_navigate_index, INDEX, UP, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_j, NULL, sc_navigate_index, INDEX, DOWN, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_h, NULL, sc_navigate_index, INDEX, COLLAPSE, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_l, NULL, sc_navigate_index, INDEX, EXPAND, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_L, NULL, sc_navigate_index, INDEX, EXPAND_ALL, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_H, NULL, sc_navigate_index, INDEX, COLLAPSE_ALL, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_Up, NULL, sc_navigate_index, INDEX, UP, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_Down, NULL, sc_navigate_index, INDEX, DOWN, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_Left, NULL, sc_navigate_index, INDEX, COLLAPSE, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_Right, NULL, sc_navigate_index, INDEX, EXPAND, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_space, NULL, sc_navigate_index, INDEX, SELECT, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_Return, NULL, sc_navigate_index, INDEX, SELECT, NULL);
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_p, NULL, sc_print, NORMAL, 0, NULL);
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_r, NULL, sc_recolor, 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, 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);
girara_shortcut_add(gsession, 0, GDK_KEY_k, NULL, sc_scroll, NORMAL, UP, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_l, NULL, sc_scroll, NORMAL, RIGHT, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_Left, NULL, sc_scroll, NORMAL, LEFT, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_Up, NULL, sc_scroll, NORMAL, UP, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_Down, NULL, sc_scroll, NORMAL, DOWN, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_Right, NULL, sc_scroll, NORMAL, RIGHT, NULL);
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_t, NULL, sc_scroll, NORMAL, HALF_LEFT, NULL);
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_d, NULL, sc_scroll, NORMAL, HALF_DOWN, NULL);
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_u, NULL, sc_scroll, NORMAL, HALF_UP, NULL);
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_y, NULL, sc_scroll, NORMAL, HALF_RIGHT, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_t, NULL, sc_scroll, NORMAL, FULL_LEFT, NULL);
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_f, NULL, sc_scroll, NORMAL, FULL_DOWN, NULL);
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_b, NULL, sc_scroll, NORMAL, FULL_UP, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_y, NULL, sc_scroll, NORMAL, FULL_RIGHT, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_space, NULL, sc_scroll, NORMAL, FULL_DOWN, NULL);
girara_shortcut_add(gsession, GDK_SHIFT_MASK, GDK_KEY_space, NULL, sc_scroll, NORMAL, FULL_UP, NULL);
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_o, NULL, sc_jumplist, NORMAL, BACKWARD, NULL);
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_i, NULL, sc_jumplist, NORMAL, FORWARD, NULL);
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_j, NULL, sc_bisect, NORMAL, FORWARD, NULL);
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_k, NULL, sc_bisect, NORMAL, BACKWARD, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_n, NULL, sc_search, NORMAL, FORWARD, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_N, NULL, sc_search, NORMAL, BACKWARD, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_Tab, NULL, sc_toggle_index, NORMAL, 0, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_Tab, NULL, sc_toggle_index, INDEX, 0, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_F5, NULL, sc_toggle_fullscreen, NORMAL, 0, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_F5, NULL, sc_toggle_fullscreen, FULLSCREEN, 0, NULL);
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_n, NULL, girara_sc_toggle_statusbar, NORMAL, 0, NULL);
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_m, NULL, girara_sc_toggle_inputbar, NORMAL, 0, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_d, NULL, sc_toggle_page_mode, NORMAL, 0, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_q, NULL, sc_quit, NORMAL, 0, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_q, NULL, sc_quit, FULLSCREEN, 0, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_plus, NULL, sc_zoom, NORMAL, ZOOM_IN, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_KP_Add, NULL, sc_zoom, NORMAL, ZOOM_IN, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_plus, NULL, sc_zoom, FULLSCREEN, ZOOM_IN, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_KP_Add, NULL, sc_zoom, FULLSCREEN, ZOOM_IN, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_minus, NULL, sc_zoom, NORMAL, ZOOM_OUT, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_KP_Subtract,NULL, sc_zoom, NORMAL, ZOOM_OUT, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_minus, NULL, sc_zoom, FULLSCREEN, ZOOM_OUT, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_KP_Subtract,NULL, sc_zoom, FULLSCREEN, ZOOM_OUT, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_equal, NULL, sc_zoom, NORMAL, ZOOM_SPECIFIC, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_equal, NULL, sc_zoom, FULLSCREEN, ZOOM_SPECIFIC, NULL);
girara_shortcut_add(gsession, 0, 0, "zi", sc_zoom, NORMAL, ZOOM_IN, NULL);
girara_shortcut_add(gsession, 0, 0, "zi", sc_zoom, FULLSCREEN, ZOOM_IN, NULL);
girara_shortcut_add(gsession, 0, 0, "zI", sc_zoom, NORMAL, ZOOM_IN, NULL);
girara_shortcut_add(gsession, 0, 0, "zI", sc_zoom, FULLSCREEN, ZOOM_IN, NULL);
girara_shortcut_add(gsession, 0, 0, "zo", sc_zoom, NORMAL, ZOOM_OUT, NULL);
girara_shortcut_add(gsession, 0, 0, "zo", sc_zoom, FULLSCREEN, ZOOM_OUT, NULL);
girara_shortcut_add(gsession, 0, 0, "zO", sc_zoom, NORMAL, ZOOM_OUT, NULL);
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, 0, "zz", sc_zoom, NORMAL, ZOOM_SPECIFIC, NULL);
girara_shortcut_add(gsession, 0, 0, "zz", sc_zoom, FULLSCREEN, ZOOM_SPECIFIC, NULL);
girara_shortcut_add(gsession, 0, 0, "zZ", sc_zoom, NORMAL, ZOOM_SPECIFIC, NULL);
girara_shortcut_add(gsession, 0, 0, "zZ", sc_zoom, FULLSCREEN, ZOOM_SPECIFIC, NULL);
#define DEFAULT_SHORTCUTS(mode) \
girara_shortcut_add(gsession, 0, GDK_KEY_a, NULL, sc_adjust_window, (mode), ZATHURA_ADJUST_BESTFIT, NULL); \
girara_shortcut_add(gsession, 0, GDK_KEY_s, NULL, sc_adjust_window, (mode), ZATHURA_ADJUST_WIDTH, NULL); \
\
girara_shortcut_add(gsession, 0, GDK_KEY_F, NULL, sc_display_link, (mode), 0, NULL); \
\
girara_shortcut_add(gsession, 0, GDK_KEY_slash, NULL, sc_focus_inputbar, (mode), 0, &("/")); \
girara_shortcut_add(gsession, GDK_SHIFT_MASK, GDK_KEY_slash, NULL, sc_focus_inputbar, (mode), 0, &("/")); \
girara_shortcut_add(gsession, 0, GDK_KEY_question, NULL, sc_focus_inputbar, (mode), 0, &("?")); \
girara_shortcut_add(gsession, 0, GDK_KEY_colon, NULL, sc_focus_inputbar, (mode), 0, &(":")); \
girara_shortcut_add(gsession, 0, GDK_KEY_o, NULL, sc_focus_inputbar, (mode), 0, &(":open ")); \
girara_shortcut_add(gsession, 0, GDK_KEY_O, NULL, sc_focus_inputbar, (mode), APPEND_FILEPATH, &(":open ")); \
\
girara_shortcut_add(gsession, 0, GDK_KEY_f, NULL, sc_follow, (mode), 0, NULL); \
\
girara_shortcut_add(gsession, 0, 0, "gg", sc_goto, (mode), TOP, NULL); \
girara_shortcut_add(gsession, 0, 0, "G", sc_goto, (mode), BOTTOM, NULL); \
\
girara_shortcut_add(gsession, 0, GDK_KEY_m, NULL, sc_mark_add, (mode), 0, NULL); \
girara_shortcut_add(gsession, 0, GDK_KEY_apostrophe, NULL, sc_mark_evaluate, (mode), 0, NULL); \
\
girara_shortcut_add(gsession, 0, GDK_KEY_J, NULL, sc_navigate, (mode), NEXT, NULL); \
girara_shortcut_add(gsession, 0, GDK_KEY_K, NULL, sc_navigate, (mode), PREVIOUS, NULL); \
girara_shortcut_add(gsession, GDK_MOD1_MASK, GDK_KEY_Right, NULL, sc_navigate, (mode), NEXT, NULL); \
girara_shortcut_add(gsession, GDK_MOD1_MASK, GDK_KEY_Left, NULL, sc_navigate, (mode), PREVIOUS, NULL); \
girara_shortcut_add(gsession, 0, GDK_KEY_Page_Down, NULL, sc_navigate, (mode), NEXT, NULL); \
girara_shortcut_add(gsession, 0, GDK_KEY_Page_Up, NULL, sc_navigate, (mode), PREVIOUS, NULL); \
\
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_p, NULL, sc_print, (mode), 0, NULL); \
\
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_r, NULL, sc_recolor, (mode), 0, NULL); \
\
girara_shortcut_add(gsession, 0, GDK_KEY_R, NULL, sc_reload, (mode), 0, NULL); \
\
girara_shortcut_add(gsession, 0, GDK_KEY_r, NULL, sc_rotate, (mode), ROTATE_CW, NULL); \
\
girara_shortcut_add(gsession, 0, GDK_KEY_h, NULL, sc_scroll, (mode), LEFT, NULL); \
girara_shortcut_add(gsession, 0, GDK_KEY_j, NULL, sc_scroll, (mode), DOWN, NULL); \
girara_shortcut_add(gsession, 0, GDK_KEY_k, NULL, sc_scroll, (mode), UP, NULL); \
girara_shortcut_add(gsession, 0, GDK_KEY_l, NULL, sc_scroll, (mode), RIGHT, NULL); \
girara_shortcut_add(gsession, 0, GDK_KEY_Left, NULL, sc_scroll, (mode), LEFT, NULL); \
girara_shortcut_add(gsession, 0, GDK_KEY_Up, NULL, sc_scroll, (mode), UP, NULL); \
girara_shortcut_add(gsession, 0, GDK_KEY_Down, NULL, sc_scroll, (mode), DOWN, NULL); \
girara_shortcut_add(gsession, 0, GDK_KEY_H, NULL, sc_scroll, (mode), PAGE_TOP, NULL); \
girara_shortcut_add(gsession, 0, GDK_KEY_L, NULL, sc_scroll, (mode), PAGE_BOTTOM, NULL); \
girara_shortcut_add(gsession, 0, GDK_KEY_Right, NULL, sc_scroll, (mode), RIGHT, NULL); \
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_t, NULL, sc_scroll, (mode), HALF_LEFT, NULL); \
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_d, NULL, sc_scroll, (mode), HALF_DOWN, NULL); \
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_u, NULL, sc_scroll, (mode), HALF_UP, NULL); \
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_y, NULL, sc_scroll, (mode), HALF_RIGHT, NULL); \
girara_shortcut_add(gsession, 0, GDK_KEY_t, NULL, sc_scroll, (mode), FULL_LEFT, NULL); \
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_f, NULL, sc_scroll, (mode), FULL_DOWN, NULL); \
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_b, NULL, sc_scroll, (mode), FULL_UP, NULL); \
girara_shortcut_add(gsession, 0, GDK_KEY_y, NULL, sc_scroll, (mode), FULL_RIGHT, NULL); \
girara_shortcut_add(gsession, 0, GDK_KEY_space, NULL, sc_scroll, (mode), FULL_DOWN, NULL); \
girara_shortcut_add(gsession, GDK_SHIFT_MASK, GDK_KEY_space, NULL, sc_scroll, (mode), FULL_UP, NULL); \
\
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_o, NULL, sc_jumplist, (mode), BACKWARD, NULL); \
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_i, NULL, sc_jumplist, (mode), FORWARD, NULL); \
\
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_j, NULL, sc_bisect, (mode), FORWARD, NULL); \
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_k, NULL, sc_bisect, (mode), BACKWARD, NULL); \
\
girara_shortcut_add(gsession, 0, GDK_KEY_n, NULL, sc_search, (mode), FORWARD, NULL); \
girara_shortcut_add(gsession, 0, GDK_KEY_N, NULL, sc_search, (mode), BACKWARD, NULL); \
\
girara_shortcut_add(gsession, 0, GDK_KEY_Tab, NULL, sc_toggle_index, (mode), 0, NULL); \
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_n, NULL, girara_sc_toggle_statusbar, (mode), 0, NULL); \
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_m, NULL, girara_sc_toggle_inputbar, (mode), 0, NULL); \
girara_shortcut_add(gsession, 0, GDK_KEY_d, NULL, sc_toggle_page_mode, (mode), 0, NULL); \
\
girara_shortcut_add(gsession, 0, GDK_KEY_q, NULL, sc_quit, (mode), 0, NULL); \
\
girara_shortcut_add(gsession, 0, GDK_KEY_plus, NULL, sc_zoom, (mode), ZOOM_IN, NULL); \
girara_shortcut_add(gsession, 0, GDK_KEY_KP_Add, NULL, sc_zoom, (mode), ZOOM_IN, NULL); \
girara_shortcut_add(gsession, 0, GDK_KEY_minus, NULL, sc_zoom, (mode), ZOOM_OUT, NULL); \
girara_shortcut_add(gsession, 0, GDK_KEY_KP_Subtract,NULL, sc_zoom, (mode), ZOOM_OUT, NULL); \
girara_shortcut_add(gsession, 0, GDK_KEY_equal, NULL, sc_zoom, (mode), ZOOM_SPECIFIC, NULL); \
girara_shortcut_add(gsession, 0, 0, "zi", sc_zoom, (mode), ZOOM_IN, NULL); \
girara_shortcut_add(gsession, 0, 0, "zI", sc_zoom, (mode), ZOOM_IN, NULL); \
girara_shortcut_add(gsession, 0, 0, "zo", sc_zoom, (mode), ZOOM_OUT, NULL); \
girara_shortcut_add(gsession, 0, 0, "zO", sc_zoom, (mode), ZOOM_OUT, NULL); \
girara_shortcut_add(gsession, 0, 0, "z0", sc_zoom, (mode), ZOOM_ORIGINAL, NULL); \
girara_shortcut_add(gsession, 0, 0, "zz", sc_zoom, (mode), ZOOM_SPECIFIC, NULL); \
girara_shortcut_add(gsession, 0, 0, "zZ", sc_zoom, (mode), ZOOM_SPECIFIC, NULL);
#define DEFAULT_MOUSE_EVENTS(mode) \
girara_mouse_event_add(gsession, 0, 0, sc_mouse_scroll, (mode), GIRARA_EVENT_SCROLL_UP, UP, NULL); \
girara_mouse_event_add(gsession, 0, 0, sc_mouse_scroll, (mode), GIRARA_EVENT_SCROLL_DOWN, DOWN, NULL); \
girara_mouse_event_add(gsession, 0, 0, sc_mouse_scroll, (mode), GIRARA_EVENT_SCROLL_LEFT, LEFT, NULL); \
girara_mouse_event_add(gsession, 0, 0, sc_mouse_scroll, (mode), GIRARA_EVENT_SCROLL_RIGHT, RIGHT, NULL); \
\
girara_mouse_event_add(gsession, GDK_SHIFT_MASK, 0, sc_mouse_scroll, (mode), GIRARA_EVENT_SCROLL_UP, LEFT, NULL); \
girara_mouse_event_add(gsession, GDK_SHIFT_MASK, 0, sc_mouse_scroll, (mode), GIRARA_EVENT_SCROLL_DOWN, RIGHT, NULL); \
\
girara_mouse_event_add(gsession, GDK_CONTROL_MASK, 0, sc_mouse_zoom, (mode), GIRARA_EVENT_SCROLL_UP, UP, NULL); \
girara_mouse_event_add(gsession, GDK_CONTROL_MASK, 0, sc_mouse_zoom, (mode), GIRARA_EVENT_SCROLL_DOWN, DOWN, NULL); \
girara_mouse_event_add(gsession, 0, GIRARA_MOUSE_BUTTON2, sc_mouse_scroll, (mode), GIRARA_EVENT_BUTTON_PRESS, 0, NULL); \
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 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);
girara_shortcut_add(gsession, 0, GDK_KEY_F11, NULL, sc_toggle_fullscreen, NORMAL, 0, NULL);
DEFAULT_SHORTCUTS(NORMAL)
/* Normal mode - Mouse events */
DEFAULT_MOUSE_EVENTS(NORMAL)
/* Fullscreen mode */
girara_shortcut_add(gsession, 0, GDK_KEY_F11, NULL, sc_toggle_fullscreen, FULLSCREEN, 0, NULL);
DEFAULT_SHORTCUTS(FULLSCREEN)
/* Fullscreen mode - Mouse events */
DEFAULT_MOUSE_EVENTS(FULLSCREEN)
/* Index mode */
girara_shortcut_add(gsession, 0, GDK_KEY_Tab, NULL, sc_toggle_index, INDEX, 0, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_k, NULL, sc_navigate_index, INDEX, UP, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_j, NULL, sc_navigate_index, INDEX, DOWN, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_h, NULL, sc_navigate_index, INDEX, COLLAPSE, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_l, NULL, sc_navigate_index, INDEX, EXPAND, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_L, NULL, sc_navigate_index, INDEX, EXPAND_ALL, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_H, NULL, sc_navigate_index, INDEX, COLLAPSE_ALL, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_Up, NULL, sc_navigate_index, INDEX, UP, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_Down, NULL, sc_navigate_index, INDEX, DOWN, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_Left, NULL, sc_navigate_index, INDEX, COLLAPSE, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_Right, NULL, sc_navigate_index, INDEX, EXPAND, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_space, NULL, sc_navigate_index, INDEX, SELECT, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_Return, NULL, sc_navigate_index, INDEX, SELECT, NULL);
girara_shortcut_add(gsession, 0, 0, "gg", sc_navigate_index, INDEX, TOP, NULL);
girara_shortcut_add(gsession, 0, 0, "G", sc_navigate_index, INDEX, BOTTOM, NULL);
/* Presentation mode */
girara_shortcut_add(gsession, 0, GDK_KEY_J, NULL, sc_navigate, PRESENTATION, NEXT, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_Down, NULL, sc_navigate, PRESENTATION, NEXT, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_Right, NULL, sc_navigate, PRESENTATION, NEXT, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_Page_Down, NULL, sc_navigate, PRESENTATION, NEXT, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_space, NULL, sc_navigate, PRESENTATION, NEXT, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_K, NULL, sc_navigate, PRESENTATION, PREVIOUS, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_Left, NULL, sc_navigate, PRESENTATION, PREVIOUS, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_Up, NULL, sc_navigate, PRESENTATION, PREVIOUS, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_Page_Up, NULL, sc_navigate, PRESENTATION, PREVIOUS, NULL);
girara_shortcut_add(gsession, GDK_SHIFT_MASK, GDK_KEY_space, NULL, sc_navigate, PRESENTATION, PREVIOUS, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_BackSpace, NULL, sc_navigate, PRESENTATION, PREVIOUS, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_F5, NULL, sc_toggle_presentation, PRESENTATION, 0, NULL);
girara_shortcut_add(gsession, 0, GDK_KEY_q, NULL, sc_quit, PRESENTATION, 0, NULL);
/* Presentation mode - Mouse events */
girara_mouse_event_add(gsession, 0, 0, sc_mouse_scroll, PRESENTATION, GIRARA_EVENT_SCROLL_UP, UP, NULL);
girara_mouse_event_add(gsession, 0, 0, sc_mouse_scroll, PRESENTATION, GIRARA_EVENT_SCROLL_DOWN, DOWN, NULL);
girara_mouse_event_add(gsession, 0, 0, sc_mouse_scroll, PRESENTATION, GIRARA_EVENT_SCROLL_LEFT, LEFT, NULL);
girara_mouse_event_add(gsession, 0, 0, sc_mouse_scroll, PRESENTATION, GIRARA_EVENT_SCROLL_RIGHT, RIGHT, NULL);
girara_mouse_event_add(gsession, 0, GIRARA_MOUSE_BUTTON1, sc_navigate, PRESENTATION, GIRARA_EVENT_BUTTON_PRESS, NEXT, NULL);
girara_mouse_event_add(gsession, 0, GIRARA_MOUSE_BUTTON3, sc_navigate, PRESENTATION, GIRARA_EVENT_BUTTON_PRESS, PREVIOUS, NULL);
girara_mouse_event_add(gsession, GDK_SHIFT_MASK, 0, sc_mouse_scroll, PRESENTATION, GIRARA_EVENT_SCROLL_UP, LEFT, NULL);
girara_mouse_event_add(gsession, GDK_SHIFT_MASK, 0, sc_mouse_scroll, PRESENTATION, GIRARA_EVENT_SCROLL_DOWN, RIGHT, NULL);
girara_mouse_event_add(gsession, GDK_CONTROL_MASK, 0, sc_mouse_zoom, PRESENTATION, GIRARA_EVENT_SCROLL_UP, UP, NULL);
girara_mouse_event_add(gsession, GDK_CONTROL_MASK, 0, sc_mouse_zoom, PRESENTATION, GIRARA_EVENT_SCROLL_DOWN, DOWN, NULL);
/* inputbar shortcuts */
girara_inputbar_shortcut_add(gsession, 0, GDK_KEY_Escape, sc_abort, 0, NULL);
girara_inputbar_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_c, sc_abort, 0, NULL);
/* mouse events */
girara_mouse_event_add(gsession, 0, 0, sc_mouse_scroll, NORMAL, GIRARA_EVENT_SCROLL_UP, UP, NULL);
girara_mouse_event_add(gsession, 0, 0, sc_mouse_scroll, FULLSCREEN, GIRARA_EVENT_SCROLL_UP, UP, NULL);
girara_mouse_event_add(gsession, 0, 0, sc_mouse_scroll, NORMAL, GIRARA_EVENT_SCROLL_DOWN, DOWN, NULL);
girara_mouse_event_add(gsession, 0, 0, sc_mouse_scroll, FULLSCREEN, GIRARA_EVENT_SCROLL_DOWN, DOWN, NULL);
girara_mouse_event_add(gsession, 0, 0, sc_mouse_scroll, NORMAL, GIRARA_EVENT_SCROLL_LEFT, LEFT, NULL);
girara_mouse_event_add(gsession, 0, 0, sc_mouse_scroll, FULLSCREEN, GIRARA_EVENT_SCROLL_LEFT, LEFT, NULL);
girara_mouse_event_add(gsession, 0, 0, sc_mouse_scroll, NORMAL, GIRARA_EVENT_SCROLL_RIGHT, RIGHT, NULL);
girara_mouse_event_add(gsession, 0, 0, sc_mouse_scroll, FULLSCREEN, GIRARA_EVENT_SCROLL_RIGHT, RIGHT, NULL);
girara_mouse_event_add(gsession, 0, GIRARA_MOUSE_BUTTON1, sc_navigate, FULLSCREEN, GIRARA_EVENT_BUTTON_PRESS, NEXT, NULL);
girara_mouse_event_add(gsession, 0, GIRARA_MOUSE_BUTTON3, sc_navigate, FULLSCREEN, GIRARA_EVENT_BUTTON_PRESS, PREVIOUS, NULL);
girara_mouse_event_add(gsession, GDK_SHIFT_MASK, 0, sc_mouse_scroll, NORMAL, GIRARA_EVENT_SCROLL_UP, LEFT, NULL);