Commit graph

997 commits

Author SHA1 Message Date
Aleix Pol
674e1433af textinputv2: readability
Remove unnecessary casts
2021-05-01 03:24:24 +02:00
Aleix Pol
036663e76d textinputv2: announce the input panel to be hidden as the instance gets disabled
Otherwise we disable it and all events will be disabled (since surface
gets cleared).
This is especially useful since otherwise we lose synchronicity with the
client and weird behaviours happen (like when the client thinks it has a
keyboard but it actually does not).
2021-04-30 12:46:14 +00:00
Xaver Hugl
3b7a43e54b Add VRR to OutputDevice and OutputConfiguration 2021-04-29 13:37:37 +00:00
Aleix Pol
6a3e80d11d Use Q_ENUM on enum class
Otherwise it can't be passed to QDebug at all
2021-04-29 11:04:37 +00:00
Alexander Lohnau
3acd2b5a26 GIT_SILENT Add trailing comma to enums 2021-04-29 11:45:00 +02:00
Aleix Pol
445289d168 Fix leak in test
Unregister an interface when we're done with it. This also ensures we
don't have several running in parallel as well.
2021-04-22 17:31:26 +02:00
Aleix Pol
c9c1c3ae0d Make sure we don't leak interfaces
Properly set the parent
2021-04-22 17:30:54 +02:00
Aleix Pol
b2d648df5d datadevice: do not call a null dragSource
Fixes the following backtrace:
*0  KWaylandServer::DataDeviceInterface::dragSource() const (this=0x0)
at ./src/server/datadevice_interface.cpp:199
*1  0x00007f10d67b0c71 in
KWaylandServer::DataDeviceInterface::updateDragTarget(KWaylandServer::SurfaceInterface*,
unsigned int) (this=0x55c42e3ee9a0,
surface=surface@entry=0x55c42e4b3170, serial=serial@entry=3104)
    at ./src/server/datadevice_interface.cpp:278
*2  0x00007f10d67d8e52 in
KWaylandServer::SeatInterface::setDragTarget(KWaylandServer::SurfaceInterface*,
QPointF const&, QMatrix4x4 const&)
(this=this@entry=0x55c42d422ed0, surface=0x55c42e4b3170,
globalPosition=..., inputTransformation=...) at
/usr/include/c++/9/bits/atomic_base.h:413
*3  0x00007f10d67d9209 in
KWaylandServer::SeatInterface::setDragTarget(KWaylandServer::SurfaceInterface*,
QMatrix4x4 const&) (this=this@entry=0x55c42d422ed0, surface=<optimized
out>, inputTransformation=...)
    at ./src/server/seat_interface.cpp:578
*4  0x000055c42cb4563a in KWin::Xwl::XToWlDrag::setDragTarget()
(this=this@entry=0x55c42ea07a00) at ./src/toplevel.h:990
*5  0x000055c42cb47a68 in KWin::Xwl::XToWlDrag::offerCallback(QString
const&) (mime=..., this=0x55c42ea07a00) at ./src/xwl/drag_x.cpp:242
*6  KWin::Xwl::XToWlDrag::offerCallback(QString const&)
(this=0x55c42ea07a00, mime=...) at ./src/xwl/drag_x.cpp:237
*7  0x00007f10d5dc06fe in  () at /lib/x86_64-linux-gnu/libQt5Core.so.5
2021-04-22 12:21:42 +02:00
Xaver Hugl
3905cfe3ee Add support for overscan 2021-04-19 13:02:18 +02:00
Heiko Becker
d4e5468c70 cmake: Specify file extension for idleinhibit_v1_interface
Gets rid of a cmake warning.

GIT_SILENT
2021-04-16 16:23:17 +02:00
Laurent Montel
2908a02d92 It's deprecated in qt5.15 2021-04-08 22:32:25 +02:00
Vlad Zahorodnii
da81f4c9e8 Send valid UUIDs for output device globals
Currently, kwin sends invalid uuids. This change makes harder to send
invalid uuids by porting relevant parts of the OutputDeviceInterface to
QUuid.
2021-04-08 17:35:30 +00:00
Vlad Zahorodnii
8f3993c91b Drop workaround for QTBUG-52092
I've been using kwaylandserver without this workaround for a while and
haven't experienced any issues. Also, there were some sub-surface fixes
in QtWayland.
2021-04-08 10:17:01 +03:00
Vlad Zahorodnii
8b7136f70d Send only current wl_output mode
Non-current output modes were deprecated due to various reasons, e.g.
it's not possible to remove some nodes; two modes can have the same
resolution and the refresh rate but different flags, but wl_output.mode
fails to communicate that properly; the usefulness of non-current modes
is questionable. For more details, please refer to [1].

