Commit Graph

630 Commits (01c1870e9dde6a73d1202be43c638fa16deb1e64)

Author SHA1 Message Date
Martin Flöser 5d101ce297 Migrate Xkb::toQtKey away from KKeyServer
Summary:
Turn Xkb into a QObject

Reduced dependencies on other classes and allows to emit signal directly
instead of emitting a signal on another class.

Dependency inject KWayland::Server::SeatInterface into Xkb

No need to depend on WaylandServer from within Xkb.

[autotests] Add test case for Xkb::toQtKey

Tests all key codes KKeyServer is able to map to Qt.

Migrate Xkb::toQtKey away from KKeyServer

The regression in kwindowsystem in
32526718eae99ccb594360627586eebdf793372b showed once more that it's time
to migrate the xkb keysym to Qt::Key mapping away from KKeyServer. The
main problem with KKeyServer is that it's made for X11 and we don't have
X11 here. This causes warnings printed at runtime and the code only
works by accident at all because KKeyServer fails to initialise
modifiers. That is normally KKeyServer would include the modifiers, but
that is nothing we are interested in for mapping xkb keysyms to Qt::Key.

So to address this, KWin now implements the mapping itself. It's based
on the implementation in KKeyServer, but also improved by providing
faster xkb to Qt conversion (which matters for KWin more than the other
direction).

Long term plan is to extend this so that also on X11 it can be used.
Then it should be split out and be used in KKeyServer as a replacement
for the current implementation which could support both X11 and Wayland.

Test Plan:
New test case added which covers all keysyms supported by
existing KKeyserver mapping

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D7336
2017-08-16 19:22:53 +02:00
Martin Flöser 801fe41013 [autotests] Add test case for Xkb::toQtKey
Tests all key codes KKeyServer is able to map to Qt.
2017-08-16 19:22:53 +02:00
Martin Gräßlin f50fbde1a9 Always emit Client::captionChanged when the caption changed
Summary:
With ddf3536f19 a regression got
introduced resulting in Client::captionChanged not being emitted if
Client::setCaption was called without the force parameter.

The regression is only in master branch.

BUG: 383444

Test Plan: Added test case passes

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D7290
2017-08-13 19:23:10 +02:00
Martin Gräßlin f9e0e8a980 [autotests] Try making KWinBindingsTest::testSwitchWindowScript more robust
Another random failure on build.kde.org (see T6546). This tries to use
QTRY_COMPARE on the SignalSpy's count instead of a wait in the hope that
this can handle the multi-threaded situation better. Though it might
also be possible that the other thread just didn't run in the 5 sec we
waited.
2017-08-13 17:08:49 +02:00
Martin Gräßlin d0c2c1ed09 [autotests] Add test case for updating X11 client captions
CCBUG: 383444
2017-08-13 16:52:14 +02:00
Martin Flöser bbca8c6677 Implement the shortcut caption suffix for Wayland windows
Summary:
The generation of the shortcut caption part is moved from Client to
AbstractClient. The ShellClient also has a captionSuffix and implements
the full part in caption.

Overall this needs more refactoring to support more sharing between the
two implementations. But one step at a time.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D7093
2017-08-12 11:31:33 +02:00
Martin Gräßlin 5118d9470c [autotests] Try making QuickTilingTest::testShortcut more robust
It failed on CI. A possibility is that the wait for the quick tile
changed took to long, so that the next wait already passed and thus
failed. Instead of wait a QTRY_COMPARE on the size of the signalspy.
2017-08-09 19:22:36 +02:00
Martin Gräßlin 5ff9aa7cf5 [autotests] Try making StrutsTest::testWindowMoveWithPanelBetweenScreens more robust
Flaky on build.kde.org. Let's add some more time between the movements.
2017-08-09 17:54:42 +02:00
Martin Flöser 8379030633 [autotests] Try to make translucencyTest more robust for CI
Changing a QVERIFY into QTRY_VERIFY in hope to make it more robust
on the highly flaky build.kde.org servers.
2017-08-08 20:48:40 +02:00
Martin Flöser af9f833a1d [autotests] Disable Outline in StrutsTest
The StrutsTest is constantly aborting on build.kde.org and lots of
OpenGL stuff in output. This could indicate a problem with the Outline
as the failing test could trigger the Outline. So let's try to disable
it.
2017-08-08 19:56:24 +02:00
Martin Flöser 20e314d151 Properly render XWayland windows in SceneQPainter
Summary:
The buffer for a XWayland window is larger than the actual size. Thus
we need to use the clientSize as reference, not the buffer size.

BUG: 382748

Test Plan: Test passes

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D6952
2017-08-02 19:30:29 +02:00
Martin Gräßlin b3a52e3999 [autotests] Drop PlasmaSurfaceTest::m_connection
Credits to clang for finding unused private variable.
2017-07-31 18:02:00 +02:00
David Edmundson 0809a357c1 Improve testWindowScaled test
Summary:
Comparing a pure blue square isn't a very effective test as someone
cropping the image will still pass.

Reviewers: #plasma, graesslin

Reviewed By: #plasma, graesslin

