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.
There's on guarantee that the pointers returned by get_proc_address are
always valid. Our implementation might, but since the trait isn't
sealed, somebody else could implement it badly.
Make text_input_byte_offset_for_position and text_input_cursor_rect_for_byte_offset
low-level in the API, where the implementation becomes easier. Two
helper functions in TextInput in turn collect the necessary parameters
and thus also reduce the amount of duplicated code.
This also decouples the renderer further from the window.
Accept the OpenGL context as trait impl. This means we can also move the rendering notifier
into the femtovg renderer create and get rid of
the proxy Renderer trait impl.
Don't require passing a dyn WindowAdapter. This was only used for
calling request_redraw(), which a proper window adapter should do anyway
if has_active_animations() is true.
This is a regression from https://github.com/slint-ui/slint/pull/2708,
where previously we would have destroyed the winit window and that's how
it would have disappeared. Now we just need to call set_visible(false);
Now that we always create a window, we end up also creating an event
loop, and that's inherently incompatible with the rust test harness that
creates threads.
We can try to re-enable this later on platforms where we can run an
event loop in a thread. I have a local WIP patch for that.
Remove the generic window handle owner part of the API. Instead assume
that the caller provides safety for the given window handles, like we do
for FemtoVG and like softbuffer does it in its public API.
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.
Don't try to include the slint preview here, we don't need it. An
alternative would be to also add a docs symlink here, but this seems
more pragmatic for the time being.
So that we don't need to query the geometry multiple time, and this pave
the way to not have the geometry in the items
Part of #1932
As a drive by, fix the clipping of the Path element which incorrectly
offseted the clip by (x,y).
Similar fixes happen in the Clip element in some renderer, but that
didn't have effect because x and y are always 0 for the Clip element
The old version depends on an old version of xcb that crashes.
Even if cargo update should fix the problem, it won't happen automatically with old Cargo.lock
Fixes#2682
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
Instead leave it out and return Default::default() in Rc::new_cyclic().
The map state handling gets quite ugly, because it needs to go into a OnceCell. On the upside, if we succeed with creating the winit window
in new() in the future, then that entire cell goes away.
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.
We must tell winit that we want a transparent surface by default, to
avoid that winit sets an opaque region on the wayland surface.
In terms of the surface, we already prefer a GL config with a color
buffer that supports transparency.