Commit graph

19084 commits

Author SHA1 Message Date
Vlad Zahorodnii
d23dab7be9 wayland: Fix handling of synthetic touch cancel events
In case the compositor wants to cancel a touch sequence, we need to
ignore subsequent touch motion and touch up events until a new sequence
is initiated by the user.

Previously, it was implicitly handled by clearing the mapping table
between the touch slots and touch ids generated by kwayland-server.
2021-02-16 17:53:30 +00:00
Vlad Zahorodnii
8f2520e00e x11: Emit missing geometry changed signals for Unmanaged
Otherwise the scene might miss some geometry updates and render override
redirect windows distorted.
2021-02-16 14:35:26 +02:00
Vlad Zahorodnii
90c6ba20ed autotests: Fix TouchInputTest::testCancel()
If a TOUCH_UP event is received after a TOUCH_CANCEL event, this is
most likely a libinput bug. TOUCH_CANCEL events act as TOUCH_UP events.
2021-02-16 12:56:05 +02:00
Vlad Zahorodnii
2df429ce5e autotests: Drop TestLibinputTouchEvent::testNoAssignedSlot()
We've switched to libinput_event_get_seat_slot(), which returns a
non-negative number to indicate the slot.
2021-02-16 12:52:08 +02:00
Vlad Zahorodnii
242544a056 core: Drop Toplevel::bufferMargins()
It can be expressed via other means.
2021-02-16 09:06:05 +02:00
Vlad Zahorodnii
10a8ef2969 Unvirtualize Toplevel::visibleGeometry() 2021-02-16 06:56:04 +00:00
Vlad Zahorodnii
8570b64384 Rename visibleRect to visibleGeometry
"rect"s have their origin at the top-left corner of the frame. However,
visibleRect() returns a QRect that's in the global coordinates.
2021-02-16 06:56:04 +00:00
Vlad Zahorodnii
311a370d77 wayland: Port kwin to SeatInterface::touchDown() changes 2021-02-16 06:54:39 +00:00
Vlad Zahorodnii
22d386cdd8 xwayland: Improve handling of Xwayland restarts
At the moment, the display name might change between Xwayland restarts.
It is a problem because the session process (plasma) may have an
outdated value of the DISPLAY environment variable after a restart.

With this change, it is guaranteed that the DISPLAY and the Xauthority
file stay the same until the server is stopped explicitly.
2021-02-15 18:09:46 +00:00
Xaver Hugl
995437f57c decouple DRM planes from DrmOutput 2021-02-15 17:28:58 +00:00
Méven Car
7c2c213f52 QPA Integration: Save enabled screens
Since QWindowSystemInterface::handleScreenRemoved would not be called in Integration::handleScreenDisabled, Qt apps would still reference disabled screens resulting in crashes.
2021-02-15 07:30:18 +00:00
Ismael Asensio
3b87c6ea2d kcm/kwinrules: Update values on text edit
Previously the text values were updated to the model after
`onEditingFinished()`, that is after losing focus, to prevent
erroneus updates.

This was making also the `needsSaving` signal fire only after
a focus change, which is not consistent with the behavior of
other KCMs.

Use `onTextEdit()` instead, so the model is updated as the user
types.

BUG: 431211
2021-02-13 22:57:38 +00:00
Cyril Rossi
12e0376fea KCM KWin VirtualDesktop highlight settings
Currently the highlight is only for the items. KCModuleData will come in another MR.
This is more simple implementation than the one I previously made.

Some default value are hardcoded in the KCM such as Rows count (2) and the number
of virtual desktop, on revert to default, it keeps only the first one.
2021-02-12 15:16:35 +00:00
Vlad Zahorodnii
c5e91b94c4 xwayland: Refuse to create connection sockets if sockets dir doesn't exist
Since kwin runs as a normal user, it cannot create the X11 connection
socket directory because any user process can easily compromise the
security of the system by unsetting the sticky bit.

In order to guarantee the security of the system, the socket directory
must be created by root and have the sticky bit on.
2021-02-12 10:03:02 +02:00
Vlad Zahorodnii
118b817134 xwayland: Reserve enough space for sun_path
We also need to reserve space for the final null terminator.
2021-02-11 20:57:48 +00:00
Dan Leinir Turthra Jensen
df498d9be4 Add CLI tool to set window decorations, and use for KNS adoptions
This adds a command line tool which allows the user to set the window
decoration, and then that tool is used in the two knsrc files to allow
the user to switch window decoration directly from either a KNS dialog,
or from Discover.
2021-02-11 16:44:33 +00:00
Vlad Zahorodnii
93d5901c85 Fix build on FreeBSD 2021-02-11 18:21:32 +02:00
Vlad Zahorodnii
a2c7c66d8a xwayland: Emit Xwayland::started() after WM_S0 is claimed
Xwayland starts listening to -listenfd file descriptors after the WM_S0
selection is claimed. At the moment, it is claimed asynchronously by
kwin. First, we create a dummy window and change one of its properties
to get the timestamp. After the timestamp has been received, we actually
call xcb_set_selection_owner().
2021-02-11 15:10:01 +00:00
Vlad Zahorodnii
9f0f452702 xwayland: Manually create sockets
This provides kwin greater control over how X11 sockets are created for
Xwayland. For example, it can be used to ensure that the DISPLAY remains
the same across Xwayland server restarts or launching Xwayland on
demand.

Even though -listen <fd> option is deprecated, we still pass it because
older versions of Xwayland may not have the -listenfd option.
2021-02-11 15:10:01 +00:00
Vlad Zahorodnii
3d363fb797 Fix build on FreeBSD 2021-02-11 16:49:05 +02:00
Vlad Zahorodnii
9ccae5eda6 platforms/wayland: Round up fractional scale factors
Currently, fractional scale factors that are less than 1 will be floored
to 0, which is a protocol violation.

CCBUG: 432766
2021-02-11 12:06:37 +00:00
Vlad Zahorodnii
2ce49877f7 platforms/wayland: Emit outputEnabled() signal
Otherwise the QPA won't create QPlatformScreens and the compositor may
not work as expected.
2021-02-11 12:03:26 +00:00
Fabian Vogt
7c325b7436 xwayland: Also write a FamilyWild entry to the Xauthority file
This is needed to deal with hostname changes during lifetime of a session.
2021-02-10 18:19:17 +00:00
Fabian Vogt
06d2a31bd3 xwayland: Rename updateXauthorityFile and add error handling
This renames updateXauthorityFile to writeXauthorityEntries as it doesn't
actually update (i.e. change) anything, it just writes new ones.

Error handling is introduced, to avoid that it continues silently without
entries, which would cause all connections to fail.
2021-02-10 18:19:16 +00:00
Fabian Vogt
d51703e335 xwayland: Simplify writeXauthorityEntry
Extract writing of what libXau calls "counted strings".
2021-02-10 18:19:16 +00:00
Fabian Vogt
357713fa78 xwayland: Simplify m_authorityFile
Use a shorter file name (which is already part of apparmor profiles) and avoid
using a pointer.
2021-02-10 18:19:16 +00:00
Vlad Zahorodnii
93e0265e4e Move source code to src/ directory
Once in a while, we receive complaints from other fellow KDE developers
about the file organization of kwin. This change addresses some of those
complaints by moving all of source code in a separate directory, src/,
thus making the project structure more traditional. Things such as tests
are kept in their own toplevel directories.

This change may wreak havoc on merge requests that add new files to kwin,
but if a patch modifies an already existing file, git should be smart
enough to figure out that the file has been relocated.

We may potentially split the src/ directory further to make navigating
the source code easier, but hopefully this is good enough already.
2021-02-10 15:31:43 +00:00
Vlad Zahorodnii
68c675d00d Make source code more relocatable
Occasionally, I see complaints about the file organization of kwin,
which is fair enough.

This change makes the source code more relocatable by removing relative
paths from includes.

CMAKE_CURRENT_SOURCE_DIR was added to the interface include directories
of kwin library. This means that as long as you link against kwin target,
the real location of the source code of the library doesn't matter.

With autotests, things are not as convenient as with kwin target. Some
tests use cpp files from kwin core. If we move all source code in a src/
directory, they will need to be adjusted, but mostly only in build
scripts.
2021-02-10 15:31:42 +00:00
l10n daemon script
fb7f507d8e 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-02-10 08:21:09 +01:00
Nicolas Fella
0ea9969cee [kcmkwin] Remove unused PlasmaCore import 2021-02-09 20:50:12 +00:00
Nicolas Fella
2c6c1a7e76 [kcms/compositing] Remove definitions handling
QT_NO_URL_CAST_FROM_STRING is defined in the top-level CMakeLists.txt

Don't remove definitions, it builds fine with them
2021-02-09 19:48:01 +00:00
Nicolas Fella
eedb8e44ea Use imported target for Threads 2021-02-09 20:32:29 +01:00
Nicolas Fella
a110231f68 Use imported target for QtGui private headers
It's nicer
2021-02-09 19:59:51 +01:00
Alexander Lohnau
2b721200fb Port kwintabbox KCM away from KNS3::DownloadDialog 2021-02-09 12:00:19 +00:00
Alexander Lohnau
309e278561 Port kwineffects KCM to KNS QML components 2021-02-09 12:00:18 +00:00
Alexander Lohnau
09b1cea056 Port kwindecoration KCM to KNS QML components 2021-02-09 12:00:18 +00:00
David Edmundson
2d68196536 [xwl] Cache KWaylandServer::DataSourceInterface as a QPointer
Seat correctly emits dragEnded when a DataSourceInterface is destroyed,
and stops the drag.

However WlToXSource lives slightly longer to finish handling any other
visits. See the guarded delete statement in Dnd::endDrag.

With recent fixes use is mostly a hypothetical, but we still don't want
dangling pointers in our code.
2021-02-09 10:11:15 +00:00
David Edmundson
4bab721db8 [xwl] Cancel the visit when a drag ends
XWL only clears up when a "visit" finishes.

If we end a WlToXDrag through clicking we call "WlToXDrag::end" but the
visit object stays alive, which obviously will never finish.

Both the visit and the drag object then effectively leak and are used on
the next drag.
2021-02-09 10:11:15 +00:00
David Edmundson
f3d46cee15 [xwl] Avoid deletion of Transfer in signals from Transfer.
Transfer emits "finished" mid way through it's own methods. If we delete
here transfer is left in the middle of methods like Transfer::timeout
with a dangling "this".
2021-02-09 10:11:15 +00:00
Vlad Zahorodnii
335d9c4192 xwayland: Generate Xauthority file
This allows running Xwayland apps as root. Xwayland started with an
empty Xauthority file. After kwin has received the display number, the
file is updated with an actual authority entry.

BUG: 432625
2021-02-09 00:14:31 +02:00
Vlad Zahorodnii
8137b8a3ab xwayland: Fix initialization of WM_S0 selection owner
The selection owner must live as long as the X11 connection is valid;
otherwise Xwayland won't catch the corresponding selection ownership
change event, and the initialization sequence will be incomplete.
2021-02-08 22:12:06 +00:00
Laurent Montel
3c63750f6e GIT_SILENT: don't use deprecated cmake variable 2021-02-08 20:19:33 +01:00
Xaver Hugl
4890db3f16 Fix hotplugging for VR headsets 2021-02-06 10:54:44 +00:00
Vlad Zahorodnii
9acf04e2b7 Refactor Toplevel::opacity
The major difference between this version and the previous is that kwin
no longer forwards the opacity to the app window if it runs as a
window window manager and a compositing manager. As Keith Packard said [1]

> The window manager support is only needed to forward the property from the
> application window to the frame; with the Composite extension, a
> compositing manager can then take that value into account when
> constructing the desktop image.  Any X server can implement the Composite
> extension; the one in the X server project at freedesktop.org is just one
> such.  It would be trivial to implement this extension in a direct FB
> based X server, or any other X server which places windows in off-screen
> images.

There are a couple of reasons to do so: (a) simplifies code, (b) we don't
temper with opacities on override-redirect windows.

[1] https://listman.redhat.com/archives/xdg-list/2003-December/msg00153.html
2021-02-06 11:13:36 +02:00
Vlad Zahorodnii
7995112550 Change type of opacity to qreal
The rest of code assumes that it's qreal.
2021-02-06 00:42:44 +02:00
Vlad Zahorodnii
e117caa3eb x11: Fix damage region updates
We cannot use addDamage() in getDamageReply() because the former sets
back the m_isDamaged flag.
2021-02-04 18:27:17 +02:00
Vlad Zahorodnii
72fda78cf6 wayland: Schedule repaints even on empty commits
If only frame callbacks have been committed, the compositor must still
schedule compositing.

BUG: 428499
2021-02-03 06:50:06 +00:00
Xaver Hugl
e30b1a0f92 Don't allow direct scanout when using software cursor 2021-02-02 22:15:50 +01:00
Xaver Hugl
bda47c9043 Fixes for direct scanout 2021-02-02 16:19:30 +01:00
Vlad Zahorodnii
16f27d2dc6 Annotate Intel GPUs with architecture generations 2021-02-02 15:17:24 +00:00