Commit Graph

39 Commits (551b3a4c48eeceef562a9e9db7c558b906480aea)

Author SHA1 Message Date
Daniel Pastushchak 0d997b1093 Introduce categorized logging for kwin core
Done by Daniel Pastushchak for KDE during GCI-2014.
2014-12-05 14:27:15 +01:00
Martin Gräßlin 2a6cd5010a Set a default cursor when creating the WaylandCursor 2014-10-20 14:51:24 +02:00
Martin Gräßlin 96d6a55ea8 Do not create a WaylandSeat if we use libinput 2014-10-20 14:51:24 +02:00
Martin Gräßlin c2185c9530 Drop check whether WAYLAND_DISPLAY env is set
It was used to check whether we should create the Wayland interaction,
but now that is in kwin_wayland and kwin_x11 doesn't even try to create
the WaylandBackend.
2014-10-17 09:28:15 +02:00
Martin Gräßlin 1829345a2f Support setting cursor image as a SubSurface
The idea is to manage the cursor position by ourself. This is needed
when KWin gains libinput support and doesn't rely on the Seat anymore.
The suggestion for this is to use SubSurfaces. The nice side-effect is
that we can do cursor warping again which we need e.g. for ScreenEdge
activation or for the kill helper, etc. Clients on the other side
still cannot (and should not) warp the pointer.
2014-10-16 16:39:49 +02:00
Martin Gräßlin 2fec4d55fc Move X11CursorTracker from WaylandSeat to WaylandBackend
Allows it to be easily re-used in case we don't have a Seat.
2014-10-15 14:55:31 +02:00
Martin Gräßlin fd0d966652 X11CursorTracker emits signal when a new cursor image needs to be installed
This means the X11CursorTracker is no longer bound to the WaylandSeat.
Instead the WaylandSeat just connects to the signal emitted by the
X11CursorTracker. This allows to use the X11CursorTracker also in cases
where we don't use a Seat for setting the cursor image.
2014-10-15 14:29:26 +02:00
Martin Gräßlin 752de2d888 Use Registry::interfacesAnnounced signal for WaylandBackend::createSurface
We are interested in going into createSurface exactly once when
everything is ready. This is something we now know due to the new signal
in Registry. So instead of multiple entry points there is just one.
2014-10-15 12:37:20 +02:00
Martin Gräßlin 7242f64d4c Change wl_event_queue to KWayland::Client::EventQueue
Requires e708af8c9dfaa2eb0d95f5e2b5059890885c5f74 in kwayland.
2014-09-23 13:15:49 +02:00
Martin Gräßlin b8837b66f3 ShmPool returns QWeakPointer<Buffer> instead of Buffer*
Requires effad12d8b1169d9ffe851fc3f0143eeb8deb10d in kwayland.
2014-09-22 09:59:58 +02:00
Martin Gräßlin 5eceda4ae6 ShmPool returns Buffer instead of wl_buffer
Requires c561316236279754c5570009ec6adb5da215efd8 in kwayland.
2014-09-20 15:13:17 +02:00
Martin Gräßlin 237ee7fcc7 wayland_client and wayland_server moved to kwayland
kwayland is provided by kde:kwayland and is located at
kde/workspace/kwayland

It's an optional build dependency needed only for kwin_wayland.
2014-09-19 13:59:51 +02:00
Martin Gräßlin 6ddded0852 [kwin_wayland] Cleanup wayland_backend.[h|cpp]
Remove no longer needed includes, turn one time slot methods into
lambdas, etc.
2014-08-27 08:57:06 +02:00
Martin Gräßlin 46f2b252d8 [kwin_wayland] Create dedicated classes for Seat, Keyboard and Pointer
Split out from wayland_backend. So far no unit test as there is no proper
way to simulate input events.
2014-08-27 08:57:06 +02:00
Martin Gräßlin 0b0a48ca08 [kwin_wayland] Create a dedicated class for Compositor
Wraps the compositor interface.
2014-08-27 08:57:06 +02:00
Martin Gräßlin a7ea4e1a56 [kwin_wayland] Make ShmPool more like the other wrapper classes
Normal QObject ctor and the setup method to bind to the interface.
2014-08-27 08:57:06 +02:00
Martin Gräßlin 08ab2c424e [kwin_wayland] Split out Buffer and ShmPool into dedicated files
Moved from wayland_backend.[h|cpp] to buffer.[h|cpp] and
shm_pool.[h|cpp]. Buffer is slightly adjusted to have the ShmPool
passed in as a ctor argument and the ctor is private and friended with
ShmPool, so that it can only be constructed from ShmPool.
2014-08-27 08:57:06 +02:00
Martin Gräßlin ce8c4240f7 [kwin_wayland] Create a dedicated Surface class
A Surface class is split out which holds a wl_surface and supports
attaching a buffer, setting the damage and emitting a signal when the
frame callback got called.

