Commit Graph

630 Commits (01c1870e9dde6a73d1202be43c638fa16deb1e64)

Author SHA1 Message Date
Martin Gräßlin 4d47f6d831 [autotests/integration] Add a test case for closing DebugConsole
This test simulates closing the DebugConsole through the window
decoration. Which unlike the dedicated button does not destroy the
DebugConsole.

CCBUG: 369858
2016-10-04 13:37:25 +02:00
Martin Gräßlin 7d93b58578 Fix whether a panel is supposed to have a strut in ShellClient
Summary:
The PanelBehavior was incorrectly mapped to hasStrut resulting in too
many modes creating a strut for the panel.

CCBUG: 368499

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2788
2016-09-16 14:30:10 +02:00
Sebastian Kügler 99f491e799 parent qaction in test
Summary:
My compiler doesn't seem to like this constructor, it bails out with the
following error:

/home/sebas/kf5/src/kde/workspace/kwin/autotests/integration/globalshortcuts_test.cpp:
In member function ‘void GlobalShortcutsTest::testConsumedShift()’:
/home/sebas/kf5/src/kde/workspace/kwin/autotests/integration/globalshortcuts_test.cpp:79:40:
error: no matching function for call to ‘QAction::QAction()’
     QScopedPointer<QAction> action(new QAction);
                                        ^~~~~~~

Using this as first argument fixes the build on my machine.

Test Plan: screenedges test fails, others pass. (this screenedges test failure seems unrelated)

Reviewers: graesslin

Reviewed By: graesslin

Subscribers: luebking, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D2782
2016-09-15 21:04:29 +02:00
Martin Gräßlin e1bcda92a2 [autotests/integration] Test case for window larger than screen
If a window gets opened which will be too large with decorations it
should get a configure event with a smaller size. This currently
doesn't happen as the test highlights.

CCBUG: 366632
2016-09-14 14:08:47 +02:00
Martin Gräßlin c71b002b24 [wayland] Fix release of TabBox on Wayland
Summary:
The interaction is changed to trigger the check for release from the
TabBoxInputFilter instead of reacting on modifier changes. That way
it's possible to check for the relevant modifiers getting released
instead of getting all modifiers in. Also this means that the checks
are only performed when relevant.

BUG: 368590

Reviewers: #kwin, #plasma_on_wayland, bshah

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2773
2016-09-14 13:26:58 +02:00
Martin Gräßlin ded90756fb Fix interaction between decoration and fullscreen ShellClient
Summary:
A fullscreen ShellClient still had a decoration which was caused by
a combination of several bugs:
* when going to/from fullscreen the decoration was not update
* noBorder did not return true for a fullscreen window
* wl_shell emits fullscreen changed and maximized changed

Comparing to X11 Client both is done. So ShellClient needs to do the
same. This ensures that the correct geometry is requested when going
to fullscreen.

BUG: 366764

Reviewers: #kwin, #plasma_on_wayland, bshah

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2751
2016-09-14 10:53:12 +02:00
Martin Gräßlin 4235871667 Remove not-wanted modifiers prior to evaluating global shortcuts
Summary:
When triggering global shortcuts we are more interested in the hold
keys than the currently active modifiers. E.g. capslock should not
be seen as "shift is hold". Similar we need to remove consumed
modifiers. Shift+5 is % and not Shift+% - the shift modifier is
consumed and needs to be removed from shortcut evaluation.

To support this we need to have the actual state directly from
xkbcommon. Thus a new method is added which exposes the modifiers
relevant for global shortcut matching. In addition on every key press
all consumed modifiers are calculated and kept so that they can be
used for shortcut matching.

In addition a workaround is added for Backtab. Similar workaround
exists in kglobalaccel for X11. The problem is that our shortcuts are
stored incorrectly: Shift+Tab instead of Backtab. Thus a mapping back
is required. To make everything worse KWin registers the wrong key
sequence "Alt+Shift+Backtab" which doesn't make any sense and is
broken on X11 at least.

The workaround supports both special cases. The one for Backtab should
be turned into Shift+Tab and also KWin's special case of adding shift
to backtab.

CCBUG: 368581

Reviewers: #kwin, #plasma_on_wayland, bshah

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2768
2016-09-14 10:25:13 +02:00
Martin Gräßlin 64126a9717 Fix updating layer when setting a ShellClient to fullscreen
Summary:
The call to update the layer was performed before adjusting to
fullscreen. Thus the layer didn't get updated at all as it still
evaluated to "not fullscreen".

Reviewers: #kwin, #plasma_on_wayland, bshah

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2758
2016-09-14 10:24:46 +02:00
Martin Gräßlin cdcee88b48 [autotests/integration] Add a global shortcuts test
New test case to verify that global shortcut triggering works correctly.
First test case is to verify that consumed modifiers do not break the
shortcut. E.g. a shortcut registered for % should trigger on Shift+5 on
us layout. For that the modifier needs to be consumed, otherwise it's
Shift+% and doesn't trigger. As the test shows this is currently the
case.
2016-09-14 09:13:36 +02:00
Martin Gräßlin bf7c670444 [autotests] Wrap integration tests in dbus-session-run
Each test needs a dedicated dbus session as the test needs to register
services (e.g. kglobalaccel) and might fail if that cannot be registered.

Due to the wrapping in another command the test need to make sure that
any process they start terminates before them. E.g. the activities test
must stop kactivitymanagerd in cleanupTestCase, otherwise the test times
out.
2016-09-14 07:59:14 +02:00
Martin Gräßlin a69300f762 [autotests/integration] Test basic working of Alt+Tab and Alt+Shift+Tab
Dedicated test methods for Alt+Tab and Alt+Shift+Tab. Both open three
windows and simulate one press with opening the TabBox. Alt+Tab should
move to the previous window in the chain, Alt+Shift+tab to the last
window in the chain.
2016-09-13 16:11:58 +02:00
Martin Gräßlin c6a840413a [autotest/integration] Extend the TabBox caps lock test to verify correct shortcut is triggered
Capslock currently modifies the shortcut which is triggered from
Alt+Tab to Alt+Shift+Tab. This shouldn't be and is not the case on X11.
2016-09-13 15:20:46 +02:00
Martin Gräßlin ca6505e84c [autotests/integration] Add new test for triggering TabBox
First test case highlight a problem that tabbox doesn't close if
capslock is on.

CCBUG: 368590
2016-09-13 13:04:27 +02:00
Martin Gräßlin 95f506ad7d [autotests/integration] Extend fullscreen shell client test to verify layers
As the test shows the layer does not get updated correctly.
2016-09-13 10:30:52 +02:00
Martin Gräßlin 97b594501a Match window role in Rules in a case insensitive manner
Summary:
We used to have a toLower when reading the rule. This was removed with
4f7edb8 which turned it into a case sensitive matching to fix a
regression.

But this created another regression: existing rules written lower case
are no longer matched.

This change makes the role matching case insensitive again.

BUG: 367554

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D2574
2016-09-13 08:37:26 +02:00
Martin Gräßlin 2545162f87 Support highlighting windows through EffectsHandlerImpl
Summary:
So far TabBox used highlight windows by passing window ids around through
an X property. This doesn't work on Wayland where we don't have window
ids for our TabBox and the Wayland windows.

This change introduces a new Effect::Feature for HighlightWindows which
the HighlightWindowsEffect provides. The EffectsHandlerImpl has a new
method to highlightWindows which it delegates to that effect if it is
loaded by invoking a new performFeature method.

The TabBoxHandler now passes the highlighting to the effects system
instead of updating the x11 property. Thus this works on Wayland and
at the same time improves the X11 side by no longer having to go through
the property protocol.

Test Plan: Verified that Alt+Tab highlights the windows on Wayland correctly.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2630
2016-09-13 08:36:12 +02:00
Martin Gräßlin 405702b1a2 [autotest/integration] Extend TestShellClient::testFullscreen with deco
In addition to normal client to fullscreen two more cases are added
which also go from a server side decorated window to fullscreen.
This highlights an issue that an incorrect geometry is requested.

CCBUG: 366764
2016-09-12 14:14:20 +02:00
Martin Gräßlin 3a3d1b6b0d DebugConsole window does not take keyboard input
Summary:
In order to add more tabs which can further help monitoring how KWin
handles some aspects the DebugConsole is changed to not take keyboard
input. This means it can only be navigated using pointer device or touch
screen.

This is needed for adding a new tab to monitor clipboard changes. On
Wayland sometimes windows don't get the clipboard, so it would be
helpful to have a debug monitor to see when the clipboard changes. But
for that debug console window may not take keyboard events.

To support this DebugConsole sets the WA_ShowWithoutActivating attribute
which gets honored by the InternalWindowEventFilter and does not forward
key events to such windows.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2620
2016-09-12 13:24:33 +02:00
Martin Gräßlin 9b32615ab4 Don't bind ShellClient::acceptsFocus to whether the window is shown
Summary:
A not shown window may accept focus (e.g. when minimized). Given that
the condition was wrong and broke when making minimized windows not
shown.

This change takes the idea of not passing focus to a closing or unmapped
window directly into acceptsFocus. Which also means that this condition
now works for xdg_shell windows.

BUG: 368673

Reviewers: #kwin, #plasma_on_wayland, bshah

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2745
2016-09-12 13:14:59 +02:00
Martin Gräßlin e25be65800 [autotests/integration] Add test case for fullscreen to ShellClientTest
There are issues with setting ShellClients to fullscreen, so adding an
autotest to reproduce it. Basic test does not show any issues yet.
2016-09-12 12:03:18 +02:00
Martin Gräßlin ab68697fe5 [autotests/integration] Extend TestShellClient::tetsMinimizeActiveWindow
Adds QEXPECT_FAIL cases for wantsInput and wantsTabFocus of a minimized
window.
CCBUG: 368673
2016-09-12 10:01:02 +02:00
Martin Gräßlin 8d4204ac0d Remove non visible internal windows from the x stacking order
Summary:
KWin always has a few internal windows around which are not visible.
A QWindow created somewhere, but not shown. Such windows should not
be part of the stacking order.

If they are it breaks code which looks at the top most window in the
stacking order like e.g. SlidebackEffect.

This change ensures that the stacking order gets updated whenever a
ShellClient gets hidden and that internal windows with isShown being
false are excluded from the stacking order.

BUG: 364483

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2636
2016-09-09 07:41:12 +02:00
Martin Gräßlin e922c79897 [autotests] Add missing add_test() 2016-09-08 15:24:21 +02:00
Martin Gräßlin d345878b52 [autotests] Add Q_CONSTRUCTOR_FUNCTION to X11 specific tests to force xcb
The X11 specific tests need to run on QT_QPA_PLATFORM xcb otherwise
they will crash. To enforce this without having to replace QTEST_MAIN
a Q_CONSTRUCTOR_FUNCTION is used to invoke a function which does nothing
except setting the env variable.
2016-09-08 15:22:48 +02:00
Martin Gräßlin 66c61adb6d [autotests] Drop KWIN_TEST_MAIN macro
It was not doing anything in addition and the documentation was
completely wrong as it does the same thing as QTEST_MAIN.
2016-09-08 15:17:17 +02:00
Martin Gräßlin d3741bd530 Set the restore geometry after placing a ShellClient for the first time
Summary:
The restore geometry gets initially set to 0/0xsize before the placement
is done. When going into updateClientArea and then afterwards into
AbstractClient::checkWorkspacePosition the geometry restory is used for
calculating the new position. This results in windows getting moved to
0/0 when e.g. plugging in a new screen or a panel changes, etc.

This change ensures that the restore geometry is set correctly after the
first placement.

BUG: 366696

Reviewers: #kwin, #plasma_on_wayland, bshah

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2627
2016-08-31 15:12:53 +02:00
Martin Gräßlin 4c0e33a94c Add a Workspace::findToplevel(QWindow*) method
This allows finding the Toplevel for a QWindow which is on Wayland a
ShellClient and on X11 an Unmanaged. This can be used to simplify
code when a Toplevel is needed for an internal QWindow without having
to do platform specific checks.
2016-08-30 15:47:59 +02:00
Martin Gräßlin f99a456f33 [autotests] Extend PlasmaSurface to verify position of OSD windows
This adds a new test case which maps an OSD window and verifies that it's
positioned correctly. Then an additional screen is added which should not
affect the position, but as the test case shows: it does affect the
position.

CCBUG: 366696
2016-08-30 13:04:10 +02:00
Martin Gräßlin 42e82f09be Move Q_PROPERTY definitions from Client to AbstractClient
The properties:
 * maximizable
 * moveable
 * moveableAcrossScreens
 * resizeable

Were only defined on Client instead of AbstractClient. This resulted
in the EffectWindow having those properties evaluate always to false
for a ShellClient and breaking some effects.

BUG: 355947
2016-08-29 07:53:26 +02:00
Martin Gräßlin 6e8a8913d1 [autotests/integration] Add test case for rule matching on window role
New test infrastructure which supports testing window rules at runtime.
Test exposes problem of window rules not able to match window roles in
a case insensitive manner.

CCBUG: 367554
2016-08-25 13:23:06 +02:00
Martin Gräßlin 2feea7837a Warp the xcb pointer whenever pointer leaves an X11 surface
Summary:
For Xwayland windows we observed that passing pointer focus to another
window does not trigger proper leave events on X. Which results in e.g.
tooltip windows to show after the pointer moved to a completely
different position on a completely different surface.

This is a bug in Xwayland which will be fixed in 1.19 (already fixed in
master). Given that there is a runtime version check. Although it's fixed
in Xwayland master it's worth to carry a workaround.

To circumvent this problem KWin warps the xcb pointer to 0/0 whever an
X window loses pointer focus. That way the X window gets a proper leave
through the X protocol.

This created a problem though: when giving focus back to the X window it
started to warp the pointer for maximized windows as KWin got pointer
motion events through the X11 event filter for positions on the window
decoration. These are passed into the screen edge filter which pushes
the pointer back and warps our Wayland pointer. To solve this problem
KWin no longer performs any actions for pointer motion in the X11 event
filter if not on X11. The event filter needs to be reworked and most of
it should be moved into the Platform API, if possible.

Test Plan:
Reproduced situations where one could see that pointer updates
don't trigger leave. E.g. going from a highlighted window to the decoration.

Reviewers: #kwin, #plasma_on_wayland, bshah

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2531
2016-08-24 13:12:06 +02:00
Martin Gräßlin af80a546bf [effects] Drop the logout effect
Summary:
The new logout design doesn't want to have the vignetting. Thus the
logout effect itself doesn't make any sense any more. All that would
still be used is the logout blur which can also be provided by the
blur effect nowadays for fullscreen windows. As the new logout is a
fullscreen window it should use that one.

The logout effect did one more thing: it kept the vignetting and the
blur once the user selected logout. Now without the vignetting this
would be weird and again doesn't make much sense any more.

So overall I think it's better to just drop the logout effect and use
blur effect in normal way. Neat side advantage: it will also work on
Wayland out-of-the-box.

Reviewers: #kwin, #plasma, #vdg

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D2553
2016-08-24 10:09:22 +02:00
Martin Gräßlin 91a6efce33 [autotests] Fix X version check for skip in XWaylandInputTest
Was missing one digit.
2016-08-23 13:39:23 +02:00
Martin Gräßlin 356510b0aa [libkwineffects] Port getXServerVersion from X11 to xcb
Removes one of the last pure XLib usages and also means that in theory
we can detect the Xwayland version number. In practice that only works
when restarting the compositor as detect is invoked before the XWayland
connection is created.
2016-08-23 11:45:59 +02:00
Martin Gräßlin 9aa6b2c1e5 [autotests] QSkip XWaylandInputTest if we don't have at least Xwayland 1.18
The test seems to fail with too old Xwayland, so let's skip it.
2016-08-23 11:25:57 +02:00
Martin Gräßlin 3c235e63cc [autotests] Further verifications in XwaylandInputTest
Trying to understand why it fails on build.kde.org...
2016-08-23 10:39:17 +02:00
Martin Gräßlin 33ca7750c2 [autotests] Further condition check in XWaylandInputTest
Just to figure out an idea why the test fails on build.kde.org...
2016-08-23 09:57:20 +02:00
Martin Gräßlin a0154d01eb [autotests] Verify in XWaylandInputTest that cursor is not on new mapped window
Test fails on build.kde.org. This just adds an additional condition to
verify that the setup is correct.
2016-08-23 09:40:23 +02:00
Martin Gräßlin efb62fd2ff [autotests] Add a test case for pointer enter/leave of X windows
This test simulates the situation that pointer leave on an X surface
does not send the XCB_LEAVE_NOTIFY event to the X window.
2016-08-23 09:15:05 +02:00
Martin Gräßlin c3dfacc3dc Improve introspection into Scripting for KWin core/testing
Summary:
This change introduces a Scripting::findScript method which returns
the AbstractScript. Thus a test can load a script, retrieve it and
trigger run on it. As the test would also need to know when finally
the test is running a signal is introduced to notify about it.

This makes the scripting ScreenEdgeTest way more reliable. The test
had been failing on both build.kde.org and build.neon.kde.org due to
not knowing when the script is loaded.

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D2497
2016-08-22 14:37:46 +02:00
Martin Gräßlin ec98f498e8 Ensure modifier locks and latches don't trigger the mod only shortcut
Summary:
If caps lock is on the shift key should not trigger. Similar pressing
caps lock should neither on activation press nor on deactivation press
trigger the shortcut. Related to that are latched modifiers aka sticky
modifiers: if the modifier is still on after releasing the key the
shortcut should not trigger. We must assume the user wanted to use the
modifier to activate the modifier, not to activate the shortcut.

This change ensures that we don't track for modifier only shortcuts if
a modifier is active before press or after release.

The added test case demonstrates for caps lock, latched modifiers is
currently still untested. (Needs a way to mock it).

Test Plan: See test case for caps lock.

Reviewers: #kwin, #plasma

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D2467
2016-08-19 10:56:41 +02:00
Martin Gräßlin b7f49244e0 [effects] Add new effect for touch point visualization
Summary:
The new effect is based on the mouse click effect and uses the same
rendering code (this could be improved by merging them better).

Unlike mouse click there is no keyboard shortcut needed to activate:
as soon as the effect is loaded all touch points are visualized.

The visualization creates an animated circle for each touch down
position, motion and up position. The ids are tracked and each touch
id gets the same color. The first ten different touch ids get a
different color. As touch ids are stable the first finger will always
have the same color.

Reviewers: #kwin, #plasma_on_wayland, bshah

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2464
2016-08-18 10:36:48 +02:00
Martin Gräßlin a4af242081 Fix crash when unminizing a ShellClient
On unminize we should not call windowHidden, but windowShown.

