From 880493885991098af29d5e3178fcf8f0019bc732 Mon Sep 17 00:00:00 2001 From: Huan Nguyen Date: Sun, 21 May 2023 16:17:48 +0000 Subject: [PATCH] window: Support forward and back mouse buttons The button value for forward is 9. See . Closes #172 --- data/gtk/window.ui | 13 ++++++++++++- src/window.rs | 15 +++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/data/gtk/window.ui b/data/gtk/window.ui index fc0f0ac..ab31a43 100644 --- a/data/gtk/window.ui +++ b/data/gtk/window.ui @@ -194,7 +194,18 @@ - + + + + 9 + + + + + 8 + + + diff --git a/src/window.rs b/src/window.rs index 90db883..de92b38 100644 --- a/src/window.rs +++ b/src/window.rs @@ -91,6 +91,12 @@ mod imp { pub(super) properties_view: TemplateChild, #[template_child] pub(super) drop_target: TemplateChild, + + #[template_child] + pub(super) forward_click_gesture: TemplateChild, + #[template_child] + pub(super) backward_click_gesture: TemplateChild, + /// 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"); }