Commit graph

1483 commits

Author SHA1 Message Date
Simon Hausmann
7d136b6568 Remove the window parameter from the render() function of all the renderers
This makes for a slimmer API and instead we can create the renderer <-> window association
behind the scenes ourselves,
in set_component.
2023-07-25 17:28:08 +02:00
Simon Hausmann
507428b03e
Simplify FemtoVG and Skia renderer API (#3153)
Fold show() into the first time render() is invoked,
and hide() into the Drop implementation.
2023-07-25 17:17:40 +02:00
ogoffart
aebaa7d6c9 Bump version number to 1.2.0 2023-07-25 10:44:53 +00:00
Christian Boelsen
399e9c63d4 Allow Qt windows to run fullscreen with SLINT_FULLSCREEN 2023-07-24 14:52:33 +02:00
Eric
1b0d3b1061
Add edited callback for SpinBox (#3096)
* add edited callback for SpinBox
* fix compile error
* add inline comment for callback definition
2023-07-18 07:53:54 +02:00
Simon Hausmann
64f1504ab9 Fix rendering of QStyle animations
Allocate a widget per NativeXXX. This way QStyleAnimation objects
created by Qt aren't shared among style options.

Fixes #2045
Fixes #2987
2023-07-14 13:09:45 +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
Olivier Goffart
9afadf50be Get rid of the "use_modules" workaround
This doesn't seem to be needed anymore with newer rust version.
As long as one symbol from the crate is used, all exported function
from the crate are available.

The reason why some symbols in some module were gone was a bug in rust
that has been fixed, it seems
2023-07-05 13:41:06 +02:00
Guilhem Vallat
6845fc2e4e remove clippy::new_ret_no_self warning 2023-06-30 12:28:13 +02:00
Guilhem Vallat
555e191ab4 remove clippy::needless_borrow warnings 2023-06-30 12:28:13 +02:00
Guilhem Vallat
67493a4f3c remove clippy::new-without-default 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
Simon Hausmann
07f42afef3 Fix support normalized ranges for Slider with Qt style
The OpenGL Texture import example uses a Slider in the range 0..1. That doesn't work with
QStyleOptionSlider out of the box because it's
using integer values.
2023-06-28 17:42:34 +02:00
Olivier Goffart
734a5b888c Improve winit's backend documentation 2023-06-28 17:08:12 +02:00
Olivier Goffart
7464c0897e Winit don't need a rtti feature 2023-06-28 17:08:12 +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
ogoffart
c8c9496722 Bump version number to 1.1.1 2023-06-26 12:50:02 +00:00
Olivier Goffart
9b59036816 Add licenses symlinks 2023-06-26 13:12:29 +02:00
Olivier Goffart
5fde19d111 winit: cache the size returned by inner_size
So that subsequent call to Window::size() return the same value

Should fix flickering of window size at startup
2023-06-26 12:37:30 +02:00
Olivier Goffart
1b9e245b4e Remove the NativeSwitch
It is identical to the NativeCheckBox  (Qt don't have a switch widget)
2023-06-23 11:02:46 +02:00
Simon Hausmann
4820d29bcb Fix macOS lsp bundle
Avoid duplicating the core-graphics crate, as that leads to linking
errors about duplicate emissions of the cg_event_tap_callback_internal
helper function from the core-graphics crate.

This partially reverts commit d91622d64f

In order to re-apply d91622d64f, winit
needs to release a new version first.
2023-06-23 07:40:43 +02:00
Olivier Goffart
d5fe68443f Native ProgressIndicator: initialize the state properly 2023-06-22 14:23:56 +02:00
Tobias Hunger
50cc61c242 Fix reuse 3.1 spec compliance issues 2023-06-22 10:49:18 +02:00
Simon Hausmann
d91622d64f Bump cocoa and core-text dependencies 2023-06-22 08:11:16 +02:00
Simon Hausmann
a181fe0196 Port to softbuffer 0.3.0 2023-06-22 08:11:16 +02:00
Olivier Goffart
613992d0dc LSP: fix errors or panic when exiting
Two problem:
 1. we were calling quit_event_loop from another thread, which didn't
    work with winit
 2. we need to ignore error from the lsp-server when shutdown as it may
    result in https://github.com/slint-ui/slint-cpp-template/issues/15

Closes https://github.com/slint-ui/slint-cpp-template/issues/15
2023-06-21 16:34:16 +02:00
Olivier Goffart
d5784811c7 Native style: Fix indeterminate ProgressIndicator
We need to pass a styleObject for the animation to work
The state will be shared accross all progressbar, but that's ok
2023-06-21 06:37:34 +02:00
Olivier Goffart
08e20c8586 Don't emit clicked when the pointer did not press the area
eg: releasing the pointer over a button that wasn't pressed shouldn't
click it

Fixes #2918
2023-06-20 16:06:12 +02:00
Florian Blasius
2656dfad7d
Refactor ProgressIndicator api according to api review. (#2937)
* Refactor ProgressIndicator api according to api review.

* Update docs/language/src/builtins/widgets.md

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>

* Capping progress also for native.

---------

Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>
2023-06-20 12:27:48 +02:00
Olivier Goffart
38879ce1b9 Wasm: initialize properly the WinitWindowAdapter::self_weak
This fixes keyboard input on mobile
2023-06-19 18:27:23 +02:00
Simon Hausmann
74ae79bca7 winit: Fall back to any renderer if the default fails
Fixes #2903
2023-06-16 12:52:15 +02:00
Simon Hausmann
7c36121082 Sanity check that the OpenGL context we have provides what we need
On Windows without OpenGL, wgl might succeed all the way, but get_proc_address will fail.
2023-06-16 12:52:15 +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
Tobias Hunger
04d1229685 Fix licnese information using xtask 2023-06-16 09:14:20 +02:00
ogoffart
641cab0e75 Bump version number to 1.1.0 2023-06-15 16:01:28 +00:00
Olivier Goffart
033263127b
Qt Combobox: make it look proper when the style show the comobox in popup mode
As discusseed in https://github.com/slint-ui/slint/discussions/2893

Also initialize the current item the same way as fluent and material
2023-06-15 17:14:28 +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
Aurindam Jana
039e54a5de
Add royalty free license to files except examples and docs (#2888) 2023-06-15 11:20:50 +02:00
Olivier Goffart
4dd10f4a78 Make WindowAdaptor::request_redraw public 2023-06-13 20:29:52 +02:00
Olivier Goffart
0e31f097a4 Un-seal the WindowAdapter trait 2023-06-13 17:44:04 +02:00
Olivier Goffart
23b910725f Rename WindowAdapterSealed to WindowAdapterInternal 2023-06-13 17:44:04 +02:00
Olivier Goffart
f4dba7bcfd Seal the Renderer trait
Because we need to make the Render trait public so one can re-implement
the WindowAdapter trait
2023-06-13 17:44:04 +02:00