Commit Graph

225 Commits (69cbb40903ecc47b7745f512f09a150489bb3f9d)

Author SHA1 Message Date
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
Martin Gräßlin 53004b95ff Port left over qDebug to qCDebug 2015-07-31 13:25:51 +02:00
Martin Gräßlin bffbbce172 [scripting] Add dedicated logging category 2015-07-31 13:25:51 +02:00
Martin Gräßlin c31bb6d46f Drop KF5::Service dependency where it's no longer needed 2015-07-07 09:53:48 +02:00
Martin Gräßlin 93ef184356 PluginEffectLoader doesn't use KPluginTrader any more
Requires that plugins change to new KPlugin json metadata.
2015-07-07 09:36:15 +02:00
Martin Gräßlin ca14073b54 Port scripted effect loading from KService to KPackage
Advantage: no more ksycoca cache for loading scripted effects.
2015-07-06 16:50:33 +02:00
Boudewijn Rempt 6ddf294b55 Warnings--: unused parameters 2015-06-12 17:17:21 +02:00
Thomas Lübking be339d7ed3 Merge branch 'Plasma/5.3' 2015-06-04 01:46:12 +02:00
Thomas Lübking 3f8a8ea32a align to c4140d6f4e
activation is now supposed to happen instantly
2015-06-04 01:43:27 +02:00
Thomas Lübking 3597959c0e add Screens::name(int screen); STUB but for XRandr
required to compare __GL_SYNC_DISPLAY_DEVICE and
later on to assign windows to an output rather than
a screen number
2015-05-15 23:55:27 +02:00
Thomas Lübking c7f13c7266 add refreshRate to Screens. STUB but for XRandr!
the randr refreshrate is calculated from the current mode
2015-05-15 23:55:27 +02:00
Thomas Lübking 0508528461 # This is a combination of 2 commits.
# The first commit's message is:

do not switch desktop on resizing windows

REVIEW: 123599

# The 2nd commit message will be skipped:

#	fix screenedge flipping merge
2015-05-15 23:55:26 +02:00
Thomas Lübking 5779e6844d add Screens::name(int screen); STUB but for XRandr
required to compare __GL_SYNC_DISPLAY_DEVICE and
later on to assign windows to an output rather than
a screen number
2015-05-15 21:59:44 +02:00
Thomas Lübking 03ab846da8 add refreshRate to Screens. STUB but for XRandr!
the randr refreshrate is calculated from the current mode
2015-05-15 21:59:36 +02:00
Thomas Lübking 5d09eaae1f do not switch desktop on resizing windows
REVIEW: 123599
2015-05-15 21:58:37 +02:00
Martin Gräßlin 6826b9eb94 [autotests] Adjust to changes regarding AbstractClient
We need a Mock for AbstractClient and our mock Client needs to
inherit from it.
2015-05-08 12:43:47 +02:00
Martin Gräßlin cfe84aa9de [autotests] Fix TestScriptedEffectLoader::testLoadAllEffects 2015-04-09 14:58:05 +02:00
Martin Gräßlin bcf5eedb0f [autotests] Drop linking against XCursor
No longer needed.
2015-03-20 15:42:29 +01:00
Michael Pyne 85d87297b0 Return false for a bool instead of nullptr.
Fixes compiler warning (error by default in gcc 5).

REVIEW:123077
2015-03-19 23:22:46 -04:00
Martin Gräßlin 0d51952d78 Provide x11Connection as a property on the KWin::Application
KWin::connection() uses the property to resolve the value instead of
using QX11Info. In practice this doesn't change anything at the moment,
but allows kwin_wayland to provide an xcb connection without depending
on QX11Info.

As we cannot make xcb_connection_t* available as a metatype, the
property's type is set to void*.
2015-03-17 09:44:53 +01:00
Martin Gräßlin fe9873e4b1 Provide x11RootWindow as a property on the KWin::Application
KWin::rootWindow() uses the property to resolve the value instead of
using QX11Info. In practice this doesn't change anything at the moment,
but allows kwin_wayland to provide a root window without depending on
QX11Info.
2015-03-17 09:44:53 +01:00
Martin Gräßlin 857219546f Update x11Time when a global shortcut is pressed
KGlobalAccel sets the timestamp as a property and we need to set our
x11Time to it otherwise following keyboard grabs might fail.

