From b815fa6ecf6a1861c777ab44dbabcb75b6daf727 Mon Sep 17 00:00:00 2001 From: Moritz Lipp Date: Wed, 15 Feb 2012 00:21:51 +0100 Subject: [PATCH] Update to new girara event definitions --- config.c | 12 ++++++++---- shortcuts.c | 51 +++++++++++++++++++++------------------------------ 2 files changed, 29 insertions(+), 34 deletions(-) diff --git a/config.c b/config.c index faebe21..94eeb88 100644 --- a/config.c +++ b/config.c @@ -169,10 +169,14 @@ config_load_default(zathura_t* zathura) girara_shortcut_add(gsession, 0, GDK_KEY_equal, NULL, sc_zoom, FULLSCREEN, ZOOM_SPECIFIC, NULL); /* mouse events */ - girara_mouse_event_add(gsession, 0, 0, sc_mouse_scroll, NORMAL, GIRARA_EVENT_SCROLL, 0, NULL); - girara_mouse_event_add(gsession, 0, 0, sc_mouse_scroll, FULLSCREEN, GIRARA_EVENT_SCROLL, 0, NULL); - girara_mouse_event_add(gsession, GDK_CONTROL_MASK, 0, sc_mouse_zoom, NORMAL, GIRARA_EVENT_SCROLL, 0, NULL); - girara_mouse_event_add(gsession, GDK_CONTROL_MASK, 0, sc_mouse_zoom, FULLSCREEN, GIRARA_EVENT_SCROLL, 0, NULL); + girara_mouse_event_add(gsession, 0, 0, sc_mouse_scroll, NORMAL, GIRARA_EVENT_SCROLL_UP, 0, NULL); + girara_mouse_event_add(gsession, 0, 0, sc_mouse_scroll, FULLSCREEN, GIRARA_EVENT_SCROLL_UP, 0, NULL); + girara_mouse_event_add(gsession, 0, 0, sc_mouse_scroll, NORMAL, GIRARA_EVENT_SCROLL_DOWN, 0, NULL); + girara_mouse_event_add(gsession, 0, 0, sc_mouse_scroll, FULLSCREEN, GIRARA_EVENT_SCROLL_DOWN, 0, NULL); + girara_mouse_event_add(gsession, GDK_CONTROL_MASK, 0, sc_mouse_zoom, NORMAL, GIRARA_EVENT_SCROLL_UP, 0, NULL); + girara_mouse_event_add(gsession, GDK_CONTROL_MASK, 0, sc_mouse_zoom, FULLSCREEN, GIRARA_EVENT_SCROLL_UP, 0, NULL); + girara_mouse_event_add(gsession, GDK_CONTROL_MASK, 0, sc_mouse_zoom, NORMAL, GIRARA_EVENT_SCROLL_DOWN, 0, NULL); + girara_mouse_event_add(gsession, GDK_CONTROL_MASK, 0, sc_mouse_zoom, FULLSCREEN, GIRARA_EVENT_SCROLL_DOWN, 0, 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); diff --git a/shortcuts.c b/shortcuts.c index 9a345f3..a97f297 100644 --- a/shortcuts.c +++ b/shortcuts.c @@ -200,22 +200,17 @@ sc_mouse_scroll(girara_session_t* session, girara_argument_t* argument, girara_e } /* scroll event */ - if (event->type == GIRARA_EVENT_SCROLL) { - switch (event->direction) { - case GIRARA_SCROLL_UP: - argument->n = UP; - break; - case GIRARA_SCROLL_DOWN: - argument->n = DOWN; - break; - case GIRARA_SCROLL_LEFT: - argument->n = LEFT; - break; - case GIRARA_SCROLL_RIGHT: - argument->n = RIGHT; - break; - } - + if (event->type == GIRARA_EVENT_SCROLL_UP) { + argument->n = UP; + return sc_scroll(session, argument, NULL, t); + } else if (event->type == GIRARA_EVENT_SCROLL_DOWN) { + argument->n = DOWN; + return sc_scroll(session, argument, NULL, t); + } else if (event->type == GIRARA_EVENT_SCROLL_LEFT) { + argument->n = LEFT; + return sc_scroll(session, argument, NULL, t); + } else if (event->type == GIRARA_EVENT_SCROLL_RIGHT) { + argument->n = RIGHT; return sc_scroll(session, argument, NULL, t); } else if (event->type == GIRARA_EVENT_BUTTON_PRESS) { x = event->x; @@ -257,22 +252,18 @@ sc_mouse_zoom(girara_session_t* session, girara_argument_t* argument, girara_eve } /* scroll event */ - if (event->type == GIRARA_EVENT_SCROLL) { - switch (event->direction) { - case GIRARA_SCROLL_UP: - argument->n = ZOOM_IN; - break; - case GIRARA_SCROLL_DOWN: - argument->n = ZOOM_OUT; - break; - default: - return false; - } - - return sc_zoom(session, argument, NULL, t); + switch (event->type) { + case GIRARA_EVENT_SCROLL_UP: + argument->n = ZOOM_IN; + break; + case GIRARA_EVENT_SCROLL_DOWN: + argument->n = ZOOM_OUT; + break; + default: + return false; } - return false; + return sc_zoom(session, argument, NULL, t); } bool