Commit graph

135 commits

Author SHA1 Message Date
Vlad Zahorodnii
639441f10b Merge branch 'Plasma/5.17' 2019-11-18 12:27:17 +02:00
David Edmundson
18a4ded307 [wayland] Fix sha check of filtered applications
Summary:
We have a sha check rather than just readlink as an app in a mount
namespace could have an executable with the same path as an exectuable
on the host system that we trust.

This became overly complicated to solve an issue that didn't exist.
sha(/proc/PID/exe) does resolve to what is currently running even if
sha(readlink(/proc/PID/exe) does not as /proc is magic.

This patch compares the root file system as kwin sees it to the running
exe.

See later comments on D22571

Reviewers: fvogt

Reviewed By: fvogt

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D25169
2019-11-06 13:39:59 +00:00
Roman Gilg
affd444507 Merge branch 'Plasma/5.17' 2019-10-29 12:12:02 +01:00
Roman Gilg
7459aabcac Dmabuf recovery on EGL reset
Summary:
The EGL platform might go away at any time through reconfiguration or because
of a graphic error. KWin then resets the graphics. The dmabuf implementation
must respect that and recover from a graphics reset by recreating all EGL
images for existing buffer.

This assumes that we won't change our graphics API mid-session and that
supported plane and modifier configuration stays constant.

In practise we remember all current dmabufs in a single map and only remove
them if the client did destroy the resource.

BUG: 411980
CCBUG: 413403
FIXED-IN: 5.17.2

Test Plan: Applied screenedge configuration without crash.

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: fvogt, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D24954
2019-10-29 12:10:15 +01:00
Aleix Pol
08d0c6a3bc Reduce interfaces verbosity
Summary: Only report about them when they're requested for the first time.

Test Plan: Been using it for a few days

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D24535
2019-10-10 17:31:03 +02:00
Vlad Zahorodnii
ffcbe24e2b Rename Client to X11Client
Summary:
Currently each managed X11 client is represented with an instance of
Client class, however the name of that class is very generic and the
only reason why it's called that way is because historically kwin
was created as an x11 window manager, so "Client" was a sensible choice.

With introduction of wayland support, things had changed and therefore
Client needs to be renamed to X11Client in order to better reflect what
that class stands for.

Renaming of Client to X11Client was agreed upon during the last KWin
sprint.

Test Plan: Compiles, the test suite is still green.

Reviewers: #kwin, romangg

Reviewed By: #kwin, romangg

Subscribers: romangg, davidedmundson, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D24184
2019-09-25 21:11:37 +03:00
Vlad Zagorodniy
168ea98845 Rename ShellClient to XdgShellClient
Summary:
Rename ShellClient to XdgShellClient in order to reflect that it
represents only xdg-shell clients.

Test Plan: Compiles, tests still pass.

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23589
2019-09-23 17:28:56 +03:00
Vlad Zagorodniy
665ec0a5de [wayland] Drop xdg-shell v5 support
Summary:
Drop xdg-shell v5 support since this protocol is obsolete and all popular
wayland compositors already did that.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23573
2019-09-23 17:28:56 +03:00
Vlad Zagorodniy
7a5447bd17 [wayland] Drop wl-shell support
Summary: wl-shell is deprecated, and pretty much no one uses it.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23562
2019-09-23 17:28:56 +03:00
Vlad Zagorodniy
bebe81209c Port QPA away from Wayland
Summary:
So far wayland was used by internal clients to submit raster buffers
and position themselves on the screen. While we didn't have issues with
submitting raster buffers, there were some problems with positioning
task switchers. Mostly, because we had effectively two paths that may
alter geometry.

A better approach to deal with internal clients is to let our QPA use
kwin core api directly. This way we can eliminate unnecessary roundtrips
as well make geometry handling much easier and comprehensible.

The last missing piece is shadows. Both Plasma::Dialog and Breeze widget
style use platform-specific APIs to set and unset shadows. We need to
add shadows API to KWindowSystem. Even though some internal clients lack
drop-shadows at the moment, I don't consider it to be a blocker. We can
add shadows back later on.

CCBUG: 386304

Reviewers: #kwin, davidedmundson, romangg

Reviewed By: #kwin, romangg

Subscribers: romangg, kwin

Tags: #kwin

Maniphest Tasks: T9600

Differential Revision: https://phabricator.kde.org/D22810
2019-09-23 17:28:56 +03:00
Roman Gilg
f7ff62e2e2 Lift output enablement into Platform
Summary:
This lifts the enablement code for outputs from the DRM backend to Platform
allowing other Wayland backends in the future to use this interface as well.

To do that we also create some helper functions on Platform level and have to
spill some KWayland classes into AbstractOutput what motivates a further split
of Platform into a Wayland child class like for AbstractOutput.

Test Plan: Disabled and enabled an output in DRM session.

Reviewers: #kwin

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23545
2019-09-05 17:22:44 +02:00
Aleix Pol
5ed98f79e8 Fix warning text message 2019-09-05 16:47:13 +02:00
Roman Gilg
5cc626c102 Remove outputs handling alternative
Summary:
With f013a4369c, cd6b69a4d2, d960be4b3f and edb200f6bc all possible
backends of a Wayland session have been ported to using the internal functions
of AbstractWaylandOutput's for managing outputs.

This removes the alternative code path used before in these backends, what
simplifies the code and is also a prerequisite to removing the Screens global
in the future.

Reviewers: #kwin, apol, zzag

Reviewed By: #kwin, apol, zzag

Subscribers: apol, kwin

Tags: #kwin

Maniphest Tasks: T11459, T11098

Differential Revision: https://phabricator.kde.org/D23485
2019-08-28 15:00:39 +02:00
Aleix Pol
f324776137 Allow blacklisting some wayland interfaces
Summary:
For some interfaces, we'll look at the X-KDE-Wayland-Interfaces property in the desktop file to see which interfaces are requested.
Requires D22570.

Reviewers: #plasma, #kwin, davidedmundson

Reviewed By: #plasma, #kwin, davidedmundson

Subscribers: fvogt, zzag, broulik, graesslin, davidedmundson, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D22571
2019-07-31 16:09:01 +02:00
Aleix Pol
bb9a5e57a1 Implement the keystate protocol
Summary: Depends on D20191

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, graesslin, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D20192
2019-06-22 12:34:06 +02:00
Vlad Zagorodniy
e96da56f8c Fix tests
`client = new ShellClient(surface)` is most likely a leftover after a
merge conflict.
2019-02-22 03:00:44 +02:00
Martin Flöser
9b922f8833 Split out a dedicated InternalClient class
Summary:
Most of the functionality which is special to internal clients is moved
from ShellClient to InternalClient. As KWin's qpa is still bound to the
Wayland protocol InternalClient inherits from ShellClient. Due to that
some aspects in ShellClient are "weird". ShellClient still detects
whether it's an internal client and uses the variable m_internal to
capture the state. This is required as we cannot use the isInternal
method. Most of m_internal usage is in init which is called from
constructor of ShellClient. Thus it's not possible to call into virtual
methods of InternalClient.

Also some of the code is duplicated and some methods are temporarily
marked as virtual.

The next step will be to remove ShmBuffer for internal windows which
should decouple the two implementations further with the long term goal
of having InternalClient inherit AbstractClient directly.

Test Plan:
Run nested KWin, triggered outline (OpenGL case) and debug console (shm case).
InternalWindow unit test still passes.

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D18569
2019-02-21 18:51:25 +01:00
Roman Gilg
548978bfe1 [xwl] Drag and drop between Xwayland and Wayland native clients
Summary:
Building upon the generic X Selection support this patch establishes another
selection class representing the XDND selection and provides interfaces
to communicate drags originating from Xwayland windows to the Wayland
server KWin and drags originating from Wayland native drags to Xwayland.

For Wayland native drags KWin will claim the XDND selection as owner and
will simply translate all relevant events to the XDND protocol and receive
alike messages by X clients.

When an X client claims the XDND selection KWin is notified via the X protocol
and it decides if it allows the X drag to transcend into the Wayland protocol.
If this is the case the mouse position is tracked and on entering a Wayland
native window a proxy X Window is mapped to the top of the window stack. This
proxy window acts as a drag destination for the drag origin window and again
X messages will be translated into respective Wayland protocol calls. If the
cursor leaves the Wayland window geometry before a drop is registered, the
proxy window is unmapped, what triggers a subsequent drag leave event.

In both directions the necessary core integration is minimal. There is a single
call to be done in the drag and drop event filter through the Xwayland
interface class.

From my tests this patch facilitates drags between any Qt/KDE apps. What needs
extra care are the browsers, which use target formats, that are not directly
compatible with the Wayland protocol's MIME representation. For Chromium an
additional integration step must be done in order to provide it with a net
window stack containing the proxy window.

Test Plan: Manually. Auto tests planned.

Reviewers: #kwin

Subscribers: zzag, kwin, alexde

Tags: #kwin

Maniphest Tasks: T4611

Differential Revision: https://phabricator.kde.org/D15627
2019-02-19 13:09:18 +01:00
Roman Gilg
2776f829ef Remove X clipboard sync helper and rename its autotest
Summary:
With the gneric X selections infrastructure and clipboard support the X
clipboard sync helper utility can be removed. Also rename its autotest as it
tests the inner workings of the new mechanism since this mechanism was
introduced.

Test Plan: Autotest still passes under new name.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: graesslin, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D15063
2019-02-19 12:30:43 +01:00
Roman Gilg
6e08fb2fa5 [xwl] Generic X selections translation mechanism with Clipboard support
Summary:
In this patch an infrastructure is created to represent generic X selections
in a Wayland session and use them for data transfers between Xwayland windows
and Wayland native clients.

The central manager is the DataBridge class, in which Selection objects can be
created. This is hard-coded and such a Selection object persists until the end
of the session, so no arbitrary selections can be created on the fly. For now
the X Clipboard selection is supported, whose corresponding mechanism in the
Wayland protocol is just called Selection.

A Selection object listens for selection owner changes on the X side and for
similar events into the Wayland server interfaces. If a data provider is
available a selection source object is created by the Selection object. In case
data is requested on the other side, a data transfer is initialized by creating
a Transfer object. A Selection keeps track of all transfers and makes sure that
they are destroyed when they are finished or in case they idle because of
misbehaving clients.

The Clipboard class translates the X Clipboard via a proxy window. Selection
changes on the Wayland side are listened to through a new signal on the active
KWayland seat interface.

The previously used X clipboard syncer helper is disabled. The clipboard sync
autotest is changed to the new mechanism.

BUG: 394765
BUG: 395313

Test Plan: Manually and clipboard sync autotest.

Reviewers: #kwin

Subscribers: zzag, graesslin, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D15061
2019-02-19 12:24:27 +01:00
David Edmundson
7d10ab0fe7 [wayland] Drop Qt extended surface
Summary:
This is only relevant on Qt and when WlShell is used.
This was only the case before Qt5.10.

We will depend on Qt5.12 next release.
Static Qt builds which are that old typically wouldn't contain QtWayland

Test Plan: Compiles. Not used in tests

Reviewers: #kwin, graesslin

Reviewed By: #kwin, graesslin

Subscribers: graesslin, zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D18594
2019-01-30 01:00:41 +00:00
David Edmundson
4240c4af05 [wayland] Call ShellClient install interface methods consistently
Summary:
When we create a new Shellclient there may be a pending relevant
interface.

For every other case this is handled in WaylandServer, the class
responsible for attaching new interfaces at runtime.
The only exception is ServerSideDecorationInterface which is handled in
the ShellClient constructor.

This makes everything consistent.

No behavioural changes.

Test Plan: Ran unit tests

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D18592
2019-01-30 01:00:41 +00:00
Roman Gilg
4729a42c34 Name Wayland socket automatically when no socket name was specified
Summary:
Wayland provides functionality for servers to acquire an unused socket name
automatically. Do this through the recently added functionality in KWayland
in case no socket name was specified as an argument to KWin.

Test Plan: Manually, autotests pass.

Reviewers: #kwin, fvogt

Reviewed By: fvogt

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D18522
2019-01-25 13:38:54 +01:00
David Edmundson
ac45977e9e [wayland] XdgDecoration Support
Summary:
Does something similar to our existing ServerDecoration, but based
around XDG Shell patterns and with a few subtle differneces.

We'll probably still need both in kwin for the forseeable future as GTK3
won't ever change from using the KDE Server Decoration.

Test Plan:
Relevant unit test. It's a bit simpler as spec states
toolkits must follow what the compositor configures if they
bind the interface.

Modified plasma-integration to remove ServerIntegration
(as Qt5.12 has native support) all my windows look and act the same.

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D17756
2019-01-01 17:53:48 +00:00
Martin Flöser
a0b482cbab Introduce a command line option to disable any kind of global shortcuts
Summary:
This command line option is useful for KWin in embedded use case. That
is when KWin is just used as a compositor for one application instead of
a complete desktop environment. In such a setup global shortcuts are not
wanted and interfere with the application. E.g. one does not want Alt+F4
to close the window, that would render the system unusable.

This change introduces a command line option and disables the following
event filters and spies:
 * global shortcuts
 * modifier only shortcuts
 * terminate session
 * virtual terminal switching
 * screen edges

KGlobalAccel still gets inited, otherwise the (non-functional) binary
would be launched when KWin registers it's global shortcuts.

Test Plan:
New test added based on existing tests for the global
shortcuts, ctest passes

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D17304
2018-12-13 19:36:28 +01:00
Martin Flöser
543b6955d4 Add more debug output around starting the x clipboard syncer process
Summary:
Trying to get some more information on why the related test fails on
build.kde.org.

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16748
2018-11-08 08:44:43 +01:00
Martin Flöser
e637d43211 Remove potential endless loop from XClipboardSyncTest
Summary:
We need to wait till the helper process created the datadevice. For this
we used a while loop. On build.kde.org the test gets stuck in this loop
and times out after 10 minutes.

This change introduces a dedicated signal and we just wait for it. So if
something fails we wait only 5 sec instead of endless. This should help
investigate why the test doesn't work on build.kde.org.

Test Plan: Test works locally

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16741
2018-11-07 20:10:32 +01:00
Martin Flöser
7221864cd2 Start xclipboard sync process from build dir if available
Summary:
The xclipboard sync test times out on build.kde.org as KWin is not
installed prior to running the tests. This is due to KWin not finding
the executable for the clipboard sync helper.

This change looks whether the binary exists in the same directory as
KWin's executable. If it exists it is started instead of the hardcoded
path in libexec.

Test Plan: Run the test and verified the correct binary is loaded

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16732
2018-11-07 15:19:25 +01:00
David Edmundson
7e8facc3fd [wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)

Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)

