Commit graph

703 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
e75415554a Create a menus module in i-slint-corelib 2025-01-30 10:08:22 +01:00
Simon Hausmann
de87bf2a43 Update to new objc2 versions 2025-01-24 18:57:09 +01:00
Simon Hausmann
1bc4f8e7d3 backend-winit: Don't call deprecated xdg settings portal method
Read() returns the value wrapped in a variant, which still works because
downcast_ref() recurses, but it's deprecated and we should be calling
the right function.

Thanks @bilelmoussaoui for spotting!
2025-01-16 09:57:00 +00:00
Simon Hausmann
22ad614bf4 Fix formatting 2025-01-15 19:09:55 +01:00
Simon Hausmann
5030d66765 Replace ashpd dependency with just zbus
This makes our dependency tree lighter and zbus is an already existing dependency (through accesskit).

cc #7276
2025-01-15 17:32:00 +01:00
Olivier Goffart
8a5df27469
Update to Image 0.25 (#7365)
Added image-default-formats with all the format supported by image by
default, and enable that feature by default.
Also put that feature in compat-1-2 for compatibility with user that
have used image 0.24 with enabled features.
Make a new compat-1-10 feature that does not enable default format by
default

ChangeLog: upgraded image crate to 0.25, added a new cargo feature
to enable all image formats. (that feature is enabled by default with
compat-1-2, added compat-1-10 to disable it

Fixes https://github.com/slint-ui/slint/issues/7251
2025-01-14 16:31:05 +01:00
Simon Hausmann
53f2d572b1 Remove some uses of once_cell 2025-01-14 14:18:24 +01:00
Tasuku Suzuki
346d1c2df3 Fix typos
Ran `typos .` and fixed all typos that do make sense.
https://crates.io/crates/typos
2025-01-13 08:35:20 +01:00
Arnold Loubriat
dec3bff5e2 Remove an unused import to fix a warning 2025-01-13 08:19:33 +01:00
Simon Hausmann
aa332202c5 Rename AccessibleRole.GroupBox to AccessibleRole.Groupbox
While unfortunate in casing, this is consistent with Checkbox, Combobox, and Spinbox.
2025-01-10 16:27:14 +01:00
Simon Hausmann
41559d30e2 Fix default menu on macOS with muda
As discussed, always disable winit's menu. Let either the user (with a custom event loop builder) or us provide a menu.

Amends 5acd931966
2025-01-10 11:22:10 +01:00
Simon Hausmann
5acd931966 Enable muda macOS menubar on macOS
Hide the winit menu bar and provide a fallback if the app doesn't
provide one. Also, activate per window to fix support for multiple
windows.
2025-01-10 10:49:26 +01:00
Olivier Goffart
cfbcf0b1d7
Introduce Window::try_dispatch_event (#7313)
That is the same as Window::dispatch_event, but it reports an error
instead of panicking
2025-01-09 19:39:38 +01:00
Olivier Goffart
6b4c822a4a MenuBar: C++/Rust native menubar implementation
introduce a SetupMenuBar builtin function to ease C++/Rust lowering
2025-01-08 21:16:17 +01:00
Olivier Goffart
71e331995c Don't depend on muda on Linux 2025-01-08 14:05:35 +01:00
Olivier Goffart
846664ad45 WIP: native menubar using muda
Only the interpreter is implemented so far

MacOs won't work yet because we don't disable the default winit menubar

The viewer don't support removing the MenuBar yet
2025-01-08 14:05:35 +01:00
Arnold Loubriat
49196728a7 Add AccessibleRole::GroupBox 2025-01-07 23:08:03 +01:00
Arnold Loubriat
e225ac15e0 Map the visible property to the AccessKit Node::hidden property 2025-01-06 09:30:11 +01:00
Arnold Loubriat
3304df0f82 Add AccessibleRole::TabPanel 2025-01-06 09:30:11 +01:00
Simon Hausmann
c31389dd14 AccessKit: expose popups in the accessibility tree
This is the plumbing, where a `PopupWindow` directly becomes a child of wherever it's declared in, when show() is called. Further changes may be necessary to make this really useful, such as new roles or improved dialog handling. (see ticket for comments)

Fixes #7209
2025-01-03 12:59:31 +01:00