Commit graph

10 commits

Author SHA1 Message Date
Laurent Montel
cc280a4dd7 Use qEnvironmentVariableIntValue 2018-10-10 21:47:36 +02:00
David Edmundson
bd5ef55318 Link clipboard sync helper to kcrash
Summary: Mine randomly disappears sometimes, may as well get whatever backtraces we can

Test Plan: None

Reviewers: #kwin, mart

Reviewed By: #kwin, mart

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D13753
2018-06-29 13:33:11 +01:00
Martin Gräßlin
572f730e8e [helper] Terminate xclipboardsyncer if kwin_wayland goes down
Summary:
Normally the xclipboardsyncer should terminate because the socket
becomes unusable. But we have reports of it not really going down and
running amok.

In order to prevent such situations this change registers SIGTERM to be
sent to xclipboardsyncer when the parent process (that is kwin_wayland)
dies in whatever way. This ensures that xclipboardsyncer cannot become
an orphan.

BUG: 371862

Test Plan: Only compile tested, no way to get into the problematic situation

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D5589
2017-05-05 19:17:11 +02:00
Martin Gräßlin
d9612b327c Merge branch 'Plasma/5.8' 2016-11-07 11:41:30 +01:00
Martin Gräßlin
f3325a1cb8 [helpers/killer] Force to platform XCB
Summary:
The killer can only kill X11 windows. It is also only invoked for Client
and not for ShellClient. The tool interacts with QX11Info which means it
would crash if tried to use on Wayland.

Thus force platform xcb on the tool.

Test Plan: Killer shows for Xwayland windows.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D3228
2016-11-07 11:27:32 +01:00
Martin Gräßlin
7681e312c5 [helpers/killer] Use <p> instead of <para>
Summary:
para works fine for English, but seems to break in translations.

BUG: 363750
FIXED-IN: 5.9

Test Plan: Renders correctly in English. Translations not tested.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D3227
2016-11-03 08:58:01 +01:00
Tobias C. Berner
7b0676ebaf Include <errno.h> in waylandclipboard.cpp
Summary:
`errno.h` needs to be includes, as `errno`, `EAGAIN` and `EWOULDBLOCK` are used.

Without:
> --- helpers/xclipboardsync/CMakeFiles/org_kde_kwin_xclipboard_syncer.dir/all ---
> /wrkdirs/usr/ports/x11-wm/plasma5-kwin/work/kwin-5.7.95/helpers/xclipboardsync/waylandclipboard.cpp:110:25: error: use of undeclared identifier 'errno'
>         if (n == -1 && (errno == EAGAIN || errno == EWOULDBLOCK) && ++retryCount < 1000) {
>                         ^
> /wrkdirs/usr/ports/x11-wm/plasma5-kwin/work/kwin-5.7.95/helpers/xclipboardsync/waylandclipboard.cpp:110:34: error: use of undeclared identifier 'EAGAIN'
>         if (n == -1 && (errno == EAGAIN || errno == EWOULDBLOCK) && ++retryCount < 1000) {
>                                  ^
> /wrkdirs/usr/ports/x11-wm/plasma5-kwin/work/kwin-5.7.95/helpers/xclipboardsync/waylandclipboard.cpp:110:44: error: use of undeclared identifier 'errno'
>        if (n == -1 && (errno == EAGAIN || errno == EWOULDBLOCK) && ++retryCount < 1000) {
>                                           ^
> /wrkdirs/usr/ports/x11-wm/plasma5-kwin/work/kwin-5.7.95/helpers/xclipboardsync/waylandclipboard.cpp:110:53: error: use of undeclared identifier 'EWOULDBLOCK'
>        if (n == -1 && (errno == EAGAIN || errno == EWOULDBLOCK) && ++retryCount < 1000) {
>                                                    ^
> 4 errors generated.
> *** [helpers/xclipboardsync/CMakeFiles/org_kde_kwin_xclipboard_syncer.dir/waylandclipboard.cpp.o] Error code 1

Reviewers: graesslin

Reviewed By: graesslin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D2794
2016-09-16 10:05:01 +02:00
Martin Gräßlin
1d24264e45 [helpers/xclipboradsync] Ensure that KWayland::Client connects through the passed fd
One needs to call ConnectionThread::setSocketFd in order to not have it
connect through the normal socket.

As WAYLAND_SOCKET is set the implementation would call the correct
functionality anyway. This change only ensures that no wrong debug
message gets logged.
2016-06-29 19:13:00 +02:00
Martin Gräßlin
133a2f0c29 Move killer/ to helpers/killer
All helper binaries invoked from KWin go to helpers subdirectory.
2016-06-29 10:42:31 +02:00
Martin Gräßlin
3493e97655 Support for syncing the clipboard from X11 to Wayland and vice versa
Summary:
The clipboard sync is done by a dedicated helper binary launched by
KWin. This helper binary is forced to xcb platform to piggy-back on
Qt's implementation of the X11 clipboard. In addition it implements
the Wayland clipboard - which is much simpler. Reading the Wayland
clipboard is based on the implementation in QtWayland.

KWin internally knows the DataDeviceInterface belonging to the helper
application. Whenever an xwayland client is focussed, this DataDevice
is allowed to set the selection and KWin manually updates the current
selection in the SeatInterface. By that the sync from X11 to Wayland
is implemented. When afterwards a Wayland client is selected, it's sent
the current selection which references the X clipboard and a data
transfer can be initiated in the normal Wayland way.

For the other direction KWin sends the current selection to the helper's
DataDevice whenever an xwayland window is focused. The helper application
reads the Wayland clipboard and sets it on the X11 clipboard. Thus the
Wayland clipboard is synced to X11.

The approach used here will also be useful for implementing a clipboard
manager (aka klipper).

Currently the implementation is not yet fully completed. We need to
make sure that the helper application gets restarted in case of a crash.

Test Plan: See added test case

Reviewers: #plasma_on_wayland, #kwin

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D1973
2016-06-29 09:03:40 +02:00