window: Show controls on mouse click

This commit is contained in:
Sophie Herold 2023-05-01 17:44:45 +02:00
parent a8693c50ef
commit 24bbd7eae2
3 changed files with 17 additions and 0 deletions

View file

@ -256,6 +256,11 @@ mod imp {
obj.on_images_available();
let gesture_click = gtk::GestureClick::new();
gesture_click
.connect_pressed(glib::clone!(@weak obj => move |_, _, _, _| obj.on_click()));
obj.add_controller(gesture_click);
let current_image_signals = self.image_view.current_image_signals();
// clone! is a macro from glib-rs that allows
// you to easily handle references in callbacks
@ -831,6 +836,16 @@ impl LpWindow {
}
}
fn on_click(&self) {
self.show_controls();
if self.can_hide_controls() {
self.queue_hide_controls();
} else {
self.dequeue_hide_controls();
}
}
#[template_callback]
fn on_motion_cb(&self) {
let controller = &self.imp().motion_controller;