Test Plan: used a bit a plasma session together with D12820, D13748 and D13746

Reviewers: #plasma, #kwin, graesslin, davidedmundson

Reviewed By: #plasma, #kwin, davidedmundson

Subscribers: hein, zzag, davidedmundson, kwin

Tags: #kwin

Maniphest Tasks: T4457

Differential Revision: https://phabricator.kde.org/D13887
2018-11-01 16:35:29 +01:00
David Edmundson
fcf9acfec5 Add XDG WmBase support
Test Plan:
Compiled latest GTK
Ran gtk4-demo and used WAYLAND_DEBUG to confirm it used the correct
shell
tested a top level and a popup

Reviewers: #plasma, romangg

Reviewed By: #plasma, romangg

Subscribers: romangg, mart, graesslin, zzag, kwin

Tags: #kwin
BUG: 398614
FIXED-IN: 5.15.0

Differential Revision: https://phabricator.kde.org/D13530
2018-09-14 12:18:47 +01:00
David Edmundson
1403fcf316 Add XDG Output support
Test Plan:
Very minimal expansion of unit tests which uses WaylandScreens
Wrote mini app to debug actual output of xdg-output for testing the DRM code

Main relevant user of this is xwayland > 1.20 which I don't have, so that
part remains untested

Reviewers: #plasma, graesslin

