Commit Graph

603 Commits (9b69dab63806299b3af58355e5d10ea99abffb75)

Author SHA1 Message Date
Martin Flöser 8f0f84d2b3 [autotests] Try to detect whether distro calls cursor theme DMZ-White or Vanilla-DMZ
Some distributions (e.g. Arch, FreeBSD) call the DMZ-White cursor theme
Vanilla-DMZ. Due to that our tests are failing even if the correct theme
is installed (see also T6623). This change tries to detect whether
DMZ-White is installed by looking into the GenericDataLocation. If not
found we set to Vanilla-DMZ. No guarantee that the check works for all
setups, but it's only tests...
2017-09-24 14:53:55 +02:00
Martin Flöser e74eacd279 [autotests] Try making StartTest more robust on FreeBSD
Use QTRY_COMPARE instead of QCOMPARE to wait longer.
2017-09-23 15:17:19 +02:00
Martin Flöser af20f1aa35 Merge branch 'Plasma/5.11' 2017-09-23 11:51:24 +02:00
Martin Flöser ab7b6757bf Properly update the visible (icon) name when the caption changes
Summary:
It was possible that we performed an early exit when the caption changes
and this results in the visible name being wrong. E.g if we have two
windows called foo, the second one has the visible name "foo <2>". After
changing that to "bar" the bug resulted in it still being the foo
variant instead of getting cleared.

BUG: 384760
FIXED-IN: 5.11.0

Test Plan: Created new test case exposing the problem

Reviewers: #kwin, #plasma, hein

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D7871
2017-09-23 11:50:48 +02:00
Martin Flöser a17c85a9ea Support mapping QKeyEvent to xkb_keysym_t
Summary:
This is needed in virtual keyboard and also used KKeyServer so far. With
this change it is moved to new API provided in Xkb. The new translation
map is now also used for the direction from Qt::Key +
Qt::KeyboardModifier to xkb_keysym_t.

New implementation is supported by a new test case covering the same
combinations as in the existing direction.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D7356
2017-09-19 19:09:17 +02:00
Jesse Pullinen 0eba3f3c18 Fix TouchEvent::id() returning -1, fixes a crash
Summary:
Libinput returns -1 when calling libinput_event_touch_get_slot on an event
from a single-touch touchscreen. The returned value is used in
DecorationEventFilter to determine the touch which is acting on it. The value -1
is used to signify that the decoration is not being acted on. Thus when
releasing the touch, it checks whether it was being dragged, and as it thinks
it isn't, it doesn't handle it and the decoration is still being dragged.
Clicking on the decoration then crashes kwin.

Test Plan: Move a window by dragging the decoration with a single-touch touchscreen.

Reviewers: #kwin, graesslin

Reviewed By: #kwin, graesslin

Subscribers: graesslin, kwin, #kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D7854
2017-09-19 07:11:40 +03:00
Martin Flöser 5256338772 [autotests] Force more tests to use evdev as XKB_DEFAULT_RULES
Should help fixing the tests on FreeBSD.
2017-09-18 21:05:34 +02:00
Martin Flöser e55e437d86 [autotests] Force XKB_DEFAULT_RULES to evdev in ModifierOnlyShortcutsTest
This is an idea to fix the failing test on FreeBSD (see T6624). For
Linux this does not change anything.
2017-09-17 20:54:32 +02:00
Martin Flöser 4fa41165d1 Move XRandR event filter into XRandRScreens
Summary:
The code in events.cpp was problematic as it was called in a Wayland
session. So KWin changed outputs, this gets mirrored to XWayland and
then KWin reacted on the XRandR event and might have even changed the
refresh rate due to that - bad idea.

This change moves the code into the already existing X11EventFilter for
XRandR events in XRandRScreens.

