separate controllers to ignore other buttons pressed

This commit is contained in:
yggverse 2025-03-06 05:49:01 +02:00
parent 33943d37f1
commit 5421afd75d

View file

@ -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