Commit Graph

304 Commits (49dfe5dfbed1d5991087be6f69fcc7a7c8b08545)

Author SHA1 Message Date
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
Martin Gräßlin fe9873e4b1 Provide x11RootWindow as a property on the KWin::Application
KWin::rootWindow() 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 a root window without depending on
QX11Info.
2015-03-17 09:44:53 +01:00
Martin Gräßlin b56ed80de1 Workaround broken CI system
It doesn't know XCB_GE_GENERIC.
2015-02-25 11:10:31 +01:00
Martin Gräßlin d95ab94f0a Migrate away from QX11Info::appTime
The porting to Qt5 broke the timestamp handling in many areas. A deeper
look into Qt's xcb plugin shows that the appTime handling is not
sufficient for KWin's need. E.g. the time is only updated in response to
a property notify event if it's for a Qt created window, which is hardly
ever the case in KWin. Another example is that key press/release events
never updated the appTime.

As the functionality in Qt is rather trivial we can do the timestamp
handling ourselves. We filter all events anyway and it is slightly faster
as we don't have to go through the QPA interface any more.

REVIEW: 122636
2015-02-23 11:02:59 +01:00
Martin Gräßlin 8cb78b7df6 Use KWIN_DBUS_SERVICE_SUFFIX for multi-head service name wrangling
Adjust the KWIN_DBUS_SERVICE_SUFFIX env variable in a multi-head
scenario instead of adjusting the "org.kde.kwin" DBus service which
we actually don't use in 5.x any more.

REVIEW: 122217
2015-01-27 07:25:52 +01:00
Lasse Liehu 4963bf3d44 Fix QTranslator installation for Qt translations
The translator instance was uninstalled right away after installation
because it was destroyed when returning from the function.

REVIEW: 121977
2015-01-12 21:10:38 +02:00
Martin Gräßlin b6bb4e2548 Register metatype Options::WindowOperation
Fixes all actions not working from user actions menu.
2014-12-08 10:08:49 +01:00
Daniel Pastushchak 0d997b1093 Introduce categorized logging for kwin core
Done by Daniel Pastushchak for KDE during GCI-2014.
2014-12-05 14:27:15 +01:00
Martin Gräßlin 15a1a5b70f Add command line option to enable libinput support
kwin_wayland gains a new command line option to enable libinput support.
This is needed as logind blanks the VT when the session controller
releases the control. So a nested compositor can seriously affect the
primary session. Thus it needs a dedicated command line switch to
enable it.

By default libinput support is disabled for kwin_x11 and can be enabled
for kwin_wayland in case KWin is compiled with libinput support.
2014-10-20 14:51:24 +02:00
Martin Gräßlin f9a7b94ee7 Create dedicated kwin_x11 and kwin_wayland binaries
All of kwin except the main function goes into a new (private) library
called kwin. Two new kdeinit_executables are created:
* kwin_x11
* kwin_wayland

Both only use a dedicated main_x11.cpp and main_wayland.cpp with the
main function and a KWin::Application subclass and linking the new
kwin library.

The main idea behind this is to be able to perform more sane sanity
checks. E.g. on Wayland we don't need to first test whether we can
create an X11 connection. Instead we should abort if we cannot connect
to the Wayland display. Also the multi-head checks are not needed on
Wayland, etc. etc. As most of that code is in the main function to
simplify it's better to split.

This will also make it easier to diverge more easily in future. The
Wayland variant can introduce more suited command line arguments for
example. This already started by having the --replace option only
available in X11 variant. The Wayland backend is still a window manager,
but doesn't claim the manager selection.
2014-08-18 08:50:44 +02:00
Martin Gräßlin 6e195331f6 Revert "set QSG_RENDER_LOOP as basic if not explicitly set"
This reverts commit c09d63d192.

