Commit graph

33 commits

Author SHA1 Message Date
Vlad Zahorodnii
7e99ab9438 Build wayland tests with same build options as other tests 2023-10-06 11:21:00 +00:00
Vlad Zahorodnii
7d56aa3687 Merge wayland tests with other tests
This makes wayland tests organization consistent with other kwin tests.
2023-10-06 11:21:00 +00:00
Martin Gräßlin
d6dd4af8cf Rename autotests/wayland to autotests/integration
It's not about Wayland, but more about Integration. It can test both
Wayland and X11 windows.

Reviewed-By: Bhushan Shah
2016-06-29 10:29:45 +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
Martin Gräßlin
02ba1e7c0a Don't crash if a decoration doesn't get created
Summary:
With the NoBorder option set the DecorationBridge won't create
decorations. Thus we get a nullptr and obviously should not call
into it. There was already a check for whether decoration is null,
so that is a rather embarrassing bug.

Test Plan: Test case added which exposes the crash

Reviewers: #plasma_on_wayland, #kwin

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D1980
2016-06-23 11:28:08 +02:00
Martin Gräßlin
c7828eab8f Ensure that WaylandServer::shellClientAdded only gets emitted once
Summary:
When a shell client got mapped, unmapped and mapped again we emitted
the shellClientAdded signal in WaylandServer again. This resulted in
e.g. Workspace, EffectsHandler, etc. to start managing the window again.
This can be a reason for problems we see with such windows like the
Plasma panel dialog when opened the second time.

Test Plan:
Needs extensive testing on real world system as that changes
behavior now.

Reviewers: #kwin, #plasma_on_wayland

Differential Revision: https://phabricator.kde.org/D1784
2016-06-14 07:36:33 +02:00
Martin Gräßlin
c65c9728d1 [autotest/wayland] Add a test case for maximize windows
The added test exposes the problem that a shell surface might request
being maximized and then provide an incorrectly sized buffer. In this
case the ShellClient is incorrectly considered as maximized.

I don't have a good idea how to address this yet, but still publish
the test case exposing the problem.
2016-06-07 10:27:02 +02:00
Martin Gräßlin
210d57bb45 Set ShellClient on all desktop depending on Plasma Surface role
Summary:
If a PlasmaShellSurface is a Desktop, a Panel or an OSD it implies
that the window is on all desktop. So let's set it like that.

Test Plan: Auto test added and also confirmed by manual testing

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D1747
2016-06-06 08:36:11 +02:00
Martin Gräßlin
4034795893 [autotests/wayland] Add a test case for PlasmaWindow
The new added test case verifies a few cases in which a PlasmaWindow
should or should not be created or destroyed.

Some cases are clearly wrong and are marked with expect_fail.
2016-06-03 09:28:46 +02:00
Martin Gräßlin
8d7d51e4ef Merge branch 'Plasma/5.6'
dont_crash_aurorae_destroy_deco.cpp is adjusted to Platform.
2016-05-12 16:43:12 +02:00
Martin Gräßlin
6cd0d5a54a Delay maximize button click to next event cycle
Summary:
The delay to next cycle dance is needed for Aurorae. Maximizing a
window can result in the decoration being destroyed, in which case
QtQuick can trigger a crash.

A test case is added to simulate the situation and ensure that maximize
still works also after the change.

BUG: 362772
FIXED-IN: 5.6.5

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1586
2016-05-11 13:45:14 +02:00
Martin Gräßlin
568a036762 [autotests] Add test case for verifying that (un)shade keeps window geometry
This adds a new test case which creates an x11 window, shades it,
unshades it and verifies that the geometry is still the same.

CCBUG: 362501
2016-05-11 10:43:27 +02:00
Martin Gräßlin
e64450c807 Merge branch 'Plasma/5.6' 2016-04-26 13:13:17 +02:00
Luigi Toscano
654a17686e Conditionally compile tests which depend on XCB_ICCCM
Summary: Move/Resize and Strut tests Wayland tests are affected.

Test Plan: Successful compilation when XCB_ICCCM is not found

Reviewers: graesslin

Reviewed By: graesslin

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1476
2016-04-25 11:27:51 +02:00
Martin Gräßlin
e2e6d8b08b Warp the cursor pos to the specificed global position in a NET::Move request
Summary:
The cursor position is the reference KWin uses while moving a window.
If we don't warp the cursor position the window "jumps" to the cursor
position on first movement.

For requests triggered by the client (e.g. widget style) this does not
matter as the cursor is at the correct position. But for tools such as
task bars we should ensure the cursor is at the right pos.

