Commit Graph

327 Commits (master)

Author SHA1 Message Date
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
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
Vlad Zahorodnii d1b35f306d Introduce started signal in Application
The new signal is emitted when the Application has fully been initialized.

It allows us to change the startup sequence, for example create workspace
before starting the Xwayland server, without making any adjustments in our
test suit.
2020-07-17 09:10:51 +00:00
Aleix Pol e28e4cb189 Move inputConfig away from KWin::Application
We were calling it from tests that were not running a KWin::Application
and not even including the symbols from main.cpp and main.h. The only
reason they linked was that it was static_casting up the QCoreApplication.
2020-07-13 12:54:34 +02:00
Aleix Pol 3a9d7a6e9d Port KWin to KWaylandServer
Summary: Away from KWayland::Server and KF5WaylandServer.

Test Plan: Builds, ran nested session

Reviewers: #kwin, #plasma, #frameworks, davidedmundson, zzag

Reviewed By: #kwin, #plasma, davidedmundson, zzag

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D29278
2020-04-30 12:56:08 +02:00
Kai Uwe Broulik be31101f12 Remove QSessionManager usage
Summary: Instead, have KSMServer talk to us directly on DBus.

Test Plan: Depends on D28616

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D28617
2020-04-06 11:51:47 +02:00
Vlad Zahorodnii 55b4912004 Update my email address 2020-01-14 18:17:18 +02:00
Laurent Montel 797b477138 Already added by kaboutdata 2020-01-12 14:36:17 +01:00
Vlad Zahorodnii a7e18789cb Fix crash in XRenderPictureData::~XRenderPictureData
Summary:
If the XRender scene has cross-faded a window, then, eventually, KWin/X11 will
crash in the destructor of the XRenderPictureData class during tear down with
the following message in the terminal

```
ASSERT: "qApp" in file /home/vlad/Workspace/KDE/src/kde/workspace/kwin/libkwineffects/kwinxrenderutils.cpp, line 163
```

The crash happens because X11StandalonePlatform attempts to clean up XRender
resources, including XRenderUtils::s_blendPicture, after the application object
has been destroyed.

In order to fix the crash, we have to destroy the platform object before the
destructor of QCoreApplication is executed.

Test Plan:
- Enable maximize effect
- Maximize a window
- Replace the current instance of KWin/X11 with another one

Without this patch, KWin/X11 crashes after the third step.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D25768
2019-12-12 14:06:27 +02:00
Vlad Zahorodnii f21f61db38 Update KAboutData
Summary:
This change updates the copyright statement and adds a few folks who are
considered to be kwin maintainers.

Test Plan: Compiles.

Reviewers: davidedmundson, romangg

Reviewed By: davidedmundson, romangg

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D25646
2019-12-01 12:47:40 +02:00
David Edmundson a209ee7865 Don't notify ksplash in our wayland session
Summary:
KSplash doesn't expect a kwin notification on wayland as kwin is started
before ksplash.

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: broulik, zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23770
2019-09-23 22:13:43 +02:00
Roman Gilg 1db84a2ba7 Split Compositor class in Wayland and X11 child classes
Summary:
This patch is a first take at splitting up of the Compositor class into
Wayland and X11 child classes.

In this first patch we mostly deal with setup and teardown procedures.
A future goal is to further differentiate the compositing part itself too.

Test Plan: Manually X from VT and Wayland nested. Autotests pass.

Reviewers: #kwin

Subscribers: sbergeron, anthonyfieroni, zzag, kwin

Tags: #kwin

Maniphest Tasks: T11071

Differential Revision: https://phabricator.kde.org/D22195
2019-08-07 21:06:53 +02:00
Vlad Zagorodniy c7639fd7ed Port away from deprecated headers
Summary: Headers like stdio.h are deprecated in C++.

Test Plan:
Compiles.

clangd no longer spews these warnings

{F6997789, size=full}

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D22351
2019-07-09 23:59:07 +03:00
Roman Gilg 608a89a85b [autotests] Use Xwayland class in WaylandTestApplication
Summary:
By using the new Xwayland class we can reduce code duplication.

An abstract parent class is introduced, that allows interfacing
with the Xwayland class from the test binaries.

Test Plan: Autotests still pass.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D15022
2019-02-19 12:18:33 +01:00
Vlad Zagorodniy 05c9b1adc2 Update about data
Summary:
Currently, --about doesn't have any effect. In addition to that, the about
data contains outdated information.

