Commit graph

59 commits

Author SHA1 Message Date
Martin Gräßlin
fa6fbbdfc1 [wayland] Destroy input method connection after process finished
More cleanup.
2015-11-10 14:38:45 +01:00
Martin Gräßlin
0bf51d99f6 [wayland] Destroy our internal wayland connection from server side
More cleanup.
2015-11-10 14:27:43 +01:00
Martin Gräßlin
affcbac7e7 [wayland] Destroy Xwayland's ClientConnection on tear down
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.
2015-11-10 14:21:48 +01:00
Martin Gräßlin
acb0dfd893 [wayland] Don't leak our internal client connection thread object
Thanks ASAN!
2015-11-10 11:43:30 +01:00
Martin Gräßlin
8175562a7a [wayland] Fix cleanup handling on tear down
ASAN righly complained: we need to delete our Wayland objects before
we destroy the internal client connection. Solved by better setting
parent relationships in the QPA plugin and correctly delete objects
in destroy of internal client connection.
2015-11-10 11:35:00 +01:00
Martin Gräßlin
1998d5ac1a [wayland] Improve tear-down to not crash if X11 applications are still around
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.
2015-11-10 08:56:32 +01:00
Bhushan Shah
6e70dd0ba2 [wayland] connect to greeterClientConnectionChanged instead of locked signal
locked signal might be too late to identify the greeter and its windows.
2015-11-09 14:15:04 +05:30
Bhushan Shah
3a1371989e [wayland] Introduce ShellClient::isLockScreen method
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
2015-11-06 19:44:13 +05:30
Bhushan Shah
c957b145a4 [wayland] Adapt to changes in the kscreenlocker
Initialize is no longer called by KSldApp ctor, and also pass
KWayland::Server::Display* to KSldApp.

Reviewed-By: Martin Gräßlin
2015-11-06 16:53:20 +05:30
Bhushan Shah
bacfd876fe [wayland] Start ksldapp from the WaylandServer
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
2015-11-05 18:39:23 +05:30
Martin Gräßlin
7253235a28 [wayland] Dispatch the WaylandServer once more before killing internal client
This is needed to not deadlock during tear down in case the client wants
to dispatch events and the server is in wait for client.
2015-10-22 10:07:02 +02:00
Martin Gräßlin
43f6c1e041 [wayland] Add support for DpmsInterface
Our server announces the DpmsManagerInterface and in the DRM backend
we announce support for Dpms on the OutputInterface (if the Output
supports it) and we connect to changing Dpms requests.
2015-09-10 14:32:41 +02:00
Marco Martin
3f5bf65a9e Use the kwayland blur protocol in the blur effect
use the new blur protocol to fetch information about the
region of blur behind to apply to windows like Plasma::Dialog
REVIEW:125017
2015-09-02 14:43:44 +02:00
Martin Gräßlin
9afbecf4a6 [wayland] Drop workaround for faking frame rendered for Qt windows
No longer needed with our own QPA plugin.
2015-08-25 14:33:51 +02:00
Martin Gräßlin
8add14fe89 [wayland] Drop hack for faking input for Qt popups
This reverts 29c2ae57.
2015-08-25 14:33:51 +02:00
Martin Gräßlin
e0103b15b7 [wayland] Remove the specific socket pair for QtWayland
Our own QPA plugin shares the internal connection, so we don't need the
dedicated connection for the QPA any more.
2015-08-25 14:33:50 +02:00
Martin Gräßlin
9272d01a2d Add a WaylandServer::findClient which takes a QWindow
Of course only works with internal clients.
2015-08-25 14:33:50 +02:00
Martin Gräßlin
a9e5343eb6 [wayland] Use an event thread for the internal Wayland connection 2015-08-25 14:33:50 +02:00
Martin Gräßlin
6294961ba4 [wayland] Keep Registry for internal connection around
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.
2015-08-25 14:33:50 +02:00
Martin Gräßlin
df1146bfa6 [wayland] Shadow gains support for a Wayland protocol
For Wayland clients we now are able to get shadows.

