Commit Graph

34 Commits (d3cca65d39ef1e01a7f6202837a8d032593fda05)

Author SHA1 Message Date
Vlad Zahorodnii d3cca65d39 Implement the layer-shell v1 protocol
The layer-shell protocol allows wayland clients to create surfaces that
can be used for building desktop environment components such as panels,
notifications, etc.

The support for the plasma-shell protocol will be dropped once plasma in
all its entirety is ported to the layer-shell protocol.
2020-09-03 18:11:44 +00:00
Marco Martin 97f4712f29 Fix size restore upon keyboard close in XdgSurfaceClient
in XdgSurfaceClient setFrameGeometry is async,
so we can't rely on it having the final value immediately.
make setVirtualKeyboardGeometry a virtual.
in the implementation on setVirtualKeyboardGeometry
use requestedFrameGeometry() instead of frameGeometry()
2020-09-01 08:58:46 +00:00
Vlad Zahorodnii 1c61de1990 autotests: Clean up the outputs list when client connection is closed
If the client connection has been closed, the Output::removed() signal
won't be emitted.
2020-08-20 11:56:42 +03:00
Vlad Zahorodnii 4ce853e8e4 Prettify license headers 2020-08-07 19:57:56 +00:00
Vlad Zahorodnii 1fb9f6f13a Switch to SPDX license markers
The main advantage of SPDX license identifiers over the traditional
license headers is that it's more difficult to overlook inappropriate
licenses for kwin, for example GPL 3. We also don't have to copy a
lot of boilerplate text.

In order to create this change, I ran licensedigger -r -c from the
toplevel source directory.
2020-08-07 19:57:56 +00:00
Vlad Zahorodnii a17a86999b Emit clientAdded for wayland clients
Emit the clientAdded() signal also for Wayland clients in order to unify
the API of the Workspace class for different client types.
2020-07-27 15:01:07 +00:00
Méven Car 61b55732ae Tests: Add outputmanagement to test helper 2020-06-24 11:17:42 +02:00
Aleix Pol 3a9d7a6e9d Port KWin to KWaylandServer
Summary: Away from KWayland::Server and KF5WaylandServer.

Test Plan: Builds, ran nested session

Reviewers: #kwin, #plasma, #frameworks, davidedmundson, zzag

Reviewed By: #kwin, #plasma, davidedmundson, zzag

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D29278
2020-04-30 12:56:08 +02:00
Vlad Zahorodnii 9cce7f8686 [wayland] Drop support for legacy xdg-shell-v6 protocol
Summary:
xdg-shell stable has been around for quite a while. A quick analysis
showed that many distros ship GTK and Qt that support both xdg-shell
v6 and stable. Therefore, we can drop support for legacy v6 protocol.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: apol, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D28118
2020-03-18 14:38:58 +02:00
Vlad Zahorodnii be759b7d33 Use AbstractClient instead of XdgShellClient wherever possible
Summary:
Currently, we have only one shell client type - XdgShellClient. We use
it when we are dealing with Wayland clients. But it isn't really a good
idea because we may need to support shell surfaces other than xdg-shell
ones, for example input panel surfaces.

In order to make kwin more extensible, this change replaces all usages
of the XdgShellClient class with the AbstractClient class.

Test Plan: Existing tests pass.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D27778
2020-03-04 09:57:13 +02: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 d92d6e77ae [autotests] Don't test wl-shell clients
Summary:
This change removes all traces of wl-shell in the test suite. That's a
prerequisite for dropping wl-shell support in KWin.

Given that wl-shell and xdg-shell are not interchangeable, some tests
were removed and initialization sequence in some tests was adjusted.

The most notable change is ensuring that each plasmashell window sets
its role and initial position before committing the surface. Setting
those properties before the first surface commit is important because
our window placement code needs to know window type in order to
avoid maximizing panels, popups, etc.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23561
2019-09-23 17:28:56 +03:00
David Edmundson 2bad2b48fe [wayland] Finish initialising ShellClient only when commited to the surface
Summary:
Everything on the wl_surface is double buffered.

When we create an XdgShell toplevel or popup we shouldn't treat it as
attached until it's committed to the surface.