Reviewers: #plasma, hein

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1421
2016-04-18 07:50:06 +02:00
Martin Gräßlin
0df4406c2c Fix crash on repainting an invalid sizes decoration
Summary:
If a window has an invalid size the decoration also has an invalid
size. This results in the texture used by the
SceneOpenGLDecorationRenderer to be invalid and being reset to null.
Of course we shouldn't try to use this texture to render to.

The change comes with a test case to simulate the situation. We cannot
simulate it with Wayland clients as the geometry can never be empty.
Thus we create an X11 client, resize it to an empty size and unmap it.

This is the first integration test case which creates an X11 Client!
It's also a test case which needs the OpenGL compositor. This will most
likely not work on build.kde.org yet - we need to see what to do about
it. Will need adjustments to get it at least skip on build.kde.org.

BUG: 361551
FIXED-IN: 5.6.3

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1383
2016-04-14 07:35:51 +02:00
Martin Gräßlin
bc25677caf Strut sanity checking: ignore struts which would exclude a complete screen
Summary:
Mostly meant for multi-screen setups: we don't want that a strut set on
a window on screen 0 results in screen 1 completely being excluded. Even
if that's strictly seen a client bug, it's better to just ignore the
strut from KWin's side.

The sanity check is implemented in Client::adjustedClientArea.

From a pure standard point of view this change is a EWMH violation and
thus can cause regressions: struts by clients no longer working.

A test case for struts is added, including some invalid combinations
whose strut is ignored with this change.

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1386
2016-04-12 16:55:19 +02:00
Martin Gräßlin
2bff90976e Move backends/ to plugins/platforms/
Summary:
Source code reorganization:
The base class AbstractBackend got renamed to Platform, thus the
"backends" are "platforms" now. As they are plugins they should go
together with other KWin plugins which are nowadays in the folder
plugins.

So new location is plugins/platforms/

Reviewers: #plasma, sebas

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1353
2016-04-12 08:01:27 +02:00
Martin Gräßlin
6a19f50cac Add a debugging console to KWin
Summary:
The idea behind the debugging console is to have a feature comparable
to xprop and xwininfo just for Wayland. We cannot have command line
utils as that violates the security restrictions, thus it needs to be
exposed directly in KWin.

The debugging console is invoked through DBus:
qdbus org.kde.KWin /KWin showDebugConsole

