window: Support forward and back mouse buttons

The button value for forward is 9. See <GNOME/gtk#515>.

Closes #172
This commit is contained in:
Huan Nguyen 2023-05-21 16:17:48 +00:00 • committed by Sophie Herold
parent 0ddecefe01
commit 8804938859
2 changed files with 27 additions and 1 deletions

View file

@ -91,6 +91,12 @@ mod imp {
pub(super) properties_view: TemplateChild<LpPropertiesView>,
#[template_child]
pub(super) drop_target: TemplateChild<gtk::DropTarget>,
#[template_child]
pub(super) forward_click_gesture: TemplateChild<gtk::GestureClick>,
#[template_child]
pub(super) backward_click_gesture: TemplateChild<gtk::GestureClick>,
/// Motion controller for complete window
pub(super) motion_controller: gtk::EventControllerMotion,
pub(super) pointer_position: Cell<(f64, f64)>,
@ -241,6 +247,15 @@ mod imp {
self.parent_constructed();
self.forward_click_gesture
.connect_pressed(clone!(@weak obj => move |_,_,_,_| {
obj.image_view().navigate(Direction::Forward);
}));
self.backward_click_gesture
.connect_pressed(clone!(@weak obj => move |_,_,_,_| {
obj.image_view().navigate(Direction::Back);
}));
if config::PROFILE == ".Devel" {
obj.add_css_class("devel");
}