Commit graph

20 commits

Author SHA1 Message Date
Martin Gräßlin
1927c3a1ae [server] Add static SurfaceInterface *SurfaceInterface::get(quint32 id) 2015-02-09 14:33:50 +01:00
Martin Gräßlin
5b03dfe324 Improve attaching buffer and commiting in SurfaceInterface
Now the code handles correctly the attaching of a null buffer
(emits a signal unmapped) and if a commit doesn't have a pending
buffer it won't be reset. Damage requests are ignored if no buffer
has been attached yet.
2014-11-28 08:33:32 +01:00
Martin Gräßlin
68ce470231 Add a parentResource to Resource 2014-11-20 16:40:14 +01:00
Martin Gräßlin
b243eea6cd Add createResource to ClientConnection
One place to rule all createResource calls.
2014-11-19 19:01:15 +01:00
Martin Gräßlin
c71cf3999c Resource holds a ClientConnection instead of a wl_client 2014-11-19 16:53:56 +01:00
Martin Gräßlin
8685a0e972 Create wl_resource in Resource::Private instead of subclasses
Required information is passed through the ctor of Private.
::create is still virtual as ShellSurfaceInterface is retrieving
client information. This can be fixed once we have a better wl_client
encapsulation class.
2014-11-14 15:33:21 +01:00
Martin Gräßlin
57de2df55e Track all created Resources in Resource::Private
Also provide static method to map a wl_resource to the Resource
sub class.
2014-11-14 15:13:06 +01:00
Martin Gräßlin
cee32f902a Move static unbind method from derived classes to Resource::Private
All classes had exactly the same implementation, so it's a good idea
to share the implementation.
2014-11-14 11:01:54 +01:00
Martin Gräßlin
0fb42d102e Move q-ptr to Resource::Private
In the derived classes a q_func() is added which casts the q-ptr
back to the Resource derived class.
2014-11-14 10:55:06 +01:00
Martin Gräßlin
de62216357 Add cast from wl_resource to Private to Resource::Private
Replaces the custom implementation in each of the derived classes.
2014-11-14 10:20:43 +01:00
Martin Gräßlin
53a4455c47 [server] Introduce a base class Resource
The Resource base class is supposed to be used by all interface
classes which get created for a wl_resource.

Most interface classes are adjusted, but there are some exceptions:
* BufferInterface: is different as the wl_resource is already created
* PointerInterface and KeyboardInterface: those two need changes, the
  implementation differs from all other interface implementations.
2014-11-14 09:45:02 +01:00
Martin Gräßlin
dd50148187 [server] Interface method returning wl_resource* is called ::resource
Simplifies using the library as all Interfaces have the same methods.
Note: there are interfaces not providing the wl_resource* method.
2014-11-13 13:05:01 +01:00
Martin Gräßlin
ec16b7c40e Use a destroy listener in BufferInterface
This fixes a crash when closing a connected Xwayland server.
2014-11-07 09:04:19 +01:00
Martin Gräßlin
5debfb6832 Add support for opaque and input region to Surface
Implemented on both Client and Server side.
2014-10-16 14:59:01 +02: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
e448b84a82 Add d-pointer to Server::SurfaceInterface
It also adds a
static SurfaceInterface *get(wl_resource*)
to SurfaceInterface which can find the SurfaceInterface for the
given wl_resource. This is needed for ShellSurfaceInterface which
can no longer just cast the wayland user data.
2014-09-19 07:06:31 +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
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