Commit graph

85 commits

Author SHA1 Message Date
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
Olivier Goffart
5e634fda9f PropertyTracker: Pin the DirtyHandler 2024-05-02 22:25:53 +02:00
Simon Hausmann
31767eb6ab Add a clear-focus()function on all elements that have a focus() function
This is the counter-part, which removes focus from the element if it's currently focused. The window - if focused - may still be focused towards the windowing system.
2024-04-26 11:09:11 +02:00
Olivier Goffart
64404ceca2 accessibility: return an Option for accessible string values
So we can know whether the item had the property set at all or not
2024-04-19 11:23:26 +02:00
Olivier Goffart
13127dc71c Accessibility: Add support for accessibility-action-* callback (#5073)
Merge branch 'feature/accessibility'

 Conflicts:
	internal/compiler/widgets/cosmic-base/button.slint
	internal/compiler/widgets/cupertino-base/button.slint
	internal/compiler/widgets/fluent-base/button.slint
	internal/compiler/widgets/material-base/button.slint

Also updated license header in actions.slint
2024-04-16 15:02:25 +02:00
Olivier Goffart
4e580c6ea4 Accessibility: Remove the replace-select-text from the slint api
Because we don't support it in Qt and in our widgets yet.

Also accessible-action-set-value now takes a string because value is a
string (for the line edit)
2024-04-16 14:41:17 +02:00
Olivier Goffart
01e0f0c526
Accesibility: Implement the action in the backend (#5062) 2024-04-15 16:39:25 +02:00
Aurindam Jana
0cfeec1a31
Update Slint Community License (#4994)
Updated the version from 1.1 to 1.2 
Renamed the header to "Slint Royalty-free Desktop, Mobile, and Web Applications License"
Added definition of "Mobile Application" and grant of right
Moved "Limitations" to 3rd section and "License Conditions - Attributions" to 2nd section
Added flexibility to choose between showing "MadeWithSlint" as a dialog/splash screen or on a public webpage
Moved the para on copyright notices to section under "Limitations"
2024-04-15 15:18:55 +02:00
Arnold Loubriat
d863893e62 Expose toggle buttons as such to AccessKit 2024-04-09 00:09:01 +02:00
Arnold Loubriat
e17b1fda8b Properly expose Switch as such in the accessibility tree 2024-04-08 08:41:47 +02:00
Montel Laurent
fc0e8faae9
Accessibility: use tab-list for the tabwidget (#4909)
* Don't show tabwidget as tab
2024-03-21 17:48:42 +01:00
Montel Laurent
da30fa2663
Add ListView accessibility role (#4911) 2024-03-21 15:20:43 +01:00
Montel Laurent
4844b84e0c
Add Treeview accessibility support (#4907) 2024-03-21 15:18:52 +01:00
Montel Laurent
c2517008d8
Add TextInput as accessibility role (#4899) 2024-03-21 13:39:31 +01:00
Simon Hausmann
d9ddc865c2 Fix panic when shutting down process on Linux
Commit 41bfe66447 bumped accesskit
dependencies, which introduced a version that uses threads.

That means the action handler as well as the initial tree update source
closure are destroyed in a thread that's not the ui thread. That means
we destruct a SenderWrapper<Weak<WinitWindowAdapter>> in a thread that
is not the same as the one the wrapper was created in, which causes
Drop for SendWrapper to panic.

Replace the use of SendWrapper here with safely copyable window ids.
2024-01-17 17:07:38 +01:00
Simon Hausmann
a5c3692fbc Add progress-indicator accessible role 2023-11-07 13:37:12 +01:00
Simon Hausmann
3a9288003d
Re-enable accesskit (#3833)
Port to the latest accesskit and accesskit_winit:

- NodeId is now a u64 instead of u128, so trim the component/item encoding.
- Adjust to some enum renamings.
- TreeUpdate now always requires a focus node, which we set to the root.
- Fixed focus handling on macOS: Report FocusIn to the accesskit
  adapter, so that it can update its internal host_is_focused state
  correctly.
2023-11-05 09:04:05 +01:00
Olivier Goffart
852b4d906d Rename ComponentVTable to ItemTreeVTable
and their related name.
Also move the component module in the item_Tree module
register_component -> register_item_tree
ComponentItemTree -> ItemTreeNodeArray

For #3323

Rationale from that issue:

Right now, we use the term `component` in the Slint language and in the compiler to be a a tree of elements that can be used as an element in a .slint file.

The term is also currently used in the runtime as a tree of runtime Items that are allocated together. (declared in ComponentVTable)

But there are no 1 to 1 mapping between a `component` in the slint language, and a runtime Component.
(for example, the items behind a `if` or `for` or `PopupMenu` are in a different runtime component. And `component` declared in Slint are often inlined)

So we should rename the internal runtime `Component` to  `ItemTree`

The currently public `slint::ComponentHandle` wraps the "root" of the ItemTree, but that's ok because it is generated from a .slint `component`,  so it doesn't change name
2023-10-09 11:01:56 +02:00
Simon Hausmann
3652f58a3f Change item indices from usize to u32
So that the compiler and run-time can never disagree on the
number of bytes the item index can use.
2023-09-12 08:53:58 +02:00
Simon Hausmann
7ff7c2f875 Fix let-else formatting
Nightly now supports it and thus `cargo +nightly fmt` yields a
difference.
2023-07-28 13:43:21 +02:00
Simon Hausmann
3e420b32ad Fix accessibility tree on Linux when UI has no repeaters
We need to make sure to replace the dummy tree from #3046 with a real tree.
2023-07-10 12:16:19 +02:00
Aurindam Jana
5a4a7fee63
Update royalty free license to 1.1 (#2994) 2023-07-10 10:12:11 +02:00
Olivier Goffart
4531210952 Fix the accesskit fix
We also need to add the node in the list of node
2023-07-10 08:50:31 +02:00
Olivier Goffart
8009f12646 Attempt to fix a panic in accesskit
On unix, the panic happens since the upgrade from zbus 3.10 to zbus 3.14

```
thread 'test_window_accessor' panicked at 'called `Option::unwrap()` on a `None` value', /home/olivier/.cargo/registry/src/index.crates.io-6f17d22bba15001f/accesskit_consumer-0.15.0/src/tree.rs:274:45
stack backtrace: [...]
   3: core::option::Option<T>::unwrap
   4: accesskit_consumer::tree::Tree::new
             at /home/olivier/.cargo/registry/src/index.crates.io-6f17d22bba15001f/accesskit_consumer-0.15.0/src/tree.rs:274:19
   5: accesskit_unix::adapter::Adapter::new
             at /home/olivier/.cargo/registry/src/index.crates.io-6f17d22bba15001f/accesskit_unix-0.5.0/src/adapter.rs:53:20
   6: accesskit_winit::platform_impl::platform::Adapter::new
             at /home/olivier/.cargo/registry/src/index.crates.io-6f17d22bba15001f/accesskit_winit-0.14.1/src/platform_impl/unix.rs:21:23
   7: accesskit_winit::Adapter::with_action_handler
             at /home/olivier/.cargo/registry/src/index.crates.io-6f17d22bba15001f/accesskit_winit-0.14.1/src/lib.rs:170:23
   8: i_slint_backend_winit::accesskit::AccessKitAdapter::new
             at ./accesskit.rs:62:20
   9: i_slint_backend_winit::winitwindowadapter::WinitWindowAdapter:🆕:{{closure}}
             at ./winitwindowadapter.rs:163:32
  10: alloc::rc::Rc<T>::new_cyclic
             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/alloc/src/rc.rs:461:20
  11: i_slint_backend_winit::winitwindowadapter::WinitWindowAdapter::new
             at ./winitwindowadapter.rs:148:23
  12: i_slint_backend_winit::window_factory_fn
             at ./lib.rs:71:5
  13: <i_slint_backend_winit::Backend as i_slint_core::platform::Platform>::create_window_adapter
             at ./lib.rs:220:9
```

The problem is that we get called to create the tree directly from
WinitWindowAdapter::new before the WinitWindowAdaptor is initialized,
So of course, the upgrade from weak is still the pseudo-weak from
Rc::new_cyclic, so the upgrade fails, resulting in a default constructed
`TreeUpdate` which is invalid for the first call as it doesn't have a
tree.

Just give it a tree with a dummy id
2023-07-07 12:51:44 +02:00
Guilhem Vallat
555e191ab4 remove clippy::needless_borrow warnings 2023-06-30 12:28:13 +02:00
Guilhem Vallat
d27e0a4852 micro-optim ItemRc::component() returns a ref instead of cloning 2023-06-29 12:38:54 +02:00
Tobias Hunger
e81a3d40f0 Get rid of more clippy warnings
* Configure clippy to not report about type complexity until *much*
  later
* Configure clippy to only complain about more than 10 function
  arguments
* Properly format safety sections
* Allow unnecessary main functions in doctests in the slint API crate
* AccessKit: Move big block of code before if condition
2023-06-28 14:22:30 +02:00
Tobias Hunger
e02c360000 Clippy polish 2023-06-28 14:22:30 +02:00
Tobias Hunger
8345c6cd79 Do automatic clippy fixes 2023-06-28 14:22:30 +02:00
Olivier Goffart
11dea135f7 Domain: slint-ui.com -> slint.dev 2023-06-16 10:55:08 +02:00
Tobias Hunger
34fd360576 Fix license information in accesskit 2023-06-16 09:14:20 +02:00
Simon Hausmann
5efbbeff1a Fix panic with Narrator on Windows when transferring narrator focus
The action requests on Windows typically come in from a non-main thread,
so we'd try to clone the send wrapper in `do_action`
in a non-main thread. That panics unfortunately - send-wrapper
requires the clone to be done in the original thread.

To work around this, wrap the send-wrapper in an Arc, which we can
safely clone. Then inside the closure invoked from within the main thread,
we can clone the send wrapper safely and then take out the Weak
from it (safely as well).
2023-06-15 13:20:14 +02:00
Matt Campbell
6db6711e12 New scheme for stable node IDs 2023-06-15 13:20:14 +02:00
Simon Hausmann
2e7cc49567 Initial AccessKit support
This change adds initial accessibility support for the winit backend
through use of AccessKit.
2023-06-15 13:20:14 +02:00