hookup the mouse back button to the 'app.back' action
This commit is contained in:
parent
6f643c12c7
commit
2f3401f67a
1 changed files with 17 additions and 0 deletions
|
@ -227,6 +227,23 @@ pub fn new(app: >k::Application, op: &Arc<Mutex<AppOp>>) {
|
|||
app.set_accels_for_action("app.quit", &["<Ctrl>Q"]);
|
||||
app.set_accels_for_action("app.back", &["Escape"]);
|
||||
|
||||
// connect mouse back button to app.back action
|
||||
let app_weak = app.downgrade();
|
||||
if let Some(window) = app.get_active_window() {
|
||||
window.connect_button_press_event(move |_, e| {
|
||||
if e.get_button() == 8 {
|
||||
if let Some(app) = app_weak.upgrade() {
|
||||
app.lookup_action("back")
|
||||
.expect("App did not have back action.")
|
||||
.activate(None);
|
||||
return Inhibit(true);
|
||||
}
|
||||
}
|
||||
|
||||
Inhibit(false)
|
||||
});
|
||||
}
|
||||
|
||||
// TODO: Mark active room as read when window gets focus
|
||||
//op.lock().unwrap().mark_active_room_messages();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue