Commit graph

28 commits

Author SHA1 Message Date
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
Martin Gräßlin
d2cd10861b [wayland] Use a DPI of 96 to calculate physical size for the server's outputs
Not perfect but better than a hardcoded physical size.
2015-04-02 17:36:38 +02:00
Martin Gräßlin
2b185fa7e0 [wayland] Set internal cursor through WaylandCursorTheme in AbstractBackend
Getting the cursor image from the cursor theme is unfortunately not
straight forward. We have three different libraries and all have
drawbacks:
* XCursor - we just kicked it out
* xcb-util/cursor - only provides xcb_cursor_t, so a dependency on X
* wayland-cursor - only a client side API

The picked solution is using wayland-cursor. It provides the cursor in a
wl_buffer. Unfortunately the client side API does not easily allow to
a) read it back
b) init without a wl_shm_pool

Thus we need to work this around:
* create an internal connection
* get a ShmPool on it
* init WaylandCursorTheme with this ShmPool
* get the cursor wl_buffer from the theme
* trigger a roundtrip
* get the corresponding BufferInterface for the buffer
* set the content as the software cursor
2015-04-02 14:37:23 +02:00
Martin Gräßlin
9a0fd94013 Introduce AbstractBackend as base class for Wayland and X11Windowed backend
The AbstractBackend registers itself in the WaylandServer allowing
external users to easily get to the backend and not needing to test
manually which backend is used.
2015-03-20 14:41:03 +01:00
Martin Gräßlin
79c49e84a4 [kwin_wayland] Pass socket file descriptor to QtWayland
WaylandServer allows to create a ClientConnection which is intended for
QtWayland. This allows us to easily identify our "own" surfaces. The
created file descriptor is set as env variable WAYLAND_SOCKET prior to
creating the Application. Wayland will unset it after connecting, so we
don't need to unset it. This removes the hack of setting and resetting
the WAYLAND_DISPLAY environment variable.
2015-03-17 10:20:19 +01:00
Martin Gräßlin
69a13a779d [kwin_wayland] Start Xwayland through socket file descriptor
Creates a socketpair in WaylandServer and creates a ClientConnection for
Xwayland. The created file descriptor is passed to Xwayland through the
WAYLAND_SOCKET env variable.
2015-03-17 10:20:19 +01:00
Martin Gräßlin
54c2c5db2d [wayland] Create SeatInterface and sync with WaylandBackend's seat
If not using libinput we get the seat information from the lower
level Wayland server: let's forward the information to our own
SeatInterface.
2015-03-17 10:20:19 +01:00
Martin Gräßlin
dc0f040185 [kwin_wayland] Init Outputs from screen information
Removes the hack for startup. Still needs proper physical size.
2015-03-17 10:20:19 +01:00
Martin Gräßlin
07c972b6d4 [wayland] Add a SurfaceInterface to Toplevel
Adds the SurfaceInterface identified by the surface id we get from
Xwayland. This allows in an easier way to map a Toplevel to a
Wayland surface and will also be useful for Wayland clients.
2015-03-17 10:08:27 +01:00
Martin Gräßlin
47bdce074e Let the fun begin: start a WaylandServer in kwin_wayland
The WaylandServer is at the moment only used to support starting an
Xwayland. It does not support Wayland clients yet, so don't get
excited.

For Xwayland it's using the trick of creating the Display before the
QApplication is created with manual event dispatching.
2015-03-17 10:08:27 +01:00