A client should commit the surface after it's sent it's initial state of
the Xdg topLevel; minimumSize, title, app_id, etc.

By blocking sending configure events we will have flushed the correct
initial state before sending a single atomic correct event to the
client. It also adds a hook to re-evaluate rules now that all properties
are set.

Arguably this applies to WlShellSurface too, but I've left it unchanged
as it's deprecated and hard to verify real client behaviour.

Test Plan: Ran all unit tests

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D18583
2019-02-26 13:51:28 +00:00
Roman Gilg 06f64d5e56 [autotests] Sub-surface resize test
Summary:
Adds an autotest to show that KWin fails an assertion when a client tries to
resize a sub-surface.

Since it is the first autotest dealing with sub-surfaces explicitly additional
autotest helpers are introduced to allow that.

We also add a new signal in Compositor to spy on to know when the buffer swap
has been completed.

Test Plan:
Test fails as expected:
```
QFATAL : KWin::BufferSizeChangeTest::testShmBufferSizeChangeOnSubSurface() ASSERT: "image.size() == m_size" in file /home/roman/dev/kde/src/kde/workspace/kwin/platformsupport/scenes/opengl/abstract_egl_backend.cpp, line 394
FAIL!  : KWin::BufferSizeChangeTest::testShmBufferSizeChangeOnSubSurface() Received a fatal error.
   Loc: [Unknown file(0)]
Totals: 4 passed, 1 failed, 0 skipped, 0 blacklisted, 367ms
********* Finished testing of KWin::BufferSizeChangeTest *********
```

Reviewers: #kwin, zzag

Subscribers: zzag, graesslin, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D18452
2019-02-21 23:33:32 +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
David Edmundson 8ef363cc21 [wayland] XdgPopup Positioning
Summary:
Support XDGShell Positioning. This gives a client a lot more control
over where the popup will be placed as well as control over how to
handle constraints. i.e what to do if the popup doesn't fit.

trasientOffset was replaced with a method on the client as semantically
it's the role of the client to handle constraints.

Both slide and flip constraint adjustments are implemented. Resize
constraint adjustment will be handled in a future patch.

WlShell is handled by treating it as 1x1 sized anchor with slide
constraint adjustment.

Test Plan:
Manual test of a client implementing xdgpopup exists in kwayland
Extensive unit test here

Existing WlShell test passes (after D16314 which fixes the original)
XdgPopup has a new unit test suite against manually calculated values

Reviewers: #kwin, graesslin

Reviewed By: #kwin, graesslin

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16325
2018-10-20 17:17:59 +01:00
David Edmundson 9ca24efc07 [autotests] Hook up some missing tests for XDGShellStable
Summary: No kwin changes

Test Plan:
Compiles
More tests pass

Reviewers: #kwin, graesslin

Reviewed By: #kwin, graesslin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16148
2018-10-15 15:02:53 +01:00
Vlad Zagorodniy 2d01ba6450 [scenes/qpainter] Draw decoration shadows
Summary:
QPainter doesn't render decoration shadows. It renders only
shadows provided through ShadowInterface.

With this change, painting of shadows is done in similar way OpenGL backend is
currently doing.

Before

{F5734867, layout=center, size=full}

After

{F5734870, layout=center, size=full}

Depends on D10811 (dummy decoration with shadows in autotests)

Test Plan:
* start kwin with QPainter backend enabled:

```
KWIN_COMPOSE=Q kwin_wayland --xwayland --windowed
```

* open konsole and kate:

```
DISPLAY=:1 konsole
DISPLAY=:1 kate
```

Reviewers: #kwin, graesslin, davidedmundson

Reviewed By: davidedmundson

Subscribers: abetts, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D10943
2018-06-07 12:27:31 +03: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
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
David Edmundson 34de2c2b5c Track outputs in kwin integration tests
Summary:
Split from the last review, as in order to track output's removed (in
any way that's useful) the registry needs to be on the heap and the change grew.

Test Plan:
Every test that previously passed on my system still does
Though currently that's not every test (for some reason) which was
my main motivation for splitting.

Reviewers: #plasma, graesslin

Reviewed By: #plasma, graesslin

