In plasma code, it's more common to see `/** ... */` doxygen comments
rather than `/** ... **/`.
This change fixes up doxygen comment terminators to prevent inconsistency
issues.
Currently, we have a mix of Frameworks versions and Plasma versions in
@since tags, which leads to some confusion. Since this is an unstable
library, one cannot rely on since version tags, we are free to add,
change, and remove apis to serve best to kwin requirements. Thus, we can
simply remove all since version tags to fix mixing up different product
versions.
This change renames methods that are used by the compositor to notify the
seat about input events.
There isn't anything special about the proposed naming scheme, for what
it is worth, it was established in weston. "notify" methods are used to
notify kwaylandserver about something, and "send" methods actually send
relevant events to wayland clients.
This rewrites the wl_seat protocol implementation to adhere to the new
design principles.
Effectively, we've been supporting wl_seat v7 so the version was also
bumped from 5 to 7.
With this design, a single PointerInterface manages multiple wl_pointer
objects. This makes the API tidier and allows implementing things such as
keyboard grabs more easier.
In addition to that, the PointerInterface doesn't inject its own frame
events anymore. It's up to the compositor to decide when it has to be
sent. However, the PointerInterface may still send a frame event if the
pointer focus changes.
Besides re-writing the pointer interface, this change, unfortunately,
also affects the implementation of pointer-gestures and relative-pointer
protocols because previously they were coupled to individual instances
of PointerInterface.
Currently, the compositor is supposed to pass the position of the touch
point to the touchDown() function and in return get its unique global
id. The id can be be passed to subsequent touchMotion() and touchUp().
The compositor is responsible for mapping between libinput slots and
internal touch point ids.
The mapping step is unnecessary and adds in some complexity as the input
code now has to keep the mapping table up to date.
This change makes the touch API more convenient to use by making
relevant functions take touch ids that are assigned by the compositor.
Usually, compositor would use libinput_event_touch_get_seat_slot() to
get touch ids.
It also allows introducing event objects that can be useful later in the
future.
The main reason why we have factory methods is that up to some point,
kwayland had its own signal to indicate when globals have to be removed.
Now that all globals add destroy listeners for the wl_display object,
we don't have that signal. Most factory methods are equivalent to doing
new T(display).
Besides adding unnecessary boilerplate code, another reason to get rid
of the factory methods is to reduce the amount of merge conflicts. If
several persons work on implementing wayland protocols at the same time,
sooner or later someone will have to resolve merge conflicts in Display.
And make them public in th keyboard_interface, there's no point in
wrapping this in seat_interface with new approach
See also: plasma/kwayland-server#13
- Get rid of the KF5 deprecated methods related to keymap,
kwayland-server is not source compatible with kwayland, so we don't
need to keep the deprecated methods
- Move the key repeat, modifiers and keymap handling fully into the
KeyboardInterface.
- Get rid of some of the keyboard related code base from the
seat_interface.
Co-Author: Bhushan Shah <bshah@kde.org>
This was done mostly because I wanted to get rid of the Resource
dependency in AbstractDataSource so I can make our xwl bridge direct,
but this also fixes up some issues with object lifespan present in the
previous version and keeps all our clipboard code in-line.
- Drop the v0 support, it is no longer used by anything
- Adapt the text-input related methods in seat interface to include
versioning, this will be useful for when zwp_text_input_v3 support is
included in kwayland-server
- Refactor SeatInterface to get rid of globalTextInput, it is no longer
needed with the new approach
- Refactor out the ContentHints and ContentPurpose enums in separate
header file which can be shared by zwp_text_input_v2/3 implementation
Co-Author: Bhushan Shah <bshah@kde.org>
Summary:
This patch makes use of wlroot's DataControl interface to support
clipboard management.
Unlike wl_data_device clipboards are sent on every change to all
watchers.
If the data device has a selection set it updates immediately.
Because it was started a year ago it uses the existing style of
wrapping objects. The unit test uses the new approach.
Test Plan:
Updated kwin
used wlroot's wl-copy, wl-paste which are xclip replacements to
show that the clipboard updated correctly
Reviewers: #kwin
Differential Revision: https://phabricator.kde.org/D29330
Summary:
Clipboard managers and middle click paste are new protocols.
We want to be able to copy from a clipboard manager to a regular
clipboard and vice versa without duplicating loads of code.
If we support kliper's "syncronise contents of the clipboard and
selection" inside the compositor that would become an unmanageable amount
of combinations.
It also potentially allows the idea of our XWayland bridge not being a
wayland client and simplifying that code.
Test Plan: Unit test passes
Reviewers: #kwin
Subscribers: zzag
Differential Revision: https://phabricator.kde.org/D29329
Summary:
A DataDevice will have zero or one active DataSource as the seclection.
In the existing code we track the current data device then update it to
the newest data device
when the source inside a data device changes.
If we store the active data source inside Seat instead of the device
everything becomes
somewhat simpler and safer.
An entire unit test vanishes as that case of an externally set
DataDevice with no source
can no longer happen.
There's also a lot of duplication that's been merged in this patch so we
have one path.
There are some technical behavioural changes in particular we do cleanup
when the
source vanishes rather than the data device, but if anything that seems
safer and more correct.
It's a precursor for introducing an abstraction class round the source
without needing to meddle
with too much code.
Test Plan: Relevant unit tests passed, ran with it for a while with no
issue.
Reviewers: #kwin
Differential Revision: https://phabricator.kde.org/D29328
Summary:
To better isolate the clients from each other eachh KeyboardInterface
creates it's own dedicated temporary file and sends the fd for this
temporary file to the client. This means the memory for the keymap is no
longer shared between all clients, every client has an own copy.
To support this the existing API to set the keymap is deprecated and
replaced by a new method setKeymapData which takes the content of the
keymap as a byte array. The now deprecated method which takes a file
descriptor is changed to use the new setKeymapData method. For that it
reads the content of the file.
The implementation in KeyboardInterface to create the file descriptor is
based on the implementation of KWin. As I implemented the change in KWin
(see 3b4c508ee3) it is not a problem from
GPL vs LGPL perspective.
The change includes test cases to verify that the content of the keymap
is properly passed to the client and that the memory is no longer shared.
BUG: 381674
Reviewers: #kwin, #frameworks, davidedmundson, zzag
Reviewed By: #kwin, zzag
Subscribers: plasma-devel, kde-frameworks-devel
Tags: #frameworks
Differential Revision: https://phabricator.kde.org/D14910
Summary:
Allows
* projects linking to KWayland to hide deprecated API up to a
given version or silence deprecation warnings after a given version,
using
* -DKWAYLAND_DISABLE_DEPRECATED_BEFORE_AND_AT
* -DKWAYLAND_NO_DEPRECATED
* -DKWAYLAND_DEPRECATED_WARNINGS_SINCE
* -DKWAYLAND_NO_DEPRECATED_WARNINGS
or
* -DKF_DISABLE_DEPRECATED_BEFORE_AND_AT
* -DKF_NO_DEPRECATED
* -DKF_DEPRECATED_WARNINGS_SINCE
* -DKF_NO_DEPRECATED_WARNINGS
No support for "EXCLUDE_DEPRECATED_BEFORE_AND_AT", needs to be done by
someone with detailed knowledge about disabling implementation, if wanted.
Reviewers: #kwin
Subscribers: zzag, kde-frameworks-devel
Tags: #frameworks
Differential Revision: https://phabricator.kde.org/D24663
Summary:
So far not all v5 features were implemented because most of them are
optional. But given that XWayland needs axis_discrete event maybe it's
time to implement them.
CCBUG: 404152
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, mthw, kde-frameworks-devel
Tags: #frameworks
Differential Revision: https://phabricator.kde.org/D18933
Summary: This signal notifies a compositor about selection changes on a seat.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: kde-frameworks-devel
Tags: #frameworks
Differential Revision: https://phabricator.kde.org/D15023
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
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
Summary:
So far SeatInterface handled automatically which DataDeviceInterface
holds the current clipboard selection. While this works fine and is
correct it doesn't support use cases like a clipboard manager where
the clipboard is hold by a different ClientConnection than the one
from the focused keyboard.
This change allows to manually set the selected DataDeviceInterface
to override the automatic selection, though the automatic selection
is still in place. Thus the next update of a selection will override
the manually set selection again.
Reviewers: #plasma_on_wayland
Subscribers: plasma-devel
Tags: #plasma_on_wayland
Differential Revision: https://phabricator.kde.org/D1972
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
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
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
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
* 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
The selection is supposed to be sent to the DataDeviceInterface just
before getting keyboard focus. In order to do that the SeatInterface
keeps track of the DataDeviceInterface which is the current selection
and the DataDeviceInterface of the focused keyboard client.
SeatInterface friends DataDeviceManagerInterface so that the latter
can register each created DataDevice for the SeatInterface.
The button state is a seat-global state and not a per pointer state.
All pressed/released and axis events are moved to the SeatInterface
and just invoke the related method on the focused surface pointer.
Makes PointerInterface more like other Interface classes wrapping
wl_resource. The most important change is the handling of the
focused surface. This is now kept in the SeatInterface and can also
be set if there is no PointerInterface for the client yet.
The unit tests had to be adjusted and some are also disabled as the
button events are not yet moved into SeatInterface.
This method is supposed to return the PointerInterface for the current
focused surface. At the moment it just creates the one global
PointerInterface. The existing SeatInterface::pointer method got
removed as that is actually wrong usage.
There can only be one focused surface per Seat, thus the information
should be hold in the seat.
This only adjusts the API, the actual data is still hold in the
PointerInterface. This still needs adjustment.
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.