Commit graph

963 commits

Author SHA1 Message Date
Vlad Zahorodnii
06cfe1a24a Fix a typo
This probably needs to be currentPrimarySelection.
2021-03-23 21:10:07 +02:00
Vlad Zahorodnii
a50f84a868 Merge notifyPointerPress() and notifyPointerRelease()
This brings the API of the SeatInterface class and the PointerInterface
class closer the corresponding Wayland API.
2021-03-23 11:20:03 +02:00
Vlad Zahorodnii
2af2ba6d4c Use common doxygen comment terminator style
In plasma code, it's more common to see `/** ... */` doxygen comments
rather than `/** ... **/`.

This change fixes up doxygen comment terminators to prevent inconsistency
issues.
2021-03-23 08:14:02 +00:00
Vlad Zahorodnii
c94787bbf4 Move DESIGN.md to toplevel directory
This makes DESIGN.md more noticeable.
2021-03-22 21:30:43 +02:00
Vlad Zahorodnii
a3ab80677c Fix handling of the case where specified surface can't imported
An xdg_imported resource must be created no matter whether there is an
exported surface with the specified handle.

This change fixes handling of that case in kwaylandserver by introducing
a dummy imported object.

If there is no exported surface with the given handle, the compositor
should create an xdg_imported resource and immediately send the
destroyed event.

A dummy imported object is needed because generated code sets resource
implementation; otherwise we would set an implementation without any
user data to mark the resource as inert.
2021-03-22 17:46:12 +00:00
Vlad Zahorodnii
d4901d16fa Call XdgImportedV2Interface::send_destroyed() that takes no resource
XdgImportedV2Interface already knows what the associated resource is, so
we can call send_destroyed() method that takes no resource to let auto
generated code figure out what resource must be used. It simplifies code.
2021-03-22 19:42:05 +02:00
Vlad Zahorodnii
e4b9f9761f Simplify emission of XdgForeignInterface::transientChanged signal
We can emit the transientChanged signal directly on the foreign object.
2021-03-22 17:15:02 +00:00
Vlad Zahorodnii
9445bfb6d8 Simplify QHash lookups
QHash provides a convenience helper to lookup a value, use it. It makes
the code simpler.
2021-03-22 17:15:02 +00:00
Vlad Zahorodnii
2f102e7544 Fix various minor coding style issues
This fixes various coding style issues, e.g. wrong variable name
capitalization, wrong brace placement, etc.
2021-03-22 17:15:02 +00:00
Vlad Zahorodnii
e5bde36e96 Get rid of unnecessary private classes in xdg-foreign wrappers
There's no point for using the d-pointer pattern because the importer
and the exporter classes are private already, they are not exposed in
public api.
2021-03-22 17:15:02 +00:00
Vlad Zahorodnii
5b060bcab0 Remove since version tag in OutputInterface
kwaylandserver is an unstable library, this renders since version tags
highly unreliable.
2021-03-22 18:58:48 +02:00
Vlad Zahorodnii
ca69d9e62a Remove noop destructors 2021-03-22 17:42:28 +02:00
Vlad Zahorodnii
0461b7fe27 autotests: Fix testXdgForeign
Currently, testXdgForeign fails because imported and exported resources
are destroyed immediately from destructor request handlers and code that
performs cleanup in the exported-imported mapping tables accesses the
dangling pointers.

Previously, it wasn't an issue because the destruction of exported and
imported resources was delayed using QObject::deleteLater().
2021-03-22 15:31:41 +00:00
Kevin Ottens
d92fa7f140 Add the activity management protocol server implementation 2021-03-22 11:28:57 +00:00
Vlad Zahorodnii
b822c1e63a Simplify handling of inert input method context
If the input method context object becomes inert, just delete it.
2021-03-22 10:16:34 +00:00
Weng Xuetian
823a34a10d Add explicit done to OutputInterface and deprecate zxdg_output_v1.done if version 3 is used.
In zxdg_output_v1 version 3, done is deprecated and should be replaced
with wl_output.done. This makes automatically send done upon change not
suitable for the usage. OutputInterface user should now use done()
explicitly to send the update.

