Commit Graph

101 Commits (84b73ab2b30b4ff2acac2ecd8c5314b7dd2b5bef)

Author SHA1 Message Date
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 96124c1643 Merge branch 'Plasma/5.5' 2015-12-15 13:08:16 +01:00
Martin Gräßlin 14b9046ad2 Unblock signals in child processes
We need to unblock the signals blocked with pthread_sigmask.
This caused kdeinit to block, because it relies on SIGUSR1.

BUG: 356580
FIXED-IN: 5.5.1
REVIEW: 126361
2015-12-15 13:03:30 +01:00
Martin Gräßlin 2d6fe2cb05 [wayland] Forward error channel of launched processes
This ensures that the redirection to xwayland-errors works properly
for a complete session.
2015-12-15 10:08:36 +01:00
Martin Gräßlin e5a27cffb1 [wayland] Disallow ptrace on kwin_wayland process
In order to increase the security we disable ptrace on kwin_wayland.
This makes it impossible for a another process running as the same
user to attach to kwin_wayland to install a key logger. It doesn't
protect against higher privileged users, but that's no problem: they
can just read the input device file and don't need to attach to KWin
to become a key logger.

This change is highly inspired by a similar change to kscreenlocker.
A difference is that KWin checks whether we are running under a
debugger. In such a case we still want to allow ptrace.
2015-12-08 11:42:48 +01:00
Rohan Garg 8680586dbd Add a check for waylandServer in the dtor before using it
Make sure the waylandServer ptr exists before referencing it
in the dtor.

REVIEW: 126190
2015-11-30 15:58:27 +01:00
Martin Gräßlin 56bd1e7194 [wayland] Add support for initial output count for nested compositors
Added to x11 backend which creates one window per output.

New command line option is called --output-count=<int>.
2015-11-26 08:33:07 +01:00
Martin Gräßlin 23784d2038 [wayland] Introduce an additional --exit-with-session command line arg
This is similar to the applications to start. That is the value of the
command line argument is interpreted as a command to start.
The difference is that when this application exits, KWin will also quit.
The argument is so to say interpreted as a session.

Reviewed-By: Bhushan Shah
2015-11-19 09:28:51 +01:00
Martin Gräßlin 3be016fba4 [wayland] Destroy all ClientConnections on tear down
Ensures that all Wayland objects are destroyed and the cleanup handling
is performed before tearing down the Compositor. This fixes for example
a crash if a Surface with a Shadow is still around at tear down.
2015-11-18 10:29:10 +01:00
Martin Gräßlin f6ef9e8d8c [wayland] Don't use waitForFinished on the Xwayland QProcess
WaitForFinished blocks our main thread, but Xwayland wants to talk
to Wayland and blocks as well. So let's ensure events are processed
while terminating Xwayland.
2015-11-12 15:15:44 +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 f2bdb4818a [wayland] Disable Compositor during tear-down
Prevents rendering an incomplete state and as well prevents from
running performCompositing() which could access Workspace and crash.
2015-11-12 15:12:01 +01:00
Martin Gräßlin 238ff89edb [wayland] Don't exit due to Xwayland exiting on tear down
Our Xwayland exit error handler should not run during tearing down
Xwayland. Yes we expect Xwayland to exit as a response to KWin telling
it to exit.
2015-11-12 14:06:28 +01:00
Martin Gräßlin c1e9280efa [wayland] Unload all effects prior to destroying Xwayland connection
Some effects do X11 calls in their cleanup code through external
libraries (e.g. KSelectionOwner). As we cannot control that we need
to ensure the effects are unloaded prior to destroying the Xwayland
connection.
2015-11-12 11:33:00 +01:00
Martin Gräßlin fa6fbbdfc1 [wayland] Destroy input method connection after process finished
More cleanup.
2015-11-10 14:38:45 +01:00
Martin Gräßlin affcbac7e7 [wayland] Destroy Xwayland's ClientConnection on tear down
We need to destroy the ClientConnections we create. Also we need
to disconnect our Xwayland error handling before destroying it, otherwise
it would trigger the abort for crashing Xwayland.
2015-11-10 14:21:48 +01:00
Martin Gräßlin f75e53af60 [wayland] Ensure to not call into x11 on Compositor tear-down
During Compositor tear down Xwayland is already destroyed. Thus it
doesn't make sense to try to delete the support properties: either
it freezes in xcb or it crashes because the connection is null.

At the same time we also ensure that the connection internally is
reset to null. Note: the one in kwinglobals.h caches and could cause
use-after-free errors. Any tear-down code must be migrated to
kwinApp()->x11Connection().
2015-11-10 13:54:26 +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
Takahiro Hashimoto 7b9c21d63c [wayland] Use Qt::AA_DisableHighDpiScaling in Qt 5.6
Follow the change of Qt 5.6 branch, see below