Reviewed By: #plasma, graesslin

Subscribers: romangg, graesslin, bshah, kwin

Tags: #kwin

Maniphest Tasks: T8501

Differential Revision: https://phabricator.kde.org/D12243
2018-05-18 14:16:13 +01:00
Martin Flöser
339a08de38 Acknowledge the server side deco mode in WaylandServer not ShellClient
Summary:
With GTK applications our code showed issues. With GTK the sequence for
a menu or dialog window is:
 1. create surface
 2. create server side decoration
 3. request csd
 4. create xdg_shell_surface

Which result in KWin to have the ServerSideDecoration object being
created before the ShellClient is created. The connect for mode changed
happens in ShellClient, which is too late to catch that the window
requested client side decoration. Thus KWin created a decoration about
things such as a menu.

This change moves the acknowledge of the mode to WaylandServer. As we
anyway always acknowledge the requested mode we can also do it there and
don't require ShellClient to be present. Thus when the ShellClient is
created the mode is properly reflected and no decoration is created.

BUG: 389117
FIXED-IN: 5.12.0

Test Plan: Played a lot with evince

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D9967
2018-01-23 16:58:33 +01:00
Martin Flöser
b002b27903 Simulate user activity on fake input events
Summary:
This ensures that using KDE Connect to control input properly inhibits
idle timeouts.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D9555
2018-01-10 17:43:42 +01:00
David Edmundson
01d6878dc2 Add explicit protocol for colour scheme management
Summary:
To replace the deprecated/broken qt extended surface

