Commit graph

1368 commits

Author SHA1 Message Date
Olivier Goffart
43c7f57b0f spawn_local: initialize the platform if not initialized before the call
Take the opportunity to refactor a bit the way the global platform or
context is accessed

Fixes: #5871
2024-08-21 13:26:04 +02:00
Simon Hausmann
d978a856fc Fix bug reference 2024-08-21 12:55:35 +02:00
Enyium
f82a785b81 Extended VecModel docs regarding interior mutability. 2024-08-20 21:56:21 +02:00
Olivier Goffart
a9f526491a Timer Element
Closes #5724
2024-08-16 16:36:38 +02:00
Tobias Hunger
3b17f19be0 core: Do not panic when popups try to find their parent
Popups may have normal `Item`s as parrent, while all the other
components always have a `DynamicTree` as a parent. So do not
panic when some component ends up with an `Item` as a parent.

Just return `None` instead of panicing.

We probably need to make the focus-handling more aware of
popups eventually, but this stops the panics.

Fixes: #5826, #5830
2024-08-14 09:08:31 +02:00
Olivier Goffart
547e00b6f9 Tab with modifier shouldn't change focus
(eg: alt+tab or control+tab)
Failed attempt at fixing #5823
This doesn't fixes it because the problem is that the key event are
forwareded as syntetic events when we gain focus, and they are not in a
order that allow to detect alt+tab
2024-08-12 13:40:58 +02:00
Simon Hausmann
fbe0b23684
Improve documented workaround for Tokio integration (#5736)
Document the two constraints of using Tokio futures in Slint, and how to work around them.

Fixes #5733

Co-authored-by: Olivier Goffart <olivier.goffart@slint.dev>
2024-08-09 08:28:43 +02:00
W Etheredge
80ae11cd80 Use associated constants on number types 2024-08-01 07:53:48 +02:00
Simon Hausmann
789fc74f07 doc: hide internal RenderingNotifier trait
We implemented it for the required public FnMut signature.
2024-07-31 10:44:15 +02:00
Simon Hausmann
b67fcce4a3 Add a new descendants api as well as deeper element queries to ElementHandle 2024-07-15 11:30:34 +02:00
Olivier Goffart
b96390cd75 Fix double click within a Flicakble
Fixes #5586
2024-07-10 15:22:17 +02:00
Olivier Goffart
256ff1a5f5 software renderer: PhysicalRegion::iter to be non-overlapping rectangles 2024-07-10 10:58:27 +02:00
Simon Hausmann
882cbd1541 Add comment to make SharedImageBuffer non_exhaustive when it ever becomes public 2024-07-08 16:58:06 +02:00
Tobias Hunger
e74745c68a backout of commit 402f7ea649
rgb crate has eben fixed upstream, remove the temporary work-around again.
2024-07-08 15:38:23 +02:00
Simon Hausmann
402f7ea649 Work around build breakage in rgb 0.8.42
See https://github.com/kornelski/rust-rgb/issues/116 for details

cc #5574
2024-07-08 11:52:57 +02:00
Simon Hausmann
a16e86bbd9 API review: Remove accidental public strum dependency
Deriving strum::EnumIter on a publicly exposed enum (like PointerEventButton) implies visibility into types that strum declares. This was added just for testing
in systest and can be solved differently.

Amends a1857e6154
2024-07-05 20:48:25 +02:00
Simon Hausmann
89b80eb00e API review: move {window,display}_handle_06_rc() into WindowAdapterInternal 2024-07-05 20:48:02 +02:00
Simon Hausmann
e35d05f6b9 API Review: Remove SharedImageBuffer from public API and rename Window::grab_window() to take_snapshot()
Use SharedPixelBuffer as return value for take_snapshot() and provide counter-parts to from_rgb* in Image as to_rgb*
2024-07-05 20:46:55 +02:00
Olivier Goffart
35a6e7bde5 Split Text item into SimpleText and ComplexText
SimpleText has all the most common properties and is half the size
2024-07-05 12:51:25 +02:00
Olivier Goffart
8b5df70dd0 Make a trait for the Text rendering
So we can Split Text
2024-07-05 12:51:25 +02:00
Olivier Goffart
7c93c7438b Rename resize-border => resize-border-width 2024-07-05 12:50:16 +02:00
Simon Hausmann
49df131625 Fix slint::Window::hide() on Wayland with winit
On Wayland hiding a window requires destroying the surface, which
means destroying the winit window as well as the underlying graphics
surface. The latter is tricky as we have to keep the renderer around,
as our WindowAdapter trait's `renderer()` function returns a `&dyn
Renderer` and that also has to work without a window (to obtain text
metrics).

Fixes #4225

Co-Authored-By: Olivier Goffart <olivier.goffart@slint.dev>
2024-07-03 14:22:30 +02:00
Olivier Goffart
60569673b5 Remove some cargo:rustc-check-cfg output:
- The cfg_aliases crate does it out of the box already
 - Don't create a build.rs for this only purpose when it can be added in
   Cargo.toml lints group. (This wasn't possible when the warning was
   first introduced in nightly)
2024-07-02 13:33:48 +02:00
Simon Hausmann
7d270812a3
Fix panic in slint::Timer due to double mutable borrow (#5525)
When stopping a timer, the removal from the timer list requires a mutable borrow.
If during that borrow the timer's closure is dropped and a `Drop` impl starts another time, then the attempt of
acquiring a mutable borrow for the timers list to insert the new timer fails.
2024-07-02 11:20:30 +02:00
Olivier Goffart
263af149c0 changed callback: limit chained callback to 10 invocations
in order to avoid infinite loops
2024-06-28 14:46:12 +02:00
Simon Hausmann
b45945a234
Add support for async unit testing and element handle click events (#5499)
This patch adds async click functions to ElementHandle and adds timer support to the testing backend's event loop.
2024-06-27 17:05:58 +02:00
Olivier Goffart
863fb4ca8e
janitor: update const-field-offset dependency requirement
To make sure nobody still use an old version that results in warning in the generated code 

Fixes #5490
2024-06-27 10:39:53 +02:00
Arnold Loubriat
ce2db77e88
Add the accessible-placeholder-text property (#5464) 2024-06-26 12:59:22 +02:00
Tobias Hunger
1c8b3733f7 janitor: Fix clippy "manual char comparison can be written more succinctly" 2024-06-24 14:59:47 +02:00
Tobias Hunger
b2c2587945 janitor: Fix clippy "clamp-like pattern without using clamp function" 2024-06-24 14:59:47 +02:00
Tobias Hunger
e14e296734 janitor: Fix clippy "casting raw pointers to the same type and constness is unnecessary" 2024-06-24 14:59:47 +02:00
Tobias Hunger
f8e4072d0c janitor: Fix clippy "unneeded return" 2024-06-24 14:59:47 +02:00
Tobias Hunger
f78ea5e7cf janitor: Fix clippy "field assignment outside of initializer
... for an instance created with Default::default()"
2024-06-24 14:59:47 +02:00
Tobias Hunger
09e9cdebb1 janitor: Fix clippy "duplicated attribute" 2024-06-24 14:59:47 +02:00
Tobias Hunger
571ee7a0bb janitor: Fix clippy "parameter is only used in recursion" 2024-06-24 14:59:47 +02:00
Olivier Goffart
c89ea56abb Update a bunch of dependencies
Bigger change is cause by resvg/usvg which now takes the font database
in a Arc, so we must store it in a Arc ourself to cheaply lend it to usvg
2024-06-23 16:47:13 +02:00
Simon Hausmann
977b827df2
Add Rust API to grab the contents of a slint::Window into a slint::SharedImageBuffer (#5445) 2024-06-22 09:33:18 +02:00
Daniel Stuart
436efaceea renderer: Use TextWrap enum for text_size function 2024-06-17 23:52:04 -07:00
Daniel Stuart
bac81bf350 Add character wrapping for software renderer
This adds `char-wrap` functionality to the software renderer.
2024-06-17 23:52:04 -07:00
Daniel Stuart
9f63d157d1 Add character wrapping for Qt Backend
This adds a new wrapping mode called `char-wrap`, which allows for wrapping at any character.
Currently, it only supports the Qt backend, with the other backends falling back to `word-wrap` when this option is selected.
2024-06-17 23:52:04 -07:00
Tobias Hunger
03f1e10b06 live-preview: Cache compilation results while moving elements around 2024-06-14 16:59:39 +02:00
Simon Hausmann
a1857e6154 system testing: add a unit test to verify that the manual AccessibilityRole mapping is always complete
The enum is non-exhaustive, but we can do an additional run-time check.
2024-06-14 07:46:36 -07:00
Olivier Goffart
4cc6337c42 Rust: Don't get the default font size through the root component
Planning for multi-component support
2024-06-13 13:53:07 +02:00
Simon Hausmann
4591ad8d57 Add plumbing for system testing 2024-06-13 04:03:17 -07:00
Simon Hausmann
db3d726886 Make it possible to retrieve a SharedImageBuffer for a slint::Image in Rust
This change exposes functionality of already existing internal API
that all renderers use to obtain pixels for upload to the screen - so
it's rather well tested.

This also exposes the `SharedImageBuffer` API, an enum that represents
different SharedPixelBuffer encodings.
2024-06-11 07:46:57 -07:00
Simon Hausmann
88e1a366a3 Make rendering rotation a public feature of the software renderer
Fixes #5372
2024-06-10 05:24:48 -07:00
Olivier Goffart
318c80b4f2 testing: only visit items that are visible and not fully clipped 2024-06-07 15:08:44 +02:00
Luc Fauvel
44a537d902
Implemented resizing for non-decorated winit windows (#5026)
Fixes #5023

* Implemented resizing for non-decorated winit windows

* Fixed formatting

* Changed direction match to use a tuple, reduced resize border size, returned after handling resize

* Added is resizable check for before resizing winit window

* Added resize-border property to window

* Formatted code

* Change resize-border from float to length
2024-06-06 11:17:05 +02:00
Olivier Goffart
445802c46d date_time: simplification and cleanups 2024-06-06 09:03:50 +02:00
Olivier Goffart
3da0ee5bb9 DatePicker: Logic in C++
Had to simplify a bit the rust logic to make it work
2024-06-06 09:03:50 +02:00