Subscribers: plasma-devel, kwin, #kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D6982
2017-07-31 15:12:37 +01:00
Martin Flöser 1447f4641c [autotests] Fix unused function warnings
The functions are defined in a common header but not used in all tests.
This creates needless warning noise, so hide them through an ifdef.
2017-07-29 18:47:58 +02:00
Martin Flöser 64da6c8d1e Replace Workspace::slotWindowQuickTileFoo by a quickTileWindow with argument
Summary:
Thanks to std::bind we don't need that many different slots to setup the
global shortcut connections. Instead we can have one shared
implementation which takes the argument and passes it to the window.

To support std::bind arguments in kwinbindings the initShortcut method
and dependencies are adjusted as well as a new macro is added.

As I don't want to include abstract_client.h in workspace.h a new enum
is created for the quick tiling flags used in Workspace. This caused a
larger refactoring as the change to an enum class also caused quite some
changes.

Test Plan: Affected test cases still pass

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D6783
2017-07-29 17:40:03 +02:00
Martin Flöser e8a92361ae [autotests] Perform complete QImage comparison in SceneQPainterTest::testX11Window
As pixel comparison is failing, let's just compare the image against a
reference image.
2017-07-28 21:17:59 +02:00
Martin Flöser f6c964a32b [autotests] Another change for SceneQPainterTest::testX11Window to make it pass CI
Still missing ideas, theory is that rendering on Xwayland is too slow and
we have an invalid buffer or that reparenting took to long.
2017-07-28 06:50:00 +02:00
Martin Flöser a13ecb1cac [autotests] Try to make SceneQPainterTest::testX11Window more robust
Still failing on CI, let's try  to verify that the buffer is ready.
2017-07-27 21:34:48 +02:00
Martin Flöser d39fea1b67 [autotests] Try to make SceneQPainterTest::testX11Window more robust
It fails on build.kde.org which might be a side effect.
2017-07-27 20:36:52 +02:00
Martin Flöser 54ca2bba25 [autotests] Add test case for incorrect rendering of XWayland on SceneQPainter
CCBUG: 382748
2017-07-27 17:09:40 +02:00
Martin Flöser 1557f102f4 [autotests] Add test cases for verifying that Toplevel::window() is only set for X11
Also at the same time verifies that root info active client is only
set on X11.
2017-07-26 07:08:27 +02:00
Martin Flöser f5f14475b5 [autotests] Try to make PlasmaWindowTest::testCreateDestroyX11PlasmaWindow more robust
The test was racing on build.kde.org and failing due to that. We have
a condition there where we wait for some parts being transmitted through
X and some through Wayland. The test assumed X is faster and failed due
to that.
2017-07-25 21:19:11 +02:00
Martin Flöser c29d6093ba Implement support for window shortcuts for Wayland windows
Summary:
Moves most of the implementation from Client to AbstractClient, so that
it can be used for both Client and ShellClient. Only the X11 specific
code is kept in Client.

Not yet implemented is updating the window caption.

Unfortunately the testing of this feature showed that setting a window
shortcut is not working on Wayland at all (the Qt widget doesn't properly
catch the shortcut). So this feature is currently only of erm theoretical
use.

Test Plan: Added new test case. No testing in real world as explained.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D6818
2017-07-25 07:12:42 +02:00
Martin Gräßlin a1af59e9dd [autotests] Extend X11ClientTest::testFullscreenLayerWithActiveWaylandWindow
Unfortunately still doesn't trigger the actual bug.
2017-07-23 20:02:57 +02:00
Martin Gräßlin bd158a6321 Reset last_active_client when a ShellClient is removed
Summary:
The last_active_client is set when an AbstractClient gets activated. For
the X11 case the last_active_client was getting reset to nullptr when
the last_active_client gets destroyed. But for the ShellClient that did
not yet happen. This could result in a crash.

This change addresses the problem and adds a test case which triggered
the crash. The condition of the crash are difficult to generate though -
it took me about an hour to write the test for the crash.

1. Wayland client must be active
2. Explicit focus to null (no active client)
3. destroy Wayland window
4. X11 client which sets focus on itself without interaction with window
  manager

Test Plan: test case no longer crashes

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D6852
2017-07-23 16:21:38 +02:00
Martin Flöser dcbfa0869b [autotest] Add a test case for X11 fullscreen windows when an Wayland window is there
KWin cannot handle the layering correctly when a Wayland window is active
and there is a fullscreen X11 window. This test tries to simulate the
situation, but it does not show it.

Nevertheless it's a good test, so let's add it.

CCBUG: 375759
2017-07-23 11:50:58 +02:00
Martin Flöser 8cd95b56e3 [autotests] Add test case for sending window to desktop shortcuts 2017-07-21 07:12:36 +02:00
Martin Flöser b1efdbaaf1 [autotest] Test opposite direction in switchWindow 2017-07-20 21:52:17 +02:00
Martin Flöser 84b0578a71 [autotests] Add test cases for switchWindow
A new test class for KWinBindings added which is intended to group the
testing of the various slots set up in kwinbindings.cpp. As the scripts
also delegate to the slots this is also tested.
2017-07-20 20:49:42 +02:00
Martin Flöser c9fa43e9db [autotests] Add test case for Client window shortcut
Registers a shortcut on a window and triggers it.
2017-07-20 19:00:01 +02:00
Martin Flöser 81c59a86dd [autotests] Try to make new QuickTilingTest addition more robust on CI
A wait on signalspy fails on CI and a TRY_COMPARE on the count of the
spy should be sufficient.
2017-07-18 21:29:50 +02:00
Martin Flöser bbbd2f6a24 [autotests/integration] Extend QuickTilingTest for keyboard shortcut and scripting 2017-07-18 21:11:06 +02:00
Martin Flöser 73fa7b21a1 [qpa] Use the new OpenGLContextAttributeBuilder to create Qt's OpenGL context
Summary:
Introduces a few more attributes needed for creating the OpenGL context
used by the QPA.

