-
Notifications
You must be signed in to change notification settings - Fork 54
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
Conversation
Please remember to add an entry for platforms/unix in release-please-config.json. I forgot to do this for the macOS adapter and ended up making a mess. |
It doesn't look like we actually need |
You forgot the copyright notice at the top of platforms/unix/src/atspi/interfaces/action.rs. Also, the accesskit_unix crate metadata says that the crate is only under the Apache license, not the MIT/Apache dual license. Is this intentional? |
Why do you manually drop the window bounds in |
Are you sure the Also, shouldn't the |
I notice that the |
In |
The methods on The tricky part, of course, is that when comparing the parent and children with those of the old version of a node, we can't currently use the full filter. One solution would be to look at the raw parent and children when doing comparisons to determine which events to fire, but then use the filtered parent and children for navigation. In that case, we'd also need to use the filtered parent and children when calculating the values to include in the events themselves. If we do this, once the children-changed event is implemented, we'd end up firing extraneous events when inline text boxes are added or removed, but I don't know of a better solution at this time. Also, to implement |
When you implement keyboard event handling, are you planning to block the main thread while waiting on the AT-SPI registry to return the result for a given keyboard event? The current design of |
Speaking of blocking the main thread, this might also be a problem with the way AT-SPI events are currently emitted. I wonder if this should be done on a background thread. |
I now understand that AT-SPI's "sensitive" state means something different than I thought. Still, I think the node's disabled flag needs to be checked separately from its read-only flag. |
The recently pushed fixes all look good. |
4c1edb2
to
3ca92fb
Compare
Please either go back to a published version of the atspi crate, or ask the crate maintainers to publish a new version on crates.io before we merge this PR. I want to publish new AccessKit crates as soon as this PR is merged, and published crates can only depend on other published crates. |
The |
To be consistent, |
I wonder if we need to call |
I have to push other changes related to device controller so I plan to ask for a new version once everything is merged. I'll do this right now.
How did I miss that? I will handle this as well as fixing the |
From
|
When looking at filter results for the The if filter_detached(node) === FilterResult::Include And finally, in if filter_new != filter_old {
if filter_new == FilterResult::Include {
self.add_node(new_node);
} else if filter_old == FilterResult::Include {
self.remove_node(old_node);
}
} else if filter_new == FilterResult::Include {
// actual update handler
} This eliminates the initial empty |
a76296e
to
58493a2
Compare
For some reason I thought that We're back on a published atspi crate! |
@mwcampbell I just pushed a commit containing everything on the accesskit_unix crate to send the keyboard events. The accesskit_winit crate API have been modified but the event conversion is not done yet. I am obviously not a big fan of placing a type parameter on all platform adapters, feel free to suggest a better option. I also looked at the egui integration and I think the current API should work. |
Just one small nit with the Unix adapter: I don't think we need to re-export |
The exported types for keyboard events might change, I'm still figuring out the cleanest way for users to not deal with AT-SPI internal stuff. I might export a whole Key event as well, we'll see. |
In the winit adapter, I have an idea to avoid the type parameter. Give me some time to implement this on my own branch so I can show it to you. |
Check out the winit-keyboard-handler branch in the main AccessKit repo to see what I came up with. Note that I haven't done anything on the actual keyboard event conversion, and the winit example still needs to be updated. |
Yes, dynamic dispatch can help here. I've merged your branch and started translating the keyboard events. We'll use x11-dl (re-exported by winit) to get the keysym. Running the example I can already see a problem: we'll want to give back the events to the app if the registry takes too long to reply. We'd need a way to sleep for 100ms or so and cancel the sending future if it isn't already done. But it's the job of an executor to sleep, and zbus Should we try to do the same and introduce a Maybe a |
I don't think accesskit_unix needs to offer the choice between async-io and tokio. As far as any users of that crate are concerned, accesskit_unix does most of its work on one or more other threads, and the user doesn't need to know how. So just go ahead and use async-io directly to implement the timeout. |
I'd like to see both accesskit_unix and the atspi crate use the futures-lite crate instead of the futures crate. accesskit_unix would also need to use the async-channel crate instead of the channel implementation in the futures crate. async-io and related crates use futures-lite rather than futures, and zbus already depends on async-channel. So eliminating a dependency would be good. Also, the example of how to implement a timeout in the async-io documentation uses futures-lite. |
We absolutely need to reduce the number of dependencies, so I'll take care of that before we merge. There is no way we can have this land today anyway. We can't just send back Therefore I am trying to collect every input related event and process them all once we receive a |
This is now blocked on odilia-app/atspi#40. The impact of that dependency on our dependency graph is unacceptable in my opinion. |
To be safe, |
I don't think it's accurate to refer to what we're doing with the winit window events as "reentrant". I suggest calling them deferred events instead. I understand why you're doing what you did with the static lifetime and the way that |
The current way of converting keycodes to keysyms using Xlib doesn't work if the app is natively using Wayland, does it? |
No it doesn't since it requires a |
Wayland clients use This is mostly the same as how it works on X, though on X the modifier state is passed as part of the |
Thanks very much @ids1024 for this summary. We'll revert the work on keyboard handling for now though, and try to get it fixed upstream thanks to @mwcampbell 's generosity. |
Keycode/keysym handling seems to have inadvertently ended up my area of expertise based on a couple things I've worked on, so if you have any questions about that, or generally about how Wayland protocols work, I may be able to help. |
The time has come. Waiting for your final review @mwcampbell ! |
Thank you for your work on this! And I'm glad you did it without bringing in C dependencies beyond the required X & Wayland libraries that GUI applications are linking already anyway. |
Closes #56
Remaining work:
strum
crate and push more event related types to theatspi
crate,