The previous approach of calling send_event on a timer has the disadvantage
or re-entering the event loop for every queued event. Any requested redraw
after one of those events will end up actually drawing, even if that frame could be
replaced by the next event's redraw without being shown to the user.
winit also doesn't expose publicly its web Runner send_events method that would
allow us to queue the events outside and pass them all together.
We can however queue the events inside winit by putting the event loop in
ControlFlow::Poll mode so that winit batches them itself.
This has the side effect of processing and painting those events using
requestAnimationFrame.
To achieve this we take advantage of winit processing send_event calls
synchronously, possibly while on a native event handler, by entering the
event loop just to send WakeEventLoopWorkaround, set the event loop in
Poll mode, exit, and call send_events again with our event which then
ends up being queue in the web event loop's Runner until the next animation
frame where all queued events are processed and redrawn together.
If the global opacity is zero, we don't need to paint rectangles, etc.
This shortcut is a compromise between opting out much later on femtovg
level and too early before querying properties of the rectangle. We
still want to do the latter as somebody might depend on that.
When blitting a rectangular texture, we can disable the anti-aliasing on the edges
that femtovg applies by default. That avoids an extra triangle strip for
this stroke to apply anti-aliasing.
cc #215
Handle Input event from the input directly instead of going through winit
for the TextInput.
Note that this doesn't handle the composition event well, so the text is
only considered written when it is accepted
This also separates the blend-to-screen part of render_layer into a
helper function, as that will be useful in the future with public layer
elements.
Relates to #725
Delegate the decision how to implement the Clip element entirely into the backend,
where the GL backend can now explicitly render
children into a layer, instead of the hack with a layer in the renderer's
state and the extra save/restore pair.
With the help of dark-light crate this is now exposed as dark-style
boolean property in NativeStyleMetrics.
Co-authored-by: Olivier Goffart <olivier@slint-ui.com>
Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>
The README.md contains the warning that used to be in lib.rs.
Add README.md files to all internal crates
... pointing to the official public crate to use instead.
Rename internal crates
fixup: README files
fixup rename