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

Expose compositor from subcompositor #429

Closed

Conversation

Friz64
Copy link
Contributor

@Friz64 Friz64 commented Nov 5, 2023

This PR implements one way of exposing a WlCompositor from a SubcompositorState.

To avoid a potential XY problem, here's my situation:

I want to change the input region of a (sub)surface of a wayland frame. I only have access to a SubcompositorState. To change the input region, I need to create new regions that I can pass into set_input_region. SCTK only allows the creation of new regions through a compositor, but not through a subcompositor.

See:

Is exposing the compositor from the subcompositor the correct way of going about this, and if so, is my solution good?

By implementing ProvidesBoundGlobal, I can leverage the Region abstraction from SCTK: https://docs.rs/smithay-client-toolkit/latest/smithay_client_toolkit/compositor/struct.Region.html#method.new

@Friz64
Copy link
Contributor Author

Friz64 commented Nov 5, 2023

I only have access to a SubcompositorState.

Well, the frame's constructor only takes a SubcompositorState, but it could theoretically also take a CompositorState. I'm not too sure if this would be the best solution though, as it feels clunky (e.g. winit would need to add another special case here: https://github.com/rust-windowing/winit/blob/e9210555c187c0573b1d13d44fa83035ef3323b0/src/platform_impl/linux/wayland/window/state.rs#L273-L280).

@Friz64
Copy link
Contributor Author

Friz64 commented Nov 24, 2023

I only have access to a SubcompositorState.

Well, the frame's constructor only takes a SubcompositorState, but it could theoretically also take a CompositorState. I'm not too sure if this would be the best solution though, as it feels clunky (e.g. winit would need to add another special case here: https://github.com/rust-windowing/winit/blob/e9210555c187c0573b1d13d44fa83035ef3323b0/src/platform_impl/linux/wayland/window/state.rs#L273-L280).

I guess adding a special case is fine.

@Friz64 Friz64 closed this Nov 24, 2023
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

Successfully merging this pull request may close these issues.

1 participant