Commit graph

14537 commits

Author SHA1 Message Date
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
76fa3026dd Merge branch 'Plasma/5.7' 2016-07-13 10:00:35 +02:00
Martin Gräßlin
56c2e158ee Call QCoreApplication::exit instead of stdlib exit to terminate if platform fails
Summary:
We need to properly tear down the application - this can be achieved
through QCoreApplication::exit. Otherwise there is a chance that the
cleanup handling crashes.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2136
2016-07-13 09:38:27 +02:00
Martin Gräßlin
cd9a0afafa [platforms/drm] Properly handle case that mapping the blank buffer fails
Summary:
If it's not possible to create a buffer to blank the output, KWin won't
be able to render to the output. In that case the output should not be
added to the list of outputs.

To support this DrmOutput::blank and DrmOutput::init return bool to
indicate whether they succeeded. DrmBackend handles this situation and
doesn't add the output to the list of outputs if init failed.

If after init there are no outputs KWin is in a state where it won't
be functional. Thus the platform emits the initFailed signal to
terminate.

BUG: 365242
FIXED-IN: 5.7.2

Test Plan: No hardware to reproduce the condition

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2135
2016-07-13 09:37:38 +02:00
Martin Gräßlin
aaf8ce16df [platforms/fbdev] Properly detect a BGR image format
Summary:
If the format of the framebuffer is BGR we cannot create an RGB image
format from it - the rendering is incorrect. Unfortunately QImage does
not support a BGR image format.

To solve this problem we still use an RGB image format but on rendering
the front buffer is rgbSwapped to convert the RGB image to a BGR image.

BUG: 365243
FIXED-IN: 5.7.2

Test Plan: Tested on a neon kvm

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2134
2016-07-13 09:37:02 +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
Jonathan Riddell
66174846f1 Update version number for 5.7.1
GIT_SILENT
2016-07-12 10:32:27 +01:00
Jonathan Riddell
231132ea30 Revert "Update version number for 5.7.1"
This reverts commit d5d1f90a6d.
2016-07-12 10:13:45 +01:00
Jonathan Riddell
d5d1f90a6d Update version number for 5.7.1
GIT_SILENT
2016-07-12 09:57:30 +01:00
David Edmundson
62d09fad12 Fix shadow rendering calculations
BUG: 365097

Reviewers: #plasma

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D2100
2016-07-06 13:16:18 +01: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
l10n daemon script
e43699c4c5 SVN_SILENT made messages (after extraction) 2016-07-01 08:05:19 +00: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
d9d70cbaaf Find KF5Wayland together with other frameworks
CCBUG: 364928
2016-07-01 07:54:53 +02:00
l10n daemon script
ec764e32b6 SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2016-06-30 13:06:15 +00:00
David Edmundson
ff3aced099 Update version number for 5.7.0
GIT_SILENT
2016-06-30 12:53:22 +01:00
Burkhard Lück
94e7adc53c killer/ moved to helpers/killer 2016-06-30 11:25:43 +02:00
l10n daemon script
f1cb59ee39 SVN_SILENT made messages (after extraction) 2016-06-30 08:01:47 +00:00
Martin Gräßlin
1d24264e45 [helpers/xclipboradsync] Ensure that KWayland::Client connects through the passed fd
One needs to call ConnectionThread::setSocketFd in order to not have it
connect through the normal socket.

As WAYLAND_SOCKET is set the implementation would call the correct
functionality anyway. This change only ensures that no wrong debug
message gets logged.
2016-06-29 19:13:00 +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
e91f34f925 Drop warning regarding ksmserver in sm.cpp
Nobody complained that it doesn't work since the release of Plasma 5.
Thus let's assume that it works fine.
2016-06-29 11:06:24 +02:00
Martin Gräßlin
f9baa22f0d Fix unsigned-signed comparison with touch id in input.cpp
The id we internally have is a signed int and might be negative, but
the touch id we get is unsigned. We can savely cast the unsigned to
signed as touch ids are recycled and more than 10 touch points is
unlikely to be useful.
2016-06-29 11:03:43 +02:00
Martin Gräßlin
67f7e8da34 Drop static previous_client from Client::takeFocus
Only set but never read. The debug code for verifying was commented
out as it would no longer compile. Let's just get rid of it completely.
2016-06-29 10:55:20 +02:00
Martin Gräßlin
89b28c32da Correct datatype to qint64 for value returned from QElapsedTimer::elapsed
Was incorrectly passed to a quint64.
2016-06-29 10:52:43 +02:00
Martin Gräßlin
a64fd14f9a [effects/zoom] Remove unused variable 2016-06-29 10:51:47 +02:00
Martin Gräßlin
95449e0843 Fix unused parameter warnings 2016-06-29 10:50:51 +02:00
Martin Gräßlin
133a2f0c29 Move killer/ to helpers/killer
All helper binaries invoked from KWin go to helpers subdirectory.
2016-06-29 10:42:31 +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
aa215e12cc Expose the transientFor relationship to PlasmaWindowInterface
Test Plan: Compiles

