Commit graph

9721 commits

Author SHA1 Message Date
Olivier Goffart
347b2d0fbf C++: Don't use optional::value
It is not available when targetting older macOs since it can throw an
exception that needs library support
2023-10-11 07:57:57 +02:00
Update Translations Bot
0fabba49ec Update Translations: extract strings 2023-10-11 03:04:49 +00:00
Tobias Hunger
6546d1a02f editors: Mention intellij plugin
... and remove the instructions on hopw to set up the generic LSP plugin
for Intellij that seems to be unmaintained nowadays.
2023-10-10 20:05:05 +02:00
Tobias Hunger
0ff8e2cdb6 compiler: Rework path handling
Add some code to do platform-independent path processing.

This is necessary aas WASM does e.g. not have any absolute paths and
such and the compiler tended to produce wrong results in that case.

Side-effect: We no longer need to depend on `dunce`
2023-10-10 20:04:47 +02:00
Simon Hausmann
26e2a3d422 Enable the linuxkms backend in the "Yocto CI" 2023-10-10 18:16:27 +02:00
Simon Hausmann
5094d56ca7 Run the Yocto build of master once a day 2023-10-10 17:25:40 +02:00
Simon Hausmann
e628277248 Re-enable the Skia build against our Yocto SDK
Commit f5c3908b7e fixed it.
2023-10-10 17:24:10 +02:00
Tobias Hunger
4e4967eabc slintpad: Support passing in style via permalink URL 2023-10-10 17:13:51 +02:00
Simon Hausmann
f5c3908b7e Fix build of Skia renderer in Yocto for armhf
As per commit 69feb7f0f40cc8dc4ca52777cf87a4c879d4b953 in meta-slint and
others, the Skia build is tricky because clang needs to be indirectly
and carefully instructed where gcc headers are located. In the Yocto
recipes, we go through lengths to set CLANGCC/CLANGXX correctly so that
the --target matches the triplet sub-directories in
recipe-sysroot/usr/lib and recipe-sysroot/usr/include/c++/$ver/ .

For aarch64 it's simple, there's usually just aarch64-$distro-linux, but
for example for armv7-$distro-linux-gnueabihf magic has to come
together: The gcc install dir is typically
recipe-sysroot/usr/lib/arm-$distro-linux-gnueabi (note the v7 and hf
absence). That means that's what --target needs to be when invoking
clang. But now the `hf` suffix is gone, which means clang relies on for
example -mfloat-abi=hard to avoid the use of gnu soft-float stubs. All
that's meticulously prepared in the Yocto recipe and placed for easy
consumption in CLANGCC/CLANGCXX environment variables. Therefore, when
those environment variables are set, don't overwrite them in
CORROSION_ENVIRONMENT_VARIABLES.when those environment variables are
set, don't overwrite them in CORROSION_ENVIRONMENT_VARIABLES.
2023-10-10 15:25:42 +02:00
Simon Hausmann
b8c7c10a06 Add an entry for LinuxKMS to the chagnelog 2023-10-10 11:37:18 +02:00
J-P Nurmi
6f2fc9967a test-driver-screenshots: don't generate rotated screenshots 2023-10-10 10:39:13 +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
414a9e85e7 Expose swrenderer screen rotation to C++ and esp-idf 2023-10-09 18:07:23 +02:00
Olivier Goffart
b0bc14d8a4 Fix the screenshot tests for rotated gradients
Rotated gradients are not precise enough and have big differences when
rotated.
So add an option to ignore them
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
4bbfbd541b Prospective fix for MSVC warnings
Warning looks like that

