Commit graph

1483 commits

Author SHA1 Message Date
Simon Hausmann
a2e10f8c78 When trying to fetch an ElementHandle as part of a RPC, remove the tracked handle if it's not valid anymore
There's no value in keeping it.
2024-06-13 04:03:17 -07:00
Simon Hausmann
1c6aadeb30 Add support for setting the accessible value 2024-06-13 04:03:17 -07:00
Simon Hausmann
e071ba9e5b Add a way to invoke accessibility actions 2024-06-13 04:03:17 -07:00
Simon Hausmann
97343b22db Testing: Add the ability to locate elements by id and expose various properties 2024-06-13 04:03:17 -07:00
Simon Hausmann
4591ad8d57 Add plumbing for system testing 2024-06-13 04:03:17 -07:00
Simon Hausmann
319fa0381c
Doc: Fix stray backtick 2024-06-13 06:33:30 +02:00
Simon Hausmann
9c75009910 LinuxKMS: Fix build with just the software renderer
We don't need gbm, but at least the drm crate.
2024-06-11 17:35:52 +02:00
Simon Hausmann
97df6b1be1 Mark AccessibleRole as non-exhaustive
That way we can add new variants in the future, while still exporting this in our public API.
2024-06-11 08:02:10 -07:00
Simon Hausmann
0347aae66b Add ElementHandle::accessible_role()
This allows querying for elements by their role/type.
2024-06-11 08:02:10 -07:00
Olivier Goffart
58826ddd94 Testing C++ API: add a visitor over the ElementHandle 2024-06-10 15:52:40 +02:00
Simon Hausmann
028903c2d3 LinuxKMS: Add support for partial rendering with the Slint software renderer 2024-06-10 06:01:19 -07:00
Simon Hausmann
27e9b133c9 LinuxKMS: Improve error reporting when failing to initialize any renderer
Collect the errors and print the lot of them.
2024-06-10 06:01:19 -07:00
Simon Hausmann
03b6a055e9 LinuxKMS: Initial support for rendering with the Slint software renderer
Two features are still missing:
 - mouse cursor support
 - partial rendering
2024-06-10 06:01:19 -07:00
Olivier Goffart
318c80b4f2 testing: only visit items that are visible and not fully clipped 2024-06-07 15:08:44 +02:00
Olivier Goffart
a780dd4905 Testing: Fix duplicated accessibility element
This fix the C++ todo test that wasn't run because of a typo

