Commit Graph

208 Commits (87e5369aedfaa49b6d388be51bb8287871a28c54)

Author SHA1 Message Date
Martin Gräßlin 659cab2419 [autotests] Use -displayfd as argument to start Xephyr
Makes the test more reliable, our side blocks till the server is
fully started.
2016-05-03 08:13:04 +02:00
Martin Gräßlin 319869881c Connect Application::screensCreated to WaylandServer::initOutputs
Summary:
Instead of having the Application invoke initOutputs after creating
the Screens, we can just connect to the signal emitted there.

This allows to make initOutputs a private, WaylandServer internal
method.

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1482
2016-05-02 15:52:07 +02:00
Martin Gräßlin 046d06716c [autotest] Remove workaround in ScreenEdgeTest with Qt 5.6.1
With eda4f61037 we introduced a workaround
for a problem introduced in Qt 5.5.1. This seems to be fixed in Qt 5.6.1.
2016-04-26 15:51:16 +02:00
Martin Gräßlin 2273fc0559 Cancel the EffectLoader query on clear
The Scripted and PluginEffectLoader perform locating all effects which
are to be loaded in a thread. When the EffectLoader gets cleared so far
the query did not get canceled. This resulted in effects maybe getting
loaded.

This problems shows on build.kde.org if the test is too fast and tears
down the Effect system while effects are still being queried.

Reviewed-By: David Edmundson
2016-04-26 15:01:15 +02:00
Martin Gräßlin e64450c807 Merge branch 'Plasma/5.6' 2016-04-26 13:13:17 +02:00
Martin Gräßlin 6d60f01ad9 Skip DontCrashEmptyDecorationTest if we don't have a /dev/dri/card0 device
Without the /dev/dri/card0 mesa fails to initialize egl and the test
fails. In order to silence the failure till the system provides the
device file, we better skip the test.

A nullptr crash in that case is fixed in WaylandServer tear-down.
2016-04-26 12:47:02 +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 e73a86d420 Create screen edge through the Platform
Removes a diversion between X11 and Wayland. The base class Platform
creates an instance of class Edge with plugin implementations being
able to create a different type.

The X11StandalonePlugin does that and creates a WindowBasedEdge. For
this the implementation of WindowBasedEdge is moved from screenedges
into the plugin.

Unfortunately an ifdef is needed to make the screenedge test still
work as expected. This should be improved in future, e.g. have a good
way to load the platform plugin from the tests.

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1419
2016-04-19 13:29:55 +02:00
Martin Gräßlin 736ad55e37 Add ::window() and ::approachWindow as virtual methods to Edge
This allows to no longer needing to dynamic cast the Edge to
WindowBasedEdge for the X11 specific event handling.
2016-04-19 13:29:55 +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 380c5e0bd8 [autotests] Only start Xwayland if compositor created a scene
Same as df2c26e3d9 for
WaylandTestApplication.
2016-04-14 10:29:27 +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 18939e17ed Move XRandrScreens to the x11/standalone plugin
By moving XRandrScreens the creation of screens gets simplified a lot
as there is no need to have windowing system specific init code. It all
just goes through the platform.

This also marks the point where the first X11 specific code is removed
from kwin_wayland.

Reviewers: #plasma, sebas

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1355
2016-04-12 08:04:16 +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 d31e9e88b4 Rename abstract_backend.(h|cpp) to platform.(h|cpp)
Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1340
2016-04-07 16:18:12 +02:00
Martin Gräßlin 10632f09ca Rename AbstractBackend to Platform 2016-04-07 16:18:12 +02:00
Martin Gräßlin 146af48f22 waylandServer()->backend() replaced by kwinApp()->platform() 2016-04-07 15:00:11 +02:00
Martin Gräßlin 7996d954c5 Provide the platform() -> AbstractBackend* in KWin::Application
Summary:
This is the first change in a refactoring series. The aim is to:
* rename AbstractBackend to Platform
* move backends/ to plugins/platforms/
* don't bind platforms to Wayland only
* provide a platform plugin for "normal" X11
* share more code between X11 and Wayland

This change moves the platform/backend from waylandServer to Application.
The init of the plugin happens directly in the Application from the
KPluginMetaData. There is no need to externally init it and set the
parent.

WaylandServer::backend() currently just delegates to
kwinApp()->platform(), the idea is to drop this method completely.

The test infrastructure is also adjusted to this change.

