Commit graph

51 commits

Author SHA1 Message Date
Vlad Zahorodnii ddb0490592 Change default keyboard interactivity to OnDemand
OnDemand is a better default as it still ensures that the window will
receive keyboard input by default, but it's less aggressive.
2023-11-30 10:06:18 +00:00
Vlad Zahorodnii 3c116e7550 Revert "Change default keyboard interactivity from exclusive to none"
This reverts commit be63783888.

It broke keyboard input in sddm greeter. While defaulting to a non-spec
value is not great, it's also not that critical. It might be worth
considering synchronizing Qt::WindowDoesNotAcceptFocus with the keyboard
interactivity flag, but the tricky part is that the keyboard interactivty
is not just a boolean.

BUG: 477251
2023-11-30 10:06:18 +00:00
David Edmundson de9fdb3fb7 Support XDG activation
QWaylandLayerShellIntegration has virtual hooks for Xdg Activation.

This is important to hook up in layer shell because activation using
requestActivate in Qt will go through this path. It also means we have
support for us to drop the implementation in KWindowSystem in favour of
calling into Qt.
2023-11-06 12:41:20 +00:00
Vlad Zahorodnii 721c0ae334 Remove an inappropriate log message 2023-09-06 14:52:55 +03:00
Aleix Pol Gonzalez 143fd1755a Expose the Window interface to QML
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>
2023-07-13 11:23:01 +02:00
Laurent Montel 3bfed84c45 Now we depend against qt6 2023-06-08 19:17:22 +02:00
Vlad Zahorodnii 9750fd8be7 Avoid emitting excessive changed signals
If the layer shell surface properties don't change, don't emit the
changed signals and issue wayland requests.
2023-05-17 14:57:09 +03:00
Vlad Zahorodnii 5e88f449b0 Introduce Window::closeOnDismissed() flag
This can be used to control the sending of QEvent::Close event.
2023-05-16 17:58:48 +03:00
Vlad Zahorodnii 497d50c4df Emit Window::layerChanged signal
Otherwise it's not possible to change layers at runtime.
2023-05-13 12:18:12 +03:00
David Edmundson 1358743441 Call LayerShell::set_size when the window geometry changes
Without this when krunner expands, the frame after kwin will resize it
back to the last size the layer shell requested to be resized to.

To detect when we should not send an explicit size on window resize
events we check the anchors; if we're constrained on opposing edges we
want the compositor alone to set the size.
2023-05-01 14:38:36 +00:00
David Redondo be63783888 Change default keyboard interactivity from exclusive to none
To be in line with the default of the protocol
2023-04-27 12:28:02 +02:00
Fabian Vogt 49f31bb22d Replace Window::desiredOutput with a Window::screenConfiguration enum
To not overlap with QWindow::screen too much, introduce an enum to make it
more clear what the options and the resulting behaviour are.
2023-04-24 20:11:13 +00:00
Vlad Zahorodnii 511b92f4ab Port to QWaylandShellSurface::attachPopup() 2023-04-22 12:11:04 +03:00
Vlad Zahorodnii fdab1544fb Add a (temporary) way to attach popups to layer surfaces
The new API is temporary. It's needed to help us with porting plasma to
the layer shell protocol until Qt 6.6 is released, which includes
QWaylandShellSurface::attachPopup().
2023-04-22 12:11:04 +03:00
Vlad Zahorodnii 2985398375 Port to QWaylandWindow::setShellIntegration()
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.
2023-04-22 12:11:01 +03:00
Fabian Vogt 3c85e2e889 Use the QScreen of the QWindow as default output
If the Window::setDesiredOutput API was not called for the QWindow, use
QWindow::screen(). This allows assigning QWindows to specific screens using
the plain Qt API.

Passing nullptr to Window::setDesiredOutput explicitly results in nil as
desired output for the layer, which lets the compositor select a screen.
2023-02-22 08:23:17 +01:00
David Redondo 7de801802b Revert "Show all headers in qtc6"
There was no consensus for this in Plasma.
This reverts commit 22df3fe914.
2023-01-24 08:49:43 +01:00
Laurent Montel 22df3fe914 Show all headers in qtc6 2023-01-22 17:38:12 +00:00
David Edmundson 7bd63669ea Use change signals on Window interface class.
QWaylandLayerSurface pulled data from the Window on startup. The Window
pushed data into the QWaylandLayerSurface on changes. Having two
patterns is a sign of something being off.

This moves everything to a single design, pulling from the public
interface. This allows us to drop a code path that meddles with
QWaylandWindow internals.
2022-06-30 08:09:21 +00:00
Carl Schwan 345676a4a1 Minor api doc improvement for api.kde.org 2022-05-04 10:43:03 +00:00
Volker Krause ae883df5b1 Build with Qt6 2022-03-06 10:54:56 +01:00
Julius Zint 9f8b8c9731 Add desiredScreen property to LayerShellQt::Window
If the property is set, the compositor will try to put the window on the
given output. If not set, the compositer will decide where to put the
window (usually the active output). The motivation for this change is the
ability for KRunner to always appear on the active output.
2022-01-26 09:04:14 +01:00
Laurent Montel 80f6a629bb GIT_SILENT: add missing override 2021-10-27 13:43:28 +02:00
David Edmundson 4a439143ba Fix a crash when creating views on the placeholder screen
When a compositor has no outputs listed Qt creates a dummy placeholder
QScreen object that does not represent a wl_output.

