Commit graph

313 commits

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