Commit graph

1483 commits

Author SHA1 Message Date
Simon Hausmann
3116ccf6d5
winit: separate menubar vbox from muda adapter (#8109)
The latter's life time is tied to the winit window and should live in WinitWindowOrNone.

Co-authored-by: Olivier Goffart <olivier.goffart@slint.dev>
2025-04-11 13:02:34 +02:00
Olivier Goffart
409413b835 Qt: re-arm the timer after callback from invoke_from_event_loop
This fixes the preview window not showing with the Qt backend,
because the preview uses a timer to show the window, but we would not
start the Qt timer and so the window was never shown
2025-04-11 12:41:10 +02:00
Simon Hausmann
cd29bdd367 Winit: remove maybe_loop_instance thread local
In the future, the plain winit::event_loop::EventLoop won't be usable for window creation anymore. There are two places where we need it:

1. From places where we also have access to the shared backend data.
2. From the top-level create_winit_window() function.

The latter we have to eliminate in the future, so might as well do it now and clean up to have one thread local less.
2025-04-11 09:37:03 +02:00
Simon Hausmann
fe56fdd5e4 Minor cleanup
Reduce access to CURRENT_WINDOW_TARGET thread-local
(via renamed with_event_loop function) from the renderer adapters.
2025-04-11 09:37:03 +02:00
Olivier Goffart
78a3757b7f
Remormat all the toml file again to fix npm upload
Commit cd6f2e2 reformated the .toml, but the 80 char width column is
judged too small to be practical

Add a .taplo.toml file

Also do not split feature array
2025-04-09 15:06:00 +02:00
Simon Hausmann
390c56a30e Winit: Clean up EventLoopInterface
In preparation for removing it altogether, remove the call to winit::platform::wayland::EventLoopExtWayland::is_wayland() with a matches!(winit_window.window_handle(), WindowHandle::Wayland(...))
2025-04-09 08:53:07 +02:00
Olivier Goffart
d2fb69c182 winit backend: remove the GLOBAL_PROXY
We have a proxy in the backend, use it
2025-04-09 08:50:39 +02:00
Simon Hausmann
42e65da8e2 Minor cleanup in winit backend
Replace thread-local window registry with the pattern we recommend: reference counted data shared between the backend and the window adapters.
2025-04-09 08:50:39 +02:00
Simon Hausmann
ac256d61d8 winit: replace special private function to spawn event loop with public API in the winit backend builder
This means the event loop spawning goes through the backend, which will permit for state from the Backend struct to be available when spinning the event loop even when spawning it merely.
2025-04-09 08:50:39 +02:00
Simon Hausmann
6aa4c691f0 winit: Simplify default canvas element handling
The winit backend defaults to locating a canvas element with the id "canvas". After the parent commit, this id can't be overridden by the API, so we can remove the function parameters.

(The parent commit implements the override via an attribute hook)
2025-04-09 08:50:39 +02:00
Simon Hausmann
4e65998016 Clean up wasm-interpreter / winit interface
Use the window attributes hook instead of a private function in the winit backend.
2025-04-09 08:50:39 +02:00
Olivier Goffart
23aa4ed8c6 Fixup menu separator with muda 2025-04-03 15:49:35 +02:00
Olivier Goffart
e5289af154 Introduce MenuSeparator
Fixes #7790
2025-04-02 11:50:45 +02:00
Simon Hausmann
3797ed79bc Fix crash when opening ComboBox
Don't do partial tree rebuilds if we know that a full rebuild is pending and that the current focus node may thus not be node mapped yet.

Amends 5ff5c0464c

Fixes #7854
2025-04-02 11:49:54 +02:00
Tobias Hunger
cd6f2e2cf2 ci: Format toml files
... using taplo with default settings

I tried this with 4 spaces indentation, but the patch is almost as
big as this one, so I went with default settings instead as that
is just easier:-)
2025-04-02 11:03:41 +02:00
Olivier Goffart
6f4f5aeefa Replace no_mangle with unsafe(no_mangle) in example and docs
We can't just do `s/#\[no_mangle]/#[unsafe(no_mangle)]/g`
because the version of cbingen we use doesn't understand the unsafe
attribute yet.

