Commit graph

415 commits

Author SHA1 Message Date
Martin Gräßlin
aa2cc874e2 [server] Declare metatype for KWayland::Server::PlasmaShellSurfaceInterface::Role 2016-03-09 16:16:29 +01:00
Martin Gräßlin
fb6256dc48 [client] Add support for drag'n'drop
DataDevice exposes new methods to get the DataOffer provided through
drag'n'drop and also signals to indicate the various changes on the
DataDevice during drag'n'drop.

This allows to add a first basic auto test for the drag'n'drop
functionality covering both server and client side.
2016-03-03 09:47:12 +01:00
Martin Gräßlin
23a719c8af [server] Implement support for drag'n'drop through pointer device
Summary:
How drag'n'drop works on Wayland:
When a surface has a pointer grab and a button pressed on the surface
(implicit grab) the client can initiate a drag'n'drop operation on the
data device. For this the client needs to provide a data source
describing the data to be transmitted with the drag'n'drop operation.

When a drag'n'drop operation is active all pointer events are interpreted
as part of the drag'n'drop operation, the pointer device is grabbed.
Pointer events are no longer sent to the focused pointer but to the
focused data device. When the pointer moves to another surface an
enter event is sent to a data device for that surface and a leave
event is sent to the data device previously focused. An enter event
carries a data offer which is created from the data source for the
operation.

During pointer motion there is a feedback mechanism. The data offer
can signal to the data source that it can or cannot accept the data
at the current pointer position. This can be used by the client being
dragged from to update the cursor.

The drag'n'drop operation ends with the implicit grab being removed,
that is the pressed pointer button which triggered the operation gets
released. The server sends a drop event to the focused data device.

The data transfer can now be started. For that the receiving client
creates a pipe and passes the file descriptor through the data offer
to the sending data source. The sending client will write into the
file descriptor and close it to finish the transfer.

Drag'n'drop could also be initiated through a touch device grab, but
this is not yet implemented.

The implementation in this change focuses on the adjustments for pointer.
For the user of the library drag'n'drop is implemented in the
SeatInterface. Signals are emitted whenever drag is started or ended.
The interaction for pointer events hardly changes. Motion, button press
and button release can still be indicated in the same way. If a button
release removes the implicit grab the drop is automatically performed,
without the user of the library having to do anything.

The only change during drag and drop for the library user is that
setFocusedPointerSurface is blocked. To update the current drag target
the library user should use setDragTarget. Sending the enter/leave to the
data device gets performed automatically.

The data device which triggered the drag and drop operation is exposed
in the SeatInterface. The user of the library should make sure to render
the additional drag icon provided on the data device. At least QtWayland
based applications will freeze during drag and drop if the icon doesn't
get rendered.

The implementation is currently still lacking the client side and due to
that also auto test. It's currently only tested with QtWayland clients.

Reviewers: #plasma, sebas

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1046
2016-03-02 08:18:41 +01:00
Martin Gräßlin
eff6a69544 [autotest] Fix crash in TestWindowManagement::cleanup
Didn't delete the m_windowManagement causing a crash on teardown.
2016-03-02 08:16:23 +01:00
Martin Gräßlin
b6cea86610 [server] Properly initialize Cursor
Summary:
The Cursor wasn't properly initialized. E.g. the damage signal didn't
get connected resulting in the server not noticing when the cursor
changes. The damage only got connected if a new cursor got instelled by
the client on the same pointer.

This change ensures that the Cursor is properly initialized by calling
into the same method as when the cursor changed.

The tests are extended by a new test case for damaging the surface.

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1022
2016-02-24 16:50:05 +01:00
Martin Gräßlin
b6b22da591 [server] Add a signal SeatInterface::focusedPointerChanged
Summary:
The signal gets emitted whenever the focused PointerInterfaces gets
newly set or reset to nullptr. This is needed to better track the
current cursor image in the compositor.

Reviewers: #plasma, sebas

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1007
2016-02-22 14:56:42 +01:00
Martin Gräßlin
0c3c71428e [server] Only send modifiers to client if they actually changed 2016-02-19 11:41:08 +01:00
Martin Gräßlin
565c832d39 [server] Expose executable path in ClientConnection
Summary: Convenient API to get the absolute executable path for the pid.

Reviewers: sebas, mart

Subscribers: plasma-devel

