Skip to content

Commit

Permalink
feat(gtk): Handle Ctrl + Q in the standalone application
Browse files Browse the repository at this point in the history
  • Loading branch information
mmstick committed Aug 13, 2019
1 parent 2f326f5 commit 5749234
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions gtk/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@ fn main() {

Inhibit(false)
});
..connect_key_press_event(move |window, event| {
use gdk::enums::key;
gtk::Inhibit(match event.get_keyval() {
key::q if event.get_state().contains(gdk::ModifierType::CONTROL_MASK) => {
let _ = window.emit("delete-event", &[&gdk::Event::new(gdk::EventType::Delete)]);
true
}
_ => false
})
});
};
});

Expand Down

0 comments on commit 5749234

Please sign in to comment.