Subscribers: plasma-devel, kwin, #kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D7377
2017-08-18 15:15:19 +01:00
David Edmundson 0809a357c1 Improve testWindowScaled test
Summary:
Comparing a pure blue square isn't a very effective test as someone
cropping the image will still pass.

Reviewers: #plasma, graesslin

Reviewed By: #plasma, graesslin

Subscribers: plasma-devel, kwin, #kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D6982
2017-07-31 15:12:37 +01:00
Martin Gräßlin eae9bdd50a [autotests/integration] Use socketpair for Wayland connection
Summary:
This is a preparation step for no longer creating a socket in the tests
and slightly simplifies the init test code.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D3575
2016-12-15 21:31:27 +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 ca50a24728 [autotests/integration] Add ScreenLockerWatcher to the Test::lockScreen and ::unlockScreen
This extends the test helper for locking the screen and unlocking the
screen to also wait for the ScreenLockerWatcher to have that state.

This is going to fail on build.kde.org as we don't have EGL there and
the greeter crashes. This needs an extension to fake that we have a
screen lock window.
2016-08-16 10:23:37 +02:00
Martin Gräßlin 440d49da00 [autotests/integration] Test case for screen locked with mod-only-shortcuts
Currently expected failures as modifier only shortcuts don't check
for locked screen yet.
2016-08-16 08:19:45 +02:00
Martin Gräßlin 4651aa1d79 [wayland] Unset focused keyboard surface when handling key event internally
Summary:
So far when KWin intercepted a key event a leave was not sent to the
Wayland surface currently having keyboard focus. This could result in
the Wayland application to start repeating keys. E.g.

1. application gets key press event
2. This triggers an internal window to show
3. key release goes to KWin internal window
4. application starts to repeat key as there is no release

With this change whenever KWin intercepts the key event e.g. due to
 * internal window
 * Effects grabbing key event
 * Tabbox

the focused keyboard surface is set to null, thus triggering a leave
event and the client not starting to repeat the event.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2402
2016-08-16 07:40:59 +02:00
Martin Gräßlin 23bfa05f46 [autotests/integration] Try hardening destroyWaylandConnection
Destroying the connection is threaded. Only wait if the signal was
not already caught.
2016-08-08 10:11:31 +02:00
Martin Gräßlin c3af4c3f9c Add support for xdg-shell version 5 interface
Summary:
The WaylandServer creates the XdgShellV5 interface and hooks it up
to create a ShellSurface whenever an xdg surface or xdg popup is created.

ShellClient gains some new ctors for the different variants and is
adjusted to delegate to xdg surface respectively.

With this change KWin mostly supports xdg-shell protocol. Still missing
is support for the "geometry" request which is rather difficult to
implement in KWin.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2108
2016-07-13 13:20:00 +02:00
Martin Gräßlin ce74d8a5e5 [autotests] Try to make the move_resize_window_test more robust
On build.kde.org it's failing due to Windows being still present in
the next test method. This change tries to destroy them in the test
methods.
2016-07-01 12:37:09 +02:00
Martin Gräßlin cf3a1d295c [autotest/integration] Add helper for waiting for a shown ShellClient
Summary:
Many tests create a Wayland window, render it and then wait till it's
created in KWin as a ShellClient. To reduce code duplication the test
helper provides helper methods to wait for the next ShellClient to be
shown and to directly render and wait for the window for that to be
shown.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2057
2016-07-01 09:56:31 +02:00
Martin Gräßlin 513878e20d [autotest/integration] Introduce a Test helper library to have less code duplication
Summary:
A new namespace KWin::Test is added which provides a few helper
functions. It makes it easy to setup a KWayland client connection with
the base set to be able to create a Surface and flags to create
additional interfaces. This replaces the KWayland connection dance in
init() methods. For cleanup() there is also a dedicated helper function.

In addition there are helper functions to:
* render a surface
* create a surface
* create a shell surface
* flush the wayland client connection
* access to the created interfaces - for compatibility with existing code

The idea is to extend this Test library also for other common use cases
like creating an X11 connection and X11 windows, etc.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2053
2016-07-01 09:01:17 +02:00