Commit graph

1146 commits

Author SHA1 Message Date
Vlad Zahorodnii
219cb54d35 Add missing Display class forward declaration 2022-04-19 13:19:20 +03:00
Vlad Zahorodnii
227ab071be Run .clang-format 2022-04-19 13:14:26 +03:00
Weng Xuetian
14ae6e3100 Fix race in wp_drm_lease_v1.
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
2022-04-16 00:01:12 -07:00
Vlad Zahorodnii
c157e948e2 autotests: Fix TestWaylandSurface
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.
2022-04-15 09:44:39 +00:00
Nicolas Fella
bb28c84ec4 Add resourceName to plasma windowmanagement
This allows to get the resource name for XWayland windows, which is useful in the task manager
2022-04-09 14:44:19 +00:00
Vlad Zahorodnii
91f883f5ca Simplify code that announces available modes and current mode
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
2022-04-08 15:56:17 +03:00
Vlad Zahorodnii
8f36b431e7 Add Q_ASSERT in OutputDeviceV2Interface::setCurrentMode()
CCBUG: 452318
2022-04-08 11:32:21 +03:00
David Edmundson
c05e2fea45 Guard subsurface parent access.
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
2022-04-05 15:33:52 +00:00
David Edmundson
d73bdf2ee2 Fix layer shell reset
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.
2022-04-05 13:59:12 +01:00
Vlad Zahorodnii
1dd6575d76 Compute valid opaque region at surface commit time
This allows us to simplify rendering code in the compositor.
2022-03-29 16:27:17 +03:00
Volker Krause
a1d61bb6e8 Link against Qt::CorePrivate as we use internal event loop headers here
Needed to compile against Qt6.
2022-03-18 14:34:41 +00:00
Volker Krause
0952512e0a Move Tranche::operator== before its first use
Qt6 QList::operator!= fails to compile otherwise.
2022-03-18 14:34:41 +00:00
Volker Krause
e5a85f503a QScopedPointer in Qt6 doesn't implicitly cast to bool anymore 2022-03-18 14:34:41 +00:00
Volker Krause
e0c1d2583a Add Wayland includes needed to build against Qt6 2022-03-18 14:34:41 +00:00
Volker Krause
ccad0066e7 Disambiguate KWaylandServer::Display
This unfortunately clashes with a typedef in a Qt6 header.
2022-03-18 14:34:41 +00:00
Volker Krause
6cd0014364 Adapt build system to also support Qt6 2022-03-18 14:34:41 +00:00
Volker Krause
09624c5a9b Make the qtwaylandscanner fork build against Qt6 2022-03-18 14:34:41 +00:00
Aleix Pol
124c78cb4b screencast: Support screencast of regions 2022-03-15 16:09:45 +01:00
Xaver Hugl
215de363e8 linuxdmabuf: port to QVector
QVector is much more suitable for modifiers in KWin than QSet, because you
can access the underlying array
2022-03-15 03:25:50 +01:00
Xaver Hugl
9c5d3c9a70 outputchangeset: set default values for vrr policy and rgb range
If this is not done then KScreen will sometimes unintentionally reset them
to the default.

BUG: 442520
FIXED-IN: 5.24.4
2022-03-11 03:51:18 +01:00
Vlad Zahorodnii
8e304963ad Make pointer focus handling less error prone
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.
2022-03-03 13:35:04 +00:00
Marco Martin
fccbe4e027 Add a methood to fore cancel any drag in progress
This is needed to cancel drags by pressing Escape which is
resposibility of the compositor

CCBUG:405267
2022-03-03 09:09:27 +00:00
Manuel Stoeckl
10b109e31c Add support for [ax]bgr16161616 wl_shm formats
These require Wayland 1.20, for the format definitions.
2022-03-02 09:08:53 +00:00
Heiko Becker
df845939a4 Fix kdebugsettings categories file
By using the same EXPORT for ecm_qt_declare_logging_category and
ecm_qt_install_logging_categories.
2022-02-23 10:14:44 +01:00
Kai Uwe Broulik
6e4acb4303 linuxdmabuf: Add unistd.h include
Don't rely on someone else to pull it in for `close()`

