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

refactor(client): bump to winit 0.30 & fixes #523

Merged
merged 10 commits into from
Aug 12, 2024

Conversation

elmarco
Copy link
Contributor

@elmarco elmarco commented Aug 6, 2024

Update code to winit 0.30, various large refactoring necessary.

Related fixes.

My main motivation was fixeing a crash on wayland with HiDPI, and also use update to latest crates.

Fixes: #375
Fixes: #521
Fixes: #522

Copy link
Contributor

@pacmancoder pacmancoder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clarification needed on cliprdr-native API change

Copy link
Member

@CBenoit CBenoit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many thanks!! Nice work.

Create a hidden window instead. This allows for easier setup of
clipboard channels while the GUI may not be ready yet.

Signed-off-by: Marc-André Lureau <[email protected]>
This solves broken/crashing display on wayland with HiDPI.

Signed-off-by: Marc-André Lureau <[email protected]>
It should now be done from an ActiveEventLoop, during ApplicationHandler
callbacks, like resumed().

Signed-off-by: Marc-André Lureau <[email protected]>
Signed-off-by: Marc-André Lureau <[email protected]>
Copy link
Contributor

@pacmancoder pacmancoder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!
@elmarco Is PR ready to be merged?

@elmarco
Copy link
Contributor Author

elmarco commented Aug 10, 2024

Looks good to me! @elmarco Is PR ready to be merged?

yes! thanks

@CBenoit CBenoit enabled auto-merge (rebase) August 12, 2024 02:20
Copy link
Member

@CBenoit CBenoit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you!!

Comment on lines +29 to +39
pub fn new(
event_loop: &EventLoop<RdpOutputEvent>,
input_event_sender: &mpsc::UnboundedSender<RdpInputEvent>,
) -> anyhow::Result<Self> {
// SAFETY: We drop the softbuffer context right before the event loop is stopped, thus making this safe.
// FIXME: This is not a sufficient proof and the API is actually unsound as-is.
let display_handle = unsafe {
std::mem::transmute::<DisplayHandle<'_>, DisplayHandle<'static>>(event_loop.display_handle().unwrap())
};
let context = softbuffer::Context::new(display_handle)
.map_err(|e| anyhow::anyhow!("unable to initialize softbuffer context: {e}"))?;
Copy link
Member

@CBenoit CBenoit Aug 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: We can’t actually guarantee that event_loop is dropped after the context at this point, we are not the ones owning it. Only the owner can guarantee that, and thus it’s only possible to know that at the call site. As such, this API is unsound and the unsafe block may cause an undefined behavior in the future if we misuse the API. I don’t consider this a blocker since this is not part of the public API of the IronRDP crates, and we can address that in the future.

@CBenoit CBenoit merged commit 0f23809 into Devolutions:master Aug 12, 2024
8 checks passed
@elmarco
Copy link
Contributor Author

elmarco commented Aug 12, 2024

thanks!

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

Successfully merging this pull request may close these issues.

Update winit dependency to version >=0.29
3 participants