Commit graph

1079 commits

Author SHA1 Message Date
Vlad Zahorodnii
9769969d8c Drop PlasmaWindowInterface::setThemedIcon()
It's unused. KWin uses setIcon() instead.
2021-10-22 18:44:33 +00:00
Aleix Pol
efc7731088 screencast: Implement version 2 of the protocol 2021-10-22 12:49:15 +00:00
Aleix Pol
01645645a7 outputconfiguration: No need to cast, q already is the right type 2021-10-21 23:44:11 +02:00
Rodney Dawes
dff485f13b TextInputV2: Add API to set modifiers map on clients 2021-10-13 14:31:32 -04:00
Rodney Dawes
b58cc08a36 TextInputV2: Don't drop or convert modifiers for keysym events 2021-10-13 14:31:32 -04:00
Rodney Dawes
25942d6fcb InputMethod: Avoid needless complex conversion of key modifiers
As we only need to pass the modifiers around, rather than do anything
internally with them, simply pass them around with minimal conversion.
2021-10-13 14:31:32 -04:00
Alex Richardson
105042ccda Correct the eglQueryWaylandBufferWL_func prototype
I am trying to build against a Qt built without OpenGL. In that case, the
openGL headers have not been included and therefore GLboolean is not
defined. Use EGLBoolean to match the EGL prototype.

See also d18486c033
2021-10-05 11:16:26 +01:00
Vlad Zahorodnii
48d9e4cc0e Automatically close fds for inert resources
If the plasma window resource is inert, the associated get_icon handler
won't be invoked. This results in leaked file descriptors.

With this change, the corresponding close() function call will be
generated to avoid leaking file descriptors and potentially crashing the
session due to kwin running out of fds.

BUG: 438097
2021-09-27 18:02:58 +00:00
Xaver Hugl
ba0d099e38 outputdevice: add missing done events
CCBUG: 442520
2021-09-21 13:34:04 +02:00
Vlad Zahorodnii
5853cc38a1 Send kde_output_device_v1.current_mode to the right resource
Currently, send_current_mode() is called for every mode resource, no
matter whether the given output resource and mode resource belong to the
same client, libwayland-server doesn't like that and it prints a warning
about a compositor bug.

With this change, the output device will remember the mode resources for
every output resource and avoid sending current_mode events with modes
that belong to other clients.
2021-09-20 11:14:50 +00:00
Xaver Hugl
177d35cace Implement drm-lease-v1 2021-09-17 23:10:13 +02:00
Xaver Hugl
3abbc31272 fix rgb range sending
BUG: 442548
2021-09-17 16:36:06 +02:00
Severin von Wnuck
bd9b42912b Fix texture format handling for Nvidia driver 2021-09-17 13:28:13 +02:00
David Edmundson
b219b9175c Only guard DND cancel events with the version check
In a recent refactor a guard seemingly in the wrong place on
SeatInterface was moved into AbstractDataSource, as typically that's
where we guard.

However it turns out the original code was correct, we want to send
cancel for all clipboard cancels, but for D&D it's version dependent.

This class introduces a new method to astract that from seat.
2021-09-10 14:06:49 +00:00
Vlad Zahorodnii
cd512fee2b Fix a typo
It makes more sense to test primarySelection().
2021-09-10 14:27:52 +03:00
David Redondo
efbe1c9664 Introduce AbstractDropHandler
This abstract class represents an object that receives drag and drop
events.
This roughly maps to some of DataDevice's receiving methods, but by
being abstract
also allows us to use the same code from xwayland in a manner
transparent to all
code paths.

Preivous xwayland support with "proxy surfaces" have been removed.

--
In future it will be extended to have the mouse move events, so that we
can
avoid spying on the seat both in dataDevice and kwin's internal filter
2021-09-09 09:04:05 +00:00
David Redondo
0aaed33c66 Move drag logic to seat and introduce SeatInterface::startDrag
A dataDevice has a request to start a drag with multiple parameters.
As kwayland's goal is to turn an event-driven API into a property cache API we
store this data. This patch moves that storage to the Seat as properties of the
active drag, rather than a property of the data device that happened to
initialise it.