Test Plan:
Extended test and run KWin/Wayland and verified that OpenGL context
gets created correctly.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D6734
2017-07-17 16:53:37 +02:00
Martin Flöser 8e2805ce9d Merge branch 'Plasma/5.10' 2017-07-17 16:53:08 +02:00
Martin Flöser 139b4dc82a Properly swap the quick tile side when pressing the shortcut again
Summary:
The quick tile shortcuts have a feature of moving the window to the next
screen if one presses the same shortcut again.
E.g. if a window is quick tiled to the left on the right most screen,
quick tile again to left should move it to the left screen and quick tile
right. Thus it swaps the borders.

This wasn't handled correctly, especially not for modes like top and
bottom. If a window is quick tiled to the top an impossible mode was
generated: Left | Right. Doesn't make sense.

This change fixes the mode swapping and extends our quick tile testing
to cover the situation.

BUG: 382313
FIXED-IN: 5.10.4

Test Plan: Extended test case

Reviewers: #plasma, #kwin

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D6708
2017-07-17 16:51:31 +02:00
Martin Flöser 672cae9a7d Implement support for restricted move area on Wayland
Summary:
This change implements a missing TODO to generate the restricted move
area for windows with struts (aka panel) on Wayland.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D6611
2017-07-11 17:52:01 +02:00
Martin Flöser 14c8440f11 Restrict move resize area only on the screen the strut window is on
Summary:
By allowing panels between screens in 5.8 to have a strut we created a
"regression" in KWin. KWin always was wrong, just we didn't notice as
neither Plasma nor previously Kicker set a strut on panels between shared
screen edges.

The strut is created from the edge of the overall screen setup. This
means a panel on the left edge of a screen on the right has the strut
starting from the left screen. KWin uses the strut to restrict the move
resize area: a window decoration is not allowed to go below a strut. Thus
it becomes impossible to move the window from the right to the left
screen.

This change tries to solve this problem by only restricting the move area
on the screen the window with the strut is on. E.g. if the window is on
the right screen, the left screen is not affected. Thus it's possible
again to move a window from one screen to the other as the added test
case shows.

Unfortunately there are still corner cases where this won't work
correctly. If the window is on both screens this won't work. It is also a
rather heavy change for KWin and thus it's targeted for master and not
for the 5.10 or the 5.8 branch. If we notice that the patch works well
and doesn't create further issues, it should be considered for
backporting.

BUG: 371199
CCBUG: 370510
FIXED-IN: 5.11

Test Plan: Added test case

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D6562
2017-07-11 17:51:39 +02:00
Martin Flöser aa4d12a906 [autotests] Ensure TestDontCrashUseractionsMenu uses breeze
The test introduced with 962a2e39ee is
meant to be used with the breeze widget style as that one triggered the
crashy code. Given the test coverage build.kde.org does not run with the
breeze widget style, so enforce this through manual loading.
2017-07-08 10:47:17 +02:00
Martin Flöser 0d941c6e27 Merge branch 'Plasma/5.10' 2017-07-06 21:18:18 +02:00
Martin Flöser 962a2e39ee [qpa] Prevent crash due to Surface getting null
Summary:
This is a regression due to changes in Breeze to support Qt 5.8+ behavior
change. KWin's own QPA operates like < Qt 5.7 and breeze was programmed
against that. Due to that it can happen now that Breeze hits code paths
in which KWin does not have a surface.

To trigger one only needed to open the user actions menu twice.

This change adds a test case which simulates the problem and fixes all
crashes happening in the code path.

Most likely shadows are now broken for KWin's own windows, this change is
only to prevent the crash and thus is for 5.10 branch, while shadow
fixing will go to master branch.

BUG: 382063
FIXED-IN: 5.10.4

Test Plan: New test case

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D6533
2017-07-06 19:14:15 +02:00
Martin Flöser adceb9c0c9 Merge branch 'Plasma/5.10' 2017-07-01 08:21:16 +02:00
Martin Flöser 113be5fac8 Restore active client after ending showing desktop
Summary:
Showing desktop requests focus on the desktop window. This means the
active window is reset. When ending showing desktop the state was not
restored.

This change addresses this problem by requesting focus to the best
window.

BUG: 375993
FIXED-IN: 5.10.4

Test Plan: New autotest and manual testing

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D6420
2017-07-01 08:20:01 +02:00
Martin Flöser 3f4995fb9b Refactor the specification of OpenGL context attributes
Summary:
The current way to specify the OpenGL context attributes does no longer
scale as can be seen in D6344. There are too many different context
attribute sets and with every addition we grow lots of copied code. The
chances to introduce errors in that code which is difficult to debug are
very high. As can be seen in the glx backend which defines major 1,
minor 2, but it should be major 2, minor 1.

