Commit graph

203 commits

Author SHA1 Message Date
David Edmundson
86c6066551 Introduce helper to restart kwin on crash exit
Right now when kwin exits, the user is taken directly back to the login
screen. The login session exits, so all processes then are killed by the
session.

This patchset introduces a mechanism to safely restart kwin. The socket
(typically wayland-0) remains alive and persistent across restarts. This
means if any process reconnects through it's own mechanism or a crash
restart handler the socket appears to work, and blocks until the new
kwin restarts.

This makes it secure and race free.

If the screen was locked at the time kwin went down, this is also
secure. Kwin now checks the status from logind at the time of launch, so
will immediately restore a locked state before any other rendering.
2020-12-15 15:43:48 +00:00
David Edmundson
bac9d554f1 Move m_display construction to the constructor
We will always create one, this resolves potential to call a getter on a null object.
Requires some code shuffling.
2020-12-15 15:22:40 +00:00
Vlad Zahorodnii
ecac025a2a Port wayland code away from factory methods in KWaylandServer::Display 2020-12-14 13:05:47 +00:00
Vlad Zahorodnii
3cdc97a4e9 Avoid converting socket name between QString and QByteArray back and forth
It only contributes overhead.
2020-12-09 15:07:29 +02:00
David Edmundson
1e2f2a28c7 Port to kwayland-server socket changes 2020-12-09 07:23:40 +00:00
David Edmundson
88f1883e90 Update to wayland-server changes for plasmashell 2020-11-16 10:10:08 +00:00
Vlad Zahorodnii
e398a7cd1a Drop Toplevel::windowId()
A window id generated by WaylandServer may reference an X11 window
with the same id, which can result in undefined behavior.

The main reason why we needed windowId() was because of the task
switcher. However, since tabbox uses internal ids now, the window id
property can be dropped.
2020-11-10 09:58:07 +00:00
Vlad Zahorodnii
823e5b02ea Adjust tablet input stuff to kwayland-server changes 2020-11-05 07:09:57 +00:00
Vlad Zahorodnii
d91da41cef wayland: Fix binding of xwayland surfaces to windows
Surface ids are not unique across clients. If the underlying surface of
an XdgToplevelClient is replaced with an Xwayland's surface, you may see
weird results such as a desktop window having the contents of an X11
window or even worse a crash.

BUG: 428680
2020-11-04 15:35:37 +02:00
Vlad Zahorodnii
5926261505 Adjust kwin to pointer constraints changes in kws 2020-11-03 22:11:28 +02:00
Vlad Zahorodnii
94389de88d Adjust WaylandServer to pointer-gestures-v1 changes in kws 2020-11-03 19:48:41 +00:00
Vlad Zahorodnii
b9cbf3647e wayland: Adapt to subsurface changes in kwayland-server 2020-11-02 08:47:18 +00:00
Aleix Pol
ec73f5eec8 Adapt to changes in wayland-server KeyStateInterface 2020-10-09 13:17:38 +00:00
David Edmundson
56f159dded Adapt to DataSource changes 2020-10-01 14:51:05 +00:00
Vlad Zahorodnii
688dc9ac1d Adjust kwin to recent window management interface changes 2020-09-28 14:43:34 +03:00
Vlad Zahorodnii
7e9bec6fd7 Use consistent naming pattern for wayland shell integrations
This change intends to fix a minor inconsistency regarding how shell
integration classes are named.
2020-09-04 16:51:25 +03:00
Vlad Zahorodnii
88829de9dd wayland: Refactor creation of input panel clients
This change introduces a shell integration class for input panel
surfaces. This effectively breaks the direct dependency between our
virtual keyboard component in kwin and the input_panel protocol,
which means that an input method server could use the layer-shell
protocol instead of the input_panel protocol.
2020-09-04 13:08:34 +00:00
Vlad Zahorodnii
d3cca65d39 Implement the layer-shell v1 protocol
The layer-shell protocol allows wayland clients to create surfaces that
can be used for building desktop environment components such as panels,
notifications, etc.

