aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2021-11-21 21:21:45 +0100
committerPřemysl Eric Janouch <p@janouch.name>2021-11-21 21:22:14 +0100
commit8b1a14decbd065e43c30a7dede4b0350116b4242 (patch)
tree925dbaebc5f9a45d5da7db6df323e3b69c417d4e
parentd0fb24bf6b07ddb5806c3424f27e6d63a0c4fd53 (diff)
downloadfiv-8b1a14decbd065e43c30a7dede4b0350116b4242.tar.gz
fiv-8b1a14decbd065e43c30a7dede4b0350116b4242.tar.xz
fiv-8b1a14decbd065e43c30a7dede4b0350116b4242.zip
Bind double click to full screen toggle
-rw-r--r--fastiv.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/fastiv.c b/fastiv.c
index f7e174f..5230085 100644
--- a/fastiv.c
+++ b/fastiv.c
@@ -355,6 +355,16 @@ on_notify_thumbnail_size(
gtk_widget_set_sensitive(g.minus, size > FASTIV_IO_THUMBNAIL_SIZE_MIN);
}
+static void
+toggle_fullscreen(void)
+{
+ if (gdk_window_get_state(gtk_widget_get_window(g.window)) &
+ GDK_WINDOW_STATE_FULLSCREEN)
+ gtk_window_unfullscreen(GTK_WINDOW(g.window));
+ else
+ gtk_window_fullscreen(GTK_WINDOW(g.window));
+}
+
// Cursor keys, e.g., simply cannot be bound through accelerators
// (and GtkWidget::keynav-failed would arguably be an awful solution).
//
@@ -410,11 +420,7 @@ on_key_press(G_GNUC_UNUSED GtkWidget *widget, GdkEventKey *event,
case GDK_KEY_F11:
case GDK_KEY_f:
- if (gdk_window_get_state(gtk_widget_get_window(g.window)) &
- GDK_WINDOW_STATE_FULLSCREEN)
- gtk_window_unfullscreen(GTK_WINDOW(g.window));
- else
- gtk_window_fullscreen(GTK_WINDOW(g.window));
+ toggle_fullscreen();
return TRUE;
}
}
@@ -459,6 +465,12 @@ on_button_press_view(G_GNUC_UNUSED GtkWidget *widget, GdkEventButton *event)
case 8: // back
gtk_stack_set_visible_child(GTK_STACK(g.stack), g.browser_paned);
return TRUE;
+ case GDK_BUTTON_PRIMARY:
+ if (event->type == GDK_2BUTTON_PRESS) {
+ toggle_fullscreen();
+ return TRUE;
+ }
+ return FALSE;
default:
return FALSE;
}