mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-23 02:05:33 +07:00
input: Don't hide overlays on a11y-consumed key presses
This commit is contained in:
+14
-2
@@ -119,11 +119,12 @@ impl State {
|
|||||||
let hide_exit_confirm_dialog =
|
let hide_exit_confirm_dialog =
|
||||||
self.niri.exit_confirm_dialog.is_open() && should_hide_exit_confirm_dialog(&event);
|
self.niri.exit_confirm_dialog.is_open() && should_hide_exit_confirm_dialog(&event);
|
||||||
|
|
||||||
|
let mut consumed_by_a11y = false;
|
||||||
use InputEvent::*;
|
use InputEvent::*;
|
||||||
match event {
|
match event {
|
||||||
DeviceAdded { device } => self.on_device_added(device),
|
DeviceAdded { device } => self.on_device_added(device),
|
||||||
DeviceRemoved { device } => self.on_device_removed(device),
|
DeviceRemoved { device } => self.on_device_removed(device),
|
||||||
Keyboard { event } => self.on_keyboard::<I>(event),
|
Keyboard { event } => self.on_keyboard::<I>(event, &mut consumed_by_a11y),
|
||||||
PointerMotion { event } => self.on_pointer_motion::<I>(event),
|
PointerMotion { event } => self.on_pointer_motion::<I>(event),
|
||||||
PointerMotionAbsolute { event } => self.on_pointer_motion_absolute::<I>(event),
|
PointerMotionAbsolute { event } => self.on_pointer_motion_absolute::<I>(event),
|
||||||
PointerButton { event } => self.on_pointer_button::<I>(event),
|
PointerButton { event } => self.on_pointer_button::<I>(event),
|
||||||
@@ -149,6 +150,12 @@ impl State {
|
|||||||
Special(_) => (),
|
Special(_) => (),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Don't hide overlays if consumed by a11y, so that you can use the screen reader
|
||||||
|
// navigation keys.
|
||||||
|
if consumed_by_a11y {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Do this last so that screenshot still gets it.
|
// Do this last so that screenshot still gets it.
|
||||||
if hide_hotkey_overlay && self.niri.hotkey_overlay.hide() {
|
if hide_hotkey_overlay && self.niri.hotkey_overlay.hide() {
|
||||||
self.niri.queue_redraw_all();
|
self.niri.queue_redraw_all();
|
||||||
@@ -326,7 +333,11 @@ impl State {
|
|||||||
.is_some_and(KeyboardShortcutsInhibitor::is_active)
|
.is_some_and(KeyboardShortcutsInhibitor::is_active)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_keyboard<I: InputBackend>(&mut self, event: I::KeyboardKeyEvent) {
|
fn on_keyboard<I: InputBackend>(
|
||||||
|
&mut self,
|
||||||
|
event: I::KeyboardKeyEvent,
|
||||||
|
consumed_by_a11y: &mut bool,
|
||||||
|
) {
|
||||||
let mod_key = self.backend.mod_key(&self.niri.config.borrow());
|
let mod_key = self.backend.mod_key(&self.niri.config.borrow());
|
||||||
|
|
||||||
let serial = SERIAL_COUNTER.next_serial();
|
let serial = SERIAL_COUNTER.next_serial();
|
||||||
@@ -360,6 +371,7 @@ impl State {
|
|||||||
event.key_code(),
|
event.key_code(),
|
||||||
event.state(),
|
event.state(),
|
||||||
) {
|
) {
|
||||||
|
*consumed_by_a11y = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user