Requires 61e2a156678eef033b2629f7c72530dc78d7c3ac in kglobalaccel.
2015-02-25 08:15:53 +01:00
Martin Gräßlin dfa89cc050 Port reading Motif hints to XCB
A wrapper class for MotifHints is added to xcbutils. This class manages
the information about the read Motif hints, so that Client doesn't need
to have a copy of the read states.

The class is designed in a way that during Client::manage we get rid of
another roundtrip.

REVIEW: 122378
2015-02-06 13:43:57 +01:00
Martin Gräßlin 48fcaa5656 Add Xcb::GeometryHints class
It's a convenient class to encapsulate the ICCCM WM_SIZE_HINT.
Instead of exposing just the properties it provides accessors for
the interesting parts and applies sanity checks.
2015-01-27 12:48:03 +01:00
Daniel Pastushchak 0d997b1093 Introduce categorized logging for kwin core
Done by Daniel Pastushchak for KDE during GCI-2014.
2014-12-05 14:27:15 +01:00
Martin Gräßlin 40ce3e4ce3 [autotests] Give Xephyr more time to startup
The test is flaky during the wait for Xephyr. Giving it more time should
hopefully make it more reliable.

The better way would be to switch to the command line argument
-displayfd pipeFd

unfortunately the Xephyr on the CI system does not yet support this
command line argument.
2014-12-01 10:53:40 +01:00
Martin Gräßlin 2eb876743c [screens] Replace DesktopWidgetScreens by XRandRScreens
A new implementation of the Screens interface is added which uses XRandR
directly instead of relying on QDesktopWidget. The implementation is
provided in a new implementation file screens_xrandr.cpp.

XRandRScreens comes with a unit test. Unfortunately it's rather difficult
to provide a proper unit test against XRandR. Xvfb (which is obviously
used on the CI system) doesn't provide the XRandR extension. Also on a
"normal" developer system one would not want to just execute the test as
the results are not predictable (number of available outputs?) and the
test would mess up the setup resulting in nobody wanting to execute the
test.

As a solution to both problems the unit test starts Xephyr as a nested
X server. This allows to have at least some limited tests against XRandR.
Nevertheless there are a few things which I was not able to test:
* multiple outputs
* no output at all

The nested X Server approach makes the interaction rather complex. Qt
opens it's connection against the main X Server thus QX11Info provides
a wrong connection and also KWin::connection() which is heavily used by
xcbutils and thus all the RandR wrappers have the wrong connection. To
circumvent this problem the test is GUILESS. In case it would call into
any code using QX11Info, it would probably either runtime fail or crash.

REVIEW: 117614
2014-11-27 09:00:19 +01:00
Martin Gräßlin 1bb1ab44af Add test case for ScreenEdge::check
Behaves similar to the check with enter notify event.
2014-09-27 12:28:54 +02:00
Martin Gräßlin 6b8075ddbf Test case for Client activation on screen edge 2014-09-27 08:18:20 +02:00
Martin Gräßlin 883445d5e8 Add an auto-test for ScreenEdges
The new test does not cover ScreenEdges completely, so far the
following areas are handled:
* creating of the edges
* reserving of edges
* trigger callback
* cursor pushback
* blocking of edges for fullscreen active clients
2014-09-26 14:01:44 +02:00
Martin Gräßlin 1416ff0994 Fix VirtualDesktopGrid::size for one desktop
The default was set that the grid size for one desktop is (1, 2)
which doesn't make any sense at all - it should be (1, 1).

This most likely only affects the unit test as in production the
default layout is taken fron NETRootInfo.
2014-09-25 12:49:18 +02:00
Martin Gräßlin a7cf808dea Improve the TestScreens autotest 2014-09-25 08:45:23 +02:00
Martin Gräßlin 1e2f491176 Improve auto-tests for xcbutils.h 2014-09-24 21:04:15 +02:00
Martin Gräßlin 237ee7fcc7 wayland_client and wayland_server moved to kwayland
kwayland is provided by kde:kwayland and is located at
kde/workspace/kwayland

It's an optional build dependency needed only for kwin_wayland.
2014-09-19 13:59:51 +02:00
Martin Gräßlin 4eadc9daef [auto-tests] Add an initial test for Screens
This is a very interesting auto test as Screens uses both Workspace
and Client. Thus it operates in the "impossible to mock" area.

The solution is to provide mock includes in autotests and ensure that
when building the auto-test the mock header includes will be picked
first. There is now a mock class for Workspace and Client providing
just the API pieces used inside Screens.

