and use Rc<dyn PlatformWindow> instead. The alias has to stay with the ffi
functions though and the item vtable definitions,
because we don't have an Rc<> template in C++.
Previously: Window is an Rc<WindowInner>, which has an Rc<dyn
PLatformWindow> - and weak references the other way around.
Now: Rc<dyn PlatformWindow> is the root of window ownership. The impl
PlatformWindow has a slint::api::Window, which just holds a WindowInner.
This change is incomplete on a few levels, mainly that neither of the
code generators nor the interpreter is ported.
For hide() we don't really need Rc<Self>, and for show() we had Rc<Self> because
for example for winit we need a Weak<Self> for the thread-local mapping of
window id to window.
However that can be encapsulated in the PlatformWindow impl using Rc::new_cyclic,
there's no need to expose this in the trait.
Move the self_weak of WindowInner into the impl of PlatformWindow. Most implementations already have it anyway.
While right now the method returns a `WindowRc`, at the end of the series
it should return a `&Window`.
From that `&Window` we can get to `&WindowInner` and all receivers there
are `&self`.
When the renderer does not re-implement visit_clip, we call combine_clip.
Then we're missing out on an optimization the GL renderer does: When the resulting clip region
is empty, we do not need to recurse into children for rendering.
That itself reduces the property dependency chain and avoids unnecessary
updates when invisible (clipped) children change properties.
This simplifies the renderer handling - the FontRequest arriving there
will always be resolved.
And this reduces the amount of property dependencies: If a Text elements
specifies a font-family, no dependency to the window's
default-font-family is created.
Every backend will do something different with the string that needs to go into the clipboard.
Qt will convert it to a QString, copypasta to a String, in theory it could be written
directly to a socket.
Given that we don't know what the perfect representation on the backend side is, passing
a string slice avoids any immediate conversions.
Instead of a new() function and a start() and no stop() function, create the collector
when we want to measure and drop it when we're done.
This will also make it possible to move the collector into the renderer
in the future.
This includes the cache of decoded images, the HTMLImage element support
and the SVG rendering adapter.
The objective is that Image holds an ImageInner, which is not a path
anymore that the backend has to process, but instead always either
decoded image data, a pointer to a static texture or an SVG tree that
can be rendered to the desired size.
The as_any() method returning a `&mut dyn Any` meant that the type has to be
'static. The class solution of returning &()
doesn't work because it has to be a mutable ref. Therefore just return an Option.
Add flags that enable the Button to be used as a Toggle, e.g. for use in toolbars or similar places.
Co-authored-by: Simon Hausmann <hausmann@gmail.com>