Test Plan: kwin_wayland still works, all tests pass

Reviewers: #plasma, sebas

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1331
2016-04-07 08:00:12 +02:00
Martin Gräßlin 7437c3836f [autotest] Validate set options in PointerInputTest::testModifierClickUnrestrictedMove
Just to be sure, the code did what we wanted it to do.
2016-04-06 17:25:24 +02:00
Martin Gräßlin 1ed6f8ba63 Merge branch 'Plasma/5.6' 2016-04-05 10:36:15 +02:00
Martin Gräßlin 09dd9153d8 [autotests] Use DMZ-White as cursor theme
On build.kde.org we cannot use the breeze cursor theme. Instead we have
DMZ-White (debian package dmz-cursor-theme).

This change adjusts the PointerInput test to enforce DMZ-White and uses
SizeAllCursor instead of OpenHandCursor as that one seems to be missing
in that theme.

Hopefully with these changes the test starts to pass on build.kde.org.
2016-04-05 08:36:53 +02:00
Martin Gräßlin c1b709b250 [autotests] Fix heap-use-after-free
Thanks build.kde.org!
2016-03-29 11:08:04 +02:00
Martin Gräßlin d49189276f Merge branch 'Plasma/5.6' 2016-03-21 16:55:39 +01:00
Martin Gräßlin 23c505d71e Ensure panel, desktop and onscreendisplay windows cannot be moved/resized
Summary:
A user shouldn't be able to manually move/resize a desktop window or
a panel. So far this wasn't ensured.

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1155
2016-03-21 16:44:46 +01: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 bf932c4e97 Fix crash when accessing ShellClient::iconGeometry for a not mapped window
It uses windowManagementInterface which is null until the window
is mapped. A not mapped window obviously has an invalid iconGeometry.
2016-03-14 10:24:13 +01:00
Martin Gräßlin 0b9e6a4aa2 Fix start move through drag distance on window decoration
We need to call handleMoveResize on the mouse move with button down.

Auto tests adjusted to include all possible directions.
2016-03-11 12:48:01 +01:00
Martin Gräßlin 2787fdb873 [autotest] Fix build on build.kde.org (Try 3)
Qt::Orientation seems not to be a declared metatype with Qt 5.4.
2016-03-03 16:26:55 +01:00
Martin Gräßlin 04fdecdd59 Implement sanity checks when placing transients
A transient window should always be visible on the current screen.
This change ensures that a transient is always placed in a way that
the transient window is visible on the screen ignoring the transient
offset hint if it has to be.

Unfortunately QtWayland doesn't set the transient hint correctly:
a sub menu is a transient to the main window and not to the parent
menu resulting in quite off positioned menus, see:
https://bugreports.qt.io/browse/QTBUG-51640
2016-03-03 15:57:55 +01:00
Martin Gräßlin fa774230f3 Fix transient placement for decorated parents
Need to add client pos to the transient's position. The offset is
relative to the parent surface, but the client doesn't know about the
size of the decoration, thus KWin needs to add it.
2016-03-03 15:57:55 +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 166d282a9f [autotests] Specify XCUROSR_THEME and XCURSOR_SIZE in pointer input test
Try to fix test on CI system. With neither a config nor the env variables
the cursor selection falls back to the default cursor theme, which might
not contain the cursors we need.
2016-02-25 13:53:23 +01:00
Martin Gräßlin ed7bf6e091 Send leave/enter pointer event when starting/stoping effect mouse interception
When starting effect mouse interception the current focused window
and or decoration should get a leave event. Similar when the effect mouse
interception ends the current pointer position needs to be evaluated and
a pointer enter be sent if needed.
2016-02-25 09:15:41 +01:00
Martin Gräßlin 6d495f1dc9 [autotests] New test case to verify cursor changes correctly in effects
The test case verifies that setting an override cursor during mouse
interception works and that it's also possible to change it. When
ending mouse interception the cursor image should be adjusted again.

The test shows that when mouse interception starts KWin should send
a pointer leave event to the current focused window and similar needs
to handle the stop of mouse interception.
2016-02-25 09:12:22 +01:00
Martin Gräßlin b6677ca04e Reset stored window before setting it as focused pointer surface on seat
Updating the focused pointer surface results in the cursor to change.
The CursorImage needs the current focused window to evaluate which cursor
to use, though. Thus we need to make sure that the window reflects the
current state before updating the seat.
2016-02-25 08:14:48 +01:00
Martin Gräßlin d15e94f326 [autotest] Add test case for cursor image
This test case verifies that the cursor image and hot spot changes
correctly when focusing a window, changes when damaged and hides.