Reviewed-By: bshah
2016-08-18 10:30:27 +02:00
Martin Gräßlin ea22b8f15d Introduce env variable KWIN_XKB_DEFAULT_KEYMAP to force default layout creation
Summary:
The Xkb class loads keyboard layouts from the users configuration. This
makes tests fail locally if the user has a layout which behaves
differently to the one the test expects. E.g. on a German layout the
right alt key is different to the one of US layout.

In order to have a more stable test base the env variable
KWIN_XKB_DEFAULT_KEYMAP forces the loading of the default keymap, thus
tests have a common layout set.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2466
2016-08-18 07:46:59 +02:00
Martin Gräßlin e40344c6bb [autotests/integration] Split InternalWindowTest::testKeyboard into two test methods
Creating a dedicated method for the leave event on client.
This restructuring of the test should hopefully work around the
failing test condition on build.kde.org.
2016-08-16 15:39:47 +02:00
Martin Gräßlin 0b475c50d2 [autotests/integration] Some more changes to try to make InternalWindowTest pass again 2016-08-16 14:32:27 +02:00
Martin Gräßlin d68a3fecd7 [autotests] Use QTR_COMPARE instead of QTest::qWait in TestScriptedEffectLoader
Hopefully makes the test more reliable on build.kde.org.
2016-08-16 14:08:07 +02:00
Martin Gräßlin 1eac18a8fd [autotests/integration] More changes in InternalWindowTest::testKeyboard
Test is still failing on build.kde.org. Adding more test conditions to
better understand what works and what doesn't.
2016-08-16 12:45:21 +02:00
Martin Gräßlin 0eecb202e2 [autotests/integration] Try to fix InternalWindowTest::testKeyboard
It fails on build.kde.org, but failing condition is not reproducable
locally.
2016-08-16 11:10:26 +02:00
Martin Gräßlin 06d562a5ba Block modifier only shortcuts when screen is/gets locked
If the screen is locked the modifier only shortcuts should not trigger.
Also if the screen gets locked while a modifier is hold the shortcuts
should not trigger.

Reviewed-By: bshah
2016-08-16 10:32:29 +02: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 142aab2e24 Introduce an EffectsHandler::animationsSupported -> bool
Summary:
A new method to tell the effects system whether the compositor scene
is able to drive animations. E.g. on software emulation (llvmpipe) it's
better to not do any animations at all.

This information can be used by effects to adjust their behavior, e.g.
PresentWindows could skip transitions or effects can use it in their
supported check to completely disable themselves.

As a first step all scripted effects are considered to be unsupported
if animations are not supported. They inherit AnimationEffect and are
all about driving animations.

The information whether animations are supported comes from the Scene.
It's implemented in the following way:
 * XRender: animations are always supported
 * QPainter: animations are never supported
 * OpenGL: animations are supported, except for software emulation

In addition - for easier testing - there is a new env variable
KWIN_EFFECTS_FORCE_ANIMATIONS to overwrite the selection.

Reviewers: #kwin, #plasma

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D2386
2016-08-15 17:38:33 +02:00
Martin Gräßlin bfb2094c0a [autotests/integration] Fix TestLibinputDevice::testName
sysName may not be empty. Set a different name.
2016-08-15 17:21:45 +02:00
Martin Gräßlin a9ac2739f7 [autotests/libinput] Set a valid sysName by default
The autotests are failing on build.kde.org due to the generated DBus
object path not being valid. This might be due to sysName having been
empty by default.
2016-08-15 16:55:10 +02:00
Martin Gräßlin ab5d31426a [libinput] Expose all input devices through DBus
Summary:
The Connection exposes a new service called org.kde.KWin.InputDevice
and every Device registers an own object exposing all properties.

This allows an external configuration tool to change the behavior of
the devices at runtime. E.g. to test configuration settings.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2407
2016-08-15 16:10:50 +02:00
Martin Gräßlin 8bbd53a774 [wayland] Properly implement minimize of ShellClient
Summary:
We need to call Workspace::clientHidden when minimizing. Otherwise
Workspace doesn't update the active client and the now minimized
window is still active.

BUG: 366634

Test Plan:
Test case works now and also tested in nested setup that
active window changes.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2410
2016-08-15 16:10:11 +02:00
Martin Gräßlin bd58d7792f Don't trigger modifier only shortcuts if pointer interaction
Summary:
If the user clicked a pointer button or scrolled a pointer axis the
held modifier was most likely intended to modify the pointer event.
Thus the modifier only shortcut should not be triggered.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2435
2016-08-15 16:09:03 +02:00
Martin Gräßlin 3a730fa51e Merge branch 'Plasma/5.7' 2016-08-15 16:07:50 +02:00
Martin Gräßlin 71c996fe33 Select also raw button press/release in XInput2 based polling
Summary:
The mouse polling is also used to detect mouse button press/release
events. This is used e.g. by the MouseClickEffect. The XInput2 filter
only selected for Raw Motion events which means mouse button events
are missed in case it's not combined with a motion.

This change makes the input filter also select for raw button press
and release events. To support this the X11EventFilter needed to
be adjusted to support multiple generic event types to filter for.

BUG: 366612
FIXED-IN: 5.7.4

Reviewers: #kwin, #plasma

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D2406
2016-08-15 16:06:30 +02:00
Martin Gräßlin 03f66b02c3 [autotest/integration] Add pointer axis events to ModifiersOnlyShortcutTest
If a pointer axis is scrolled while a modifier is hold, the modifier only
shortcuts should not trigger. The user wanted to use the modifier for the
pointer axis.

This is not implemented yet, thus all is QEXPECT_FAIL.
2016-08-13 15:15:54 +02:00
Martin Gräßlin 280663fede [autotest/integration] Add pointer button events to ModifiersOnlyShortcutTest
If a pointer button is pressed or gets pressed while a modifier is
hold, the modifier only shortcuts should not trigger. The user wanted
to use the modifier for the pointer button.

This is not implemented yet, thus all is QEXPECT_FAIL.
2016-08-13 15:09:21 +02:00
Martin Gräßlin fcd9a15186 [autotest/integration] Add a test case for modifier only shortcuts
This test verifies the functionality of modifier only shortcut
activation. The base test case uses a helper object which is exported
to DBus and has a slot which can get triggered.

The test configures the individual modifiers to call that DBus method
when the shortcut is triggered. It simulates pressing the modifier and
verifies the DBus method was invoked or not.
2016-08-13 14:35:01 +02:00
Martin Gräßlin 83d8181675 [libkwinglutils] Revert version hack for Qualcomm Adreno on libhybris
The idea to set proper version is good, but it results in epoxy
thinking it does not have the entry points and terminating KWin.
2016-08-12 15:46:55 +02:00
David Edmundson 6c8f0e6cc0 Include setOnActivity in the test 2016-08-12 13:21:09 +01:00
David Edmundson 628fe79d3e Fix activites_test check
client->isOnActivity("foo") will return true if the client is on no
activities, as that's the equivalent of saying we are on all activities.

In our case we do want to check activities() shows the right thing.
2016-08-12 13:21:09 +01:00
Martin Gräßlin b14618994b [autotests/integration] Add a first test case for activities
Verifies the condition from D1982 with expected_fail. That is sets
a Client on non existing activities and expects that it should be on
all activities.
2016-08-12 12:52:47 +02:00
Martin Gräßlin a5c8356d40 [libkwineffects] Add detection code for Qualcomm Adreno to GLPlatform
Summary:
The Qualcom Adreno classes are recognized and a version detection
workaround is added for libhybris which only announces GLES version 2
although GLES version 3 is supported. KWin at least used to work with
GLES version 3 which gives us e.g. framebuffer blit.

Reviewers: #kwin, bshah

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D2415
2016-08-12 09:59:38 +02:00
Martin Gräßlin 79641df928 [autotests/libkwineffects] Add test data for Adreno 330
This is the device used in Nexus 5 and reference for Plasma Mobile.
The output is with using libhybris on top of hwcomposer backend.
2016-08-12 09:16:28 +02:00
Martin Gräßlin 7586394b81 [autotests] Don't try to load StartupFeedbackEffect on GL compositor
The test terminated cleanly as it tried to load a shader which obviously
fails.
2016-08-12 08:24:43 +02:00
Martin Gräßlin ec596519c6 [autotests/integration] Add test case for minimizing active ShellClient
When minimizing an active ShellClient it should become inactive.
This is not the case as the test case shows through expected failures.

CCBUG: 366634
2016-08-11 17:08:08 +02:00
Martin Gräßlin cd6d82fcbc [libinput] Add device configuration for tap-drag-lock
From libinput documentation:
Also optional is a feature called "drag lock". With drag lock disabled,
lifting the finger will stop any drag process. When enabled, libinput
will ignore a finger up event during a drag process, provided the finger
is set down again within a implementation-specific timeout.
2016-08-11 16:32:00 +02:00
Martin Gräßlin 02cf9e8a64 [libinput] Add support for tap and drag
From libinput documentation:
A tap immediately followed by a finger down and that finger being held
down emulates a button press. Moving the finger around can thus drag
the selected item on the screen.
2016-08-11 16:02:26 +02:00
Martin Gräßlin e18e2eb57c [libinput] Rename Device::tapEnabledByDefault to tapToClickEnabledByDefault
Slightly more descriptive name what the feature is about.
2016-08-11 15:18:40 +02:00
Martin Gräßlin 2f7298bed5 [libinput] Add support for tapToClick configuration
New property added to Device which allows reading and setting the
tap to click configuration.
2016-08-11 15:13:36 +02:00
Martin Gräßlin 7bca270f97 Force windows of type desktop to be opaque
Summary:
Plasmashell's desktop windows are RGBA which forces the compositor to
perform blending and render the background. That is absolutely pointless
as there is no window behind the desktop window it could blend to. All it
does is destroying KWin's more optimized code path and forcing additional
rendering which will never be visible (including shader push/pop).

