Commit graph

27 commits

Author SHA1 Message Date
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
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
51b44f4a87 [autotests/wayland] Fix with Qt 5.6
Test need to disable HighDPI, otherwise they crash.
2015-11-10 10:58:33 +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
Martin Gräßlin
f1215e44d4 Move implementation of (shrow|grow)(Horizontal|Vertical) to AbstractClient
Methods are no longer virtual. The only x11 specific usage in these
methods (resizeInc) is replaced by a virtual method. Default resize
increments is QSize(1,1) for AbstractClient.
2015-10-26 15:49:03 +01:00
Martin Gräßlin
8f2b01b549 [wayland] Fix quick tiling auto test
Don't emit both geometryShapeChanged and geometryChanged: the one
is set up to call the other.

Also adjust tests because maximize changes triggers too many geometry
changed signals.
2015-10-26 13:50:08 +01:00
Martin Gräßlin
45fb1680fc Consider all client in Workspace::packPositionFoo
We need to use m_allClients (AbstractClient) instead of clients (just
Client). Thus packing against another AbstractClient works.
2015-10-26 13:25:47 +01:00
Martin Gräßlin
b19da3cb14 Move implementation of Client::packTo to AbstractClient
Method no longer virtual and only implemented in AbstractClient.
The implementaton works in a generic way nowadyas.

Added an autotest for the basic packTo behavior for packing against
a screen border. Packing towards other clients still needs adjustments
in the Placement code.
2015-10-26 11:30:34 +01:00
Martin Gräßlin
1a66472494 Merge setting up client and shell client connections in EffectsHandlerImpl
The signals operate on AbstractClient nowadays, so we can have one
implementation for both Client and ShellClient.

Only X specific connections are only done for Client.
2015-10-26 10:43:36 +01:00
Martin Gräßlin
5d4cd0b26c Move geometry related connects from Client to AbstractClient 2015-10-26 10:14:54 +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
a2b83bffc5 [wayland] Update geometry in ShellClient::setGeometry directly if size didn't change
If the size is the same it's basically just a window movement. That's
nothing we need to roundtrip to the client, but can adjust the geometry
change directly.

The quick tiling test is adjusted to test this together with
sendToScreen. Each window is also sent to the next screen to verify the
state doesn't change and geometry is updated.

Note: the flag for quick maximization seems to get lost in this setup.
2015-10-14 16:38:17 +02:00
Martin Gräßlin
5558d62220 [backends/virtual] Add possibility to have multiple virtual screens
Very basic: all screens have same size and are ordered from left to
right. It's mostly meant to allow easy test cases with multi-screen.

The quick tiling test demonstrates how it's used.
2015-10-14 16:38:17 +02:00
Martin Gräßlin
86448c66dd [wayland] Use first valid geometry of ShellClient as restore geometry
This is needed to properly restore to a valid geometry after quick
maximizing. Note: this is not yet perfect, actually it should be done
after initial placing, which means we do need a manage method like
Client.

The autotest for quick tiling is extended to cover maximize changes
and cover this case.
2015-10-14 12:11:56 +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
80b6a26a09 [autotests] Enforce QPainter compositing
The change to O2 in 4a35a63d2d didn't
work on the CI, so QPainter it is.
2015-10-09 07:58:30 +02:00
Martin Gräßlin
4a35a63d2d [autotests] Enforce OpenGL compositing
As expected in a025791d7b the tests
fail on the CI system  due to llvmpipe. Let's try whether enforcing
O2 makes them run, if not update to switch to Q is following.
2015-10-09 07:42:34 +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
b74cae4dbe [autotests] And remove the problematic code
Last version of 4b917da861 was even
worse: doesn't compile. So let's just remove it completely.
2015-10-03 10:04:28 +02:00
Martin Gräßlin
4b917da861 [autotests] Only use QTest::setMainSourcePath if we have Qt 5.5
Update to f5fbdaa6ca which didn't solve
the problem. Seems to be new function in Qt 5.5.
2015-10-03 09:50:37 +02:00
Martin Gräßlin
f5fbdaa6ca [autotests] Don't use QTEST_SET_MAIN_SOURCE_PATH
It fails to build on Kubuntu's CI. Apparently not defined, let's use
what it resolves to on the author's system.
2015-10-02 16:02:13 +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