Differential Revision: https://phabricator.kde.org/D858
2016-01-25 10:56:16 +01:00
Martin Gräßlin
f51038c2b4 Add .arcconfig 2016-01-25 10:53:57 +01:00
Martin Gräßlin
4f8f9849f9 [autotest] Add tests for ServerSideDecoration protocol
REVIEW: 126301
2015-12-17 13:29:38 +01:00
Martin Gräßlin
d2f01dbbbe [server] Add implementation for server side decoration protocol 2015-12-17 13:29:38 +01:00
Martin Gräßlin
07c36644a2 Add protocol for server side decoration 2015-12-17 13:29:38 +01:00
Sebastian Kügler
18458d3252 fix OutputDevice::edid()
This patch transports the EDID data base64-encoded over the wire.

Apparently, we can't just send random QByteArrays as "strings" over, it
has to be encoded and decoded. So...

* base64-encode the data before sending to the client
* base64-decode it on the client side
* document the above, fix documentation woes in the xml definition
* change test accordingly

The test data used was actually invalid, it's a base64 string of the
actual data, so fix the tests (which actually breaks it), and encode on
the server-side and decode on the client side.

REVIEW:126380
2015-12-16 13:57:10 +01:00
Martin Gräßlin
042896a755 [server] Add Display::seats() -> QVector<SeatInterface*>
Similar to OutputInterfaces we can have multiple SeatInterfaces so
expose a way to get to all SeatInterfaces.

REVIEW: 126364
2015-12-15 15:49:12 +01:00
Martin Gräßlin
9d40118f23 [server] Add support for pointer input transformation
So far we only supported mapping global to surface-local coordinates
using a 2D-offset. With this change it's possible to register a
QMatrix4x4 to describe the transformation for going from global to
surface-local coordinates in a full 3D space.

The existing 2D-offset is transformed to use the new matrix based
variant describing a translation.

REVIEW: 126271
2015-12-08 14:15:27 +01:00
Martin Gräßlin
d96319b23d [server] Minimum supported idle timeout is 5 sec
A system isn't idle by definition below 5 sec. Before it's not possible
to properly determine whether the user is still interacting with the
system or not. Thus such a short timeout is not sufficient to determine
whether the system is idle.

Furthermore allowing short timeouts like 1 msec can be used to gather
information from the system. It would allow to reconstruct the timestamp
changes on the seat very reliable, which we do not want a Client to know.

And also this can be used to get events on each key press and key release
and the time between each of the events. This can be used to gather
statistics which would in worst case allow to reconstruct what the user
is typing. Determining where a word starts and ends should be relatively
straight forward if you know the timing. With the length of the word and
the statistics of alphabetic distribution it becomes possible to
reconstruct some words. And also individual letters. With enough
statistic and some known words one can determine how long it takes to
press a certain letter. At that point the idle interface would be a
keylogger.

To prevent such attacks the timestamp is now modified to be at least
5 sec. Why 5 sec? Because it's the smallest timestamp used in the
KIdleTime example application which I do not want to break.
5 sec are long enough to destroy this possible attack.

REVIEW: 126220
2015-12-08 14:15:08 +01:00
Martin Gräßlin
8748ef5199 [autotests] Declare metatype for Qt::Edges
Seems to fail compiling with Qt 5.4, so better fix it.
2015-12-02 09:16:54 +01:00
Martin Gräßlin
fc37f1a9eb [tests] Use QCoreApplication for ShadowTest 2015-11-18 10:21:36 +01:00
Martin Gräßlin
799d11fdb7 [tests] Add a shadow test application 2015-11-18 09:58:19 +01:00
Martin Gräßlin
9558edb96d [server] Fix possible crash after deleting an output(device)interface
After deleting an OutputInterface the resources are not necessarily
destroyed, so unbind might still be called. The existing code just
casted the resource's user data which could then point to invalidated
memory.

This change verifies that we still have a Private* for the resource.
If not, it doesn't have to do any cleanup anyway.