CCBUG: 433224
2021-03-19 10:39:07 -07:00
Usarin Heininga
2414deb86b Expose missing client UUids in plasma windowManagementInterface
StackingOrder.
2021-03-19 13:54:50 +00:00
Vlad Zahorodnii
61a6ee4b07 Rename some methods in xdg-foreign classes 2021-03-17 10:46:11 +02:00
Vlad Zahorodnii
1f83657c65 Remove unused signals 2021-03-17 10:46:02 +02:00
Vlad Zahorodnii
8fc6cb85a6 Remove redundant class forward declarations 2021-03-17 10:43:58 +02:00
Vlad Zahorodnii
9763aec020 Send an icon only if there is one
Currently, plasma window model test fails because the null icon is
received after executing the main body of the test.

    FAIL!  : PlasmaWindowModelTest::testVirtualDesktops() '!dataChangedSpy.wait(100)' returned FALSE. ()
       Loc: [/data/projects/src/kwayland-server/autotests/client/test_plasma_window_model.cpp(583)]

We can fix the test by waiting for the iconChanged signal to be emitted,
but we will need to wait in all tests too. Furthermore, it doesn't make a
lot of sense to wait for an icon that was never set.

This change makes the compositor send an icon only if there is one.

It's a behavioral change, but it shouldn't regress anything because kwin
always sets icons via the plasma window management protocol even for apps
that have no valid app id.

It also makes the api of the PlasmaWindowInterface class more intuitive.
2021-03-16 15:43:59 +02:00
Vlad Zahorodnii
f321882177 autotests: Fix testWindowmanagement
Currently, testIcon fails because the actual and the expected pixmaps
have mismatching formats.

The root cause is that images with an alpha channel will loose the alpha
channel if they are converted to QPixmap using QPixmap::fromImage().

The >> stream operator for the QPixmap class will deserialize pixel data
in a temporary QImage and then use QPixmap::fromImage() to get a pixmap
object.

The >> stream operator for the QIcon class will delegate the task of
reading the icon from a QDataStream to QPixmapIconEngine, which uses the
>> stream operator under the hood to deserialize icon data.

In order to fix testIcon, this change constructs a dummy icon from a
pixmap object returned by QPixmap::fromImage().
2021-03-16 15:28:46 +02:00
Vlad Zahorodnii
bdb138bdcd Remove @since version tags
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.
2021-03-16 10:08:21 +02:00
Vlad Zahorodnii
a6ef2cc9e4 Remove pointer asserts in gesture related functions
These asserts were overlooked in 59ae762300.
2021-03-15 18:53:24 +02:00
Vlad Zahorodnii
59ae762300 Replace input device asserts with if checks
KWin may call pointer or touch-related function even if the
corresponding capabilities are missing.
2021-03-15 16:41:14 +00:00
Vlad Zahorodnii
62c8a3829c Don't print a warning if the compositor sets focused surface without wl_keyboard capability
KWin may set focused keyboard surface even if there is no wl_keyboard
capability. :/
2021-03-15 16:41:14 +00:00
Vlad Zahorodnii
43a56a6ce8 Explicitly destroy inert tablet resources
This makes handling of inert resources easier.
2021-03-15 16:34:46 +00:00
Vlad Zahorodnii
16db81b5cc Make RegionInterface private
If a Wayland protocol deals with regions, they will be exposed as
QRegion objects in public API. Therefore, it makes sense to make
RegionInterface private as it's an implementation detail and it's
not intended to be used in public api.