Test Plan: Run kwin_x11 in gdb on Xephyr, breakpoint in new code and triggered XRandR event

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D7654
2017-09-12 18:53:08 +02:00
Martin Flöser 50470e97c6 [autotests] Drop cast to SceneOpenGL GenericSceneOpenGLTest
Not really needed, instead we can compare on the compositing type.
2017-09-08 16:06:33 +02:00
Martin Flöser e0f95fd913 Delay syncing internal window geometry to end of cycle
Summary:
The syncing of the window geometry to the internal geometry can
unfortunately cause a freeze in very special conditions:
1. create QML component
2. a Plasma::Dialog gets created
3. It creates the DialogShadows
4. This triggers QGlobalStatic creation which locks a non-recursive
mutex
5. The creation of DialogShadows creates a Registry and triggers a
roundtrip on the Wayland server
6. KWin processes all Wayland events
7. This triggers the creation of a ShellClient
8. The ShellClient has a PlasmaShellSurface which requested a position
9. The new geometry does not match the geometry of the Plasma::Dialog
10. ShellClient syncs the geometry to the Plasma::Dialog
11. Plasma::Dialog updates the theme because window geometry changed
12. This accesses the DialogShadows...

which is still in the non recursive mutex and we have a freeze.

By delaying the sync to the end of cycle we jump out of this deadly
sequence.

BUG: 384441

Test Plan:
The freeze doesn't hit any more. It's possible that some test
cases need adjustments.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D7712
2017-09-07 19:06:54 +02:00
Martin Flöser c398db3c45 Provide a virtual Scene::qpainterRenderBuffer() -> QImage* method
Needed by testing of QPainter scene to access the back buffer. Exposed
as a virtual method in Scene, so that the test does not have to cast to
SceneQPainter.
2017-09-01 17:44:49 +02:00
Martin Flöser 546d603182 [autotests] Remove not needed includes for scene_qpainter.h 2017-09-01 17:44:49 +02:00
Martin Gräßlin 1e13deaa1d Port some displayWidth/displayHeight usages to Screens::size()
Summary:
KWin::displayWidth and KWin::displayHeight are bound to X11 which
doesn't make much sense on X11. In addition KWin internally knows
the overall display dimensions through the Screens singleton class.

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D1798
2017-09-01 17:11:10 +02:00
Martin Flöser 6685288d48 Add <number> to Wayland captions if the caption is the same
Summary:
Bringing another caption feature from X11 to Wayland. If we have
multiple windows with the same caption, starting from the second window
a suffix <number> is added.

E.g. if we have three windows with caption "foo", the naming is:
 * foo
 * foo <2>
 * foo <3>

The change tries to use as much shared code between the X11 and Wayland
implementation. Unfortunately it's not possible to share completely as
the X11 implementation does X11 specific things like editing the visible
name.

By sharing the code the numbering also works cross windowing system.
That is if a window is called "foo" on X11, a new window on Wayland with
caption "foo" will get adjusted to "foo <2>" and vice versa.

The change also eliminates a duplicated signal for captionChanged in
ShellClient (found by test case).

By using the shared implementation on X11 side a bug gets fixed which
got introduced with the support of "unresponsive", this is no longer
considered and the numbering still works even if there is a window which
is unresponsive.

Test Plan: New test case and manual testing

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D7425
2017-09-01 17:02:36 +02:00
Martin Flöser 833f933c5c Move X11 specific event filtering for ScreenEdges into x11 standalone platform
Summary:
This change splits out the X11 specific event filtering into a dedicated
X11EventFilter. It is created in the x11 standalone platform plugin when
the first Edge is being created.

Some of the X11 specific code is removed from ScreenEdges, though more
refactoring is possible in ScreenEdges to share more code between X11
specific and generic implementation.

Test Plan: Run KWin on Xephyr, screen edge approach effect still shows

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D7406
2017-09-01 17:01:01 +02:00
David Edmundson b57a525ef7 ARGB buffers are premultiplied
D7460 in kwayland assumes all WL_SHM_FORMAT_ARGB8888 buffers have
opacity premultipied RGB values.