This should still be fixed in the clients to not create a view, it's
wasteful and probably will still have plenty of other bugs, hence the
giant warning, but it's still worth guarding.

CCBUG: 439096
2021-09-15 22:55:35 +00:00
Friedrich W. H. Kossebau 7d46bd63c5 Port away from ECMSetupVersion's deprecated *_VERSION_STRING CMake variable
GIT_SILENT
2021-05-04 23:35:44 +02:00
Vlad Zahorodnii 8d1aeb7bf1 Store QWaylandLayerShell using a QScopedPointer
This is to ensure that the QWaylandLayerShell will be eventually
destroyed.
2021-04-20 16:02:33 +00:00
Vlad Zahorodnii 93f3ed2c07 Fix a memory leak
The dynamically allocated QtWayland::zwlr_layer_shell_v1 object in
QWaylandLayerShellIntegration::registryLayer() isn't deleted anywhere.
2021-04-20 16:02:33 +00:00
Vlad Zahorodnii efd32eed53 Add missing parenthesis
This is to make the compiler happier.
2021-04-20 18:38:24 +03:00
Vlad Zahorodnii 11a811061f Introduce KeyboardInteractivity enum 2021-04-20 15:27:43 +03:00
Nicolas Fella 549f5ad682 Link against xkbcommon
Otherwise the build fails with missing xkbcommon headers
2021-04-15 20:46:25 +02:00
David Edmundson 2b1219cfdd Ensure we can set per-window properties before the intial commit
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
2021-04-15 09:58:57 +01:00
David Edmundson 29d0078909 Ensure we can set per-window properties before the intial commit
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
2021-04-14 23:49:30 +01:00
Vlad Zahorodnii f684097c0f Properly guard zwlr_layer_shell_v1 destructor request
The destructor request was added in version 3.
2021-04-09 12:49:49 +00:00
Vlad Zahorodnii b4c62f7926 Expose set_layer
The set_layer request allows to move a surface to another layer after
creating it.
2021-04-09 12:49:49 +00:00
Aleix Pol 154741bb47 Add wlr-layer-shell-unstable-v1.xml protocol file's licence
This way "reuse lint" outputs clean
2021-04-08 18:26:32 +02:00
Vlad Zahorodnii 31ce504f99 Fix layer-shell version selection logic
If an app blindly binds a global, it may crash if the compositor
supports slightly newer version of the protocol.
2021-04-08 09:26:16 +03:00
Vlad Zahorodnii 9816f32bc4 Remove redundant includes
qwayland-wlr-layer-shell-unstable-v1.h is already included in
corresponding header files.
2021-04-07 16:49:31 +00:00
Vlad Zahorodnii c46249bba0 Remove Q_NULLPTR usage
This project requires C++17, which has the nullptr keyword.
2021-04-07 16:05:02 +00:00
Vlad Zahorodnii 834551f6b7 Remove hard-coded zwlr_layer_shell_v1 interface name
This makes code more neater.
2021-04-07 18:19:43 +03:00
Aleix Pol 09be37e17c SPDX, use .license on files where it's awkward to get it inside 2021-04-06 14:32:51 +02:00
Aleix Pol 6c75bae88b Warn when qputenv returns false as the whole component won't work 2021-04-06 13:54:52 +02:00
Aleix Pol efa32dfbe3 Use unversioned Qt targets 2021-04-06 13:54:43 +02:00
Aleix Pol cd9b1a6fd3 Address code formatting 2021-04-06 13:39:27 +02:00
Aleix Pol 1bf7276d53 Add SPDX 2021-04-06 13:05:53 +02:00
Vlad Zahorodnii 840f40db73 Fix clang warning
The warning itself:

> /home/tsdgeos/devel/kde/layer-shell-qt/src/qwaylandlayershell_p.h:23:24: note: did you mean class here?
>      QWaylandLayerShell(struct QtWayland::zwlr_layer_shell_v1 *shell);
2021-04-05 09:23:52 +03:00
Fabian Vogt 4a3d27d0be Fix build of the layer-shell plugin
It's missing a dependency on Wayland::Client.
Also, it uses LayerShellQtInterface, which is only defined later, move it.
2021-04-01 22:36:29 +02:00
Aleix Pol cffdab8c33 Use debug logging categories 2021-04-01 17:55:58 +02:00
Aleix Pol be966dbeb6 Install headers in the right directory 2021-04-01 14:06:10 +02:00
Aleix Pol 53a97fc89e Make sure it's findable 2021-04-01 03:12:40 +02:00
Aleix Pol 41704f8d15 Fixes 2021-04-01 02:45:31 +02:00