This change reworks this code by creating a builder class which contains
only an abstract definition of what needs to be in the attributes.
E.g. the version, whether it's robust and so on.

Now we can just have a list of possible attributes in a well described
way:
    auto builder;
    builder.setVersion(3, 1);
    builder.setRobust(true);

All possible builders are added to a list and operated on in a for loop
which tries to creat a context. Once it succeeded it breaks the list.
In addition a debug statement is added which prints out the set of
options which went into the context.

So far this is only done for EGL, GLX can follow once D6344 is merged.

Test Plan: New unit test added, kwin_wayland OpenGL tests run and verified

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D6396
2017-06-26 22:13:47 +02:00
Martin Flöser 004c0f3892 [autotests] Test creating core context profile
Extends OpenGL testRestart to once with GLCore and once with legacy.
2017-06-25 09:48:46 +02:00
Martin Flöser 66f0839925 [autotests] Introduce a SceneOpenGL ES test
The SceneOpenGLTest is transformed into a GenericSceneOpenGLTest which
can create either an OpenGL or an OpenGL ES scene based on env variable
which it sets in initTestCase. The env variable to set is passed as a
ctor argument from the SceneOpenGLTest and the new SceneOpenGLESTest.

This allows to easily run the same test code for both our OpenGL and
OpenGL ES compositor.
2017-06-24 21:05:49 +02:00
Martin Flöser e2682c8405 [autotests] Extend pointer constraints test for closing window of locked pointer 2017-06-24 20:31:50 +02:00
Martin Flöser 33ca5025e7 Merge branch 'Plasma/5.10' 2017-06-20 07:11:16 +02:00
Martin Flöser c45e165514 Fix switch desktop through edge when moving window
Summary:
There was a regression introduced in ScreenEdges when introducing the
activatesForPointer method. It considered the switch desktop on edge,
but not the special case of switch desktop when moving windows. Due to
that the edges did not activate when moving the window.

This change addresses the regression and extends the autotest to ensure
it's properly covered.

BUG: 380440
FIXED-IN: 5.10.3

Test Plan: Manual testing and extended auto test

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D6257
2017-06-20 06:57:33 +02:00
Martin Flöser 56e681823b [autotest] Disable default TabBox on touch screen edge in ScreenEdgeClientShowTest
Not needed and the QML doesn't work well in tests.
2017-06-19 21:54:11 +02:00
Martin Flöser 0364fae4b9 [autotests] Fix ScreenEdgeClientShowTest::testScreenEdgeShowHideX11 on new CI
On the new CI system this test is failing. This might be a variation of
Qt 5.10 as I'm able to reproduce with Qt 5.10. From the investigation it
is not a bug in KWin. The test was failing due to a missing xcb_flush.
This happens when we go back to the event loop which seems not to happen
in proper timing. By adding a qWait we force to go to the event loop, the
flush is performed and the test passes.
2017-06-19 21:45:58 +02:00
Martin Flöser 0df09a8cbb Better handle cases when the xkb keymap fails to be created
Summary:
If the keymap cannot be created a few pointers in Xkb are null.
We should make sure to not call any xkbcommon functions on those
null pointers and instead use proper fallbacks.

This change introduces fixes for a few usages, but it's not unlikely
that there are more cases.

BUG: 381210
FIXED-IN: 5.10.3

Test Plan:
Autotest added for the condition of the bug, which does
not crash any more. Just starting the test found a few more crash
cases.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D6260
2017-06-18 21:04:58 +02:00
Martin Flöser 6a4e9cbb58 Merge branch 'Plasma/5.9' into Plasma/5.10 2017-05-12 07:08:04 +02:00
Martin Gräßlin 229be65e40 Improve the escape key handling for breaking constrained pointers
Summary:
So far KWin started to filter out the escape key as soon as it gets
pressed. This was done by unsetting keyboard focus. The idea was to
reset keyboard focus when it is only a short press and that then the
keyboard state is correct for the application. But in practice this
does not work. The only application currently supporting pointer
constraints (Xwayland) does not do anything on a key which is pressed
when gaining keyboard focus. The result is escape not working in
pointer constrained Xwayland windows.

This change addresses this problem by changing the interaction to only
unset keyboard focus when our break constraints condition is met. This
should also result in the application not handling the key release, but
it means it gets the key press. Unfortunately I don't have a good way
to test.

BUG: 378452

Test Plan: None

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D5488
2017-05-12 07:06:44 +02:00
Martin Gräßlin c3e2ea6c21 Merge branch 'Plasma/5.9' 2017-05-05 19:16:38 +02:00
Martin Gräßlin cacfdf3676 Merge branch 'Plasma/5.8' into Plasma/5.9 2017-05-05 19:14:10 +02:00
Martin Gräßlin 0bec9ad733 Improve the x11 timestamp handling
Summary:
So far KWin only updated the x11 timestamp if the new timestamp is larger
than the existing one. While this is a useful thing it creates problems
when the 32 bit msec based time stamp wraps around which happens after
running an X server for 49 days. After the timestamp wrapped around KWin
would not update the timestamp any more and thus some calls might fail.
Most prominent victims are keyboard and pointer grab which fails as the
timestamp is either larger than the server timestamp or smaller than the
last grab timestamp.

