Commit graph

9162 commits

Author SHA1 Message Date
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
689238a3af Lower ComponentContainer into two objects
... so that we have one that controls the embedding operation and one
that we can turn into a dynamic tree node where the actual embedding
happens.

Mark the placeholder Element as `is_component_placeholder` and make sure to not
optimize out that object in a later pass.

Adapt Element creation to account for the new
`is_component_placeholder`.
2023-07-27 12:04:16 +02:00
Tobias Hunger
eb84994e7a Add lower_component_container pass
Do some diagnostics in that pass.
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
1fb9b6de41 docs: Sort type tables 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
Tobias Hunger
ad2c98937f Disable embed test in C++ 2023-07-27 12:04:16 +02:00
Tobias Hunger
df069bf6ed component_factory: Add documentation (#2868)
* component_factory: Add documentation

What was there was not useful, this is a bit better I think:-)

Co-authored-by: Olivier Goffart <olivier@woboq.com>
Co-authored-by: Simon Hausmann <simon.hausmann@slint-ui.com>
2023-07-27 12:04:16 +02:00
Tobias Hunger
23564cc32d Add a embed.slint test case
... currently only testing the Rust ComponentFactory
2023-07-27 12:04:16 +02:00
Tobias Hunger
731c422329 Add a ComponentFactory (Rust)
Add a ComponentFactory type which will eventually be used as a property
value in Slint. The idea is to copy around this type and to create
components from it that we can embed.

We do not want to hand raw components around as those are reference counted
and might end up being embedded into several places, which would break out
tree of components.
2023-07-27 12:04:16 +02:00
Olivier Goffart
136130781c Update corrosion 2023-07-27 10:39:51 +02:00
Olivier Goffart
caabf9ae1e Remove unused dependency 2023-07-27 10:39:51 +02:00
Olivier Goffart
e829564e8a LSP: auto-complete imports 2023-07-27 10:08:45 +02:00
Olivier Goffart
3054ecfb71
C++ platform API: move the dispatch_* function on the Window like in rust 2023-07-26 16:03:05 +02:00
Florian Blasius
297b55dbdd
Added item-pointer-event to StdListView (#3165) 2023-07-26 14:43:55 +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
Olivier Goffart
bde0ae7585 Compiler: Fix access_item_rc in the generator for complex path
Fixes #3148
2023-07-26 13:45:20 +02:00
Simon Hausmann
835510c7f6 C++ platform API: Remove const qualified from request_redraw() 2023-07-26 13:25:36 +02:00
Olivier Goffart
865f7a5091 LSP: Add debug for panic #3160
Ignore the case when the file is not in the documents this normally
shouldn't happen since we iterate from it, but could optentially happen
if a file was removed for example.

but file that don't parse seems strange

This might have been related to #2719

cc #3160
2023-07-26 12:33:20 +02:00
Olivier Goffart
6920f9ea7f
vscode extension: Use the wasm preview in codespaces (#3159)
Attempt to detect when we are running in a codespace and force the
preview to render in wasm.
Remote view don't make sense as there is no graphical server where the
extension runs
2023-07-26 11:56:12 +02:00
Olivier Goffart
51d8a15164 C++ platform: make the max_buffer_age an enum
Copying the Rust enum instead of using cbindgen because we would need to
create a new header just for it for bublic types generated in the
platform namespace. I've also put it in the SoftwareRenderer class since
the equivalent enum is in the software_renderer module in Rust.
2023-07-26 11:28:45 +02:00
Simon Hausmann
f15bc6147e Simplify FemtoVG and Skia renderer APIs: remove resize()
We can convey the new physical window size from the run-time
through the private renderer API
when a window resize event is dispatched.
2023-07-25 19:33:26 +02:00
Simon Hausmann
68a255b1d2 C++: Make the SkiaRenderer constructor explicit
As discussed in API review
2023-07-25 19:16:44 +02:00
Simon Hausmann
7649153b3e janitor: silence rust warning 2023-07-25 17:58:46 +02:00
Olivier Goffart
69a11f7dbc C++: Platform::register_platform -> platform::set_platform 2023-07-25 17:38:20 +02:00
Olivier Goffart
42bb2bf705 C++: some changes to the Platform API 2023-07-25 17:38:20 +02:00
Simon Hausmann
c05ee8b87d Fix empty window test
When render() is called on an renderer that's not associated with a component yet,
then just return a default constructed region.
2023-07-25 17:28:08 +02:00
Simon Hausmann
5a9f8a4c90 Clear caches in the renderers when "changing" the window adapter
This helps to keep the allocation peak low.
2023-07-25 17:28:08 +02:00
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
Olivier Goffart
2a56e25788
C++: rename PlatformEvent to Platform::Task 2023-07-25 16:15:35 +02:00
Olivier Goffart
3137bfe775 C++ Rgb565Pixel 2023-07-25 15:24:59 +02:00
Simon Hausmann
7893ec3fd4 C++: Improve type-safety of NativeWindowHandle API on macOS
Replace void* with forward-declared NSView/NSWindow in NativeWindowHandle::from_appkit
2023-07-25 15:19:56 +02:00
Tobias Hunger
d0903adcaf
LSP: Polish snippets (#3114)
Use default values, choices and nested replacements where those make
sense. Use `$0` to place the cursor once done and add some line
breaking.

Remove the transitions (not mentioned in the docs anymore) snippet, add
a `when` snippet for use in states.
2023-07-25 14:47:43 +02:00
Olivier Goffart
3a2359f107 C++ Pointer dispatch API 2023-07-25 14:03:40 +02:00
ogoffart
aebaa7d6c9 Bump version number to 1.2.0 2023-07-25 10:44:53 +00:00
Olivier Goffart
f1f5a86d0d Fix calling the open_import_fallback for non existing files
(Note: This code path is not run for wasm because dounce::canonicalize
is not used there, but it was used for the test)
2023-07-24 18:21:53 +02:00
Olivier Goffart
edee63c8c6 Remove test that don't pass because not all drivers are run in the same level
this fails to the nodejs driver because its workdir is not nested the
same way that other driver
2023-07-24 18:21:53 +02:00
Olivier Goffart
5dea1f1d29 compiler: Fix loading relative path to the workdir
This should in principle not be allowed, it should be relative to the
file itself.
Make it a warning, and at least, don't duplicate the globals

Fixes #2719
2023-07-24 18:21:53 +02:00
Tobias Hunger
355464e850 vscode: Fix web extension
Make sure to pass around the extensionUrl, not the extensioPath. The web
extension seems to need the full URL when actually deploying this. It
works file in web extension test mode either way.
2023-07-24 18:16:43 +02:00
Christian Boelsen
399e9c63d4 Allow Qt windows to run fullscreen with SLINT_FULLSCREEN 2023-07-24 14:52:33 +02:00
Simon Hausmann
5c0d88b71e C++: Rename SoftwareRenderer::render_rgb565 to just render() and overload the Rgb8Pixel variant 2023-07-24 14:25:49 +02:00
Tobias Hunger
f306e049e8 vscode: Make utf8 decoding of the welcome page more portable 2023-07-24 14:10:57 +02:00
Olivier Goffart
37f11e566b Better error when using ';' instead of ',' when declaring struct 2023-07-24 12:31:41 +02:00