This change hopefully addresses all previously mentioned issues.

Test Plan: Ran kwin_wayland --author.

Reviewers: #kwin, graesslin

Reviewed By: #kwin, graesslin

Subscribers: graesslin, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D17319
2018-12-03 10:31:50 +02:00
David Edmundson a3cff85e7a Remove Qt module declarations in includes
Summary:
Test Plan: Compiles

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D13359
2018-06-05 18:07:23 +01:00
Martin Flöser bbf00fdd98 Require libinput and udev
Summary:
The main reason for not having it as a mandatory dependency was that BSD
doesn't support it. But as I learned recently it is available on our CI
system. So BSDs have support now.

Even more it showed that the code doesn't compile if the dependency is
missing. And there's one thing I hate: broken build configuration
options.

So let's make UDEV and libinput a required dependency and get rid of the
problems.

Test Plan: Compiles

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D10057
2018-02-04 15:00:42 +01:00
Martin Flöser a74f8766c3 Drop OperationModeX11AndWayland and introduce OperationModeWaylandOnly instead
The operation mode X11 and Wayland is no longer supported and probably
hasn't been supported for the last few years. But now there is the
possibility to run Wayland only, so introduce this as a dedicated new
OperationMode.
2017-09-30 15:09:06 +02:00
Martin Flöser 5cbd28f9a0 Move X11 specific Workspace initialization code into dedicated method
Summary:
This is required to start KWin/Wayland without XWayland support or
delayed XWayland support.

Test Plan: Run kwin_x11 in a nested Xephyr

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D7897
2017-09-30 13:03:52 +02:00
Martin Gräßlin 857d8a9c37 Add a KSharedConfigPtr for kcminputrc to KWin::Application
Summary:
There are a few places where KWin needs to read values from kcminputrc.
As I need to add yet another one it makes more sense to properly
structure it like in other cases and have only one kcminputrc hold in
the application. This also allows to better mock the config values in
the integration tests.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D5540
2017-04-24 21:01:03 +02:00
Martin Gräßlin 8d9c4acf4d Provide kxbk config through kwinApp
Summary:
So far KWin parsed the kxbkrc at multiple places (once in Xkb, once
in KeyboardLayout). This is now replaced by one KSharedConfigPtr hold
by kwinApp, just like the normal kwinrc. The KSharedConfigPtr is now
passed to Xkb.

As a nice side effect this makes it easier to test keyboard layout
changes as we can now properly mock the keyboard configuration. Thus
this change also comes with an autotest for loading keyboard layout
configuration. This is becoming more and more a need as we start
getting bug reports for layout specific issues like global shortcuts
not working with Greek layout.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D4315
2017-01-30 17:04:03 +01:00
Martin Gräßlin 6184278bec Fix for failing testScriptedEffectsLoader
By changing the loading of scripted effect config to interact with
kwinApp we broke the tests which do not use a kwinApp.

This change turns the access to the KSharedConfigPtr go through the
property system, so that the tests can also install a dummy
KSharedConfigPtr. With that scripted effects loader test passes and no
longer crashes and the integration/effects tests also still pass.
2016-11-16 16:53:17 +01:00
Martin Gräßlin 1c1dca6da4 Move registerMetaType for SurfaceInterface* to main.cpp
Toplevel has the SurfaceInterface* exposed as a property which results
in a (incorrect) runtime warning on X11 about not registered meta type.
2016-08-26 15:27:07 +02:00
Martin Gräßlin 440cca918e Register metatype for KWin::EffectWindow*
It's used as arg in a QMetaObject::invokeMethod and there was a report
about KWin printing a warning of unregistered metatype.
2016-08-26 15:24:00 +02:00
Martin Gräßlin 03700500be Create Cursor instance through Platform
By default the InputRedirectionCursor is created and only the X11
standalone platform creates the X11 specific cursor.

This is a preparation step for moving the X11 specific cursor
implementation into the x11standalone platform plugin.
2016-08-19 10:57:09 +02:00
Martin Gräßlin 490eaadb83 Turn ScreenLockerWatcher into a KWIN_SINGLETON
It's created together with input, so that the input mechanismn already
has a way to check whether screen is locked.

