Commit Graph

65 Commits (a039c2760f6458059dfc91b035a5e03022a31d12)

Author SHA1 Message Date
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 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 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
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 20a9a2a247 Introduce a --no-kactivities command line option
This change enables kactivities integration by default again on both
X11 and Wayland (as kactivities no longer blocks). As we have an
infrastructure to disable kactivities we can also make use of it and
offer a command line switch to disable kactivities. This might be
useful for using KWin outside of Plasma.

REVIEW: 126153
2015-12-16 10:42:14 +01:00
Martin Gräßlin 240e7ba337 [wayland] Emit signal before x11 connection gets destroyed
Used in Compositor to destroy the cm_selection. This would crash
otherwise as it calls into xcb after Xwayland is destroyed.
2015-11-12 15:13:42 +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
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 efa0500313 [libinput] Bind libinput support to VirtualTerminal
This change is motivated by the fact that we need to suspend libinput
before switching the virtual terminal. Also we don't want to take over
libinput if we do not have a VirtualTerminal created - in windowed mode
we don't want libinput to be started. So binding it to the backends which
create the VirtualTerminal makes sense.

The KWin::Application gains a new signal virtualTerminalCreated which is
emitted from VirtualTerminal once it's properly setup. This is used by
Input to create Libinput integration instead of binding it to logind.

Furthermore Libinput gets suspended when the VirtualTerminal reports that
it is no longer active. For re-activation we still just use logind's
session active property.
2015-04-24 12:03:19 +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 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 8c15da99ae Use property for x11AppScreen in KWin::Application
Already provided by KWin::Application so let's use it instead of
QX11Info::appScreen.

REVIEW: 122683
2015-03-17 09:44:53 +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 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
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 704e42163d [kwin] Add missing includes
Were missing if built stand-alone.
2014-03-18 14:37:01 +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
Martin Gräßlin 72882f6aba [kwin] Add sanity checks for the QPA plugin
KWin requires the xcb plugin otherwise KWin crashes when the first
xcb/xlib code is called. First KWin tries to set the QT_QPA_PLATFORM
to "xcb", but that doesn't protect against the command line switch.

Thus KWin also verifies that after constructing the QGuiApplication
the platform name is set to xcb, if not it exits gracefully with a
useful error message instead a crash.

To make that work the KWinSelectionOwner has to be changed to a
pointer and be delayed constructed, otherwise the crash already happens
in the KSelectionOwner.

Furthermore a small sanity check on the plugin is performed by checking
whether KWin can get the XDisplay from the QPA. If not it means that the
QPA plugin was compiled with -no-xcb-xlib which KWin doesn't support, it
still uses XLib at various places. If KWin doesn't get the Display, it
exits gracefully with a clear error message.

CCBUG: 331880
REVIEW: 116669
2014-03-10 08:41:53 +01:00
Martin Gräßlin b65d54f4d2 Enforce compositing if required
In the Wayland world we need to have a compositor. This means we have to
enforce that the compositor is running. If the setup fails we have to
quit, because it doesn't make any sense any more to be running.

A new method requiresCompositing() is added to the Application. If it
returns true the useCompositing option will always return true and the
unredirect fullscreen option will always return false. That way
compositing is enforced at startup and cannot end by unredirecting.

In addition this method is checked if actions are performed which would
suspend compositing. E.g. the shortcut to toggle compositing. Restarting
the compositor is still possible in order to change the selected
compositing backend without a restart. But if it fails KWin will quit.
2014-01-09 15:16:42 +01:00
Martin Gräßlin 1be3a7a9f0 Introduce a method shouldUseWaylandForCompositing() in KWin::Application
Returns true if the OperationMode requires KWin to composite to a
Wayland surface. This replaces the checks for the WaylandBackend or env
variable used so far in the construction of the Scene.
2014-01-09 15:16:42 +01:00
Martin Gräßlin 6eb104b32a Introduce an OperationMode enum
This enum describes how KWin is operating with the available windowing
systems. By default KWin is using the OperationModeX11, but if the
Wayland backend gets started KWin is using the OperationModeWaylandAndX11

