Commit graph

9721 commits

Author SHA1 Message Date
Olivier Goffart
ae4debafe2 Compiler: Don't panic when a Row is repeated in a GridLayout
Fixes #3729
2023-10-23 19:43:46 +02:00
Tobias Hunger
49571c8bf2 qt: Silence warning during Slint build
Silence this warning:

```
warning: i-slint-backend-qt@1.3.0: qt_window.rs:1536:17: warning: ignoring temporary created by a constructor declared with 'nodiscard' attribute [-Wunused-value]
```
2023-10-23 16:52:42 +02:00
Olivier Goffart
1d3c3e5dae Test for #2598
CC #2598
2023-10-23 16:52:03 +02:00
Olivier Goffart
78d273e599 Revert "Reduce the amount of re-creation of cells in repeaters when the model changes (#1954)"
This reverts commit 1162ebbb79.

Because otherwise if we keep the elements, their internal state is kept
and this causes bug #2598

Fixes #2598
2023-10-23 16:52:03 +02:00
J-P Nurmi
0d366e0087 LSP: add "Repeat element" and "Make conditional" code actions 2023-10-23 15:58:24 +02:00
Simon Hausmann
670fed7dbd Reduce softbuffer features
Only pull in wayland or x11 and skip kms for now.
2023-10-23 14:54:21 +02:00
Olivier Goffart
6cccefd1b1 Janitor: fix rust test driver when run standalone
the component_container test use internal API
2023-10-23 14:37:05 +02:00
Olivier Goffart
0597313af8 Skia needs raw-window-handle 0.5
Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>
2023-10-23 14:22:48 +02:00
Olivier Goffart
28c67294cb softbuffer needs raw-window-handler 0.5 traits 2023-10-23 14:22:48 +02:00
Olivier Goffart
087ed3a8c5 Update to released version of winit 0.29 and glutin 2023-10-23 14:22:48 +02:00
Olivier Goffart
e3dae193f6 winit: Use run_ondemand instead of pump_events
That should be the same, but run_ondemand is showing the intend more
2023-10-23 14:22:48 +02:00
Olivier Goffart
58e5d62a02 Winit port: Fix wasm build
Port everything from instant to web-time
2023-10-23 14:22:48 +02:00
Olivier Goffart
12cd8e71f1 WIP: some polish over the winit update to 0.29 2023-10-23 14:22:48 +02:00
Olivier Goffart
0fac958ebf Revert "Fix touch events not working for wasm builds"
This reverts commit 5879e1ec71.

We will update to next version of winit:
Closes #2424

 Conflicts:
	internal/backends/winit/Cargo.toml
	internal/backends/winit/event_loop.rs
	internal/backends/winit/glwindow.rs
	internal/renderers/skia/Cargo.toml
2023-10-23 14:22:48 +02:00
Tobias Hunger
58d61606cc Winit update to master
Conflicts:
	internal/backends/winit/event_loop.rs
	internal/common/key_codes.rs
2023-10-23 14:22:48 +02:00
Tobias Hunger
1e8574aa74 cleanup: rename a private function 2023-10-23 14:22:48 +02:00
Simon Hausmann
e0cc2e30a3 skia: Avoid unsafe in favor of bytemuck::cast_slice_mut 2023-10-23 13:55:23 +02:00
Simon Hausmann
d6ab1c4882 Document the explicit choice of Skia as software renderer as well as its support in general 2023-10-23 13:55:23 +02:00
Simon Hausmann
3855de0794 winit: Add support for selecting Skia's software renderer directly
That might be useful for debugging
2023-10-23 13:55:23 +02:00
Simon Hausmann
f7d666b948 winit backend: clean up renderer creation
Pass around a factory function to create the renderer,
instead of a factory function that creates the window adapter. The adapter is
always the same anyway, and this way the WinitWindowAdapter's new
also doesn't have to be generic.

This also prepares for adding a second skia renderer
constructor later to select a specific variant.
2023-10-23 13:55:23 +02:00
Simon Hausmann
60901a27ff skia: Fall back to software rendering if GPU accelerate rendering fails to initialize
At the moment this is only supported for the winit backend and the C++
API. linuxkms uses a different SkiaRenderer constructor.
2023-10-23 13:55:23 +02:00
Simon Hausmann
0aa4c42989 skia: Add support for Skia's software renderer 2023-10-23 13:55:23 +02:00
Simon Hausmann
2329bf9eb1 Fix Skia not rendering with some Radeon drivers on Windows
Sometimes Radon drivers report on Windows erroneously that it supports
GL_NV_framebuffer_blit as extension but when looking up
glBlitFramebufferNV via getProcAddress it returns a null pointer.

The issue goes away when bumping the GLES version. GLES 2.0 was released
in 2003 and 3.0 in 2012. Practically everyone supports it nowadays (even
Safari), so that's the easiest solution for the Skia renderer.
2023-10-23 11:42:54 +02:00
Olivier Goffart
5bf2c7192b Fix panic with very large ListView
In `ItemRc::find_sibling` we currently do:
 1. get the range
 2. check that the next index is within the range
 3. call `get_subtree`

The problem is that get_subtree itselg will call 'ensure_updated' which
will do the relayout of the ListView and may get a different range of
element.

So don't query the range before and just have get_subtree to return an
empty ItemWeak if we are out of the actual range.

Couldn't really find a way to make a test since this is called from
the accessibility code which is hard to test as is

For #3700
2023-10-21 14:03:39 +02:00
J-P Nurmi
b8c3bbef74 LSP: don't insert extra braces for "Wrap in element" auto-completions 2023-10-21 07:35:32 +02:00
Olivier Goffart
975abf3c42 Don't steal the x and y properties for dummy parents
Parents surch as Opacity, Clip, and co, used to steal the x and y
property of their children, making the property not what they ought to
be.

Now that we refactored recently the code so that geometry need not to be
always linked to a property of the same name, we can dissociate the x
and y property of these generated elements and their content so that the
actual "x" property of the former elementstay some value, despite its
relative item property is now 0.

Had to change a bit of code that was still assuming a literal "height"
or "width" or "y" or "x" property that no longer worked when the
geometry is dissociated from its property

Fix #1072
2023-10-21 07:30:46 +02:00
J-P Nurmi
c5248c005e Allow specifying paths for @library imports 2023-10-20 16:47:00 +02:00
Tobias Hunger
df544fe1c9 interpreter: Introduce internal feature
... and use it to hide internal functionality so users will notice that
they depend on fucntionality we do not provide any guarantees for.

Make the lsp and viewer request the internal feature when building the
interpreter.
2023-10-20 15:34:49 +02:00
Tobias Hunger
d6ec7f23a1 Change component factory API
... to avoid winit panicing on us when embedding some item tree.
2023-10-20 15:34:49 +02:00
Olivier Goffart
3ab98a7596 LSP: harmonize spaces when auto-completing element name
Fixes #3714
2023-10-20 14:35:59 +02:00
Tobias Hunger
23a9f5aeb8 LSP: Fix race condition
In rare cases I was getting a response before the request that the LSP
sent out way registered in the event queue. Insert the request earlier.
2023-10-19 20:55:09 +02:00
Olivier Goffart
f4dd08783c janitor: C++: make the code more readable by having the type explicit 2023-10-19 18:09:14 +02:00
Olivier Goffart
172dcfa775 C++: fix crash when accessing empty model from Slint
Fixes #3704
2023-10-19 18:09:14 +02:00
Simon Hausmann
403bb6c716
napi: Catch typescript errors in the CI and in debug builds (#3703)
We use esbuild to transform index.ts into index.js, but we also need to
perform a type check. esbuild doesn't do that, this is left to the
typescript compiler. So let's run it with -noEmit as recommended by the
esbuild folks, in debug builds as well as in the CI (which doesn't do
debug builds).
2023-10-19 18:05:32 +02:00
Guilhem Vallat
75b3a3e07b Implement Model:as_any() for all adapter models 2023-10-19 17:19:40 +02:00
Guilhem Vallat
dc43c6f620 Add source_model() to FilterModel, SortModel, ReverseModel and MapModel
As a mean of getting the inner model, useful to be able to push into the
underlying model.
2023-10-19 17:19:40 +02:00
Tobias Hunger
6cd68e84a7 interpreter: Fix highlighting
Clean the highlight pass so that it is in the same form as the paths
stored in the interpreter. Otherwise they do not match and highlighting
will fail.
2023-10-19 15:01:46 +02:00
Tobias Hunger
f12b3d2df4 vscode: Create highlight function again and pass it to the LSP
This stops a panic then triggering a highlight to happen.
2023-10-19 15:01:46 +02:00
Tobias Hunger
f6f369251b Revert "vscode: Use ESM modules"
Using ESM modules causes issues with the web extension: It complains
about use of "ImportScript" in a module. Something adds that into the
module, I need to properly investigate what and why. Let's revert this
till then.

This reverts commit cb66bc1650.
2023-10-19 15:01:46 +02:00
Tobias Hunger
c1456e5153 component_container: Add background rectangle 2023-10-19 13:22:39 +02:00
Florian Blasius
f4eb46465b
napi documentation (#3689)
* napi documentation

* Add missing documentation
* Generate documentation with typedoc

* Update api/napi/cover.md

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>

* Update api/napi/cover.md

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>

* Update api/napi/cover.md

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>

* Update api/napi/cover.md

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>

* Update api/napi/index.ts

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>

* Update api/napi/cover.md

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>

* Update api/napi/cover.md

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>

* Update api/napi/cover.md

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>

* Update api/napi/cover.md

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>

* Update api/napi/cover.md

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>

* Update api/napi/src/types/size.rs

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>

* Update api/napi/cover.md

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>

* Update api/napi/index.ts

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>

* Update api/napi/index.ts

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>

* Update api/napi/src/types/size.rs

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>

* code review feedback.

* Update api/napi/cover.md

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>

* Update api/napi/cover.md

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>

* Update api/napi/cover.md

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>

* Update api/napi/cover.md

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>

* Code review feedback.

* Update api/napi/index.ts

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>

* code review feedback.

* Update api/napi/cover.md

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>

* Update api/napi/cover.md

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>

* Update api/napi/cover.md

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>

* Update api/napi/cover.md

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>

* Code review feedback.

* napi: added slint example to callback

* napi: added example to instantiating a component

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

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>

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

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>

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

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>

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

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>

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

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>

* Update api/napi/src/types/brush.rs

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>

* Update api/napi/src/types/image_data.rs

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>

* napi: more code review stuff

---------

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>
2023-10-19 11:53:00 +02:00
Update Translations Bot
1caa23547a Update Translations: extract strings 2023-10-19 03:04:11 +00: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
Simon Hausmann
b34e365701 doc: Add missing space as word separator 2023-10-17 13:32:32 +02:00
Simon Hausmann
e0d1d4366d doc: In the type mapping, refer to the angle as "angle", not as "value" 2023-10-17 13:26:04 +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
Olivier Goffart
5513e470d5 Fix LSP not quiting when it shows a preview
The "LanguageServer" thread (New name also given in that commit) is
blocked while waiting for the io threads because the preview keeps a
ServerNotifier in its content cache.
We first need to tell the preview to quit before waiting on these
threads.
2023-10-17 11:09:53 +02:00