Commit graph

43 commits

Author SHA1 Message Date
Martin Gräßlin
b44a8fb556 Implementation of PointerConstraints protcol
Summary:
The pointer constraints protocol is an unstable protocol and thus
the implementation follows the semantics of unstable protocols.

The protocol allows to create a constraint on the pointer - either a
lock or a confinement on a surface. Those are not activated at once, but
when the compositor actively grants it.

During lock no further pointer motion is emitted, during confinement the
pointer is kept in a certain area.

This implements T4451.

Reviewers: #plasma_on_wayland

Subscribers: plasma-devel

Tags: #plasma_on_wayland

Differential Revision: https://phabricator.kde.org/D3466
2016-11-24 09:19:36 +01:00
Martin Gräßlin
58a6740e48 Fix build - KWayland_SOURCE_DIR instead of KWAYLAND_SOURCE_DIR
Change was prepared prior to project name change. Sorry about breaking.
2016-11-07 13:34:08 +01:00
Martin Gräßlin
a3a7356995 Implementation of PointerGestures protocol
Summary:
Pointer gestures are created for a pointer and there are two types of
gestures: swipe and pinch.

At a given time there can only be one active gesture. The implementation
in SeatInterface ensures that there can only be one active gesture.

Each gesture consists of a start event, 0 to multiple update events and
an end event. The end can also be a cancel. To better support this the
implementation doesn't follow the protocol and splits end and cancel
into dedicated methods in the server side and into dedicated signals in
the client side.

Reviewers: #plasma_on_wayland

Subscribers: plasma-devel

Tags: #plasma_on_wayland

Differential Revision: https://phabricator.kde.org/D3169
2016-11-07 13:28:44 +01:00
Friedrich W. H. Kossebau
4513dad684 Unbreak build: adapt cmake var names to KWAYLAND->KWayland change
project() sets more variables than I remembered

Fix-up for f90f647227508943ec8f919285fd16f0440261b9
2016-11-03 16:46:37 +01:00
Harald Sitter
99bcb89c3b Remove /KF5 include directory injection
This is ancient code that is outright wrong most of the time and at best
just incredibly unnecessary.
It is also not present in the great majority of frameworks due to this.

Its wrongness comes from the fact that it hardcodes the installation path,
which breaks relocatability of the KF5 tree as it will always attempt to
find the include dir $PREFIX/KF5 (e.g. /usr/include/KF5), which may or may
not exist given that the tree was relocated.
Worse yet, in a cross-building scenario we maybe for example
build on ARM and install to /usr but for cross building take the entire ARM
tree and shift it into /arm/usr/. If we then crossbuild on that tree the
bogus include list in this framework will make sure that we always search
in /usr/include/KF5 and thus potentially load a !ARM header simply because
the relevant ARM header was not installed etc.. Similarly of course a
build in $HOME can pick up /usr/include/KF5 headers because the home ones
are missing, causing unexpected results.
This happens whenever the KDE_INSTALL_INCLUDEDIR_KF5 var is absolute, which
it usually is.

