Commit Graph

225 Commits (69cbb40903ecc47b7745f512f09a150489bb3f9d)

Author SHA1 Message Date
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