Another problem related to timestamp handling is KWin getting broken by
wrong timestamps sent by applications. A prominent example is clusterssh
which used to send a timestamp as unix time which is larger than the
x timestamp and thus our timestamp gets too large.

This change addresses these problems by allowing to reset the timestamp.
This is only used from updateXTime (which is normally invoked before we
do things like grabKeyboard). Thus we make QX11Info::getTimestamp the
ultimate trusted source for timestamps.

BUG: 377901
BUG: 348569
FIXED-IN: 5.8.7

Test Plan: As I cannot wait 50 days: unit tests for the two conditions added.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D5704
2017-05-03 21:36:34 +02:00
Martin Gräßlin b221d529a2 [autotests] Fix touch screen edge test after setting a default
Changes the config mocking to not have an action on the left edge which
conflicts with the test condition.
2017-05-02 21:17:41 +02:00
Martin Gräßlin 207eb167e1 [autotests/integration] Fix SceneQPainter::testWindowScaled
A code of line was missing.
2017-05-01 17:10:42 +02:00
David Edmundson 80f21064f1 Merge branch 'scaling' 2017-04-29 14:11:13 +01:00
Martin Gräßlin 857d8a9c37 Add a KSharedConfigPtr for kcminputrc to KWin::Application
Summary:
There are a few places where KWin needs to read values from kcminputrc.
As I need to add yet another one it makes more sense to properly
structure it like in other cases and have only one kcminputrc hold in
the application. This also allows to better mock the config values in
the integration tests.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D5540
2017-04-24 21:01:03 +02:00
Martin Gräßlin e9a44a275e Support blocking of screen edges on active fullscreen windows also for touch
Summary:
This change ensures that the blocking condition of screen edges is also
honored for touch screen swipe gestures.

Test Plan: Only the added test case

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D5403
2017-04-22 08:16:31 +02:00
Martin Gräßlin b132fe7c24 Add support for keyboard layout switching policy "winclass"
Summary:
This is quite similar to the policy "window" - the main difference is
that windows from the same application share the layout. So only
switching to a window from another application changes the layout.

This change is the last policy to add for support of all the policies we
have on X11.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D5365
2017-04-22 08:15:59 +02:00
Martin Gräßlin c8274dbe57 Add support for keyboard layout switching policy "window"
Summary:
This policy stores the layout for each window which becomes active
and restores the layout once it gets activated again.

Test Plan: Added test case

Reviewers: #kwin, #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D5315
2017-04-22 08:15:45 +02:00
Martin Gräßlin bf99d9ffdd Introduce support for keyboard layout switching policies
Summary:
This change introduces the initial support for keyboard layout switching
policies like in the X11 session. This first change only adds support for
Global and Virtual Desktop policy. This means the current layout is
stored in context to the current virtual desktop. Whenever one changes
the virtual desktop the previous layout is restored. If the user has not
yet navigated to this virtual desktop a switch to default layout is
performed.

This is the first code interacting with the new Virtual Desktop API which
is not based on integer ids. To fully support this the API is slightly
extended.

Test Plan: Added test case

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D5301
2017-04-22 08:15:25 +02:00
Martin Gräßlin 9a13743c49 Don't update the focused pointer Surface if a button is pressed
Summary:
During pointer motion we already had the condition that an update of
focused pointer surface can only happen when no button is pressed. But
there are more conditions where we try to update the focused pointer even
if a button is pressed. E.g. if the stacking order changes.

This happens when trying to move one of Qt's dock widgets:
 1. Press inside a dock widget
 2. Qt opens another window, which is underneath the cursor
 3. KWin sends pointer leave to parent window
 4. dock widget movement breaks

This change ensures that also this sequence works as expected and the
pointer gets only updated when there are no buttons pressed, no matter
from where we go into the update code path.

BUG: 372876

Test Plan: Dock widgets in Dolphin can be moved now.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D5461
2017-04-20 17:02:42 +02:00
Martin Gräßlin c3ecf55bf8 Do not handle ScreenEdges::check for Edges which don't activate for Pointer
Summary:
On X11 the edges reserved only for pointer started to show the approach
geometry. This problem is addressed by this change.

Touch screen events do not go through this method, neither is it used on
Wayland.

Test Plan: Tested on X11, problem fixed

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D5421
2017-04-20 17:02:16 +02:00
Martin Gräßlin 2132b1e0c8 [effects] Use arg="true" in the kcfg files
Summary:
By changing all kcfg to have arg="true" we can pass in the same
KSharedConfigPtr into all effects. This allows to have fake config in
the tests and in the planned effect demo mode.

Also it means that we don't have to hardcode the name kwinrc into the
files. In the configs - where we cannot access the effectshandler - we
use the define KWIN_CONFIG which gets generated based on the compile
time arguments.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D3571
2017-04-15 10:03:34 +02:00
Martin Gräßlin 259e373bfc [tabbox] Expose noModifierGrab to QtQuick
Summary:
There is a special mode in TabBox which is the noModifierGrab mode. This
is Alt+Tab active without a modifier being hold. This mode is entered
when being activated through screen edges (either pointer or touch). So
far this was not exposed to QtQuick and thus one could not end the mode
using pointer or touch. It is possible to select another window, but not
to activate it. That required the press of a keyboard key.

