Set fullscreen mode and custom button press events

This commit is contained in:
Moritz Lipp 2012-10-05 00:41:05 +02:00
parent 07fbbd514a
commit b24ae033ad
3 changed files with 28 additions and 15 deletions

View file

@ -321,23 +321,26 @@ config_load_default(zathura_t* zathura)
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_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, GDK_SHIFT_MASK, 0, sc_mouse_scroll, NORMAL, GIRARA_EVENT_SCROLL_UP, LEFT, NULL);
girara_mouse_event_add(gsession, GDK_SHIFT_MASK, 0, sc_mouse_scroll, FULLSCREEN, GIRARA_EVENT_SCROLL_UP, LEFT, NULL);
girara_mouse_event_add(gsession, GDK_SHIFT_MASK, 0, sc_mouse_scroll, NORMAL, GIRARA_EVENT_SCROLL_DOWN, RIGHT, NULL);
girara_mouse_event_add(gsession, GDK_SHIFT_MASK, 0, sc_mouse_scroll, FULLSCREEN, GIRARA_EVENT_SCROLL_DOWN, 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_CONTROL_MASK, 0, sc_mouse_zoom, NORMAL, GIRARA_EVENT_SCROLL_UP, UP, NULL);
girara_mouse_event_add(gsession, GDK_CONTROL_MASK, 0, sc_mouse_zoom, FULLSCREEN, GIRARA_EVENT_SCROLL_UP, UP, NULL);
girara_mouse_event_add(gsession, GDK_CONTROL_MASK, 0, sc_mouse_zoom, NORMAL, GIRARA_EVENT_SCROLL_DOWN, DOWN, NULL);
girara_mouse_event_add(gsession, GDK_CONTROL_MASK, 0, sc_mouse_zoom, FULLSCREEN, GIRARA_EVENT_SCROLL_DOWN, DOWN, NULL);
girara_mouse_event_add(gsession, 0, GIRARA_MOUSE_BUTTON2, sc_mouse_scroll, NORMAL, GIRARA_EVENT_BUTTON_PRESS, 0, NULL);
girara_mouse_event_add(gsession, GDK_BUTTON2_MASK, GIRARA_MOUSE_BUTTON2, sc_mouse_scroll, NORMAL, GIRARA_EVENT_BUTTON_RELEASE, 0, NULL);
girara_mouse_event_add(gsession, GDK_BUTTON2_MASK, 0, sc_mouse_scroll, NORMAL, GIRARA_EVENT_MOTION_NOTIFY, 0, NULL);
girara_mouse_event_add(gsession, GDK_SHIFT_MASK, 0, sc_mouse_scroll, NORMAL, GIRARA_EVENT_SCROLL_UP, LEFT, NULL);
girara_mouse_event_add(gsession, GDK_SHIFT_MASK, 0, sc_mouse_scroll, FULLSCREEN, GIRARA_EVENT_SCROLL_UP, LEFT, NULL);
girara_mouse_event_add(gsession, GDK_SHIFT_MASK, 0, sc_mouse_scroll, NORMAL, GIRARA_EVENT_SCROLL_DOWN, RIGHT, NULL);
girara_mouse_event_add(gsession, GDK_SHIFT_MASK, 0, sc_mouse_scroll, FULLSCREEN, GIRARA_EVENT_SCROLL_DOWN, RIGHT, NULL);
girara_mouse_event_add(gsession, GDK_CONTROL_MASK, 0, sc_mouse_zoom, NORMAL, GIRARA_EVENT_SCROLL_UP, UP, NULL);
girara_mouse_event_add(gsession, GDK_CONTROL_MASK, 0, sc_mouse_zoom, FULLSCREEN, GIRARA_EVENT_SCROLL_UP, UP, NULL);
girara_mouse_event_add(gsession, GDK_CONTROL_MASK, 0, sc_mouse_zoom, NORMAL, GIRARA_EVENT_SCROLL_DOWN, DOWN, NULL);
girara_mouse_event_add(gsession, GDK_CONTROL_MASK, 0, sc_mouse_zoom, FULLSCREEN, GIRARA_EVENT_SCROLL_DOWN, DOWN, NULL);
girara_mouse_event_add(gsession, 0, GIRARA_MOUSE_BUTTON2, sc_mouse_scroll, NORMAL, GIRARA_EVENT_BUTTON_PRESS, 0, NULL);
girara_mouse_event_add(gsession, GDK_BUTTON2_MASK, GIRARA_MOUSE_BUTTON2, sc_mouse_scroll, NORMAL, GIRARA_EVENT_BUTTON_RELEASE, 0, NULL);
girara_mouse_event_add(gsession, GDK_BUTTON2_MASK, 0, sc_mouse_scroll, NORMAL, GIRARA_EVENT_MOTION_NOTIFY, 0, NULL);
/* define default inputbar commands */
girara_inputbar_command_add(gsession, "bmark", NULL, cmd_bookmark_create, NULL, _("Add a bookmark"));

View file

@ -550,6 +550,10 @@ cb_zathura_page_widget_button_press_event(GtkWidget* widget, GdkEventButton* but
zathura_page_widget_private_t* priv = ZATHURA_PAGE_GET_PRIVATE(widget);
if (girara_callback_view_button_press_event(widget, button, priv->zathura->ui.session) == true) {
return true;
}
if (button->button == 1) { /* left click */
if (button->type == GDK_BUTTON_PRESS) {
/* start the selection */

View file

@ -1043,6 +1043,9 @@ sc_toggle_fullscreen(girara_session_t* session, girara_argument_t*
zathura_document_set_scale(zathura->document, zoom);
render_all(zathura);
page_set_delayed(zathura, zathura_document_get_current_page_number(zathura->document));
/* setm ode */
girara_mode_set(session, zathura->modes.normal);
} else {
/* backup pages per row */
girara_setting_get(session, "pages-per-row", &pages_per_row);
@ -1068,6 +1071,9 @@ sc_toggle_fullscreen(girara_session_t* session, girara_argument_t*
/* set full screen */
gtk_window_fullscreen(GTK_WINDOW(session->gtk.window));
page_set_delayed(zathura, zathura_document_get_current_page_number(zathura->document));
/* setm ode */
girara_mode_set(session, zathura->modes.fullscreen);
}
fullscreen = fullscreen ? false : true;