The selection is supposed to be sent to the DataDeviceInterface just
before getting keyboard focus. In order to do that the SeatInterface
keeps track of the DataDeviceInterface which is the current selection
and the DataDeviceInterface of the focused keyboard client.
SeatInterface friends DataDeviceManagerInterface so that the latter
can register each created DataDevice for the SeatInterface.
The button state is a seat-global state and not a per pointer state.
All pressed/released and axis events are moved to the SeatInterface
and just invoke the related method on the focused surface pointer.
Makes PointerInterface more like other Interface classes wrapping
wl_resource. The most important change is the handling of the
focused surface. This is now kept in the SeatInterface and can also
be set if there is no PointerInterface for the client yet.
The unit tests had to be adjusted and some are also disabled as the
button events are not yet moved into SeatInterface.
This method is supposed to return the PointerInterface for the current
focused surface. At the moment it just creates the one global
PointerInterface. The existing SeatInterface::pointer method got
removed as that is actually wrong usage.
There can only be one focused surface per Seat, thus the information
should be hold in the seat.
This only adjusts the API, the actual data is still hold in the
PointerInterface. This still needs adjustment.
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.
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.
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.
Version and interface get passed to the ctor allowing Global::Private
to implement ::create instead of providing a pure virtual method.
Also the static bind method is added to the Global::Private which
delegates into a pure virtual method.
New base class KWayland::Server::Global which all Interface classes
for a wl_global inherit. Furthermore there is a shared base class
for all the Private classes of that type.
The BufferInterface used nested calls of wl_shm_buffer_begin_access
and allowed multiple different BufferInterfaces to be in a block
between wl_shm_buffer_begin_access and wl_shm_buffer_end_access.
But this is not allowed: nesting is only possible if it accesses
the same buffer!
This resulted in an abort when we accessed two BufferInterfaces
at the same time. The added test case aborts in the previous
version.
The fix now changes the semantic of the method. The BufferInterface
doesn't hold the QImage any more, but creates a new one every time
::data is invoked. The QImage is created with a custom cleanup
function which calls to wl_shm_buffer_end_access. It ensures that
we don't call into wl_shm_buffer_begin_access as long as there is
a valid QImage for any other BufferInterface still around and
instead returns a null QImage.
Thus a user of a BufferInterface::data should destroy the returned
QImage as soon as it's no longer needed or create a deep copy if
it needs to be kept around.
Counter part for the copyClient test app: the pasteClient test app
creates and maps a shell surface and waits for selection announce,
initiates the copy/paste mechanismn and prints out what got pasted.
After success it closes itself.
The test application copyClient creates a ShellSurface, maps it as
fullscreen, renders a green buffer and when it gets pointer focus it
sets "foo" in mimetype "text/plain" into the selection.
This test application "testRenderingServer" is able to start a
Wayland server and uses a QWidget to render the "scene". It manages
ShellSurfaces and renders them on the QWidget in a very static way.
Furthermore input events (key, pointer, wheel) are forwarded to the
top most Surface.
This test server is able to support kwin_wayland as a client, but
weston's test application in latest release fail due to missing
xdg_shell support.
Qt::MouseButton is mapped to the linux buttons. The mapping does
not match the mapping used in QtWayland module [1] as that seems
to be incorrect to me. E.g. Qt::BackButton is not mapped to BTN_BACK.
[1] qtwayland/src/client/qwaylandinputdevice.cpp