REVIEW: 126097
2015-11-17 16:37:01 +01:00
Martin Gräßlin
a28b9ee1e3 [autotests] Delete connection in thread in TestWindowmanagement
If that fixes the ASAN error, we should do it in all tests.
2015-11-11 09:03:42 +01:00
Martin Gräßlin
d72188130f [autotests] Use QStringLiteral for TestWindowManagement::testWindowTitle 2015-11-11 08:52:37 +01:00
Martin Gräßlin
65a79d98da [autotests] Switch all tests to GUILESS_MAIN 2015-11-11 08:36:31 +01:00
Martin Gräßlin
9297ce9c5a [autotests/client] Use GUILESS_MAIN for TestWindowManagement 2015-11-11 08:31:04 +01:00
Martin Gräßlin
5fe6365faa Fix build
How did that happen? I run the autotest...
2015-11-10 15:07:44 +01:00
Martin Gräßlin
67c45c1a4b [autotests] Destroy a created ClientConnection 2015-11-10 14:51:41 +01:00
Martin Gräßlin
868282fb08 [server] Add a convenient ClientConnection::destroy
Wrapper around wl_client_destroy. In case the ClientConnection got
created through Display::createClient we need to destroy the
ClientConnection again. The exiting client will not cause it to be
destroyed.

Reviewed-By: Bhushan Shah
2015-11-10 13:31:47 +01:00
Martin Gräßlin
f19fedb0f6 [autotests] Cleanup surface handling in TestWindowManagement
For some reason two surfaces were created and the surface not cleaned
up before the connection thread exits.

This caused ASAN to complain.
2015-11-09 09:40:58 +01:00
Marco Martin
2867b84101 address last comments of review 125871 2015-11-04 17:33:36 +01:00
Sebastian Kügler
29a4f496cf Add new interfaces to mapping file
REVIEW:125942
2015-11-04 15:43:26 +01:00
Sebastian Kügler
51ad392378 Autotests for outputmanagement and outputdevices protocols
REVIEW:125942
2015-11-04 15:38:41 +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
219b1b755c [server] Flush client after sending a frameRendered callback 2015-11-04 14:50:15 +01:00
Marco Martin
df22d2ac31 add a static PlasmaShellSurfaceInterface::get(wl_resource*)
to get the associated plasmashell surface from anywhere having
the associated resource
2015-11-04 13:21:37 +01:00
Marco Martin
72316718df task geometries to wayland for minimize effect
this exposes the geometry of taskbar entries in
plasma-windowmanagement, in order to make the
minimize effects possible.
unlike on X11, it takes relative positions and
it has one geometry per panel, making possible
to have multiple taskbars working.
REVIEW:125871
2015-11-04 13:16:50 +01:00
Martin Gräßlin
79f410263b Support request resizing on ShellSurface
Implemented in both client and server side.

REVIEW: 125836
2015-10-29 10:24:58 +01:00
Martin Gräßlin
c72313be16 Support request moving on ShellSurface
Implemented in both client and server side.

REVIEW: 125828
2015-10-29 10:24:48 +01:00
Martin Gräßlin
8f7893b385 [server] Add support for flags on transient ShellSurfaceInterface
A transient surface can indicate through the flags that it does not
want to accept keyboard focus. This is now exposed through a dedicated
method.

REVIEW: 125552
2015-10-08 12:48:08 +02:00
Martin Gräßlin
65444264a9 [server] ShellSurface's transient is a dedicated mode
So far transient was a mutual exclusive mode causing a transient window
to not be able to be fullscreen. This seems wrong. Let's have transient
still as a dedicated mode allowing the window to be maximized and/or
fullscreen. Only popup stays a dedicated mode.

REVIEW: 125468
2015-10-01 10:54:31 +02:00
Marco Martin
27667222a4 introduce SkipTaskbar
support the skipTaskbar property in the window model
that property is set client side by
PlasmaShell::setSkipTaskbar
REVIEW:125453
2015-09-30 16:52:57 +02:00
Marco Martin
ac4ef26990 fake a movement before sending a click
this makes the touch to mouse clicks mapping for xwayland
clients be a bit more reliable in accepting and correctly managing events
2015-09-28 15:18:19 +02:00
Martin Gräßlin
7021be3ae2 Add Mainpage.dox to triggeri apidocs generation 2015-09-19 17:16:54 +02:00
Martin Gräßlin
efaa5c5233 [tools] Simulate a panel tooltip
On entered on the panel window we show a tooltip at the entered
position and make it follow the mouse.
2015-09-17 11:50:01 +02:00
Sebastian Kügler
239e702f0f Fix Typo in Surface::inputIsInfitine
- add correctly named method
- forward the wrongly named one
- adjust autotests

REVIEW:125260
2015-09-16 16:45:09 +02:00
Martin Gräßlin
2bd8a8b98a Add support for transient to ShellSurface(Interface)
On client side a setTransient method is added which wraps the semantic
of wl_shell_surface_set_transient.

