Added a common interface that:
- Uses closures instead of static functions. This should allow easier
refactoring in the future.
- Returns a handle which is invalidated on `Drop`. This should avoid
situations where the event loop has exited, but an observer is still
called because the user spawned the application later on.
- Is properly main-thread safe.
This interface is placed in winit-common, to allow using it in both
winit-appkit and winit-uikit.
This avoids using JavaScript exceptions to support `EventLoop::run_app`
on the web, which is a huge hack, and doesn't work with the Exception
Handling Proposal for WebAssembly:
https://github.com/WebAssembly/exception-handling
This needs the application handler passed to `run_app` to be `'static`,
but that works better on iOS too anyhow (since you can't accidentally
forget to pass in state that then wouldn't be dropped when terminating).
The API is integrated into the `WindowEvent::Pointer*` API and is
present in form of `TabletTool` variant on corresponding data entries.
For now implemented for Web, Windows, and with limitations for Wayland.
Fixes#99.
Co-authored-by: daxpedda <daxpedda@gmail.com>
Allow updating IME state atomically to make it easier for platforms
where it's atomic by its nature, like Wayland. The old API is marked
as deprecated and is routed to the new atomic API.
Co-authored-by: dcz <gilapfco.dcz@porcupinefactory.org>
* iOS: Refactor queued_gpu_redraws out from AppStateImpl
To allow AppStateImpl to be Copy, and to move redraws into the window in
the future.
* iOS AppState: Avoid RefCell and static mut
Instead, prefer Cell and Copy types, as those will never have crashes
on re-entrancy / if forgetting to make a state transition.