BUG: 385214

Test Plan: Ran test in plasma-integration

Reviewers: #plasma, graesslin

Reviewed By: #plasma, graesslin

Subscribers: plasma-devel, kwin, #kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D9660
2018-01-04 18:32:18 +00:00
Martin Flöser
a561f91d29 Add missing include
Fix build.
2017-12-27 09:50:39 +01:00
David Edmundson
ee28104c7a Port to new AppMenu iface
Plus test

Test Plan:
Ran kwin with menus and patched QPT
Ran test

Reviewers: graesslin

Reviewed By: graesslin

Subscribers: graesslin, kwin, #kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D9262
2017-12-22 14:38:31 +00:00
Martin Flöser
ff2e883469 Add support for new IdleInhibition protocol
Summary:
A small helper class is added which manages inhibiting idle for the
ShellClients. So far only very basic functionality is added. That is
only the inhibition on the Surface is followed. It is not yet checked
whether the ShellClient is visible at all. That needs some changes in
ShellClient.

BUG: 385956
FIXED-IN: 5.12

Test Plan: New test case passes

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D8856
2017-11-30 21:51:36 +01:00
Martin Flöser
02d3daf28a Add physicalSize to the Screens API
Summary:
Allows to share the implementation in a better way and is a requirement
to get the Screen implementation in the QPA plugin to be based on
KWin::Screens instead of KWayland::Output.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D8344
2017-10-19 18:02:32 +02:00
Martin Flöser
6b8943bddd Fix new unused variable warning 2017-10-16 17:17:15 +02:00
Marco Martin
735fcc6e95 Make use of foreign protocol
Summary:
not sure if that is the right "parent" that has
to be set, set the transient for surfaces that
have setParentOf of an imported set