As Screens is abstract and we cannot properly interact with
QDesktopWidget there is also a MockScreens class inheriting from Screens
and mocking the required functionality (by just operating on a list of
QRects).

The auto-test itself is only performing checks on the abstract class.
The mock class is indirectly tested by Screens calling into the virtual
methods. The test case is not yet complete, but looking quite good
already.
2014-09-17 10:29:03 +02:00
Martin Gräßlin d2e4b4300e [autotests/wayland_client] Make TestWaylandShell more robust 2014-09-03 21:31:10 +02:00
Martin Gräßlin 7b2d7d9c54 [autotests/wayland_client] Improve TestWaylandShell
Uses our own Wayland server instead of starting Weston and adds
tests for the interface removed signals.
2014-09-03 21:13:25 +02:00
Martin Gräßlin 515903cc33 [kwin_wayland] Test that Seat gets destroyed when Display terminates 2014-09-03 20:02:42 +02:00
Martin Gräßlin 7e27f2fc0c [kwin_wayland] Test adding/removing Outputs in TestWaylandServerDisplay 2014-09-03 20:01:54 +02:00
Martin Gräßlin 5852a4c069 [kwin_wayland] Add SeatInterface to server module
So far the Seat interface is provided together with pointer and
keyboard. As always touch is not yet implemented. The pointer interface
is still lacking the set cursor callback. Keyboard on the other hand is
complete.

Both Keyboard and Pointer have the concept of a focused surface and only
to the bound interface belonging to the same client as the focused
surface events are sent.

The change comes with a set of new auto tests also verifying the client
side which wasn't possible before as we couldn't fake events.
2014-09-02 10:55:33 +02:00
Martin Gräßlin 106b540d91 [kwin_wayland] Add Shell and ShellSurface to server module
ShellSurfaceInterface is not yet completely implemented. Several parts
are still TODO, e.g. move/resize is missing, setting to maximized is
missing and also flags for fullscreen are missing.

The surface test is extended as far as possible.
2014-09-02 10:55:33 +02:00
Martin Gräßlin 35c4786820 [kwin_wayland] Add support for shm buffers in server module
The Display provides a method to create the shm pool and a
BufferInterface class is added to the server module. It is created
from the SurfaceInterface when a buffer gets attached to the surface.
The BufferInterface can be referenced and once its unreferenced it
sends a buffer release to the client and destroys itself.

For the case that the buffer is a shm buffer the BufferInterface
provides a convenience method to turn it into a QImage.

The auto test for Surface is extended by attaching buffers to the
surface and verifying that the content is correct.
2014-09-02 09:52:16 +02:00
Martin Gräßlin cb7cabe98e [kwin_wayland] Add CompositorInterface and SurfaceInterface
As far as it's currently possible to implement. CompositorInterface is
able to create a surface and emits the created SurfaceInterface. It
does not yet support regions.

The SurfaceInterface is already more complete. It keeps track of the
double buffered states and emits signals when one of the values are
changed after the committing. It supports frame callbacks and has a
hook to mark the frame as rendered.

What's still missing are the regions (as it's not implemented in
CompositorInterface) and attaching the buffer as we do not yet support
creating shm buffers and pools.

The client side test is changed to use our own server and extended to
test damage and frame callback. The test needs to be extended for scale
and transform, but that is still missing in the client side
implementation.
2014-09-02 09:52:16 +02:00
Martin Gräßlin 1e230fda77 [kwin_wayland] Initial addition of the WaylandServer module
So far this new module contains:
* Display
* OutputInterface

Display manages the server socket and server event loop. In general it's
the entry point to any part of the server.

OutputInterface is the abstraction for the wl_output interface on server
side. An OutputInterface is created through the Display.

The auto tests for ConnectionThread and Output are adjusted to use the
internal server instead of starting Weston. Especially the Output test
could be extended to test much more as we have absolute control over
the server now.
2014-09-02 09:52:16 +02:00
Martin Gräßlin e11df5b4f5 [kwin_wayland] Keep the size in Surface
Technically the Surface itself does not have a size, it's the
ShellSurface or the size of the FullScreenShell's Output. But it
simplifies a lot if we keep track of the size in the Surface as that
way we can hide the fact which kind of Shell is used.