https://codereview.qt-project.org/#/c/127895/

REVIEW: 126008
2015-11-10 07:47:55 +09:00
Nick Shaforostoff 3a8d7d866a optimize string operations
-use qstringliteral only when necessary (i.e. not in concat or comparison)
-use qbytearray instead of qstring when dealing with latin1 input and output (glplatform)
-use qstringref to extract numbers from strings (glplatform)
-define qt_use_qstringbuilder to optimize all string concatenations
-anidata: use ctor init lists, add windowType member initialization

REVIEW: 125933
2015-11-05 14:14:06 +00:00
Bhushan Shah bacfd876fe [wayland] Start ksldapp from the WaylandServer
This introduces --lockscreen option in kwin_wayland which when used will
lock screen immediately. Also dependency to newly created kscreenlocker
repo is introduced.

REVIEW: 125954
2015-11-05 18:39:23 +05:30
Martin Gräßlin 19602a921e [wayland] Reset QT_QPA_PLATFORM to wayland after starting Application
We only need to force QT_QPA_PLATFORM to be our own plugin when starting
the application. As KWin starts other processes (e.g. kcmshell5) we need
to ensure that the env variable has a sane value. No other process can
load our QPA plugin after all.

Reviewed-By: Bhushan Shah
2015-11-03 16:52:55 +01:00
Martin Gräßlin 7cc566681d [wayland] Drop check for QtWayland 5.4.2
We don't use QtWayland any more, so we don't need to check the version
any more.
2015-10-29 10:10:28 +01:00
Martin Gräßlin 28992c3d31 [wayland] Force Qt::AA_NoHighDpiScaling on Qt 5.6
We already unset QT_DEVICE_PIXEL_RATIO to ensure to keep out of
high dpi scaling. Now with Qt 5.6 we also need to set the attribute.
Without we crash on startup as we don't have a screen that early and
well Qt doesn't check whether it's null.
2015-10-29 10:08:23 +01:00
Martin Gräßlin eed5531b4f [wayland] Rework command line checks for platforms
The change to reflect the available plugins in the command line options
had side effects as that made it impossible to start KWin if certain
plugins are not available.

This change ensures that we only check the option value if they are set
in the first place.

In addition the multi checks to verify whether combinations are valid
is removed as that makes in reality no sense any more (only few plugins
installed by distros) and doesn't scale any more with the increasing
numbers of backends.
2015-10-03 20:14:16 +02:00
Martin Gräßlin bfa9646d1d [wayland] Add a virtual framebuffer backend
A new backend which doesn't present the rendered output. It uses a
QPainter scene, renders to a QImage but doesn't present it anywhere.
Thus a real virtual backend.

By exporting the environment variable KWIN_WAYLAND_VIRTUAL_SCREENSHOTS
the backend creates a temporary dir, prints the path to std-out and
saves each rendered frame into that directory. Of course with exit it
will be deleted again.
2015-10-02 10:58:33 +02:00
Martin Gräßlin 007a317099 [wayland] Add options depending on available backend plugins
As distributions do not ship all plugins let's try to filter the options
based on the plugins which are actually available. There is no point in
allowing e.g. framebuffer just to notice then that the plugin is not
shipped ending in confusing error for the user. So let's only add the
options which actually make sense.
2015-10-02 09:47:27 +02:00
Martin Gräßlin fc0272f3c4 [wayland] Add a --list-backends command line arg for listing available backends
Distributions do package each backend plugin in a dedicated package,
which means just because KWin got compiled with a specific backend,
doesn't mean it is also available at runtime.

In order to better support this reality this change introduces a
list-backends command line option. Each of the plugins got the json
metadata extended by the KPlugin syntax, so that we have a name and
description to print.

As we already locate all plugins anyway, the additional findPlugins for
the selected backend is changed to search the list of all plugin meta
data.
2015-10-02 09:31:47 +02:00
Martin Gräßlin abb9bf1355 [wayland] Create event dispatcher in QPA plugin
We no longer need to have the event dispatcher created before starting
the QApplication, thus we can leave it to the QPA plugin to creat it.

Also we don't need to implement our own dispatcher any more but can
use one from Qt5PlatformSupport as we link it anyways. The special
need for dispatching the WaylandServer is no longer needed as we can
explicitly dispatch it from the QPA plugin if needed.
2015-08-25 14:33:51 +02:00
Martin Gräßlin ef20f82b4d [wayland] Create waylandServer after creating QApplication
Our QPA plugin does not require a running Wayland server at startup,
so we can move the startup after creating the application.

Nice side effect: --help works now.
2015-08-25 14:33:51 +02:00
Martin Gräßlin f034537ad7 [wayland] Drop workaround on Qt window expose event
No longer needed with our own QPA plugin.
2015-08-25 14:33:51 +02:00
Martin Gräßlin 8add14fe89 [wayland] Drop hack for faking input for Qt popups
This reverts 29c2ae57.
2015-08-25 14:33:51 +02:00
Martin Gräßlin cd0e905248 [wayland] Drop QT_WAYLAND_DISABLE_WINDOWDECORATION env variable
No longer needed as we don't use the Wayland QPA.
2015-08-25 14:33:50 +02:00
Martin Gräßlin cc27042a7b [wayland] Drop threaded eglInitialize hack
The hack to perform the first eglInitialize in a thread is no longer
needed, as our internal QPA plugin is either able to share the
EGLDisplay or performs the potentially blocking eglInitialize in a
thread.
2015-08-25 14:33:50 +02:00
Martin Gräßlin e90fc1f8e1 [wayland] Drop QtWayland specific BypassWindowManagerHint workaround
No longer needed as our internal QPA is able to show windows with
BypassWindowManagerHint set.
2015-08-25 14:33:50 +02:00
Martin Gräßlin e0103b15b7 [wayland] Remove the specific socket pair for QtWayland
Our own QPA plugin shares the internal connection, so we don't need the
dedicated connection for the QPA any more.
2015-08-25 14:33:50 +02:00
Martin Gräßlin 4851470ff9 [wayland] Enforce our internal QPA plugin as QT_QPA_PLATFORM 2015-08-25 14:33:50 +02:00
Martin Gräßlin 8797f826f9 [wayland] Determine whether libinput is needed from plugin metadata
If the backend specifies
{
"input": false
}

in it's plugin metadata, it means that it does not handle input by
itself. In that case we can enforce libinput.

With this change one does no longer need to specify --libinput when
starting kwin_wayland on the drm or fbdev backend. So

kwin_wayland --xwayland

will bring up a fully functional kwin_wayland on drm platform.
2015-07-16 10:54:29 +02: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 3fe270b804 [wayland] Enforce basic render loop
Looks like Qt 5.5 changed the default back to threaded and that can
result in dead locks of the compositor. So better enforce to basic
for the time being.

Another reason to have an own QPA to get rid of these "regressions".
2015-07-10 08:57:56 +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 a4ca6f196e [wayland] kwin_wayland is no longer a kdeinit_executable
kdeinit_executable doesn't make sense in the case of kwin_wayland as
start_kdeinit_wrapper will be executed after kwin_wayland thus the
framework doesn't work.
2015-07-06 09:57:30 +02:00
Martin Gräßlin 94827c7405 [wayland] Introduce automatic backend selection
If none of the backend specific command line options are passed, we
try to autmatically determine the proper plugin.

1. if DISPLAY is set -> x11 backend
2. if WAYLAND_DISPLAY is set -> wayland backend
3. if compiled with libhybris and ANDROID_ROOT is set -> hwcomposer backend
4. if compiled with DRM -> drm backend
5. if nothing selected yet, fallback to fbdev
2015-06-29 11:59:27 +02:00
Martin Gräßlin fa7b2fd055 [wayland] Improve passing env variables to applications started by KWin
If an env variable is set outside of KWin (e.g. QT_QPA_PLATFORM) we
want KWin to pass the original env variable to the started process and
not pass none instead because it's one of KWin's special changed
variables.

Thus we take the environment before we adjust it and pass that to the
started processes with our own DISPLAY and WAYLAND_DISPLAY added.
2015-06-29 10:51:37 +02:00
Martin Gräßlin 6e58d50efa [wayland] Drop EGL_PLATFORM env variable from QProcessEnvironment passed to launched processes
Can result in interesting crashes of the launched processes, if KWin uses
e.g EGL_PLATFORM=hwcomposer.
2015-06-13 21:29:56 +02:00
Boudewijn Rempt d457a8d92b This line wasn't intended to go in. 2015-06-13 19:10:33 +02:00
Martin Gräßlin 859a3bb598 [wayland] Add support for PlasmaWindowManagement interface
So far this only allows to trigger show desktop functionality and exports
the state.

In future this should be restricted to just one dedicated desktop shell
process.
2015-06-13 18:23:54 +02:00
Boudewijn Rempt 98bcdbe70a [wayland] Add a command-line option to start an input method server
Input-method servers, like maliit, need to be known to KWin since KWin
needs to know about virtual keyboards. Virtual keyboards should be shown
as OSD layers, and they are one of the types of windows that actually
should be showable when the lock screen is active.

kwin_wayland --inputmethod /path/to/your/input-server

tries to start the input server. The input-server's window never gets
keyboard focus and is shown on top of all windows except for KWin's
internal clients.
2015-06-13 04:06:12 +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