When an element is optimized in another one, only the first one should
report the accessible properties. (because element with accessible
properties cannot be optimized so they are always the first)
2024-06-07 13:18:12 +02:00
Simon Hausmann
0e67654431 Fix jitter when resizing a window on macOS
Commit 1e450abc9c originally fixed this. Meanwhile, after many refactorings, this doesn't work anymore for the FemtoVG renderer. That's because the contents placement (or layer's contents gravity) is set before the hidden layer NSOpenGLContext creates is associated with the view.

For the Skia GL surface that already works, but for clarify the code is moved into the same location.

For Skia Metal rendering, apply the same on the metal layer (through the view). For this to work the contents scale also needs to be applied. To avoid further visual effects, the scale needs to be applied as early as possible, so apply it right after creating the
surface and latest at rendering time.

Fixes #5258
2024-06-06 08:34:58 -07:00
Olivier Goffart
e9deb00332 Testing API: Have a public rust visitor function 2024-06-06 16:12:53 +02:00
Olivier Goffart
ec0ddbc5b9 Add missing license header from previous commit 2024-06-06 11:18:15 +02:00
Luc Fauvel
44a537d902
Implemented resizing for non-decorated winit windows (#5026)
Fixes #5023

* Implemented resizing for non-decorated winit windows

* Fixed formatting

* Changed direction match to use a tuple, reduced resize border size, returned after handling resize

* Added is resizable check for before resizing winit window

* Added resize-border property to window

* Formatted code

* Change resize-border from float to length
2024-06-06 11:17:05 +02:00
Arnold Loubriat
8ece16321b Add DefaultActionVerb to AccessKit nodes 2024-06-06 00:01:29 -07:00
Simon Hausmann
28cff6628d Add a test for looking up elements by id that are conditional 2024-06-05 09:51:13 -07:00
Simon Hausmann
15b517a554 Emit a warning to stderr (debug_log) when using the ElementHandle API but there's no debug info present 2024-06-05 01:29:58 -07:00
Simon Hausmann
622991a627 Fix ElementHandle::find_by_element_id docs
Describe what an id is and provide an example.
2024-06-05 01:29:58 -07:00
Simon Hausmann
7af0e7ae7c Add C++ API for find_by_element_type_name 2024-06-05 01:29:58 -07:00
Simon Hausmann
1a8ce3c659 Add support for optimized rectangles in ElementHandle
Keep merging elements, but remember the boundaries in the debug info, separated by a slash.

Also fixed tests that rely on accessible-label being set only once. For example

```
Button { text: "foo"; }
```

will certainly have "foo" as accessible-label on `Button`, but its internal `Text` element has
an implicit "accessible-label" set to the same
value.

So don't rely on that for now but search by id instead.
2024-06-05 01:29:58 -07:00
Simon Hausmann
a752851d0f Expose element type names and ids in Rust and C++ 2024-06-05 01:29:58 -07:00
Simon Hausmann
4eef2d4936 WIP: Add find_by_element_type_name 2024-06-05 01:29:58 -07:00
Olivier Goffart
43a336b534 C++ part of element_ids
Simplify a bit the llr generation so that there is less code duplication
between Rust and C++
2024-06-05 01:29:58 -07:00
Simon Hausmann
73b5136f98 WIP: Search by qualified element id 2024-06-05 01:29:58 -07:00
Tobias Hunger
d9224cd58f janitor: Use more workspace dependencies 2024-06-04 14:58:29 +02:00
Olivier Goffart
dea51f2055 Android: fix content positioning
The getWindowVisibleDisplayFrame seems to return a rectangle in the screen coordinate and cut the room for the camera.
The problem is that the Window is somehow already displaced.
The insets seems to be a better way to get that value.

Fixes #5242
2024-06-03 16:53:29 +02:00
Olivier Goffart
b3181b05a2 Android: clear the native focus when the keyboard hides
Otherwise the keyboard will popup again when the app is switched to the
background and back.

Fixes #5235
2024-06-03 16:27:47 +02:00
Olivier Goffart
a1e7f85892 Android: Always hide cursor/selection handle when the keyboard hides
Fixes #5233
2024-06-03 16:21:47 +02:00
Arnold Loubriat
2e5ebe2668 Address review comments 2024-06-03 01:38:06 -07:00
Arnold Loubriat
f97de46c6f Set accessible min/max values on progress indicator widgets 2024-06-03 01:38:06 -07:00
Simon Hausmann
d183498c4e Add support for step-size to SpinBox rendered by the Qt style
Fixes #5325
2024-05-31 09:45:29 -07:00
Aurindam Jana
3523e86359
Simplify commercial license (#3063)
Base the commercial license on the Royalty-free license adding clauses pertaining to the fees.
2024-05-31 14:06:17 +02:00
Aurindam Jana
9a3aa265d5
Update Royalty-free license (#5257)
Add clarification that Application may not expose Slint APIs.
2024-05-31 10:53:19 +02:00
Simon Hausmann
fbc441c372 Fix invoke_accessible_increment/decrement_action docs
They invoke a callback, not change a property.
2024-05-27 18:52:16 +02:00
Montel Laurent
f63523f708
Add increase/decrease support test (#5224) 2024-05-14 10:40:12 +02:00
Montel Laurent
c37c9d4f26
Testing: Add minimum/maximum support (#5192) 2024-05-10 16:18:02 +02:00
Simon Hausmann
09cfd067dd Prospective fix for Qt style’s slider’s release callback
Like in the Slint impl, invoke only if previously pressed.
2024-05-09 14:14:09 +02:00
Montel Laurent
f8f3316dc1
Allow to check checkable support (#5186) 2024-05-07 13:44:14 +02:00
Simon Hausmann
b00752514c Skia: Don't use Vulkan by default also on linuxkms
Amends ac53049408
2024-05-07 12:51:41 +02:00
Olivier Goffart
ebc4a14602 Update the android-activity crate by adding a new feature
The android-activity 0.5 no longer works with Rust 1.78 because it
asserts with
> slice::from_raw_parts requires the pointer to be aligned and non-null, and the total size of the slice not to exceed `isize::MAX`

Note that the documentation is build with the 05 feature because it also
build the winit backend crate in the same command that still depends on
android-activity 0.5 via winit
2024-05-07 12:48:49 +02:00
Tobias Hunger
2e3b00e38e janitor: Fix some clippy warnings pre-release
Nothing that should be controversial, but the
`internal/compiler/builtin_macros.rs` could point to a thinko in the original
commit.
2024-05-06 16:47:14 +02:00
Simon Hausmann
ed0030efe8 Pick the Skia renderer over FemtoVG
If Skia is available, pick that over FemtoVG. We end up recommending
Skia for most customers, so it should be enough to enable the feature
and not require additionally setting the `SLINT_BACKEND` environment
variable.

This change also means that the live-preview in the language server will
default to Skia on desktop installations. On the downside, this means
that Slintpad and the VS Code extension for the web will be using a
different renderer (FemtoVG).

Cherry picked from commit 90da6a9d7e,
as the parent commit of this change fixes the issue that required
reverting it.
2024-05-06 12:01:05 +02:00
Simon Hausmann
518681cc02 Fix live-preview not working with Skia backend
When the winit backend creates the Skia renderer, there is no associated surface to render into. Only the winit Resume event would cause a call to set_window_handle() and thus surface creation. This was done for the earlier Android backend, and is generally good practice.

When running for example slint-viewer with SLINT_BACKEND=winit-skia, we would create the skia renderer (no surface), then start the winit event loop, get a resume event, initialize the surface, and it all works.

With the live-preview inside the lsp, we'd create the event loop, get a resume event (but there's no window yet), and then we'd create the skia renderer without a surface... ever.

It's not ideal, but for now call resume() explicitly since we _do_ have a winit window, and we're not calling this on Android anymore.
2024-05-06 12:01:05 +02:00
Simon Hausmann
43e3c57b3b Prospective fix for rustdoc warnings about unknown cfg's
Let cargo know about our internal cfgs.
2024-05-06 12:00:44 +02:00
Simon Hausmann
2acae37fd1 Revert "Pick the Skia renderer over FemtoVG"
This reverts commit 90da6a9d7e.

Somehow the live-preview with VS code stopped working with this change,
so revert it for now.
2024-05-06 09:45:31 +02:00