Commit graph

21 commits

Author SHA1 Message Date
Martin Gräßlin
d28f95f603 [server] Better split flushing events and dispatch events
Running real world applications (Xwayland) showed that it doesn't like
at all that we do a dispatch when we are going to flush. This caused
in a very reliable manner a "Connection closed" error in XWayland, taking
down the client and in return the (xwayland-enabled) server.
2015-04-21 08:56:19 +02:00
Martin Gräßlin
846a4e1d79 [server] BufferInterface can resolve size through egl extension
Uses eglQueryWaylandBufferWL (if available) to determine the size of the
buffer. In order to do so, the server library links against egl (1) and
one needs to register the EGLDisplay in Server::Display by the user of
the library. For this a new method Display::setEglDisplay is added.

1: not using epoxy as it doesn't wrap the Wayland interfaces yet.
2015-03-03 09:43:30 +01:00
Martin Gräßlin
16b26b2428 [server] Use eventDispatcher on currentThread instead of QCoreApplication
This allows to start the Wayland server before the QCoreApplication is
created with an eventDispatcher being installed through
QCoreApplication::setEventDispatcher.
2015-02-18 09:32:40 +01:00
Martin Gräßlin
775908e02c [server] Fix incorrect assert
Display::createShm is allowed to be called when the Display is not
yet running. E.g. while starting up for the Xwayland case.
2015-02-09 17:13:20 +01:00
Martin Gräßlin
1d5a032803 Introduce categorized logging
New logging categories KWAYLAND_SERVER and KWAYLAND_CLIENT.
2015-01-20 09:42:26 +01:00
Martin Gräßlin
e8dbd39c60 Display::start takes a StartMode argument
If one passes StartMode::ConnectClientsOnly the socket in
XDG_RUNTIME_DIR is not created and instead one can only connect to
this server using the Display::createClient method. A very nice
solution to just have a Server and one dedicated Client talk to each
other.
2014-11-27 16:42:16 +01:00
Martin Gräßlin
ef810d39f7 ConnectionThread can connect to a socket fd instead of name
This allows connecting a client without going via the socket
name. E.g. to create a socketpair in the server and fork to
exec the client.
2014-11-27 16:38:01 +01:00
Martin Gräßlin
b770cbb140 Expose all ClientConnections in Display 2014-11-17 18:15:50 +01:00
Martin Gräßlin
8f11a2b0e5 Adding a new ClientConnection class for wrapping wl_client
The ClientConnection is managed by Display. Whenever one tries to
get a ClientConnection for a wl_client* and it doesn't exist yet a
new one will be created and a clientConnected signal will be emitted.
Also there is a clientDisconnected signal.

ClientConnection provides access to pid, uid and gid. The idea is
to extend it to provide access to all the resources created for the
client.
2014-11-17 16:01:18 +01:00
Martin Gräßlin
9d5d8d0871 Display can start the server before QCoreApplication is created
Event dispatching in Display requires a QSocketNotifier which
requires the QCoreApplication to be created. This requirement renders
it impossible to create the server before the QCoreApplication is
created. But there are use cases which need this:

Let's assume we want to integrate a wayland server into an existing
X11 dependent application which uses QApplication and enforces the
xcb plugin. This means said application requires that an X Server is
up and running before the QApplication is created. If we want said
application to connect to an Xwayland server we need to be able to
create the Wayland server AND the Xwayland server before creating
the QApplication.

The solution is to only create the socket notifier if the
QCoreApplication exists. For the case that it doesn't exist an
additional method is added which needs to be called once the
QCoreApplication got created. In addition a manual event dispatch
method is added which allows to block for events when we don't
have a QSocketNotifier set up yet.
2014-11-07 11:41:37 +01:00
Martin Gräßlin
92c46fdcd3 Add DataDeviceManager and DataSource in client and server
Basic implementation of the DataDeviceManager and the DataSource it
creates.

Still needs support for DataDevice and DataOffer to complement the
API.
2014-11-04 15:10:22 +01:00
Martin Gräßlin
ee24e4e08a Add support for wl_subcompositor and wl_subsurface
This implements the subcompositor and subsurface protocol on both
Client and Server side.

