Basically this is a well known issue in wayland for globals. If bind
comes after destroyed, it will raise a invalid global error. The common
practice is to delay the destroy of global. Similar technique is also
applied to wl_output.
CCBUG: 452435
The API of SurfaceInterface was changed so it always maintains an opaque
region.
At the surface commit, if the attached buffer is opaque, the whole
surface will be marked opaque. Otherwise, the specified opaque region
will be intersected with the surface rect.
If no mode has the current flag set, the first mode object will be
announced twice.
There's also no benefit from sending the current mode as last. If the
current mode changes, the compositor will send the current_mode event,
not the mode event.
BUG: 452318
Whilst a subsurface must have a parent at the time of creation, the
lifespan is not guaranteed afterwards.
It's a weird thing for a client to do, but we need to not crash
afterwards.
If the parent surface is destroyed we should consider the surface
unmapped.
BUG: 452044
In the current form any client committing multiple times without
attaching a buffer would unset the cached state and trigger an error.
It's legal (though weird) to commit multiple times before attaching a
buffer.
We should only reset the state if we commit an empty buffer after having
committed an existing buffer. This brings us in line with XdgShell.
Currently, if the pointer surface has to change between two surfaces,
the compositor must do the following
seat->setFocusedPointerSurface(nullptr);
seat->notifyPointerMotion(newPos);
seat->setFocusedPointerSurface(focus);
The pointer motion is needed so the enter event has correct position,
setFocusedPointerSurface(nullptr) is needed to avoid sending a bad
motion event before the leave event.
This change makes the pointer focus api less error prone by splitting
setFocusedPointerSurface() in two functions - notifyPointerEnter() and
notifyPointerLeave().
notifyPointerEnter() takes new focus surface as well as the position
where the pointer has entered the surface so the focus update can be
atomic and without any corner cases.
notifyPointerLeave() is used to clear pointer focus.
Consider the cases where we get a touch move or touch up but we never
received a touch down before.
In the case of move, we'll simulate a touchDown right there and move on
with reality.
In the case of touch up, we'll just ignore the event as simulating could
just be more confusing.
BUG: 450338
When dragging from one window to another, we may end up in a data_device
that didn't get "data_device_start_drag". In that case, the internal
touch point serial will be incorrect and we need to update it to the
serial from the seat. The serial stored in the seat is changed to
std::optional so we can properly check if it is set.
The SeatInterface cleans up currentSelection and currentPrimarySelection
when the AbstractDataSource::aboutToBeDestroyed() signal is emitted, but
since the data source and primary data source have parent objects, they
can be potentially destroyed without emitting the aboutToBeDestroyed()
signal and thus leaving dangling pointers in SeatInterface.
CCBUG: 449101
If the source rectangle is not set, we need to use the surface size
given by the attached buffer. It's computed as buffer size / scale, but
the buffer can also be transformed. In other words, we need to compute
the natural surface size as follows - buffer size / scale and transpose
the result if the buffer is rotated 90 or 270 degrees.
Usually, a client will only use text input v2/v3. Do not return the focused
surface for text input if it has no relevant text input resource.
If text-input object is created after surface get the focus, send
enter to this text input object. Ensure sendEnter and sendLeave always
appear in pair.
Also, use the same technique in text-input-v2 for text-input-v3 to
handle per resource's enable/disable state, and only send update to
enabled text-input-v3 object.
Currently drag-and-drop doesn't work on FreeBSD because relevant input
parts of kwayland-server are not compiled there.
HAVE_LINUX_INPUT_H is set to 0 on FreeBSD because linux/input.h is in
/usr/local/include and check_include_file() doesn't look there.
Regardless of that, as FreeBSD developers pointed out, including
linux/input.h is the recommended way to get input event codes so let's
make it a hard dependency.
dmabuf-feedback allows the compositor to give the client feedback on what
formats and modifiers are best to use, and for which devices it needs to
allocate its buffers, which improves performance and efficiency.
Reusing the pointer transformation causes drag with touch to send
completely incorrect coordinates. So implement the "TODO" item about
surface transformation for touch, so we send correct drag events for
touch.