Commit graph

5155 commits

Author SHA1 Message Date
Olivier Goffart
83fac67632 Binary package: use Qt 6 on windows and add the svg image plugin 2021-11-16 12:23:46 +01:00
Olivier Goffart
7a5fc72093 Fix black background with native style
If we don't tell the compiler that the properties are `native_output` then
it might const-propagate the default value which is transparent
2021-11-16 11:27:21 +01:00
Olivier Goffart
aa24922a1a
Mention the VIM 3rd party plugins in the LSP readme
cc #429
2021-11-16 09:20:29 +01:00
Olivier Goffart
a6425300fb Fix documentation warning
In wasm, the documentation eed to be repeated
2021-11-15 17:03:47 +01:00
Simon Hausmann
b29b2cfaea Make WinitWindow::apply_window_properties work outside the GL backend crate
Move the image loading related bit for the icon back into glwindow.

Amends commit
51469be56b.
2021-11-12 11:44:39 +01:00
Simon Hausmann
e3ee59fd13 Fix transitioning from fixed size to resizable window with the GL backend
PR #642 fixed making the window not resizable when it has initially a
fixed size. This change applies a different logic with the same
resulting effect when the window item changes later, for example when
transiting in the live-preview from a fixed size to a resizable window -
by looking at the min/max constraints.
2021-11-12 09:06:35 +01:00
Simon Hausmann
51469be56b Move more of the winit related code from PlatformWindow impl into WinitWindow
This will allow code sharing with the simulator in the future.
2021-11-12 09:02:52 +01:00
Simon Hausmann
68ec3ccf6f GL backend cleanup
Move the window constraint application handling into WinitWindow,
for future sharing.
2021-11-11 11:47:54 +01:00
Simon Hausmann
8de52f1b70 GL backend cleanup
Move the OpenGLContext helper into a module of its own, for future sharing.
2021-11-11 11:47:54 +01:00
Simon Hausmann
ad1b251966 Internal cleanup
Centralize the setting of the width/height on the window item in the core library.
2021-11-11 11:47:54 +01:00
Simon Hausmann
1fb101c0a0 GL window cleanup
Remove internal component() function. There was only one call site.
2021-11-11 11:47:54 +01:00
Simon Hausmann
6fe9c3c23c GL window cleanup
Inline map_window() and unmap_window()
2021-11-11 11:47:52 +01:00
Simon Hausmann
3c0607276c Make the GL backends' winit driven event loop a reusable module
Abstract away the dependency to the former GraphicsWindow by

(1) Renaming GraphicsWindow to GLWindow
(2) Introducing a WinitWindow trait
2021-11-11 11:45:56 +01:00
Aursen
bd613219ba Refactoring code 2021-11-11 11:45:37 +01:00
Aursen
ceb8ed626c Fix previous error 2021-11-11 11:45:37 +01:00
Aursen
2962da65a4 Fix the maximization button with a fixed inner size 2021-11-11 11:45:37 +01:00
Olivier Goffart
de43f0a783 Start doing some constant evaluation
There was a warning in the C++ generated code in the tests:  (in test_cpp_image_geometry)

```
/tmp/.tmpsAMWqZ.cpp:307:85: error: self-comparison always evaluates to true [-Werror,-Wtautological-compare]
    this->image_in_layout_fit_ok.set((sixtyfps::cbindgen_private::ImageFit::contain == sixtyfps::cbindgen_private::ImageFit::contain));
                                                                                    ^
```

Deoing some simple evaluation prevent this warning at least
2021-11-11 11:14:59 +01:00
Olivier Goffart
4360dc2010 Fix const detection with declared aliases 2021-11-11 11:14:59 +01:00
Olivier Goffart
a3adfd94b1 Const propagation
Inline access to constant properties
2021-11-11 11:14:59 +01:00
Olivier Goffart
125ab12816 Don't take the binding when calling visit_element_expressions
So that we can visit the expression and the property reference
still have a meaning
2021-11-11 11:14:59 +01:00
Olivier Goffart
dd3fa1c221 Make the BindingMap hold RefCell of the BindingExpression
This will allow later to be able to operate on the binding despite the
element is borrowed.

Since the Binding itself is in a RefCell, the analysis don't need to
be anymore.
To do this change, a small change in the binding_analysis logic was required
which means that we will now detect binding loop if a binding was causing
two binding loop. (before, only one binding loop was detected)
2021-11-11 11:14:59 +01:00
Simon Hausmann
a10f832a93 Remove unused dependency 2021-11-10 10:54:56 +01:00
Olivier Goffart
390b838c21 Use intra doc links in the documentation of vtable and const-field-offset macro 2021-11-09 17:37:31 +01:00
Olivier Goffart
973964c2e3 Fix warning in documentation because of a typo 2021-11-09 17:00:43 +01:00
Olivier Goffart
0484c7ea4b Rename the env variable
Co-authored-by: Simon Hausmann <simon.hausmann@sixtyfps.io>
2021-11-09 15:32:33 +01:00
Olivier Goffart
61202c6cba Make the inlining decision part of the CompilerConfiguration
This also enable disable inlining by default
2021-11-09 15:32:33 +01:00
Simon Hausmann
8ff27671ef Fix absolute item index computation for children of nested sub-components
Somehow the focus_change_subcompo test missed this case and the visible
issue of this off-by-one was that
the combo boxes in the printer demo's settings page opened at the wrong location (wrong parent).
2021-11-09 14:52:47 +01:00
Olivier Goffart
669f96d2b6 const-field-offset: Also fix privacy rule when field-offset-trait feature is activated 2021-11-09 14:36:50 +01:00
Olivier Goffart
92998a76aa Rust: Don't mark the window as pub
No reason to have it public
2021-11-09 13:48:22 +01:00
Olivier Goffart
aea68b9ad8 C++: Fix subcomponents/nested_repeater.60 when not inlining
More or less the same fix as what was done in rust when the test was added
2021-11-09 12:40:04 +01:00
Simon Hausmann
f10f05c726 Fix set_focus_item and show_popup_window calls from within sub-components in Rust
Compute the absolute item index like in the C++ generator.
2021-11-09 11:50:36 +01:00
Simon Hausmann
270f8145ff Don't call set_focus_item in the init function of sub-components
We use the setup_code for that for now, so apply the same logic as in the C++ generator.