Signed-off-by: Eike Hein <eike.hein@mbition.io>
2022-02-22 15:31:38 +01:00
Aleix Pol
62637c1a92 seat: Do not assert on corner touch cases
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
2022-02-21 04:08:43 +01:00
Vlad Zahorodnii
9e25fd0468 Add support for xdg_toplevel.configure_bounds()
xdg_toplevel.configure_bounds() allows to indicate the client the
maximum surface size bounds.

wayland-protocols: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/41
2022-02-12 14:14:24 +02:00
Tobias C. Berner
17fc13f100 Add missing errno.h include 2022-02-10 09:11:31 +01:00
Arjen Hiemstra
e6c1ccbd3b Fix drag and drop with touch between different windows
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.
2022-01-27 10:44:58 +00:00
Vlad Zahorodnii
c793dd93d2 Make data source objects "parentless"
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
2022-01-25 09:59:59 +02:00
Xaver Hugl
fd3a7c3c99 linuxdmabuf: remove unnecessary fallback
DRM_FORMAT_MOD_INVALID is now explicitly included in KWin where needed
2022-01-14 17:07:07 +01:00
Vlad Zahorodnii
f06e83f241 Replace resize edges flag with an enum
It's more typesafe.
2022-01-12 14:59:06 +02:00
Vlad Zahorodnii
ee1ea077ba Store surface object in tablet cursor using QPointer
The SurfaceInterface can get destroyed and TabletCursorV2 may return a
dangling pointer.

BUG: 446255
2022-01-10 13:17:32 +02:00
Vlad Zahorodnii
49aadee2a9 Use correct "natural" surface size when computing surface-to-buffer matrix
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.
2022-01-08 15:15:14 +02:00
Weng Xuetian
5475751c7b Fix testTextInputV3Interface
Put EnableEmitter in the anonymous namespace to avoid it to be linked to the
wrong implementation.
2022-01-04 11:24:45 -08:00
Xaver Hugl
a011fe74b2 linuxdmabuf: fix sending default tranches
Only the first one was getting sent
2022-01-04 15:22:27 +00:00
Weng Xuetian
afc2a1c0aa Clean up the focus handling for text input.
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.
2021-12-29 00:38:48 +00:00
Xaver Hugl
f2bf7fb1f8 linuxdmabuf: allow setting the default tranches 2021-12-23 00:24:48 +00:00
Weng Xuetian
3ef4f994fa Implemnt preedit_styling for text input v2. 2021-12-19 04:09:48 -08:00
Vlad Zahorodnii
a711f90a69 Include linux/input.h without performing any checks
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.
2021-12-17 13:12:31 +02:00
Vlad Zahorodnii
6cdf056047 autotests: Remove unrelated client-side wrapper tests
They belong in KWayland::Client.
2021-12-17 06:56:41 +00:00
Tobias C. Berner
1bc7afe8aa Add helpers to read the executable path for a given PID 2021-12-17 06:54:53 +00:00
Weng Xuetian
2da3276a95 Fix the wrong argument order for send_modifiers. 2021-12-12 23:49:44 -08:00
Vlad Zahorodnii
47897e249f Add ServerDecorationInterface::preferredMode()
This change adds the preferred decoration mode similar to what
XdgToplevelDecorationV1Interface has. It's needed to clean up some kwin
code.
2021-12-08 21:31:17 +02:00
Vlad Zahorodnii
1e84a56df8 Introduce fake None xdg-decoration mode
This is intended for borderless maximized windows. They should be
neither client-side nor server-side decorated.
2021-12-08 21:31:16 +02:00
Xaver Hugl
db91050fb5 dmabuf-feedback: fix crash
BUG: 446502
2021-12-05 13:46:52 +01:00
Xaver Hugl
53064d9af3 linuxdmabuf: implement dmabuf-feedback
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.
2021-11-30 10:22:31 +01:00
Xaver Hugl
43ccc5910b linuxdmabuf: split out declarations for private classes
The cpp file is getting too long and unwieldy
2021-11-28 13:48:14 +00:00
Arjen Hiemstra
8af2a010c7 Implement drag surface transformation for touch events
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.
2021-11-17 13:32:00 +00:00
Arjen Hiemstra
1bd496f42b DataDevice: Send enter event with a correct position if we're using touch
It used to send the pointer position, which may be somewhere completely
different when we're using touch.
2021-11-17 13:32:00 +00:00