This both helps keep a lot of other logic together, but also allows us to expose
a public startDrag method that can be invoked from Kwin's internal surfaces or
xwayland.

Any properties in DataDevice now relate to data being dropped on the device.
2021-09-09 09:04:05 +00:00
Carl Schwan
ea65068fe0 Fix documentation generation
Otherwise all the 'The' are linked to this class and the class is named The
2021-09-07 20:40:22 +00:00
Méven Car
84dd746a2a Fix some warnings 2021-09-03 09:42:16 +00:00
David Redondo
ca92dccbd8 Install all primaryselection interfaces headers 2021-09-03 08:19:15 +00:00
Jan Blackquill
c2680d7108 Implement set_frost in contrast protocol 2021-09-02 22:41:52 +00:00
Xaver Hugl
e31d10c18d output protocols: add rgb range setting 2021-09-01 20:54:14 +00:00
Méven Car
a9458fa031 Remove unused code after cee6912d00 2021-09-01 17:20:38 +00:00
Méven Car
57f8837e39 Fix two ununsed compile warnings 2021-09-01 18:07:03 +02:00
Méven Car
cee6912d00 Implement kde-output-device-v2 and kde-output-management-v2 2021-09-01 12:20:21 +02:00
Aleix Pol
8d9607391c Implement org_kde_plasma_window_management::send_to_output 2021-08-31 17:26:29 +02:00
Alexander Lohnau
525d12bee5 Run clang-format
If you want git blame to ignore formatting revisions run:
git config blame.ignoreRevsFile .git-blame-ignore-revs
2021-08-29 07:11:06 +02:00
Alexander Lohnau
6c163e3260 clang-format: exclude waylandscanner from formatting 2021-08-28 12:40:34 +02:00
Vlad Zahorodnii
2b3e8d6775 Decouple activation feedback from plasma window management global 2021-08-25 09:21:20 +00:00
Aleix Pol
773995de56 plasma-window-management: Support new activation concepts 2021-08-19 18:08:06 +00:00
David Edmundson
aeaa480b0c Add API to record the socket name used by a given file descriptor 2021-08-16 17:37:15 +01:00
Vlad Zahorodnii
d0a0c70d9c Add aboutToBeDestroyed signal to various xdg-shell classes
With the aboutToBeDestroyed signal, the compositor will be able to
perform cleanup before the QObject::destroyed signal is emitted, which
saves us some nullptr checks.
2021-08-12 10:35:13 +00:00
David Redondo
6ba9856a29 Implement wlr-data-control v2
This adds primary clipboard support to data control.
2021-08-12 09:01:08 +02:00
Vlad Zahorodnii
1083e650d5 Avoid using bitfields
Unfortunately, bitfields can be initialized using default member
initializer only since C++20.
2021-08-06 12:59:07 +03:00
Manuel Stoeckl
3f6433b81d Add a few 30-bit wl_shm formats
Register WL_SHM_FORMAT_ARGB2101010 and its XRGB,ABGR, and XBGR variants.
These (little-endian) formats are only advertised on little endian
machines, where there exist matching (native-endian) QImage formats.
2021-08-03 21:18:26 -04:00
Vlad Zahorodnii
00f112f48a Allocate less memory for every wl_callback
wl_callback and wl_region are two kinds of objects that are frequently
allocated.

Currently, we make two extra heap allocations per each wl_callback
object. One for the wrapper object (FrameCallback) and the other one is
for its Resource.

With this change, no extra allocations will be made. Also, due to
relying on wl_resource linked lists, the destroy listener implementation
got much simpler.

This won't result in huge memory usage or performance improvements, but
still it's worth reducing the number of memory allocations where possible.
2021-07-29 10:21:13 +03:00
Vlad Zahorodnii
43cfd25d27 Search for Xwayland surfaces differently
Currently, we store all surfaces in a single list and use linear search
to find the SurfaceInterface by its object id and client connection.