However there's more work to be done later to make forward-focus work corectly into sub-components.
2021-11-09 11:49:51 +01:00
Simon Hausmann
3e02c7090c Minor cleanup
Qualify the Default trait also for the root field
2021-11-09 11:09:56 +01:00
Simon Hausmann
b0d76d1bcc Fix dyn_index dispatch to sub-components in Rust
Correctly make the dyn_index a local index by subtracting the base
2021-11-09 10:46:48 +01:00
Simon Hausmann
f7415171d0 Fix generated Rust code when using sub-components in nested repeaters
The code to determine the root is a little more complex, as unlike in C++
we are not passing the root on in constructors.
2021-11-09 10:40:51 +01:00
Olivier Goffart
a5e1f35f7b Make sure that the BindingExpression with animation always has a binding
Consider this code:
```60
Foo := Rectangle {
   animate y { /*...*/ }
   x: some_binding;
}

Bar := Rectangle {
   foo_instance := Foo {
      y: some_binding;
      animate x { /*...*/ }
   }
}
```
We need to make sure that the binding are set with the right animation.

FIXME: the generator should actually handle this case without needing for inlining.
Also, this currently do not work if there is several level of "inheritence"
2021-11-09 10:22:11 +01:00
Olivier Goffart
f6cf8b6d47 Check the analysys of the base component
If there is a Expression::Invalid as a binding (because it has an animation,
for example) we must check that the binding expression in the base is not
constant.

This fixes the rust test `properties_animation_merging` without inlining
(The o4_val was considered constant despite it shouldn't be)
2021-11-08 20:03:26 +01:00
Olivier Goffart
d97fe873ec Fix the FieldOffsets derive macro on non pub struct
When the struct expose as public a private type
2021-11-08 19:01:29 +01:00
Simon Hausmann
1055b39c68 Fix calls to ItemRc that take a VRc, when called from sub-components
There are different ways to get the VRc.
2021-11-08 16:53:24 +01:00
Olivier Goffart
a3bafb59f0 Don't mark the internal components as pub 2021-11-08 16:46:13 +01:00
Olivier Goffart
a6a8f232db Fix error in generated code:
```
error[E0599]: no method named `unwrap` found for struct `sixtyfps::re_exports::OnceCell` in the current scope
   --> .../test-driver-rust-0868c471dd25beed/out/imports_external_type.rs:384:29
    |
384 |                 &_self.root.unwrap().upgrade(),
    |                             ^^^^^^ method not found in `sixtyfps::re_exports::OnceCell<VWeak<sixtyfps::re_exports::ComponentVTable, imports_external_type::sixtyfps_generated_TestCase::InnerTestCase>>`
```
2021-11-08 16:41:45 +01:00
Simon Hausmann
e9a7be2f62 Fix compilation of init() calls to sub-components that are instantiated in repeaters
The path to get the root differs depending on where we are.
2021-11-08 16:29:34 +01:00
Olivier Goffart
28c485c161 Handle the tab key in the Qt backend
Completes #639
2021-11-08 16:16:56 +01:00
Simon Hausmann
8f2a7edbee Add support for callback aliases in Rust sub-components 2021-11-08 16:09:20 +01:00
Simon Hausmann
f693b434f4 Fix warning about unused imports in repeated elements of sub-components in Rust 2021-11-08 16:09:20 +01:00
Philipp Gesang
cd3717af9a handle tab keycode in backend
Treating the Tab key as text disallows handling Shift-Tab because
the shift modifier will not be passed down. This makes the
handling of Tab analogous to Escape, Return and other non-text
keycodes.
2021-11-08 16:04:37 +01:00
Simon Hausmann
4ba6260a47 Add support for repeaters in Rust sub-components
* Generate a visit_dynamic_children dispatch function in sub-components and call it
* Add a self_weak to sub-components
* Fix access to the window from within repeated components
* Fix the parent type of repeated elements within sub-components to be a VWeakMapped instead of VWeak
* Fix the build of the parent_item() implementation of repeated elements within sub-comps. The parent index might still be wrong, needs to be checked.
2021-11-08 15:11:05 +01:00
Simon Hausmann
94b19d3df9 Add VRcMapped::origin() 2021-11-08 13:41:52 +01:00
Simon Hausmann
735a7eef82 Fix access to two-way bindings resolved to aliases in sub-components
We generate a getter that hides the renaming. Instead of returning a field offset, we
might as well use the same code as for the value getter
and return a `Pin<&Property<T>>`.

What doesn't work yet are aliases to globals, because that
uses a temporary.
2021-11-08 13:25:13 +01:00
Simon Hausmann
13de800ba3 Internal cleanup: Rename layouting_info to layout_info
That's making the call on the Component VTable consistent(ish) with the Item VTable.
2021-11-08 10:24:30 +01:00