mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
separate controllers to ignore other buttons pressed
This commit is contained in:
parent
33943d37f1
commit
5421afd75d
1 changed files with 13 additions and 9 deletions
|
|
@ -37,17 +37,21 @@ impl Widget {
|
||||||
|
|
||||||
// Connect back/forward navigation buttons @TODO use constant
|
// Connect back/forward navigation buttons @TODO use constant
|
||||||
application_window.add_controller({
|
application_window.add_controller({
|
||||||
use gtk::prelude::GestureSingleExt;
|
let controller = gtk::GestureClick::builder().button(8).build();
|
||||||
let button_controller = gtk::GestureClick::builder().button(0).build();
|
controller.connect_pressed({
|
||||||
button_controller.connect_pressed({
|
|
||||||
let window = window.clone();
|
let window = window.clone();
|
||||||
move |this, _, _, _| match this.current_button() {
|
move |_, _, _, _| window.tab.history_back(None)
|
||||||
8 => window.tab.history_back(None),
|
|
||||||
9 => window.tab.history_forward(None),
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
button_controller
|
controller
|
||||||
|
});
|
||||||
|
|
||||||
|
application_window.add_controller({
|
||||||
|
let controller = gtk::GestureClick::builder().button(9).build();
|
||||||
|
controller.connect_pressed({
|
||||||
|
let window = window.clone();
|
||||||
|
move |_, _, _, _| window.tab.history_forward(None)
|
||||||
|
});
|
||||||
|
controller
|
||||||
});
|
});
|
||||||
|
|
||||||
// Return new struct
|
// Return new struct
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue