mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 17:45:28 +00:00
remove Escape accels from window actions as blocking dialog windows, replace it with local EventControllerKey implementation, that depends of active focus
This commit is contained in:
parent
4a81297ef1
commit
d469499d46
10 changed files with 37 additions and 68 deletions
|
|
@ -49,6 +49,22 @@ impl Search {
|
|||
g_box.append(&placeholder.label);
|
||||
g_box.append(&close);
|
||||
|
||||
// Hide widget on `Escape` key pressed
|
||||
g_box.add_controller({
|
||||
use gtk::{gdk::Key, glib::Propagation};
|
||||
let c = gtk::EventControllerKey::new();
|
||||
c.connect_key_pressed({
|
||||
let g_box = g_box.clone();
|
||||
move |_, k, _, _| {
|
||||
if k == Key::Escape {
|
||||
g_box.set_visible(false)
|
||||
}
|
||||
Propagation::Stop
|
||||
}
|
||||
});
|
||||
c
|
||||
});
|
||||
|
||||
// Connect events
|
||||
close.connect_clicked({
|
||||
let form = form.clone();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue