Commit graph

20020 commits

Author SHA1 Message Date
Alex Richardson
af3602b48c Fix out-of-bounds copy in xcb_send_event() calls
xcb_send_event always copies 32 bytes, so we have to pad all xcb_*_event_t
to 32 bytes to avoid leaking uninitialized stack memory. I found this
problem while running kwin_x11 on a CHERI-RISC-V system (which has bounded
pointers). The xcb_send_event() implementation has a memcpy() that was
copying 32 bytes but the event passed was a bounded to 28 bytes, so this
resulted in a run-time exception in X11Client::sendClientMessage().
The same problem exists in Selection::sendSelectionNotify(), but this time
we could end up copying up to 8 bytes since xcb_selection_notify_event_t
is only 24 bytes.

This disclosure of uninitialized data could in theory have a security
impact if it leaks a pointer value (e.g. a return address) as part of an
exploit chain that needs to bypass ASLR. However, the selection notify
events go directly to the XServer and you most likely already have a
serious problem if an attacker has full control over the XServer. It is
possible that the configure notify events go directly to an untrusted
client, but even if they do this leak is not directly exploitable.

See also https://gitlab.freedesktop.org/xorg/lib/libxcb/-/issues/18
2021-09-09 15:03:44 +01:00
David Edmundson
a4cdcb6c87 Fix xwayland copying unit test
The current code set m_pasteProcess to null, before running the cleanup
function which tells the process to quit.

Which is why it always hung the CI. This patch addresses it in a way
that cleans up helpers even if we abort the test early.
2021-09-09 11:13:02 +00:00
David Edmundson
65f168e144 Use a direct connection for X to wayland drags
We already use a direct DataSource object for transfer.

Use of the new public SeatInterface::startDrag allows us to start our drag directly.
2021-09-09 11:13:02 +00:00
David Edmundson
400dd31db6 Drop the internal connection for wayland to X drags
An AbstractDragTarget is introduced. This contains either the DataDevice we are
dragging to or an Xwl bridge.

We set this on Seat along with the active surface.

In future this also allows getting rid of the move filter.
2021-09-09 11:13:02 +00:00
David Edmundson
7f976199b7 Adapt to kwayland-server icon changes
The icon is a property of the active drag which is managed by Seat, the
DataDevice should not cache this.
2021-09-09 11:13:02 +00:00
Vlad Zahorodnii
0aaa57e18e Assign default name if new virtual desktop has no explicit name
If a virtual desktop has empty name, kwin is going to end up in an
infinite cycle where VirtualDesktopManager::save() updates the
_NET_DESKTOP_NAMES property and then in the next event loop cycle,
RootInfoFilter::filter() is going to call VirtualDesktopManager::save()
because the _NET_DESKTOP_NAMES property has been changed.

This regression has showed up just now because some parts of kwin used
to increase virtual desktop count to create new desktops. Recently, that
code was ported to VirtualDesktopManager::createVirtualDesktop().

The main difference between createVirtualDesktop() and setCount() is
that the latter will set the desktop name to "Desktop N", the former
will use user-specified name.

If the user-specified name is empty, the createVirtualDesktop() method
should assign "Desktop N" name to the virtual desktop according to the
docs. However, it's not the case and this change addresses that.
2021-09-09 10:50:16 +03:00
l10n daemon script
16f5ce9361 SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2021-09-08 01:27:17 +00:00
Xaver Hugl
b38bb41698 Test DrmPipelines for outputs
Not all combinations of connectors, crtcs and planes will work
on all hardware, so we need to test the pipelines before using
them.