[1] https://gitlab.freedesktop.org/wayland/wayland/-/issues/92
2021-04-07 11:04:26 +00:00
Vlad Zahorodnii
f30bd9e341 Rework OutputInterface following new design principles 2021-04-07 11:04:26 +00:00
Vlad Zahorodnii
f16320e693 Don't use nested private class in ClientConnection
Nested private classes are highly discouraged in KWaylandServer due to
their flaws, e.g. it's very easy to forget to put Q_DECL_HIDDEN, etc.
2021-04-06 06:45:39 +00:00
Vlad Zahorodnii
35d601bb23 Don't use nested private class in FilteredDisplay
The usage of nested private classes is highly discouraged in
kwaylandserver due to various reasons, e.g. it's easy to forget to put
Q_DECL_HIDDEN, etc.
2021-04-05 11:35:06 +03:00
Vlad Zahorodnii
f119c9470d Fix some coding style issues in FilteredDisplay 2021-04-05 11:33:54 +03:00
Vlad Zahorodnii
ba4f796e24 Remove some unused includes 2021-04-05 11:20:24 +03:00
Vlad Zahorodnii
7058710eca Use code generated by qtwaylandscanner to send xdg-exported handle
This was overlooked during the port to the new approach.
2021-04-02 10:04:49 +03:00
Vlad Zahorodnii
18815f88fb Drop SurfaceInterface::trackedDamage()
There is no need for both kwin and kwaylandserver track damage.
2021-03-31 13:33:29 +00:00
Vlad Zahorodnii
75a6fd29fd Introduce SurfaceInterface::childSubSurfacesChanged
Currently, the SurfaceInterface class has a signal that is emitted
whenever any sub-surfaces in its sub-tree changes in a way that requires
a repaint. It is emitted when a sub-surface is resized, moved, or
damaged, etc. There is no way for the compositor to track changes in the
stacking order of sub-surfaces efficiently.

This change replaces the subTreeChanged signal with a less noisy signal
that's emitted whenever the list of direct child sub-surfaces changes.
2021-03-31 13:24:58 +00:00
Vlad Zahorodnii
daadaa70de Send current primary selection after introducing focused surface
Toolkits such as GTK don't like that kwin sends the current primary
selection before the wl_keyboard.enter event.
2021-03-30 06:03:39 +00:00
Aleix Pol
4a357d503e Fix typo 2021-03-26 15:32:18 +01:00
Vlad Zahorodnii
755004acd0 Remove redundant check
Given that both pointers are not null and the size is a positive
integer, qstrncpy() can never return null.
2021-03-26 13:41:04 +02:00
Vlad Zahorodnii
c56712776a Fix management of keymap files
This is a regression that was introduced with the port to the new
approach.
2021-03-26 13:17:13 +02:00
Vlad Zahorodnii
83087817f4 Forward keyboard events via seat
This is needed for keyboard grabs. If the seat is notified about a
keyboard event, it will need to forward the event to the grab object,
which in its turn will decide what should happen to the event.
2021-03-26 09:08:12 +00:00
Vlad Zahorodnii
70daa07f27 Destroy output device globals with a delay
When hot plugging outputs, we may hit the wl_global race condition.

We need to delay the destruction of output device globals to prevent
hitting that race condition.
2021-03-26 07:50:32 +00:00
Vlad Zahorodnii
b27150387c Fix -Wunused-variable 2021-03-25 17:29:51 +02:00
David Edmundson
1fec9ed4ae Add API to remove globals without immediate destruction
Destroying a global leads to a race on the client. If a client binds
at just the wrong moment they will use an invalid ID and cause a
protocol error. The current best thing to do is to announce the removal
then remove the global (and thus the ID) only after a delay. Non-ideal,
but better than nothing.

Pragmatically this affects only:
Blur/Contrast/Slide/Output/OutputDevice