The support for the plasma-shell protocol will be dropped once plasma in
all its entirety is ported to the layer-shell protocol.
2020-09-03 18:11:44 +00:00
Vlad Zahorodnii
925bb4eea3 Adapt to XdgOutputManagerV1 changes 2020-08-20 17:53:10 +03:00
Aleix Pol
f266a7cfa0 Only allow access to zwp_input_* to the input method
It is a very privacy-concerning component, so we will treat it
specifically.
As it is, it will have to come from the --inputmethod argument. We can
work on some UI later on to select which keyboards are available.
2020-08-18 10:55:21 +00:00
Aleix Pol
7aabd45df9 Integrate input-method-unstable-v1 2020-08-18 10:55:21 +00:00
Aleix Pol
062f1c3c87 Let WaylandServer::findOutput tell us about an output given an OutputInterface
Makes for more readable code and allows to reuse the lookup without
adding the boilerplate.
2020-08-18 10:55:21 +00:00
Vlad Zahorodnii
4ce853e8e4 Prettify license headers 2020-08-07 19:57:56 +00:00
Vlad Zahorodnii
1fb9f6f13a Switch to SPDX license markers
The main advantage of SPDX license identifiers over the traditional
license headers is that it's more difficult to overlook inappropriate
licenses for kwin, for example GPL 3. We also don't have to copy a
lot of boilerplate text.

In order to create this change, I ran licensedigger -r -c from the
toplevel source directory.
2020-08-07 19:57:56 +00:00
Aleix Pol
d71672a0d1 XdgPopupClient can also be a PlasmaShellSurface
Debugging the panel thumbnails I realised that the setPosition calls
didn't have an effect. This is probably not the only way to fix this bug
but does fix the bug.
At the moment it only brings the position from the interface.
2020-08-06 11:00:43 +00:00
Vlad Zahorodnii
19ad172584 Survive Xwayland crashes
If the Xwayland process crashes, it will bring down the entire session
together with itself. Obviously, we don't want that. At least, Wayland
clients should survive the crash.

This change refactors relevant X11 parts to handle Xwayland crashes in a
less fatal way.

In order to handle Xwayland crashes better, a pair of start() and stop()
methods had been introduced in the Xwayland class to allow starting and
stopping the Xwayland process at any moment.

If we detect that the Xwayland process has crashed, we will immediately
stop the Xwayland server, which in its turn will deactivate the socket
notifier and destroy all connected X11 clients. Unfortunately, a couple
of subtle changes in X11Client::releaseWindow() and Unmanaged::release()
had to be made to ensure that we are left with a valid state after the
Xwayland server has been stopped.
2020-08-05 08:48:00 +00:00
adrien faveraux
76b9fb15ea Apply 1 suggestion(s) to 1 file(s) 2020-07-28 13:32:04 +00:00
Adrien Faveraux
08722ff386 adapt shadow to Kwayland server Changes 2020-07-28 13:32:04 +00:00
Adrien Faveraux
69920044f7 Adapt dpms to Kwayland Server changes 2020-07-28 14:03:38 +02:00
Adrien Faveraux
b690858e3f adapt VirtualDesktop to Kwayland Server Changes 2020-07-28 11:53:26 +00:00
Adrien Faveraux
b0f7dcee98 adapt xdg foreign to Kwayland Changes 2020-07-28 11:24:23 +00:00
Adrien Faveraux
16c7b29c3b adapt Idle to Kwaylans Server Changes 2020-07-28 11:02:08 +00:00
Adrien Faveraux
e6ba54a730 adapt idle inhibit to KWayland change 2020-07-28 10:47:25 +00:00
Vlad Zahorodnii
5a73f4a350 screencast: Move creation of the global to manager
We want to turn screencasting into a plugin eventually.
2020-07-27 13:43:05 +00:00
Aleix Pol
9438a2e1b1 Disable screencasting if there's no pipewire 0.3
Hopefully fixes the CI
2020-07-23 23:33:30 +02:00
Aleix Pol
38eb72efe3 screencasting: integrate zkde_screencast_unstable_v1
Includes a PipeWire implementation that will send the relevant streams
to the processes that need them.
2020-07-23 13:14:22 +02:00
Vlad Zahorodnii
97cf90269a Start accepting client connections after creating workspace
Sub-classes of the AbstractClient class need a valid instance of the
Workspace class to function as desired. We should not create xdg-shell
clients until the workspace is created.
2020-07-17 09:10:51 +00:00
Vlad Zahorodnii
036ad759e0 [wayland] Adapt to SurfaceInterface changes 2020-07-15 12:46:28 +00:00
Adrien Faveraux
ae12cf9784 adapt Decoration Server to KwaylandServer Change 2020-07-14 18:23:03 +00:00
Vlad Zahorodnii
5463a5427d [wayland] Drop pointless xwayland connection check
Xwayland can operate in two modes - rootless and rootful. When Xwayland
operates in the rootful mode, a container window is created where all
native X11 clients are placed. The container window is an xdg-toplevel
surface. Most compositors are not interested in rootful mode.

