Commit graph

692 commits

Author SHA1 Message Date
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
Simon Hausmann
30ae161d51 AccessKit: Clean up internal helper function
accessible_parent_for_item_rc does not depend on NodeCollection.
2025-01-03 12:59:31 +01:00
Simon Hausmann
1320a839da AccessKit: simplify item to node id encoding API
Implicitly register the component if not found. This makes the API easier to use. In another patch I called encode_item_node_id() in some other place before the component happened to be registered, and then it would return
None and each call site would then register the same pre-registration as in build_node_for_item_recursively.
2025-01-03 12:59:31 +01:00
U-ALDEBERAN\Nate
cfc52c3fa6 ChangeLog: Creating an API to enable creating winit Windows with Slint's event loop
In `winit`, it is not possible to instantiate a new window without access to the `winit` event loop, which Slint manages.  With this change, there is now a `create_winit_window` call on Slint's winit` back end that will enable creating `winit` windows using existing functionality.

Of course, the utility of these windows is limited without access to `winit` event handling, but there are applications for which simply creating a window and instructing an external program to write into it (by passing the `HWND` on Windows or the `XId` on X11) is useful.
2025-01-02 13:32:47 +01:00
Olivier Goffart
b2b3bf800a
winit: Fix docs generation on docs.rs/i-slint-backend-winit 2024-12-30 11:00:29 +01:00
Simon Hausmann
16ec61f922 Fix build with merely renderer-software enabled for the winit backend
Fixes #7160
2024-12-19 09:05:46 +01:00
Simon Hausmann
dc4bda958e Fix window decoration on Linux with Wayland not being rendered according to the selected color scheme 2024-12-17 16:48:38 +01:00
Simon Hausmann
e69bbef5e6 On Linux, react to dark/light color scheme changes 2024-12-17 16:06:21 +01:00
Simon Hausmann
6c60f9b2a5 Use ashpd to detect dark/light mode on Linux.
The previously used dark-light crate is going to switch to ashpd, so we
might as well use it directly. This is using an older version to match the
zbus version used with accesskit.

This could be extended in the future to use spawn_local and use the stream
provided by ashpd to listen to theme changes.

Fixes #4392
2024-12-17 16:06:21 +01:00
Simon Hausmann
0d36f88152 Revamp BackendSelector API
Based on API review, PlatformBuilder becomes BackendSelector with
a slightly smaller API surface but more options, such as selecting
Metal or Vulkan rendering.
2024-12-16 13:06:05 +01:00
Benny Sjoestrand
5ef4aace4c Implement full-screen property for slint Window item
Make it possible to programatically to switch to full-screen mode
via a new property in the Windows item.
The SLINT_FULLSCREEN environment variable will default set this
property to true. However settings this property in the slint code
will override the SLINT_FULLSCREEN.

Fixes #6665
2024-12-16 09:52:40 +01:00
Simon Hausmann
bfdf0e275f Clean up Apple cfg's
Use target_vendor = "apple" where to cover all Apple OS, and exclude ios for event pumping.
2024-12-13 11:03:44 +01:00