The test results we got indicate that on NVIDIA the problems with the
threaded rendering loop do not exist and at the same time the rendering
result improves a lot. As Qt still disables the threaded rendering loop
for the problematic drivers, it's better to not force the basic rendering
loop.
2014-06-30 14:21:40 +02:00
Hrvoje Senjan 52653aaede Rename KWin binary to kwin_x11
This servers two purposes.
1. it makes KWin/5 co-installable with KWin/4 as now binary and
   all libraries etc. are renamed or installed to a different
   location.
2. In future we need a dedicated X11 and Wayland main function
   anyway. Thus it makes most sense to rename to kwin_x11 directly
   instead of first renaming to kwin5. The reason why we need to
   have dedicated main functions is that kwin needs to check early
   whether X11 is working or Wayland is working. Right now the first
   thing kwin does is trying to connect to the XServer. This happens
   before the QApplication is constructed and before command line
   args are processed. On Wayland we won't want to test whether we
   can connect to the XServer. As it's too early to check whether we
   are starting kwin for X11 or Wayland the most convenient way is to
   have dedicated binaries - thus a rename is needed. Just renaming
   kwin for wayland is also not a good idea as in future the "main"
   kwin will be for wayland not for X11. Another case for the dedicated
   binaries is the Application class, which right now first tries to
   claim the X11 Window Manager Selection. Again on Wayland even with
   XWayland we won't need that. KWin will be the window manager for
   XWayland if KWin is the Wayland compositor. There is no need to even
   try to support anything else. Most likely it will even be KWin to
   start the XWayland server, so we can be sure that there is no other
   WM running and thus no need to claim the selection and abort if it
   fails.

REVIEW: 118266
2014-06-16 15:34:34 +02:00
Martin Gräßlin d8dd369f9e Load Qt's translations 2014-06-04 15:59:53 +02:00
Martin Gräßlin 14c5637d68 Add KAboutData's command line arguments to the QCommandLineParser
This adds back --author and --license.
2014-05-27 09:34:14 +02:00
Martin Gräßlin 7fe2b08bf9 Call KAboutData::setApplicationData
That way we don't have to specifiy name et all multiple times.
2014-05-27 09:33:34 +02:00
Andreas Hartmetz 9c73055a10 Adapt to changes in KAboutData. 2014-05-14 05:04:40 +02:00
Marco Martin c09d63d192 set QSG_RENDER_LOOP as basic if not explicitly set 2014-05-07 15:43:01 +02:00
Martin Gräßlin 88d55997f7 Port away from DefaultScreen(display())
The screen number is provided through QX11Info.
2014-05-05 08:09:09 +02:00
Martin Gräßlin e80094694e Adjust kwin and killer to new ki18n
Setting the ApplicationDomain to kwin, both use the kwin catalog.

The left-over code for catalogs is removed. Note for adjustments:
* scripting doesn't provide an own catalog
* scripts are extracted but there are no scripts with i18n
2014-05-05 08:03:54 +02:00
Martin Gräßlin ee20101142 Fix deprecated warnings for KAboutData
Ctor with catalog name got deprecated, use ctor without it.
2014-04-28 17:11:20 +02:00
Àlex Fiestas 0e9f6888e0 Stop suspending startup from KWin
This commit basically makes KWin stop using suspend-resumeStartup
methods from KSMServer. The idea is to launch things on parallel and
this is doing exactly the contrary.

Reviewed-by: Martin Gräßlin <mgraesslin@kde.org>
2014-03-24 16:01:48 +01:00
Martin Gräßlin 704e42163d [kwin] Add missing includes
Were missing if built stand-alone.
2014-03-18 14:37:01 +01:00
Martin Gräßlin cb262a2bbb [kwin] Add used features from config-workspace.h to config-kwin.h
Adds HAVE_UNISTD_H and HAVE_MALLOC_H to config-kwin.h and gets used
in main.cpp. With that KWin does no longer need config-workspace.h.
2014-03-18 09:30:40 +01:00
Aleix Pol c72e519d9c Remove KDE/ prefix in include directories
It's unneeded and deprecated since KF5.
2014-03-17 16:24:10 +01:00