Commit 2b7a1eebcd introduced a deep clone of the winit event loop proxy inside the event run function callback.
That introduced constant wakeups because cloning an event loop
proxy creates a new one, which adds a source to the cf run loop and also
explicitly triggers a wakeup.
Fortunately we don't really need that clone, a reference works just fine and is faster.
* Provide an internal behavior parameter to run_event_loop() that we can use
from the preview to not quit when the last window was closed.
* Fix Drop for the winit event loop GraphicsWindow to drop the backend window correctly
when unmapping, not when the graphics window dies. Otherwise QuitOnLastWindowClosed doesn't work.
This way we can serve preview requests immediately.
This basically makes post_event safe to call before the event loop is entered.
The events will be queued up and sent when the event loop
is created and we have access
to the proxy, which will take over the queue.
* sixtyfps_timer_start needs to *take* the timer id out of the Rust
timer to avoid that the subsequent drop stops the timer again
* For the Qt event loop, call `timer_event()` once before entering
QCoreApplication::exec(), to schedule any timers that were started
beforehand.
* Added a way to quit the event loop gently, in order to use that
from the C++ unit test.
Similar to the window properties, use a property tracker with a change
handler in window to issue redraw requests. This allows eliminating the
forced repaints in the event loop after event processing and ensures
that the UI is repainted when programmatically setting a property, for
example.
Synchronize title/background/etc. once when the window is mapped and
afterwards lazily when the corresponding property tracker notifies us.
Since that callback can happen at any point in time and to also capture
potentially multiple changes, this first triggers a wakeup of the event
loop, when the actual application of properties happens.
With commit
9ca87ab312
and
c62b0e5316
the winit event loop sends our KeyPress for
winit::event::WindowEvent::KeyboardInput only when the virtual key code
matches our specially encoded keys. For regular keys we rely on
winit::event::WindowEvent::ReceivedCharacter, for which we sent only
KeyRelease (which TextInput listens for), but not KeyPressed. With
this patch we simulate press & release.
* Rename logo to the more generic meta as keyboard modifier.
* Use control as the real modifier and map command key to it with
winit and keep Qt semantics as-is.
We rely on ReceivedCharacter to send the event to the item for
combinations like Ctrl+C, instead of the single KeyEvent from winit. We
use the latter only for special key codes.
This will give a nicer API to expose to .60. If the struct weren't
repr(C) then the booleans would be nicely packed, but alas that's not
happening. On the other hand we're not keeping many instances of them
around.
Fold CharacterInput into KeyPressed/KeyReleased and store the "key" as a string.
Also, instead of exposing the KeyCode we're encoding special characters
into the string.
Reduce the dependency of the GLRenderer to a new trait that exposes the
EventLoopTarget and EventLoopProxy. Those are provided by either an
winit::event_loop::EventLoop or, once the loop is started using the
self-consuming run(), by the event loop target provided to the run_fn.
This way renderers can be created from either within run or before.
The initial event loop instance is kept in TLS. When starting the loop,
it's taken out and instead the event loop target is placed into a scoped
tls variable.