aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2021-11-18 12:43:08 +0100
committerPřemysl Eric Janouch <p@janouch.name>2021-11-18 12:46:04 +0100
commit47293cfc10c9d752a77c5d1a22319fdea15f1271 (patch)
tree180342592080aa234d7af1a84cf59ad3c0096d2a
parentd7a25ad89452f1b2f80ec3b707061307dda0b1be (diff)
downloadfiv-47293cfc10c9d752a77c5d1a22319fdea15f1271.tar.gz
fiv-47293cfc10c9d752a77c5d1a22319fdea15f1271.tar.xz
fiv-47293cfc10c9d752a77c5d1a22319fdea15f1271.zip
Make the forward mouse button go back to the view
For symmetry.
-rw-r--r--fastiv.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/fastiv.c b/fastiv.c
index 6433508..7162a53 100644
--- a/fastiv.c
+++ b/fastiv.c
@@ -368,12 +368,29 @@ on_key_press_view(G_GNUC_UNUSED GtkWidget *widget, GdkEventKey *event,
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 */) {
+ if ((event->state & gtk_accelerator_get_default_mod_mask()))
+ return FALSE;
+ switch (event->button) {
+ case 8: // back
gtk_stack_set_visible_child(GTK_STACK(g.stack), g.browser_paned);
return TRUE;
+ default:
+ return FALSE;
+ }
+}
+
+static gboolean
+on_button_press_browser(G_GNUC_UNUSED GtkWidget *widget, GdkEventButton *event)
+{
+ if ((event->state & gtk_accelerator_get_default_mod_mask()))
+ return FALSE;
+ switch (event->button) {
+ case 9: // forward
+ gtk_stack_set_visible_child(GTK_STACK(g.stack), g.view_scroller);
+ return TRUE;
+ default:
+ return FALSE;
}
- return FALSE;
}
int
@@ -453,6 +470,8 @@ main(int argc, char *argv[])
gtk_widget_set_hexpand(g.browser, TRUE);
g_signal_connect(g.browser, "item-activated",
G_CALLBACK(on_item_activated), NULL);
+ g_signal_connect(g.browser, "button-press-event",
+ G_CALLBACK(on_button_press_browser), NULL);
gtk_container_add(GTK_CONTAINER(g.browser_scroller), g.browser);
// TODO(p): Put a GtkListBox underneath, but with subdirectories.