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:
parent
0ddecefe01
commit
8804938859
2 changed files with 27 additions and 1 deletions
|
|
@ -194,7 +194,18 @@
|
|||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="LpImageView" id="image_view"/>
|
||||
<object class="LpImageView" id="image_view">
|
||||
<child>
|
||||
<object class="GtkGestureClick" id="forward_click_gesture">
|
||||
<property name="button">9</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkGestureClick" id="backward_click_gesture">
|
||||
<property name="button">8</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkDropTarget" id="drop_target">
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue