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

Xlib must die #3198

Open
notgull opened this issue Oct 28, 2023 · 8 comments
Open

Xlib must die #3198

notgull opened this issue Oct 28, 2023 · 8 comments

Comments

@notgull
Copy link
Member

notgull commented Oct 28, 2023

Xlib is the legacy strategy for interacting with the X server. It has since been replaced by libxcb, which is lighter and has fewer soundless holes. x11rb wraps around libxcb and reimplements the protocol parsing logic in safe Rust, further reducing the number of places where unsound logic can occur.

List of places in winit where Xlib still lurks:

Discussion questions:

  • I want to be able to replace x11-dl with tiny-xlib, is this possible?
  • Do we want to add a feature to remove Xlib entirely and just use XCB?
  • Going further, do we want to add a feature to remove these two external libraries from our X backend altogether and just use x11rb's pure-Rust backend?
    • Is this also available for Wayland?
@kchibisov
Copy link
Member

Cursor handling code

isn't cursor being drawn on the server? Or we must submit a Xcursor theme to the server? How does it all work? I thought you just send names, it's not wayland with its client side cursors in the end of the day.

I want to be able to replace x11-dl with tiny-xlib, is this possible?

doesn't matter, but we don't need x11-dl that hard.

Do we want to add a feature to remove Xlib entirely and just use XCB?

yes

Is this also available for Wayland?

no.

@notgull
Copy link
Member Author

notgull commented Oct 28, 2023

Is this also available for Wayland?

no.

Can you elaborate on this? I know that wayland-rs has a pure-Rust implementation available.

@kchibisov
Copy link
Member

Can you elaborate on this? I know that wayland-rs has a pure-Rust implementation available.

any API wants a wl_proxy from libwayland, so unless you write a EGL/Vulkan platform to use whatever wayland-rs provides, this won't change.

@bjorn3
Copy link

bjorn3 commented Oct 31, 2023

I believe Haiku has Xlib compatibility through the xlibe library, but not XCB compatibility. So without a native implementation of Haiku's GUI api, dropping Xlib support would mean dropping Haiku support.

@kchibisov
Copy link
Member

dropping Xlib support would mean dropping Haiku support.

if they are interested they can send patches like redox did to even have their native platform working.

@ids1024
Copy link
Member

ids1024 commented Oct 31, 2023

Haiku apparently has some kind of Wayland support too. Which is better for running applications currently?

Native Haiku support in winit would be good.

@ids1024
Copy link
Member

ids1024 commented Oct 31, 2023

Going further, do we want to add a feature to remove these two external libraries from our X backend altogether and just use x11rb's pure-Rust backend?

Doesn't this run into rust-windowing/raw-window-handle#120?

@psychon
Copy link
Contributor

psychon commented Dec 19, 2023

Cursor handling code (could use https://github.com/esposm03/xcursor-rs instead)

x11rb's cursor feature could be used as well. I do not know Xlib's API, but this was modeled after what libxcb-cursor does. And from your link, xcursor-rs seems to at least try to do something similar (but it uses e.g. XDG env vars for finding stuff which libxcb-cursor and x11rb do not and I doubt a lot that libX11 uses anything like that).

isn't cursor being drawn on the server? Or we must submit a Xcursor theme to the server? How does it all work? I thought you just send names, it's not wayland with its client side cursors in the end of the day.

This is X11. Of course everything is horrible. ;-)

Like windows, pixmaps, fonts, cursors are objects. Once created, one can tell the server to use the cursor when the mouse is inside "your" window. For creating a cursor, there are many options, but besides the legacy ones, you basically update an image (or a list of images and a delay between them) to the X11 server. Everything else happens client side and is convention.

@kchibisov kchibisov added this to the Version 0.31.0 milestone Jan 15, 2024
notgull added a commit that referenced this issue Jun 22, 2024
Another one bites the dust.

This replaces the code dependent on libxcursor with equivalent code
written using x11rb, featuring its special "cursor" module.

cc #3198

Signed-off-by: John Nunley <dev@notgull.net>
notgull added a commit that referenced this issue Jun 22, 2024
Another one bites the dust.

This replaces the code dependent on libxcursor with equivalent code
written using x11rb, featuring its special "cursor" module.

cc #3198

Signed-off-by: John Nunley <dev@notgull.net>
notgull added a commit that referenced this issue Jun 22, 2024
Another one bites the dust.

This replaces the code dependent on libxcursor with equivalent code
written using x11rb, featuring its special "cursor" module.

cc #3198

Signed-off-by: John Nunley <dev@notgull.net>
notgull added a commit that referenced this issue Jun 22, 2024
Another one bites the dust.

This replaces the code dependent on libxcursor with equivalent code
written using x11rb, featuring its special "cursor" module.

cc #3198

Signed-off-by: John Nunley <dev@notgull.net>
notgull added a commit that referenced this issue Jun 23, 2024
Another one bites the dust.

This replaces the code dependent on libxcursor with equivalent code
written using x11rb, featuring its special "cursor" module.

cc #3198

Signed-off-by: John Nunley <dev@notgull.net>
notgull added a commit that referenced this issue Jun 24, 2024
Another one bites the dust.

This replaces the code dependent on libxcursor with equivalent code
written using x11rb, featuring its special "cursor" module.

cc #3198

Signed-off-by: John Nunley <dev@notgull.net>
notgull added a commit that referenced this issue Aug 10, 2024
Another one bites the dust.

This replaces the code dependent on libxcursor with equivalent code
written using x11rb, featuring its special "cursor" module.

cc #3198

Signed-off-by: John Nunley <dev@notgull.net>
notgull added a commit that referenced this issue Aug 10, 2024
Another one bites the dust.

This replaces the code dependent on libxcursor with equivalent code
written using x11rb, featuring its special "cursor" module.

cc #3198

Signed-off-by: John Nunley <dev@notgull.net>
notgull added a commit that referenced this issue Aug 23, 2024
Another one bites the dust.

This replaces the code dependent on libxcursor with equivalent code
written using x11rb, featuring its special "cursor" module.

cc #3198

Signed-off-by: John Nunley <dev@notgull.net>
notgull added a commit that referenced this issue Aug 23, 2024
Another one bites the dust.

This replaces the code dependent on libxcursor with equivalent code
written using x11rb, featuring its special "cursor" module.

cc #3198

Signed-off-by: John Nunley <dev@notgull.net>
raphamorim pushed a commit to raphamorim/winit that referenced this issue Aug 24, 2024
Another one bites the dust.

This replaces the code dependent on libxcursor with equivalent code
written using x11rb, featuring its special "cursor" module.

cc rust-windowing#3198

Signed-off-by: John Nunley <dev@notgull.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

5 participants