Commit graph

505 commits

Author SHA1 Message Date
Simon Hausmann
5c9eed62f1 Add a new backend that supports rendering fullscreen with Vulkan
This doesn't require a windowing system, just Linux and Vulkan drivers
that supports the display extensions.

It's called linuxkms as soon this will go beyond Vulkan and also support
EGL and perhaps dumb buffers for software rendering.
2023-07-28 13:40:37 +02:00
Olivier Goffart
3a807e46c1
Renderer feature refactor 2023-07-27 19:11:24 +02:00
Olivier Goffart
627deb1e9f interpreter: Hide the ComponentFactory from the public API
(also re-order the types in the docs of api/rs/slint/lib.rs to make the
non-literal types appart)
2023-07-27 12:04:16 +02:00
Tobias Hunger
baa4eb1ea3 Get rid of the window when building an embedded component
... now that we can get the WindowAdapter from the parent component when
we embed it.
2023-07-27 12:04:16 +02:00
Tobias Hunger
a362b7a1ae Add window_adapter to ComponentVTable
Make it duplicate as `maybe_window_adapter` with a boolean `do_create`
parameter.
2023-07-27 12:04:16 +02:00
Tobias Hunger
de96455dda No more panic when the interpreter runs into an ComponentContainer
... in one of the components it manages.
2023-07-27 12:04:16 +02:00
Tobias Hunger
9de515b768 Implement embedding in rust 2023-07-27 12:04:16 +02:00
Tobias Hunger
5db78b6dd2 Implement LLR code lowering for ComponentContainer 2023-07-27 12:04:16 +02:00
Tobias Hunger
d47d52bf52 ItemVTable::init(...): Take an ItemRc so that the itan can know where in the Item Tree it is located 2023-07-27 12:04:16 +02:00
Tobias Hunger
a866c6cf57 Implement embed_component in the interpreter 2023-07-27 12:04:16 +02:00
Tobias Hunger
74ef877f70 Add embed_component to ComponentVTable 2023-07-27 12:04:16 +02:00
Tobias Hunger
05e9ce078a Add a simplistic ComponentContainer element
It just registers the type, nothing more.
2023-07-27 12:04:16 +02:00
Tobias Hunger
2840886d28 Add component-factory type to Slint language
Add a type "component-factory" to the Slint language.
2023-07-27 12:04:16 +02:00
Simon Hausmann
af97435463 Replace show()/hide() in the WindowAdapter with set_visible(bool)
This makes for a smaller interface.
2023-07-26 13:53:45 +02:00
ogoffart
aebaa7d6c9 Bump version number to 1.2.0 2023-07-25 10:44:53 +00:00
Olivier Goffart
da55f4591a Silence nightly warning
```
warning: private item shadows public glob re-export
  --> internal/interpreter/api.rs:9:37
   |
9  | use i_slint_core::{Brush, PathData, SharedString, SharedVector};
   |                                     ^^^^^^^^^^^^
   |
note: the name `SharedString` in the type namespace is supposed to be publicly re-exported here
  --> internal/interpreter/api.rs:19:9
   |
19 | pub use i_slint_core::api::*;
   |         ^^^^^^^^^^^^^^^^^^^^
note: but the private item here shadows it
  --> internal/interpreter/api.rs:9:37
   |
9  | use i_slint_core::{Brush, PathData, SharedString, SharedVector};
   |                                     ^^^^^^^^^^^^
   = note: `#[warn(hidden_glob_reexports)]` on by default