With this change KWin forces desktop windows (both X11 and Wayland) to
be considered as opaque by setting the depth to 24. Thus blending is
disabled and the background is not rendered.

Test Plan:
Verified with apitrace that KWin goes in the opaque rendering
path for desktop windows.

Reviewers: #kwin, #plasma

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D2382
2016-08-10 15:10:22 +02:00
Martin Gräßlin 4cdb078376 [autotest/libkwineffects] Add more test data for glplatformtest 2016-08-09 08:40:37 +02:00
Martin Gräßlin 1e13c5ad8f [autotests/libkwineffects] Test GLPlatform::driverToString and chipClassToString 2016-08-09 08:30:09 +02:00
Martin Gräßlin 0778cab42d [autotest/libkwineffects] Add more test data for the glplatform test
Example data harvested from bugs.kde.org: open bugs against kwin with
a comment containing supportInformation.

We can see that especially detecting modern radeon gpus is not working.
2016-08-08 17:40:04 +02:00
Martin Gräßlin 14730d1f7c [wayland] Place transient windows every time they are shown
The parent window might have moved, they should always be placed
according to their placement hint.

Reviewed-By: bshah
2016-08-08 14:55:26 +02:00
Martin Gräßlin 981b312323 [Wayland] Make it possible to have internal windows decorated
Summary:
With this change KWin can create window decorations for internal windows.
Thus it's also possible to move internal windows and resize them which is
especially important for the debug console.

Reviewers: #kwin, #plasma_on_wayland, sebas

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2371
2016-08-08 14:00:32 +02:00
Martin Gräßlin 921e27257c [wayland] Ensure that pointer enter event carries the correct coordinates
So far KWin's pointer surface enter handling was:
1. update fouced surface
2. update the global position

On client side this resulted in:
1. Enter with incorrect coordinates
2. move event to correct coordinate

With QtWayland this results in the case of multiple surfaces in one
application that Qt doesn't properly process the enter event and the
Window never getting pointer focus and not reacting on any pointer
input events.

The root problem is that the KWayland server API is not ideal for
supporting this situation. There is an API call for setting the global
position (which causes a pointer motion for the focused surface) and
an API call to update the focused surface. But a combination for both
is (still) missing.

This change addresses the problem by first unsetting the entered surface,
then updating the global position and afterwards setting the new surface.
Thus the position is correct. While this needs to be made better in
KWayland, this is an urgency bug fix to get the behavior correct and thus
first working around the API deficit and not first extending in KWayland.

Reviewed-By: bshah
2016-08-08 13:38:43 +02:00
Martin Gräßlin f31989f701 [autotest/intergration] Wait for pointer enter before simulating button press
The test LockScreenTest::testPointerButton and testPointerAxis both
fail on Neon's CI infrastructure. In order to make the test more reliable
the tests first wait for the pointer enter after unlock before simulating
another button press.
2016-08-08 13:38:02 +02:00
Martin Gräßlin a1490905e9 [autotest/intergration] Wait for pointer enter before simulating button press
The test LockScreenTest::testPointerButton and testPointerAxis both
fail on Neon's CI infrastructure. In order to make the test more reliable
the tests first wait for the pointer enter after unlock before simulating
another button press.
2016-08-08 11:12:22 +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 e88a709f03 Raise minimum libinput version to 1.2
Now provided on build.kde.org, thus let's properly depend on it and
remove the ifdef.
2016-08-08 09:18:39 +02:00
Martin Gräßlin 8a83a6fef5 [libinput] Add support for gesture events
Summary:
Gesture events are swipe or pinch events on a touch pad.

This change implements basic support by:
 * wrapping them in LibInput::Event
 * processing them in LibInput::Connection and emitting
   dedicated signals
 * Forwarding them in InputRedirection to PointerInputRedirection
 * Support them in the internal input event filter
 * Printing debug information in DebugConsole

Further handling is not yet done. In future the following should be
implemented:
 * activating e.g. zoom and present windows on pinch/swipe gesture
 * forwarding non global gestures to KWayland

Note that forwarding to KWayland is not yet useful as QtWayland does
not yet have support for the unstable protocol. No Qt application could
make use of it yet. So for the moment just global gestures is the best
we can get.

Test Plan: Looked at output of DebugConsole when triggering gestures

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2359
2016-08-08 09:15:06 +02:00
Martin Gräßlin 31790dc00c [autotest] Introduce a test infrastructure for GLPlatform
The new test can load "profiles" from kconfig files in the test data.
Based on that the glGetString return values are mocked and GLPlatform
can perform detect without having to interact with a real GL library.

That way we can verify that the detect code works correctly. As a first
test the settings of one Intel/IvyBridge is included. More tests can be
added easily (e.g. looking at various supportInformation output in
bugs.kde.org). Also this allows to more easily add detect code for GPUs
we do not know yet. And to simulate conditions where the detect code
failed resulting in no compositing at all.
2016-08-05 08:47:32 +02:00
Martin Gräßlin f0dc01b352 [wayland] Ensure that pointer enter event carries the correct coordinates
So far KWin's pointer surface enter handling was:
1. update fouced surface
2. update the global position

On client side this resulted in:
1. Enter with incorrect coordinates
2. move event to correct coordinate

With QtWayland this results in the case of multiple surfaces in one
application that Qt doesn't properly process the enter event and the
Window never getting pointer focus and not reacting on any pointer
input events.

The root problem is that the KWayland server API is not ideal for
supporting this situation. There is an API call for setting the global
position (which causes a pointer motion for the focused surface) and
an API call to update the focused surface. But a combination for both
is (still) missing.

This change addresses the problem by first unsetting the entered surface,
then updating the global position and afterwards setting the new surface.
Thus the position is correct. While this needs to be made better in
KWayland, this is an urgency bug fix to get the behavior correct and thus
first working around the API deficit and not first extending in KWayland.

Reviewed-By: bshah
2016-08-04 11:13:52 +02:00
Martin Gräßlin 671740dc70 Ensure that EffectsHandlerImpl::slotClientShown is only invoked once per Window
Summary:
This fixes a regression introduced with a1afeded6a.
The connections were setup every the windowShown signal got emitted.
This caused effects to get multiple singals and start multiple animations
which then do not get cancelled correctly.

The incorrect behavior was most visible in the translucency effect which
did not cancel the move animation and the window stayed translucent.

BUG: 366081

Test Plan:
New test case which simulates the behavior of the translucency
effect.

Reviewers: #kwin, #plasma, sebas

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D2346
2016-08-03 16:16:00 +02:00
Martin Gräßlin 6a6af0e8b5 [libinput] Add optional device detection for cap tablet tool
The capability tablet tool is new in Libinput 1.2. As build.kde.org
does not yet support this version, it's only an optional check.

So far the code only detects whether the capability exists and reports
this accordingly.
2016-08-03 09:31:47 +02:00
Martin Gräßlin 17abac9db3 [autotest/integration] Add a test case for screenedge usage in Scripts
A new sub-directory scripting is added in autotests/integration to
gather all test cases related to scripting.

The first added test case verifies the activation of screen edges. For
that it loads a helper script, which reserves an edge based on config.
When the edge is triggered showing desktop is activated.
2016-08-02 09:12:57 +02:00
Martin Gräßlin 3308f35984 Handle restart of Compositor Scene correctly for Wayland client
Summary:
This change ensures that KWin doesn't crash in the QPainter scene if
the compositor gets restarted and if there are Wayland clients.

BUG: 365471

Test Plan:
Test case added to scene qpainter which triggers a restart
of the Compositor with a window being shown. Verifies that rendering
is correct afterwards.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2185
2016-07-21 08:11:32 +02:00
Martin Gräßlin 4d5d7a6d7e [autotests/integration] Fix PointerInputTest::testUpdateFocusAfterScreenChange
Change the way how a screen is removed. This ensures that Xwayland
doesn't die.
2016-07-20 14:42:22 +02:00
Martin Gräßlin 9d7ef58b2b Support restarting the OpenGL compositor on Wayland
Summary:
KWin needs to support restarting the OpenGL compositor in case of a
graphics reset event.

On Wayland the tricky part is that the applications should not notice
this. Most importantly KWin cannot just destroy the EGLDisplay and create
a new one. But this is how a restart works: the complete compositor gets
torn down and recreated - including the EGLDisplay.

This change moves ownership of the EGLDisplay to the Platform.
The AbstractEglBackend subclasses query the Platform whether there is
already an EGLDisplay. Only if there is no EGLDisplay the EGLDisplay is
created and only if no EGLDisplay is registered with Wayland the bind
is performed.

Another change is regarding the destruction: the AbstractEglDisplay does
no longer unbind the Wayland display and does no longer destroy the
EGLDisplay. The EGLDisplay is destroyed by the Platform - so very late
on application exit. The Wayland display is unbound when the Compositor
terminates.

