breadbox: fix unfocus-close, Enter, and arrow key navigation
- KeyboardMode::Exclusive → OnDemand: with Exclusive the compositor never sends wl_keyboard::leave, so EventControllerFocus::connect_leave never fires. OnDemand lets Hyprland hand focus back on click-outside. - Move EventControllerKey from search to window, capture phase: bubble phase on SearchEntry let its own handlers consume Enter and arrows first. Capture phase on the window intercepts all keys before any widget sees them, so Enter/Up/Down/Esc always reach our handler. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
ec07b82747
commit
f665320634
1 changed files with 5 additions and 3 deletions
|
|
@ -331,7 +331,7 @@ fn run_ui(entries: Vec<(String, String)>) {
|
|||
|
||||
window.init_layer_shell();
|
||||
window.set_layer(Layer::Overlay);
|
||||
window.set_keyboard_mode(KeyboardMode::Exclusive);
|
||||
window.set_keyboard_mode(KeyboardMode::OnDemand);
|
||||
window.set_anchor(Edge::Top, true);
|
||||
window.set_exclusive_zone(-1);
|
||||
|
||||
|
|
@ -402,8 +402,10 @@ fn run_ui(entries: Vec<(String, String)>) {
|
|||
list_f.select_row(first_vis.as_ref());
|
||||
});
|
||||
|
||||
// Keyboard: Esc, Enter, arrows — keep focus in search bar
|
||||
// Keyboard: Esc, Enter, arrows — capture phase on window so we
|
||||
// intercept before SearchEntry's own handlers consume them
|
||||
let key_ctrl = EventControllerKey::new();
|
||||
key_ctrl.set_propagation_phase(gtk4::PropagationPhase::Capture);
|
||||
let window_k = window.clone();
|
||||
let list_k = list.clone();
|
||||
key_ctrl.connect_key_pressed(move |_, key, _, _| {
|
||||
|
|
@ -461,7 +463,7 @@ fn run_ui(entries: Vec<(String, String)>) {
|
|||
_ => glib::Propagation::Proceed,
|
||||
}
|
||||
});
|
||||
search.add_controller(key_ctrl);
|
||||
window.add_controller(key_ctrl);
|
||||
|
||||
// Click to launch
|
||||
let window_a = window.clone();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue