Now that the SoftwareRenderer can be constructed, it is
finally possible to have your own WindowAdapter
Revert "Hide the `renderer()` function from the public API"
This reverts commit ff6653c77e.
Note: the addition of MinimalSoftwareWindow::set_size is there because
it would be a breaking change for user who called set_size on the
MinimalSoftwareWindow while also using the WindowAdapter trait.
This was the case of a test.
The same problem theorically exist with set_position and position, but
is unlikely to be a problem because i don't think people would use the
position with a MinimalSoftwareWindow
The renderer() is now public as well. That's because I want to make sure
that the scealed trait don't have non-provided method
This patch adds a `close()` function that can be called to close a popup
window, and a `close-to-click` boolean that can be set to false to
disable the default behavior.
With Qt and eglfs it may happen that when creating a popup, Qt delivers
a paint event via show() before we've had a chance to set the component
on the slint::Window. In that case unwrapping the component in
draw_contents() panics.
This fix is covered by reproducing the same scenario using public
MinimalSoftwareWindow API.
Fixes#2799
Co-authored-by: Olivier Goffart <olivier.goffart@slint-ui.com>
Add WindowEvent::ScaleFactorChanged and made set_scale_factor on
WindowInner private.
This achieves what #2486 tried to do, but using the clean platform
window event interface.
This simplifies the logic for how to apply window related requests as
they can be applied to the winit window immediately.
It also simplifies the state handling in the WinitWindowAdapter, as
there's no more distinction between mapped and unmapped. We always map
now (winit does).
One related change in core is that the window properties are now sent to
the backend before calling show(), instead of after.
When a global shortcut, like ^-Cmd-Q on macOS to lock the screen, causes
a loss of window focus, we'll receive a key event from the windowing
system for the modifier, but we'll never receive the "Q" in this example
(as press or release). So later, when we regain focus, we'd assume that
our keyboard modifier state is still "pressed ^/Cmd", which is
incorrect. Therefore assume that a loss of window focus implies a reset
keyboard of keyboard modifier state.
Fixes#2098
The default impl of unregister_component in WindowAdapterSealed would call free_graphics_resources
on the rendere. Any re-implementation would have to do the same,
which the winit backend forwarded through
the winit backend specific internal renderer interface.
Instead, the original call site for unregister_component now calls
free_graphics_resources and unregister_component (for accessibility tree dirty notification).
Replace register_root_component in the WindowAdapterSealed altogether with
a default font size getter on the renderer.
This is overall simpler and allows removing the doc-hidden getter in the software renderer.
* janitor: Fix clippy error drop_copy
Clippy says cache_entry is Copy, so calling drop on it is useless since
it will drop a copied value.
* janitor: Fix clippy error
... about cloning a double ref.
Co-authored-by: Olivier Goffart <olivier@woboq.com>
Permit the style metrics to provide a `default-font-size` and bind that
to the `Window` if set. If not provided, then the backend can set a
`default-font-size`. By ensuring that the value is non-zero at run-time,
we can later introduce a rem unit that can act as factor relative to
this non-zero font size.