```
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.35.32215\include\tuple(144,47): warning C4244: 'initializing': conversion from '_Ty' to '_Ty', possible loss of data [D:\a\slint\cppbuild\examples\virtual_keyboard\cpp\virtual_keyboard.vcxproj]
            with
            [
                _Ty=int
            ]
            and
            [
                _Ty=float
            ]
  C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.35.32215\include\tuple(239): message : see reference to function template instantiation 'std::_Tuple_val<_This>::_Tuple_val<_Ty>(_Other &&)' being compiled [D:\a\slint\cppbuild\examples\virtual_keyboard\cpp\virtual_keyboard.vcxproj]
            with
            [
                _This=float,
                _Ty=int,
                _Other=int
            ]
  C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.35.32215\include\tuple(239,81): message : see reference to function template instantiation 'std::_Tuple_val<_This>::_Tuple_val<_Ty>(_Other &&)' being compiled [D:\a\slint\cppbuild\examples\virtual_keyboard\cpp\virtual_keyboard.vcxproj]
            with
            [
                _This=float,
                _Ty=int,
                _Other=int
            ]
  C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.35.32215\include\tuple(802): message : see reference to function template instantiation 'std::tuple<float,float,float,float>::tuple<std::_Exact_args_t,int,float,float,int,0>(_Tag,_This2 &&,float &&,float &&,int &&)' being compiled [D:\a\slint\cppbuild\examples\virtual_keyboard\cpp\virtual_keyboard.vcxproj]
            with
            [
                _Tag=std::_Exact_args_t,
                _This2=int
            ]
  C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.35.32215\include\tuple(802,12): message : see reference to function template instantiation 'std::tuple<float,float,float,float>::tuple<std::_Exact_args_t,int,float,float,int,0>(_Tag,_This2 &&,float &&,float &&,int &&)' being compiled [D:\a\slint\cppbuild\examples\virtual_keyboard\cpp\virtual_keyboard.vcxproj]
            with
            [
                _Tag=std::_Exact_args_t,
                _This2=int
            ]
```
2023-10-09 17:25:24 +02:00
Simon Hausmann
1c37a7ed60 linuxkms: Prospective fix for touch input when SLINT_SCALE_FACTOR is set
When supplying logical touch coordinates to the slint::Window, scale
them to the logical screen size, not the physical one.
2023-10-09 16:47:37 +02:00
Florian Blasius
5d5934d932 Removed no longer needed build napi package setp 2023-10-09 16:07:07 +02:00
Simon Hausmann
b31d6c464a linuxkms: Add support for motion pointer events with absolute coordinates
When using qemu we receive these, for example.
2023-10-09 12:12:04 +02:00
Florian Blasius
d425c13ff2
Added install script for napi (#3623) 2023-10-09 11:10:14 +02:00
Olivier Goffart
091dd0a7b9 Rename dynamic_component to dynamic_item_tree 2023-10-09 11:01:56 +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
Simon Hausmann
186c3ef3cb Simplify filter/map expression
Co-authored-by: Olivier Goffart <olivier.goffart@slint.dev>
2023-10-07 11:26:17 +02:00
Simon Hausmann
b6b3dfc9c0 linuxkms: Prospective fix for failing crtc setup
If the chosen connector doesn't have a current encoder (who's crtc we could use), fall back to the algorithm described in

    https://manpages.debian.org/testing/libdrm-dev/drm-kms.7.en.html#CRTC/Encoder_Selection

for selecting the crtc (minus the usage check, since we drive only one connector).
This is also the same logic as in kmscube.
2023-10-07 11:26:17 +02:00
Olivier Goffart
4c0a435196 Implement TouchArea::scroll-event
Closes #1280
2023-10-07 07:59:53 +02:00
Olivier Goffart
2f4e110111 ChangeLog update 2023-10-06 17:26:59 +02:00
Olivier Goffart
22284000ec esp-idf: Wait for vsync before swapping frame buffers 2023-10-06 17:19:07 +02:00
Simon Hausmann
231dbd5695 Revert "Revert "Improve file type for SLINT_COMPILER cmake cache variable""
This reverts commit 292f487815.

Olivier had the brilliant idea of preceeding the path with a slash
on the Yocto side, so we can go back to the correct "type".
2023-10-06 14:56:28 +02:00
Simon Hausmann
0ff0153462 doc: Add missing period 2023-10-06 14:25:24 +02:00
Simon Hausmann
292f487815 Revert "Improve file type for SLINT_COMPILER cmake cache variable"
This reverts commit 0773e51d92.

By the SLINT_COMPILER being a `FILEPATH`, cmake will convert any
relative path to an absolute path. That's not wanted for the Yocto
build, because there we pass
'$ENV{OECORE_NATIVE_SYSROOT}/usr/bin/slint-compiler', so that
the path is resolved dynamically against the environment variable that
the Yocto SDK sets.