The user of the Surface must connect either the FullscreenShell's
Output or the ShellSurface to set the size on the Surface.
2014-09-02 09:52:16 +02:00
Martin Gräßlin 94654a12dd [kwin_wayland] Track all created Wayland::Surface
Add static accessors to get all Surfaces and the Surface for a
wl_surface to Wayland::Surface.
2014-09-02 09:48:05 +02:00
Martin Gräßlin 7d059c8b08 [autotests/wayland_client] Don't build TestWaylandFullscreenShell for Wayland < 1.5
The fullscreen shell is only provided with at least Weston 1.5.
It should be checked on runtime, but that's difficult as Weston doesn't
fail if it cannot find the shell.so. So we disable it based on the
assumption that if Wayland library is not 1.5 the Weston is also not 1.5.
2014-08-27 12:59:32 +02:00
Martin Gräßlin 0b0a48ca08 [kwin_wayland] Create a dedicated class for Compositor
Wraps the compositor interface.
2014-08-27 08:57:06 +02:00
Martin Gräßlin ce8c4240f7 [kwin_wayland] Create a dedicated Surface class
A Surface class is split out which holds a wl_surface and supports
attaching a buffer, setting the damage and emitting a signal when the
frame callback got called.

It doesn't come with a unit test yet as it first needs the ShmPool
and Buffer properly split out to easily set it up.
2014-08-27 08:57:06 +02:00
Martin Gräßlin 8c4bc3ba45 [kwin_wayland] Split out wl_shell and wl_shell_surface into dedicated classes
New classes Shell and ShellSurface are created. Both are in shell.[h|cpp]
to indicate their close relationship with the Shell having to create the
ShellSurface.

WaylandBackend is adjusted to hold a Shell* and ShellSurface* instead of
the lower level structs. This also required adjustements to the creation
of the Backend as it now doesn't set a default size any more. Thus the
backendReady signal may not be emitted before the initial configure
event arrived. This also makes it easier to support either the fullscreen
shell or wl_shell at the same time.

Of course a unit test is added for the two new classes. This needs to
be extended once we have more control over the mock Wayland server.
2014-08-27 08:57:06 +02:00
Martin Gräßlin d2f1e936f1 [kwin_wayland] Move Wayland::Output into dedicated source files
At the same time adding an autotest for the Output, moving the listener
into the Output class and providing enums for Subpixel and Transform.

KWin now requires wl_ouput interface version 2 as that allows us to emit
the changed signal in a better way.

The unit test is not yet capable of testing everything, we need a mock
Wayland server which is more flexible.
2014-08-27 08:57:05 +02:00
Martin Gräßlin d19b6c0241 [kwin-wayland] Add support for FullscreenShell
The FullscreenShell is a Wayland protocol provided by Weston to have
exactly one surface per output. This is exactly what KWin needs. So
in case the Wayland server we connect to provides the FullscreenShell
we prefer it over the normal Shell and mapping our surface as fullscreen.

The protocol is not yet part of wayland-client library, so the header
and source file needs to be generated. This is done during the build
process using the external tool wayland-scanner. The protocol
description is copied from the Westion 1.5 sources.

REVIEW: 119839
2014-08-27 08:55:40 +02:00
Fredrik Höglund 0aff9830df Remove the decoration opacity property
It has been broken since cross-fading was introduced, and no one has
filed any bug reports about it.
2014-08-25 17:25:04 +02:00
Martin Gräßlin 5cc66f12ac [autotests/wayland_client] Add --use-pixman and remove --no-config
Needed for running the weston on the ci-system.
2014-08-21 13:46:13 +02:00
Martin Gräßlin bd5fe4f785 [kwin_wayland] Add a Wayland::Registry class
The Wayland::Registry class wraps wl_registry handling. It keeps track
of the interfaces in the registry and emits signals whenever a known
interface gets announced or removed. So far it only tracks the interfaces
which are used and needed by KWin.
2014-08-18 14:05:35 +02:00
Martin Gräßlin 3185530ed6 [kwin-wayland] Create dedicated thread for wayland connection
The Wayland event queue is moved into a dedicated thread and a
new class is created for just creating the connection and listening
for events. The WaylandBackend creates the thread and uses an event
queue for the main thread.

REVIEW: 119761
2014-08-18 08:51:24 +02:00
Marco Martin 490e733590 Distinguish empty and non existent properties
This restores the behavior on KWin4: if I set an X property that doesn't have any data on a window, it's still information, so this makes the Xcb wrapper return an empty QByteArray that is not null.
EffectWindow::readProperty() now returns an empty QByteArray constructed the same way as it was in KWin4.