Test Plan:
Limited testing with the added auto-test. This one needs to
be extended to fully verify that OpenGL applications continue to work.
But this requires build.kde.org to support OpenGL on Wayland.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2202
2016-07-20 14:08:23 +02:00
Martin Gräßlin d0c488f4a2 Announce output changes to Wayland for platforms not handling outputs
Summary:
Most platforms like the nested and virtual do not handle the outputs
themselves and WaylandServer announces the Outputs to Wayland.

So far this was static: at startup it got announced once to Wayland
and any changes were not catched.

This change makes WaylandServer listen to changes to the Screens and
sync them to Wayland.

Unfortunately KWin's internal Screen information is not sufficient to
properly synchronize this to Wayland and also Wayland by not supporting
adding/removing modes does not help.

Thus the solution implemented here is to add new outputs reflecting the
changes and then removing the old ones. This creates situations with more
outputs being present than actually there, but prevents that there are
no outputs at all.

Test Plan: Auto test added which verifies this for the virtual platform

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2233
2016-07-20 13:53:02 +02:00
Martin Gräßlin 8445008e85 Expose window geometry to PlasmaWindow
Summary: Needed for e.g. the pager.

Test Plan: Test case for PlasmaWindow verifies the geometry

Reviewers: #kwin, #plasma_on_wayland, hein

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2200
2016-07-20 13:49:10 +02:00
Martin Gräßlin fb8434671f [autotests] Move libkwineffects/autotests to autotests/libkwineffects
All autotests shall be in autotests subdirectory.
2016-07-18 08:47:45 +02:00
Martin Gräßlin a1afeded6a Emit windowShown and windowHidden from Client::internalKeep and ::internalHide
Summary:
With this change auto-hiding panels are animated again by SlidingPopups
effect.

Test Plan: Test case adjusted, and tested in VM

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D2157

BUG: 354407
FIXED-IN: 5.8.0
2016-07-14 11:11:49 +02:00
Martin Gräßlin 5e1e2be5e8 [autotests/integration] Add new test case for screenedge client show
A test to simulate auto-hiding panels. Preparation step for making the
slidingpopups effect working again for auto-hiding panels.

The test case simulates creating a panel at the screen edge, hides it
through the property and shows it again through the edge.
2016-07-14 09:45:03 +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 5ee958ca7e [libkwineffects] Add signals windowShown and windowHidden to EffectsHandler
Summary:
This allows effects to animate when a window is shown again and when
a window gets hidden but not yet closed/destroyed. This situation
happens on X11 for e.g. auto hiding panels and on Wayland for pretty
much any window which properly unmaps (windowHidden) prior to destroy.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2084
2016-07-13 10:46:05 +02:00
Martin Gräßlin a35ffa93d7 Use hiddenInternal() for a ShellClient which got unmapped
Summary:
So far when a ShellClient got unmapped ready_for_painting was set to
false. That is the ShellClient was treated in the same way as a not
yet shown window. It was completely excluded from painting, a close
animation impossible.

This change makes use of the functionality available in
Client::hiddenInternal(). The window is considered as hidden, thus
still excluded from e.g. getting input events, but could be rendered
any time as we still have a previous window pixmap (if referenced).
This allows to have it considered in the rendering pass, but effects
still cannot make use of it as that state is not yet exposed to the
effects.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2083
2016-07-13 10:45:10 +02:00
Martin Gräßlin 445335ba5f Merge signal connections for AbstractClient in Workspace
Summary:
Have one dedicated method which performs the connection for both
Client and ShellClient. This fixes the desktopPresenceChanged signal
not being passed to the effects.

Note that not all signals are merged. Most signals setup for Client
don't make sense for ShellClient as ShellClient cannot block composite
or unredirect.

Test Plan:
Test case added for ShellClient to ensure that the signal
is correctly invoked on the ShellClient, Workspace and EffectsHandler.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2059
2016-07-13 10:44:34 +02:00
Martin Gräßlin 3c04d5295d Handle situation of no XDG_RUNTIME_DIR gracefully
Summary:
If KWin fails to start the Wayland server due to XDG_RUNTIME_DIR not
being set, kwin_wayland should terminate with an error condition but
not crash.

This change makes sure that KWin detects that the Wayland server does
not work and terminates the startup early and ensures that it doesn't
crash while going down.

An error message is shown that we could not create the Wayland server.

Test Plan:
Test case added which verifies that WaylandServer fails to
init. Manual testing that kwin_wayland exits with error 1.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2078
2016-07-13 10:00:46 +02:00
Martin Gräßlin f8d556e630 [autotests/integration] Test another multi-screen setup
The struts test is extended by a setup containing two horizontal
screens, bottom aligned with the left screen smaller than the right.
Thus there is a dead area in the top left corner. In addition there's
a panel on top left screen.

Apparently KWin allowed windows to open in the dead area. The test
case reconstructs this by opening a window with the same size hints,
but in the test it's working correctly.
2016-07-13 07:59:18 +02:00
Martin Gräßlin 2b5747dccb [autotests/integration] Unload effects before destroying Workspace
Brings in line with behavior in main_wayland.cpp and is needed as
effects might call into Workspace during tear down.
2016-07-04 14:37:35 +02:00
Martin Gräßlin da36fd1c02 [autotests/integration] Try to make SceneQPainterTest::testWindow more robust
It was failing on the CI system due to timing. Reorder the signalspy
creation a little bit in the hope that this makes it pass.
2016-07-04 08:12:42 +02:00
Martin Gräßlin 7610ff49a8 [autotests/integration] Make MoveResizeWindowTest more robust
A few more cases where we need to ensure that the created window is
destroyed before going into next test method.

Interesting observation: the generated window ids are identical.
Possible problem with KWayland::ClientConnection?
2016-07-01 15:21:37 +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 2780639936 [autotest] Add a test to SceneQPainterTest to render a window
New test method which verifies that a newly mapped window is rendered
correctly, that cursor image set on it is rendered correctly, also when
pointer moves.
2016-07-01 10:33:25 +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
Martin Gräßlin 1f2b47a83b [autotests/integration] Simplify the cmake for creating a test
Summary:
A dedicated cmake function is added to create a test case. It takes
a NAME, the SRCS and additional LIBS.

Thus it's
integrationTest(NAME myTestCase SRCS test.cpp)

to create a standard integration test.

In addition kwin_wayland_test.cpp is compiled into a static library
to decrease the compile time a little bit.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2052
2016-07-01 09:00:53 +02:00
Martin Gräßlin 055e2b3bb6 [autotests] Add a new test case which can verify the rendering of QPainter Scene
Summary:
The idea behind this autotest is inspired by bug 356328 which produced
incorrect rendering results. Also it's inspired by openQA which performs
image reference comparisons.

This test case tries to go further. It creates reference images which
must match the rendering result exactly. So far the test case verifies
the start condition - kwin started and one frame is rendered with default
cursor in the middle of the screen. And it verifies the moving of the
cursor without any windows shown. Whenever the cursor moves a repaint
should be triggered and the old and new area should be properly
repainted.

To support this the test needs some minor changes in KWin:
* Scene provides a frameRendered signal - needed for waiting on frame
* Scene and SceneQPainter are exported
* SceneQPainter provides access to it's Backend, so that we get to the
 backbuffer
