Commit graph

1368 commits

Author SHA1 Message Date
Olivier Goffart
b565eb8820 Merge all the pinned field of the window in a common allocation 2023-04-12 14:49:08 +02:00
Simon Hausmann
9a35989eea Fix outer FocusScope objects stealing click-focus
After the `FocusScope` accepted the input event by transferring focus, stop
propagating the event and avoid it being sent to a parent,
which in turn will steal the focus.
2023-04-12 08:48:24 +02:00
Olivier Goffart
fd3f974d7e Don't use old syntax in docs 2023-04-06 17:06:46 +02:00
Simon Hausmann
3ef634ebbc Fix Coord casting logic
Preserve i32::MAX as f32 correctly as i32::MAX as Coord, not Coord::MAX.
2023-03-30 09:37:56 +02:00
Simon Hausmann
6e6acb828f Fix build with slint_int_coord 2023-03-30 09:25:40 +02:00
Simon Hausmann
d6c9ddd27a Qt: Avoid setting 0x0 as maximum size on a window
Centralize the code to ensure that we only set a maximum size if > 0 into corelib.
2023-03-30 08:43:48 +02:00
Olivier Goffart
538dddf953 Update fontdb since resvg depends on the newer one 2023-03-28 15:55:27 +02:00
Olivier Goffart
977b1cc23a Update resvg dependency
Don't import all the dependent crate, use the re-export

And use a workspace dependency
2023-03-28 15:55:27 +02:00
Olivier Goffart
16fbee01fe Allow slint::Weak::upgrade_in_event_loop in no_std
Closes #2379
2023-03-28 12:46:32 +02:00
Simon Hausmann
b38df20d9a Add a feature to enable system fonts with the software renderer
If we have a file system, then we can allow users of the software
renderer to support text rendering by from fonts served by the file
system.

cc #2100
2023-03-28 11:33:44 +02:00
Olivier Goffart
b4e5345a7e Femtovg: fix panic when rendering layer or shadow with negative size
Reproducer:

```
export component Test {
    width: 200px;
    height: 200px;
    Rectangle {
        clip: true;
        background: red;
        border-radius: 5px;
        height: -12px; //<- negative size
        width: 100%;
        Rectangle { background: green; }
        drop-shadow-color: #8888;
        drop-shadow-blur: 5px;
    }
}

```
2023-03-27 20:52:37 +02:00
Olivier Goffart
476ab383ea software_renderer: return the modified region from the render call
Closes #2389
2023-03-24 17:29:01 +01:00
Olivier Goffart
17e7c1f0c7 software_renderer: implement draw_cached_pixmap
needed to render the native style
2023-03-24 16:29:21 +01:00
Simon Hausmann
2872c13fff Fix using the software renderer with the native style
Provide access to the window inner also from within the software
renderer, so that the native style rendering can query the active state.