See https://gitlab.freedesktop.org/wayland/wayland/issues/10 for more.
2021-03-25 12:31:03 +00:00
Vlad Zahorodnii
71d4b463f0 autotests: Drop testPlasmaWindowModel
KWaylandServer doesn't implement the KWayland::Client::PlasmaWindowModel
class so there is no point for carrying this test.
2021-03-25 08:19:19 +00:00
Vlad Zahorodnii
0b688f6b6e Improve code readability in xdg-foreign wrapper
This moves out code that links/unlinks imported toplevels and child
surfaces in functions to improve code readability.
2021-03-25 07:53:36 +00:00
Vlad Zahorodnii
060940e426 Remove unused method in XdgImporterV2Interface 2021-03-25 07:53:36 +00:00
Vlad Zahorodnii
77a065e8de Remove redundant anonymous namespace
static functions already have translation unit internal linkage.
2021-03-24 15:08:31 +02:00
Vlad Zahorodnii
06cfe1a24a Fix a typo
This probably needs to be currentPrimarySelection.
2021-03-23 21:10:07 +02:00
Vlad Zahorodnii
a50f84a868 Merge notifyPointerPress() and notifyPointerRelease()
This brings the API of the SeatInterface class and the PointerInterface
class closer the corresponding Wayland API.
2021-03-23 11:20:03 +02:00
Vlad Zahorodnii
2af2ba6d4c Use common doxygen comment terminator style
In plasma code, it's more common to see `/** ... */` doxygen comments
rather than `/** ... **/`.

This change fixes up doxygen comment terminators to prevent inconsistency
issues.
2021-03-23 08:14:02 +00:00
Vlad Zahorodnii
c94787bbf4 Move DESIGN.md to toplevel directory
This makes DESIGN.md more noticeable.
2021-03-22 21:30:43 +02:00
Vlad Zahorodnii
a3ab80677c Fix handling of the case where specified surface can't imported
An xdg_imported resource must be created no matter whether there is an
exported surface with the specified handle.

This change fixes handling of that case in kwaylandserver by introducing
a dummy imported object.

If there is no exported surface with the given handle, the compositor
should create an xdg_imported resource and immediately send the
destroyed event.

A dummy imported object is needed because generated code sets resource
implementation; otherwise we would set an implementation without any
user data to mark the resource as inert.
2021-03-22 17:46:12 +00:00
Vlad Zahorodnii
d4901d16fa Call XdgImportedV2Interface::send_destroyed() that takes no resource
XdgImportedV2Interface already knows what the associated resource is, so
we can call send_destroyed() method that takes no resource to let auto
generated code figure out what resource must be used. It simplifies code.
2021-03-22 19:42:05 +02:00
Vlad Zahorodnii
e4b9f9761f Simplify emission of XdgForeignInterface::transientChanged signal
We can emit the transientChanged signal directly on the foreign object.
2021-03-22 17:15:02 +00:00
Vlad Zahorodnii
9445bfb6d8 Simplify QHash lookups
QHash provides a convenience helper to lookup a value, use it. It makes
the code simpler.
2021-03-22 17:15:02 +00:00
Vlad Zahorodnii
2f102e7544 Fix various minor coding style issues
This fixes various coding style issues, e.g. wrong variable name
capitalization, wrong brace placement, etc.
2021-03-22 17:15:02 +00:00
Vlad Zahorodnii
e5bde36e96 Get rid of unnecessary private classes in xdg-foreign wrappers
There's no point for using the d-pointer pattern because the importer
and the exporter classes are private already, they are not exposed in
public api.
2021-03-22 17:15:02 +00:00
Vlad Zahorodnii
5b060bcab0 Remove since version tag in OutputInterface
kwaylandserver is an unstable library, this renders since version tags
highly unreliable.
2021-03-22 18:58:48 +02:00
Vlad Zahorodnii
ca69d9e62a Remove noop destructors 2021-03-22 17:42:28 +02:00
Vlad Zahorodnii
0461b7fe27 autotests: Fix testXdgForeign
Currently, testXdgForeign fails because imported and exported resources
are destroyed immediately from destructor request handlers and code that
performs cleanup in the exported-imported mapping tables accesses the
dangling pointers.

Previously, it wasn't an issue because the destruction of exported and
imported resources was delayed using QObject::deleteLater().
2021-03-22 15:31:41 +00:00
Kevin Ottens
d92fa7f140 Add the activity management protocol server implementation 2021-03-22 11:28:57 +00:00
Vlad Zahorodnii
b822c1e63a Simplify handling of inert input method context
If the input method context object becomes inert, just delete it.
2021-03-22 10:16:34 +00:00
Weng Xuetian
823a34a10d Add explicit done to OutputInterface and deprecate zxdg_output_v1.done if version 3 is used.
In zxdg_output_v1 version 3, done is deprecated and should be replaced
with wl_output.done. This makes automatically send done upon change not
suitable for the usage. OutputInterface user should now use done()
explicitly to send the update.

CCBUG: 433224
2021-03-19 10:39:07 -07:00