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.
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.
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
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.
libwayland-server allows the wl_display accept client connections on
more than one socket. We currently don't listen on multiple sockets,
but it would be nice if Display supported such operation mode.
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
A threshold exists to stop users flooding the server for no reason.
However, there is a usecase for small timeouts.
rsibreak has a "please relax for 20 seconds" interface. Here it makes
perfect sense to know if a user is active in small increments. The plan
is to start a 1s timer and wait for that. Then we wait locally for 20s
without a resume event.
We cannot end a drag after the destroyed() signal for the source data
device is emitted because DataDeviceInterface and its d pointer are gone
by that time.
One of the most disappointing things when writing autotests is dealing
with a race condition where destructor requests are processed after all
globals have been destroyed.
With this change, the Display object will destroy all clients and their
resources before destroying the wl_display object. The good thing about
doing so is that shut down logic becomes simple. We don't have to assume
that wl_resource objects can outlive their wl_global objects, etc. The
bad thing is that it exposed a couple of pre-existing latent bugs in the
data device and the xdg foreign code.
closesplasma/kwayland-server#2
Getting the object associated with the particular wl_resource is not
difficult, but it involves a pretty reasonable amount of boilerplate
code.
This change, introduces a helper function with an intend to reduce the
amount of boilerplate code.
It can be used as resource_cast<const ObjectPrivate *>(resource) or
just simply resource_cast<ObjectPrivate *>(resource).
Every time the icon surface is committed, we need to accumulate the
surface offset. However, this is not easy to do on the compositor side
with the current design.
This change introduces a new class DragAndDropIcon that defines a
surface role as well as accumulates surface offsets on every commit.
This fixes a bug where the dnd icon jumps all of sudden while dragging
an image from Firefox to other applications.
This change rewrites implementation of subsurfaces with qtwaylandscanner
and fixes various smaller issues, such as proper handling of position
updates for subsurfaces in the desync mode and getting rid of QPointer in
the public API.
Parenting both registry and the client connection to the test leads to a
confusing teardown order. Especially as m_connection is explicitly
deleted in cleanup()
Scoping registry to where it's actually used solves that
It is allowed to call surface_attach multiple times with the same
buffer. We want to only connect once.
Found whilst debugging a freeze, going through the list of
BufferInterface connections I had multiple to the same SurfaceInterface.
CCBUG: 428361
Currently, Firefox will stuck in "dnd" mode if you try to drag any of
its tabs. The main reason for that is that kwin doesn't send the
wl_data_source.cancelled event if the pointer button has been released
and there is no target surface or if the data source hasn't been
accepted by anyone.
CCBUG: 427528
During DataDevice migration we moved dataDevicesForSurface away from the
existing template macro due to inheritance reasons at the time.
The SeatInterface::setDragTarget() is used with null surfaces
- 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>
Some input related code in kwin is mislead by the fact that when the
input region is infinite, SurfaceInterface::input() is going to return
an empty QRegion object.
We cannot really do that because the client could have just set a valid
empty wl_region object to ignore all input events.
This change makes SurfaceInterface assign an actually infinite region
when a NULL input region has been passed to set_input_region().
modifiers request by the input method is supposed to send the raw
modifiers based on the keymap of the keyboard grabbed as result of the
grab_keyboard request. If input method client is not using the keysym
functionality it can decide to not send out the modifiers_map, since it
is already known to compositor as part of keymap event sent by it.
While at it also guard against empty modifiers_map, if this happens
ideally compositor should handle that information based on the keymap
sent out using grab_keyboard function, but since currently, we do not
have the grab_keyboard implemented in here, send out the NoModifier if
that happens.
When touching a surface that doesn't register to wl_touch events, KWin
didn't send frame events (which it does for regular pointer and touch
events), causing severe updating issues with some clients.
Test Plan:
Launch a client that doesn't attach to wl_touch (for instance,
rootston) with WAYLAND_DEBUG=client and watch the logs while touching
its window.
The xdg-output spec omits whether the compositor has to destroy all xdg-
output resources when the associated wl_output global is removed.
This means that no xdg-output resource should be destroyed unless the
client has called the destructor request; otherwise the client may panic
due to protocol errors.
Starting with Qt 5.15.2, it's okay to destroy generated wrapper objects
without destroying associated resources. Destructor requests will be
handled behind the scenes for inert and orphaned resources by code that
is generated by qtwaylandscanner.
BUG: 426293
If we track the commit counts at compositor global, this will fail
horribly for anything other than the first text-input-v3 client, as for
new client the serial count will not be what it expects in the done()
request and it will simply consider events as outdated and will refuse
to accept those events
s_version is used only to initialize a global so there is no point for
storing protocol version in a static member field and use funky syntax
in the cpp file to initialize it. This change also simplifies the code.
If a frame callback resource is destroyed, it will unregister itself
from corresponding lists in current, pending, and cached state.
However, this means that we need to be super duper careful when the
compositor wants to destroy all frame callbacks. We need to make a copy
of a frameCallbacks list; otherwise a call to removeOne() will
invalidate iterators and the compositor may crash.
Currently, that copy is made implicitly. Some people may see that code
and add qAsConst() without realizing the consequences it will lead to.
This change improves the readability of that code by making explicit
copies of frameCallbacks in code that shuts down SurfaceInterface.
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.
When the focusedTextInputSurfaceChanged() signal is emitted, it is
expected that SeatInterface::focusedTextInputSurface() will return
the new focused text input surface.
- 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>
One problem with delaying destruction of buffer objects is that the
compositor may create a shadow that references defunct buffers.
One way to fix that issue is to immediately destroy buffers. However,
there is other way to address the issue - keep released buffers alive.
If a buffer is kept alive by the client, then it will most likely be
used again. It also simplifies buffer management.
BUG: 425233
A DataOffer can slightly outlive a DataSource; a client will still be
told it's deleted but could call a method in a race.
DataOfferInterface correctly checks for source being still valid, but
nothing updates it when it gets deleted.
BUG: 396308
If the underlying wl_surface object has been removed, the input panel
surface will be still alive.
Unfortunately, in order to make the test pass, the input panel surface
interface must have a destructor request.
So, the code that tests the destruction of an input panel surface had
been removed.
Since the screencast protocol is unstable, the ScreencastInterface class
and the ScreencastStreamInterface class must carry version info in their
class names.
In v1 to v3 of textinput protocol, updates for the text input state
needs to be updated explcitly using commit or update state request, so
send out this information to compositor, which can use it to update the
input method state.
We need to convert the content hint and content purpose to the
protocol values before passing it to the input method since text-input
v0, v2 and v3 have a different values for some of enums. We need to do
manual translation.
Generated code typically cleans up resource objects when the client
calls the relevant destructor.
In multi-cast mode our wrapper can be deleted at any time, whilst a
client resource exists any existing resources that have a pending
message will then crash the compositor.
Deleting resources ahead of time also resolves this. calls to this
resource will no-op. The zxdg_output_v1::destroy_func will then be
called to delete the Resource object.
If a client attempts to create an input panel surface for a wl_surface
that already has a role assigned, we must post a protocol error or else
the behavior of the input panel surface will be undefined.
Posting an error of 0 is not really correct, but on the other hand the
spec has no any error enums.
This reverts commit 3cf004b68e.
Unfortunately, 3cf004b broke a couple of tests in kwin due to Qt not
emitting QAbstractEventDispatcher::aboutToBlock() signal when macros
such as QTRY_VERIFY() or QTRY_COMPARE() spin the event loop.
Frame callbacks only indicate when the client can start rendering a new
frame, it's not meant to be precise. If the client wants to do some
black magic with frame scheduling and so on, it needs to use a protocol
such as presentation_time. This change removes the pointless flush to
prevent over-flushing client connections.
We have a situation where some clients drop their old offer before
creating a new one. This means klipper tries to fill in the empty
clipboard at the same time the client posts its new real contents.
This adds in a flag (via a hidden mimetype) that klipper is trying to
replace a null clipboard. If this flag is set and our clipboard is not
null because the client has updated it in the meantime we ignore the
klipper update.
It's a workaround, rather than an ideal fix at a data level, but it
solves the problem in the interim.
CCBUG: 424855