The corresponding test was dropped because the CompositorInterface
no longer emits a signal to indicate that a wl_region has been created.
It should be also noted that wl_region stuff is already tested via
other means, e.g. surface damage, etc.
2021-03-15 16:28:30 +00:00
Vlad Zahorodnii
a60ed431f1 Fix testError
testError expects that the compositor will post a protocol error if the
client tries to create several plasma shell surfaces for the same wayland
surface.
2021-03-15 16:27:41 +00:00
Vlad Zahorodnii
8c32edcd12 Implement wl_keyboard.release
The destructor request was added in version 3. Currently, we support v7.
2021-03-15 12:34:35 +02:00
Vlad Zahorodnii
9089fc5357 Update pressed keys even if there is no focused surface
This is a minor regression introduced with the refactor of the
KeyboardInterface. We need to update pressed key status even if there is
no focused surface, otherwise some keys may get stuck in the pressed
state.
2021-03-15 10:30:34 +00:00
Vlad Zahorodnii
14ccbb8b94 Remove redundant nullptr check
We always check if focusedSurface is not nullptr before calling
sendModifiers().
2021-03-15 10:30:34 +00:00
Vlad Zahorodnii
9526b1c3fe Explicitly send keyboard modifiers
This improves the readability of the setFocusedSurface() method in the
KeyboardInterface class. Currently, it's easy to overlook that the
sendEnter() function also sends modifiers.
2021-03-15 10:30:34 +00:00
Vlad Zahorodnii
4918519eec Simplify KeyboardInterface
KeyboardInterface no longer has a concept of a focused child surface, so
remove relevant dead code.
2021-03-15 10:30:34 +00:00
Xaver Hugl
264bb6c53d Consider the tool type in TabletSeatV2Interface::toolByHardwareSerial 2021-03-14 23:53:19 +01:00
Vlad Zahorodnii
4e16b10e82 Rename some SeatInterface methods following consistent naming scheme
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.
2021-03-12 10:19:03 +00:00
Adrien Faveraux
d7a1067a7a move output management to the new approach 2021-03-12 11:06:35 +01:00
Aleix Pol
a0419faecb Include implementation of declared method 2021-03-11 13:49:38 +01:00
David Edmundson
1a0020b18f Move PlasmaWindowInterface lifespan management to the caller
PlasmaWindowInterface is a "Server-managed multicasting resources". We
no longer need our wrapper to outlive objects so we can tidy that up.

It's weird to have a method call to an object delete the object, so
memory management is moved to the caller to be consistent.
2021-03-11 12:01:52 +00:00
Adrien Faveraux
54d3d7e68f move output device to the news approach 2021-03-11 11:12:25 +01:00
Vlad Zahorodnii
d853b08659 Post a protocol error if missing seat capability
The protocol spec indicates that the compositor has to accumulate seat
capabilities and post a protocol error if a client requests an input
device and the seat has never had the corresponding capability.
2021-03-10 22:19:00 +02:00
Vlad Zahorodnii
1d7bc7128d Port SeatInterface to the new approach
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.
2021-03-10 22:18:59 +02:00
Adrien Faveraux
09126dab41 migrate ifndef to pragma once 2021-03-10 20:16:46 +00:00
Vlad Zahorodnii
6289875418 Remove SeatInterface::keyboardCreated signal
It's pointless with the new design.
2021-03-10 17:33:51 +02:00
Vlad Zahorodnii
c08adf1388 Port wl_touch wrapper to the new approach
With the new design, a single TouchInterface manages multiple wl_touch
objects. This allows implementing things such as touch grabs, etc.
2021-03-10 16:06:24 +02:00
Vlad Zahorodnii
6748a31cd1 Rename methods to send press and release events in PointerInterface
This makes the naming scheme consistent. Most methods don't use past
tense to describe what we send, i.e. sendMotion instead of sendMoved.
2021-03-10 14:05:20 +00:00
Vlad Zahorodnii
a9d480ec0d Minor style fixes 2021-03-10 14:05:20 +00:00
Vlad Zahorodnii
178c5d0595 Rewrite wl_pointer implementation with new approach
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.
2021-03-10 14:05:20 +00:00
Vlad Zahorodnii
eb123a40b7 Introduce SurfaceInterface::mapToChild()
The new method provides a convenient way to map a point from the
parent's coordinate system to a child's coordinate system.
2021-03-10 14:05:20 +00:00
Aleix Pol
5a968c89fe Still tell about received pings if they timed out
There's a good chance the user still cares about it. They're free to
ignore it if they want.
2021-03-01 13:09:59 +00:00