Reviewers: #kwin, #plasma_on_wayland, hein

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D1780
2016-06-29 09:19:15 +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
Martin Gräßlin
4bc0c75df2 Merge branch 'Plasma/5.7' 2016-06-29 09:02:49 +02:00
Martin Gräßlin
f79c3f244d On Wayland never try to create a WindowPixmap from an X11 pixmap
Summary:
Our Wayland compositors cannot composite an X11 pixmap. Thus even
if we succeed in creating the pixmap, the changes would not get to
the scene. The code allowed for situation where a surface is not yet
set to fall back to the X11 code path. This can happen for XWayland
windows.

Test Plan: Crash in xclipboardsynctest without the change

Reviewers: #plasma_on_wayland, #kwin

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2010
2016-06-29 09:01:46 +02:00
Martin Gräßlin
758d41d6bf Paint the software cursor directly in SceneQPainter
Summary:
No need to delegate the painting of the software cursor into the backend.
The core has enough information to perform the rendering itself.

This change means less code duplication and all platforms which might use
a software cursor in QPainter compositor gain support for it without any
further adjustments.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2028
2016-06-29 08:50:46 +02:00
Martin Gräßlin
23fb02cce2 Render cursor in multi-screen setup in QPainter Compositor
Summary:
The call to render the cursor was missing in the multi-screen code path
of the QPainter Compositor.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2027
2016-06-29 08:49:46 +02:00
Martin Gräßlin
7ea84cd346 [platforms/drm] If mapping a DrmBuffer for a cursor fails, fallback to software cursor
Summary:
So far the drm platform did not verify whether creating and mapping a
DrmBuffer for a cursor works. This could result in a crash in the worst
case.

This change verfies whether mapping the two cursor buffers works, if
not software cursor is enabled. The code is adjusted to ensure that
none of the cursor buffers is accessed in case software cursor are
enabled.

Please note that right now the drm platform's rendering does not
support software cursors. Thus currently this change results in no
cursor at all. This will be addressed by following patches.

BUG: 364740
FIXED-IN: 5.7

Test Plan:
Verfied that it properly falls back to software cursor,
but could not verify that the crash is actually fixed.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2026
2016-06-29 08:49:17 +02:00
Martin Gräßlin
feadcea6ce [platforms] Call setSoftWareCursor in init instead of ctor
Summary:
Platform::setSoftWareCursor creates connections to the Cursor in order
to trigger repaints whenever the cursor position changes. The Cursor is
created before Platform::init is called, but after the Platform is
created. Thus the call needs to happen in init, otherwise the cursor
is not rendered correctly.

BUG: 356328
FIXED-IN: 5.7.0

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2025
2016-06-29 08:48:24 +02:00
Martin Gräßlin
fd19db0fbe Properly clip the damage region and windows in SceneQPainter
Summary:
On the framebuffer backend the software rendered cursor was creating
rendering artifacts due to incorrect clipping. This change ensures that
in a single screen setup the clipping is performed correctly. For multi
screen a similar change might be required, but we currently don't have
any a way to test that as framebuffer only supports one screen and other
(visual) platforms don't support the software cursor.

CCBUG: 356328

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2024
2016-06-29 08:47:58 +02:00
Martin Gräßlin
d19f9a96b4 Merge branch 'Plasma/5.7' 2016-06-29 08:36:44 +02:00
Martin Gräßlin
3c6dff75d5 Stop composite timer when Workspace gets destroyed
On Wayland tear down the Workspace gets destroyed before the Compositor
gets destroyed. If the timer fires in that area, the Compositor would
crash. It's not possible to start the timer if the Workspace is
destroyed, thus it should also be stoped on Workspace destroy.

Reviewed-By: Bhushan Shah
2016-06-29 08:34:10 +02:00
Bhushan Shah
3ec8e5ce75 Remove completely useless output
This was being repeated everytime a window is created/resized/closed.

Reviewed-by: Martin Gräßlin <mgraesslin@kde.org>
2016-06-29 11:56:18 +05:30
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