Commit graph

6560 commits

Author SHA1 Message Date
Simon Hausmann
f0544b4cb8 WIP: dma2d for solid fill, glyph and textures
This is the wrong place :-)
2022-06-15 14:36:41 +02:00
Olivier Goffart
5ca8f08ea7 swrenderer: add a renderer that operate dirrectly onh the frame buffer 2022-06-15 13:28:35 +02:00
Olivier Goffart
c10173ff2d swrenderer: Refactor so that we can add a BufferRenderer 2022-06-15 13:28:32 +02:00
Simon Hausmann
f21fca0e83 Use upstream git repo for the touch driver
My panic-probe patch was merged
2022-06-15 13:27:25 +02:00
Simon Hausmann
975d0b16e7 Increase the size of the reload "button" in the slide puzzle 2022-06-15 13:27:25 +02:00
Simon Hausmann
7c63067a7d Fix missing glyphs in the slide puzzle when building on Linux
Add more crude fallback handling for Linux
2022-06-15 13:27:25 +02:00
Simon Hausmann
c5c0c2f07a Enable panic-probe by default for stm32
Combines with aee3269cf6821c00d82079d6ca9b5feecd22514a
2022-06-15 13:27:25 +02:00
Simon Hausmann
6129ffd101 Fix compilation with --cfg slint_debug_performance 2022-06-15 13:27:25 +02:00
Simon Hausmann
5883bdd168 Make the shuffle button finger friendly on stm32h7 2022-06-15 13:27:25 +02:00
Simon Hausmann
e9a127c373 Fix display of final empty tile in the slide puzzle
Replace the use of the unknown glyph with a rectangle for the last tile.
2022-06-15 13:27:25 +02:00
Simon Hausmann
644b202824 Fix some missing glyphs in the slide puzzle on stm32h7
Implement some very rudimentary font fallback handling and add some
the glyphs the puzzle needs.

The font fallback handling deserves to go into a module shared between GL backend and the compiler.

For the character selection we should scan the text elements for
literals just like we do for the font size.
2022-06-15 13:27:25 +02:00
Simon Hausmann
c3972d802f Make the slide puzzle landscape friendly for the stm32h7
This change of the design makes the tiles bigger (more finger friendly) and moves the
"tabs" and "controls" from the top and bottom to the left and right
hand side.

The over effect was removed from the check box as it sometimes stays.
2022-06-15 13:27:25 +02:00
Simon Hausmann
c862bd5b1e Fix random moves in the slide puzzle on stm32
Unfortunately the RNG on the stm32 may fail when called repeatedly in quick successsion - maybe it's running out of entropy.
That would result in the random moves being not random at all because we map the error to 0.

Instead, use rand's pseudo rng in the slide puzzle, seed it once (when it works) and
then re-use the rng throughout.
2022-06-15 13:27:25 +02:00
Simon Hausmann
cf26c14b2e Fix the plaster font not showing up in the slide puzzle on the stm32
Make sure to embed whatever we pick as default font, but also register any
custom imported fonts.
2022-06-15 13:27:25 +02:00
Simon Hausmann
20e5826f6e Fix compilation of generated Rust code when embedding fonts
The quote crate doesn't escape the characters for the character map entry.
This causes problems with some of the characters we chose by default, and in
general (if we ever do coverage based) will break. So for now just store
the char strait as u32.

There's an opportunity to use different character map encodings to cover the
common case that we don't actually need u32, but that's not for this patch.
2022-06-15 13:27:25 +02:00
Simon Hausmann
87e81ac45a Shuffle the tiles of the slide puzzle randomly
This is overkill by mixing the device rng and the rand crate, but it works.
2022-06-15 13:27:25 +02:00
Simon Hausmann
641a1fda38 Make it possible to use the panic probe on stm32h7
The ft5336 crate enforced the panic-semihosting for no apparent reason. Switch to a fork.
2022-06-15 13:27:25 +02:00
Simon Hausmann
b618f21b80 Make the slide puzzle also work with the simulator 2022-06-15 13:27:25 +02:00
Simon Hausmann
dc2c66c701 Make the slide puzzle work on the stm32h7 with the background
Resize the jpeg to a smaller version.
2022-06-15 13:27:25 +02:00
Olivier Goffart
e00d948123 Port the memory game to micro controlers
Command used to run:

```
SLINT_SCALE_FACTOR=0.6 SLINT_EMBED_GLYPHS=1 SLINT_FONT_SIZES=8,11,10,12,13,14,15,16,18,20,22,24,32 CARGO_TARGET_THUMBV6M_NONE_EABI_LINKER="flip-link" CARGO_TARGET_THUMBV6M_NONE_EABI_RUNNER="probe-run --chip RP2040" SLINT_STYLE=ugly  SLINT_PROCESS_IMAGES=1 cargo +nightly build -p memory --no-default-features --features=i-slint-backend-mcu/pico-st7789 --target=thumbv6m-none-eabi --release && udisksctl mount -b /dev/sda1 && elf2uf2-rs -d target/thumbv6m-none-eabi/release/memory
```

