Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upstdweb support for eventloop 2.0 #797
Conversation
ryanisaacg
referenced this pull request
Feb 20, 2019
Closed
[WIP] Add wasm32-unknown-unknown support through stdweb #589
iceiix
referenced this pull request
Mar 2, 2019
Open
Allow compiling winit to wasm32-unknown-unknown target #2
Osspial
added this to the EventLoop 2.0 milestone
Mar 6, 2019
ryanisaacg
added some commits
Mar 10, 2019
Walther
referenced this pull request
Mar 10, 2019
Open
Written comparison of possible GUI approaches, with pros and cons #84
ryanisaacg
added some commits
Mar 11, 2019
This comment has been minimized.
This comment has been minimized.
|
Ok, so I've made a bunch of progress on this (most of it was just churning through various bad designs that didn't work at all) and it's in a state where you can make a window, run an event loop, and receive events! I made a roadmap in the PR text to give an indication of where I'm at on the implantation, and the unresolved questions I have about the design. If any maintainers (or users for that matter) have opinions, please let me know! |
This comment has been minimized.
This comment has been minimized.
solson
commented
Mar 13, 2019
•
|
Apologies if this question is naive, but would it make sense for winit to support wasm-bindgen's web-sys directly, rather than stdweb? According to this thread, stdweb plans to become a wrapper around web-sys that's a bit higher level (but also more expensive), while web-sys provides the bare minimum only-pay-for-what-you-use interface for Web APIs. Either way, it would be fine to support both, or stdweb now and web-sys later, so I don't mean to imply the PR should be blocked over this. |
This comment has been minimized.
This comment has been minimized.
|
Essentially: stdweb is what I'm more familiar with and what my downstream project uses. I would be open to supporting both (for example the rand crate allows either via feature flags) if someone else contributes the web-sys backend. |
This comment has been minimized.
This comment has been minimized.
|
General thoughts on the API questions you have:
I'd agree with that for now. We can revisit this once we figure out #696, but for now only having a single canvas is simplest.
Yes, and I'd say to actually make the canvas fullscreen. This is a feature that's commonly supported across browsers (video fullscreening, for instance), it's useful to have, and it's consistent with the other backends.
Eeeeh, I'm less sure about this. If we do end up supporting multiple canvases at some point there's no clean solution for what to do when multiple icons get set on different
I'd say no for now. Using the same File API across both desktop platforms and web platforms implies that the data they provide can be used the same way, which doesn't seem to be the case (I'd be surprised if |
grovesNL
referenced this pull request
Mar 15, 2019
Merged
Add wasm32-unknown-unknown/WebGL support #2554
ryanisaacg
added some commits
Mar 16, 2019
Osspial
referenced this pull request
Mar 17, 2019
Closed
Expose `winit::platform::emscripten::set_main_loop_callback` #814
ryanisaacg
added some commits
Mar 19, 2019
This comment has been minimized.
This comment has been minimized.
|
Just a heads up: my progress on this is going to slow down for a while, as I'll probably not have as much time to work on it for the next few weeks. |
bors bot
added a commit
to gfx-rs/gfx
that referenced
this pull request
Jun 8, 2019
This comment has been minimized.
This comment has been minimized.
blm768
commented
Jun 8, 2019
|
After a little testing, it's looking like the basic canvas creation and event handling seem to be working (at least with a slightly generous definition of "working") with the While I'm thinking about it, I've got a couple of thoughts I've been considering:
|
spennydl
referenced this pull request
Jun 9, 2019
Open
Provide a way to return from the event loop #900
This comment has been minimized.
This comment has been minimized.
|
@ryanisaacg Are you intending to maintain the stdweb backend after this PR lands? |
This comment has been minimized.
This comment has been minimized.
|
@ZeGentzy Yes, but without a guarantee that I'll have a lot of time for it. I'll do my best to keep it updated, though; at the very least I'll be using it downstream. |
This comment has been minimized.
This comment has been minimized.
|
Okay. Should prolly add a new column and row to the table in https://github.com/rust-windowing/winit/blob/master/CONTRIBUTING.md then. Also to the tables in https://github.com/rust-windowing/winit/blob/master/FEATURES.md when you are done. @Osspial can probably add you to rust-windowing |
Osspial
changed the base branch from
eventloop-2.0
to
master
Jun 13, 2019
ryanisaacg
referenced this pull request
Jun 15, 2019
Closed
Instant is not available on WASM + Proposed Solution #926
ryanisaacg
added some commits
Jun 17, 2019
felixrabe
suggested changes
Jun 17, 2019
|
|
||
| event_loop.run(|event, _, control_flow| { | ||
| println!("{:?}", event); | ||
| console!(log, format!("{:?}", event)); |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
ryanisaacg
Jun 21, 2019
Author
Member
Yup, before merge I'll be doing some cleanup (this is still actively in development and I use this example to test.)
hecrj
suggested changes
Jun 19, 2019
hecrj left a comment
|
Looks great! Let me know if I can help! |
ryanisaacg
added some commits
Jun 21, 2019
This comment has been minimized.
This comment has been minimized.
hecrj
commented
Jun 25, 2019
•
|
I am currently working on unifying both the In summary, I have created a new The The Additionally, I have made some other changes:
Let me know what you think! |
This comment has been minimized.
This comment has been minimized.
blm768
commented
Jun 26, 2019
|
@hecrj: I haven't looked through your changes thoroughly, but I'm thrilled to learn that it's working (particularly with Have you happened to look at the changes in #845? If I recall correctly, they had already started on multi-canvas support, and the That raises a question about |
This comment has been minimized.
This comment has been minimized.
|
(Just noticed that this is a Draft PR that I didn't know about previously. Quick intro with very helpful screenshot here: https://github.blog/2019-02-14-introducing-draft-pull-requests/) |
This comment has been minimized.
This comment has been minimized.
hecrj
commented
Jun 26, 2019
•
I see that #845 uses platform-specific builder attributes to take control of an already existing canvas in the document. Maybe we could take this approach and simply make the
Not sure what the desired behavior is in this case, but the current one reports mouse events just fine even when the canvas loses focus. Right now, the only events that are focus-dependent are keyboard events. |
ryanisaacg
added some commits
Jul 9, 2019
This comment has been minimized.
This comment has been minimized.
|
@ryanisaacg As we discussed on Discord, I've made a new web branch with @hecrj's fork. It should be noted that it was four commits behind your branch, so you might want to push those changes to it, if they are still applicable. Anyways, closing. Thanks! |
ZeGentzy
closed this
Jul 10, 2019
This comment has been minimized.
This comment has been minimized.
|
@ryanisaacg Can you open a tracking issue with the things at the top? Thanks. |
ryanisaacg commentedFeb 20, 2019
•
edited
Unresolved design questions:
Fileobject which isn't as useful as it is on desktopImplementation:
Testing / docs:
CHANGELOG.mdif knowledge of this change could be valuable to users