Effects doesn't hold a member variable any more and instead uses the
singleton instance.
2016-08-15 08:37:24 +02:00
Martin Gräßlin c45942a70c Move requiresCompositing from Application to Platform
Summary:
This change reduces the windowing system specific code pathes. Instead
of checking whether we are on X11 or Wayland to decide whether
compositing is required, we just ask the Platform.

The default is true, only x11 standalone allows to not require
compositing.

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1575
2016-05-17 13:59:32 +02:00
Martin Gräßlin bd8f6d78f0 Move everything KCrash related from Application to ApplicationX11
Summary:
This change ensures that kwin_wayland does not pull in KCrash. We
don't want and need KCrash in the Wayland case. If KWin crashes the
session goes down - restarting doesn't make any sense, we need to
relogin.

Similar drkonqi just doesn't work as it doesn't have a windowing
system to connect to. After all the windowing system just crashed.

Also the AlternativeWM dialog doesn't make any sense on Wayland.
Similar thought: there is no windowing system to show this nice dialog.

Overall it's better to have system default behavior
(e.g. systemd-coredump) than using KCrash in the very special case of
kwin_wayland.

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1550
2016-05-09 08:08:49 +02:00
Martin Gräßlin d31e9e88b4 Rename abstract_backend.(h|cpp) to platform.(h|cpp)
Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1340
2016-04-07 16:18:12 +02:00
Martin Gräßlin 10632f09ca Rename AbstractBackend to Platform 2016-04-07 16:18:12 +02:00
Martin Gräßlin 7996d954c5 Provide the platform() -> AbstractBackend* in KWin::Application
Summary:
This is the first change in a refactoring series. The aim is to:
* rename AbstractBackend to Platform
* move backends/ to plugins/platforms/
* don't bind platforms to Wayland only
* provide a platform plugin for "normal" X11
* share more code between X11 and Wayland

This change moves the platform/backend from waylandServer to Application.
The init of the plugin happens directly in the Application from the
KPluginMetaData. There is no need to externally init it and set the
parent.

WaylandServer::backend() currently just delegates to
kwinApp()->platform(), the idea is to drop this method completely.

The test infrastructure is also adjusted to this change.

Test Plan: kwin_wayland still works, all tests pass

Reviewers: #plasma, sebas

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1331
2016-04-07 08:00:12 +02:00
Martin Gräßlin 9e54cb5a1f Move global event filter from Application to ApplicationX11
The event filter is only used to let Qt compose a QKeyEvent from an
x11 event for grabbed key events. On Wayland we don't need it as we
can generate good QKeyEvents ourself. This means less event processing
as the events no longer need to pass through the
Workspace::workspaceEvent.

In addition it fixes a regression in LockScreenTest::testEffectsKeyboard
caused by the LockScreenEventFilter sending a QKeyEvent to KSldApp.
This event got intercepted by the global event filter making the test
rightfully fail.
2016-02-17 09:26:38 +01:00
Oleg Chernovskiy 7ccca92c3e Remove crash handling in kwin_wayland
This patch introduces additional method to Application class
that has default policy of restarting the app.
This method is overridden for wayland case disabling this step.

REVIEW: 126655
2016-02-09 17:20:43 +01:00
Kevin Funk 8ea4f4dae7 Port to CMake AUTOMOC
Summary: Run convert-to-cmake-automoc.pl over all .cpp files

Differential Revision: https://phabricator.kde.org/D882
2016-02-01 21:05:36 +01:00
Martin Gräßlin 1f7daa934d KWin::Application holdes a KSharedConfigPtr with the config
This allows the integration tests to provide their own configuration
as they need it. Setting the configuration should be done before
invoking start()
2016-01-29 09:48:02 +01:00
Martin Gräßlin 1998d5ac1a [wayland] Improve tear-down to not crash if X11 applications are still around
We need to destroy the compositor after Xwayland terminated and after
the internal Wayland connection is destroyed. This means when destroying
the Workspace we may no longer destroy the Compositor at the same time.
Also we need to ensure that other tear down functionality doesn't call
into the no longer existing internal client connection.