On server side both set_transient and set_popup are implemented, though
for popup only the transient part is implemented. In particular the grab
is not yet handled and also no popup done is provided.

For the transient on server side the flags are ignored. Main reason is
that Qt does not use the flag, so testing whether it works is tricky
(needs a test application).

REVIEW: 125223
2015-09-16 08:25:37 +02:00
Martin Gräßlin
265504a088 Increase version requirements for wl_data_device_release
* wl_data_device_manager -> version 2
* wl_data_device -> version 2
* Wayland -> version 1.7

Unfortunately the client side is not yet completely correct. We
need to call wl_data_device_release only if we have a data device
of version 2. But there is no easy way to test this. To change we
will need to introduce a client side version tracking.

BUG: 352663
2015-09-15 08:44:42 +02:00
Martin Gräßlin
38d155ff5e Fix typo 2015-09-10 16:32:45 +02:00
Martin Gräßlin
6ac9f402a0 [server] Add more documentation 2015-09-10 13:36:42 +02:00
Martin Gräßlin
4ea7f34564 [server] Less warnings please 2015-09-10 11:09:38 +02:00
Martin Gräßlin
71fd67cca7 [server] Move static methods into anonymous namespace 2015-09-10 09:45:31 +02:00
Martin Gräßlin
bbfdf3f72a [server] Make s_version a static member of private class
Follows a useful change added in the kwaylandScanner tool the
s_version becomes part of the Private class.

Also fixes the related generation in the tool.
2015-09-10 09:23:36 +02:00
Martin Gräßlin
b7e9ffdf06 [server] Install slide_interface.h
CCMAIL: notmart@gmail.com
2015-09-10 08:19:39 +02:00
Marco Martin
9a23a1c406 fix autotest 2015-09-09 18:24:08 +02:00
Martin Gräßlin
f789f9df7f Add documentation for the namespaces
This triggers Doxygen into generating the Namespace list, so that
we have a good separation of Client and Server documentation.
2015-09-09 18:16:02 +02:00
Sebastian Kügler
28df14c441 small fixes for kwaylandScanner
* fix initializer type -- was hardcoded, seems like an oversight
* add semicolons after class declarations -- one less thing to fix in the
  resulting code

REVIEW:125110
2015-09-09 17:52:43 +02:00
Martin Gräßlin
423f4e7c2f [autotests] Extend tests for Dpms
REVIEW: 125018
2015-09-09 17:47:36 +02:00
Martin Gräßlin
23f4a63908 [tests] Add an example for the Dpms interface
Uses QWidgets to render a very small UI.
* lists each Output
* for each output shows whether dpms is supported
* and which dpms mode it's in
* and provides a button to change the mode
2015-09-09 17:46:40 +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
Martin Gräßlin
9d6df1f92a [server] Add a static OutputInterface::get(wl_resource*)
Allows to retrieve the OutputInterface* for a given native wl_resource.
To support this we need to track the resources bound for each Output.
2015-09-09 17:42:19 +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
Martin Gräßlin
0676d53961 [server] Another round of docu improvements 2015-09-09 17:31:13 +02:00
Martin Gräßlin
5e3bb70612 Fix doxygen generation
Doxygen doesn't like our callback listener at all. We need to hide
it from doxygen, otherwise docu doesn't get generated.
2015-09-09 16:39:50 +02:00
Martin Gräßlin
30122f1e05 API doc improvements 2015-09-09 13:49:58 +02:00
Martin Gräßlin
a074f84cf1 Add dedicated destructor requests to blur and contrast interface
Better resource management.

REVIEW: 125114
2015-09-09 09:42:32 +02:00
Martin Gräßlin
dd5c39d2a6 Implement release for wl_data_device
Callback added to server and client calls release instead of destroy.
2015-09-09 09:34:51 +02:00
Martin Gräßlin
7cd58b27fa [server] Implement raise/lower in QtExtendedSurfaceInterface 2015-09-09 09:17:05 +02:00
Martin Gräßlin
cfd0227a01 Fix typos
REVIEW: 125100
2015-09-08 10:19:24 +02:00
Martin Gräßlin
f4091f4869 [tools] Generation of server boilerplate code 2015-09-07 14:50:37 +02:00
Martin Gräßlin
ecb5e64b67 [server] Clean up headers of BlurInterface and ContrastInterface
* remove unused forward declarations
* remove unused included
2015-09-07 10:56:34 +02:00
Martin Gräßlin
c93f6e84a6 [tools] Generate CamelCase request names and arguments 2015-09-07 10:46:27 +02:00
Martin Gräßlin
7a69d3cc40 [tools] Generate boiler plate of requests on client side
In the header for each request a method is created, with following
features:
* ignores requests working as destructor
* adjusts return type for requests containing newId
* adds QObject *parent = nullptr for requests containing newId
* adds the arguements
* turns arguments from wayland into Qt types

