Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Basic Unix platform adapter #198

Merged
merged 69 commits into from
Jan 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
64aef00
AT-SPI adapter scaffolding
DataTriny Oct 29, 2021
9770914
Major refactoring
DataTriny Nov 8, 2021
68d122c
Improve Application interface, implement basic Accessible interface m…
DataTriny Nov 13, 2021
2505ca7
Experiment with states and events
DataTriny Dec 5, 2021
065b451
Fix accesskit_linux after rebase
DataTriny Dec 9, 2021
438002e
Implement role translation
DataTriny Dec 9, 2021
a5081c2
Improve node state
DataTriny Dec 12, 2021
bc197fe
Improve example event handling
DataTriny Dec 12, 2021
61d6611
Improve focus and active window tracking
DataTriny Dec 13, 2021
d55ea1d
Implement basic support for name change event
DataTriny Dec 13, 2021
705bcb6
Refactor object state change events
DataTriny Dec 16, 2021
dd72c22
Implement application deregistering
DataTriny Dec 17, 2021
1f55b5f
Generalize object state change events
DataTriny Dec 20, 2021
59009e0
Run cargo fmt
DataTriny Dec 20, 2021
447aa60
Refactor node state method
DataTriny Dec 22, 2021
992ef70
Various fixes after rebase
DataTriny Dec 22, 2021
0514517
Rebase and bump dependencies
DataTriny Aug 5, 2022
3e63b01
Simplify D-Bus interfaces by getting rid of traits
DataTriny Aug 14, 2022
1be5dda
cargo fmt
DataTriny Aug 14, 2022
c3a89b5
Improve Interfaces
DataTriny Aug 15, 2022
a019089
Fix state property for the root node
DataTriny Aug 15, 2022
5e50f51
Implement org.a11y.atspi.Value
DataTriny Aug 15, 2022
f8da04c
Remove unused Application interface methods
DataTriny Aug 15, 2022
1cb6005
Refactor and improve events
DataTriny Aug 17, 2022
e9b9a12
Fix most warnings and visibility issues
DataTriny Aug 18, 2022
33e6793
Simplify QueuedEvent and raise parent changed event
DataTriny Aug 21, 2022
5aa4015
Improve D-Bus interfaces management
DataTriny Aug 21, 2022
8daa161
First try at implementing org.a11y.atspi.Action interface
DataTriny Aug 22, 2022
95c5953
Fix regressions in org.a11y.atspi.Accessible, add GetApplication whil…
DataTriny Aug 22, 2022
44c7511
Get rid of Drop for Bus to avoid accidentally unembedding, AT-SPI see…
DataTriny Aug 22, 2022
4a54c2f
Actually implement Deserialize for StateSet, test the whole module
DataTriny Aug 28, 2022
0966b96
Remove officially deprecated org.a11y.atspi.Event.Focus
DataTriny Aug 30, 2022
90923b4
Simplify how we obtain AT-SPI bus address, drop reference to x11rb
DataTriny Aug 30, 2022
aec46ab
Update deps
DataTriny Aug 30, 2022
19551a4
Rebase
DataTriny Nov 13, 2022
0dae57a
Add Linux support to accesskit_winit
DataTriny Nov 13, 2022
a7e601e
Various cleanups
DataTriny Nov 13, 2022
e204ef9
Start using the atspi crate
DataTriny Nov 13, 2022
56d26ef
Add basic support for hit-testing
DataTriny Nov 21, 2022
92cf00f
Bump Rust edition, fix some deps, populate Cargo.toml
DataTriny Nov 21, 2022
6f45b19
accesskit_winit: Rework event handling
DataTriny Nov 22, 2022
366bbc2
Improve object address management
DataTriny Nov 25, 2022
aa589ec
Rebase
DataTriny Dec 19, 2022
d8acda1
Refactor node positioning
DataTriny Dec 20, 2022
0acef5f
Rename the Linux adapter, improve conditional compilation inside acce…
DataTriny Dec 20, 2022
2b85e23
Slightly improve lazy initialization process
DataTriny Dec 20, 2022
ae7ae16
Raise proper event when removing a node
DataTriny Dec 20, 2022
8e1de32
Update to latest accesskit
DataTriny Dec 21, 2022
c223cb5
Add a README
DataTriny Dec 21, 2022
c83b3c4
cargo fmt
DataTriny Dec 21, 2022
e2f2350
Please clippy
DataTriny Dec 21, 2022
5528004
Fix winit example message about how to launch Orca
DataTriny Dec 21, 2022
36c442c
Remove commented out code and traces
DataTriny Dec 21, 2022
cb4ef83
Fix licensing and copyright notices
DataTriny Dec 22, 2022
806e1aa
Tell release-please about the Unix adapter
DataTriny Dec 22, 2022
30ba2ca
Drop unused AT-SPI types and methods
DataTriny Dec 22, 2022
c762bbb
Apply inverse transform before hit-testing
DataTriny Dec 24, 2022
480932f
Improve ComponentInterface::get_accessible_at_point
DataTriny Dec 24, 2022
0105122
Only expose filtered parent and children
DataTriny Dec 24, 2022
0a29994
Raise event on value property change
DataTriny Dec 24, 2022
c2253ff
Drop dependency on strum
DataTriny Dec 24, 2022
3000187
More Component interface methods and events
DataTriny Dec 26, 2022
c077ed9
Use filtered nodes everywhere
DataTriny Dec 27, 2022
afcdf42
Switch to newly published atspi version
DataTriny Dec 27, 2022
8f12d91
Raise events on child addition and removal
DataTriny Dec 28, 2022
988ccfd
Raise events asynchronously
DataTriny Dec 29, 2022
79776dc
Chop the dependency tree a bit
DataTriny Jan 4, 2023
01b48aa
Split adapter initialization method
DataTriny Jan 4, 2023
55ea3c9
Add some documentation on public items
DataTriny Jan 4, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
770 changes: 750 additions & 20 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ members = [
"common",
"consumer",
"platforms/macos",
"platforms/unix",
"platforms/windows",
"platforms/winit",
]
Expand Down
35 changes: 26 additions & 9 deletions consumer/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,25 +103,30 @@ impl<'a> Node<'a> {
(self.tree_state.node_by_id(*parent).unwrap(), *index)
})
}
}