This opens a window with a tree view. The DebugConsoleModel which is
used by the tree view groups all windows into four categories:
* x11 clients (that is Workspace::clientList() and Workspace::desktopList())
* x11 unmanaged (Workspace::unmanagedList())
* wayland shell clients (WaylandServer::clients())
* wayland internal clients (KWin's own QWindows - WaylandServer::internalClients())

Each window is a child to one of the four categories. Each window itself
has all it's QProperties exposed as children.

This allows to properly inspect KWin's internal knowledge for windows and
should make it easier to investigate problems. E.g. what's a window's
geometry, what's it's window type and so on.

The debugging console is intended as a developer tool and not expected to
be used by users. That's why it's invokation is rather hidden. Due to
the fact that it's internal to KWin it results in:
* no window decoration
* stealing keyboard focus
* no way to resize, close, move from KWin side
* rendered above all other windows

There is a dedicated close button to get rid of it again. While the
console is shown it's hardly possible to interact with the system in
a normal way anymore. This is something which might be improved in
future.

At the moment the model is able to update when windows are added/removed,
but not yet when a property changes. Due to the lack of interaction with
the existing system, that's not a high priority at the moment, but can
be added in future.

Reviewers: #plasma

Differential Revision: https://phabricator.kde.org/D1146
2016-03-16 14:30:19 +01:00
Martin Gräßlin
f2873dcd36 [autotest] Add test for transient placement positioning
Test creates windows and transients for it and verifies the position.
For decorated windows the position is currently broken as it does not
consider the adjusted client position.
2016-03-03 15:57:55 +01:00
Martin Gräßlin
cc8b3a5a96 [autotest] Don't crash when cancel animation from animationEnded in scripted effect
Canceling the animation in the animationEnded handler triggers a crash.
This is due to multiple lists being iterated and manipulated at the same
time.

This adds a test case which simulates the crashy situation.

REVIEW: 126975
2016-02-17 13:59:55 +01:00
Martin Gräßlin
7d81e9cf22 [plugins/qpa] Implement a custom QPlatformCursor
This makes QCursor::pos and QCursor::setPos function correctly. KWin
actually wouldn't need it as KWin has the KWin::Cursor replacement, but
it allows Qt internal API to have it function correctly and also the
zoom effect does use QCursor::setPos.
2016-02-17 12:42:12 +01:00
Martin Gräßlin
3aeec88449 [autotest] Add test for internal pointer warping
When warping a pointer through Cursor::setPos it should be processed
just like any other pointer event. It should generate enter/leave event,
create motion events, etc. This is currently not the case as the test
shows.
2016-02-11 12:48:42 +01:00
Martin Gräßlin
8e6f387a6e [autotest] Test case for stacking order changes should change focus
A new test case which ensures that when stacking order changes the
pointer focus gets re-evaluated and updated. I was positively surprised
to notice that this already works.

Noticed two other problems while writing the test case:
* warping pointer does not re-evaluate the pointer pos
* deleting a ShellSurface (client) does not destroy the ShellClient (server)
2016-02-11 10:47:21 +01:00
Martin Gräßlin
4e907d6773 [autotest] Add test for touch input
Basic test validating:
* multiple touch points are handled
* cancel is handled
2016-02-09 11:35:15 +01:00
Martin Gräßlin
dfd0664fd6 [autotest] Add a test for a KWin internal QWindow
The test creates a QRasterWindow which through KWin's internal QPA
is considered an internal window. In the test methods we simulate
various pointer events (enter/leave, press/release, wheel).
2016-02-05 15:39:04 +01:00
Martin Gräßlin
938a0ff7fc [autotests] New test for input on window decoration
First test case is whether wheel events are forwarded correctly.
From the code it seems to me like up/down is inversed. Needs manual
testing.

As this requires working decorations it's possible that this test
will fail on build.kde.org.
2016-02-04 11:20:28 +01:00
Martin Gräßlin
7de9a402df [autotest] Add a test for locking the screen
First test case is to ensure that pointer motion events trigger a
leave event on the surface the pointer is on.

The test case shows errors in the input handling.

More tests need to be added.
2016-02-01 15:10:00 +01:00
Martin Gräßlin
4e7521fe64 Allow moving of Wayland windows
So far only moving through useractions menu is possible and only through
cursor control (mouse events are lost).

A basic first autotest is added to validate the moving of Windows.
2015-10-26 09:21:36 +01:00
Martin Gräßlin
58bcf66ecf [autotests] Test case for 10ad9262a1
The problem we had was closing a glxgears through an Aurorae theme
crashed KWin inside QtQuick.

This test case simulates the sequence:
1. starts glxgears
2. wait till we have a Client for it
3. send mouse move to guessed close button position
4. send mouse press/release at that position
5. verify the window is closed
6. verify glxgears exits

With the given commit reverted this crashes, with it in place it passes.

Please note: on CI it might fail as glxgears is not yet installed. [1]
Also we cannot enforce using Aurorae from the test yet, though on
the CI system it should get picked automatically as no other deco
plugin should be installed.

[1] Sysadmin ticket already created
2015-10-22 10:08:49 +02:00
Martin Gräßlin
996c828da3 [autotest/wayland] Add a test for quick tiling Wayland clients
Base test verifies the quick tile positions. No maximization or direct
state changes tested yet.

Required to have Toplevel and AbstractClient exported. Otherwise we
cannot use the SignalSpy.
2015-10-14 09:58:16 +02:00
Martin Gräßlin
29b2082daa [wayland] Honor ShellSurfaceInterface::acceptsKeyboardFocus in ::wantsInput
If the surface indicates that it doesn't want keyboard focus we shouldn't
give it keyboard focus.

This was a problem with Kate's autocompletion tool tip windows.

REVIEW: 125553
2015-10-08 12:51:49 +02:00
Martin Gräßlin
7fed20f136 [autotest] Welcome to integration testing KWin
This is the beginning of a new testing era for KWin: finally we are
able to test against a running KWin. This works by making use of the
new virtual framebuffer backend for Wayland. It starts a specific
Application subclass which is mostly a fork of ApplicationWayland.

The individual tests are able to influence the socket name and the
size of the virtual screen. This is supposed to be done in
initTestCase. To know when KWin is fully started one can use the
workspaceCreated signal of KWin::Application. KWin is not started in
another process, but the kwin library is used, so the test has pretty
much full introspection to everything going on inside KWin. It can
access the Workspace, WaylandServer, fake input events through
InputRedirection and so on.

Once the test KWin is running it's possible to connect to it using
KWayland::Client library. This allows to introspect the Workspace
to see whether all worked as expected (e.g. correct stacking order,
active window and so on).

This first autotest is mostly meant to illustrate how to setup a
test and how one can use KWayland::Client to interact with the mock
KWin. For more tests it is suggested to move the connections to the
Wayland server in the init() and cleanup() methods.

The change also affects the qpa plugin: the specific check to only
run in binaries called kwin_wayland doesn't hold any more. This can
now be overwritten by an env variable.

Please note that this first test will probably fail in the CI system
as it might not have XWayland which is needed by KWin.
2015-10-02 15:14:41 +02:00