Invert slint:🪟:WindowInner and PlatformWindow ownership

Previously: Window is an Rc<WindowInner>, which has an Rc<dyn
PLatformWindow> - and weak references the other way around.

Now: Rc<dyn PlatformWindow> is the root of window ownership. The impl
PlatformWindow has a slint::api::Window, which just holds a WindowInner.

This change is incomplete on a few levels, mainly that neither of the
code generators nor the interpreter is ported.
This commit is contained in:
Simon Hausmann 2022-08-18 11:38:30 +02:00 committed by Simon Hausmann
parent f88b688fbf
commit af86f36157
32 changed files with 494 additions and 533 deletions

View file

@ -564,7 +564,7 @@ public:
/// such as the position on the screen.
const slint::Window &window()
{
const cbindgen_private::WindowRcOpaque *win_ptr = nullptr;
const cbindgen_private::PlatformWindowRcOpaque *win_ptr = nullptr;
cbindgen_private::slint_interpreter_component_instance_window(inner(), &win_ptr);
return *reinterpret_cast<const slint::Window *>(win_ptr);
}
@ -582,7 +582,7 @@ public:
/// it may return nullptr if the Qt backend is not used at runtime.
QWidget *qwidget() const
{
const cbindgen_private::WindowRcOpaque *win_ptr = nullptr;
const cbindgen_private::PlatformWindowRcOpaque *win_ptr = nullptr;
cbindgen_private::slint_interpreter_component_instance_window(inner(), &win_ptr);
auto wid = reinterpret_cast<QWidget *>(cbindgen_private::slint_qt_get_widget(
reinterpret_cast<const cbindgen_private::WindowRc *>(win_ptr)));
@ -1010,7 +1010,7 @@ inline void send_keyboard_string_sequence(const slint::interpreter::ComponentIns
const slint::SharedString &str,
KeyboardModifiers modifiers = {})
{
const cbindgen_private::WindowRcOpaque *win_ptr = nullptr;
const cbindgen_private::PlatformWindowRcOpaque *win_ptr = nullptr;
cbindgen_private::slint_interpreter_component_instance_window(
reinterpret_cast<const cbindgen_private::ErasedComponentBox *>(component), &win_ptr);
cbindgen_private::send_keyboard_string_sequence(