Client:
New classes SubCompositor and SubSurface. The SubCompositor can be
created through the Registry and creates the SubSurface which is
bound to a Surface and has a parent Surface. The SubSurface class
provides convenient wrappers for all calls exposed in the
wl_subsurface interface.

Server:
New classes SubCompositorInterface and SubSurfaceInterface. Support
for all commands is added, though the API probably still can need
some fine tuning. The synchronized vs. desynchronized behavior is
not yet exposed in the API. This could also be delegated towards
the user of the library.
2014-10-16 08:19:52 +02:00
Martin Gräßlin
2bee5b0e2b Add d-pointer to Server::Display 2014-09-18 15:40:22 +02:00
Martin Gräßlin
a8c7c16c94 Use namespace KWayland::Server instead of KWin::WaylandServer
It's no longer part of KWin.
2014-09-17 16:10:38 +02:00
Martin Gräßlin
3c87cea7a8 Change to LGPLv2+
I'm the only copyright holder of the code in this repository, thus
I can change from GPL to LGPL!
2014-09-17 15:57:56 +02:00
Martin Gräßlin
7003d80173 [kwin_wayland] Add assert in Display::setRunning
Making the impossible condition an assert instead of a return.
2014-09-03 20:04:31 +02:00
Martin Gräßlin
9d780deeb2 [kwin_wayland] Add SeatInterface to server module
So far the Seat interface is provided together with pointer and
keyboard. As always touch is not yet implemented. The pointer interface
is still lacking the set cursor callback. Keyboard on the other hand is
complete.

Both Keyboard and Pointer have the concept of a focused surface and only
to the bound interface belonging to the same client as the focused
surface events are sent.

The change comes with a set of new auto tests also verifying the client
side which wasn't possible before as we couldn't fake events.
2014-09-02 10:55:33 +02:00
Martin Gräßlin
71b125e967 [kwin_wayland] Add Shell and ShellSurface to server module
ShellSurfaceInterface is not yet completely implemented. Several parts
are still TODO, e.g. move/resize is missing, setting to maximized is
missing and also flags for fullscreen are missing.

The surface test is extended as far as possible.
2014-09-02 10:55:33 +02:00
Martin Gräßlin
76cb898c7f [kwin_wayland] Add support for shm buffers in server module
The Display provides a method to create the shm pool and a
BufferInterface class is added to the server module. It is created
from the SurfaceInterface when a buffer gets attached to the surface.
The BufferInterface can be referenced and once its unreferenced it
sends a buffer release to the client and destroys itself.

For the case that the buffer is a shm buffer the BufferInterface
provides a convenience method to turn it into a QImage.

The auto test for Surface is extended by attaching buffers to the
surface and verifying that the content is correct.
2014-09-02 09:52:16 +02:00
Martin Gräßlin
992d210e86 [kwin_wayland] Add CompositorInterface and SurfaceInterface
As far as it's currently possible to implement. CompositorInterface is
able to create a surface and emits the created SurfaceInterface. It
does not yet support regions.

The SurfaceInterface is already more complete. It keeps track of the
double buffered states and emits signals when one of the values are
changed after the committing. It supports frame callbacks and has a
hook to mark the frame as rendered.

What's still missing are the regions (as it's not implemented in
CompositorInterface) and attaching the buffer as we do not yet support
creating shm buffers and pools.

The client side test is changed to use our own server and extended to
test damage and frame callback. The test needs to be extended for scale
and transform, but that is still missing in the client side
implementation.
2014-09-02 09:52:16 +02:00
Martin Gräßlin
07bdf14dab [kwin_wayland] Initial addition of the WaylandServer module
So far this new module contains:
* Display
* OutputInterface

Display manages the server socket and server event loop. In general it's
the entry point to any part of the server.

OutputInterface is the abstraction for the wl_output interface on server
side. An OutputInterface is created through the Display.

The auto tests for ConnectionThread and Output are adjusted to use the
internal server instead of starting Weston. Especially the Output test
could be extended to test much more as we have absolute control over
the server now.
2014-09-02 09:52:16 +02:00