Kwin tests need updating to do the same.
Rendering code did not need changing.

Test Plan: Tests now pass

Reviewers: #plasma, graesslin

Reviewed By: #plasma, graesslin

Subscribers: plasma-devel, kwin, #kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D7607
2017-08-30 10:02:29 +01:00
Martin Flöser 28534e3664 [autotests] Fix testX11TimestampUpdate after latest change
We need to init the X11 standalone platform plugin now.
2017-08-24 21:48:29 +02:00
David Edmundson f0971532c9 Send output enter/leave events to surfaces
Summary:
A surface has an API to know which screen(s) it's on, this is useful
especially for knowing the scale it should render at.

In practice Qt currently doesn't do anything with this information; but
that's set to change.

Test_helpers is changed as we need to create output objects in order for
wl_surface to map them.

Closes task T4467

Test Plan:
Attached unit test.
As mentioned above, it doesn't have any real world impact currently, so not a lot
to test.

Reviewers: #plasma, graesslin

Reviewed By: #plasma, graesslin

Subscribers: johanhelsing, graesslin, plasma-devel, kwin, #kwin

Tags: #kwin

Maniphest Tasks: T4467

Differential Revision: https://phabricator.kde.org/D7359
2017-08-24 17:57:30 +01:00
Martin Flöser c87230c3a5 Use xcb-icccm to read the name property
Summary:
The KWindowSystem call which we used doesn't work on Wayland as it's only
implemented in the xcb variant and cannot be made available for Wayland
in an easy way as it is still XLib based.

This change turns the optional XCB-ICCCM dependency in a required one
and thus can use the functionality provided by said library to implement
what KWindowSystem provided.

BUG: 382789

Test Plan: New test case which failed with old code

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D7046
2017-08-21 17:58:52 +02:00
Martin Flöser 70bc9524d9 Send QKeyEvent with Qt::Key as expected by Qt to internal windows
Summary:
KWin passes the current keysym converted to a Qt::Key in the QKeyEvent.
The current keysym does not always change when a key gets released, so
when pressing a shortcut the release carry a Qt::Key which could be
considered as wrong.

QtWayland transforms the actual pressed/released key into a keysym and
passes that through the QKeyEvent. This change does the same for the
internal windows. A new QKeyEvent is created and adjusted in a way that
it matches what Qt expects.

Why not change everything to how Qt expects it? The key is used at
various places and in KWin internally we expect the behavior how it is
currently implemented. So it's better to use Qt's expectation only when
interacting with Qt.

Also the change carries a workaround for a bug in QKeySequenceEdit
(see QTBUG-62102) and transforms Super to Meta. As this adjustment only
makes sense for the internal windows we need to send in an adjusted
QKeyEvent anyway, so another argument for using the Qt behavior only in
this place.

Test Plan:
Can set a shortcut on Wayland and it can be used to activate
the window.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D6828
2017-08-19 11:37:08 +02:00
Martin Flöser f88c322a3b [platforms/x11] Use a GlxContextAttributeBuilder
Summary:
Based on the work of 3f4995fb9b this change
introduces a GlxContextAttributeBuilder to make the requesting of context
attributes cleaner, more verbose and less error prone copy and paste.

Test Plan:
Switched between Core and legacy and verified the output;
extended auto test

Reviewers: #kwin, #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D6411
2017-08-19 11:34:51 +02:00
David Edmundson 34de2c2b5c Track outputs in kwin integration tests
Summary:
Split from the last review, as in order to track output's removed (in
any way that's useful) the registry needs to be on the heap and the change grew.

Test Plan:
Every test that previously passed on my system still does
Though currently that's not every test (for some reason) which was
my main motivation for splitting.

Reviewers: #plasma, graesslin

Reviewed By: #plasma, graesslin

Subscribers: plasma-devel, kwin, #kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D7377
2017-08-18 15:15:19 +01:00
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