Treating the Tab key as text disallows handling Shift-Tab because
the shift modifier will not be passed down. This makes the
handling of Tab analogous to Escape, Return and other non-text
keycodes.
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.
As per commit 0c02f133f3daee146b805149e69bba8cee6727b2 in qtbase (qt6),
quit() on QCoreApplication on macOS calls [NSApp terminate], which will
not return to main. The latter however is documented behavior, and
sixtyfps-viewer for example relies on it.
The contents of a Text would wander to the left with center and
right alignment because some size calculations don't take the
maximum available width into account.
The button bevel was rendered upside down, which happens due to some
weird double y-axis inversion, which goes away when passing the QWidget
pointer to the style. When using the Qt backend, we can do that.
When the PM_LayoutHorizontalSpacing pixel metric is negative, we're supposed to call
layoutSpacing() on the style. Until we have a detailed
overview over the controls, a default spacing is better than -1 :-)
The database is not empty, as the changed expect() suggests, but instead
it just means that the family could not be found. This can happen for
example with something like this:
export App := Window {
Text {
text: "Ok";
font-family: "Non-existent";
}
}
or it can also happen when loading the printer demo in the online
editor, where a custom font is supposed to be available but that's not
implemented for wasm builds.
So instead of panicing, fall back to querying for a last-resort
sans-serif family.
For Linux, we register fontconfig's choice for sans-serif, otherwise
fontdb has defaults for macOS and Windows, and for wasm we register our
copy of DejaVu. So that cannot really fail....
When processing window specific events, or generally when accessing
the ALL_WINDOWS refcell, keep the time for borrow to an absolute
miniumum. That way any subsequent method calls may further acquire the
refcell.
This patch re-organizes the entire deeply nested window event handling
in a function with slightly less indentation.
Fixes a panic when calling hide on a Window from within a callback
handler.
Fixes#539
Use the new fontdb API:
* When registering embedded fonts, we don't need to make a copy of the
embedded font data anymore.
* We don't have to mmap the font files ourselves anymore, fontdb can
do this now for us.
Don't apply constraints to the winit window if we're in fullscreen mode,
as that might result in us allocating a surface that's bigger than the
screen, which in turn may result in the process exiting right away.
Fixes#532
- The Tab must be drawn before the contents, because the style draws something under the active tab,
outside of its region
- Also set the QStyleOptionTab::HasFrame flag since we are in the equivalent of a QTabWidget
Some styles recompute the size based on the contents given in the QStyleOptionButton,
Some styles need to be given the icon in their content size. And this was not done properly