Commit graph

1114 commits

Author SHA1 Message Date
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