Internally this reuses large parts of the X11 implementation. This
could be improved to make the Scene's better aware of the Wayland
shadow, so that less memory is needed.
2015-07-15 11:25:16 +02:00
Martin Gräßlin
282321bfb5 [wayland] Announce support for idle interface 2015-07-09 10:10:58 +02:00
Martin Gräßlin
72635101f0 [wayland] Improve creation of KWayland::Server::PlasmaWindowInterface
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).
2015-07-09 09:10:33 +02:00
Martin Gräßlin
085c77810b [wayland] Create PlasmaWindow as child of AbstractClient
Ensures that the PlasmaWindow gets destroyed together with the window.
Note: when a ShellClient gets unmapped the PlasmaWindow does not yet
get destroyed. It should probably get destroyed and recreated on next
mapping.
2015-06-29 10:09:15 +02:00
Martin Gräßlin
8b6fef457b [wayland] Export themed icon name to PlasmaWindow interface
If the icon doesn't have a name, we pass the generic xorg icon. Most
likely our xwayland clients won't have a theme name, so giving them
the xorg icon seems a good enough work around. If we would want to
pass the real icon for xwayland clients we would need a way to
serialize them which seems like quite some needless overhead for legacy
applications. Can be considered for the future nevertheless.
2015-06-20 02:48:48 +02:00
Martin Gräßlin
69d78fe8db Fix unused variable warning 2015-06-20 00:12:22 +02:00
Martin Gräßlin
ccd8f50b63 [wayland] Connect state change requests from PlasmaWindowInterface
This should be enough for libtaskmanager to manage the windows.
2015-06-19 17:10:51 +02:00
Martin Gräßlin
3c2c1d31c9 [wayland] Add support for closeWindow request in PlasmaWindowInterface 2015-06-19 01:50:25 +02:00
Martin Gräßlin
171bbd662a [wayland] Export more states to PlasmaWindowInterface 2015-06-18 21:15:20 +02:00
Martin Gräßlin
f5724b9a55 [wayland] Unmap PlasmaWindowInterface instead of destroying it
The unmap triggers a destroy on client side and also triggers the
automatic cleanup of the PlasmaWindowInterface instance.
2015-06-18 00:22:48 +02:00
Martin Gräßlin
183479fe67 [wayland] Only create PlasmaWindowInterface if AbstractClient has a surface
With Xwayland clients it can happen that the window gets destroyed
before it ever got a surface (Qt 5's file open dialog being an example).

This change delays such clients till it got the surface, removing not
needed roundtrips and possible problems.
2015-06-18 00:22:48 +02:00
Martin Gräßlin
0b00af25dc [wayland] Announce AbstractClient to PlasmaWindowManagement interface
Creates a PlasmaWindowInterface for each AbstractClient and so far
passes caption and virtual desktop through.
2015-06-16 06:50:22 +02:00
Martin Gräßlin
859a3bb598 [wayland] Add support for PlasmaWindowManagement interface
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.
2015-06-13 18:23:54 +02:00
Boudewijn Rempt
98bcdbe70a [wayland] Add a command-line option to start an input method server
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.
2015-06-13 04:06:12 +02:00
Martin Gräßlin
f696b578cc [wayland] Add support for QtSurfaceExtension for closing ShellClients
If the ShellClient has a QtExtendedSurface it's closeable.
2015-06-10 00:59:53 +02:00
Martin Gräßlin
124bd8aaed [wayland] Add support for the PlasmaShell interface
The PlasmaShell interface allows to create a PlasmaShellSurface for a
given Surface. Through this interface the Surface can request:
* a specific position
* a window type

So far only the window types Normal, Panel and Desktop are supported
which is a sufficient subset for getting plasmashell to work.

In future there should be security checks so that only the dedicated
desktop shell can bind these interfaces.
2015-06-09 19:10:56 +02:00
Martin Gräßlin
1420bb38a9 [wayland] Drop Qt version check from WaylandServer::fakeDummyQtWindowInput
No longer needed as we install keymaps which prevents the crash in
QtWayland this version check worked around.
2015-05-28 10:25:11 +02:00
Martin Gräßlin
988ce28943 [wayland] Ensure size is updated before marking window as ready for painting
Fixes regression introduced with 90a6814: we may not queue a signal
taking a pointer to a ShellClient as the ShellClient might be destroyed
before the queued signal is delivered.

The idea for the queued signal was to ensure that the size is set when
windowShown is emitted - this can also be achieved by first updating the
size.
2015-05-28 08:27:34 +02:00
Martin Gräßlin
90a6814513 [wayland] Place ShellClients
When a ShellClient is added and it's not internal, it get placed just
like any other Client. This needs to happen after the initial size is
determined.

Please note: this breaks the positioning of popup windows (e.g. menus)
as they are placed like any other Client. This needs proper popup support
which right now does not yet exist and thus is not much difference to
before.
2015-05-27 14:20:12 +02:00
Martin Gräßlin
783afd17b7 [wayland] Delay WaylandServer::shellClientAdded till the Surface is ready for painting
This simplifies the interaction: we know that the Surface is useable if
it got announced to the Workspace.
2015-05-21 13:34:26 +02:00
Martin Gräßlin
36fa88893e [wayland] Track the internal ShellClients in WaylandServer
Adds all internal ShellClients into a dedicated list. This ensures that
we don't perform "normal" window management on them.

In addition we add them to the top of the stacking order. This restores
behavior as it is on X11: internal windows are using BypassWindowManagerHint
and thus on top of everything.
2015-05-21 13:34:26 +02:00
Martin Gräßlin
4ed4d4dab4 [wayland] Create a windowId for ShellSurface
The internal used window Id consists of two parts identifiying the
Client and one identifying the Surface. That is the first 16 bits
are set to the ClientConnection, the last 16 bits are taken from
the Surface id. As the Surface id is 32 bits, but we only use 16 bits
there is a chance of overlap. So this might need some improvement.
2015-05-21 13:34:26 +02:00
Martin Gräßlin
7d152991c7 [wayland] ShellClient can reference an internal QWindow
If the ShellClient got created for a Qt internal window, we try to
find the QWindow and if we get one, we use the geometry directly as
it got set by KWin in the first place.

Also a windowId() is added to ShellClient which can be used by the
effect system to find an EffectWindow. If it's an internal QWindow
we just use that window id. For other clients we still need some
smart solution.
2015-05-18 15:31:41 +02:00
Martin Gräßlin
74ae2f503e [wayland] Flush QtWaylands wl_display and KWin's wayland server when processing events
QtWayland and mesa might dead lock KWin if we start rendering a QWindow
before Qt/Mesa got the last frame callback. They perform blocking wayland
event reading on the main gui thread which makes it impossible for KWin
to do the compositing and send the callback.

To workaround this problem we fake a frameRendered directly after each
damage event for a Qt internal window. Unfortunately this is not yet
completely sufficient, thus we also need to ensure that the wayland
events are processed before any events are processed which would cause
a repaint and block. Thus we first flush QtWayland's wl_display and then
our Server connection. If there were any damage events we can be sure
that the frameRendered is sent before Qt attempts to render.
2015-05-18 15:31:40 +02:00
Martin Gräßlin
29c2ae57e0 [wayland] Use a dummy window for QtWayland's popup window handling
QtWayland only creates popup windows if they have a parent QWindow or
if there is any window which had input. It's not enough to fake an
enter, it needs to be either a pointer button press or key press.

As KWin's useraction menu doesn't have a parent and we most likely
never send a pointer press to any QWindow it doesn't get shown. To
circumvent this we create a dummy window and fake a button press/release
on the window. After that Qt is tricked into believing there's a parent
window and shows the popup.

Faking the input is only done with at least Qt 5.5 as QtWayland crashes
on pointer event without a keymap being installed. As KWin does not yet
send keymaps we better disable the dangerous code path. With Qt 5.5 the
crash condition is fixed.
2015-05-18 15:31:40 +02:00
Martin Gräßlin
4a671fbf98 [wayland] Don't handle ShellSurface created signals till Workspace is ready
Similar to Surface: we ignore till we are all ready to go.
2015-05-18 15:31:40 +02:00
Martin Gräßlin
8d3ee65269 [wayland] Don't set surface on Toplevel for non Xwayland-Clients
For other clients we are only interested in the shell surfaces.
2015-05-08 12:43:47 +02:00
Martin Gräßlin
28d314a487 [wayland] Create a DataDeviceManager in wayland server
Makes QtWayland way more happy.
2015-05-08 12:43:47 +02:00
Martin Gräßlin
d60c377890 [wayland] Introduce a ShellClient
The ShellClient is a Toplevel subclass for a
KWayland::Server::ShellSurfaceInterface. It gets created when a new
ShellSurfaceInterface is created and destoryed when it gets unmapped.

So far the usage is still rather limited. The ShellClient is opened
at position (0/0). While it's possible to pass pointer events to it,
it's not yet possible to activate it, so no keyboard focus.
2015-05-08 12:43:44 +02:00
Martin Gräßlin
603844cf98 [wayland] Allow the AbstractBackend subclasses to manage OutputInterfaces
This gives the backend more control without needing to provide all
information in Screens.
2015-04-24 12:03:20 +02:00
Martin Gräßlin
8ec3f55ff4 [wayland] Abort if Xwayland connection breaks
If Xwayland goes down it's better to abort than staying alive. If
Xwayland goes down the next roundtrip to X (most likely during call
to xStackingOrder) will just freeze completely, which is kind of the
worst as one cannot VT-switch anymore. So a clean abort is a bad but
better solution.
2015-04-21 09:21:49 +02:00