With this, we first search for the wl_resource object by its id. Once we
have a wl_resource, SurfaceInterface::get(wl_resource) can be used.

The main advantage of the proposed solution is that we don't need to
maintain a static list with all SurfaceInterface objects.
2021-07-28 14:38:01 +03:00
Vlad Zahorodnii
ba3f587200 Drop ClientConnection::createResource()
It's leftover after now gone Global and Resource.
2021-07-28 14:21:11 +03:00
Vlad Zahorodnii
0ed5f6f096 Remove unused wl_event_loop forward declaration 2021-07-28 13:46:56 +03:00
Vlad Zahorodnii
f248dce3da Ignore dpms status in Display::outputsIntersecting()
Display::outputsIntersecting() is used to compute the list of outputs
where the given surface is. The problem is that it accounts for the dpms
mode.

This means that if an output is turned off, clients will receive a leave
event and they may potentially decide to change the buffer scale and
commit new buffers.

The dpms check was introduced to fix a crash, however since then, output
bits in kwin have changed drastically, in particular how wl_output
objects are destroyed. So, it should be safe to remove the dpms check.
2021-07-28 10:28:21 +00:00
David Redondo
8cffad3fe8 Query height instead of texture format
Texture queries do not seem to work on nvidia and QtQuick windows
will then no be rendered.
2021-07-27 17:30:16 +02:00
Vlad Zahorodnii
7335d54209 Fix mapped status tracking for subsurfaces
A subsurface should be considered mapped only if it has a buffer
attached and its parent is also mapped.

Currently, mapped status logic in SurfaceInterface is somewhat broken
for sub-surfaces. For example, the mapped() signal will be emitted even
if the sub-surface should be considered unmapped according to the spec.
2021-07-23 21:42:30 +03:00
Vlad Zahorodnii
0fcc4af42d Make SurfaceInterface::buffer() const 2021-07-23 19:58:42 +03:00
Vlad Zahorodnii
0045eaecfa Reference shm pool for destroyed buffers
Currently, if an application is closed, all of its shm buffers will be
destroyed. However, the compositor may want to access them to fade out
the window.

With this change, the underlying shm pool will be referenced when a shm
buffer is destroyed. So, the compositor can access buffer data even if
the buffer is destroyed.
2021-07-22 11:41:08 +03:00
Vlad Zahorodnii
e4bf7e0334 Drop Global and Resource classes
They're unused.
2021-07-22 11:41:08 +03:00
Vlad Zahorodnii
0d2879c62d Split BufferInterface
Currently, the BufferInterface encapsulates all the kinds of client
buffers. This has become a somewhat annoying issue as we want to
reference the shm pool if a shm buffer is destroyed, or have custom
buffer readiness logic for linux dma-buf client buffers.

Implementing all of that with the current abstractions will be
challenging as there's no good separation between different client
buffer types.

This change splits the BufferInterface class in three sub-classes -
DrmClientBuffer, LinuxDmaBufV1ClientBuffer, and ShmClientBuffer.

In addition to that, this change fixes the broken buffer ref'ing api.
2021-07-22 11:41:06 +03:00
Vlad Zahorodnii
a244769a3f Make layer-surface acknowledged configure serials double-buffered state
This will be needed to delay surface commits.
2021-07-21 17:26:12 +00:00
Vlad Zahorodnii
c5691ba4de Make xdg-surface acknowledged configure serials double-buffered state
This will be needed to delay applying surface state.
2021-07-21 17:26:12 +00:00
Vlad Zahorodnii
9210e25c52 Build surface-to-buffer matrix based on current state
This makes it more clear that the surface-to-buffer matrix is computed
based on the current surface state.
2021-07-21 06:18:38 +00:00
Vlad Zahorodnii
ce92ac7451 Merge SurfaceInterfacePrivate::commit() and SurfaceInterfacePrivate::surface_commit()
This removes an unnecessary layer of indirection.
2021-07-21 06:18:38 +00:00