```
2023-07-24 12:20:03 +02:00
Guiguiprim
ef8ddaaa1d
Add native support for min/max 2023-07-21 16:26:41 +02:00
Simon Hausmann
667d071ec0 doc: Minor expansion on the properties() docs in the interpreter 2023-07-17 15:52:42 +02:00
Aurindam Jana
5a4a7fee63
Update royalty free license to 1.1 (#2994) 2023-07-10 10:12:11 +02:00
Olivier Goffart
eb257774e8
Add modifiers to PointerEvent
* Add modifiers to PointerEvent

Closes #2686
2023-07-06 09:54:43 +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
555e191ab4 remove clippy::needless_borrow warnings 2023-06-30 12:28:13 +02:00
Olivier Goffart
7a88dba2e7 Add clear-selection() to all our input fields 2023-06-28 17:07:55 +02:00
Tobias Hunger
4ab19f3011 Incorporate feedback from code review 2023-06-28 14:22:30 +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
Olivier Goffart
9177916b9d Fix select-all in the interpreter
(The js test wasn't call because of its name, also, js don't support
callign funciton at the moment)
2023-06-27 16:02:03 +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
bf8bbeda40 Take self by value in JoinHandle::abort 2023-06-20 11:36:36 +02:00
Olivier Goffart
11dea135f7 Domain: slint-ui.com -> slint.dev 2023-06-16 10:55:08 +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
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
0e31f097a4 Un-seal the WindowAdapter trait 2023-06-13 17:44:04 +02:00
Olivier Goffart
d428a981b7 interpreter ffi: ensure that the size of the opaque structs are equal
...to their rust counter-part

CC #2859
2023-06-13 10:18:29 +02:00
Olivier Goffart
ac6f473a64 WIP: support for enum in slint
Parser and interpreter part
2023-06-12 13:02:14 +02:00
Olivier Goffart
a017265376 Fix 32bit build
The alignment of a HashMap within a Struct is 8 bytes because of the
RandomState.
This is important because the C++ allocated `interpreter::Struct` could
be mis-aligned
2023-06-12 10:40:56 +02:00
Olivier Goffart
85f32ca014 fixup previous commit 2023-06-12 08:57:28 +02:00
Olivier Goffart
690dbd723b C++: ensure that the alignment if the Opaque structures is big enough
CC: #2859
2023-06-12 08:53:15 +02:00
Simon Hausmann
ca3a6bd586 Fix Qt High-DPI support with the interpreter
See parent commit for details.
2023-06-10 11:41:04 +02:00
Simon Hausmann
d98c6773e1 Make window adapter creation lazy in the interpreter
The main change is that the window adapter is not copied into
sub-components anymore - instead it is accessed through the root.  This
is especially important for globals.

In order to add the root, a little extra dance had to be performance on
instantiation: The self_rc/self_weak is created first and the
ComponentExtraData's fields are populated via once_cells.
2023-06-10 11:41:04 +02:00
Simon Hausmann
5665df2cb8 interpreter: Clean up Rc<&dyn WindowAdapter> vs. &Rc<dyn WindowAdapter>
Consume the Rc in the function signature where the implementation would clone it anyway.

This is also needed in preparation for InstanceRef::window_adapter()
walking up the tree of components,
by which it's not possible to return a reference anymore as
parent_instance() returns a new lifetime that's shorter than &self
inside window_adapter().
2023-06-10 11:41:04 +02:00
Simon Hausmann
9b25bdb1d1 interpreter: Remove one more direct use of window_adapter_offset
That we we can encapsulate the lazy creation in the getter function.
2023-06-10 11:41:04 +02:00
Simon Hausmann
3604bdbf69 Prepare interpreter for lazy window adapter creation
Replace all call sites that call unwrap() on window_adapter_ref() with a call
that returns a &Rc<dyn WindowAdapter> and use an Option variant for register/unregister component.

For the former, in the future, we want to create the adapter if it doesn't exist.
For the latter we don't want to do that.
2023-06-10 11:41:04 +02:00
Simon Hausmann
4bb27d3196 Minor cleanup in interpreter WindowInner handling
Replace `fn window_ref(component) -> Option<& WindowInner)` with
`component.access_window(cb: impl FnOnce(&WindowInner))` as
all call sites unconditionally called unwrap() on them and by using the
pattern with a closure, we can in the future get the WindowInner from an
Rc<dyn Adapter> instead of an &Rc<dyn WindowAdapter>.
2023-06-10 11:41:04 +02:00
Simon Hausmann
01b00d26eb Rust: Allocate the window adapter lazily
This will be needed for embedding - to avoid creating two window
adapters - and it will be needed for the API to allow creating a
component from an existing window.
2023-06-10 11:41:04 +02:00
Olivier Goffart
cb840660aa Make the extraction of slint! macro as part of the compiler core
This includes slint-viewer, slint-interpreter (when loading path, not
string), slint-compiler.

(This would also include internal things such as
`import { Xxx } from "foo.rs"`, if we didn't check for .slint or .60
extension before)

But that doesn't include anything that's not opening the source by path
(so not the lsp which use its own representation coming from the editor,
or varius tools like the updater and fmt which also open the files
themselves)
2023-06-08 11:26:17 +02:00
Olivier Goffart
12e6b34e2d Translations: support for plurals 2023-06-07 10:34:34 +02:00