diff --git a/data/ui/views/media_viewer.ui b/data/ui/views/media_viewer.ui
index 5cf9718c..4c88b70d 100644
--- a/data/ui/views/media_viewer.ui
+++ b/data/ui/views/media_viewer.ui
@@ -69,7 +69,6 @@
-
+
+
+
visible
@@ -164,7 +187,6 @@
-
diff --git a/src/Views/MediaViewer.vala b/src/Views/MediaViewer.vala
index 1b96c941..539bed81 100644
--- a/src/Views/MediaViewer.vala
+++ b/src/Views/MediaViewer.vala
@@ -292,12 +292,14 @@ public class Tuba.Views.MediaViewer : Gtk.Widget, Gtk.Buildable, Adw.Swipeable {
if (value) {
app.main_window.fullscreen ();
fullscreen_btn.icon_name = "view-restore-symbolic";
- _fullscreen = true;
} else {
app.main_window.unfullscreen ();
fullscreen_btn.icon_name = "view-fullscreen-symbolic";
- _fullscreen = false;
}
+
+ _fullscreen =
+ toggle_fs_revealer.visible = value;
+ headerbar.visible = !value;
}
get { return app.main_window.fullscreened; }
}
@@ -320,6 +322,7 @@ public class Tuba.Views.MediaViewer : Gtk.Widget, Gtk.Buildable, Adw.Swipeable {
[GtkChild] unowned Gtk.Button fullscreen_btn;
[GtkChild] unowned Adw.HeaderBar headerbar;
[GtkChild] unowned Gtk.Button back_btn;
+ [GtkChild] unowned Gtk.Revealer toggle_fs_revealer;
[GtkChild] unowned Gtk.Revealer page_buttons_revealer;
[GtkChild] unowned Gtk.Button prev_btn;
@@ -336,6 +339,7 @@ public class Tuba.Views.MediaViewer : Gtk.Widget, Gtk.Buildable, Adw.Swipeable {
set {
headerbar.opacity =
page_buttons_revealer.opacity =
+ toggle_fs_revealer.opacity =
zoom_buttons_revealer.opacity = value;
}
}
@@ -461,7 +465,7 @@ public class Tuba.Views.MediaViewer : Gtk.Widget, Gtk.Buildable, Adw.Swipeable {
context_menu.set_parent (this);
setup_mouse_previous_click ();
- setup_double_click ();
+ setup_mouse1_click ();
setup_mouse_secondary_click ();
setup_swipe_close ();
}
@@ -638,7 +642,13 @@ public class Tuba.Views.MediaViewer : Gtk.Widget, Gtk.Buildable, Adw.Swipeable {
old_width = null;
}
+ double on_motion_last_x = 0.0;
+ double on_motion_last_y = 0.0;
protected void on_motion (double x, double y) {
+ if (on_motion_last_x == x && on_motion_last_y == y) return;
+ on_motion_last_x = x;
+ on_motion_last_y = y;
+
on_reveal_media_buttons ();
}
@@ -646,6 +656,7 @@ public class Tuba.Views.MediaViewer : Gtk.Widget, Gtk.Buildable, Adw.Swipeable {
protected void on_reveal_media_buttons () {
page_buttons_revealer.set_reveal_child (true);
zoom_buttons_revealer.set_reveal_child (true);
+ toggle_fs_revealer.set_reveal_child (true);
if (revealer_timeout > 0) GLib.Source.remove (revealer_timeout);
revealer_timeout = Timeout.add (5 * 1000, on_hide_media_buttons, Priority.LOW);
@@ -654,6 +665,7 @@ public class Tuba.Views.MediaViewer : Gtk.Widget, Gtk.Buildable, Adw.Swipeable {
protected bool on_hide_media_buttons () {
page_buttons_revealer.set_reveal_child (false);
zoom_buttons_revealer.set_reveal_child (false);
+ toggle_fs_revealer.set_reveal_child (false);
revealer_timeout = 0;
return GLib.Source.REMOVE;
@@ -760,11 +772,11 @@ public class Tuba.Views.MediaViewer : Gtk.Widget, Gtk.Buildable, Adw.Swipeable {
add_controller (gesture);
}
- private void setup_double_click () {
+ private void setup_mouse1_click () {
var gesture = new Gtk.GestureClick () {
button = 1
};
- gesture.pressed.connect (on_double_click);
+ gesture.pressed.connect (on_mouse1_click);
add_controller (gesture);
}
@@ -786,13 +798,18 @@ public class Tuba.Views.MediaViewer : Gtk.Widget, Gtk.Buildable, Adw.Swipeable {
clear ();
}
- private void on_double_click (int n_press, double x, double y) {
- if (n_press != 2) return;
-
- Item? page = safe_get ((int) carousel.position);
- if (page == null) return;
-
- page.on_double_click ();
+ private void on_mouse1_click (int n_press, double x, double y) {
+ switch (n_press) {
+ case 1:
+ on_reveal_media_buttons ();
+ break;
+ case 2:
+ Item? page = safe_get ((int) carousel.position);
+ if (page == null) break;
+
+ page.on_double_click ();
+ break;
+ }
}
private void reset_media_viewer () {