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.
Now that we store the layer textures as Rc<Texture>, before rendering a
layer we can take a clone of a possibly existing layer texture and if if
the layer's tracker is dirty, we can re-use the existing layer texture
if it's the same size.
This avoids unnecessary texture allocations.
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>
Fix a logic bug in the function to determine if we need to fall back to
other fonts or if the font we selected provides complete coverage.
In the common case where coverage is given, we start with some unknown
coverage (in old_uncovered_*) and end up with empty
remaining_required_*_coverage. That also happens to be less than
old_uncovered_*. Since that check came first, we always returned
"Improved", which meant we still built up the font fallback list, even
though we didn't need to. Fix the order of checks to avoid that.
I want to track component structure changes in the window without
generating more code. So use a more generic name for the init_*_items
functions, so that I can add the functionality I need in there.
Also add a register_component to PlatformWindow and call that.
I want a more generic name as I want to do to track component structure
changes in addition to resource freeing and I do not want to add another
call into the generated code.
Clean up texture caching in the GL renderer
In preparation for moving the image decoding and caching of decoded
image data into the core library, change the texture cache to be really
a cache of textures. Previously it cached Rc<CachedImage>, which could
have also been just a CPU side image. However this was "run-time"
asserted. Instead, with this patch it's an `Rc<Texture>` and that will
always be GPU side.
The display-interface-spi crate the not flush the internal fifo between the write
and the changes of the CS and DC pins, which result of changing these pins before
the screen recieve all the data over the spi and causes artifacts on the screen.
So re-implement the logic in our crate and use `transfer` instead of `write`
which flushes the fifo correctly.
This requires us to flash the cache before swapping the frame buffer pointer.
With slide puzzle span drawing with image tiles goes from ~100ms down to ~50ms,
and theme switching between simple and berlin from ~140ms to ~72ms.
This is with the line renderer.
When using repeaters - like in the slide puzzle - and during renderer a component
gets deleted, we call free_graphics_resources and try to free
the dirty rectangle list in the partial renderer cache. At that point the cache is
already mutably borrowed, which causes a panic.
As remedy, apply the mutable borrow more fine grained and not right when calling
render().
Implement basic accessibility (a11y) support, using the Qt backend.
_This should get us started, but accessibility support is an additional way to interact with UIs that is very different from the "graphical way" most users will interact with the UI. No single PR will "make a toolkit accessibility", this needs to be an ongoing effort!_
Parts of this PR:
* Add functions to access a11y-related properties to Component
* Add helper functions to Item struct
* Handle accessible- properties in the compiler
* Add documentation, add description, enforce some basic rules
* Make the Text element accessible by default
* Don't optimize away accessibility property in the LLR
* Ensure that accessibility property are marked as used
* Add some accessibility properties to the native style widgets
* Support for bool and integer `accessible` properties
* Implement basic support for accessibility
* Make basic widgets accessible by default
* Make slider focus-able and interactable with keyboard
* Tell a11y layer about value changes
* Generate QAccessible constants using bindgen
* Don't expose the `accessible` properties when using the MCU backend: There is no backend to make use of them
* Handle focus change based on keyboard focus of the window
* Report accessible widgets at correct positions
* Allow for (virtual) focus delegation at the a11y level
* Calculate value step size dynamically
* Make sure to not send notifications to a11y backend about dead objects
The mcu simulator builds i-slint-core with the std feature, but debug_log maybe
used in #[no_std] contexts, so we need to use a re-export rather than rely on std
being present
The slide puzzle makes use of the source-clip-* properties and that unveiled three issues:
* For the scale factor from image space to physical pixel space (sx/sy),
use the source clip size, as we're only drawing those
pixels. That means that the call sites of draw_image_impl need to pass the
correct original image size if there is no source clip.
* Similarly, the scaled_clip is in image coordinates, but needs to be relative to the source-clip-x/y
* The geometry for the target rectangle on screen
must originate at (0, 0) so that the apllication of
sx/sy only changes the size.