CMake would convert this to an absolute path that points into the build
directory, i.e. it would be /home/blah/foo/\$ENV{...}
2023-10-06 13:05:30 +02:00
Florian Blasius
e34cd741a8
Create components from a slint file for napi (#3566)
* Get todo example running with napi.

* Code review fixes.

* Code review feedback.

* Code review fixes.

* docs fix

* Update api/napi/__test__/resources/error.slint

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

* Update api/napi/__test__/resources/test.slint

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

* fix test

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-10-06 12:39:17 +02:00
J-P Nurmi
8dd51f76f1
Fix named exports in native code (#3602) 2023-10-05 16:41:10 +02:00
Simon Hausmann
a982bdebe2 Fix cmake producing absolute DT_NEEDED paths in applications when linking against installed libslint_cpp on Linux
Commit 9b62b08ed6 fixed
https://github.com/slint-ui/slint/issues/1066 initially, but commit
1036c0d082 erroneously regressed this
again, because while Corrosion sets this property, it is only set on the
locally generated CMake target. We still need to propagate that also
into the installed CMake target, which this patch does.
2023-10-05 16:07:28 +02:00
Simon Hausmann
dbabb33c45 Fix build of dependencies that use pkg-config when building Slint in buildroot
When building with cmake, buildroot sets PKG_CONFIG_SYSROOT_DIR in its
toolchain file, and therefore it's only available at configure time but
not build time, which is when our dependencies need it.
2023-10-05 09:39:04 +02:00
J-P Nurmi
10ae5cd60a Skia: fix line height calculation for eliding the last line of text 2023-10-05 08:54:02 +02:00
Simon Hausmann
3a56bcd2a4 Fix build of linuxkms backend on Yocto
We enable libseat's custom_logger feature by default, which redirects
log output from libseat into the Rust log facade. That's nice, but as
part of the implementation of this feature unfortunately libseat's
build.rs unconditionally adds /usr/local/include to the list of the
search include paths when compiling the log_handler.c file. That breaks
the Yocto build, rightly so:

warning: cc1: error: include location "/usr/local/include" is unsafe for cross-compilation [-Werror=poison-system-directories]

We can do without this feature, so let's not enable it.
2023-10-04 22:17:02 +02:00
Aurindam Jana
30f1ff5466
Update logo/README.md
Add Logo License info
2023-10-04 11:57:32 +02:00
J-P Nurmi
6792f6abf1 Skia: fix empty text input cursor alignment 2023-10-04 10:17:30 +02:00
J-P Nurmi
bf0e474a1f Handle unicode line- and paragraph separators 2023-10-02 23:26:21 +02:00
J-P Nurmi
59ee8edcdc Skia: fix cursor rect at a trailing newline 2023-10-02 23:26:21 +02:00
Simon Hausmann
afbe73414e
Fix winit backend crate description 2023-10-02 23:02:33 +02:00
Olivier Goffart
86968d6f80 Dependencies update 2023-10-02 20:27:25 +02:00
Olivier Goffart
661080676a Compiler: fix conversion of array of array of structs
When finding the common types for array of array, we must recurse in the
inner type

Fixes: #3574
2023-10-02 19:00:21 +02:00
Simon Hausmann
b50b661928 Fix GLESv3 compile check
If the headers aren't found, don't add them to CMAKE_REQUIRED_INCLUDES
2023-10-02 18:36:31 +02:00
Simon Hausmann
5103c07a9c Yocto CI build: Enable examples
After commit e44f70c9df this should work
and disable the one example that needs GLES3 while
the currently built SDK doesn't have the headers.
2023-10-02 18:16:17 +02:00
Simon Hausmann
d6f2942800 Add a build for Slint against a Yocto SDK
This is manually triggered for now
2023-10-02 17:35:46 +02:00
Olivier Goffart
9323d64479 Interpreter: fix crash when clicking on a item causes it to be destroyed
What happens is that the item is destroyed and removed from the layout
when clicking. But the send exit event still query the geometry if the
ItemRc which points to position in the layout cache that is not valid.

The Rust and C++ generator already check for the vailidity of the index
and return 0 if it's too large.

Fixes #3589
2023-10-02 16:50:29 +02:00
J-P Nurmi
0b518df12c FemtoVG: fix empty text input cursor alignment 2023-10-02 14:49:45 +02:00