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

Implement WinRT support in SDL2 raw-window-handle shim #1183

Merged
merged 1 commit into from
Dec 21, 2021

Conversation

nathanvoglsam
Copy link
Contributor

Now that #1182 is merged the crate is up to date with the latest raw-window-handle release. This release contains the results of my PR from February which adds support for WinRT (UWP) to the crate. raw-window-handle now exposes a WinRt variant which contains an opaque c_void pointer to what is expected to be a CoreWindow*. SDL2 provides the same mechanism with the SDL_SYSWM_WINRT enum variant and the winrt field on SDL_SysWMinfo, which is what I modeled the WinRt variant in raw-window-handle after.

As a result, this PR includes the additions necessary to shim the CoreWindow pointer from SDL2 to raw-window-handle, allowing the use of this crate on UWP.

The changes simply adds the required match branch to output the RawWindowHandle::WinRt variant, as well as modifying the union definition so we can shim it from SDL2. SDL2 already handles the UWP pain for us.

Here's egui rendered with DirectX 12 in a UWP app on Windows 10.
image

I would include it running on my Xbox Series S too if I hadn't loaned it to someone.

The source code for my implementation of the UWP app is here https://github.com/nathanvoglsam/aleph.

@Cobrand Cobrand merged commit cfdb435 into Rust-SDL2:master Dec 21, 2021
@Cobrand
Copy link
Member

Cobrand commented Dec 21, 2021

Thanks!

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.

2 participants