REVIEW:118645
BUG:335446
2014-06-11 11:08:02 +02:00
Martin Gräßlin 7fcecc616c Drop "kwin4_effect_" prefix for BuiltIn Effects
This removes all the hacks to add kwin4_effect_ to the name of the Effect
and adjusts the desktop files of the effect configuration's parent
component.

Note: the scripted effects still start with kwin4_effect_ prefix.

REVIEW: 117367
2014-04-28 13:52:50 +02:00
Martin Gräßlin b45eeae352 [Xcb::Wrapper] Introduce a Property and StringProperty Wrapper subclass
The Xcb::Property can wrap the xcb_get_property call and provides
convenient access methods to read the value of the reply with checks
applied. For this it provides a templated ::value method for reading a
single value or reading an array. There's also a ::toBool and
::toByteArray which performs the conversion directly with default values
for the type and format checks.

Xcb::TransientFor is changed to be derived from Property instead of
Wrapper directly, so that the reading of the property value can be
shared.

Xcb::StringProperty is a convenient wrapper derived from Property to
handle the reading of a string property providing a cast to QByteArray
operator. This replaces the ::getStringProperty from utils. Though the
separator functionality from ::getStringProperty is not provided as that
is only used in one function and handled there.

All the custom usages of xcb_get_property or getStringProperty are
replaced to use this new wrapper. That simplifies the code and ensures
that all properties are read in the same way.

REVIEW: 117574
2014-04-17 07:41:33 +02:00
Martin Gräßlin 98f259d63e [Xcb::Wrapper] Add unit test for TransientFor 2014-04-17 07:41:11 +02:00
Martin Gräßlin e25abdf3bb [Xcb::Wrapper] Add unit test for CurrentInput 2014-04-17 07:41:11 +02:00
Martin Gräßlin 9db9f172bc [Xcb::Wrapper] Add a unit test for Xcb::Tree
Based on the test Tree::children() is extended for a test case on no
children which used to return a garbage pointer.
2014-04-17 07:41:11 +02:00
Martin Gräßlin 4230a0d331 [effects] Get xcb_connection_t* and rootWindow through EffectsHandler API
So far the effects could just use the connection() and rootWindow()
provided by kwinglobals. Thus an internal detail from KWin core is
accessed directly.

To be more consistent with the rest of the API it's wrapped through the
EffectsHandler and with a convenient method in Effect.

The connection() is provided as xcbConnection() to free the very generic
name connection which could create confusion once we provide a wayland
connection to the Effects.

The rootWindow() is provided as x11RootWindow() to indicate that it is
for the X11 world.

REVIEW: 117597
2014-04-16 16:05:05 +02:00
Martin Gräßlin cf498cc14b Use KWindowInfo::clientMachine in ClientMachine::resolve
Let's use the available API instead of duplicating code.

Nice side effect: client_machine.cpp doesn't include utils.h any more
which simplifies the unit test.

REVIEW: 117473
2014-04-10 15:55:17 +02:00
Alex Merry 4d88fcdff6 [kwin] Adapt to KPluginFactory change
KPluginFactory's constructor no longer takes arguments, since plugin
root objects are not passed any arguments.
2014-03-28 19:50:46 +00:00
Martin Gräßlin 6622c97601 [kwin] Add a PluginEffectLoader
This is a specialized subclass of AbstractEffectLoader to load binary
effect plugins. It used the KPluginTrader to find all candidates to load.
The loader is able to detect incorrect ABI versions through the
pluginVersion() and uses the methods exposed by the new
KWin::EffectPluginFactory to check whether the Effect is supported and
should be enabled by default.

The unit test for this loader comes with two plugins: one is able to be
loaded and provides a supported and enabledByDefault method which can be
tweaked during the test to get all the conditions we want to test for.

The second plugin uses an incorrect plugin version and thus cannot get
loaded.
2014-03-28 14:04:54 +01:00
Martin Gräßlin 42ff5e0c08 [kwin] Move finding of scripted effect source file to ScriptedEffect
New ScriptedEffect::create(KService::Ptr). This is a preparation for
adding the ordering directly to the Effect.
2014-03-28 14:04:54 +01:00
Martin Gräßlin ba12fe3cc0 [kwin] Add a ScriptedEffectLoader
This implementation of the AbstractEffectLoader is able to to load the
scripted KWin Effects. It uses KServiceTypeTrader to find all the
candidates to load.
2014-03-28 14:04:54 +01:00
Martin Gräßlin 0fd9a1eeee [kwin] Introduce a new Effect Loading mechanism
Effect loading gets split by the kind of effects KWin supports:
* Built-In Effects
* Scripted Effects
* Binary Plugin Effects

