Commit graph

1368 commits

Author SHA1 Message Date
Tobias Hunger
c1456e5153 component_container: Add background rectangle 2023-10-19 13:22:39 +02:00
J-P Nurmi
8ea3153e87
SW: fix eliding of multiline text (#3612)
SW: fix eliding and vertical alignment of multiline text
2023-10-18 10:15:55 +02:00
Florian Blasius
3e3dd03566
Added focus-changed-event callback to FocusScope (#3650) 2023-10-17 17:30:19 +02:00
Olivier Goffart
807f19484b Fix has-hover in Flickable with scroll wheel
The code that was making sure has-hover is kept in sync was no longer working
because of the introduction of the scroll-event.
Sadly, the flickable3.slint test didn't catch that because of another
bug.

Fixes #3666
2023-10-17 14:11:13 +02:00
Olivier Goffart
02e9bd96f2 Remove dead code
This was no longer used
2023-10-17 14:11:13 +02:00
Tobias Hunger
962d70a357 core: Fix two-way-bindings of two-way-bindings
Fix binding a two-way bound property to another property: The value of
the first bproperty was used here, while it is documented to use the
value of the second.

Add test cases for two-way bindings in first, second an in both places
when creating another two-way binding to make sure everything works and
stays that way :-)
2023-10-17 13:00:52 +02:00
Tobias Hunger
caee0b2f9d janitor: Fix a semi-random selection of clippy warnings
Nothing serious in there.
2023-10-16 13:44:37 +02:00
Tobias Hunger
b12575a4c4 janitor: Go over our spell checking setup
* Extend the cspell word list
* Remove those extensions from individual source files
* white-list licenses and such as we should not meddle with those
* Fix spelling
2023-10-16 09:01:51 +02:00
J-P Nurmi
c4864d62ff SW: stop breaking lines after reaching the max (elided) lines 2023-10-13 22:14:58 +02:00
J-P Nurmi
6686861523 SW: fix vertical alignment of elided multiline text 2023-10-11 14:35:20 +02:00
Olivier Goffart
b88a3caacd swrenderer: Put the rotation feature behind a freature gate
We're not ready to make the API public as we want to have the API as
part of the Window rather than part of the renderer
2023-10-09 18:07:23 +02:00
Olivier Goffart
b6636b2e94 swrender: Implement window rotation by 180° and 270°
(The tests are still failling)
2023-10-09 18:07:23 +02:00
Olivier Goffart
ec36d46740 WIP: experiment with screen rotation
TODO:
 - Polish the API
 - Most screenshot test are failling because the rotation don't draw the
   rounded rectangle exactly the same (that's because the border
   rectangle algo is not perfect), and also scaled image are not pixel
   perfect

The updated screenshot is because of a small change in the image
rendering algorithm that changes the rounding slightly.
2023-10-09 18:07:23 +02:00
Olivier Goffart
a5488d6285 Rename RepeatedComponent -> RepeatedItemTree
And some more cleanups
2023-10-09 11:01:56 +02:00
Olivier Goffart
852b4d906d Rename ComponentVTable to ItemTreeVTable
and their related name.
Also move the component module in the item_Tree module
register_component -> register_item_tree
ComponentItemTree -> ItemTreeNodeArray

For #3323

Rationale from that issue:

Right now, we use the term `component` in the Slint language and in the compiler to be a a tree of elements that can be used as an element in a .slint file.

The term is also currently used in the runtime as a tree of runtime Items that are allocated together. (declared in ComponentVTable)

But there are no 1 to 1 mapping between a `component` in the slint language, and a runtime Component.
(for example, the items behind a `if` or `for` or `PopupMenu` are in a different runtime component. And `component` declared in Slint are often inlined)

So we should rename the internal runtime `Component` to  `ItemTree`

The currently public `slint::ComponentHandle` wraps the "root" of the ItemTree, but that's ok because it is generated from a .slint `component`,  so it doesn't change name
2023-10-09 11:01:56 +02:00
Olivier Goffart
4c0a435196 Implement TouchArea::scroll-event
Closes #1280
2023-10-07 07:59:53 +02:00
J-P Nurmi
af60d060ca
SW: fix horizontal alignment of text cursor and selection
A partial fix to #3580.
2023-10-02 12:44:03 +02:00
Olivier Goffart
e0ac0ed319
Frame per second counter for the software renderer 2023-09-28 16:23:07 +02:00
Guilhem Vallat
6134d6d873 Clear TextInput selection on FocusOut 2023-09-28 13:11:11 +02:00
Tobias Hunger
85e1c6020b janitor: Use workspace dependnecies for the slint crates
This moves most of the version information we need to update into one
place.

Note that the workplace dependency features are in *addition* to any
feature set when using the workspace dependency. So we have all
workspace dependencies defined with `no-default-features = true`.
2023-09-25 16:34:16 +02:00
Tobias Hunger
d6695c55cb Janitor: Use cargo workspace package data more 2023-09-25 16:34:16 +02:00
Tobias Hunger
783083868a janitor: Fix clippy errors about wrong clone implementations
... for Copy types.
2023-09-20 20:23:38 +02:00
Simon Hausmann
2b14806cd5 Default for false for ImageInner's PartialEq::eq fallback
This may help to reduce the risk of introducing issues similar to #3510.
2023-09-20 11:18:29 +02:00
Simon Hausmann
a7b6bcae6e Skia renderer: Fixed the source property of Image elements sometimes not changing when setting dynamically loaded images
After loading an image with `Image::load_from_path` and setting to a
source property, upon rendering with Skia, it would get replaced with a
Skia renderer specific image representation. When later setting another
image that was also using `ImageInner::BackedStorage`, the property
would not get set because PartialEq::eq would return true because the
image inner types are the same, instead of comparing the vtable
pointers.

Fixes #3510
2023-09-20 11:18:29 +02:00
Olivier Goffart
46ec7875ed Software renderer: partial rendering with winit and fix non-opaque background
Implement the partial rendering with winit and our software renderer.

When the background is not opaque, we must still initialize all the
pixel with 0 otherwise we blend over the previous frame.
(That wasn't visible before because the buffer was always empty)
2023-09-13 16:08:57 +02:00
Guilhem Vallat
c82ef57c26 fix item_tree test compilation 2023-09-13 16:08:37 +02:00
Guilhem Vallat
5cf1a45e41 Remove duplicated geometry properties from items 2023-09-13 16:08:37 +02:00
Olivier Goffart
06fc251729 Remove the geometry on ItemVTable 2023-09-13 16:08:37 +02:00
Olivier Goffart
cfda569e56 More use of item_geometry 2023-09-13 16:08:37 +02:00
Olivier Goffart
083023866d Use the item_geometry from ComponentVTable 2023-09-13 16:08:37 +02:00
Olivier Goffart
e0fd9a6105 WIP: Add item_geometry to the ComponentVTable
(unused yet)
2023-09-13 16:08:37 +02:00
Olivier Goffart
2a8ebb9752 Flickable: don't make the viewport special
Instead: add the viewport propety directly in the Flickable

Simplifies the compiler's code generation a bit
2023-09-13 16:08:37 +02:00
Simon Hausmann
3652f58a3f Change item indices from usize to u32
So that the compiler and run-time can never disagree on the
number of bytes the item index can use.
2023-09-12 08:53:58 +02:00
Tobias Hunger
1c6a3aeee5
Fix typo in error message 2023-09-11 10:35:37 +02:00
darknight
5e5bbed8ee Expand InputType to support number & decimal 2023-09-07 14:56:45 +02:00
Adam Obuchowicz
644a39f1e8 Derive serde for Color 2023-09-06 11:15:34 +02:00
tronical
b8b9db4e42 Bump version number to 1.3.0 2023-09-05 15:46:36 +02:00
Olivier Goffart
95b6eda10b Make sure PLatformError is Send+Sync as it is needed for anyhow 2023-08-31 20:52:10 +02:00
Simon Hausmann
38f8615065 Fix PlatformError compatibility
It was Send before, so try to keep it Send with the new Boxed dyn error, too.
2023-08-31 20:52:10 +02:00
Olivier Goffart
8f16b519a2 use #repr(uX) instead of repr(C) for fieldless enums
Otherwise the ABI may differ between the C++ and the Rust
2023-08-31 10:22:03 +02:00
Simon Hausmann
98a971666c API changes to ReverseModel and doc fixes
- Add missing documentation to various new functions
- Remove unused `inner_model()` function. We don't have an equivalent in the other model classes. C++ has source_model() though, but we can add that if needed.
2023-08-30 16:36:25 +02:00
Simon Hausmann
e73ad733fc API fixes to the OpenGL texture borrowing API
- Make BorrowedOpenGLTextureOrigin non_exhaustive
- Mark BorrowedOpenGLTextureBuilder::new_gl_2d_rgba_texture as unsafe instead of build(). The former takes the arguments that may be garbage, not the latter.
2023-08-30 16:18:42 +02:00
Olivier Goffart
4920224be0
Rename Slider::vertical to Slider::orientation 2023-08-30 13:43:59 +02:00
Olivier Goffart
fde561a56a Some improvements to Window visibility
- From C++, always call the Window::show() and hide() function instead
   of going through set_visible directly as it doesn't set the size of
   the WindowItem
 - show() should also call resize on the renderer
 - remove the is_visible in the WindowAdapterInternal as it is no longer
   needed
2023-08-30 13:05:35 +02:00
Simon Hausmann
d160eb7a31
Add support for set_position(), position(), and set_physical_size() to the C++ WindowAdapter (#3367)
Closes #3349
2023-08-28 18:43:04 +02:00
Simon Hausmann
ce07a3ab74 Fix doc warning 2023-08-28 15:08:47 +02:00
Simon Hausmann
67423b288f Add documentation to the WindowAdapters to explain the basic message passing protocol
... and provide hints in there about implementing window close requests.

Note: The links to set_size() and set_position() are not resolved, as
these virtual functions are still missing from the WindowAdapter base
class.
2023-08-28 13:45:28 +02:00
Simon Hausmann
11128b3b7f Document show()/hide()'s behavior of the additional strong component reference 2023-08-28 13:45:28 +02:00
Simon Hausmann
de58d5e83c Keep the component alive when the window is visible
show() now let's Slint maintain a strong reference to the component, so
that it's easy to create new windows without having to do an awkward
dance around keeping the component alive.

Closes #3328
2023-08-28 13:45:28 +02:00
Simon Hausmann
65f9e6f1eb Move the OpenGLInterface back to the FemtoVG renderer
At the moment it's only needed there, so let's
have it there and move it to core later if the need arises.
2023-08-28 13:33:15 +02:00