Part of #7998
2025-03-31 17:35:22 +02:00
Simon Hausmann
072bff8c42
wasm: Fix some shortcuts on macOS (such as cmd+a) (#7908)
The core library expects command to be mapped to control, and control to meta, for the shortcut detection. This needs to be done separately for the wasm input handling.

This helps with #7477 by fixing cmd+a. Unfortunately, the "copy" and "paste" events, while intercepted by Safari, aren't somehow delivered to our canvas element.
2025-03-22 11:53:49 +01:00
szecket
ed47d1e70a
matching the math for skia and femtovg renders for radial gradient (#7899) 2025-03-21 10:53:04 -04:00
Arnold Loubriat
6aa7744868 Expose more kinds of text edit widgets to AccessKit 2025-03-17 14:27:08 +01:00
Simon Hausmann
d79689984e Upgrade muda 2025-02-25 16:08:48 +01:00
Olivier Goffart
7390df1b47
ContextMenuArea: Intercept long press on Android 2025-02-24 18:27:25 +01:00
Simon Hausmann
b4b1d329b6 Fix build on macOS
The tracker is optional for when there's no app supplied menu bar.
2025-02-24 14:12:51 +01:00
Olivier Goffart
f30c9ad2a0 Add a property tracker for the Muda Menu 2025-02-24 14:12:51 +01:00
Olivier Goffart
97fdda5c09 Qt: Fix processing of the mouse release event in popup menu
We really need to dispatch the release event otherwise the wrong
item keeps the drag and this breaks the behavior.

This is not perfect yet as if the release is done on the wrong popup,
then we'll still not get the release event.

We should probably remove the grab when a popup open. But that's
slightly more complicated
2025-02-24 12:02:38 +01:00
Simon Hausmann
164d5dfca7 Fix panic with accesskit when using nested context menus
Sub-menus will be declared as parents of the same item, so don't just match for the first but all popups.
2025-02-24 08:59:21 +00:00
Olivier Goffart
c3e32c1665
Don't enable image-default-formats by default, remove compat-1-10 feature
We decided that the compatibility with people having enabled the extra
format in image 0.24 [1] is not worth it compared to the extra compilation
time most people gets by default when they don't need this feature.
(Which is less than 10% slower when the feature is enabled)

Since then there is no need for compat-1-10, remove it

[1] by depending directly on image 0.24 in their Cargo.toml and enabling
the features, which will not work with Slint 1.10 that now use image 0.25
2025-02-22 11:15:18 +01:00
Simon Hausmann
2b6938bce8
Node.js: Avoid running epoll() in the wayland event loop when pumping… (#7682)
Work around pump_events() with `Some(std::time::Duration::ZERO)` still entering `epoll` and thus not returning, preventing us from processing node events.

cc  #7657


Co-authored-by: Olivier Goffart <olivier.goffart@slint.dev>
2025-02-21 14:50:20 +01:00
Arnold Loubriat
cc91de2d38 Add the accessible-read-only property 2025-02-19 09:16:41 +01:00
Arnold Loubriat
90c337f1d1
Add AccessibleRole::Image and use it in the AboutSlint widget (#7593)
* Add `AccessibleRole::Image`

* Improve accessibility of the `AboutSlint` widget

* Filter out some images from the accessibility tree
2025-02-18 09:43:53 +01:00
Olivier Goffart
ce7a785138
Qt: don't clear selection when the window gain focus
(or popup menu gets closed)

We receive an empty `QInputMethodEvent` when the window gets active
and we should not have a replacement range if there is nothing to
replace, otherwise we clear the selection
2025-02-11 18:10:09 +01:00
Olivier Goffart
22317d29b4
Qt: Fix event forwarding for native popups
So that popup menus can handle hover events.

This also remove some of the code in the qt backend that used the
private API
2025-02-11 17:11:43 +01:00
Olivier Goffart
ceb7ea00f5
Qt: don't call deleteLater on the main widget
Otherwise we crash at exit

Fixes #7570
2025-02-11 12:53:53 +01:00
Simon Hausmann
9195f3e265 Fix build with renderer-skia-vulkan
We always offer the Skia software renderer fallback in
`new_try_vulkan_then_opengl_then_software`, so make sure that the drm
and mmemap dependencies are activated, needed to compile swdisplay.rs.
2025-02-11 09:15:38 +00:00
Simon Hausmann
479bee7c87 Add support for exposing PopupWindow instances in the element tree when active 2025-02-10 13:57:55 +01:00
Simon Hausmann
8372cd6412
Convey clipping of children to accesskit (#7587)
and while at it, move is_clipping_item() that casts a function of the ItemVTable.

Fixes #2341
Fixes #7382
2025-02-10 13:42:10 +01:00
Arnold Loubriat
9375f9a08b Track the accessible-delegate-focus property of the focused item 2025-02-09 21:36:52 +01:00
Yuri Astrakhan
6324b35e94 Auto-fixed clippy::needless_borrow
`__CARGO_FIX_YOLO=1` is a hack, but it does help a lot with the tedious fixes where the result is fairly clear.

See https://rust-lang.github.io/rust-clippy/master/index.html#/needless_borrow

```
__CARGO_FIX_YOLO=1 cargo clippy --fix --all-targets --workspace --exclude gstreamer-player --exclude i-slint-backend-linuxkms --exclude uefi-demo --exclude ffmpeg -- -A clippy::all -W clippy::needless_borrow

cargo fmt --all
```
2025-02-07 09:02:45 +01:00
Yuri Astrakhan
bcb2953f00 Auto-fixed clippy::unnecessary_map_or
This is a hacky approach, but does help a lot with the tedious fixes.

See https://rust-lang.github.io/rust-clippy/master/index.html#/unnecessary_map_or

```
__CARGO_FIX_YOLO=1 cargo clippy --fix  --all-targets --workspace --exclude gstreamer-player --exclude i-slint-backend-linuxkms --exclude uefi-demo --exclude ffmpeg -- -A clippy::all -W clippy::unnecessary_map_or

cargo fmt --all
```
2025-02-07 09:02:31 +01:00
Yuri Astrakhan
4ae2627ade A few more format arg inlining
Used these commands and some manual searching

```
cargo clippy --fix  --all-targets --workspace --exclude gstreamer-player --exclude i-slint-backend-linuxkms --exclude uefi-demo --exclude ffmpeg -- -A clippy::all -W clippy::uninlined_format_args
cargo clippy --all-targets -- -A clippy::all -W clippy::uninlined_format_args
cargo clippy --fix -- -A clippy::all -W clippy::uninlined_format_args
```
2025-02-07 06:43:19 +01:00
Yuri Astrakhan
5356fdcf89 Fix clippy issues, plus a few manual cleanups
* Run `cargo clippy --fix`
*  `BackendSelector` is easier to instantiate with auto `Default`
2025-02-06 17:28:51 +01:00
Olivier Goffart
2846c35055
TextInput: implement page up/down
CC #474
2025-02-06 14:52:28 +01:00
Simon Hausmann
d855b44668 Always create an app menu for the menubar
This is the discussed stop-gap for macOS for the 1.10 release.
2025-02-06 14:42:20 +01:00
Yuri Astrakhan
61de4d56b0 Fix all format arg inlining
Ran this command:

```shell
cargo clippy --fix -- -A clippy::all -W clippy::uninlined_format_args
```
2025-02-06 10:16:20 +01:00
Arnold Loubriat
358e42a8d5 Add the accessible-action-expand action 2025-02-03 20:32:45 +01:00
Arnold Loubriat
f30f953ffd Add the accessible-expanded property 2025-02-03 20:32:45 +01:00
Arnold Loubriat
53fd7b12e4 Add the accessible-expandable property 2025-02-03 20:32:45 +01:00
Simon Hausmann
a28ec80917 winit: Fix support for menu bars provided by native code
Add `with_default_menu_bar` to winit's `BackendBuilder` to permit applications
to provide their own menu bar.

Fixes the lsp's Window -> Keep on top menu on macOS.
2025-02-03 11:30:03 +01:00
Simon Hausmann
2a5e35a5e8
Fix typo 2025-01-31 21:59:05 +01:00
Simon Hausmann
5ff5c0464c Fix crash when AccessKit is active and combobox is opened
Opening a combobox with the winit backend implies creating a popup and a transfer of focus. The former will re-create the accessibility tree and cause pending_update to be set to true. The latter will send a notification to the accesskit adapter and unfortunately the (new) focus node will not be known to accesskit yet, causing it to panic.

Since we have a pending update and the new tree update will include the correct focus, we can just sking sending one in this moment.

Fixes #7403
2025-01-31 15:28:42 +01:00
Olivier Goffart
0d72bb0a72 Remove experimental flag for MenuBar and ContextMenu 2025-01-31 14:05:28 +01:00