It doesn't come with a unit test yet as it first needs the ShmPool
and Buffer properly split out to easily set it up.
2014-08-27 08:57:06 +02:00
Martin Gräßlin bd8ed3cd70 [kwin_wayland] Flush display connection before going to block
Integrate with QAbstractEventDispatcher::aboutToBlock and because of that
we can drop all direct calls to flush from the Scenes.
2014-08-27 08:57:06 +02:00
Martin Gräßlin 8c4bc3ba45 [kwin_wayland] Split out wl_shell and wl_shell_surface into dedicated classes
New classes Shell and ShellSurface are created. Both are in shell.[h|cpp]
to indicate their close relationship with the Shell having to create the
ShellSurface.

WaylandBackend is adjusted to hold a Shell* and ShellSurface* instead of
the lower level structs. This also required adjustements to the creation
of the Backend as it now doesn't set a default size any more. Thus the
backendReady signal may not be emitted before the initial configure
event arrived. This also makes it easier to support either the fullscreen
shell or wl_shell at the same time.

Of course a unit test is added for the two new classes. This needs to
be extended once we have more control over the mock Wayland server.
2014-08-27 08:57:06 +02:00
Martin Gräßlin d2f1e936f1 [kwin_wayland] Move Wayland::Output into dedicated source files
At the same time adding an autotest for the Output, moving the listener
into the Output class and providing enums for Subpixel and Transform.

KWin now requires wl_ouput interface version 2 as that allows us to emit
the changed signal in a better way.

The unit test is not yet capable of testing everything, we need a mock
Wayland server which is more flexible.
2014-08-27 08:57:05 +02:00
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 ac25052c22 [kwin_wayland] Safety check for WaylandSeat::installCursorImage
wl_cursor_theme_get_cursor might return a null pointer - return
instead of crash.
2014-08-25 15:22:21 +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 f373aa1ce5 Improve sanity check in WaylandBackend::create
If the WaylandBackend got created without a wl_display we better
stop processing.
2014-08-18 08:50:44 +02:00
Martin Gräßlin f9a7b94ee7 Create dedicated kwin_x11 and kwin_wayland binaries
All of kwin except the main function goes into a new (private) library
called kwin. Two new kdeinit_executables are created:
* kwin_x11
* kwin_wayland

Both only use a dedicated main_x11.cpp and main_wayland.cpp with the
main function and a KWin::Application subclass and linking the new
kwin library.

The main idea behind this is to be able to perform more sane sanity
checks. E.g. on Wayland we don't need to first test whether we can
create an X11 connection. Instead we should abort if we cannot connect
to the Wayland display. Also the multi-head checks are not needed on
Wayland, etc. etc. As most of that code is in the main function to
simplify it's better to split.

This will also make it easier to diverge more easily in future. The
Wayland variant can introduce more suited command line arguments for
example. This already started by having the --replace option only
available in X11 variant. The Wayland backend is still a window manager,
but doesn't claim the manager selection.
2014-08-18 08:50:44 +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 6baf794f88 InputRedirection for keyboard events
Major new functionality is xkbcommon support. InputRedirection holds an
instance to a small wrapper class which has the xkb context, keymap and
state. The keymap is initialied from the file descriptor we get from the
Wayland backend.

InputRedirection uses this to translate the keycodes into keysymbols and
to QString and to track the modifiers as provided by the
Qt::KeybordModifiers flags.

This provides us enough information for internal usage (e.g. pass through
effects if they have "grabbed" the keyboard).

If KWin doesn't filter out the key events, it passes them on to the
currently active Client respectively an unmanaged on top of the stack.
This needs still some improvement (not each unmanaged should get the
event). The Client/Unmnaged still uses xtest extension to send the key
events to the window. So keylogging is still possible.
2014-03-18 09:00:50 +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 1617deabb8 Introduce the beginning of an InputRedirection class
So far this new class is not yet doing much. The WaylandBackend forwards
the received pointer events to this InputRedirection class. From there
signals are emitted to inform internal areas about the changes first.

The events are currently forwarded to X through the xtest extension. This
will be removed in future. Input will be forwarded directly to the
surface which wants it (no matter whether X11 or Wayland).
2014-03-18 09:00:49 +01:00
Martin Gräßlin 6eb104b32a Introduce an OperationMode enum
This enum describes how KWin is operating with the available windowing
systems. By default KWin is using the OperationModeX11, but if the
Wayland backend gets started KWin is using the OperationModeWaylandAndX11

This will be extended in future when XWayland and Wayland only become
viable options.
2014-01-09 15:16:33 +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