When Xwayland operates in the rootless mode, every X11 window is going
to be represented with a Wayland surface that has no role assigned to it.
In order to associate a wayland surface with an X11 window, Xwayland
will send a client message of type WL_SURFACE_ID.

Since we want Xwayland operate only in rootless mode, the check that
verifies that a newly created xdg-toplevel surface belongs to Xwayland
is pointless. We are never going to hit that case.
2020-07-13 15:37:34 +00:00
Adrien Faveraux
8d861b475d adapt Decoration Server palettes to KWaylandServer Changes 2020-07-13 15:36:22 +00:00
Vlad Zahorodnii
cb7a9456c0 [wayland] Rework Xcursor theme loading code
Currently in order to load an Xcursor theme, kwin uses libwayland api,
which looks really awkward because of the way how the compositor talks
to itself via the internal connection.

The main motivation behind this change is to limit the usage of kwayland
client api in kwin.
2020-06-18 07:14:58 +00:00
Méven Car
e3df2e15a6 ScreenshotEffect: Use Service Property to authorize screenshot without confirmation
Summary:
Restrict to process with `X-KDE-DBUS-Restricted-Interfaces=org.kde.kwin.Screenshot` in their corresponding Service file,
 to take screenshots.
Such a program can now take immediate screenshots.

Adds a utility file to group KService related logic.

Needed for D29408

Reviewers: #kwin, apol, davidedmundson, bport, zzag

Reviewed By: #kwin, davidedmundson

Subscribers: ngraham, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D29407
2020-06-16 19:00:04 +02:00
David Edmundson
2c55df788f [wayland] Update to kwayland-server appmenu changes 2020-06-15 10:34:46 +01:00
David Edmundson
d0d1ad8c85 [wayland] Create primary selection device manager 2020-06-03 14:17:47 +01:00
Vlad Zahorodnii
de2c4cb4ac [wayland] Add support for cropped and scaled surfaces
The wp_viewporter compositor extension allows clients to crop and scale
their surfaces. It can be especially useful for applications wishing to
reduce their power consumption, e.g. video players, etc.

Given that there is no any direct relationship between the surface size
and the buffer size anymore, we have to use specialized helper methods
for converting coordinates from the surface-local space to buffer pixel
space and vice versa.
2020-06-03 10:00:48 +03:00
Vlad Zahorodnii
df9e36ee68 [wayland] Destroy XdgToplevelClient and XdgPopupClient on unmap
There are several ways to handle unmapping of a wl_surface. The first
one is to destroy the associated AbstractClient instance. The second one
is to transition the AbstractClient in a special state.

The problem with the second approach is that it makes animations such as
fade out more difficult to handle since effects in kwin are geared more
towards the first approach (destroying AbstractClient).
2020-06-01 15:13:03 +03:00
Vlad Zahorodnii
31ea780d79 [wayland] Rework xdg-shell implementation
Summary:
This change splits the XdgShellClient class to better match existing
abstractions in the xdg-shell protocol and fix a few issues related to
sending configure events.

In the new client classes, configure events are handled differently.
Instead of blocking configure events, we try to send them as late as
possible. Delaying configure events will let us merge changeMaximize()
for X11 clients and Wayland clients and it also fixes the bug where
we don't send the final configure event when user has finished resizing
a window.

Given that configure events are not sent immediately, XdgSurfaceClient
keeps the last requested frame geometry and the last requested client
geometry.

This patch doesn't intend to fix all issues in kwin's implementation of
the xdg-shell protocol. For example, we still handle surface unmapping
very poorly.

Test Plan: Tests pass.

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D27861
2020-06-01 15:12:59 +03:00
Benjamin Port
301d3defc5 Take in consideration keyboard shortcuts inhibit rename to V1 2020-05-29 11:24:04 +02:00
Benjamin Port
4a90f6ab60 Add support to keyboard shortcuts inhibitor
Summary:
- Disable all global shortcuts
- For now don't disable spies (So opening menu with meta key is not disabled for now)

Depends on D29231

Test Plan: Tested with https://github.com/swaywm/wlroots/blob/master/examples/keyboard-shortcuts-inhibit.c

Reviewers: davidedmundson, zzag

Reviewed By: davidedmundson

Subscribers: romangg, broulik, apol, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D29272
2020-05-29 08:49:11 +00:00