In the cpp the same logic is applied. Methods are not properly
implemented and won't compile in the case of returning.
2015-09-07 10:10:37 +02:00
Martin Gräßlin
7a52d15eca [tools] Generator can parse xml protocol description to generate code
* parses the protocol
* can derive file name to generate from protocol name
* detects which interface is a global and which one is referenced
* generates client code for global and for resource
* comes with a mapping.txt file to translate wl -> KWayland
2015-09-04 13:58:14 +02:00
Volker Krause
51018e8e38 compile 2015-09-03 18:40:04 +02:00
Marco Martin
b99f95e3e2 support OnScreenDisplay window type
plasmashell needs some of their windows as on screen display
ideally only the shell will be allowed to use them
REVIEW:125036
2015-09-03 18:16:26 +02:00
Marco Martin
47d7a79f9d add missing files for the contrast effect 2015-09-03 16:27:20 +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
Martin Gräßlin
62ddb960c4 Add a small tool to generate the boilerplate for Wayland interfaces
The small tool added here allows to automate the process of generating
the boiler plate for an interface. Currently it's able to generate the
Client side code representing a wl_global.

The tool does not get installed, so run it from build directory:
Example usage:
./kwaylandScanner -c Foo -f foo -g wl_foo

This will generate a wrapper for the wl_foo interface in files:
foo.h and foo.cpp
The class is called KWayland::Client::Foo.

The tool will be extended. Following things are on the TODO list:
* parse xml to get the Wayland names
* add listener (if needed)
* generate code for Wayland interfaces representing Resources
* generate the Server boiler plate

CCMAIL: mart@kde.org
CCMAIL: sebas@kde.org
2015-09-03 11:58:15 +02:00
Martin Gräßlin
66838ccf33 Fix compiler warnings 2015-09-02 16:20:10 +02:00
Martin Gräßlin
8dc1e73f5d [server] Use WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION 2015-09-02 16:14:16 +02:00
Martin Gräßlin
13bf4c9484 Implement repeat info on wl_keyboard protocol
* Raises wl_seat supported version to 4 in both server and client
* Raises wl_keyboard supported version to 4 in wl_keyboard
* wl_pointer and wl_touch are still on version 3
* Raises minimum Wayland version to 1.6
2015-09-02 16:04:14 +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
029c18ae5c [client] Add a removed() signal to each class representing a global
Setup by the Registry to be emitted whenever the wl_global gets
removed for which a dedicated object has been created.

REVIEW: 124835
2015-08-20 11:42:10 +02:00
Martin Gräßlin
6888c18b79 [autotests] Fix typos 2015-08-19 08:10:58 +02:00
Martin Gräßlin
10c562a2f2 [client] Extend Registry by providing name and version of announced interfaces
This change addresses the sometimes cumbersome to use API of Registry.
So far to bind an interface one needed to connect to the signals when
setting up the registry. There was no other way to get the name and
version at a later point. This made it difficult to use one Registry
in different parts of an Wayland application.

This change adds a convenient:
struct AnnouncedInterface { quint32 name; quint32 version;};
AnnouncedInterface interface(Interface) const
QVector<AnnouncedInterface> interfaces(Interface) const

The first one is meant for interfaces like wl_shm which is normally only
announced once. The latter one is meant for interfaces like wl_output
for which normally multiple interfaces can get announced.

Those methods can be used without having to connect to the announced
spy.

REVIEW: 124734
2015-08-19 08:10:18 +02:00
Martin Gräßlin
f78c65033b Set default logging category to Critical 2015-07-31 16:28:56 +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
0068cfddad [server] Add missing include
Fixes build with gcc 4.8.

