mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-12-29 12:55:59 +01:00
Implemented sc_mouse_scroll
This commit is contained in:
parent
1c0920a190
commit
0363495151
3 changed files with 51 additions and 0 deletions
4
config.c
4
config.c
|
@ -133,6 +133,10 @@ config_load_default(zathura_t* zathura)
|
|||
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);
|
||||
|
||||
/* mouse events */
|
||||
girara_mouse_event_add(gsession, 0, 0, sc_mouse_scroll, NORMAL, 0, NULL);
|
||||
girara_mouse_event_add(gsession, 0, 0, sc_mouse_scroll, FULLSCREEN, 0, NULL);
|
||||
|
||||
/* define default inputbar commands */
|
||||
girara_inputbar_command_add(gsession, "bmark", NULL, cmd_bookmark_create, NULL, "Add a bookmark");
|
||||
girara_inputbar_command_add(gsession, "bdelete", NULL, cmd_bookmark_delete, cc_bookmarks, "Delete a bookmark");
|
||||
|
|
36
shortcuts.c
36
shortcuts.c
|
@ -170,6 +170,42 @@ sc_goto(girara_session_t* session, girara_argument_t* argument, girara_event_t*
|
|||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
sc_mouse_scroll(girara_session_t* session, girara_argument_t* argument, girara_event_t* event, unsigned int t)
|
||||
{
|
||||
g_return_val_if_fail(session != NULL, false);
|
||||
g_return_val_if_fail(session->global.data != NULL, false);
|
||||
zathura_t* zathura = session->global.data;
|
||||
g_return_val_if_fail(argument != NULL, false);
|
||||
g_return_val_if_fail(event != NULL, false);
|
||||
|
||||
if (zathura->document == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
return sc_scroll(session, argument, NULL, t);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
sc_navigate(girara_session_t* session, girara_argument_t* argument,
|
||||
girara_event_t* UNUSED(event), unsigned int t)
|
||||
|
|
11
shortcuts.h
11
shortcuts.h
|
@ -60,6 +60,17 @@ bool sc_follow(girara_session_t* session, girara_argument_t* argument, girara_ev
|
|||
*/
|
||||
bool sc_goto(girara_session_t* session, girara_argument_t* argument, girara_event_t* event, unsigned int t);
|
||||
|
||||
/**
|
||||
* Handle mouse events
|
||||
*
|
||||
* @param session The used girara session
|
||||
* @param argument The used argument
|
||||
* @param event Girara event
|
||||
* @param t Number of executions
|
||||
* @return true if no error occured otherwise false
|
||||
*/
|
||||
bool sc_mouse_scroll(girara_session_t* session, girara_argument_t* argument, girara_event_t* event, unsigned int t);
|
||||
|
||||
/**
|
||||
* Navigate through the document
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue