Commit graph

10134 commits

Author SHA1 Message Date
Simon Hausmann
ebaecbcb7e Add support for running the tests in the CI
This is relatively straight-forward using nox.

One little change required was the change to the MACOSX_DEPLOYMENT_TARGET.
maturin requires it to be a full version, and GitHub actions requires it to
be quoted consequently, otherwise it interprets 11.0 as 11 and stores that
instead.
2023-12-21 12:57:35 +01:00
Simon Hausmann
81a636bb5f Exclude python module from workspace wide cargo test
It doesn't quite compile like that
2023-12-21 12:57:35 +01:00
Simon Hausmann
e4785220ef Add a little test for manual trying :) 2023-12-21 12:57:35 +01:00
Simon Hausmann
08461d7b32 Convert None to Void correctly 2023-12-21 12:57:35 +01:00
Simon Hausmann
82c2728cfd Add show/hide/run to component instance 2023-12-21 12:57:35 +01:00
Simon Hausmann
644ebbb2aa Split value conversion into a separate module 2023-12-21 12:57:35 +01:00
Simon Hausmann
10d6aa199c Split errors out into a separate module 2023-12-21 12:57:35 +01:00
Simon Hausmann
73024beb98 Begin wrapping the component compiler 2023-12-21 12:57:35 +01:00
Simon Hausmann
a2054e7ebd Add boilerplate 2023-12-21 12:57:35 +01:00
Simon Hausmann
adcfa9b9ca janitor: fix indentation of comment 2023-12-21 09:13:00 +01:00
Tobias Hunger
378280e0a7 lsp: Ignore the "Window" when selecting in preview
The compiler automatically adds a Window on top of the actual root
element when that isn't a Window already. When selecting the added
window element would get ignored and the "real" root element would get
selected as its only child. That causes the cursor to jump to the end of
the document.

So skip auto-added Windows when selecting, starting with the "real" root
element.
2023-12-20 19:28:35 +01:00
Tobias Hunger
9436a23546 lsp: Reset selection on preview update 2023-12-20 19:28:35 +01:00
Tobias Hunger
9e5806cfe8 lsp: Use lsp_types::Range over lots of usize 2023-12-20 19:28:35 +01:00
Tobias Hunger
ca1263c3e5 lsp: Handle selections and highlighting in the LSP
Ask the interpreter for all the necessary information, but handle the
look and feel in the LSP preview UI.
2023-12-20 19:28:35 +01:00
Tobias Hunger
c9414d98fa lsp: Add element tree printing functionality (unused!) 2023-12-20 19:28:35 +01:00
Tobias Hunger
9142336d5c interpreter: Add highlighting feature-gated functions
The preview can not leave it up to the interpreter to handle element selection
and highlighting. So add new functions to the interpreter (behind the
"highlight" feature-gate) to query positions of elements.

This exposes some of the code that is used by the existing highlighting code
and extends it where needed.

Two use-cases need to be covered:

1. Query the positions of a component (given by source file path and offset).
   This is then used to highlight all occurences of a component as the
   cursor position in a source file changes.

2. Query the position of an element (given as `ElementRc`).
   This is used when selecting elements in the UI. We need to work at
   the element level for this, not at the component level.

Also make the `highlight` module public but feature-gated, so that we
can put helper-types there.
2023-12-20 19:28:35 +01:00
Olivier Goffart
2ce161ced8 Parser: Hint for the mod function when parsing %
Was reported several times:
 - https://github.com/slint-ui/slint/discussions/4190
 - https://github.com/slint-ui/slint/issues/3980
2023-12-19 17:23:30 +01:00
Tobias Hunger
2404cce0bc janitor: Fix typos 2023-12-19 17:04:33 +01:00
Simon Hausmann
6b6fd91035 linuxkms: Move the fallback timer based animation driver code into a separate helper type 2023-12-19 16:59:35 +01:00
Simon Hausmann
0b21d8bfce linuxkms: Don't use a 16ms timer for the animation frame callback after the first buffer was posted
We don't need to wait 16ms, we could render right away. In theory this could also use invoke_from_event_loop, but then
the callback needs to be sync, which is an unnecessary
complication.
2023-12-19 16:59:35 +01:00
Simon Hausmann
2d0f2a52e6 linuxkms: Simplify drm event handling code a little bit
Less code nesting :)
2023-12-19 16:59:35 +01:00
Simon Hausmann
0ccc334de7 linuxkms: remove home-grown fd event source with calloop's generic even source
That's less boiler plate for us and better error handling (note how the receive_events()
call on the DRM device now propagates the error). And this also unregisters automatically
on drop.
2023-12-19 16:59:35 +01:00
Simon Hausmann
208a1e24ac linuxkms: replace 16m timer for animations with page flip driven rendering (if possible) 2023-12-19 16:59:35 +01:00
Simon Hausmann
4f0ad4c15b linuxkms: remove page flip specific bits from the calloop event loop
This belongs encapsulated inside the egldisplay code.
2023-12-19 16:59:35 +01:00
Simon Hausmann
b998f94ad6 linuxkms: Avoid keeping the EGL display around for too long
Don't keep a strong reference to the EGL display, we don't need that. If the display is removed but there are pending events, just ignore them.
2023-12-19 16:59:35 +01:00
Simon Hausmann
388661cc53 linuxkms: Fix firing of timers while animations are running
Merge the 16 redraw timer with other timers, which might fire sooner.
2023-12-19 16:59:35 +01:00
Simon Hausmann
b40b629e11 linuxkms: don't blockingly read on the drm fd after issuing a page flip request
... instead pass the fd into the calloop event loop and change state when we receive activity on it.

