Commit graph

14 commits

Author SHA1 Message Date
Martin Gräßlin
d19b6c0241 [kwin-wayland] Add support for FullscreenShell
The FullscreenShell is a Wayland protocol provided by Weston to have
exactly one surface per output. This is exactly what KWin needs. So
in case the Wayland server we connect to provides the FullscreenShell
we prefer it over the normal Shell and mapping our surface as fullscreen.

The protocol is not yet part of wayland-client library, so the header
and source file needs to be generated. This is done during the build
process using the external tool wayland-scanner. The protocol
description is copied from the Westion 1.5 sources.

REVIEW: 119839
2014-08-27 08:55:40 +02:00
Martin Gräßlin
bd5fe4f785 [kwin_wayland] Add a Wayland::Registry class
The Wayland::Registry class wraps wl_registry handling. It keeps track
of the interfaces in the registry and emits signals whenever a known
interface gets announced or removed. So far it only tracks the interfaces
which are used and needed by KWin.
2014-08-18 14:05:35 +02:00
Martin Gräßlin
3185530ed6 [kwin-wayland] Create dedicated thread for wayland connection
The Wayland event queue is moved into a dedicated thread and a
new class is created for just creating the connection and listening
for events. The WaylandBackend creates the thread and uses an event
queue for the main thread.

REVIEW: 119761
2014-08-18 08:51:24 +02:00
Martin Gräßlin
670973efdb Move creating WaylandBackend into ApplicationWayland
Early creation to ensure that we can abort if there is no Wayland
display to connect to.
2014-08-18 08:50:44 +02:00
Sebastian Kügler
530160a2f3 Fix grammar in docs 2014-08-12 00:16:26 +02:00
Martin Gräßlin
02c4ae1002 Track information about connected outputs to the Wayland Compositor
The Wayland Backend connects to the wl_output interface to get
information about the connected outputs and their modes. This information
can be used to setup screen information.
2014-03-19 14:14:40 +01:00
Martin Gräßlin
ca9642b80f Watch whether the Wayland socket goes away
The Wayland Backend watches the socket it uses for communicating with the
Wayland compositor. If the socket is removed we have to perform a kind of
emergency stop. The backend tears down all data structures created from
the Wayland display and emits a signal that the system compositor died.

In addition the Wayland Backend starts to monitor the XDG_RUNTIME_DIR for
the socket to be added again. If the socket is created again the backend
reinitializes the Wayland connection.

This also requires the Compositor to restart. Therefore it connects to
the new signals emitted by the Wayland Backend to stop and start
compositing.
2014-03-19 09:30:17 +01:00
Martin Gräßlin
f9704ff0df Add support for Wayland Cursor themes
WaylandSeat can install a cursor based on Qt::CursorShape using the
Wayland cursor theme library.
2014-03-18 09:00:49 +01:00
Martin Gräßlin
8b1040f78d Move installing cursor image form X11CursorTracker to WaylandSeat
This allows to install cursor images also from other parts.
2014-03-18 09:00:49 +01:00
Martin Gräßlin
59e08896fb Better re-using of Wayland::Buffer
A user can now directly request a Wayland::Buffer object which exposes
the memory address of the shared memory with the wl_buffer. This allows
to use the Wayland Buffer directly as the storage of a QImage.

To make sure that the ShmPool does not reuse such a buffer the Buffer can
be marked as used.

When the ShmPool gets resized the memory addresses become invalid.
Therefore the ShmPool is now a QObject and emits a signal on resized pool
so that every user of a Wayland::Buffer can remap the memory.
2014-01-08 09:22:40 +01:00
Martin Gräßlin
b7a1f2b3cf Support resizing of Wayland ShmPool
The Wayland::Buffer no longer holds the exact memory address but only
the offset in the pool. The actual address of the pool is only known to
the ShmPool which allows us to remap a resized file.

If a new buffer cannot be provided by the given pool, it gets now resized
to the new needed size. This allows us to only create a very small pool.
2014-01-08 09:22:40 +01:00
Martin Gräßlin
53c09ce7bd Reuse wl_buffer in ShmPool
A new Wayland::Buffer class is provided which wraps a:
* wl_buffer
* size
* stride
* memory address of data represented by the buffer

In addition the Buffer knows whether the compositor has released it or
not. This allows the ShmPool to reuse the buffer in case the same size
and stride is requested.

This is currently most relevant for the CursorData. Instead of keeping
the wl_buffer, the QImage for the cursor is kept and each time the cursor
is set for the surface a new buffer is requested from the ShmPool.

The ShmPool now either reuses an existing buffer or creates a new one.
Furthermore the ShmPool takes care of releasing all buffers at EOL.
2014-01-08 09:22:40 +01:00
Martin Gräßlin
0f09f00210 WaylandBackend becomes a KWin Singleton
The backend gets created by Workspace, but only if the environment
variable WAYLAND_DISPLAY is set.

Because of that the egl wayland backend does no longer create the
backend, but uses the already created one.
2014-01-08 09:22:40 +01:00
Martin Gräßlin
baf477ac00 Split out non-EGL functionality of WaylandBackend into own source files
The functionality to create the connection to a Wayland compositor and
creating a fullscreen surface is moved into wayland_backend.(h|cpp). The
wl_egl_window for the surface is moved into the EglWaylandBackend to have
the actual WaylandBackend free from Egl. This will allow in future to
implement other compositing backends for Wayland which do not use egl.
This means that egl is no longer a build requirement for the wayland
related functionality.
2014-01-08 09:22:40 +01:00