This setup is rather unfortunate. By exposing the mode to QtQuick we can
react from QtQuick side to it and invoke already exposed functionality to
select and item and directly activate it - existing left-over from the
Plasma Active window switcher.

Test Plan:
Tested on X11 and Wayland with an adjusted lnf package. It kind
of works, but there are additional issues on both X11 and Wayland.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D5414
2017-04-12 19:46:48 +02:00
Martin Gräßlin 3259d5e113 Cancel popup if the user clicked window decoration of parent window
Summary:
So far the window decoration was not considered and e.g. right clicking
the window decoration resulted in two open popups - one by KWin and one
by the application. This change addresses the problem by ensuring the
popup gets cancelled if the decoration is clicked. It's considered not
being part of the window.

Test Plan: Added test case which fails without the change

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D5388
2017-04-11 20:22:32 +02:00
Martin Gräßlin 2be1625822 Add support for new touch screen callbacks to KWin scripts and scripted effects
Summary:
Exposes two new global JS functions to register and unregister touch
screen edges.

Test Plan: Added test case

Reviewers: #kwin, #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D5277
2017-04-07 16:18:09 +02:00
Martin Gräßlin 63b1138307 Add support for new touch screen edge actions to declarative KWin scripts
Summary:
This change introduces a new property mode in ScreenEdgeItem to switch
between Pointer and Touch mode. The touch mode interacts with the new
touch screen edge gestures through a QAction.

Test Plan: New test case added

Reviewers: #kwin, #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D5272
2017-04-07 16:17:48 +02:00
Martin Gräßlin e6aabf5b9f Add callback functionality for touch screen swipe gestures
Summary:
This is implemented through QActions following the general approach
inside KWin and not the older approach used by ScreenEdges for pointer
callback activation.

Test Plan: Extended auto test

Reviewers: #kwin, #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D5263
2017-04-07 16:16:34 +02:00
Martin Gräßlin 64ce6259a9 Introduce dedicated actions for touch screen swipe gestures
Summary:
The new touch gestures activated for the same actions as configured for
mouse pointer actions. This has disadvantages as the only configured
default screen edge action cannot be triggered (corner) on touch. On the
other hand setting a default touch gesture would be rather annoying with
pointer as a default.

So overall it makes sense to split the actions and have dedicated pointer
and dedicated touch actions.

This change introduces the first part of it and splits the handling in
general. We now have:

Activates for pointer and touch:
 * client (auto-hiding panels)

Activates for pointer only:
 * the configured action
 * virtual desktop switching
 * callbacks

Activates for touch only:
 * the new touch action

The touch actions are implemented similar to the pointer actions which
slight improvements in the code which will be backported to the pointer
actions.

Introducing callbacks will be the next step. I plan to do it a little bit
different by using QActions as that's what KWin internally uses for
everything except screen edges.

Test Plan: Manual testing and improved auto tests

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D5252
2017-04-07 16:16:18 +02:00
Martin Gräßlin 1193b0da77 Initial support for popup window handling
Summary:
So far KWin did not properly handle popup windows. That is when a popup
surface got created and a click outside the surface happened KWin did not
send out the popupDone Wayland event.

This change makes KWin aware of whether a surface is a popup and tracks
through a new PopupInputFilter whether there are popup windows. In case
there are popups the new filter waits for mouse press events and cancels
the popups if the press does not happen on any surface belonging to the
same client. To quote the relevant section of the Wayland documentation:

    The popup grab continues until the window is destroyed or a mouse
    button is pressed in any other client's window. A click in any of the
    client's surfaces is reported as normal, however, clicks in other
    clients' surfaces will be discarded and trigger the callback.

So far the support is still incomplete. Not yet implemented are:
 * support xdg_shell popup windows
 * verifying whether the popup is allowed to be a popup
 * cancel the popup on more global interactions like screen lock or
   kwin effect

BUG: 366609
FIXED-IN: 5.10

Test Plan: Auto test and manual testing with QtWayland client

Reviewers: #plasma, #kwin

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D5177
2017-04-07 16:14:50 +02:00
Kai Uwe Broulik 1eb950a985 Desaturate non-responsive windows
When an application is not responding, its window is desaturated to communicate this.
Also "(Not Responding)" is added to the title bar.

Differential Revision: https://phabricator.kde.org/D5245
2017-04-05 11:16:23 +02:00
Martin Gräßlin 67295336e5 Add support for interactive selection through touch events
Summary:
This was forgotten during implementing the interactive window/point
selection. With this change it is also possible to perform the
interaction through touch events. In that case KWin takes over any
existing touch sequence.

This implements T5315.

