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

@ -429,6 +429,7 @@ mod imp {
if obj.is_hscrollable() || obj.is_vscrollable() {
obj.cancel_deceleration();
gesture.set_state(gtk::EventSequenceState::Claimed);
obj.set_cursor(gdk::Cursor::from_name("grabbing", None).as_ref());
obj.imp().last_drag_value.set(Some((0., 0.)));
} else {

View file

@ -176,6 +176,7 @@ mod imp {
gesture.set_state(gtk::EventSequenceState::Denied);
None
} else {
gesture.set_state(gtk::EventSequenceState::Claimed);
obj.current_page().and_then(|p| p.content_provider())
}
}),

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;