With this change kwin doesn't crash when exiting with Wayland and/or
X11 windows still open.
2015-11-10 08:56:32 +01:00
Martin Gräßlin f7d317601e Install a categories file for kdebugsettings
Instead of setting our own filter rules we install a categories file
to allow to configure them. This seems to still have them enabled by
default, but should at least give distributions the possibility to
disable logging by default.
2015-07-15 12:02:31 +02:00
Martin Gräßlin f6458fa1e8 Port away from KToolInvocation
The problem with KToolInvocation is that it creates a dead lock on
Wayland in case kdeinit is not already running. It starts kdeinit
and does a QProcess::waitForFinished and our kdeinit needs to interact
with the wayland server. So dead lock.

As KRun also calls into the dangerous code path it's no option which
leaves us with QProcess to start the processes.

A nice side-effect is that we no don't need to link KF5::Service any
more from kwin_core. Now once Plasma and Notification don't use it
any more, it will be gone completely.
2015-07-07 17:35:57 +02:00
Martin Gräßlin 3041a7c32d [wayland] Add a plugin for kglobalaccel
The KGlobalAccelD which gets created by KWin needs a plugin for the
platform specific parts. This change introduces such a plugin. It's
linked against kwin so that it can integrate with the core.

On enable the plugin registers itself in the InputRedirection and
GlobalShortcutsManager checks the plugin whether a shortcut got
triggered.

As the loading of the plugin must happen after InputRedirection is
fully created a dedicated init method is added to InputRedirection.

REVIEW: 124187
2015-07-02 13:42:29 +02:00
Thomas Lübking 3442664609 port session management to KF5
REVIEW: 123580
BUG: 341930
2015-06-18 00:18:53 +02:00
Martin Gräßlin 604b6d05f5 [wayland] Ensure Compositor is destroyed early enough
If startup fails and there is no Workspace the Compositor was destroyed
as a child of Application with the result of being destroyed after the
Wayland server resulting in a crash.

If the Workspace gets created the Compositor will be destroyed by the
Workspace, so there's no need to destroy it early.
2015-05-27 09:13:33 +02:00
Martin Gräßlin c798977e55 [wayland] Ensure KWin::atoms are destroyed before doing xcb_disconnect
Destroying the Atoms might call into xcb as a request might have to be
discarded. If atoms are destroyed after disconnecting xcb, this'll crash.
2015-05-26 14:26:56 +02:00
Martin Gräßlin 90b1980ce0 Emit signal in Application once Screens are created 2015-04-01 11:05:45 +02:00
Martin Gräßlin 50ef02fa1b [wayland] Start Compositor and Scene before Workspace
For Xwayland we need to have the Scene (and EglDisplay) created prior
to starting Xwayland and having X11. This requires creating the
Compositor before creating Workspace and starting Xwayland.

To support this the startup of Compositor is split into two parts:
prior and after Workspace creation.

The change might also be interesting for the kwin_x11 case as it could
result in the compositor being up in a quicker way.
2015-03-17 10:20:19 +01:00
Martin Gräßlin f39c3c8cbb Emit signal from Application once Workspace is created
Allows interesting parties to delay initialization till Workspace is
ready.
2015-03-17 10:20:19 +01:00
Martin Gräßlin 0f945f53fe Move creation of InputRedirection, Cursor and Screens out of Workspace
Do not depend on Workspace and do not depend on X11 thus can be started
earlier allowing to get more things started prior to depending on
Workspace.
2015-03-17 10:20:19 +01:00
Martin Gräßlin 7369a2c3a5 [kwin_wayland] Support using platform wayland for the QPA
This reorders the startup sequence quite a bit:
1. Create QAbstractEventDispatcher and install it on QCoreApplication
2. Create Application
3. Start Xwayland, use thread to get when its ready
4. Create xcb connection
5. perform startup

For using the wayland QPA it needs a patch in QtWayland which will be
part of Qt 5.4.2, otherwise it blocks.
2015-03-17 10:20:19 +01:00
Martin Gräßlin 65007cd104 [xwayland] Add a dedicated --xwayland option to kwin_wayland
The --xwayland option starts a rootles Xwayland server. If a
rootless Xwayland server is used OperationModeXwayland is used
which is introduced with this change as well.
2015-03-17 10:03:05 +01:00
Martin Gräßlin 0d51952d78 Provide x11Connection as a property on the KWin::Application
KWin::connection() uses the property to resolve the value instead of
using QX11Info. In practice this doesn't change anything at the moment,
but allows kwin_wayland to provide an xcb connection without depending
on QX11Info.

As we cannot make xcb_connection_t* available as a metatype, the
property's type is set to void*.
2015-03-17 09:44:53 +01:00