Test Plan: Added auto test and took a screenshot through touch events

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D5203
2017-03-31 07:44:38 +02:00
David Edmundson 59515b1681 Scale QPainter x11 windowed backend
Reviewers: #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D3495
2017-03-29 20:53:22 +01:00
Martin Gräßlin dce674f3ae [autotests] Adjust ShellClientTest to changes in 634dfc09e4
The desktopPresenceChanged signal is no longer delayed by one cycle.
2017-03-29 06:49:12 +02:00
Martin Gräßlin 4adb2b65e8 [autotests] Add test case for showing auto-hiding panel through swipe gesture 2017-03-28 22:01:16 +02:00
Martin Gräßlin aa6c8f8116 Add support for activating screenedges through touch swipe gestures
Summary:
Each Edge creates a SwipeGesture for touch activation. The swipe needs to
be a single finger starting from the edge into the screen for at least
20 %. The SwipeGesture and GestureRecognizer is extended to support the
use cases of the touch screen edge swipe.

New features supported by the gesture system are:
 * minimum and maximum position
 * a minimum delta for the swipe
 * progress signal based on the minimum delta
 * starting a swipe with a start point

The Edge has the progress signal connected to its approach signal, thus
visual feedback is provided through the screen edge effect.

The screen edge system supports touch only for the edges (corners are
too difficult to activate on touch screens). At the moment the following
features are supported:
 * screen edge show/raise of windows (e.g. auto hidden panels)
 * trigger the configured action
 * trigger the configured callback function (e.g. script)

In future it might make sense to add a touch specific configuration
action to support different actions for screen edges activated by mouse
and touch.

BUG: 370323

Test Plan:
configured a screen edge and triggered through touch,
added an auto-hiding panel and triggered through touch

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel

Tags: #plasma_on_wayland

Differential Revision: https://phabricator.kde.org/D5106
2017-03-27 17:44:02 +02:00
Martin Gräßlin 22c91df2ec Add support for global touchpad swipe gestures
Summary:
This change adds global touchpad swipe gestures to the
GlobalShortcutsManager and hooks up the swipe gestures as defined at the
Plasma Affenfels sprint:
 * swipe up: Desktop Grid
 * swipe down: Present Windows
 * swipe left: previous virtual desktop
 * swipe right: next virtual desktop

The main work is handled by two new classes: SwipeGesture and
GestureRecognizer. This is implemented in a way that it can be extended
to also recognize touch screen gestures and pinch gestures.

The SwipeGesture defines what is required for the gesture to trigger.
Currently this includes the minimum and maximum number of fingers
participating in the gesture and the direction. The gesture gets
registered in the GestureRecognizer.

The events for the gesture are fed into the GestureRecognizer. It
evaluates which gestures could trigger and tracks them for every update
of the gesture. In the process of the gesture tracking the
GestureRecognizer emits signals on the Gesture:
 * started: when the Gesture gets considered for a sequence
 * cancelled: the Gesture no longer matches the sequence
 * triggered: the sequence ended and the Gesture still matches

The remaining changes are related to hook up the existing shortcut
framework with the new touchpad gestures. The GlobalShortcutManager
gained support for it, InputRedirection and EffectsHandler offer methods
to register a QAction. VirtualDesktopManager, PresentWindows and
DesktopGrid are adjusted to support the gesture.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel

Tags: #plasma_on_wayland

Differential Revision: https://phabricator.kde.org/D5097
2017-03-27 17:43:44 +02:00
Martin Gräßlin 0bb587dcb9 Ensure PointerInputRedirection::processMotion finishes prior to warping
Summary:
Consider the following situation: we have three InputEventFilter linked
in the sequence A - B - C.

The input filters are processing pointer motion events. The expected
behavior is that the new motion is processed in the sequence
   A -> B -> C

So far this did not work correctly if the pointer gets warped during the
processing. If e.g. filter B warps the pointer we get a motion sequence:
   A (1) -> B (1) -> A (2) -> B (2) -> C (2) -> C (1)

The filters following the one warping the pointer get first the newer
than the older position. This is obviously wrong. Unfortunately it is not
just a theoretical condition, but a condition happening when interacting
with the screenedges, which warp the pointer.

This change introduces a PositionUpdateBlocker in
PointerInputRedirection::processMotion to ensure that a processMotion
call finishes prior to the next update. If the PositionUpdateBlocker is
blocked the new position gets scheduled and processed once the
PositionUpdateBlocker gets destroyed.

With this we get the expected sequence for B warping pointer:
   A (1) -> B (1) -> C (1) -> A (2) -> B (2) -> C (2)

This should hopefully improve the interaction with screen edges on
Wayland.

CCBUG: 374867

