When a second canvas is visible, only animations in the first canvas
resulted in updates and visible animation. An animation in the second
canvas wouldn't result in repaints.
When we start an animation, we request a redraw on all windows and
return with `ControlFlow::Poll` to winit.
Winit then schedules an animation frame request, and in the callback the
redraw request events are delivered. For the first window we call
`update_animations()`, a new tick is detected (different than the
previous one) and animated properties are dirty and yield new windows.
Then right away we get called again with a redraw request for the second
window. update_animations() determines that the instant::now() is the
same, and has_animations() returns false. So at the end of the event
handler we return fail to return `Poll` and therefore no animation frame
request is created, which means the animations just stop.
Fix this by calling update_animations() only once, when all input events
have been processed and the redraw events are up for delivery next.
This is visible in the preview canvases in the documentation, if a
canvas other than the first has animations.
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.
* Build the backends without rtti unless needed
Only the interpreter needs the rtti generated code.
* Since `SlintElement` emits `#[cfg(feature = "rtti")]` tokens, each
crate using `SlintElement` needs to have an `rtti` feature.
* The selector gets backend specific rtti selection features, in order
for the interpreter to enable them.
* Enable rtti when building the C++ project with the interpreter enabled
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>
This re-aligns the ttf-parser and rustybuzz dependencies in the GL
backend. There's still one other version of ttf-parser pulled into the
compiler due to fontdue, but that's minor.
When "combining" information from winit's ReceiveCharacter and
KeyboardInput events, then do not create a second KeyPress event
when the KeyboardInput contained a control character.
This makes us not send duplicate events for `Tab`, but leaves the
handling for e.g. `Ctrl-C` unchanged.
Bump the femtovg dependency to ensure we get the fix for error detection on the renderer side
and handle it in the GL backend side by rendering text to the 2D canvas, followed by a panic.
This was moved up to before the resize handler can be installed, as that would end up
clearing the canvas when resizing.
A message on the 2D canvas was chose over an alert message box, as the latter
is rather intrusive and would be a nightmare if many of them popped up
when viewing our docs with a browser
configured that way.
resvg produces an image with pre-multipled alpha and anecdotal evidence suggests that HTMLImageElement on an SVG does, too.
This might need further restriction for the HTMLImageElement case just to svg, but
let's try this.