Commit graph

990 commits

Author SHA1 Message Date
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
David Edmundson
09a45da505 Port all connects
This is mostly all automatic from clazy, though it got confused by a few
namespace issues.
2021-02-25 13:48:11 +00:00
Vlad Zahorodnii
13e03bde1d Prevent sending enter events to already focused surfaces
If the surface already has keyboard focus, do nothing.
2021-02-17 12:18:54 +00:00
Vlad Zahorodnii
377385fa6e Send enter and modifiers events if wl_keyboard is bound by focused client
We need to send out these events; otherwise the client may have
incorrect state for the new wl_keyboard object.
2021-02-17 12:18:21 +00:00
Vlad Zahorodnii
13fa83c7a6 Make some getters in ClientConnection const 2021-02-17 12:18:21 +00:00
Vlad Zahorodnii
3c0b35cd81 Remove unimplemented keyboardsForSurface() method 2021-02-17 13:23:54 +02:00
David Edmundson
6202dbc0a8 Guard against DataSource being deleted during transfer
During a drag the source can disappear at any time. The other client
will be notified, but it may have actions in flight.

Other methods were guarded but not data_offer_finished.
2021-02-16 10:47:28 +00:00
Vlad Zahorodnii
64744103dc Simplify SeatInterface::touchDown() api
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.
2021-02-15 20:03:11 +02:00
Vlad Zahorodnii
b0a20b2815 Prevent setting invalid buffer transform and scale
At the moment, it is possible to crash the compositor if some client
sets a buffer scale less than 1.
2021-02-11 10:10:12 +02:00
David Edmundson
4047053829 Initialise variable 2021-02-02 19:04:25 +00:00
Vlad Zahorodnii
ae5a31acd1 Introduce SurfaceInterface::hasFrameCallbacks()
The new method can be used to check if the surface has a pending frame
callback.

CCBUG: 428499
2021-02-02 14:00:34 +00:00
Nicolas Fella
ca6fa1cbf0 Use versionless Qt cmake target
This makes it easier to build against both Qt5 and Qt6

GIT_SILENT
2021-01-30 17:24:42 +01:00
Vlad Zahorodnii
db6647a8a2 Simplify handling of inert sub-surfaces
With the local copy of qtwaylandscanner, it's possible now to simplify
handling of inert sub-surfaces.
2021-01-29 13:23:02 +00:00
Vlad Zahorodnii
16bf88b67c Print warning messages in KWAYLAND_SERVER logging category
This makes it easier to analyze logs.
2021-01-26 09:22:39 +02:00
David Edmundson
fe8a0a28b5 Import local copy of qtwaylandscanner
This is a copy of the code from Qt5.15 with some backported patches from
development branch of Qt.

One of the upcoming fixes introduces new API, which is why we can't rely
on distro packaging.

The cmake macro is mostly copied from ECM, but set to rebuild generated
code when the scanner changes.
2021-01-26 06:53:59 +00:00
Vlad Zahorodnii
46604a3ca2 xdg-shell: Provide more helpful description for invalid window geometry error 2021-01-21 15:24:45 +00:00
David Edmundson
fbe8aff439 Send SurfaceInterface::enter events after clients bind to outputs
The following order of events are legal:

Typically order is:
 - server announces a new output
 - client binds to a new output
 - server updates the surface to be on new output

But we can have events occur in the following order:

 - server announces a new output
 - server updates the surface to be on new output
 - client binds to a new output

At which point when we update the surface there is no ID to tell the
client which output the surface is on.

This patch watches for clients binding to output and updates
appropriately.
2021-01-12 11:10:50 +00:00
Aleix Pol
6566c91e39 tablet_v2: Readability
Be more explicit about the types, prefer passing semantically correct
parents and keep track of the pads from the object rather than relying
on them being initialised properly.
2021-01-06 02:33:12 +01:00
Aleix Pol
e57f925dfc tablet: Address how he clean resources up 2021-01-06 02:23:13 +01:00
Aleix Pol
1d904daf65 tablet_v2: Further implements missing components
Namely TabletPadV2Interface, TabletPadRingV2Interface,
TabletPadStripV2Interface and TabletPadGroupV2Interface were entirely
missing.
2021-01-06 02:23:13 +01:00
Aleix Pol
c80086ceda tablet_v2: consistency
Add an m_removed attribute to all elements that can send a removed
event.
Never advertise an object that has been marked as removed already.
2021-01-06 02:21:54 +01:00
Carson Black
4fe4a50aa4 xdgshell: wrap v3 of xdgshell protocol 2021-01-05 21:25:38 +00:00
Aleix Pol
9641aa42ec tablet: small cleanups
Add missing &
Remove unnecessary namespace
Consistant m_ prefix
2020-12-16 02:44:17 +01:00
Andrey Butirsky
03fc51ef2f keyboard_interface: Always update modifiers cache
We send modifiers to the active client when they change, and when we
focus an existing client we send the cached state.

For this reason it's important we always update our internal store of
modifiers regardless of whether a surface is currently active.

Unit test is adopted accordingly.

BUG: 429930
2020-12-14 17:09:38 +00:00