In future versions of winit, it'll only be possible to create windows
when the active event loop signals availability. To upgrade to the latest
accesskit version as well as to run on iOS, we're going to implement support
for this earlier and stop using the deprecrated create_window() function
on the regular (not running) EventLoop.
Co-Authored-By: Olivier Goffart <olivier.goffart@slint.dev>
Based on API review, PlatformBuilder becomes BackendSelector with
a slightly smaller API surface but more options, such as selecting
Metal or Vulkan rendering.
On Wayland hiding a window requires destroying the surface, which
means destroying the winit window as well as the underlying graphics
surface. The latter is tricky as we have to keep the renderer around,
as our WindowAdapter trait's `renderer()` function returns a `&dyn
Renderer` and that also has to work without a window (to obtain text
metrics).
Fixes#4225
Co-Authored-By: Olivier Goffart <olivier.goffart@slint.dev>
Updated the version from 1.1 to 1.2
Renamed the header to "Slint Royalty-free Desktop, Mobile, and Web Applications License"
Added definition of "Mobile Application" and grant of right
Moved "Limitations" to 3rd section and "License Conditions - Attributions" to 2nd section
Added flexibility to choose between showing "MadeWithSlint" as a dialog/splash screen or on a public webpage
Moved the para on copyright notices to section under "Limitations"
For the backend selector, this means that when a backend is selected explicitly,
and initialization fails, don't try `create_default_backend()` but
propagate the error.
For the Rust code generator, propagate the first ensure_backend()
errors. Any subsequent onces (unlikely, since the first thing any
public new() calls is ensure_backend) will unwrap.
Pass around a factory function to create the renderer,
instead of a factory function that creates the window adapter. The adapter is
always the same anyway, and this way the WinitWindowAdapter's new
also doesn't have to be generic.
This also prepares for adding a second skia renderer
constructor later to select a specific variant.
Implement the partial rendering with winit and our software renderer.
When the background is not opaque, we must still initialize all the
pixel with 0 otherwise we blend over the previous frame.
(That wasn't visible before because the buffer was always empty)
- Use NonZeroU32 in the OpenGLContextWrapper interface (correct API for the future)
- Don't render zero sized windows with the software renderer and FemtoVG
We would pass `physical_size_to_slint(&self.winit_window().inner_size())`, which is
identical to `slint::Window::size()`, which
calls `size()` on the WindowAdapter, which
returns the above.
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.
Despite the documentation of softbuffer claiming that the high bits
should be 0, it seems to be interpreted as an alpha value when the
window is actually transparent.
And the values are considered as premultiplied alpha
Also use a Premultiplied aplha for the buffer so we can even have
transparent window with the software renderer
The creation of the renderer might fail, for example if we tried to
create an OpenGL renderer on a display that doesn't support OpenGL. We
should catch that in the future and fall back to the software renderer.
In order for GLX support to work, we need to create the X11 window with
the same visual as in the GLX configuration. That requires delaying
the creation of the window.
This is done in four parts:
- The window builder is re-introduced in the winit backend create
internal renderer interface.
- The glcontext helper code for wasm was moved into a separate function
(less indentation).
- The loop over different display preferences was replaced with a
preference to the "window system native GL interface" over EGL,
which should achieve the same as the fix for #2162. Upstream glutin
defaults to this and so do various downstream projects.
- Use glutin-winit for the actual display selection.
This covers the FemtoVG bits of #2269
Having a const generic for that didn't turn to be a good API.
Also made the C++ side more difficult
(Also renamed buffer_stride to pixel_stride)
Closes#2135
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.