diff options
author | Přemysl Eric Janouch <p@janouch.name> | 2021-10-20 09:15:06 +0200 |
---|---|---|
committer | Přemysl Eric Janouch <p@janouch.name> | 2021-10-20 09:15:06 +0200 |
commit | 82accaf200ab3a2cbf5a9112628a8f6eac27b1c8 (patch) | |
tree | 6efc02aaa0a8f5a1d26a5fcc2ec0a9e7204021f6 /src/sdgui.c | |
parent | e461189f0e67f237d7bfb8280b58a6881cf914d0 (diff) | |
download | tdv-82accaf200ab3a2cbf5a9112628a8f6eac27b1c8.tar.gz tdv-82accaf200ab3a2cbf5a9112628a8f6eac27b1c8.tar.xz tdv-82accaf200ab3a2cbf5a9112628a8f6eac27b1c8.zip |
sdgui: make Page Up/Down scroll the view
Diffstat (limited to 'src/sdgui.c')
-rw-r--r-- | src/sdgui.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/sdgui.c b/src/sdgui.c index 3c16acc..d126d20 100644 --- a/src/sdgui.c +++ b/src/sdgui.c @@ -216,6 +216,20 @@ on_key_press (G_GNUC_UNUSED GtkWidget *widget, GdkEvent *event, return TRUE; } } + if (mods == 0) + { + StardictView *view = STARDICT_VIEW (g.view); + if (event->key.keyval == GDK_KEY_Page_Up) + { + stardict_view_scroll (view, GTK_SCROLL_PAGES, -0.5); + return TRUE; + } + if (event->key.keyval == GDK_KEY_Page_Down) + { + stardict_view_scroll (view, GTK_SCROLL_PAGES, +0.5); + return TRUE; + } + } return FALSE; } @@ -341,8 +355,6 @@ main (int argc, char *argv[]) // TODO: make the entry have a background colour, rather than transparency gtk_entry_set_has_frame (GTK_ENTRY (g.entry), FALSE); - // TODO: supposedly attach to "key-press-event" here and react to - // PageUp/PageDown and up/down arrow keys... either here or in the Entry g.window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_default_size (GTK_WINDOW (g.window), 300, 600); g_signal_connect (g.window, "destroy", |