This improves performance slightly, and is a necessary to be able to implement refresh rate throttled rendering (in the next commits).
2023-12-19 16:59:35 +01:00
Simon Hausmann
11df315c54 linuxkms: Clean up file descriptor handling (part 2)
File can be converted into OwnedFd, so we can replace the
use of a dyn with the concrete Rc<OwnedFd>.
2023-12-19 16:59:35 +01:00
Simon Hausmann
e98a029293 linuxkms: Clean up file descriptor handling (part 1)
We don't need Arc for the file descriptors that remain in the same thread.
2023-12-19 16:59:35 +01:00
Olivier Goffart
7b3d96368b LSP: Fix error when going to the definition of builtin items
Instead of returning an "invalid:/" URL for the builtins, we should just
return a None result from the goto definition function.

Also add a test for goto_definition

Fixes #4126
2023-12-19 16:16:19 +01:00
Olivier Goffart
908c68f2a1 TextInput: inserting empty string should do nothing
So that we don't erase selection or call edited unless there is
something typed.

Workaround a bug in which plasma/wayland sends many empty ime event:
```
WindowEvent { window_id: WindowId(WindowId(94309690701616)), event: Ime(Preedit("", None)) }
```

Fixes #4184
2023-12-19 15:36:59 +01:00
Olivier Goffart
672820be0e Inline the Color accesor functions
Profiling reveal they are not always inlined, despite they are only a
single instruction and can be used in a tight loop. So there is no
excuse to not inline them.
2023-12-19 13:24:48 +01:00
Olivier Goffart
85526d772e Fix detection of properties when they are only used in two way bindings
Fixes #2166
2023-12-19 11:14:53 +01:00
Sergio Gasquez
7fd75a8ba0 feat: Use custom runner to flash and update espflash command 2023-12-19 10:46:03 +01:00
Olivier Goffart
34face122e
api: give proper panic message to a function that can panic from bad use
Also use #[track_caller] as the source location should point to the user's
source code as this is where the bug is
2023-12-19 10:45:13 +01:00
Simon Hausmann
95044c3a09
Rename WindowRotation to RenderingRotation in the software renderer (#4181)
Same term as we're going to use in the linuxkms backend.
2023-12-19 08:47:55 +01:00
Simon Hausmann
3b51c8e30a
LinuxKMS: Add support for synthetic display rotations (#4166)
This patch adds support for the `SLINT_KMS_ROTATION` environment
variable, that instructs the Skia/FemtoVG renderers to rotate
the scene before rendering.
2023-12-18 17:49:05 +01:00
Olivier Goffart
b8ebc084b6 Janitor: Crater: some edits to have hopefully less failures 2023-12-18 17:43:56 +01:00
Simon Hausmann
007de3dd8d Use raw-window-handle 0.6 for accesskit
The new release defaults to using rwh 0.6, which implicitly also
enables rhw_06 on winit.
2023-12-18 17:07:30 +01:00
Tobias Hunger
585e293a6a interpreter: Hide build_from_versioned_source behind feature flag 2023-12-18 16:01:59 +01:00
Tobias Hunger
d785f2d5df compiler: Store an optional version number with the document
A None value means the file on disk is the golden version.

We have an editor, the LSP and the preview that all need to at least
notice when they have newer data then their peers. So IMHO it makes
sense to have an optional document version around.

The language server protocol makes use of a version number already. This
patch moves that code into the compiler so that it is stored with the
actual data getting versioned.
2023-12-18 14:21:50 +01:00
Tobias Hunger
dc536ac599 cargo.toml: Sort workspace dependencies 2023-12-18 14:21:50 +01:00
Olivier Goffart
4484fe647b Fix wrongly optimized properties with aliases
If we don't see that a native property is modified, it could get inlined
and we wouldn't detect changes

Fix #4072
2023-12-18 12:22:20 +01:00
Noah Sweilem
4ca5afc710
Implement colorize-icon for NativeButton (#4167)
Fixes #4159.

Co-authored-by: Florian Blasius <florian.blasius@slint.dev>
2023-12-18 09:19:09 +01:00
Noah Sweilem
1ddddf1081
Qt backend: use QObject::deleteLater() when destroying popup QWidget (#4168) 2023-12-18 09:03:39 +01:00
Simon Hausmann
c04298647e Skia: Fix OpenGL rendering on devices that don't support GLES 3.0
Fall back to a GLES 2.0 context. After commit 2329bf9eb1 we bumped the minimum to 3.0, but that breaks
rendering on the stm32mp157 with linuxkms.
2023-12-15 16:48:23 +01:00
Update Translations Bot
393c5de1df Update Translations: extract strings 2023-12-15 03:03:51 +00:00
Simon Hausmann
18c5b1ebea doc: Fix link from Rust API docs to Slint language docs for singletons
Fixes #4158
2023-12-14 13:41:25 +01:00
Simon Hausmann
cdc2ccec3b Fix missing types from Node.js API docs
Commit 84fd6dc08c changed the import
from "rust-module" to "rust-module.cjs", which unfortunately broke
typedoc's visibility into the types. Revert back to using the import
without extension. With the given tsconfig files that works now and
typedoc publishes the docs for the re-exported types again.

Fixes #4153
2023-12-14 13:16:00 +01:00
Florian Blasius
e587c09d9c
Added colorize-icon to Button (#4152)
Co-authored-by: Simon Hausmann <simon.hausmann@slint.dev>
2023-12-14 12:07:55 +01:00