Test Plan:
m_XdgForeign->transientFor(surface()) finds the surface is expected,
not sure how to test it further

Reviewers: #plasma, graesslin

Reviewed By: #plasma, graesslin

Subscribers: luebking, graesslin, davidedmundson, plasma-devel, kwin, #kwin

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D7521
2017-10-13 11:32:22 +02:00
Martin Flöser
4c334098f3 Ensure internal Wayland connection is properly setup before creating LockScreen integration
With the new Wayland only mode we start too fast and it can happen that
the initWithWorkspace is called before the client connection is fully
setup. This would result in a crash in the idletime plugin once it tries
to create a seat.

To prevent this problem the code is split out into a dedicated method
and only invoked if all interfaces have been announced on the internal
connection.
2017-09-30 16:33:45 +02:00
David Edmundson
e492f9e298 XdgV6 - Kwin side
Summary:
Adds XDGV6 support for the kwin side.

Popup placement support is limited to the stuff v5 had,
a simple offset, rather than the awesome new positioner.

But Qt doesn't make use of it yet either.
Also ideally we should do all the positioning before sending the first
configure, but again Qt doesn't actually do anything with that anyway.

Also integrate pinging clients

Test Plan: gtk3-demo  works nicely.

Reviewers: #plasma, graesslin, mart

Reviewed By: #plasma, graesslin

Subscribers: mart, graesslin, kwin, plasma-devel, #kwin

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D6591
2017-09-25 16:47:30 +01:00
Martin Flöser
06433997e8 Emit connectionDied on all Wayland connections of plugins on teardown
Summary:
Some libraries loaded into KWin (e.g. breeze) also have a Wayland
connection. If KWin destroyes it's own Wayland connection before the
libraries destroy theirs, KWin might crash on tear down when the
libraries call into libwayland with an invalid connection.