BUG: 350058
2015-07-09 20:28:20 +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
Martin Gräßlin
a63fe2f0fb Better handle the creation of PlasmaWindow in PlasmaWindowManagementInterface
Sending a new PlasmaWindow as an event is quite problematic. The main
problem here is that it sends an id of 0 and this doesn't make sense
when the interface gets bound and all existing windows are send to the
client.

This changes the interaction to have the client create the resource for
the PlasmaWindow instead of the server creating it. The server generates
"window ids" and sends those to the client. The client now binds a
PlasmaWindow with the "window id" in the normal way.

In case the server doesn't know the id any more, it directly sends an
unmapped and destroyes the newly created resource again. It is not a
protocol error as that can happen (common example: file open dialog of
Qt 5 applications on Xwayland).
2015-06-29 10:04:51 +02:00
Marco Martin
7fd15ea066 generate fake mouseevents on touch for xwayland
on xwayland clients, send mouse press, move and release
corresponding to touchDown, move and release
this gives a very basic touchscreen support on
xwayland clients

reviewed-by: Martin Graesslin <mgraesslin@kde.org>
2015-06-20 14:21:27 -07:00
Martin Gräßlin
42a1e1e99e Add a themed icon name to PlasmaWindow interface
Server can set a themed icon name, client gets it directly turned into a
QIcon. That only works with QGuiApplications as can be seen in the
adjusted paneltest.
2015-06-20 02:46:56 +02:00
Martin Gräßlin
2f02ee45cf Add support for panel behavior in PlasmaShellSurface
Allows to set a PlasmaShellSurface with role panel to be either:
* AlwaysVisible
* AutoHide
* WindowsCanCover
* WindowsGoBelow
2015-06-19 23:27:38 +02:00
Martin Gräßlin
1a4c431ae7 Request state changes in PlasmaWindow interface 2015-06-19 04:34:50 +02:00
Martin Gräßlin
93c1521624 Add close request to the PlasmaWindow interfaces 2015-06-19 01:43:58 +02:00
Martin Gräßlin
abf42dfdc3 Add state handling to PlasmaWindow interface
Allows to pass all on/off states from compositor to the PlasmaWindow.
2015-06-18 21:13:58 +02:00
Martin Gräßlin
dcb18dfc46 [client] Create Compositor from QtWayland integration
Adds a new test application qtwayland-integration-test which demonstrates
how one can create a Surface from the Compositor got from QtWayland.
2015-06-18 03:37:58 +02:00
Martin Gräßlin
441856a0e6 [server] Destroy created Surface/Region when ClientConnection goes away
Resources might not be properly destroyed if an application crashes and
doesn't call destroy.
2015-06-18 03:16:29 +02:00
Marco Martin
c0d78d5aa1 make KWayland usable from qmake 2015-06-17 17:05:32 -07:00
Martin Gräßlin
c67614ad9d [server] Expose PlasmaWindowInterface::unmap
Sends an umap to the client and destroys the resource afterwards.

The PlasmaWindowInterface gets automatically destroyed once there
are no more resources bound to it.
2015-06-18 00:11:32 +02:00
Martin Gräßlin
d6f0ff55bd [tests] Extend paneltest on how to use PlasmaWindow
Debugs out changes to window title.
2015-06-16 06:30:54 +02:00
Martin Gräßlin
83ce426353 [server] Add PlasmaWindowInterface to PlasmaWindowManagementInterface
Only a very small subset is supported at the moment allowing to change
window title, appId and virtual desktop.
2015-06-16 06:30:08 +02:00
Martin Gräßlin
9e1991b77e [server] Add resource safety checks to TouchInterface
Prevent marshalling errors.
2015-06-15 19:31:06 +02:00
Martin Gräßlin
946b1c8d78 Fix 3e53a6283d
The most trivial changes are the one which needs to be tested!
2015-06-14 05:48:36 +02:00
Martin Gräßlin
3e53a6283d [server] Add safety checks in SeatInterface::setFocusedFooSurface
Check whether the resource for the Keyboard/Pointer/TouchInterface
is still valid before trying to use it.

This was hitting crashes in wayland during the wl_foo_send_enter
calls.
2015-06-14 00:52:55 +02:00
Martin Gräßlin
fea4b92c92 [tests] Extend paneltest to enable/disable showDesktop mode
* Left button: enable
* Right button: disable
2015-06-13 00:16:48 +02: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
1c1da06eb1 [tests] Add a test application for PlasmaShellInterface
Creates a panel.

