Skip to content

On Web, use the new WebCanvasWindowHandle#3270

Merged
daxpedda merged 3 commits intorust-windowing:masterfrom
daxpedda:web-rwh-06
Dec 22, 2023
Merged

On Web, use the new WebCanvasWindowHandle#3270
daxpedda merged 3 commits intorust-windowing:masterfrom
daxpedda:web-rwh-06

Conversation

@daxpedda
Copy link
Copy Markdown
Member

Now we don't have to set data-raw-handle on the canvas anymore.

@daxpedda daxpedda added the DS - web Affects the Web backend (WebAssembly/WASM) label Dec 17, 2023
@daxpedda
Copy link
Copy Markdown
Member Author

Unfortunately WebCanvasWindowHandle is supposed to be !Send, for good reasons. Currently asking in IRC how other platforms are doing this.

@daxpedda daxpedda requested a review from madsmtm as a code owner December 17, 2023 21:34
@daxpedda
Copy link
Copy Markdown
Member Author

So I went ahead and made Window::window_handle() return HandleError::Unavailable when not on the main thread. To do this I had to change the call to raw_window_handle_rwh_06() from Window because it was using maybe_wait_on_main().

@madsmtm I didn't actually change anything in MacOS/iOS behavior because it still calls maybe_wait_on_main() with the SendSyncWrapper there, but maybe you want to change that to return HandleError::Unavailable as well?

@madsmtm
Copy link
Copy Markdown
Member

madsmtm commented Dec 22, 2023

maybe you want to change that to return HandleError::Unavailable as well?

Sure, see #3288.

@daxpedda
Copy link
Copy Markdown
Member Author

Alright, let me go ahead and merge this then.

@madsmtm
Copy link
Copy Markdown
Member

madsmtm commented Dec 22, 2023

But returning WebCanvasWindowHandle instead of WebWindowHandle, while it shouldn't be a breaking change, in practice it will be, since a lot of users will assume that it returns WebWindowHandle, and panic if it doesn't.

So I think you should update the changelog to reflect that.

@daxpedda
Copy link
Copy Markdown
Member Author

But returning WebCanvasWindowHandle instead of WebWindowHandle, while it shouldn't be a breaking change, in practice it will be, since a lot of users will assume that it returns WebWindowHandle, and panic if it doesn't.

Hm, alright.

@daxpedda daxpedda merged commit 8cd3aaa into rust-windowing:master Dec 22, 2023
hecrj pushed a commit to iced-rs/winit that referenced this pull request Mar 19, 2024
hecrj pushed a commit to iced-rs/winit that referenced this pull request Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DS - web Affects the Web backend (WebAssembly/WASM)

Development

Successfully merging this pull request may close these issues.

2 participants