Commit graph

305 commits

Author SHA1 Message Date
Lukas Jung
e4559f0ea6
Fix Bugs Introduced by GL Jitter on Resize Fix (#1397) 2022-07-15 10:03:03 +02:00
Simon Hausmann
9799571396 Make it possible to implement the ItemRenderer trait with a lifetime
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.
2022-07-12 20:37:14 +02:00
Simon Hausmann
0b20f58ada GL backend: speed up updates to layer content
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.
2022-07-11 23:19:05 +02:00
Simon Hausmann
94b4f81be6 Translate logical to physical coordinates for window position and size
Our API exposes physical coordinates, Qt operates on "logical" coordinates.
2022-07-08 18:37:01 +02:00
Simon Hausmann
937c37677e Add API for setting and getting the size of a Window in Rust and C++ 2022-07-08 18:37:01 +02:00
Simon Hausmann
3ce9977f0a Add slint::Window::(set_)position
Fixes #323
2022-07-08 18:37:01 +02:00
Tobias Hunger
82000405b3
qt_accessible: Fix warning suggesting to use std::move (#1400) 2022-07-08 17:04:53 +02:00
Tobias Hunger
20c1c45253
Button: Implement support to make the Button a toggle (#1384)
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>
2022-07-08 16:17:06 +02:00
Olivier Goffart
ceb030a5f7 stm32h735g: be sure to wait until the the buffer is no longer shown before drawing onto it 2022-07-06 17:06:40 +02:00
Olivier Goffart
4ecc2cd1c0 swrenderer: add a renderer that operate dirrectly on the frame buffer 2022-07-06 17:06:40 +02:00
ogoffart
6b15d2e479 Bump version number to 0.2.6 2022-07-06 09:58:14 +00:00
Lukas Jung
4f5986167b
Add Tutorial to set up VSCode Debugging for RP Pico (#1390) 2022-07-05 17:24:39 +02:00
Tobias Hunger
a30533a053 Do not needlessly create the tree of accessible items
... only do that when the OS accessibility layer requests this
data.
2022-07-05 16:53:29 +02:00
Olivier Goffart
9ee13035de Qt backend: rerun the build script when qt_accessible.rs changes as it contains C++ 2022-07-05 10:10:09 +02:00
Simon Hausmann
9661e66bb4 GL backend: reduce memory allocations for text rendering
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.
2022-07-05 09:26:13 +02:00
Tobias Hunger
29248f0c6f Qt: Update the accessibility tree when the component tree changes
This makes the Qt accessibility story actually useful: It will now
update as the models in the UI update:-)
2022-06-30 11:51:49 +02:00
Tobias Hunger
dd59d41ee6 Rename init_*_items to register_component
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.
2022-06-30 11:51:49 +02:00
Tobias Hunger
581533f302 Rename free_*_graphics_resources to unregister_component
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.
2022-06-30 11:51:49 +02:00
Tobias Hunger
539dec2962 a11y: Allow to update the accessibility tree
Qt sends the necessary crate/delete events automatically as the
placeholder QObjects are created/deleted.
2022-06-30 11:51:49 +02:00
Lukas Jung
63970dcced Implement size() and set_size() for SimulatorWindow 2022-06-30 10:59:33 +02:00
Lukas Jung
d63407066d Add documentation to WinitWindow::size() and set_size(). 2022-06-30 10:59:33 +02:00
Lukas Jung
e1b4727c9c Fix resize jitter bug on macOS with GL Backend 2022-06-30 10:59:33 +02:00
Olivier Goffart
deba176c72 Janitor: bump dependencies versions 2022-06-29 09:02:43 +02:00
Simon Hausmann
966e2586a6
Clean up texture caching in the GL renderer (#1375)
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.
2022-06-27 19:01:00 +02:00
Olivier Goffart
50bd72c535 stm32h735h: copy assets from flash to ram so we can access them 2022-06-18 20:00:21 +02:00
Olivier Goffart
00583ade05 Add env variable to put data into a different section
This also makes sixtyfps::Slice Send and Sync
2022-06-18 20:00:21 +02:00
Olivier Goffart
e777cb0fea MCU simulator: fix partial rendering by not drawing the non-dirty rect
Fixes #1324
2022-06-17 10:34:11 +02:00
Olivier Goffart
b62132392d stm32h735g: Use a intermediate line vector in the RAM for rendring
It is much faster than blending on the frame buffer which is in hyperram
2022-06-17 09:30:09 +02:00
Olivier Goffart
711fa66ca3 rp2040 backend: use DMA to send pixels to the screen via SPI 2022-06-17 09:30:09 +02:00
Olivier Goffart
5494e4ec28 mcu pico: fix the screen artifacts by re-implementing display-interface-spi
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.
2022-06-16 21:36:15 +02:00
Olivier Goffart
87c10eea31 MCU pico: adjust the threshold for the key handling 2022-06-16 18:31:58 +02:00
Tobias Hunger
821b5fc141
qt_accessible: Fix another warning about an unused constant (#1352) 2022-06-16 15:14:04 +02:00
Tobias Hunger
fcf8528bf3
qt_accessible: Fix some warnings (#1351) 2022-06-16 13:48:22 +02:00
Lukas Jung
45406ddef0
Make the Pico use Interrupts and WFE (#1337) 2022-06-15 17:15:58 +02:00
Simon Hausmann
1cac472f4e Enable panic-probe by default for stm32
The ft5336 crate enforced the panic-semihosting for no apparent reason,
but this is fixed upstream now.
2022-06-15 15:16:03 +02:00
Olivier Goffart
d5e598a5d6 Janitor: Update rp-pico 2022-06-15 13:44:07 +02:00
Simon Hausmann
0c97cb0fcc Enable the data cache for stm32h7
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.
2022-06-15 13:15:19 +02:00
Simon Hausmann
b7b1101adb Bump system clock frequence on stm32h735
Up to 400 Mhz seems to work. Also fixed assert to match the octospi controller for the hyperram (1 instead of 2).
2022-06-14 19:08:42 +02:00
Simon Hausmann
65419240b4 Bump resvg/usvg versions 2022-06-12 10:58:42 +02:00
Simon Hausmann
2d2eb70b51 Fix panic about multiple mutable borrows with the software 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().
2022-06-10 08:38:34 +02:00
Tobias Hunger
07ad20a09c
Basic Slint accessibility support (#1294)
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
2022-06-08 20:42:10 +02:00
Simon Hausmann
565262f5c1 Fix formatting
Re-ran `cargo fmt`
2022-06-08 09:23:31 +02:00
pubg-hacks
aed71311ca Add a read-only propery to TextInput, LineEdit and TextEdit 2022-06-08 09:23:01 +02:00
Simon Hausmann
52b82632e1 janitor: remove unnecessary function parameter 2022-06-08 09:06:31 +02:00
Olivier Goffart
dc5d1e87cd Compile fix for the MCU simulator
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
2022-06-07 00:05:01 +02:00
Olivier Goffart
a72115518d Move the software renderer to core 2022-06-04 13:40:50 +02:00
Simon Hausmann
44f7bc1279 Fix rendering of source clipped images with the MCU renderer
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.
2022-06-02 15:51:07 +02:00
Simon Hausmann
22af9c0a33 janitor: Use SharedString instead of String in GL renderer image cache
We can avoid a string copy.
2022-06-02 11:04:21 +02:00
Olivier Goffart
fa6be65a04 Revert "Rename the free_graphics_resources to component_destroyed"
This reverts commit 1b9fee96c16f7a660ed2c14bb3287fceedc72ba7.

The MCU backend still need the array of item, so it's too realy for this change
2022-05-31 10:48:24 +02:00
Olivier Goffart
ad2d19165a Rename the free_graphics_resources to component_destroyed
And do not iterate over the items anymore
2022-05-31 10:48:24 +02:00