Fixes #2404
2023-03-24 16:29:21 +01:00
Simon Hausmann
8ffb5131c7
Introduce error handling in the FemtoVG and Skia renderers (#2402)
Avoid unwrap() and expect() and instead propagate errors all the way
down to run_event_loop(), show(), and hide() in the Slint AIP.
2023-03-24 14:18:11 +01:00
Olivier Goffart
35c5325fa5 Review the items that should have a stretch of 1 in a layout 2023-03-24 11:15:05 +01:00
Tobias Hunger
799c9a9389
docs: fix some more links from rust docs into other docs 2023-03-24 10:18:04 +01:00
Olivier Goffart
c82bb1515e C++ image: add some docs
Note: Don't use cbindgen to generate `operator==` for public types.
Because it doesn't have docs and the documentation show warnings
otherwise
2023-03-20 17:22:56 +01:00
Olivier Goffart
be47c8464c C++: implement creation of image from raw data
Issue #616
2023-03-20 17:22:56 +01:00
Olivier Goffart
4cf44ea69d Mark StandardListViewItem and TableColumn as #[non_exhaustive]
Closes #2330
2023-03-18 09:04:48 +01:00
Simon Hausmann
032faad210 software renderer: Fix rendering artefacts when deleting components when using the partial renderer
Upon deletion we have little choice but to refresh the screen :(
2023-03-09 15:14:15 +01:00
Olivier Goffart
233bc61c8e Flickable: capture the event if the flickable can flick even if it is at the end
When scrolling the printer demo, I often end up closing or opening
element i don't want to because we reached the end and therefore it is
not scrolling and forwarding the event
2023-03-09 11:35:57 +01:00
Tobias Hunger
3ac01c3f07 clippy: Fix clippy warnings 2023-03-09 09:35:29 +01:00
Olivier Goffart
3101c278dc Janitor: rename a 'data' variable 2023-03-08 11:44:42 +01:00
Olivier Goffart
50dad538a1 Partial renderer: take in account change in clipping and parent geometry
... as well as opacity

When an item change its geometry or clipping, one really must also
refresh all the children, even the ones outside of the item.

And if the position of the parent changes, the old offset must still be
used to compute the geometry

This change also add the clip to the dirty region so we don't need to
draw so much for clipped items
2023-03-08 11:44:42 +01:00
Olivier Goffart
db12795032 swrenderer: gradient with opacity 2023-03-07 07:16:31 +01:00
Olivier Goffart
5a54fcfeb1 swrenderer: fix image drawing when the image is not stretched to the geometry
This would cause some of the image to be drawn outside of the clip
region, which may even lead to panics

(Fix changing pages in the energy-monitor demo)
2023-03-06 17:13:33 +01:00
Simon Hausmann
c10349b2d1 Fix software renderer system fonts on some Yocto distros
Add "Liberation Sans" as another default system font we could look for.
2023-03-06 13:55:53 +01:00
Simon Hausmann
6d968aa329 Extract the FemtoVG renderer into a separate crate
This will be needed for a future experiment. Unlike the Skia renderer,
which operates on raw window handles, the FemtoVG renderer exposes a
different interface where it assumes that the caller takes care of the
OpenGL context state. This means more boilerplate remains in the winit
backend, including the glutin dependency. The upside is that it will
allow using the FemtoVG renderer in environments without glutin.

In order to work in an environment without fontconfig or memmap, the
crate has two features:

  - fontconfig (set when we anticipate fontconfig to be available at
    run-time and libloading being available at compile time).
  - diskfonts (set when we want to be able to load fonts from disk)

The winit crate enables fontconfig on "Linux" and diskfonts on !wasm.
2023-03-06 11:45:28 +01:00
Olivier Goffart
a89c5db8db Fix crash when a state condition is detected as constant
States are never constant because the generated state binding depend on
the time as it register the time it was set for the pottential animation

Also adjust the assert so it assert correctly which the right message

Fixes: #2274
2023-02-24 16:43:48 +01:00
Tobias Hunger
f7de5d4602
docs: Go over builtin_elements.md (#2280)
Co-authored-by: Simon Hausmann <hausmann@gmail.com>
2023-02-24 11:03:56 +01:00
Tobias Hunger
a50983862b
docs: Fix some more broken links 2023-02-23 11:31:39 +01:00
Tobias Hunger
39d215bee0 docs: Rename "Slint language Reference" to "Slint Language Documentation" 2023-02-22 21:13:47 +01:00
Tobias Hunger
78892cdf1f docs: Fix broken links in our docs. 2023-02-22 17:08:30 +01:00
Olivier Goffart
aa2d5fa324 We must update animations before the timers
In case a timer start an animation, the starting time need to be correct
2023-02-17 15:27:43 +01:00
Olivier Goffart
5146c52d20 Flickable: Shift + mouse scroll reverts scroll dirrection
Closes #2228
2023-02-16 14:01:34 +01:00
Olivier Goffart
8450e01a3f
Change the name of the compat feature (#2230)
And remove the compat-0-2-0 and compat-0-3-0 features
2023-02-16 09:40:44 +01:00
Olivier Goffart
361526fb33 Update resvg dependency 2023-02-16 09:03:22 +01:00
Olivier Goffart
6889dfa5f5 Rust: Make new(), run() and show() report errors from the backend
Fixes #2198
2023-02-10 05:00:03 +01:00
Olivier Goffart
a19efc30db
Replace the MAX_BUFFER_AGE const generic with a runtime enum
Having a const generic for that didn't turn to be a good API.
Also made the C++ side more difficult

(Also renamed buffer_stride to pixel_stride)

Closes #2135
2023-02-08 14:44:01 +01:00
Simon Hausmann
860f318f7c
Bump femtovg, rustybuzz, ttf-parser, and fontdb dependencies (#2191)
Mostly bugfix changes upstream with some minor API changes. FemtoVG is
no more limited to 24 gradient stops for the paint.
2023-02-08 09:56:53 +01:00
Olivier Goffart
dddfcf572d Fix const detection with two ways binding
The const detection for two way binding was not detecting change if one
of the property was set to a const value in a component using it.

This would cause the compiler to generate call set_content on one of the
property in a two way bindings, and later, the "const sentinel" be
present in the dependency list, causing crash.

To avoid segfault for similar bug in the future, added added an assert!
in the property system to detect that.

Fixes #2185
2023-02-07 10:27:37 +01:00
Olivier Goffart
7990bfe6f0 Add a distance threshold to the double-click 2023-02-06 09:14:29 +01:00
Olivier Goffart
96c17e9563 TextImput: Shift+Click selects 2023-02-06 09:14:29 +01:00
Olivier Goffart
9e48e5eee3 TextInput: implement double-click and drag
(and tripple-click and drag)
2023-02-06 09:14:29 +01:00
ogoffart
e7f48512ee Bump version number to 1.0.0 2023-02-03 11:07:15 +01:00
Olivier Goffart
995d960a2a Comile with Rust < 1.66
wrapping_add_signed was added in Rust 1.66
2023-02-02 15:54:07 +01:00
Olivier Goffart
a4eb1ab287 swrenderer support for linear gradient
Only simple rectangle (no borders or radius)
2023-02-02 15:54:07 +01:00
Olivier Goffart
5050e4fea8 swrenderer: move the SceneCommend vector into a separate struct
Simplifies a bit the code as we will add more vectors that need to be
passed from the SceneBuilder to the Scene
2023-02-02 15:54:07 +01:00
Olivier Goffart
f34b1bda2e Add primary keyboard support on unix (selection copy, middle click paste)
Closes #2146
2023-01-31 16:39:22 +01:00