Skip to content

Commit

Permalink
fix: Return to handling focus events directly, after generic node cha…
Browse files Browse the repository at this point in the history
…nges (#409)
  • Loading branch information
mwcampbell authored May 13, 2024
1 parent 2f8155c commit cd2e35e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions platforms/atspi-common/src/adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,14 @@ impl TreeChangeHandler for AdapterChangeHandler<'_> {
self.adapter.window_deactivated(&NodeWrapper(&root_window));
}
}
if let Some(node) = new_node {
self.adapter
.emit_object_event(node.id(), ObjectEvent::StateChanged(State::Focused, true));
}
if let Some(node) = old_node {
self.adapter
.emit_object_event(node.id(), ObjectEvent::StateChanged(State::Focused, false));
}
}

fn node_removed(&mut self, node: &Node) {
Expand Down
4 changes: 4 additions & 0 deletions platforms/atspi-common/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,10 @@ impl<'a> NodeWrapper<'a> {
let new_state = self.state(true);
let changed_states = old_state ^ new_state;
for state in changed_states.iter() {
if state == State::Focused {
// This is handled specially in `focus_moved`.
continue;
}
adapter.emit_object_event(
self.id(),
ObjectEvent::StateChanged(state, new_state.contains(state)),
Expand Down

0 comments on commit cd2e35e

Please sign in to comment.