This will be extended in future when XWayland and Wayland only become
viable options.
2014-01-09 15:16:33 +01:00
Martin Gräßlin dda4f32e09 [kwin] Add a static kwinApp method to get a pointer to KWin::Application
The idea is that we can use the Application instance as a place to put
global information which should not go into kwinglobals. That is core
global things.
2014-01-09 14:49:57 +01:00
Martin Gräßlin 64dde54f35 Perform crash count checking before we claimed the manager selection
The crash count checking does not depend on whether or not we will
be able to claim the window manager selection. As claiming the selection
can take up to one second we should try to get as many checks which do
not depend on it out.
2013-09-10 15:30:11 +02:00
Martin Gräßlin 0dd7adf5f5 Port KWin::Application to QApplication and QCommandLineParser
Done in one step as it requires changes which are better suited with a
QApplication.

To not need to parte the QCommandLineParser around the needed arguments
are added to the KWin::Application through setters and the crash count
is available through a static getter/setter pair.
2013-08-28 14:13:39 +02:00
Martin Gräßlin 437f762466 Use xcb_atom_t for the Atoms in KWinSelectionOwner 2013-08-28 14:13:39 +02:00
Martin Gräßlin f11e3283d7 Introduce an XcbEventFilter and install it in the Application
Forwards all xcb events to Workspace::workspaceEvent() which got changed
to process xcb events instead of XEvents. So far all handling is
disabled. Will be re-enabled step by step in the following patches.
2013-07-29 08:58:05 +02:00
Martin Gräßlin ea5c23d530 Adjust methods in KWinSelectionOwner to changes in KF5 2013-07-24 09:47:03 +02:00
Martin Gräßlin a516cf3c11 Drop KWinApplication::x11EventFilter(XEvent*)
Does no longer exist in Qt 5. Needs to be replaced.
2013-07-24 09:47:02 +02:00
Martin Gräßlin 1d2c2d5982 Use Q_SLOTS and Q_SIGNALS instead of slots and signals
Fixes compilation with Qt5/KF5 setup.
2013-07-24 09:46:54 +02:00
Martin Gräßlin 1276eb044f Move KWinSelectionOwner to main.(h|cpp)
KWinSelectionOwner is only used in KWin::Application which means that
utils is the wrong place for it.

REVIEW: 110245
2013-05-01 19:15:19 +02:00
Martin Gräßlin 0a7e48f7aa KWin uses kdelibs coding style. 2011-01-31 20:07:03 +01:00
Lucas Murray 04d84ae446 SVN_SILENT Standardized coding style on main.* and manage.cpp
svn path=/trunk/KDE/kdebase/workspace/; revision=898632
2008-12-18 15:01:25 +00:00
Luboš Luňák 01bf6cbb4c License cleanup - add headers where missing, be explicit about GPL
being v2+ (right now it says just GPL, which according to GPL itself
means any GPL). Decoration clients will come later.
CCMAIL: kwin@kde.org


svn path=/trunk/KDE/kdebase/workspace/; revision=742302
2007-11-27 19:40:25 +00:00
Rivo Laks ec0fa1789a Automatically restart KWin when it crashes.
If it crashes at least two times in a row then disable compositing.

svn path=/trunk/KDE/kdebase/workspace/; revision=717778
2007-09-27 14:53:52 +00:00
Luboš Luňák f52b8e48cd branches/work/kwin_composite becomes new trunk kwin.
svn path=/trunk/KDE/kdebase/workspace/; revision=659202
2007-04-29 17:35:43 +00:00
Luboš Luňák 2b7e1f4993 Remove kwin, kwin_composite will become new trunk kwin, missing merges
from trunk will be merged in.


svn path=/trunk/KDE/kdebase/workspace/; revision=659200
2007-04-29 17:34:49 +00:00