REVIEW: 124053
2015-06-09 20:52:45 +02:00
Martin Gräßlin
85a654b02b [server] Add bindings for PlasmaShell interface 2015-06-09 19:05:25 +02:00
Martin Gräßlin
0d000d0046 [server] Drop incorrect assert from PointerInterface::setFocusedSurface
It's totally fine to have d->resource to be null - there are checks for
it in the method.
2015-06-04 01:36:34 +02:00
Martin Gräßlin
19c03da560 [server] Don't discard callbacks on surface commit
Old callbacks need to be kept around, otherwise mesa might freeze.
2015-06-03 21:16:53 +02:00
Martin Gräßlin
75915984bb [server] Query whether BufferInterface's format has an alpha channel
Reviewed-By: Sebastian Kügler
2015-06-01 02:37:44 +02:00
Martin Gräßlin
4412063c0e [sever] Check whether it's a shmBuffer in BufferInterface::Private::format
Safety check before calling into wayland library.
2015-06-01 01:21:33 +02:00
Martin Gräßlin
b47c6566a8 [server] Send keymap if we have one when creating a keyboard 2015-05-28 10:15:42 +02:00
Martin Gräßlin
713dbc51fa [server] Restrict damage to the surface geometry
Before emitting the new damage we need to restrict it to the geometry
of the surface. That's required by the documentation and at least
QtWayland/OpenGL emits non-sense damage events.
2015-05-26 11:42:38 +02:00
Martin Gräßlin
35a854e991 [server] Only send surface leave if resources are still valid
If a resource is null, because e.g. the surface got already destroyed,
wayland will create an error while marshalling arguments causing
the connected client to in worst case abort.
2015-05-26 09:26:19 +02:00
Martin Gräßlin
ed080780fd [server] Make Display::dispatchEvents also work when event loop is started
Just delegates to dispatch in the d-ptr if the Display is already running.
2015-05-18 10:27:44 +02:00
Martin Gräßlin
b7e8611e70 [autotest] Drop custom flush code in testWaylandSeat
The flush handling for blocking is done in ConnectionThread, so not
needed.
2015-05-12 16:36:36 +02:00
Martin Gräßlin
09bfc4ac5e [autotests] Improve stability of testWaylandSurface
* uses an EventQueue
* better waits for events when testing for buffer released
2015-05-12 15:51:15 +02:00
Martin Gräßlin
681211ca33 [autotests] Improve stability of TestWaylandFullscreenShell
Apparently we need to add a small delay after starting weston otherwise
it fails to connect on the CI system.

Additionally we switch to using headless-backend.so which should also
make the setup more robust.
2015-05-12 14:00:48 +02:00
Martin Gräßlin
8a6cbfd874 [autotest] Make TestWaylandOutput more robust
If we use a thread for the connection we should also have an EventQueue.
2015-05-12 13:16:57 +02:00
Martin Gräßlin
aaf64644f7 [Server] Delete BufferInterface directly from destroyListenerCallback
It showed that we don't eed the delete later and that it could cause
a crash in QCoreApplication.
2015-04-21 09:00:10 +02:00
Martin Gräßlin
fda44f9540 [server] Default init link.prev/next of the destroyListener in BufferInterface
Better save than sorry.
2015-04-21 08:58:49 +02:00
Martin Gräßlin
d28f95f603 [server] Better split flushing events and dispatch events
Running real world applications (Xwayland) showed that it doesn't like
at all that we do a dispatch when we are going to flush. This caused
in a very reliable manner a "Connection closed" error in XWayland, taking
down the client and in return the (xwayland-enabled) server.
2015-04-21 08:56:19 +02:00
Martin Gräßlin
260c33e75d [server] Call wl_resourc_destroy from destroyCallbacks
That's what weston does.
2015-04-20 13:56:41 +02:00
Martin Gräßlin
7b1e1bac9b [server] Guard sending events to PointerInterface
After unbind the PointerInterface is not yet deleted, but resource
is null, thus we need to protect the calls.
2015-04-20 09:09:23 +02:00
Martin Gräßlin
c562f62696 [server] Nullptr check in Resource::Private::get
The resource pointer might be null in which case we shouldn't call
wl_resource_get_id on it.
2015-04-20 08:15:21 +02:00
Martin Gräßlin
9039db90f0 [server] Add BufferInterface::get
Allows to get a BufferInterface for a native wl_resource*.
2015-04-02 14:22:55 +02:00
Martin Gräßlin
3a01f7155a [server] Add ClientConnection::getResource
Returns the wl_resource associated with a given id for the client
if it exists.
2015-04-02 14:12:16 +02:00
Martin Gräßlin
fd6ab581a1 [server] ServerSurface::get takes id and client
id is in client scope, thus we need to include the client as well.
2015-04-02 09:41:48 +02:00
Martin Gräßlin
a6eb193a33 Install new headers 2015-03-25 14:23:08 +01:00
Martin Gräßlin
41f5d246f6 Fix unused variable warnings
Thanks CI system for reporting them.
2015-03-25 13:46:29 +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
bb7065be3d [client] Add Touch
Basic support for handling touch events on Client side.
2015-03-25 12:22:05 +01:00
Martin Gräßlin
bfccb15d2f [server] Don't set a parent on BufferInterface
BufferInterface used to have a SurfaceInterface as parent. This could
result in easily hitting the abort condition that the BufferInterface
was still referenced when it gets deleted by just having one other
user referencing the BufferInterface.