* ScriptedEffectLoader is exported for getting a list of all scripted
 effects - (we don't want fade to manipulate the rendering)

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2046
2016-07-01 09:00:19 +02:00
Martin Gräßlin 83dca5b524 Properly wait for client activated in XClipboardSyncTest::testSync
Test was failing on build.kde.org, though passing locally. This change
tries to make the test more robust to timing issues which makes it
hopefully pass on build.kde.org again.
2016-06-29 12:38:02 +02:00
Martin Gräßlin 95449e0843 Fix unused parameter warnings 2016-06-29 10:50:51 +02:00
Martin Gräßlin 50569a2580 Move tabbox/autotests to autotests/tabbox
Let's have all autotests in autotests subdirectory instead of spread
out over the source tree.
2016-06-29 10:38:17 +02: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 c9984094de Add support for ToolTip Role on PlasmaSurface
Summary:
It's mapped to be on all desktops in order to properly have tooltips
show for the panel (which is on all desktops) instead of just on the
desktop it's created.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2032
2016-06-29 09:06:01 +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
Bhushan Shah a69b47f7b7 [autotests] Extend StrutsTests for setup on mobile
This testcase tries to emulate the panel setup on the phone,

- Window placement strategy is set to maximizing
- Top panel with height of 60
- Bottom panel with height of 150

However this is still not complete testcase, some todo items:

- Create Plasmashell desktop window before creating panels
- Create normal window and verify if its placement/position is right

Reviewed-by: Martin Gräßlin <mgraesslin@kde.org>
2016-06-28 16:53:35 +05:30
Martin Gräßlin 1a779ccd88 Merge branch 'Plasma/5.7' 2016-06-28 12:43:36 +02:00
Martin Gräßlin c81d8204f9 Add support for new Notification role on PlasmaSurface
Summary:
Sets notifications on all desktop and doesn't activate them.

Unfortunately doesn't work on Plasma yet. Seems the windows don't get
tagged properly.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D1930
2016-06-27 11:47:50 +02:00
Martin Gräßlin 7adf69dece Update Keyboard focus when the Surface of the active client changes
Summary:
For XWayland windows the window might be activated before the Wayland
Surface is set for it. Thus the keyboard focus is not passed to the
window. Only on the next activate after the window got created the
window got keyboard focus.

This change addresses this problem by emitting a signal from Toplevel
when the surface changes. The KeyboardInput listens to this signal
for the active client and updates keyboard focus again if the surface
changes. Thus keyboard focus is properly passed to XWayland windows.

Test Plan:
Test case which creates an X11 window is adjusted to verify
the condition.

Reviewers: #plasma_on_wayland, #kwin

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2009
2016-06-26 16:07:31 +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 8a85cc5f9c Do not activate on-screen-display windows
Summary:
Plasma's OSD windows were stealing focus on Wayland. We can be sure
that they should not get keyboard focus, so a check to acceptsFocus
is added.

Reviewers: #plasma_on_wayland, #kwin

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D1927
2016-06-17 09:26:15 +02:00
Martin Gräßlin 4560f8d253 Handle ShellClient::windowShown in Workspace
Summary:
When a ShellClient gets unmapped and mapped again the signal windowShown
gets emitted. We need to handle this in Workspace to ensure the window
is in the proper layer and gets focus.

This fixes applications like KRunner/Yakuake not having focus on a
second show. Unfortunately it also brings back the problem that
notifiations steal focus (this needs to be fixed by passing a proper
window type to a notification).

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D1864
2016-06-16 11:13:59 +02:00
Martin Gräßlin e5fe3137b8 Fix the ignore struts multi-screen handling
Summary:
The checks in Client::adjustedClientArea were a little bit too
agressive, excluding also valid setups.

This change addresses the regression by keeping the actual intended
improvements in place.

The check in Client::adjustedClientArea is now only done for the
special case of desktopArea == area. This ensures that a strut excluding
a complete screen won't affect the overall workarea.

In addition new checks are introduced in Workspace::updateClientArea.
When calculating the new sareas a check is performed whether the
intersection with the adjustedClientArea would result in the sarea
becoming empty (thus a screen being completely removed). If that's the
case the geometry is ignored to not exclude a complete screen.

Interestingly I should have noticed that something with the logic is
odd. As the test case had two commented geometries which we now get.

BUG: 363804

Reviewers: #plasma, apol, lbeltrame

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D1744
2016-06-15 14:48:13 +02:00
Martin Gräßlin 39e7b26243 Introduce a RequestGeometryBlocker in ShellClient
Summary:
The idea is to not send multiple resize requests to a client when we
know that we might have multiple geometry changes. E.g. when going
from maximized to restored the borders change and trigger a resize in
addition to the resize from switching to restored.

The implementation is inspired by the GeometryUpdateBlocker.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D1808
2016-06-14 07:40:14 +02:00
Martin Gräßlin 53a3740082 Request the resize of ShellSurface after Decoration updated the borders when maximizing
Summary:
This ensures that we don't send a size request with the borders still
added.

Test Plan:
Verified that a maximized window is properly sized and
doesn't have empty borders

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D1807
2016-06-14 07:39:37 +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 d49fba5d30 [libkwinxrenderutils] Clean up static blend picture before going down
Summary:
The method xRenderBlendPicture created a static XRenderPicture on
first usage. To cleanup a XRenderPicture an xcb_connection_t* is needed.
As it's static the cleanup happens on exit handler and at that time Qt
already destroyed the xcb_connection_t*. With a certain chance this will
crash.

To expose the problem a Q_ASSERT(qApp) is added in the destructor of
XRenderPicture. Using xrenderBlendPicture() will hit this assert on
application exit. This is demonstrated by the added auto test.

The actual fix to the problem is moving the static variable out of
the method and introduce a global cleanup method just like the init
method. This is now called from Workspace dtor, so before application
goes down.

CCBUG: 363251

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D1731
2016-06-13 15:29:07 +02:00
Martin Gräßlin 2343a90aa5 UpdateClientArea from ShellClient::doSetGeometry if the ShellClient has a strut
Summary:
This ensures that resizing a panel updates the client area. On X11 there
is an event when the struts change, but on Wayland the struts are implied
from window type (panel) and the panel behavior, so we need to trigger it
manually.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D1811
2016-06-10 12:56:33 +02:00
Martin Gräßlin 58db477796 Fix the strut handling for wayland clients
Summary:
The implementation was broken as it transformed the QRects into QRegions,
subtracted the geometries and took the bounding rect again. In several
setups this could result in the strut getting ignored.

This change improves the calculation of the struts by creating a QMargin
which describes the area which needs to be subtracted from a screen rect.
The QMargin is only adjusted for the edge the window borders. We can
assume that a window with a strut needs to border a screen on Wayland.

With this change we are also able to support panels between screens.
On Wayland a panel placed on the right of a left screen affects the
maximization area of the left screen, but does not affect the overall
workarea.

CCBUG: 167852

Reviewers: #plasma_on_wayland, #kwin

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D1803
2016-06-10 12:36:15 +02:00
Martin Gräßlin c95ddb7102 Pass the maximized signal to DecoratedClient
Summary:
From the famous category: "How could that code ever have worked".

Maximized state changes were never passed to window decorations. For
X11 windows the decoration updated the state nevertheless, for Wayland
windows the state did not get updated, thus a maximized window had
borders and was shown with a not maximized button.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D1805
2016-06-09 13:35:38 +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 9d0360b3ef [autotests] Skip PlasmaWindowTest::testLockScreenNoPlasmaWindow on build.kde.org
Needs to start kscreenlocker_greet which needs EGL which we don't have.
2016-06-07 10:03:12 +02:00
Martin Gräßlin 0388ed02a6 Call destroyWindowManagementInterface from ShellClient::destroyClient
Summary:
So far destroyWindowManagementInterface was only called when the
ShellClient got unmapped. But it's possible (although not recommended)
to just destroy the Surface without prior unmapping. In that case the
PlasmaWindow got leaked.

This change addresses this problem by always calling
destroyWindowManagementInterface from ShellClient::destroyClient.

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D1762
2016-06-06 08:37:53 +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 76de85b449 Don't setup PlasmaWindowManagement integration for lock screen windows
Summary:
We don't want external processes to know anything about the lock screen
windows. Especially we don't want them to be able to request close on
them.

Thus better never show thus windows to them.

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D1760
2016-06-03 16:22:52 +02:00
Martin Gräßlin 5d396add12 Restrict when to expose a ShellClient to PlasmaWindowManagement
Summary:
For some windows we don't want to create a PlasmaWindow. Not all
ShellClients are something the outside world should see. This change
introduces the first restrictions:
* KWin internal windows are hidden
* transients not accepting focus are hidden

The latter case doesn't work though if the Surface is mapped prior
to creating the shell surface. In such a situation it's racy as KWin
handles the create surface request before we get the setTransient
request. This is difficult to handle as we do want to react quickly.

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D1759
2016-06-03 16:22:52 +02:00
Martin Gräßlin 67b869218f [autotest/wayland] Force kscreenlocker_greet to QMLSCENE_DEVICE softwarecontext
OpenGL/EGL doesn't work on build.kde.org. Because of that the
kscreenlocker_greet aborts on startup and we cannot really test whether
it works on build.kde.org. E.g. we never actually see the window.

This change just makes sure that QMLSCENE_DEVICE=softwarecontext is
passed to the greeter in the LockScreenTest. Hopefully that fixes it
on build.kde.org.
2016-06-03 14:18:45 +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 c04f193532 [libinput] A not valid LibInput::Context should return -1 as filedescriptor
0 is a valid filedescriptor after all.

Autotest extended to cover this case.
2016-06-02 16:23:23 +02:00
Martin Gräßlin 2d9ff54e68 [autotest/libinput] Add a basic test for Context
This test mocks part of KWin::Udev, udev and libinput. The test itself
is still rather limited and only verifies whether libinput is valid or
not and that assignSeat works. Most of the interaction is not yet tested,
though to a large degree doesn't make sense and should be rather tested
in the context of LibInput::Connection.
2016-06-02 15:55:34 +02:00
Martin Gräßlin fdb04e6f75 [autotests] Correct the expected values from 1a23ab7cf0 2016-06-02 10:07:47 +02:00
Martin Gräßlin 1a23ab7cf0 [autotest] Add test case exposing problem of bug 363804
The test case sets up apol's screen setup and the panel as described
in the attachements in bug 363804. As the test shows the panel's strut
is incorrectly ignored.

CCBUG: 363804
2016-06-02 09:29:53 +02:00
Martin Gräßlin 4548ba403b [autotest/libinput] Verify that Event::create can handle a null argument 2016-05-31 10:15:44 +02:00
Martin Gräßlin 1e564989c9 [autotest/libinput] Add a mocked test for Libinput::TouchEvent 2016-05-31 10:14:28 +02:00
Martin Gräßlin 8851bb8daa [autotest/libinput] Add a mocked test for Libinput::PointerEvent 2016-05-31 09:23:48 +02:00
Martin Gräßlin 4b3e8425a3 [autotests/libinput] Add include_directories for libinput
Libinput header is needed by the tests.
2016-05-30 18:03:42 +02:00
Martin Gräßlin ac227e57c7 [autotest/libinput] Add a mocked test for Libinput::KeyEvent
This new test includes everything used in events.cpp to the mocked
functionality of libinput. Only key event is implemented so far, the
referenced pointer and touch functions are mocked with default values.

The test verifies that a KeyEvent gets created and the key press/release
works as expected.
2016-05-30 17:46:53 +02:00
Martin Gräßlin 2e4db5c2b8 [autotests/libinput] Add test case for Device::setEnabled and isEnabled 2016-05-30 16:04:06 +02:00
Martin Gräßlin 69cbb40903 Pass LibInput::Device* through the event handlers
Summary:
The signals emitted by LibInput::Connection carry the Device for which
the input event was received. This Device is passed to the input handlers.

Custom event classes are added which extend QMouseEvent, QKeyEvent and
QWheelEvent respectively and expose the Device. The Device is only passed
around as a forward declared pointer, so even if compiled without libinput
support, it should still compile.

Event handlers which need to get access to the Device can now just cast
the event pointer to the custom class and access it. This can be used in
future to handle device specific key codes, etc.

As we don't have a proper event classes for touch events the event
handlers do not yet have access to the Device. Here the internal API
needs to be adjusted in future.

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D1667
2016-05-30 15:26:37 +02:00
Martin Gräßlin b72e4ec897 Revert "Fix build."
This reverts commit abe582c27d.

To explain: the test uses a mocked implementation of libinput. Because
of that it must not link against libinput. The whole idea is to not link
libinput.

So I'm reverting the addition of libinput to linkage. I don't know the
build error, if it gets presented to me, I'll fix it properly without
having to add a linkage to libinput.
2016-05-30 15:06:30 +02:00
Martin Gräßlin 27523b6ecb [autotests/libinput] Add test case for Device::isAlphaNumericKeyboard 2016-05-30 08:22:04 +02:00
Christophe Giboudeaux abe582c27d Fix build. 2016-05-28 17:09:24 +02:00
Martin Gräßlin 202f4beeba [autotest/libinput] Two more test cases for testLeftHanded
With that all conditions should be covered.
2016-05-25 17:47:49 +02:00
Martin Gräßlin 3aa8dc376e [autotest/libinput] Add test case for the supported pointer buttons 2016-05-25 17:25:58 +02:00
Martin Gräßlin 82d2a2f9f1 [libinput] Track all created Devices in Device
Summary:
Device has a static QVector<Device*> into which each created Device
is added and provides a static method to match a libinput_device* to
the already created Device.

This can be used by the the libinput Event class wrapper to properly
reference the Device the event is for.

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D1665
2016-05-25 12:13:03 +02:00
Martin Gräßlin aeb408d7fe [autotests/libinput] Use GUILESS_MAIN in TestLibinputDevice
No need to have a QGuiApplication for this test.
2016-05-24 11:46:40 +02:00
Martin Gräßlin ff88f93852 Support touch events on KWin internal windows
Summary:
Qt's touch event API is rather difficult and complex to implement.
As none of KWin's internal windows supports multi-touch gestures yet,
this is going the easy route and just simulates a left mouse button
press. If in future need arises for touch gesture support on KWin's
internal windows, this can be added.

Test Plan: Tested on exopc with DebugConsole and auto test

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D1661
2016-05-23 18:40:06 +02:00
Martin Gräßlin d758eae6c5 [autotests/wayland] Try to make PointerInputTest::testMouseActionActiveWindow more robust
It's currently failing on build.kde.org. I'm not able to reproduce the
failure localy so I can only interpret the failure. The failure looks
like a window is still present in the next executed test case thus
breaking the positioning.

This change ensures that the window is properly gone before going into
the next test case.
2016-05-23 11:19:29 +02:00
Martin Gräßlin eb44bbe460 [autotest] Add a test case for KWin::LibInput::Device
Summary:
The usage of libinput is completely mocked. The test covers all the
constant properties read by Device.

There are some features which are not yet tested:
* alphaNumericKeyboard
* supportedButtons
* enabled

The setters for leftHanded and pointerAcceleration are also covered
including the variants where it can fail.

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D1648
2016-05-20 15:51:20 +02:00
Martin Gräßlin 73fae5e63d Support touch events in DecorationEventFilter
Summary:
Touch events are emulating mouse events, in particular left mouse
button.

With this change one can move windows through the decoration, use
the decoration buttons and also support the double click action.

As finding the decoration is pretty much exactly the same as for
pointer events, a new base class is introduces which provides the
functionality of updating the decoration and the shared common
variables.

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1604
2016-05-17 07:33:02 +02:00
Martin Gräßlin 14d12c0585 Do not limit mouse actions to titleBarArea but allow on complete titleBarPosition
Summary:
Mouse actions like wheel and double click were restricted to the titleBar
area. This made the top most pixel non-interactive as it's not part of the
titleBarArea.

This change makes the complete titlebarPosition interactive. That is it
includes for a "normal" (top) setup also the TopLeft/Top/Right section.
Thus the top most pixel can be double clicked, mouse wheeled, etc.

For the Wayland case the test case is adjusted.

BUG: 362860
FIXED-IN: 5.7.0

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1596
2016-05-12 16:58:15 +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 d19690ce98 Honor input mask set on internal windows
Summary:
This ensures that QWindow::setMask works for KWin internal windows.
Without KWin sends all pointer events to the QWindow, even if the
mask says it shouldn't get events.

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1509
2016-05-03 11:10:25 +02:00
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
Martin Gräßlin 44bb78c193 Map all pointer buttons to Qt::MouseButton
The mapping is slightly inspired by the mapping in QtWayland.
But the mapping in QtWayland seems wrong. E.g. there is a linux kernel
button called BTN_BACK which is not mapped to Qt::BackButton.

Anyway we are not really interested in the mapping being 100 % correct
for the case in KWin. KWin internally uses only very few mouse buttons
and all others are only relevant to figure out whether buttons are
pressed. The button code itself is passed to the seat with the native
code.
2016-02-17 11:16:57 +01:00
Martin Gräßlin 61428b164e [autotests] Test move ends when all pointer buttons are released
The MoveResizeWindowTest is extended by a test case to verify that
the move only ends once all mouse buttons are released. So far this
is not yet the case as KWin has an incorrect mapping of buttons to
Qt::MouseButtons.
2016-02-17 11:00:58 +01:00
Martin Gräßlin 5200a484ce [autotest] Adjust LockScreenTest to fix that KSldApp goes to Locked state
So far KSldApp was always either in state AcquiringLock or Unlocked
during the tests. Due to a fix in WaylandServer it now can also enter
the Locked state. But this is timing related and also depends on whether
the greeter works at all. E.g. on build.kde.org the greeter fails to
start, so it never enters the Locked state.

The adjusted test now considers that the state might have changed to
Locked and expects one additional signal to be emitted.
2016-02-17 09:41:17 +01:00
Martin Gräßlin fed7a48112 Revert "[autotest] Let's dare enabling the OpenGL compositor in the tests"
This reverts commit 5e21963a3b.

Unfortunately all tests failed on the CI system, so no GL yet :-(
2016-02-12 15:22:55 +01:00
Martin Gräßlin 5e21963a3b [autotest] Let's dare enabling the OpenGL compositor in the tests
CI system is adjusted, so that OpenGL should work. At least latest
run didn't show the EGL warnings in the lock screen test. So let's
try to enable again. It's possible that this fails horribly. If that's
the case I'll revert again.

The dontCrashGlxgearsTest is kept on QPainter as locally it crashes
on teardown (needs fixing).
2016-02-12 14:18:14 +01:00
Martin Gräßlin a51171720e Improve updating the pointer position after screen changes
The logic should not be tied to whether libinput is used. It's relevant
for all Wayland backends whether they use libinput or not.

In addition this should generate a pointer motion event, so that proper
processing can take place and we get proper pointer enter events.
2016-02-11 14:27:30 +01:00
Martin Gräßlin 79c274b942 [autotest] Add test case for update pointer focus after screen change
The test removes the second screen while the cursor is on it. This
should warp the pointer to the center of first screen and trigger
a focus enter event.

As can be seen by the expect failures currently it's bound to libinput
and also doesn't process the event as if it were a pointer event.
2016-02-11 14:25:04 +01:00
Martin Gräßlin 5b5a966e48 Process pointer warped positions like normal updates
If the pointer is warped the position change should be treated like
a change coming from the input device. Our normal processing should
take place.

A problem in this case is the timestamp to pass to the wayland server.
Normally our timestamps come from the backend/libinput and we don't
know the next one. As an intermediate solution we just use the last
timestamp on the seat. In future a solution could be to not use the
backend's timestamp at all, but have our own timestamp handling.
2016-02-11 12:56:26 +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 f4e28e2c9c Fix typo 2016-02-11 09:34:19 +01:00
Martin Gräßlin c8c33ae398 Implement lock screen security for touch events
When the screen gets locked any existing sequence gets cancelled
and the focused touch surface gets reset. While screen is locked
touch events are filtered to only go to lock screen or input methods.

Test case is added for touch event during lock screen.

Reviewed-By: Bhushan Shah
2016-02-11 08:09:10 +01:00
Martin Gräßlin a311f9bfda Add check for lock screen in InputRedirection::updateKeyboardWindow
Instead of only making the active client the focused keyboard surface,
the method now also performs the lock screen security restriction.

Also just like udatePointerWindow the method becomes public, so that
it can be used from the LockScreenEventFilter and is connected for
lock state changes. This means as soon as the screen locks the current
focused keyboard surface will get a leave event and get an enter event
once the screen unlocks.

The auto test is adjusted to verify these new conditions.

Reviewed-By: Bhushan Shah
2016-02-11 08:09:10 +01:00
Martin Gräßlin 16a33f662b Improve lock screen interaction for pointer in InputRedirection
InputRedirection connects to lockStateChanged to udate the current
pointer window. This way we can ensure that the current pointer
surface gets reset as soon as the screen locks (c.f. the expect
fail in the autotest) and also that it restores to the surface under
the mouse once the screen is unlocked.

The relevant code was not yet lock screen aware and performed an
early exit. Part of the code was fine, e.g. findToplevel is lock
screen aware. So this change adjusts the methods for updating the
internal window and decoration to be lock screen aware, that is they
get reset. With that updatePointerWindow is also lock screen aware.

Thus the LockScreenFilter can also use updatePointerWindow just like
the normal handling and does not need to reimplement parts of it. As
it now relies on other code being correct it has an additional check
to verify that the current pointer surface is a surface which is allowed
to get events. If it isn't the events are not forwarded.

Reviewed-By: Bhushan Shah
2016-02-11 08:09:10 +01:00
Martin Gräßlin 142e826191 Clear touch ids when canceling a touch sequence
Before calling touchUp would hit an abort in KWayland::Server.
2016-02-11 08:09:10 +01:00
Oleg Chernovskiy 61e1a98fb7 Maintenance - fixing naming typos
Fix typos in signal naming var
Fix typo in KWin QPA environment variable
2016-02-09 17:20:12 +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 09cc134bfc [autotests] Test case for lock screen intercepts key events
Our active client should lose keyboard focus when screen gets locked
and re-gain after the screen unlocks.
2016-02-08 16:52:22 +01:00
Martin Gräßlin 500bc9c18c [autotest] Add test case for global shortcuts while screen is locked
They shouldn't be triggered if the screen is locked.
2016-02-08 15:23:06 +01:00
Martin Gräßlin 75261ab9f6 [autotests] Test case for key events on internal windows 2016-02-08 15:03:21 +01:00
Martin Gräßlin 037b3ba66e [autotests] Add test case for effects key handling during screen lock
Verifies that no key events are forwarded to the Effects during a
locked screen.
2016-02-08 12:36:39 +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 66c77bcd31 [autotest] Move window through decoration
Interestingly just trigger the move and instant release doesn't move
the window.
2016-02-04 15:07:03 +01:00
Martin Gräßlin a9f48ec62c [autotest] Test case for hover move on decoration
Verifies that the cursor shapes are adjusted correctly.
2016-02-04 14:20:36 +01:00
Martin Gräßlin 749ec28e23 [autotests] Add test case for double click on window decoration
Shows that currently a tripple-click triggers two double click events.
2016-02-04 11:56:45 +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 7558fcd4b4 [autotest] Extend LockScreen test for global pointer and axis shortcuts
The global shortcuts may not be triggered while screen is locked.
2016-02-04 09:06:15 +01:00
Martin Gräßlin 25d07c22da [autotests] Extend LockScreenTest for locking while moving window
Things which weren't possible on X11 are possible now.
2016-02-03 09:36:12 +01:00
Martin Gräßlin a0cc3aac63 [autotest] Reduce code duplication in LockScreenTest 2016-02-02 16:18:37 +01:00
Martin Gräßlin 1baba74611 [autotests] Verify that Effects don't get pointer events on locked screen
Interesting approach I would not have expected to work. A dummy Effect
class is created in the test and an instance is passed to
EffectsHandler's startMouseInterception. It doesn't verify whether it's
an Effect it knows or has created, so it's totally happy with the dummy.

It shows that motion and press/release are passed to the Effect when
screen is not locked and doesn't while the screen is locked.
2016-02-02 14:41:28 +01:00
Martin Gräßlin 87d1f87cc0 [autotest] Extend lockscreen test
* verifies that pointer axis isn't passed to windows
* verifies that screen edge is not activated while screen is locked
2016-02-02 13:50:13 +01:00
Martin Gräßlin b905fa0f68 [autotests] Adjust lockscreen test to improvements in KSld
On the CI system our tests failed due to the greeter failing to start
due to OpenGL problems. This was because we waited for a window to show
which never happened. Thus the test failed.

This change makes use of the new lockStateChanged signal to determine
when the screen gets locked/unlocked.

It's still possible that the test fails as I'm not able to reproduce
the failure condition on the CI system.
2016-02-02 10:22:37 +01:00
Martin Gräßlin 803d499287 [autotest] Add test case for pointer buttons on locked screen
Extends the lock screen tests by verifying that pointer button
press/release events will be intercepted by the lock screen.
2016-02-01 17:57:38 +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 1790168fb3 [autotests] Test quick tiling when moving a window with the Pointer
Just like the keyboard case. Too much code duplication.
2016-02-01 09:28:06 +01:00
Martin Gräßlin a12fb5ed03 [autotest] Extend QuickTilingTest for keyboard window move
Trigger quick tiling by moving the window. For moving the window only
keyboard keys are used.

The test experienced some problems with the Outline triggering crashes.
To work around them the test disables the Outline by specifying an
invalid configuration.
2016-01-29 09:54:07 +01:00
Martin Gräßlin 1f7daa934d KWin::Application holdes a KSharedConfigPtr with the config
This allows the integration tests to provide their own configuration
as they need it. Setting the configuration should be done before
invoking start()
2016-01-29 09:48:02 +01:00
Martin Gräßlin 5f502c141a [autotests/wayland] Disable KActivities in the tests
Makes our tests time out, we're too fast in shutting down.
2015-12-18 16:40:52 +01:00
Martin Gräßlin 3be016fba4 [wayland] Destroy all ClientConnections on tear down
Ensures that all Wayland objects are destroyed and the cleanup handling
is performed before tearing down the Compositor. This fixes for example
a crash if a Surface with a Shadow is still around at tear down.
2015-11-18 10:29:10 +01:00
Martin Gräßlin f6ef9e8d8c [wayland] Don't use waitForFinished on the Xwayland QProcess
WaitForFinished blocks our main thread, but Xwayland wants to talk
to Wayland and blocks as well. So let's ensure events are processed
while terminating Xwayland.
2015-11-12 15:15:44 +01:00
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
Nick Shaforostoff 3a8d7d866a optimize string operations
-use qstringliteral only when necessary (i.e. not in concat or comparison)
-use qbytearray instead of qstring when dealing with latin1 input and output (glplatform)
-use qstringref to extract numbers from strings (glplatform)
-define qt_use_qstringbuilder to optimize all string concatenations
-anidata: use ctor init lists, add windowType member initialization

REVIEW: 125933
2015-11-05 14:14:06 +00: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 5f8e8985df [autotests] Dashboard is no longer available
Sorry for breaking the autotest.
2015-10-19 14:17:04 +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
David Edmundson 0e1e85d81c Fix unit test
Last commit removed a setGeometry call that I thought was only used to clear an edge (which we don't want) but was in fact crucial to the next test.

REVIEW: 125635
2015-10-14 13:56:30 +01: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
David Edmundson 04ab8554aa Add hint similar to autohide to raise/lower a window
Add action type to screen edge show to allow raise/lower as well as
autohide

Add an action type to screen edge show to allow raise/lower as well as
autohide. This uses the same atom, using a mask to separate type and
location.

The logic for handling geometry changes is moved from the screenedge to
the client so that we can handle both types without screenedge needing
to know what the raise is for.

REVIEW: 124272
2015-10-12 10:37:16 +01: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
Martin Gräßlin eda4f61037 [autotest] Add workaround for broken no-XRandr in screen edge test
With Qt 5.5 the physicalSize of a screen is broken if the X system does
not provide the XRandR extension. This caused our screen edge test to
fail on the CI system (Xvfb) due to approach window being based on the
dpi.

The problem itself is addressed for Qt in:
https://codereview.qt-project.org/126808

This change just worksaround till the change has made it into our CI
system (at which point the expected fails will break).

Reviewed-By: David Edmundson
2015-09-30 15:06:01 +02:00
Martin Gräßlin 1f2087ce7c Merge branch 'Plasma/5.4' 2015-09-30 10:30:47 +02:00
Martin Gräßlin 7365069ba0 [autotests] Adjust TestScreenEdges::testCallback to changes
We need to add more delay to get it trigger/pushback again.
2015-09-30 10:30:10 +02:00
Martin Gräßlin acf668d798 [autotests] Adjust TestScreenEdges::testFullScreenBlocking for changes
We need to wait the reactivation time before getting a pushback again.
2015-09-30 10:30:04 +02:00
Marco Martin 5a55727056 support the slide protocol
take and apply thhe informations from the wayland slide
protocol in the sliding popups effect

REVIEW:125120
2015-09-14 16:39:39 +02:00
Marco Martin 3f5bf65a9e Use the kwayland blur protocol in the blur effect
use the new blur protocol to fetch information about the
region of blur behind to apply to windows like Plasma::Dialog
REVIEW:125017
2015-09-02 14:43:44 +02:00
Thomas Lübking b5e3e4ac4c tests test tests, not code
The test put a reference to the XCB::Window as data
to the _net_wm_transient property, not the window ID
This "works" (you get various garbage transients for
the leader in addition) as long as the window id itself
is the first item in the structure (because that is what
the test resolves to verify what it has done) bug fails
when the XCB::Window structure changes and anything
is the first item (or, btw., when the compiler feels
to re-align the structure and adds some padding...)

So let's fix the test by at least passing the proper
data reference.

is FIXED-IN: 5.4.1
REVIEW: 124888
also see REVIEW: 124864
2015-08-27 22:20:16 +02:00