Maybe not everything is needed (like there is no text)
Also need to add flags in .cargo/config because there is no build.rs
2022-06-15 13:27:25 +02:00
Olivier Goffart
01ddee2fba Some debug for the touch screen 2022-06-15 13:27:25 +02:00
Olivier Goffart
515be9cd92 MCU profiler: show the profiles to the screen 2022-06-15 13:27:25 +02:00
Olivier Goffart
0c9cf2a76f MCU WIP: quick and dirty port of the slide_puzzle demo 2022-06-15 13:27:25 +02:00
Olivier Goffart
4640662713 Terminal device for the MCU backend 2022-06-15 13:27:25 +02:00
Olivier Goffart
86effb662f Make the printer demo compile for the pico with the st7789 driven screen
CARGO_TARGET_THUMBV6M_NONE_EABI_LINKER="flip-link" CARGO_TARGET_THUMBV6M_NONE_EABI_RUNNER="probe-run --chip RP2040" SLINT_STYLE=ugly SLINT_PROCESS_IMAGES=1 cargo +nightly run -p printerdemo --features=mcu-pico-st7789 --target=thumbv6m-none-eabi
2022-06-15 13:27:25 +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
Olivier Goffart
7eff0e5a30 Fix compilation in presence of a Cargo.lock
We use new clap api so we need to raise the version
2022-06-14 11:34:40 +02:00
Simon Hausmann
a5f29d401b Fix panic when clicking on an open printer queue in the printer demo with the partial renderer
When computing the dirty regions, the call to geometry() might end up
querying a value that's computed by the layout. For the layout
computation we might end up calling ensure_updated() on a repeater,
which then might destroy components. The destruction involves freeing
cached dirty rectangles (via free_graphics_resources), and that also
requires a write access to the cache. So after retrieving the property
tracker for the dirty geometry, drop access to the cache before calling
geometry().
2022-06-14 11:33:00 +02:00
Simon Hausmann
3e40835ec2 Fix more clap deprecation warnings 2022-06-14 11:32:03 +02:00
Olivier Goffart
014c827194 swrenderer: Optimize image drawing by using premultiplied colors 2022-06-14 11:23:02 +02:00
Simon Hausmann
ca74f91320 Fix clap deprecation warnings 2022-06-14 11:06:54 +02:00
Simon Hausmann
fbd3a47bac Build the lsp binary for the vs code extension also for aarch64
Need that binary for the raspberry pi demo
2022-06-13 15:11:39 +02:00
Olivier Goffart
5f03320ded Some changelog entries 2022-06-13 14:47:04 +02:00
Simon Hausmann
65419240b4 Bump resvg/usvg versions 2022-06-12 10:58:42 +02:00
Olivier Goffart
0556ff6db9 vscode online extension preview: throttle the preview update
Only send preview update command to the webview if the webview is ready to compile
2022-06-11 15:12:35 +02:00
Olivier Goffart
0df15f8cb4 vscode online extension preview: use Promise to load files 2022-06-11 15:12:35 +02:00
Olivier Goffart
40072e958a vscode web extension: Preview WIP
Start working on a preview for the web extension in a tab
2022-06-11 15:12:35 +02:00
Simon Hausmann
798e3070b7 Prospective fix for missing publish to vs code market place
We publish to OpenVSX first and if that succeeds then we publish to vs code market place.
The former sometimes times out, where the publishing actually succeeds but the GH
action step fails. Thus we never run the VS code market place step.

Swap the two steps as a starter and equip the OpenVSX step with continue-on-error: true
as at that point we have built the package, just publishing failed.
2022-06-10 08:58:15 +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
Olivier Goffart
100eb305a3 vscode: document how to debug the web extension 2022-06-09 20:11:14 +02:00
Tobias Hunger
10a6e191f0
Mention accessibility in README 2022-06-09 10:56:55 +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
Olivier Goffart
dc7117eeb1 swrenderer: move some computation outside of loop 2022-06-08 16:36:46 +02:00
Simon Hausmann
f0c14bea54 Fix memory leak with repeated elements in generated Rust code
The generated code provides a PinnedDrop implementation that calls
free_component_item_graphics_resources. We must annotate the components
correctly to make sure to the drop implementation is called and graphics
resources are released.

Thanks to Jocelyn!

Fixes #1261
2022-06-08 15:56:47 +02:00
Simon Hausmann
7cead49f8c Add ChangeLog entry for text input changes 2022-06-08 09:23:31 +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
Simon Hausmann
17e86ff6f0 Fix VS code warning about recommended extensions
Rust-Analyzer's extension id was renamed
2022-06-07 16:13:30 +02:00