Test Plan:
Added an auto test demonstrating the issue of incorrect
ordering caused by screenedges. Prior to the change the test is failing.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D5182
2017-03-27 07:08:10 +02:00
Marco Martin a25a06b6fa remove offending test
in reference to discussion on
https://phabricator.kde.org/D4718
2017-03-16 18:30:39 +01:00
Marco Martin a7b7ce9ec0 new logout effect
Summary:
new logout effect: it's just a slow fade in of the logout
greeter (window is usable immediately tough

Test Plan: logout greeter now fades in without setting the window opacity manually

Reviewers: graesslin, #plasma

Reviewed By: graesslin, #plasma

Subscribers: broulik, plasma-devel, kwin, #kwin

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D5045
2017-03-15 17:47:22 +01:00
Marco Martin c0b207a2b5 support for auto-hidden windows to resize
Summary:
auto hidden windows were shown again when their geometry
changed, this was done for being as easy as possible as
the unhide zone changed, but the behavior looked very
annoying as autohide panels with an self resize taskbar
would unhide themselves every time any window gets open
or closed.
This makes the edge keep track of
windows that can resize/move themselves while auto hidden

Test Plan:
a self-resizing autohidden panel with a taskbar in it doesn't auto unhide
anymore when a window is opened or closed.
the unhide area gets properly updated

Reviewers: graesslin, #plasma

Reviewed By: graesslin, #plasma

Subscribers: luebking, plasma-devel, kwin, #kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D4718
2017-03-08 23:55:20 +01:00
Martin Gräßlin cf79de5f36 Merge branch 'Plasma/5.9' 2017-02-14 07:37:00 +01:00
Martin Gräßlin 8b4f284249 [autotests] Add test case for quick tiling on X11
Exposes our regressions of X11 quick tiling when a window is vertically
maximized.

CCBUG: 376155
2017-02-14 07:29:38 +01:00
Martin Gräßlin 40de5fa75f Only export the org.kde.keyboard DBus service if there are at least two layouts
Summary:
It doesn't make much sense to export the DBus service if there is nothing
one can do with it.

Test Plan: Added test case

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D4562
2017-02-11 11:37:45 +01:00
Martin Gräßlin df76d83087 [autotests] Add test case for per-keyboard-layout global shortcut
This new test method verifies that the global shortcut functionality
to switch to a specific layout functions correctly.
2017-02-11 09:46:33 +01:00
Martin Gräßlin 94f8011914 Merge branch 'Plasma/5.9' 2017-02-07 22:06:57 +01:00
Martin Gräßlin 16647c3a3c Require Qt 5.7 and remove pre-5.7 code
Summary:
Increases minimum Qt version to 5.7. This allows to drop the pre-5.7
virtual keyboard and various ifdefs for now unsupported versions.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D4485
2017-02-07 20:43:19 +01:00
Martin Gräßlin 8edd0336e6 Support creation of PlasmaShellSurface prior to ShellSurface
Summary:
So far KWin did not support the sequence:
1. Create wl_shell
2. Create PlasmaShellSurface
3. Create wl_shell_surface

KWin only supported the case that the PlasmaShellSurface is the last
thing to get created. This is rather limiting and can be considered a
bug. At least we had a QEXPECT_FAIL auto test for this situation. So
it was a known issue.

This change should make it easier to support the QtWayland changes in
Qt 5.8.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D4482
2017-02-07 19:26:36 +01:00
Martin Gräßlin b16bd4147a Ensure the layoutChanged DBus signal gets emitted when changing layouts through DBus
Summary:
Unfortunately Xkb does not emit a signal when the keyboard layout
changes. Due to that we need to manually check in KeyboardLayout after
each action which could change the layout whether the layout changed.

This was not yet done for the case when the layout got changed through
the DBus interface. Resulting in the DBus signal not emitted.

This change addresses the issue by invoking the check for change after
changing the keyboard layout.

Test Plan: Added test case

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D4387
2017-02-06 19:36:30 +01:00
Martin Gräßlin d33c96af5e [autotests] Add test case for changing keyboard layout through DBus
Calls setLayout of org.kde.KeyboardLayouts.
2017-01-31 19:42:55 +01:00
Martin Gräßlin 8d9c4acf4d Provide kxbk config through kwinApp
Summary:
So far KWin parsed the kxbkrc at multiple places (once in Xkb, once
in KeyboardLayout). This is now replaced by one KSharedConfigPtr hold
by kwinApp, just like the normal kwinrc. The KSharedConfigPtr is now
passed to Xkb.

As a nice side effect this makes it easier to test keyboard layout
changes as we can now properly mock the keyboard configuration. Thus
this change also comes with an autotest for loading keyboard layout
configuration. This is becoming more and more a need as we start
getting bug reports for layout specific issues like global shortcuts
not working with Greek layout.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D4315
2017-01-30 17:04:03 +01:00
Martin Gräßlin c35aae2c4f Merge branch 'Plasma/5.9' 2017-01-30 17:03:46 +01:00
Martin Gräßlin 5083adb1b8 Call performMoveResize when we got a new geoemtry during resize
Summary:
So far on a geometry sync we did not call performMoveResize like we
do on X11 when getting the sync. This resulted in the
clientStepUserMovedResized not getting called during resize and the
geometry update effect to not function.

BUG: 374869
FIXED-IN: 5.9.1

Test Plan: Geometry hint updates

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D4333
2017-01-30 17:02:13 +01:00
Martin Gräßlin 3088b50ad4 Merge branch 'Plasma/5.9' 2017-01-29 14:03:51 +01:00
Martin Gräßlin a67f4dfa65 [autotests] Add test case for resizing window manually
During resize the signal clientStepUserMovedResized signal is not emitted
for Wayland windows which causes the window geometry effect to not
function. This change adds a test case highlighting the problem.
2017-01-29 14:01:15 +01:00
Martin Gräßlin de444194ed Improve MoveResizeWindowTest::testMove expected fail cases
Instead of having an expect fail on every check for the count of signals
emitted for clientStepUserMovedResized we reset after the first one which
is the actual issue.

Thus we can properly check that in the other cases the signals are
emitted.
2017-01-26 20:41:58 +01:00