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

Move parser for XSETTINGS from winit to x11rb #922

Open
notgull opened this issue Mar 3, 2024 · 3 comments
Open

Move parser for XSETTINGS from winit to x11rb #922

notgull opened this issue Mar 3, 2024 · 3 comments

Comments

@notgull
Copy link
Collaborator

notgull commented Mar 3, 2024

In rust-windowing/winit#3222 I added a parser for the data format found by querying the _XSETTINGS_SETTINGS atom. However this parser is not winit-specific. I think it could be useful outside of winit.

x11rb has parsers for other X11-specific formats already (e.g. xcursor, the resource manager), so I think it would make the most sense to move it here. What do the other maintainers think?

cc @kchibisov

@psychon
Copy link
Owner

psychon commented Mar 3, 2024

Oh, wow, yet another format for something similar to the resource manager stuff... Google suggests that this has a spec: https://specifications.freedesktop.org/xsettings-spec/xsettings-latest.html

So far, my approach was mainly "is there a xcb library for something?", but that's not a rule. So, yeah, I can see some usefulness in having something like that.

Would the code in x11rb then also help in implementing a server? How could x11rb help in implementing this part of the spec (which winit also ignores):

and select for notification on the settings window by calling XSelectInput() with a mask of StructureNotifyMask|PropertyChangeMask.

This part is also currently ignored, but can easily be handled, I guess:

To prevent race conditions a client MUST grab the server while performing these operations using XGrabServer().

x11rb has parsers for other X11-specific formats already (e.g. xcursor, the resource manager),

Due to #883, I have another spontaneous idea: Should all these parsers be moved to separate crates so that they can actually build in parallel? But I guess that's a different topic and there would not be much benefit since they are actually quite small... But separate crates could have x11rb or x11rb-async features and then offer specific APIs to make their usage nicer...

Edit: Some lists of possible setting names: https://codeberg.org/derat/xsettingsd#settings https://www.freedesktop.org/wiki/Specifications/XSettingsRegistry/

@notgull
Copy link
Collaborator Author

notgull commented Mar 3, 2024

I suppose it's probably better to have it in a separate crate, yes.

@kchibisov
Copy link

Having parsers in separate crates will be fine, I guess. Though, would be nice to have them discoverable.

Also, there's xcursor crate which also parses the cursors and is used by wayland infra.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants