mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-12-27 14:06:00 +01:00
Implemented scrolling
This commit is contained in:
parent
6b852bec6d
commit
742c9770a2
2 changed files with 28 additions and 1 deletions
|
@ -120,6 +120,15 @@ InputbarShortcut inputbar_shortcuts[] = {
|
|||
{GDK_CONTROL_MASK, GDK_w, isc_string_manipulation, { DELETE_LAST_WORD } },
|
||||
};
|
||||
|
||||
/* mouse settings */
|
||||
MouseScrollEvent mouse_scroll_events[] = {
|
||||
/* direction, function, argument */
|
||||
{GDK_SCROLL_LEFT, sc_scroll, { LEFT } },
|
||||
{GDK_SCROLL_UP, sc_scroll, { UP } },
|
||||
{GDK_SCROLL_DOWN, sc_scroll, { DOWN } },
|
||||
{GDK_SCROLL_RIGHT, sc_scroll, { RIGHT } },
|
||||
};
|
||||
|
||||
/* commands */
|
||||
Command commands[] = {
|
||||
/* command, abbreviation, function, completion, description */
|
||||
|
|
18
zathura.c
18
zathura.c
|
@ -86,6 +86,13 @@ typedef struct
|
|||
Argument argument;
|
||||
} InputbarShortcut;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int direction;
|
||||
void (*function)(Argument*);
|
||||
Argument argument;
|
||||
} MouseScrollEvent;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char* command;
|
||||
|
@ -1334,6 +1341,7 @@ sc_adjust_window(Argument* argument)
|
|||
Zathura.PDF.scale = (view_size / page_width) * 100;
|
||||
|
||||
draw(Zathura.PDF.page_number);
|
||||
update_status();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -3317,8 +3325,18 @@ cb_view_button_pressed(GtkWidget* widget, GdkEventButton* event, gpointer data)
|
|||
gboolean
|
||||
cb_view_scrolled(GtkWidget* widget, GdkEventScroll* event, gpointer data)
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < LENGTH(mouse_scroll_events); i++)
|
||||
{
|
||||
if(event->direction == mouse_scroll_events[i].direction)
|
||||
{
|
||||
mouse_scroll_events[i].function(&(mouse_scroll_events[i].argument));
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* main function */
|
||||
int main(int argc, char* argv[])
|
||||
|
|
Loading…
Reference in a new issue