For this a new AbstractEffectLoader is added which will have several
sub-classes:
* BuiltInEffectLoader
* ScriptedEffectLoader
* PluginEffectLoader
* EffectLoader

The EffectLoader will be what the EffectsHandlerImpl is using and it just
delegates to the three other types of loaders. Thus the handler doesn't
need to care about the different kinds of effects. The loading is
supposed to be completely async and the EffectLoader emits a signal
whenever an Effect got loaded. The EffectsHandlerImpl is supposed to
connect to this signal and insert it into its own Effect management.
Unloading is not performed by the loader, but by the EffectsHandler.

There is one important change which needs to be implemented: the ordering
cannot be provided by the loader and thus needs to be added to the
Effects directly.

So far only the BuiltInEffectsLoader is implemented. It's not yet
integrated into the EffectsHandlerImpl, but a unit test is added which
tries to perform the various operations provided by the loader and the
BuiltInEffects. The test should cover all cases except the Check Default
functionality which is only used by Blur and Contrast effects. This
cannot be mocked yet as the GLPlatform doesn't allow mocking yet.
2014-03-28 14:04:54 +01:00
Martin Gräßlin 9075b5e2d6 [kwin] Remove cursorPos() from utils.h
Only delegated to Cursor::pos() anyway, so let's just use that directly.
Fixes the annoyances of having to mock it in the unit tests which include
utils.cpp.

REVIEW: 116900
2014-03-25 15:25:40 +01:00
Martin Gräßlin 4b372ba57e Switch virtual desktops with ctrl+alt+mouse wheel 2014-03-19 14:14:56 +01:00
Martin Gräßlin b274fb9297 InputRedirection emits a signal when the modifiers change
Used by Cursor to properly emit the mouseChanged signal which for
historic reasons includes the keyboard modifiers.

Again some fiddling around with the autotests and kcmrules needed to
make it compile. This needs improvement!
2014-03-19 14:14:56 +01:00
Martin Gräßlin d1d3401b9f Register KWin's global shortcuts with the new shortcut system
All the KWin core shortcuts get also registered inside the new global
shortcut system so that they are still triggered when running KWin on
Wayland.
2014-03-19 14:14:56 +01:00
Aleix Pol df58c38b7c Stop including KDE4_INCLUDES globally
Depend on libraries specifically instead.
2014-03-18 18:02:03 +01:00
Martin Gräßlin 23e6fbbb71 [kwin] Add missing target link libraries
Missing libs caused compile error if built standalone.
2014-03-18 14:38:00 +01:00
Martin Gräßlin 46392a337d [kwin] Port autotests away from kde4_add_unit_test 2014-03-18 11:49:53 +01:00
Martin Gräßlin d3c4a46c59 Track used cursor theme and size in Cursor
Reads the settings from kcminputrc. Unfortunately there is no update when
the settings change. This needs fixing in the cursors KCM first.
2014-03-18 09:00:49 +01:00
Martin Gräßlin 7523c1e7d7 Integrate KWin::Cursor with InputRedirection
New inheriting class which uses the InputRedirection to track the cursor
position. It doesn't support warping of cursor.

This introduces a slight dependency loop in the startup. Cursor needs to
be created after the WaylandBackend to ensure that the operation mode is
set correctly. But the WaylandBackend itself is accessing Cursor. It
should be safe as inside the WaylandBackend it's only accessed after
callbacks.
2014-03-18 09:00:49 +01:00
Aleix Pol c72e519d9c Remove KDE/ prefix in include directories
It's unneeded and deprecated since KF5.
2014-03-17 16:24:10 +01:00
Martin Gräßlin 4586767db8 [kwin] Use imported targets for all XCB libs
Requires 04f78489265b6e52cabd2980dfc417abeee3a695 from ECM
2014-02-25 15:48:39 +01:00
Martin Gräßlin 04716ae5e3 [kwin] Rename tests subdirectories to autotests
Follows the naming schemes in frameworks and opens up the possibility
to include test applications for KWin in the tests subdirectory.
2014-01-30 11:01:59 +01:00