This change requires D6569 in KWayland.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D6571
2017-07-28 20:30:54 +02:00
David Edmundson
fd58c68ba5 Set wayland output scale
Summary:
Provides a virtual method in Screens where backends can supply the scale
of each screen, this is then set on each output.

For the X windowed backend this value is taken from a command line
parameter.

Test Plan:
Ran windowed mode with --scale 1 and 2
then kate --platform=wayland from another screen.
On the latter case UI elements were scaled up correctly

Reviewers: #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D3159
2017-03-29 20:53:22 +01:00
Martin Gräßlin
8edd0336e6 Support creation of PlasmaShellSurface prior to ShellSurface
Summary:
So far KWin did not support the sequence:
1. Create wl_shell
2. Create PlasmaShellSurface
3. Create wl_shell_surface

KWin only supported the case that the PlasmaShellSurface is the last
thing to get created. This is rather limiting and can be considered a
bug. At least we had a QEXPECT_FAIL auto test for this situation. So
it was a known issue.

This change should make it easier to support the QtWayland changes in
Qt 5.8.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D4482
2017-02-07 19:26:36 +01:00
Martin Gräßlin
a7f5c16754 Reduce code-duplication of socketpair in WaylandServer
Summary:
WaylandServer creates a socketpair for several Wayland connections. So
far this duplicated code quite a bit.

This change introduces one method to perform the socketpair and the
error checking plus creating the server side ClientConnection from the
pair.

Test Plan: Tests still pass

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D3576
2016-12-17 09:47:55 +01:00
Martin Gräßlin
0c5ca405cc Implement support for pointer constraints
Summary:
There are two types of constraints supported:
1. Pointer confinement
2. Pointer locking

In the case of confinement the pointer is confined to a given region of
the surface. This is comparable to general operation where the pointer
is confined to the screen region.

In the second case the pointer gets locked. That means it cannot move at
all. No further position updates are provided, only relative motion
events can go to the application. There is a hint about cursor position
update on unlock which is not yet implemented in KWayland::Server, thus
also not in this change.

The implementation in KWin grants the requests for pointer constraints
when the pointer enters the constrained region, either by pointer
movement or by e.g. stacking order changes. There is no confirmation
from user required to enter that mode. But we want to show an OSD when
the pointer gets constrained, this is not yet implemented, though.

Breaking an active constraint is relatively easy. E.g. changing the
stacking order will break the constraint if another surface is under the
cursor. Also (in case of confinement) moving the pointer to an
overlapping window breaks the confinement. But as soon as one moves the
pointer back to the window a constraint might get honoured again.

To properly break there is a dedicated event filter. It listens for a
long press of the Escape key. If hold for 3sec the pointer constraint is
broken and not activated again till the pointer got moved out of the
window. Afterward when moving in the pointer might activate again.

The escape filter ensures that the key press is forwarded to the
application if it's a short press or if another key gets pressed during
the three seconds. If the three seconds way fires, the later escape
release is not sent to the application.

This basic interaction is also ensured through an added auto test.

This change implements T4605.

Test Plan: Added auto test and nested KWin Wayland with D3488

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D3506
2016-12-08 19:50:24 +01:00
Martin Gräßlin
b6af777230 Forward pointer gestures to Wayland server
Summary:
This change implements forwarding the pointer gestures to the new API in
SeatInterface.

While screen is locked no gestures are forwarded to the server. Also
locking the screen cancels any active gesture. Similar if areas inside
KWin would start to intercept the gestures, they need to be cancelled on
the Wayland SeatInterface.

Test Plan: Not yet

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D3174
2016-11-07 13:45:08 +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
455c5c07a0 Move implementation of iconGeometry from ShellClient to AbstractClient
Summary:
This allows Client to use the Wayland-specific implementation if there
is no icon geometry set through the X11 way. That way Xwayland windows
have an icon geometry even if Plasma is using Wayland and setting the
icon geometry in the Wayland way. Which is expected as Plasma is
ignorant about the windowing system a PlasmaWindow uses.

In order to move the code from ShellClient to AbstractClient
WaylandServer gained a new findAbstractClient(Surface*) method which
is just like findClient(Surface*) with the difference that it returns
an AbstractClient instead of a ShellClient*.

Test Plan:
minimized/unminimized an X client on Wayland, verified
animation is correct (though broken in general for minimize)

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2530
2016-08-24 13:11:32 +02:00