If we are designing our UI's windows from QML, it makes sense that we
might want to configure how they're placed from the same place.
Everything was already in place but for a few technical bits which this
change adds.
Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
With QWaylandWindow::setShellIntegration(), it's possible to use
xdg-shell and layer-shell protocols in the same process. It's important
for plasmashell, where we want to use the layer shell protocol for
special surfaces such as the desktop background, and the xdg shell
protocol for dialogs.
In order to make a QWindow use the layer shell protocol, you need to
call LayerShellQt::Window::get() before the window is mapped.
In the current implementation we cannot use a LayerShellQt before the
shell surface is created.
At the moment a shell surface is created, the constructor is run and
then QtWayland commits the current state. This means the compositor
configures the window before a client has any chance to set anchors or
margins.
This works whilst we're just being a simple fullscreen window, but won't
scale for plasmashell in the future.
This patch makes LayerShellQt::Window always creatable, and we can set
and cache properties before the platform window is created, just like
one can on QWindow and XDGShell properties.
This also makes it less potentially crashy as ::get always returns a
valid result, and
sets up the public API to be QML-able as an attached property in future.
Co-authored on Aleix's patch for the unit test
In the current implementation we cannot use a LayerShellQt before the
shell surface is created.
At the moment a shell surface is created, the constructor is run and
then QtWayland commits the current state. This means the compositor
configures the window before a client has any chance to set anchors or
margins.
This works whilst we're just being a simple fullscreen window, but won't
scale for plasmashell in the future.
This patch makes LayerShellQt::Window always creatable, and we can set
and cache properties before the platform window is created, just like
one can on QWindow and XDGShell properties.
This also makes it less potentially crashy as ::get always returns a
valid result, and
sets up the public API to be QML-able as an attached property in future.
Co-authored on Aleix's patch for the unit test