Commit graph

1368 commits

Author SHA1 Message Date
Ian McFarlane
1de7b1512c
Expose clipboard_text accessors to C++ (#3265) 2023-08-28 12:26:40 +02:00
Olivier Goffart
7904493e1c C++: dispatch close request and activation change 2023-08-24 17:27:04 +02:00
Olivier Goffart
c33e5a0f12
Rust platform API: add ways to send CloseRequested and WindowActiveChanged events 2023-08-24 14:39:20 +02:00
Olivier Goffart
ec32931985 Another Prospective fix for warnings in CI 2023-08-23 12:29:48 +02:00
Olivier Goffart
44a8147201
Rust platform API to query window properties 2023-08-22 18:32:50 +02:00
Olivier Goffart
4d018c1793 Prospective fix for warnings in the CI:
```
Error parsing Cargo.toml manifest, fallback to caching entire file: Error: Invalid TOML document: expected key-value, found comma

58:  instant = { version = "0.1", features = [ "now" ], optional = true }
59:  lyon_algorithms = { version = "1.0" , optional = true }
                                         ^
60:  lyon_geom = { version = "1.0", optional = true  }
```
2023-08-22 17:13:40 +02:00
Olivier Goffart
4cf464a7d6 Fix warning on MCU about unused PropertyTracker import
All the direct uses of PropertyTracker were under a "std" cfg check.
2023-08-21 17:09:00 +02:00
Olivier Goffart
fadedad025 Prospective fix for warnings in nightly 2023-08-21 13:02:58 +02:00
Simon Hausmann
96d7bb132c reuse: remove glob for markdown files
Instead, place the copyright and license right into the source.

To satisfy reuse, this also removes the unnecessary MIT.txt
symlinks.
2023-08-17 08:55:28 +02:00
Simon Hausmann
91d0747d06 Make use of the ItemCache more robust when the window scale factor changes
Previously, all the closures passed to `get_or_update_cache_entry` would
have to make sure that the scale factor is an included dependency. This
is error prone, as the parent commits show.

Instead, this change adds a property tracker to each ItemCache and lets
the renderer clear the cache if the scale factor changes.

Strictly speaking this may delete too many entries from the cache (not
all depend on the scale factor), but on the other hand this doesn't
happen very often so we trade robustness over efficiency.
2023-08-16 16:37:07 +02:00
Simon Hausmann
4881bd1a87 Fix box-shadow cache not being invalidate when the scale factor changes
Include the scale factor in the dependency tracker of the item cache used for box shadows.
2023-08-16 16:37:07 +02:00
Tobias Hunger
09d3eaf00a Update license symlinks
run `cargo xtask check_reuse_compliance --fix-symlinks`
2023-08-16 11:46:15 +02:00
Olivier Goffart
7f0ba774ec Use portable_atomic instead of deprecated atomic_polyfill 2023-08-10 13:12:04 +02:00
Simon Hausmann
cd0056ca92 Make it easier to use the software renderer with PremultipliedRgbaColor and Rgb565 in "foreign" environments
Implement rgb::Pod/rgb::Zeroable for PremultipliedRgbaColor and Rgb565
Pixel. This allows for bytemuck::cast_slice(), making it easier to copy
software renderer output into another buffer that's the same format but
Vec<u8> for example.
2023-08-07 11:46:43 +02:00
darknight
37488f015d Refactoring: define macro rules to group builtin structs
apply new macro for struct declaration, type register,
doc generation, cpp header generation, struct-value conversion.
2023-08-03 11:01:18 +02:00
Simon Hausmann
0c9199b17f
Add support for flipping borrowed OpenGL textures vertically (#3205)
Closes #2986

Co-authored-by: Olivier Goffart <olivier.goffart@slint-ui.com>
2023-08-02 13:11:13 +02:00
Olivier Goffart
ad389aa4eb linuxkms: Implement keyboard input and clamp mouse
Unfortunately, this is currently not mapped to the right keyboard layout

Also keep the mouse clamped in the visible area.
And make it start in the middle of the screen.
2023-07-31 17:27:53 +02:00
Olivier Goffart
0a8f9c585a
C++: expose special key codes constants 2023-07-31 15:11:57 +02:00
Simon Hausmann
84ddfc6c2f Add support for rendering the mouse cursor with linuxkms
The cursor is loaded by the window adapter from the cache. When it's
loaded the first time, its format will be Svg, so we convert it to a
pixel buffer. That way the skia backend can convert it on first draw
into a skia_safe::Image and replace the cache entry with the backend
storage variant.
2023-07-31 13:06:28 +02:00
Simon Hausmann
7ff7c2f875 Fix let-else formatting
Nightly now supports it and thus `cargo +nightly fmt` yields a
difference.
2023-07-28 13:43:21 +02:00
Olivier Goffart
3a807e46c1
Renderer feature refactor 2023-07-27 19:11:24 +02:00
Simon Hausmann
f2af8317a2 doc: Give visibility to slint::Window::new() 2023-07-27 16:50:29 +02:00
Simon Hausmann
f60b2ebde9 Add slint::platform::OpenGLInterface
This allows for the use of the FemtoVG renderer but delegate the GL implementation to the user.
2023-07-27 16:48:57 +02:00
Simon Hausmann
3b29bfe2f6 Change OpenGLContextWrapper to return a generic Error
This is in preparation for making the trait public.
2023-07-27 16:48:57 +02:00
Simon Hausmann
581085a953 Added PlatformError::OtherError that stores a boxed error
This allows our public traits to return a boxed error.
2023-07-27 16:48:57 +02:00
Olivier Goffart
a9fa51469c swrenderer: use interior mutability for the repaint_buffer_type 2023-07-27 14:44:28 +02:00
Olivier Goffart
d43d24ec7e Un-hide the renderer() function from the WindowAdapter
Now that the SoftwareRenderer can be constructed, it is
finally possible to have your own WindowAdapter

Revert "Hide the `renderer()` function from the public API"

This reverts commit ff6653c77e.
2023-07-27 14:44:28 +02:00
Olivier Goffart
49485dbf7d SoftwareRenderer: add API to construct and change the buffer type 2023-07-27 14:44:28 +02:00
Olivier Goffart
a29123a498 Remove invalid comments seen in the code review 2023-07-27 12:04:16 +02:00
Tobias Hunger
baa4eb1ea3 Get rid of the window when building an embedded component
... now that we can get the WindowAdapter from the parent component when
we embed it.
2023-07-27 12:04:16 +02:00
Tobias Hunger
a362b7a1ae Add window_adapter to ComponentVTable
Make it duplicate as `maybe_window_adapter` with a boolean `do_create`
parameter.
2023-07-27 12:04:16 +02:00
Tobias Hunger
9de515b768 Implement embedding in rust 2023-07-27 12:04:16 +02:00
Tobias Hunger
d47d52bf52 ItemVTable::init(...): Take an ItemRc so that the itan can know where in the Item Tree it is located 2023-07-27 12:04:16 +02:00
Tobias Hunger
74ef877f70 Add embed_component to ComponentVTable 2023-07-27 12:04:16 +02:00
Tobias Hunger
05e9ce078a Add a simplistic ComponentContainer element
It just registers the type, nothing more.
2023-07-27 12:04:16 +02:00
Tobias Hunger
2840886d28 Add component-factory type to Slint language
Add a type "component-factory" to the Slint language.
2023-07-27 12:04:16 +02:00
Tobias Hunger
df069bf6ed component_factory: Add documentation (#2868)
* component_factory: Add documentation

What was there was not useful, this is a bit better I think:-)

Co-authored-by: Olivier Goffart <olivier@woboq.com>
Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>
2023-07-27 12:04:16 +02:00
Tobias Hunger
731c422329 Add a ComponentFactory (Rust)
Add a ComponentFactory type which will eventually be used as a property
value in Slint. The idea is to copy around this type and to create
components from it that we can embed.

We do not want to hand raw components around as those are reference counted
and might end up being embedded into several places, which would break out
tree of components.
2023-07-27 12:04:16 +02:00
Simon Hausmann
af97435463 Replace show()/hide() in the WindowAdapter with set_visible(bool)
This makes for a smaller interface.
2023-07-26 13:53:45 +02:00
Simon Hausmann
f15bc6147e Simplify FemtoVG and Skia renderer APIs: remove resize()
We can convey the new physical window size from the run-time
through the private renderer API
when a window resize event is dispatched.
2023-07-25 19:33:26 +02:00
Simon Hausmann
c05ee8b87d Fix empty window test
When render() is called on an renderer that's not associated with a component yet,
then just return a default constructed region.
2023-07-25 17:28:08 +02:00
Simon Hausmann
5a9f8a4c90 Clear caches in the renderers when "changing" the window adapter
This helps to keep the allocation peak low.
2023-07-25 17:28:08 +02:00
Simon Hausmann
7d136b6568 Remove the window parameter from the render() function of all the renderers
This makes for a slimmer API and instead we can create the renderer <-> window association
behind the scenes ourselves,
in set_component.
2023-07-25 17:28:08 +02:00
ogoffart
aebaa7d6c9 Bump version number to 1.2.0 2023-07-25 10:44:53 +00:00
asuper0
5268aeb676 Add set_interval function to Timer, which could change the interval of timer without re-invoking a start function. 2023-07-24 09:37:53 +02:00
Guilhem Vallat
49b3e15bc8 Add ReverseModel 2023-07-20 16:18:37 +02:00
Guilhem Vallat
8f2fd38a88 Implement Default for Weak 2023-07-17 20:05:36 +02:00
Olivier Goffart
3c528b67b3 Fix touch in the flickable not resulting in a click
because the pending press event might be loss if there is a move between
the click and the release

This was reported on Mattermost
2023-07-15 08:34:58 +02:00
Simon Hausmann
59d869cb84 Fix missing invocation of init() on Items with C++
In Rust, register_component in the run-time library is called unconditionally and
invokes init(). The window adapter is an optional
parameter.

In C++, we'd call register_component only if we had a window adapter, which meant
that we're missing init calls().

Amends cd9994306e
2023-07-14 13:09:45 +02:00
Aurindam Jana
5a4a7fee63
Update royalty free license to 1.1 (#2994) 2023-07-10 10:12:11 +02:00