Test shows that when focusing a window the cursor image is not
removed, neither that unfocus sets back to fallback cursor properly.
2016-02-25 08:14:48 +01:00
Martin Gräßlin 9eeef2d9ca Fix mouse action on (in)active window
Small regression: the command didn't get updated at all, so it was always
MouseNothing.

To prevent such a regression to sneak in again the change comes with
autotest for the action on inactive and active window.
2016-02-22 10:07:02 +01:00
Martin Gräßlin cb3c6a4780 Implement internal keyboard repeat
As a Wayland server KWin does not have to emit additional key repeat
events (unlike X11). The clients are responsible for handling this based
on the provided key repeat information.

Internally KWin needs key repeat, though. E.g. the effects need key
repeat (filtering in Present Windows), window moving by keyboard needs
repeat, etc. etc.

This change introduces the internal key repeat. For each key press a
QTimer is started which gets canceled again on the key release. If the
timer fires it invoked processKey with a new KeyboardKeyAutoRepeat state.
This is handled just like a KeyPress, but states are not updated and
the QKeyEvent has autorepeat set to true.

The event filters check for the autorepeat state and filter the event
out if they are not interested in it. E.g. the filters passing the event
to the Wayland client need to filter it out.

Currently auto-repeat is bound to using libinput. This needs to be
modified. The only backend sending repeated events is X11, thus for
other backends it should be enabled.

Whether creating a timer on each key event is a good idea is something to
evaluate in future.

Reviewed-By: Bhushan Shah
2016-02-19 08:22:53 +01:00
Martin Gräßlin b59593bd9d Invoke AbstractClient::enterEvent and ::leaveEvent on updating pointer window
This implements auto raise and focus follows mouse for Wayland.

The decoration interaction needs to be autotested.
2016-02-18 16:12:22 +01:00
Martin Gräßlin 6d47839e95 Fix scroll direction on window wheel command
Experimental testing in real world showed it's just a signing issue
in this specific case. The events passed to wayland clients scroll
in correct direction.
2016-02-18 10:11:20 +01:00
Martin Gräßlin f1e3c9f191 [autotests] Add test case for touch down triggers a mouse action 2016-02-18 09:57:18 +01:00
Martin Gräßlin 2a98c681d0 Implement whell command in input handling
With that all the actions are implemented just like on X11.

There are two not yet implemented differences:
* hide splash window when clicking it
* replay event on special window
2016-02-18 09:18:39 +01:00
Martin Gräßlin 1f1a4ac6e8 Add support for modifier+wheel action
Implemented in the ForwardEventFilter: before forwarding the event
to the window we check whether a modifier is pressed and perform the
wheel command.

Possible improvements: each axis event triggers the same change, there
is no adjusted scaling.
2016-02-18 08:27:28 +01:00
Martin Gräßlin f8f13a7fba Implement modifier+click in InputRedirection for Wayland
This change implements the mouse command for modifier (alt/meta) plus
click in InputRedirection so that it also works on Wayland.

Modifier plus mouse wheel is not implemented yet.

For easier code in Options a new method is added which provides the
configured modifier as a Qt::KeyboardModifier instead of a Qt::Key code.

Test case is added which simulates all variants of modifiers plus
supported mouse buttons to trigger move.
2016-02-17 17:07:09 +01:00
Martin Gräßlin fd692ecf07 [autotest] Adjust TestScriptedEffectLoader::testLoadAllEffects for morphingpopups
A new default effect means a new line in the mock config.
2016-02-17 15:27:06 +01:00
Martin Gräßlin 093e56ff05 Move decoration double click logic to button press
Complements ed1d32288b for Wayland.
2016-02-17 14:41:26 +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 521470b04a Improve keyboard handling for internal windows
So far the key handler in the InternalWindowEventFilter used the
PointerInputRedirection's internal window. This had the result that
key events were only delivered to an internal window if the window
was under the cursor.

This change tries sending the event to the latest created and visible
window. Thus e.g. with nested context menus it goes to the current
sub menu as expected. The return value of sendEvent is used to filter
out the event.
2016-02-17 13:34:24 +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