BUG: 433107
CCBUG: 435265
2021-09-08 02:44:29 +02:00
Xaver Hugl
18a8245ca2 platforms/drm: rename user data in DrmPipeline to output 2021-09-07 23:36:32 +02:00
Xaver Hugl
65b55e2045 platforms/drm: change when to reset the output with eglstreams
In order to accomodate crtc or primary plane changes on outputs we
need to dynamically recreate rendering resources with EglStreams as
the stream is tied to the crtc or plane currently in use.
2021-09-07 23:36:32 +02:00
Xaver Hugl
d057bd41c9 AbstractWaylandOutput: always emit mode change when mode is set
Otherwise there can be situations where the platform sets a mode but
KScreen never gets notified of it.
2021-09-07 21:34:01 +00:00
Xaver Hugl
f82d9f3d23 platforms/drm: remove duplicated warning
The same warning already gets printed in DrmPipeline
2021-09-07 21:34:01 +00:00
Xaver Hugl
e59f50e599 platforms/drm: adjust how transforms are set
Instead of using setTransformInternal directly, have DrmOutput
set it in updateTransform, like with the other setters. Also use
updateTransform instead of setTransformInternal in DrmBackend, so
that hardware rotation can be used where possible.
2021-09-07 21:34:01 +00:00
Xaver Hugl
1af2067f40 platforms/drm: reload m_conn in DrmConnector::updateProperties 2021-09-07 21:34:01 +00:00
Vlad Zahorodnii
82dd480196 autotests: Fix testMoveResize
"2" is a copy paste typo, the expected number of outputs is 1.
2021-09-07 20:51:48 +03:00
Vlad Zahorodnii
2d9207e251 autotests: Fix testSceneQPainter
Scene::qpainterRenderBuffer() was ported to AbstractOutput but not
testSceneQPainter, which results in a few broken tests.
2021-09-07 17:44:10 +00:00
Aleix Pol
6d35d63acb Fix build 2021-09-07 13:27:44 +02:00
Kai Uwe Broulik
1f53db1b44 [kcmkwin/kwindecoration] Port last remnants of removed "units"
ButtonGroup was still using it...
2021-09-07 07:41:42 +00:00
Kai Uwe Broulik
8bebf5cee1 Port to function-pointer based QMetaObject::invokeMethod
It's more efficient and compile-time checked
2021-09-07 06:30:39 +00:00
Xaver Hugl
ed2d0979c7 platforms/drm: fix warning 2021-09-07 05:45:51 +00:00
Xaver Hugl
237ef3d47f platforms/drm: fix drmModeSetCursor2 fallback
the return value is -errno, not errno.
2021-09-07 05:45:15 +00:00
l10n daemon script
d63b06d7a5 SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2021-09-07 01:25:46 +00:00
Méven Car
74cb7a5b45 kcm compositing: Hide preview option in Wayland 2021-09-06 12:22:20 +00:00
Aleix Pol
be96741803 Test first desktop file names with the .desktop extension appended
It's the right thing to do, without it's only a fallback for bogus
applications.
2021-09-06 11:48:46 +00:00
Aleix Pol
73279acc63 Fix absolute desktop file names
Qt understands that the spec wants the id without .desktop postfix and
chops it, so we need to add it back if we want to infer the desktop
file.
https://code.qt.io/cgit/qt/qtwayland.git/tree/src/client/qwaylandwindow.cpp?h=5.15#n161

BUG: 425403
2021-09-06 11:48:46 +00:00
Vlad Zahorodnii
935fa6a9e1 Move ownership of Shadow to Toplevel
This decouples the management of Shadow from the scene window and allows
multiple items share the same Shadow.

Currently, kwin has a single scene graph, but it makes sense to create a
scene graph per output as they could have different layers, etc. This
would also allow QtQuick share more textures with kwin, which is worth
doing for optimization purposes in the future.
2021-09-06 10:42:39 +00:00
Vlad Zahorodnii
b40fb76c71 platforms/wayland: Prepend KWayland::Client:: to Surface 2021-09-06 10:42:03 +00:00
Vlad Zahorodnii
200223e06e autotests: Prepend KWayland::Client:: to Surface
With a "Surface" type in kwin, KWayland::Client::Surface without fully
specified namespace will conflict with kwin's Surface type.

In some way, it also improves readability as it's clear where Surface
comes from.
2021-09-06 10:42:03 +00:00
Vlad Zahorodnii
1d54231df1 scene: Generate unnormalized shadow texture coords
This makes shadow texture coordinates consistent with surface and
decoration texture coords and allows reusing window quads between
kwin items and qtquick items more easily.
2021-09-06 12:17:44 +03:00
l10n daemon script
9b06492499 SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2021-09-06 01:26:11 +00:00
l10n daemon script
a78a9f3275 SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2021-09-05 01:21:09 +00:00
Guilherme Marçal Silva
06d1d45f24 kcmkwin: Add new keywords to KCMs for finding options more easily 2021-09-04 17:19:32 +00:00
Ismael Asensio
436011e0ec X11Client: emit isCloseableChanged when updated
This allows the decoration buttons to be updated accordingly
when the status changes.

We also need to explicitely update allowed actions when rules
are applied, as `isCloseable` is not a settable property, but
an allowed action

BUG: 424370
FIXED-IN: 5.22.90
2021-09-04 15:51:38 +02:00
Ismael Asensio
bb0f749ee7 xdgshellclient: Fix "noBorder" rule on initialization
The check for this rule was missing on window initialization,
so on Wayland it wasn't being applied until something would
trigger the check again.

BUG: 429171
FIXED-IN: 5.22.90
2021-09-04 12:47:09 +02:00
Ismael Asensio
2aacea5026 Set a minimum version check for pipewire
Fixes compilation on systems with a lesser version than required
The minimum version is set to 0.3.29 as indicated in
https://invent.kde.org/plasma/kwin/-/merge_requests/1210
2021-09-04 04:24:07 +02:00
Aleix Pol
5d73adf780 Fix crash on the debug console
Do not access fields in DataSourceModel::m_data that are not available

0  0x00007f3445a4bd22 in raise () at /usr/lib/libc.so.6
1  0x00007f3445a3590e in abort () at /usr/lib/libc.so.6
2  0x00007f3446362bb1 in qt_message_fatal (message=<synthetic pointer>..., context=...) at /home/apol/devel/frameworks/qt5/qtbase/src/corelib/global/qlogging.cpp:1914
3  QMessageLogger::fatal(char const*, ...) const (this=this@entry=0x7fff288a4ff8, msg=msg@entry=0x7f3446663028 "ASSERT failure in %s: \"%s\", file %s, line %d") at /home/apol/devel/frameworks/qt5/qtbase/src/corelib/global/qlogging.cpp:893
4  0x00007f344636203e in qt_assert_x(char const*, char const*, char const*, int) (where=<optimized out>, what=<optimized out>, file=<optimized out>, line=<optimized out>) at /home/apol/devel/frameworks/qt5/qtbase/src/corelib/global/qglobal.cpp:3366
5  0x00007f344973e118 in QVector<QByteArray>::at(int) const (this=0x55f42c20d338, i=7) at /home/apol/devel/kde5/include/QtCore/qvector.h:449
6  0x00007f34497305df in KWin::DataSourceModel::data(QModelIndex const&, int) const (this=0x55f42c20d320, index=..., role=6) at /home/apol/devel/frameworks/kwin/src/debug_console.cpp:1657
7  0x00007f3447674ed1 in QModelIndex::data(int) const (arole=6, this=0x7fff288a55c0) at ../../include/QtCore/../../../../../devel/frameworks/qt5/qtbase/src/corelib/itemmodels/qabstractitemmodel.h:460
2021-09-03 18:06:50 +00:00
Columbariu s
2fbeb0abc1 screencast/pipewire: Add TODO marks for extending modifier capabilities
no_use_linear: dropping the gbm GBM_BO_USE_LINEAR flag on allocation
explicit_modifiers: moving from the modifier-less api to the modifier
aware one with explicit modifiers
2021-09-03 17:49:37 +00:00
Columbariu s
150ebf0cf7 screencast/pipewire: announce format with modifier 2021-09-03 17:49:37 +00:00
Columbariu s
8a2475da63 screencast/pipewire: Add buildFormat method 2021-09-03 17:49:37 +00:00
Columbariu s
b05900e242 screencast/pipewire: Check for a modifier in the format negotiation via pipewire 2021-09-03 17:49:37 +00:00
David Edmundson
78439fd3e7 Avoid test commit whilst constructing DrmOutput
Otherwise we'll try to render a frame on an output before making the
output, which segfaults.
2021-09-03 16:43:48 +00:00
Xaver Hugl
c48ac020cd platforms/drm: correct cursor dirty handling 2021-09-03 18:26:23 +02:00
Vlad Zahorodnii
8891cdb74f effects/overview: Remove "wip" from description
Removing (WIP) will result in more work for translators. There are other
ways to indicate the effect is not ready for its prime time yet, e.g.
being disabled by default.
2021-09-03 13:00:05 +03:00
David Redondo
1c074d81e2 Add clipboard tab to debug console
Can be useful when investigating clipboard related problems, by checking
which source KWin thinks is the current clipboard. Displays clipboard and
primary selection.
2021-09-03 08:40:07 +00:00
Vlad Zahorodnii
c0bec3e27b effects/overview: Add missing desktop filters 2021-09-03 09:40:39 +03:00
Vlad Zahorodnii
43a50be325 effects/overview: Display window icon and caption
BUG: 441312
2021-09-03 06:38:54 +00:00
Vlad Zahorodnii
79a7cf1aec effects/overview: Allow setting ExpoCell margins 2021-09-03 06:38:54 +00:00
Ismael Asensio
9995f984c3 kwinrules: Use a list of desktop UUIDs to set and store the rules setting
Port the RuleSettings and KCM to store and use a list of virtual desktop
 UUIDs, instead of the previous x11 positional id, continuing the work on
This allows to set a rule with several desktops on Wayland.

On X11 it has no visible change for the user, but internally it uses the
more modern concept, helping to simplify the related code.

The relevant key on kwinrulesrc changes from `desktop` to `desktops`.
A kconf_update script handles the migration.
2021-09-02 22:11:46 +02:00
Xaver Hugl
5da8df39a5 AbstractWaylandOutput: make updateMode use uint32_t 2021-09-02 14:34:07 +02:00
Xaver Hugl
26ad8e194f platforms/drm: support Broadcast_RGB setting
This allows the user to switch between full and limited rgb.

BUG: 375666
BUG: 353689
2021-09-02 13:53:02 +02:00