impl NodeState {
pub fn child_ids(
&self,
) -> impl DoubleEndedIterator<Item = NodeId>
+ ExactSizeIterator<Item = NodeId>
+ FusedIterator<Item = NodeId>
+ 'a {
let data = &self.state.data;
+ '_ {
let data = &self.data;
data.children.iter().copied()
}
}

impl<'a> Node<'a> {
pub fn children(
&self,
) -> impl DoubleEndedIterator<Item = Node<'a>>
+ ExactSizeIterator<Item = Node<'a>>
+ FusedIterator<Item = Node<'a>>
+ 'a {
let state = self.tree_state;
self.child_ids()
self.state
.child_ids()
.map(move |id| state.node_by_id(id).unwrap())
}

Expand Down Expand Up @@ -267,23 +272,31 @@ impl<'a> Node<'a> {
};
parent_transform * self.direct_transform()
}
}

impl NodeState {
pub fn raw_bounds(&self) -> Option<Rect> {
self.data().bounds
}
}

impl<'a> Node<'a> {
pub fn has_bounds(&self) -> bool {
self.data().bounds.is_some()
self.state.raw_bounds().is_some()
}

/// Returns the node's transformed bounding box relative to the tree's
/// container (e.g. window).
pub fn bounding_box(&self) -> Option<Rect> {
self.data()
.bounds
self.state
.raw_bounds()
.as_ref()
.map(|rect| self.transform().transform_rect_bbox(*rect))
}

pub(crate) fn bounding_box_in_coordinate_space(&self, other: &Node) -> Option<Rect> {
self.data()
.bounds
self.state
.raw_bounds()
.as_ref()
.map(|rect| self.relative_transform(other).transform_rect_bbox(*rect))
}
Expand All @@ -307,7 +320,7 @@ impl<'a> Node<'a> {
}

if filter_result == FilterResult::Include {
if let Some(rect) = &self.data().bounds {
if let Some(rect) = &self.state.raw_bounds() {
if rect.contains(point) {
return Some((*self, point));
}
Expand Down Expand Up @@ -413,6 +426,10 @@ impl NodeState {
self.data().multiline
}

pub fn is_protected(&self) -> bool {
self.data().protected
}

pub fn default_action_verb(&self) -> Option<DefaultActionVerb> {
self.data().default_action_verb
}
Expand Down
9 changes: 9 additions & 0 deletions consumer/src/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// the LICENSE-APACHE file) or the MIT license (found in
// the LICENSE-MIT file), at your option.

use accesskit::kurbo::Point;
use accesskit::{
Action, ActionData, ActionHandler, ActionRequest, Live, Node as NodeData, NodeId,
TextSelection, Tree as TreeData, TreeUpdate,
Expand Down Expand Up @@ -386,6 +387,14 @@ impl Tree {
})
}

pub fn scroll_to_point(&self, target: NodeId, point: Point) {
self.action_handler.do_action(ActionRequest {
action: Action::ScrollToPoint,
target,
data: Some(ActionData::ScrollToPoint(point)),
})
}

pub fn select_text_range(&self, range: &TextRange) {
let selection = TextSelection {
anchor: range.start.downgrade(),
Expand Down
21 changes: 21 additions & 0 deletions platforms/unix/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[package]
name = "accesskit_unix"
version = "0.1.0"
authors = ["Arnold Loubriat <[email protected]>"]
license = "MIT/Apache-2.0"
description = "AccessKit UI accessibility infrastructure: Linux adapter"
categories = ["gui"]
keywords = ["gui", "ui", "accessibility"]
repository = "https://github.com/AccessKit/accesskit"
readme = "README.md"
edition = "2021"

[dependencies]
accesskit = { version = "0.8.1", path = "../../common" }
accesskit_consumer = { version = "0.11.0", path = "../../consumer" }
async-channel = "1.8.0"
atspi = "0.8.7"
futures-lite = "1.12.0"
parking_lot = "0.12.1"
serde = "1.0"
zbus = "3.6"
3 changes: 3 additions & 0 deletions platforms/unix/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# AccessKit Unix adapter

This is the Unix adapter for [AccessKit](https://accesskit.dev/). It exposes an AccessKit accessibility tree through the AT-SPI protocol.
Loading