Commit graph

10295 commits

Author SHA1 Message Date
Simon Hausmann
9df29b1a35 Add test coverage for setting non-existent properties and callbacks 2023-08-08 13:52:59 +02:00
Simon Hausmann
faeda3c466 Remove stray package.json files for non-existent binary packages
We don't have binary packages yet, the ones in the default napi
template don't quite match what we're going to need (we won't support
musl for example), and the license choice of MIT is also wrong.

So this PR removes them and we can re-add them when we work on binary
packages.
2023-08-08 13:47:47 +02:00
Simon Hausmann
7d05d8ee0f napi: add more tests for js object -> structure conversion
- cover when properties are missing
- verify that excess properties are ignored
2023-08-08 13:47:20 +02:00
Simon Hausmann
5d102bc838 napi: Fix access to diagnostics
Invoking the diagnostics getter would throw an exception because the JsDiagnostic type has no constructor.

There's however no constructor that would allow for the previous
laziness, so instead this PR bites the bullet:

- When diagnostics are requested, we convert them all in one go into proper JavaScript objects.
- The vector returned by line_column is replaced with more idiomatic column and lineNumber properties
2023-08-08 13:46:53 +02:00
Simon Hausmann
4679bb6c38 napi: In the test for data structure conversion, remove the unrelated boolean property test 2023-08-08 13:45:02 +02:00
Simon Hausmann
23e4f4e6fe napi: In the tests, don't rely on the current process working directory
Instead, resolve the path to resources/rgb.png relative
to the test file.
2023-08-08 13:44:46 +02:00
Simon Hausmann
63df4b78c3 napi: Add tests that verify that lookup of non-existent global callbacks and properties fails 2023-08-08 13:44:12 +02:00
Simon Hausmann
7c8b49743c napi: Remove unnecessary dependencies
Let's add them later when we need to
2023-08-08 13:43:52 +02:00
Simon Hausmann
824c8ae6c6 Fix napi CI
- Re-add windows to the tested platforms
- Use the dev-dependencies and build instructions in packages.json instead of duplicating them in ci.yaml
  (use a debug build because of #3222 )
- use a separate cache key for the rust cache, to avoid sharing cache
  with the neon artefacts
2023-08-08 13:43:18 +02:00
Simon Hausmann
af63c2e270 Fix slint-lsp process zombies
Drop the connection before waiting for the io_threads
to join, because those require the Connection's
sender to be destroyed so that the stdio writer
thread can terminate cleanly.
2023-08-08 08:48:33 +02:00
Simon Hausmann
0007a0c0d9 napi: Remove unnecessary cargo build
Since this file is part of the repository workspace, we
should use the common profile in the top-level Cargo.toml.
2023-08-07 17:20:47 +02:00
Olivier Goffart
c9f716d898
Make a esp-idf component for slint 2023-08-07 16:33:02 +02:00
Simon Hausmann
56feda7ad9 napi: Fix typo in file name 2023-08-07 13:30:06 +02:00
Olivier Goffart
63ca3509ea
MVU board support README: change the opt-level for the stm32h7 board
Use `CARGO_PROFILE_RELEASE_OPT_LEVEL=s` otherwise the program don't fit in flash
2023-08-07 12:59:31 +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
Florian Blasius
b375b67467
Initial setup for napi-rs port (#3171)
* Startup with napi.

* Added interpreter api for napi.

* Initial implementation of set_property/get_property on ComponentInstance

Co-authored-by: Florian Blasius <FloVanGH@users.noreply.github.com>

* fixup! minimal napi setup

* Type conversion for napi.

* Work on napi callbacks.

* Fix life-time of JsFunction kept in closures for callbacks

The life-time of napi values is limited to the method invocation from napi itself.
In order to keep a value beyond that, it's necessary to use persistent references:

https://nodejs.org/api/n-api.html#references-to-values-with-a-lifespan-longer-than-that-of-the-native-method

* Added callback tests for napi.

* Fix licenses for napi stuff.

* Update api/napi/src/interpreter/component_instance.rs

Co-authored-by: Olivier Goffart <olivier.goffart@slint-ui.com>

* Update api/napi/src/interpreter/component_instance.rs

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Code review stuff

* Update api/napi/src/interpreter/component_definition.rs

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update api/napi/src/interpreter/component_instance.rs

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update api/napi/src/interpreter/component_instance.rs

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* code review fixes

* ci fix

* code review fixes.

* up

* Revert "up"

This reverts commit 06412f1acf.

* ci fix

---------

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>
Co-authored-by: Florian Blasius <FloVanGH@users.noreply.github.com>
Co-authored-by: Olivier Goffart <olivier.goffart@slint-ui.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-08-07 10:44:05 +02:00
Simon Hausmann
f301e3d8c9 Remove Rust/C++ type name sentence in StandardListViewItem docs
This makes no sense in the Slint docs. But it's okay, this is a really
simple data structure anyway.

Amends 37488f015d
2023-08-03 15:54:54 +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
Update Translations Bot
3e79b6957c Update Translations: extract strings 2023-08-03 03:04:26 +00: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
7ec5b01ff0 C++: Properly enable the software renderer when the feature is enabled 2023-08-02 11:57:02 +02:00
Olivier Goffart
bcbe157712 Native style: Fix animations with the KDE's breeze style
The style use update() on an invisible widget so animations wouldn't
work. As a workaround, capture the MetaCall event
2023-08-02 10:56:25 +02:00
Olivier Goffart
5718b15899 Qt platform: use QWindow::requestUpdate instead of QWidget::update
Otherwise we may repaint too fast

Fixes #3193
2023-08-02 10:56:25 +02:00
Olivier Goffart
b94e3c3886 Update .mailmap to use the slint.dev domain 2023-08-02 08:57:55 +02:00
Tasuku Suzuki
3571396159
ffmpeg example: Change background color to black (#3204)
In general, black background better matches the aesthetics of video
playback apps, making the viewing experience more immersive.
2023-08-02 07:36:38 +02:00
Olivier Goffart
a12b7c416f C++ platform qt example: implement timer events
(so that the line edit cursor blinks)
2023-08-01 17:50:00 +02:00
Florian Blasius
d3bfdf7e7f Added test for LangType to ValueType conversion 2023-08-01 12:24:32 +02:00
Florian Blasius
b3b6126f4b Added missing brush type to ValueType from LangType. 2023-08-01 12:24:32 +02:00
Simon Hausmann
203a5ed431 linuxkms: Tweak mouse cursor appearance
- Fix the viewbox so that cursor isn't squashed but appears in the
  correct ratio.
- Add a ~2 pixel wide white stroke around it, so that it's easier to see
  on dark background.
2023-07-31 20:11:15 +02:00
Simon Hausmann
f3f7d1de33 Don't show live-preview in fullscreen when running VS code with WSL
Generally, disable the fullscreen rendering. This selection mechanism
needs reworking, as one might want to use the live-preview in a setup
where weston, etc. are running side-by-side.

This could be made configurable in the future, i.e. choosing a backend
like linuxkms, or having the window state as property in Slint.
2023-07-31 20:10:49 +02:00
Olivier Goffart
f5caafd379 linuxkms: Implement support for SLINT_SCALE_FACTOR 2023-07-31 19:35:17 +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
Simon Hausmann
23ca0cb36c Disambiguate Render trait type name
Use FullscreenRenderer as name for the trait used in the linuxkms backend
2023-07-31 17:11:43 +02:00
Simon Hausmann
868173cc20 Disambiguate the type name SkiaRenderer
- Use WinitSkiaRenderer for the adapter in the winit backend (similar to WinitSoftwareRenderer)
- Use SkiaItemRenderer for the impl of the ItemRenderer trait
2023-07-31 17:11:43 +02:00
Simon Hausmann
b503733d03 Update to a new release of the Rust Skia bindings 2023-07-31 16:18:42 +02:00
Olivier Goffart
0a8f9c585a
C++: expose special key codes constants 2023-07-31 15:11:57 +02:00
Simon Hausmann
ad84114bae Fix build of generated C++ code with older macOS versions
Avoid the use of std::optional<T>::value.

Amends 0ba6ef1c24
2023-07-31 14:37:45 +02:00
Simon Hausmann
d96d37ea4b Fix linuxkms on i915
Adding a framebuffer with the given modifiers fails for some reason. Forcing
the gbm surface to linear is one workaround, but instead
let's use the old API without modifiers but still planar support.

This also removes the dependency to drm-ffi again, which was missing from renderer-femtovg.
2023-07-31 13:47:23 +02:00
Simon Hausmann
6b044ae078 Rename extension trait to use Ext as suffix 2023-07-31 13:06:28 +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
Olivier Goffart
41f0972e4b C++ platform Qt example: handle key events 2023-07-31 12:58:38 +02:00
Olivier Goffart
a34074db11 Move the C++ specific example to the examples/cpp directory
The platform ones are not experimental so move out of tests
2023-07-31 12:58:38 +02:00
Simon Hausmann
4b2eacd024 Fix build
Amends 717a3d9729
2023-07-31 12:46:58 +02:00
Simon Hausmann
717a3d9729 linuxkms: Add support for planar framebuffers and DRM modifiers 2023-07-31 12:07:33 +02:00
Simon Hausmann
d681864a3b c++: Fix missing platform API Docs
- Fix pre-processor include search path setup so that pre-processing
  slint.h finds slint_internal.h and (most importantly)
  slint_generated_public.h for the feature defines.
- Add missing documentation that caused doxygen errors.
2023-07-31 11:45:01 +02:00
Simon Hausmann
8c289fe3cc Fix doxygen formatting for slint::interpreter::Value::operator== 2023-07-31 11:45:01 +02:00
Simon Hausmann
c2689f3f56 Prospective fix for failing nightly builds
Don't try to install newer packages on older Ubuntu versions
(where we don't need them anyway)
2023-07-29 13:32:16 +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
Simon Hausmann
8d0b0e945c Add ChangeLog entry 2023-07-28 13:40:37 +02:00
Simon Hausmann
fee44f3f7d Add basic support for libseat
This is not dynamic unfortunately, but at least it forwards device access for OpenGL and remove the need to run it as root.
2023-07-28 13:40:37 +02:00