As outlined in commit 753ec83a05,
converting from a VRc<VT, X> to VRc<VT, Dyn> requires subsequent use of
the data_offset in order to determine the correct instance pointer.
This applies also to VRc's Deref implementation, which isn't used with
Dyn right now, but will be soon in order to determine the bare instance
address for item tree traversal.
Component's get_item_ref has a life time attached to it, and in the
interpreter we're having two vtable implementations, one for
ErasedComponentBox and another generated one. The approach with
as_pin_ref to transfer the lifetime to a reference to the trait object
for the other vtable isn't working because as_pin_ref consumes the VRef
and then takes the address of a temporary on the stack.
Short of a cleaner solution, this patch circumvents the second vtable
indirection and calls our extern "C" function directly.
When converting a Weak<VT, T> into Weak<VT, Dyn>, we were ignoring that
while T inside VRcInner may be at a certain offset to satisfy alignment,
the empty Dyn field may not and thus be at a different offset.
On wasm32 for example the compiler generated component struct has a
16-byte alignment, while the Dyn has none. So converting the Weak<VT,
Dyn> to a VRc<VT, Dyn> and then calling borrow() would use the wrong
instance pointer.
To fix this, this patch introduces an extra offset field that's
preserved during the casting and that's used for borrow() as well as
drop().
... or `Dyn` if unkown.
So we can implement Deref for the concreate type.
Sicne Deref is implemented for VRc, all the method of VRc are now
associated function.
Similar to the mouse_grabber, we use a VisitChildrenResult field to
track the focus item within a component. Unlike the mouse grabber
however, it is set/cleared using dedicated focus events.
The key event now routes the key event directly to the focus item.
The focus can be requested via set_focus_item on a window, which the
TextItem does.
- Give all the sixtyfps-* create a 0.0.1 version
- Make sure that the internal dependences are using the exact same version
(so "=0.0.1")
- Add the description/homepage/repository fields in the .toml files
- Set publish=false to crates that are not meant to be published on crates.io
Removed the drop and create from the ComponentVTable:
since we are not using VBox<ComponentVTable>, this simplifies a bit
the code of the interpreter and everything else.
But there is still a lot of changes everywhere to support that the Component
is pinned.
This is just for the component. Which would be required if later we want
to access the properties as Pin<Property<_>>. But we have not yet ability
to do projections