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

Split wrapper around "display" and "window" into different types #37

Closed
ids1024 opened this issue Dec 21, 2022 · 0 comments
Closed

Split wrapper around "display" and "window" into different types #37

ids1024 opened this issue Dec 21, 2022 · 0 comments
Labels
enhancement New feature or request Needs Design Work
Milestone

Comments

@ids1024
Copy link
Member

ids1024 commented Dec 21, 2022

@i509VCB suggested this on Matrix. I don't know about other platforms, but for Wayland it could definitely be desirable to not create a new registry, etc. for every window. Doesn't make a difference for uses with a single window, but with a lot of wl_surfaces it definitely is a good idea to not duplicate everything like that.

@john01dav john01dav transferred this issue from rust-windowing/swbuf Dec 22, 2022
@john01dav john01dav added enhancement New feature or request Needs Design Work labels Dec 23, 2022
@ids1024 ids1024 added this to the 0.3 milestone Jan 6, 2023
ids1024 added a commit that referenced this issue Jan 6, 2023
WIP implementation of
#37. Currently
compiles on Linux, and splits parts of Wayland code to not need
duplication for multiple windows.
ids1024 added a commit that referenced this issue Jan 6, 2023
A `Context` is created with a display handle, and a `Surface` is created
with a `&Context` and a window handle. Thus multiple windows can be
created from the same context without duplicating anything that can be
shared. This API is broadly similar to `wgpu` or `glutin`.

On Wayland, the `Context` contains the `EventQueue`, which is shared
between windows, and the `WlShm` global. On X11, `Context::new` checks
for the availability of XShm, and contains a bool representing that as
well as the `XCBConnection`. The shared context data is stored within
the window in an `Arc`.

On other platforms, the display isn't used and `Context` is empty. This
does however test that the display handle has the right type on those
platforms and fail otherwise. Previously the code didn't test that.

Closes #37.
ids1024 added a commit that referenced this issue Jan 6, 2023
A `Context` is created with a display handle, and a `Surface` is created
with a `&Context` and a window handle. Thus multiple windows can be
created from the same context without duplicating anything that can be
shared. This API is broadly similar to `wgpu` or `glutin`.

On Wayland, the `Context` contains the `EventQueue`, which is shared
between windows, and the `WlShm` global. On X11, `Context::new` checks
for the availability of XShm, and contains a bool representing that as
well as the `XCBConnection`. The shared context data is stored within
the window in an `Arc`.

On other platforms, the display isn't used and `Context` is empty. This
does however test that the display handle has the right type on those
platforms and fail otherwise. Previously the code didn't test that.

Closes #37.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Needs Design Work
Development

No branches or pull requests

2 participants