The ffi function wrapper need to be changed because in the 2021 edition, when
the capture is moved into the closure, it moves the individual field instead
of the whole wrapper. But we need to move the whole wrapper because the Drop
of the wrapper will delete the C++ closure, and we don't want to call the
closure after it is deleted.
It can be activated using the `SIXTYFPS_DEBUG_PERFORMANCE` environment
variable, which takes a comma separated list of options.
This could be extended in the future with different locations for the
overlay (corner_top_left, corner_top_right, etc.) - but this is a simple
start.
cc #728
On Windows 10, the creation of symlinks by normal users requires
enabling the developer mode, which may or may not be acceptable in
corporate environments with restricted IT setups.
We introduced the symlinks for the shared special key codes mapping,
which instead this patch places into a shared sixtyfps-common crate.
Share the code that defines the key with a macro over all the backends using
a symlink.
This is a symlink rather than exposing the macro directly since we add this
module in every backend, and each backend re-declares the macro to handle
the part that it needs. This needs to be a symlink because it will also be shared
with the compiler that does not depends on sixtyfps-corelib
Due to a bug in Qt's implicit sharing in QPalette, the resolve mask of
QGuiApplicationPrivate::app_pal would get changed with an unrelated setColor
call and thus break color resolution from a new base palette when the theme changes.
For the MCU port, we need to proccess the image to save them in the binary
in a convenient format.
This patch start this work by trying to anaylyze what format should an image
be using, and saving it as a texture in the binary.
The current graphical backend and the C++ frontend are not yet supported
Avoid creating an intermediate array of items to free the graphics resources.
Instead call run-time function with the item tree as a parameter, which is traversed.
It's practically the same data structure that was previously created, except
that it is shared/global and has little holes for the dynamic tree items, but those are easy to skip.
The font resolution function querying fontdb is fast now, so we can
always call it when rendering text. That way we don't need all the
indirection in the text_size(), etc. functions, we don't need an entry
in the item graphics cache for the font and we can avoid a lot of
property dependencies.
Unfortunately the text property was not included in the property dependency chain
for the cached Font.
This is fixed by delaying that with a getter function, but in the mid term
we should be able to remove this again once
femtovg learns lazy font resolution.
Set QStyle::State_Active conditional to whether the window is active,
which maps to Qt's active window concept and winit's has-focus (until we
render popups differently).
If the root item is a Window, then we use the default-font-* properties as the basis
for all unspecified font properties in text rendering.
This patch centralizes the code for retrieving that in the runtime window.
If this becomes a performance bottleneck, then we could cache it in a
box-pinned property in the run-time window.
- Have the cursor at the right place when clicking on end of line
- make sure not to render new lines if there are some when in single-line mode
- Enter should make a new line
since there is only one function in it, just put that function in the Window
then there is no need to heap alocate a dyn FontMetrics just to call this function.
In preparation of having mutiple-lines TextInput, we will need to give more
data to this function so it no longer belong in FontMetrics
Also remove the unused FontMetric::line_height()
Under these windowing systems, we receive a QString text from Qt that
contains a terminal control character (like \u{3} for ctrl+c). We
decided to supply the character for the key (for example 'c' for Ctrl+C)
to the application, so activate the conversion from the key code when
control characters are present.
With winit, we receive first a key down input event with the virtual key
code (for example C for Ctrl+C), followed by a ReceivedCharacter event
with a terminal control character. We choose to ignore that and instead
take the previously received key code and try to use that instead.
Fixes#441
The RenderCache (slab and generation) is always in a refcell, so we can
just pass that through. This also eliminates the ItemGraphicsCache
wrapper in the GL backend.
This will allow more fine grained borrowing in the future.