diff options
author | Přemysl Eric Janouch <p@janouch.name> | 2021-11-13 10:04:40 +0100 |
---|---|---|
committer | Přemysl Eric Janouch <p@janouch.name> | 2021-11-13 10:05:05 +0100 |
commit | b8cc43eb914a1d66b94dc917f27d9609266d4a01 (patch) | |
tree | 65a2f3c33bdbdc551d7be5e08c54f54c9a500de4 | |
parent | a1db89d91cb7498c962a9183eebf2e1d3070ca62 (diff) | |
download | fiv-b8cc43eb914a1d66b94dc917f27d9609266d4a01.tar.gz fiv-b8cc43eb914a1d66b94dc917f27d9609266d4a01.tar.xz fiv-b8cc43eb914a1d66b94dc917f27d9609266d4a01.zip |
Bind the mouse back button on the view
-rw-r--r-- | fastiv-view.c | 2 | ||||
-rw-r--r-- | fastiv.c | 13 |
2 files changed, 14 insertions, 1 deletions
diff --git a/fastiv-view.c b/fastiv-view.c index a8b879e..b7dda61 100644 --- a/fastiv-view.c +++ b/fastiv-view.c @@ -100,7 +100,7 @@ fastiv_view_realize(GtkWidget *widget) // than what we get automatically. .visual = gtk_widget_get_visual(widget), .event_mask = gtk_widget_get_events(widget) | GDK_SCROLL_MASK | - GDK_KEY_PRESS_MASK, + GDK_KEY_PRESS_MASK | GDK_BUTTON_PRESS_MASK, }; // We need this window to receive input events at all. @@ -317,6 +317,17 @@ on_key_press_view(G_GNUC_UNUSED GtkWidget *widget, GdkEventKey *event, return FALSE; } +static gboolean +on_button_press_view(G_GNUC_UNUSED GtkWidget *widget, GdkEventButton *event) +{ + if (!(event->state & gtk_accelerator_get_default_mod_mask()) && + event->button == 8 /* back */) { + gtk_stack_set_visible_child(GTK_STACK(g.stack), g.browser_scroller); + return TRUE; + } + return FALSE; +} + int main(int argc, char *argv[]) { @@ -377,6 +388,8 @@ main(int argc, char *argv[]) gtk_widget_set_hexpand(g.view, TRUE); g_signal_connect(g.view, "key-press-event", G_CALLBACK(on_key_press_view), NULL); + g_signal_connect(g.view, "button-press-event", + G_CALLBACK(on_button_press_view), NULL); gtk_container_add(GTK_CONTAINER(g.view_scroller), g.view); gtk_widget_show_all(g.view_scroller); |