On top of all that the premise of the code in question is flawed. It seeks
to add $PREFIX/$KF5INCLUDES to the search paths (e.g. /usr/include/KF5).
This is unnecessary because the target itself is properly installed via
cmake's install(TARGETS ... EXPORT ...) function [1]. This function has
smart functionality built in which will add the passed INCLUDES destination
to the INTERFACE_INCLUDE_DIRECTORIES property of the targets (i.e. what
the useless code wants to do) [2].
So what happens is that we install the target to the
KF5 locations, which has "include/KF5" as INCLUDES location,
thus causing the correct path to be added to the includes list of the
Targets.cmake file.
In particular thanks to more internal magic in cmake it will do so with
automatically resolved root paths such that the installed tree is
relocatable and able to relatively find the other KF5/* headers. So it
does what the code in question wants to do, just correctly.

Since cmake automatically takes care of injecting $prefix/include/KF5 we
can simply get rid of the wrong custom inejection code. This makes the
generated cmake file find the correct include/KF5/ directory and stops it
from always expecting a /usr/include/KF5/ directory to be present.

[1] https://cmake.org/cmake/help/v3.0/command/install.html
[2] https://cmake.org/cmake/help/v3.0/command/install.html
> The INCLUDES DESTINATION specifies a list of directories which will be
> added to the INTERFACE_INCLUDE_DIRECTORIES target property of the
> <targets> when exported by the install(EXPORT) command.

REVIEW: 129273
CHANGELOG: Improved relocatability of CMake export
2016-10-28 14:08:44 +02:00
Martin Gräßlin
d92592a291 Support passing generic QIcon through PlasmaWindow interface
Summary:
Especially for Xwayland windows the compositor might not have a themed
icon name. Resulting in a task manager not having dedicated icons for
Xwayland windows.

This change deprecates the way how a compositor is supposed to set the
window icon. Instead of passing the themed icon name, it is now supposed to
pass the QIcon. In case it's a themed icon the existing way to pass to
the client is used.

Otherwise a new event is used to inform the client that there is an icon
- no data is transmitted at this point. The client can then create a
file descriptor and pass it to the compositor. The compositor serializes
the icon into the file descriptor and the client can read from it. This
all happens transparently on client side there is no api change at all.

The writing and reading of the icon is done in a thread. Due to that
Qt5::Concurrent is now a required dependency instead of an optional
dependency.

Reviewers: #plasma_on_wayland, hein

Subscribers: plasma-devel

Tags: #plasma_on_wayland

Differential Revision: https://phabricator.kde.org/D3049
2016-10-17 07:35:21 +02:00
Martin Gräßlin
a96776ac0e Implement support for the relative pointer protocol
Summary:
This change implements the zwp_relative_pointer_v1 protocol which allows
to send relative motion events.

The (unstable) protocol consists of a RelativePointerManager which
creates RelativePointers for a given Pointer. This interface currently
only has one event to report the relative motion. It carries the delta,
the non-accelerated-delta and a timestamp in microsends granularity.

On the server side the implementation is mostly internal. Once a
RelativePointerManagerInterface is created one can send relative motion
events through the SeatInterface. The SeatInterface takes care of
sending it to the responding RelativePointerInterface. The protocol does
not restrict the sending of "normal" and relative motion events. Thus it
can be combined in any way one wants. This allows to have a rather
simple implementation. A user of the SeatInterface can just start to
feed the relative motion events (if the information is available) to the
SeatInterface together with the pointer events.

On client side a new RelativePointerManager and RelativePointer class
are added. The RelativePointerManager creates the RelativePointer for a
given Pointer. The event sent to RelativePointer is transformed in a
normal signal.

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma_on_wayland

Differential Revision: https://phabricator.kde.org/D2978
2016-10-11 07:40:54 +02:00
Martin Gräßlin
53f27feee7 Add support for xdg-shell
Summary:
This change introduces support for the unstable xdg-shell interface in
the server. The implementation is based on version 5 of the unstable
interface. This is the version used by toolkits like e.g. GTK.

There is also a version 6 of the protocol under development which is
incompatible. This makes it difficult to implement it in a backward
compatible way.

Because of that the implementation is a little bit different to other
interfaces and inspired by the TextInput interfaces:
On client side an XdgShell class is exposed which does not represent
it directly. Instead it delegates everything to an XdgShellUnstableV5
implementation. For the Surface/Popup the same is done.

In the Registry it's possible to create an XdgShell and it accepts
the XdgShellUnstableV5 and in future will accept XdgUnstableV6, etc.

On server side it also follows the approach from TextInput. That is
there is a version enum which gets passed to the factory method in
Display. It currently supports only V5, but in future can be extended
for V6. As there is lots of similar code between wl_shell, xdg_shell
and in future xdg_shell_unstable_v6 a templated GenericShellInterface
class is added which combines the common parts.

Reviewers: #plasma_on_wayland

Subscribers: plasma-devel

Tags: #plasma_on_wayland

Differential Revision: https://phabricator.kde.org/D2102
2016-07-13 13:04:31 +02:00
Martin Gräßlin
990e88ac1a Implement wl_text_input and zwp_text_input_v2 interfaces
Summary:
This change introduces support for text input. Text input allows to
compose text on the server (e.g. through a virtual keyboard) and sent
the composed text to the client.

There are multiple interfaces for text input. QtWayland 5.6 uses
wl_text_input, QtWayland 5.7 uses zwp_text_input_v2.

wl_text_input is from pre Wayland-Protocols times and considered as
UnstableV0 in this implementation. The other interface is UnstableV2.
Unfortunately the V2 variant is not yet part of Wayland-Protocols, but
used in Qt.

The implementation hides the different interfaces as good as possible.
The general idea is the same, the differences are rather minor.

This means changes to how interfaces are wrapped normally. On client
side in the Registry a manager is factored which represent either of
the two interfaces. Similar on the server side Display's factory method
takes an argument to decide which interface should be factored. This
way a user of the library can expose both interfaces and thus be
compatible with Qt 5.6 and Qt 5.7 onwards.

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D1631
2016-05-25 15:10:42 +02:00
Martin Gräßlin
d2f01dbbbe [server] Add implementation for server side decoration protocol 2015-12-17 13:29:38 +01:00
Sebastian Kügler
461e37d65e server side of new outputmanagement protocol
This implements the server part of the screen management protocol. The
protocol is implemented as a wayland protocol.

It provides the following mechanisms:
- a list of outputs, close to wl_output, with additional properties for
  enabled, uuid, edid, etc.. These OutputDevices correspond to a
  connected output that can be enabled by the compositor, but is not
  necessarily currently used for rendering.
- a global OutputManagement, which allows creating config objects, one
  per client. The client can make changes to the outputs through
  setScale(outputdevice*, scale) for example.
- an OutputConfiguration resource, that can be handed to a client and
  used for configuration. Changes are double buffered here. Only after
  OutputConfiguration.apply() has been called, the changes are relayed
  over the global OutputManagement.

The compositor is responsible to handle changes.

For a more detailed description, see the API docs in especially
outputconfiguration.h.

REVIEW:125942
2015-11-04 15:36:52 +01:00
Martin Gräßlin
b7e9ffdf06 [server] Install slide_interface.h
CCMAIL: notmart@gmail.com
2015-09-10 08:19:39 +02:00
Martin Gräßlin
c4bf620253 [server] Add a DpmsManagerInterface
Adding support for a org_kde_kwin_dpms interface. On server side
Dpms is mostly bound to the OutputInterface exposing just a very
small manager. Whether Dpms is supported and which mode is used is
tracked directly on the OutputInterface.
2015-09-09 17:43:08 +02:00
Marco Martin
4b9ee54d66 Interface for a Slide effect
a kwayland interface plus autotests for
the slide KWin effect, marks a window the direction
it wants to slide from and the offset from the screen edge
2015-09-09 17:37:36 +02:00
Marco Martin
1f4beb0334 Wayland protocol for background contrast
new wayland protocol used to define regions behind a window
in which the kwin background contrast effect should be applied
REVIEW:125030
2015-09-03 16:12:23 +02:00
Marco Martin
4c3aa31cd3 Blur protocol in KWayland
a protocol to activate the blur behind windows and to
optionally set a sub region of the window where to apply
the blur to, in case the window is shaped
REVIEW:125015
2015-09-02 14:42:57 +02:00
Martin Gräßlin
69832442a1 Add a Shadow protocol
The shadow protocol is inspired by the KWin's X11 protocol and the
DecorationShadow in KDecoration2.

A shadow is attached to a surface (after a commit on surface) and
consists of several image parts (represented through a buffer):
* top-left
* top
* top-right
* right
* bottom-right
* bottom
* bottom-left
* left

In addition there is an offset on each side.

For more information see also the X11 protocol described at [1].

Note: the protocol is currently missing documentation and changing
the shadow is not yet properly delegated to the server API.

[1] https://community.kde.org/KWin/Shadow
2015-07-15 11:11:30 +02:00
Martin Gräßlin
eb97db3fd1 Adding support for a fake input interface
This interface allows a client to fake input events and the server
might use them. There is an authentication mechanismn in place which
requires the server to mark the client as authenticated in order for
any events to be emitted at all.

This interface is intended for use cases like kdeconnect which allows
to remote control a device.
2015-07-09 10:10:42 +02:00
Martin Gräßlin
40d36443bd Add support for an idle time interface
The idle time interface is modelled for the use cases of the KIdleTime
framework to allow providing a Wayland specific implementation.

It supports registering idle timeouts which are triggered on server
side if there has not been any user activity on the seat for the
requested amount of time. Once user activity resumes a resume from idle
signal is emitted.

In additon there is the possibility to simulate user activity which
simulates the resume from idle.
2015-07-09 10:09:18 +02:00
Marco Martin
c0d78d5aa1 make KWayland usable from qmake 2015-06-17 17:05:32 -07:00
Martin Gräßlin
deeb0bc50e [server] Add PlasmaWindowManagementInterface 2015-06-13 00:16:48 +02:00
Martin Gräßlin
36644b8734 [server] Add support for QtSurfaceExtension protocol
The Qt surface extension is a small protocol to allow exchanging
additional data between QWindows and the compositor. What we are
currently only interested in is the possibility to close a surface
from the Compositor.

Protocol description is copied from QtWayland 5.4.2 branch.
2015-06-10 00:56:31 +02:00
Martin Gräßlin
85a654b02b [server] Add bindings for PlasmaShell interface 2015-06-09 19:05:25 +02:00
Martin Gräßlin
a6eb193a33 Install new headers 2015-03-25 14:23:08 +01:00
Martin Gräßlin
49b926e249 [server] Add support for touch events in SeatInterface 2015-03-25 13:31:38 +01:00
Martin Gräßlin
846a4e1d79 [server] BufferInterface can resolve size through egl extension
Uses eglQueryWaylandBufferWL (if available) to determine the size of the
buffer. In order to do so, the server library links against egl (1) and
one needs to register the EGLDisplay in Server::Display by the user of
the library. For this a new method Display::setEglDisplay is added.

1: not using epoxy as it doesn't wrap the Wayland interfaces yet.
2015-03-03 09:43:30 +01:00
Martin Gräßlin
1d5a032803 Introduce categorized logging
New logging categories KWAYLAND_SERVER and KWAYLAND_CLIENT.
2015-01-20 09:42:26 +01:00
Martin Gräßlin
67b1bf7d42 Install KF5WaylandServer and headers
CCMAIL: sebas@kde.org
2014-11-27 18:26:33 +01:00
Martin Gräßlin
e6b91f5628 [server] Move PointerInterface into own .h and .cpp 2014-11-25 13:53:16 +01:00
Martin Gräßlin
80d0fb1e94 [server] Move KeyboardInterface into dedicated .h and .cpp 2014-11-25 13:39:24 +01:00
Martin Gräßlin
8f11a2b0e5 Adding a new ClientConnection class for wrapping wl_client
The ClientConnection is managed by Display. Whenever one tries to
get a ClientConnection for a wl_client* and it doesn't exist yet a
new one will be created and a clientConnected signal will be emitted.
Also there is a clientDisconnected signal.

ClientConnection provides access to pid, uid and gid. The idea is
to extend it to provide access to all the resources created for the
client.
2014-11-17 16:01:18 +01:00
Martin Gräßlin
53a4455c47 [server] Introduce a base class Resource
The Resource base class is supposed to be used by all interface
classes which get created for a wl_resource.

Most interface classes are adjusted, but there are some exceptions:
* BufferInterface: is different as the wl_resource is already created
* PointerInterface and KeyboardInterface: those two need changes, the
  implementation differs from all other interface implementations.
2014-11-14 09:45:02 +01:00
Martin Gräßlin
22197da94b Add a base class for all server interfaces of a wl_global
New base class KWayland::Server::Global which all Interface classes
for a wl_global inherit. Furthermore there is a shared base class
for all the Private classes of that type.
2014-11-13 15:10:35 +01:00
Martin Gräßlin
7763cd94a7 Add wl_data_offer on Client and Server side
Only selection part is implemented, drag'n'drop still needs to be
implemented.

Unit test is not properly testing whether the data can be transferred.
This needs some better architecture to have multiple processes which
perform the source and target part.
2014-11-06 16:56:50 +01:00
Martin Gräßlin
421cfaafc3 Add implementation for wl_data_device in Server and Client
On the client side anything related to wl_data_offer is not yet
implemented.
2014-11-06 10:02:49 +01:00
Martin Gräßlin
92c46fdcd3 Add DataDeviceManager and DataSource in client and server
Basic implementation of the DataDeviceManager and the DataSource it
creates.

Still needs support for DataDevice and DataOffer to complement the
API.
2014-11-04 15:10:22 +01:00
Martin Gräßlin
7fce72b7d1 Implement the wl_region interface
Compositor::createRegion added which returns a Region. Also server
side part is implemented.
2014-10-16 14:54:17 +02:00
Martin Gräßlin
ee24e4e08a Add support for wl_subcompositor and wl_subsurface
This implements the subcompositor and subsurface protocol on both
Client and Server side.

Client:
New classes SubCompositor and SubSurface. The SubCompositor can be
created through the Registry and creates the SubSurface which is
bound to a Surface and has a parent Surface. The SubSurface class
provides convenient wrappers for all calls exposed in the
wl_subsurface interface.

Server:
New classes SubCompositorInterface and SubSurfaceInterface. Support
for all commands is added, though the API probably still can need
some fine tuning. The synchronized vs. desynchronized behavior is
not yet exposed in the API. This could also be delegated towards
the user of the library.
2014-10-16 08:19:52 +02:00
Sebastian Kügler
bf0f8fd266 Fix export header for WaylandServer
This makes it possible to install and then use it. Installation is still
commented since we can't give enough stability guarantees for now.

In detail:
- do not actually install headers
- generate the export header into Wayland/Server
- include it from there

REVIEW:120579
2014-10-14 14:46:05 +02:00
Martin Gräßlin
cdd2ab9b78 Do not install Server library
It's not yet used by KWin, so we don't need to expose it yet.
This gives us more time to fine tune the API.
2014-09-19 09:46:55 +02:00
Martin Gräßlin
8fee17fc79 Install library and headers 2014-09-17 15:47:42 +02:00
Martin Gräßlin
5e54a86d5e Generate export headers and use it in our headers
Auto tests are adjusted to link against the library instead of compiling
the source files.
2014-09-17 15:10:43 +02:00
Martin Gräßlin
e763d9acc0 Add a build system
Framework style build system which generates two libraries:
* KF5WaylandClient
* KF5WaylandServer

autotests are adjusted to compile again. They need to be changed to
use the libraries once the export header gets generated.
2014-09-17 14:35:33 +02:00