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

Gate non-wasm32 winit features behind flags. #1178

Closed

Conversation

TannerRogalsky
Copy link
Contributor

Let me state, up front, that I would not be upset if this PR were declined. I recognize that it makes some decisions that I did not consult anyone on.

Motivation: these changes (along with #1117 and #1118) allow the winit "native" shell to compile and run on the wasm32-unknown-unknown target. This presents a homogeneous and, IMO, very pleasant development target for native/web cross-platform Iced GUIs.

It requires that a custom event loop is run on wasm32 platforms. Personally, I think that that is acceptable. Winit's basic event loop does work on wasm32-unknown-unknown but it is not particularly pretty and EventLoopExtRunReturn is not implemented (on which Iced currently depends) is not implemented. I'm of the opinion that this is fine: the requirement that users implement their own event loop on web seems like a reasonable tradeoff for using a native shell on a platform that is not really native.

It does not introduce any changes to existing users of the crate on non wasm platforms.

@hecrj hecrj force-pushed the master branch 2 times, most recently from e6ab610 to 8b0f2e6 Compare January 19, 2022 15:04
@hecrj
Copy link
Member

hecrj commented Jan 27, 2022

I am guessing most of these will be fixed by hecrj/window_clipboard#18 once it is merged and released.

I think it'd be great to offer an Application implementation for Wasm out of the box too. Maybe we conditionally compile with run_return only on native platforms.

@TannerRogalsky
Copy link
Contributor Author

I can certainly appreciate that. I find that the way that winit implements the "does not return" event loop via an uncaught exception to be not acceptable for my use cases. But providing that option to users would be absolutely an improvement.

I'll leave this open for reference and/or discussion. Feel free to close as you see fit and thanks for the consideration!

@hecrj
Copy link
Member

hecrj commented Jan 31, 2022

Closing since this should be addressed by hecrj/window_clipboard#18 and #1096.

@hecrj hecrj closed this Jan 31, 2022
@TannerRogalsky TannerRogalsky deleted the native-web-fixes branch January 31, 2022 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants