window: Show controls on mouse click
This commit is contained in:
parent
a8693c50ef
commit
24bbd7eae2
3 changed files with 17 additions and 0 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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())
|
||||
}
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue