dbus: Implement org.freedesktop.a11y.Manager protocol
This protocol is now the upstream solution in at-spi2-core/orca for registering keyboard grabs and watching key events. It should also be a bit better than the current verious of our custom Wayland protocol for this purpose. Like Mutter and Kwin, we currently restrict this to only be called by the client that holds the name `org.gnome.Orca.KeyboardMonitor` on the session bus. We also send the `KeyEvent` signal only to registered watchers, rather than broadcasting, as DBus does by default.
This commit is contained in:
parent
d08ac9645b
commit
f065143d3e
5 changed files with 358 additions and 2 deletions
|
|
@ -1595,6 +1595,9 @@ impl State {
|
|||
self.common
|
||||
.atspi_ei
|
||||
.input(modifiers, &handle, event.state(), event.time() * 1000);
|
||||
self.common
|
||||
.a11y_keyboard_monitor_state
|
||||
.key_event(modifiers, &handle, event.state());
|
||||
|
||||
// Leave move overview mode, if any modifier was released
|
||||
if let Some(Trigger::KeyboardMove(action_modifiers)) =
|
||||
|
|
@ -1759,11 +1762,15 @@ impl State {
|
|||
}
|
||||
|
||||
if event.state() == KeyState::Released {
|
||||
let removed = self
|
||||
let mut removed = self
|
||||
.common
|
||||
.atspi_ei
|
||||
.active_virtual_mods
|
||||
.remove(&event.key_code());
|
||||
removed |= self
|
||||
.common
|
||||
.a11y_keyboard_monitor_state
|
||||
.remove_active_virtual_mod(handle.modified_sym());
|
||||
// If `Caps_Lock` is a virtual modifier, and is in locked state, clear it
|
||||
if removed
|
||||
&& handle.modified_sym() == Keysym::Caps_Lock
|
||||
|
|
@ -1790,16 +1797,23 @@ impl State {
|
|||
);
|
||||
}
|
||||
} else if event.state() == KeyState::Pressed
|
||||
&& self
|
||||
&& (self
|
||||
.common
|
||||
.atspi_ei
|
||||
.virtual_mods
|
||||
.contains(&event.key_code())
|
||||
|| self
|
||||
.common
|
||||
.a11y_keyboard_monitor_state
|
||||
.has_virtual_mod(handle.modified_sym()))
|
||||
{
|
||||
self.common
|
||||
.atspi_ei
|
||||
.active_virtual_mods
|
||||
.insert(event.key_code());
|
||||
self.common
|
||||
.a11y_keyboard_monitor_state
|
||||
.add_active_virtual_mod(handle.modified_sym());
|
||||
|
||||
tracing::debug!(
|
||||
"active virtual mods: {:?}",
|
||||
|
|
@ -1835,10 +1849,15 @@ impl State {
|
|||
}
|
||||
|
||||
if self.common.atspi_ei.has_keyboard_grab()
|
||||
|| self.common.a11y_keyboard_monitor_state.has_keyboard_grab()
|
||||
|| self
|
||||
.common
|
||||
.atspi_ei
|
||||
.has_key_grab(modifiers.serialized.layout_effective, event.key_code())
|
||||
|| self
|
||||
.common
|
||||
.a11y_keyboard_monitor_state
|
||||
.has_key_grab(modifiers, handle.modified_sym())
|
||||
{
|
||||
return FilterResult::Intercept(None);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue