* Remove the `new` function from the main impl and use the slightly
less visible From conversion trait
* Make the inner Rc<Window> pub(crate) instead of pub
* Instead, provide a public as_any() accessor that the Qt backend can use
If we were to add `sixtyfps:🪟:Window` to the re_exports, then
this clashes. We might rename the former, but this is a cleaner naming
in any case.
Relates to #333
When the widget itself is part of a hierarchy and some parent widget defines
font properties (such as weight, etc.) that aren't defined in .60, we would
inherit those for rendering, but not when measuring.
Since when measuring we don't have a widget, this patch disables all font
property merging from the widget hierarchy.
In this case, the last line will have elipsis on the last line
when no more line can be printed
Note that the behavior is different with the Qt backend
Glutin's desire to default to srgb mysteriously creates a black window
on Windows 10 under Vmware. I tested this with many glutin apps and examples,
they all exhibit the same: black window,
working when query for srgb is turned off.
This used to work, so I suspect some change underneath on the vmware svga
driver perhaps, or Windows.
This requires the image size query to be window independent and go
through the backend instead.
This implies minor changes for the Qt backend and bigger ones for the GL
backend:
* There exists now a thread-local IMAGE_CACHE, which is used by the
backend's image_size() function as well as by the renderer for
loading CPU side images.
* The image remain as decoded images in there (including SVG tree)
and the window now has a texture_cache, which holds CachedImage
with ImageData::Texture.
* Rendering an image item therefore fetches the CPU side image,
calls upload_to_gpu() on it, which creates a new Rc<CachedImage>
and that's stored in the texture_cache.
* The texture cache continues to be pruned when hiding the window.
Split the vertical and horizontal pass into different property cache
This will allow to implement "height for with"
This patch does not port the Rust or C++ binding yet
When a Text element has wrapping enabled, it should not have zero
minimum size. Otherwise the layout will give it a height of zero in the
layout in the test case and that'll make the text disappear. There are
different options but this patch goes for minimum height as if no
wrapping was enabled (so at least one line plus forced line breaks).
Fixes#246
By moving the image cache to the GraphicsWindow we can now decode images
first without a window and later upload to the GPU.
This also allows removing the window_map_pending property hack.
Decouple the Texture from the HTML image loading logic and introduce an
ImageData state that represents just the DOM element.
This will make it possible later to also load the images without a canvas.
Instead a "manual" refresh is needed (like mouse mover). This regressed
in commit 8d2554ff3b, which removed the
event loop proxy clone. For some reason that's not sending the event
from the DOM callback, but winit requires a clone of the proxy.
the must_resize was not set to true when the with and height are set to the prefered
size, but it must be set for the layout to apply.
Note that even with this patch, the window will be resized to the preferred
size when reloading. Because we have no way to know there if this is the first time
the window is shown, or not.
This issue is not quite specific to the gallery, a simpler test case is
this:
```
App := Window {
preferred-width: 500px;
preferred-height: 750px;
HorizontalLayout {
Rectangle {
background: blue;
}
}
}
```
As there is no fixed width/height set, the size is calculated by layout and
apply_window_properties() sets the inner size correctly on the winit window.
However the width/height properties on the root Window item are not set, remain
zero and thus lead to incorrect rendering. They are not set because they are
identical with what window.inner_size() reports - we assume no change and that
they are in sync.
The bug however is in the creation phase, when we decide on an initial size to
pass to the window_builder, we should also set those on the root item. This is
where window.inner_size() and the root item's width/height get out of sync.