-
Notifications
You must be signed in to change notification settings - Fork 915
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
It is a foot-gun that EventLoopProxy
is !Sync
on macOS
#3448
Comments
I mean, That said, the underlying |
Seems like this will need some work on the web too, @daxpedda? |
Yeah, it is pretty easy to fix a program that fails to compile on macOS for this reason on the user side--I just like the idea that if a winit program compiles on a supported platform and doesn't noticeably use any platform-specific features it should compile on all supported platforms. By the way, I really appreciate the keyboard input handling rework you all recently pushed through. The fact that it associates the physical/logical and textual input interpretations of a single key press to a single event helped me easily solve a bug of mine that I had previously been using a super hacky work-around for (relating to pressing the T button to open a text input, and not wanting that same T button press to also cause a T character to be typed in after opening it). |
Co-authored-by: daxpedda <[email protected]> Closes: #3448
Co-authored-by: daxpedda <[email protected]> Closes: #3448
Co-authored-by: daxpedda <[email protected]> Closes: rust-windowing#3448
Hi all, thank you for your consideration. Someone previously created #3220 on this subject, but then closed their own issue when they found that there actually is an obstacle to making
EventLoopProxy
Sync
on macOS. However, I'm creating this issue for further discussion because I think it is unfortunate that the API is as such.EventLoopProxy
beingSync
only on non-macOS platforms makes it so that one can write code with winit that doesn't seem to be using any platform-specific features but nonetheless fails to compile on macOS while compiling fine on other platforms, which I think goes against winit's generally very nice goals and behaviors in terms of cross-platform abstraction.Some possible ways I can imagine dealing with this include:
EventLoopProxy
always!Sync
EventLoopProxy
Sync
on macOS by wrapping its internals in a mutexEventLoopProxy
always!Sync
, but create a platform-specificSyncEventLoopProxy
type which is likeEventLoopProxy
butSync
, and whichEventLoopProxy
can be converted into through a platform specific-APIEventLoopProxy
Sync
and document that that feature flag can only be enabled on certain platformsThe text was updated successfully, but these errors were encountered: