Summary:
Building upon the generic X Selection support this patch establishes another
selection class representing the XDND selection and provides interfaces
to communicate drags originating from Xwayland windows to the Wayland
server KWin and drags originating from Wayland native drags to Xwayland.
For Wayland native drags KWin will claim the XDND selection as owner and
will simply translate all relevant events to the XDND protocol and receive
alike messages by X clients.
When an X client claims the XDND selection KWin is notified via the X protocol
and it decides if it allows the X drag to transcend into the Wayland protocol.
If this is the case the mouse position is tracked and on entering a Wayland
native window a proxy X Window is mapped to the top of the window stack. This
proxy window acts as a drag destination for the drag origin window and again
X messages will be translated into respective Wayland protocol calls. If the
cursor leaves the Wayland window geometry before a drop is registered, the
proxy window is unmapped, what triggers a subsequent drag leave event.
In both directions the necessary core integration is minimal. There is a single
call to be done in the drag and drop event filter through the Xwayland
interface class.
From my tests this patch facilitates drags between any Qt/KDE apps. What needs
extra care are the browsers, which use target formats, that are not directly
compatible with the Wayland protocol's MIME representation. For Chromium an
additional integration step must be done in order to provide it with a net
window stack containing the proxy window.
Test Plan: Manually. Auto tests planned.
Reviewers: #kwin
Subscribers: zzag, kwin, alexde
Tags: #kwin
Maniphest Tasks: T4611
Differential Revision: https://phabricator.kde.org/D15627
Summary:
With the gneric X selections infrastructure and clipboard support the X
clipboard sync helper utility can be removed. Also rename its autotest as it
tests the inner workings of the new mechanism since this mechanism was
introduced.
Test Plan: Autotest still passes under new name.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D15063
Summary:
In this patch an infrastructure is created to represent generic X selections
in a Wayland session and use them for data transfers between Xwayland windows
and Wayland native clients.
The central manager is the DataBridge class, in which Selection objects can be
created. This is hard-coded and such a Selection object persists until the end
of the session, so no arbitrary selections can be created on the fly. For now
the X Clipboard selection is supported, whose corresponding mechanism in the
Wayland protocol is just called Selection.
A Selection object listens for selection owner changes on the X side and for
similar events into the Wayland server interfaces. If a data provider is
available a selection source object is created by the Selection object. In case
data is requested on the other side, a data transfer is initialized by creating
a Transfer object. A Selection keeps track of all transfers and makes sure that
they are destroyed when they are finished or in case they idle because of
misbehaving clients.
The Clipboard class translates the X Clipboard via a proxy window. Selection
changes on the Wayland side are listened to through a new signal on the active
KWayland seat interface.
The previously used X clipboard syncer helper is disabled. The clipboard sync
autotest is changed to the new mechanism.
BUG: 394765
BUG: 395313
Test Plan: Manually and clipboard sync autotest.
Reviewers: #kwin
Subscribers: zzag, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D15061
Summary:
We have a mix of different doxygen comment styles, e.g.
/*!
Foo bar.
*/
/**
* Foo bar.
*/
/** Foo bar.
*/
/**
* Foo bar.
*/
/**
* Foo bar.
**/
To make the code more consistent, this change updates the style of all
doxygen comments to the last one.
Test Plan: Compiles.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18683
Summary:
This is only relevant on Qt and when WlShell is used.
This was only the case before Qt5.10.
We will depend on Qt5.12 next release.
Static Qt builds which are that old typically wouldn't contain QtWayland
Test Plan: Compiles. Not used in tests
Reviewers: #kwin, graesslin
Reviewed By: #kwin, graesslin
Subscribers: graesslin, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18594
Summary:
Does something similar to our existing ServerDecoration, but based
around XDG Shell patterns and with a few subtle differneces.
We'll probably still need both in kwin for the forseeable future as GTK3
won't ever change from using the KDE Server Decoration.
Test Plan:
Relevant unit test. It's a bit simpler as spec states
toolkits must follow what the compositor configures if they
bind the interface.
Modified plasma-integration to remove ServerIntegration
(as Qt5.12 has native support) all my windows look and act the same.
Reviewers: #kwin, zzag
Reviewed By: #kwin, zzag
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D17756
Summary:
This command line option is useful for KWin in embedded use case. That
is when KWin is just used as a compositor for one application instead of
a complete desktop environment. In such a setup global shortcuts are not
wanted and interfere with the application. E.g. one does not want Alt+F4
to close the window, that would render the system unusable.
This change introduces a command line option and disables the following
event filters and spies:
* global shortcuts
* modifier only shortcuts
* terminate session
* virtual terminal switching
* screen edges
KGlobalAccel still gets inited, otherwise the (non-functional) binary
would be launched when KWin registers it's global shortcuts.
Test Plan:
New test added based on existing tests for the global
shortcuts, ctest passes
Reviewers: #kwin
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D17304
Summary:
We need to wait till the helper process created the datadevice. For this
we used a while loop. On build.kde.org the test gets stuck in this loop
and times out after 10 minutes.
This change introduces a dedicated signal and we just wait for it. So if
something fails we wait only 5 sec instead of endless. This should help
investigate why the test doesn't work on build.kde.org.
Test Plan: Test works locally
Reviewers: #kwin
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D16741
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
Test Plan:
Compiled latest GTK
Ran gtk4-demo and used WAYLAND_DEBUG to confirm it used the correct
shell
tested a top level and a popup
Reviewers: #plasma, romangg
Reviewed By: #plasma, romangg
Subscribers: romangg, mart, graesslin, zzag, kwin
Tags: #kwin
BUG: 398614
FIXED-IN: 5.15.0
Differential Revision: https://phabricator.kde.org/D13530
Test Plan:
Very minimal expansion of unit tests which uses WaylandScreens
Wrote mini app to debug actual output of xdg-output for testing the DRM code
Main relevant user of this is xwayland > 1.20 which I don't have, so that
part remains untested
Reviewers: #plasma, graesslin
Reviewed By: #plasma, graesslin
Subscribers: romangg, graesslin, bshah, kwin
Tags: #kwin
Maniphest Tasks: T8501
Differential Revision: https://phabricator.kde.org/D12243
Summary:
This ensures that using KDE Connect to control input properly inhibits
idle timeouts.
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D9555
Plus test
Test Plan:
Ran kwin with menus and patched QPT
Ran test
Reviewers: graesslin
Reviewed By: graesslin
Subscribers: graesslin, kwin, #kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9262
Summary:
not sure if that is the right "parent" that has
to be set, set the transient for surfaces that
have setParentOf of an imported set
Test Plan:
m_XdgForeign->transientFor(surface()) finds the surface is expected,
not sure how to test it further
Reviewers: #plasma, graesslin
Reviewed By: #plasma, graesslin
Subscribers: luebking, graesslin, davidedmundson, plasma-devel, kwin, #kwin
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D7521
With the new Wayland only mode we start too fast and it can happen that
the initWithWorkspace is called before the client connection is fully
setup. This would result in a crash in the idletime plugin once it tries
to create a seat.
To prevent this problem the code is split out into a dedicated method
and only invoked if all interfaces have been announced on the internal
connection.
Summary:
Adds XDGV6 support for the kwin side.
Popup placement support is limited to the stuff v5 had,
a simple offset, rather than the awesome new positioner.
But Qt doesn't make use of it yet either.
Also ideally we should do all the positioning before sending the first
configure, but again Qt doesn't actually do anything with that anyway.
Also integrate pinging clients
Test Plan: gtk3-demo works nicely.
Reviewers: #plasma, graesslin, mart
Reviewed By: #plasma, graesslin
Subscribers: mart, graesslin, kwin, plasma-devel, #kwin
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D6591
Summary:
So far KWin did not support the sequence:
1. Create wl_shell
2. Create PlasmaShellSurface
3. Create wl_shell_surface
KWin only supported the case that the PlasmaShellSurface is the last
thing to get created. This is rather limiting and can be considered a
bug. At least we had a QEXPECT_FAIL auto test for this situation. So
it was a known issue.
This change should make it easier to support the QtWayland changes in
Qt 5.8.
Reviewers: #kwin, #plasma_on_wayland
Subscribers: plasma-devel, kwin
Tags: #plasma_on_wayland, #kwin
Differential Revision: https://phabricator.kde.org/D4482
Summary:
WaylandServer creates a socketpair for several Wayland connections. So
far this duplicated code quite a bit.
This change introduces one method to perform the socketpair and the
error checking plus creating the server side ClientConnection from the
pair.
Test Plan: Tests still pass
Reviewers: #kwin, #plasma_on_wayland
Subscribers: plasma-devel, kwin
Tags: #plasma_on_wayland, #kwin
Differential Revision: https://phabricator.kde.org/D3576
Summary:
This allows Client to use the Wayland-specific implementation if there
is no icon geometry set through the X11 way. That way Xwayland windows
have an icon geometry even if Plasma is using Wayland and setting the
icon geometry in the Wayland way. Which is expected as Plasma is
ignorant about the windowing system a PlasmaWindow uses.
In order to move the code from ShellClient to AbstractClient
WaylandServer gained a new findAbstractClient(Surface*) method which
is just like findClient(Surface*) with the difference that it returns
an AbstractClient instead of a ShellClient*.
Test Plan:
minimized/unminimized an X client on Wayland, verified
animation is correct (though broken in general for minimize)
Reviewers: #kwin, #plasma_on_wayland
Subscribers: plasma-devel, kwin
Tags: #plasma_on_wayland, #kwin
Differential Revision: https://phabricator.kde.org/D2530
If we try to query before WaylandServer created the KSldApp the service
owner change is never delivered. Thus a delay till we know that the
service is there on Wayland. On X11 the initialization can be done
directly.
To know when the WaylandServer is fully initialized an additional
signal is added to WaylandServer.
Summary:
Most platforms like the nested and virtual do not handle the outputs
themselves and WaylandServer announces the Outputs to Wayland.
So far this was static: at startup it got announced once to Wayland
and any changes were not catched.
This change makes WaylandServer listen to changes to the Screens and
sync them to Wayland.
Unfortunately KWin's internal Screen information is not sufficient to
properly synchronize this to Wayland and also Wayland by not supporting
adding/removing modes does not help.
Thus the solution implemented here is to add new outputs reflecting the
changes and then removing the old ones. This creates situations with more
outputs being present than actually there, but prevents that there are
no outputs at all.
Test Plan: Auto test added which verifies this for the virtual platform
Reviewers: #kwin, #plasma_on_wayland
Subscribers: plasma-devel, kwin
Tags: #plasma_on_wayland, #kwin
Differential Revision: https://phabricator.kde.org/D2233
Summary:
The WaylandServer creates the XdgShellV5 interface and hooks it up
to create a ShellSurface whenever an xdg surface or xdg popup is created.
ShellClient gains some new ctors for the different variants and is
adjusted to delegate to xdg surface respectively.
With this change KWin mostly supports xdg-shell protocol. Still missing
is support for the "geometry" request which is rather difficult to
implement in KWin.
Reviewers: #kwin, #plasma_on_wayland
Subscribers: plasma-devel, kwin
Tags: #plasma_on_wayland, #kwin
Differential Revision: https://phabricator.kde.org/D2108
Summary:
If KWin fails to start the Wayland server due to XDG_RUNTIME_DIR not
being set, kwin_wayland should terminate with an error condition but
not crash.
This change makes sure that KWin detects that the Wayland server does
not work and terminates the startup early and ensures that it doesn't
crash while going down.
An error message is shown that we could not create the Wayland server.
Test Plan:
Test case added which verifies that WaylandServer fails to
init. Manual testing that kwin_wayland exits with error 1.
Reviewers: #kwin, #plasma_on_wayland
Subscribers: plasma-devel, kwin
Tags: #plasma_on_wayland, #kwin
Differential Revision: https://phabricator.kde.org/D2078
Summary:
The clipboard sync is done by a dedicated helper binary launched by
KWin. This helper binary is forced to xcb platform to piggy-back on
Qt's implementation of the X11 clipboard. In addition it implements
the Wayland clipboard - which is much simpler. Reading the Wayland
clipboard is based on the implementation in QtWayland.
KWin internally knows the DataDeviceInterface belonging to the helper
application. Whenever an xwayland client is focussed, this DataDevice
is allowed to set the selection and KWin manually updates the current
selection in the SeatInterface. By that the sync from X11 to Wayland
is implemented. When afterwards a Wayland client is selected, it's sent
the current selection which references the X clipboard and a data
transfer can be initiated in the normal Wayland way.
For the other direction KWin sends the current selection to the helper's
DataDevice whenever an xwayland window is focused. The helper application
reads the Wayland clipboard and sets it on the X11 clipboard. Thus the
Wayland clipboard is synced to X11.
The approach used here will also be useful for implementing a clipboard
manager (aka klipper).
Currently the implementation is not yet fully completed. We need to
make sure that the helper application gets restarted in case of a crash.
Test Plan: See added test case
Reviewers: #plasma_on_wayland, #kwin
Subscribers: plasma-devel, kwin
Tags: #plasma_on_wayland, #kwin
Differential Revision: https://phabricator.kde.org/D1973
Summary:
When a shell client got mapped, unmapped and mapped again we emitted
the shellClientAdded signal in WaylandServer again. This resulted in
e.g. Workspace, EffectsHandler, etc. to start managing the window again.
This can be a reason for problems we see with such windows like the
Plasma panel dialog when opened the second time.
Test Plan:
Needs extensive testing on real world system as that changes
behavior now.
Reviewers: #kwin, #plasma_on_wayland
Differential Revision: https://phabricator.kde.org/D1784
Summary:
Instead of having the Application invoke initOutputs after creating
the Screens, we can just connect to the signal emitted there.
This allows to make initOutputs a private, WaylandServer internal
method.
Reviewers: #plasma
Subscribers: plasma-devel
Projects: #plasma
Differential Revision: https://phabricator.kde.org/D1482
Summary:
In order to start the WaylandServer in kwin_x11 we need to make sure
that WaylandServer does not start the KScreenLocker integration. On
X11 the lock screen is provided by a different application (in Plasma
by ksmserver).
A new init flag is added to WaylandServer to not integrate with
KScreenLocker. Thus the default is still to integrate with KScreenLocker.
All direct usages of KScreenLocker are guarded to not be called if
the screenlocker integration is not present.
Reviewers: #plasma
Subscribers: plasma-devel
Projects: #plasma
Differential Revision: https://phabricator.kde.org/D1481
Summary:
This is the first change in a refactoring series. The aim is to:
* rename AbstractBackend to Platform
* move backends/ to plugins/platforms/
* don't bind platforms to Wayland only
* provide a platform plugin for "normal" X11
* share more code between X11 and Wayland
This change moves the platform/backend from waylandServer to Application.
The init of the plugin happens directly in the Application from the
KPluginMetaData. There is no need to externally init it and set the
parent.
WaylandServer::backend() currently just delegates to
kwinApp()->platform(), the idea is to drop this method completely.
The test infrastructure is also adjusted to this change.
Test Plan: kwin_wayland still works, all tests pass
Reviewers: #plasma, sebas
Subscribers: plasma-devel
Projects: #plasma
Differential Revision: https://phabricator.kde.org/D1331
This patch implements read access to the outputmanagement interface in
kwin_wayland's drm backend.
- outputdevices are created in DrmOutput, just like the wl_outputs
- wayland_server implements the outputmanagement interface and
- passes the changesets down into the backend
This means that the interface is announced, independently of the DRM
backend, but the actual outputs are currently only there if the DRM
backend is used.
The changes are not applied (passed into the kernel's drm interface
yet). This is obviously work-in-progress, so it's incomplete. Since it
allows us to run kwin[master] with the libkscreen KWayland backend, it's
a significant step allowing testing and further development.
Reviewed-by: Martin Gräßlin
We need to also destroy all idle objects when we tear down the
internal client connection. Otherwise the cleanup tries to free
the object after our Wayland connection is already destroyed.
We announce support for it and depending on whether we have a plugin
or not set the default mode to Server or None.
When a decoration interface is created it gets installed on the
ShellClient. But there it isn't properly used yet as we don't have
support for decorations in ShellClient yet.
Ensures that all Wayland objects are destroyed and the cleanup handling
is performed before tearing down the Compositor. This fixes for example
a crash if a Surface with a Shadow is still around at tear down.
This introduces Toplevel::isLockScreen() and Toplevel::isInputMethod(),
this can be used to allow only lockscreen/inputmethods to get input
events and shown when screen is locked.
We need to destroy the ClientConnections we create. Also we need
to disconnect our Xwayland error handling before destroying it, otherwise
it would trigger the abort for crashing Xwayland.
We need to destroy the compositor after Xwayland terminated and after
the internal Wayland connection is destroyed. This means when destroying
the Workspace we may no longer destroy the Compositor at the same time.
Also we need to ensure that other tear down functionality doesn't call
into the no longer existing internal client connection.
With this change kwin doesn't crash when exiting with Wayland and/or
X11 windows still open.
This allows to check if specific ShellClient is from LockScreen or not,
as well as this adds method to verify if ShellClient is from input
method like maliit.
Now that KWin knows about which window is from Screenlocker it can apply
various security restrictions like no other window then greeter is on
top of it.
Reviewed-By: Martin Gräßlin
This introduces --lockscreen option in kwin_wayland which when used will
lock screen immediately. Also dependency to newly created kscreenlocker
repo is introduced.
REVIEW: 125954
Allows to interact with the Registry for the internal connection in
other parts of KWin and makes it possible to create more than just the
ShmPool for this Registry.
The creation of PlasmaWindowInterface is moved from WaylandServer into
AbstractClient. This allows the sub classes to better control when to
create/destroy the Client.
For creation it's bound to becoming visible - that is Windows which are
only created but never shown are not announced at all.
For Client it's destroyed with the normal tear-down of a Client, for
ShellClient it's destroyed on unmapped (which also means a new one
will be created again in case of another mapping of the surface).
As a side effect, this works around the problem that ShellClients do not
yet get destroyed for QtWayland's menus (needs further investigation).
So far this only allows to trigger show desktop functionality and exports
the state.
In future this should be restricted to just one dedicated desktop shell
process.
Input-method servers, like maliit, need to be known to KWin since KWin
needs to know about virtual keyboards. Virtual keyboards should be shown
as OSD layers, and they are one of the types of windows that actually
should be showable when the lock screen is active.
kwin_wayland --inputmethod /path/to/your/input-server
tries to start the input server. The input-server's window never gets
keyboard focus and is shown on top of all windows except for KWin's
internal clients.