There is no need to have the BufferInterface deleted when the
SurfaceInterface to which it belongs gets deleted. The BufferInterface
will get deleted once it's completely unreferenced and also has a
destroy listener.
2015-03-04 07:43:21 +01:00
Martin Gräßlin
33a37f99b7 [server] Add a size property to SurfaceInterface
Basically just wraps the size of the attached buffer. Convenience to
not have to go down to the Buffer to read the size.

TODO: apply buffer scale and transform.
2015-03-03 10:16:11 +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
b95858e961 [server] Add BufferInterface::size and ::setSize
This provides the size of the shared memory buffer. For other buffers
the user unfortunately needs to set the size manually.
2015-03-02 14:11:15 +01:00
Martin Gräßlin
4a1888fd43 Add support for setting cursor on the Pointer
Methods on client side added and proper handling on server side.
2015-02-27 17:36:43 +01:00
Martin Gräßlin
ff33fcdbfa [server] Provide wl_resource *resource() in BufferInterface
We need to be able to access the wl_resource* to bind it to a texture.
2015-02-24 08:53:13 +01:00
Martin Gräßlin
b3b4adfe7f [tests] Install eventDispatcher before creating the QGuiApplication
This change demonstrates how one can install a custom event dispatcher
before creating the QGuiApplication and how to process Wayland events
using the event dispatcher to e.g. start an Xwayland server prior to
creating the application.

It also allows to use

--platform wayland

on the test application. The wayland QPA plugin will connect to the
KWayland server started prior to creating the application.
Please note that such a setup will freeze unless QtWayland has commit
1e32e71 [1].

[1] 1e32e71403
2015-02-18 09:43:04 +01:00
Martin Gräßlin
aa6b502440 [server] Flush clients after sending Output information
Explictly flush the client after we send all output information on bind
and flush all clients after output changes.
2015-02-18 09:35:07 +01:00
Martin Gräßlin
16b26b2428 [server] Use eventDispatcher on currentThread instead of QCoreApplication
This allows to start the Wayland server before the QCoreApplication is
created with an eventDispatcher being installed through
QCoreApplication::setEventDispatcher.
2015-02-18 09:32:40 +01:00
Martin Gräßlin
97756ff872 [tests] Improve startup of Xwayland server
Instead of performing dispatchEvents for a hard coded number of
expected events from Xwayland, we use select on the pipe to figure
out whether Xwayland has started writing the display number. As long
as select does not indicate that the pipe is ready we need to dispatch
further events.
2015-02-16 14:32:58 +01:00
Martina Flöser
2b133eccfd Refactoring ShellSurfaceInterfaces window mode handling
Introduction of enum windowMode to replace the three dedicated boolean
variables.
2015-02-16 09:29:37 +01:00
Martin Gräßlin
775908e02c [server] Fix incorrect assert
Display::createShm is allowed to be called when the Display is not
yet running. E.g. while starting up for the Xwayland case.
2015-02-09 17:13:20 +01:00
Martin Gräßlin
1927c3a1ae [server] Add static SurfaceInterface *SurfaceInterface::get(quint32 id) 2015-02-09 14:33:50 +01:00
Martin Gräßlin
272904313b [server] Add quint32 Resource::id() const
Wrapper for wl_resource_get_id.
2015-02-09 14:33:50 +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