Commit graph

18 commits

Author SHA1 Message Date
Vlad Zahorodnii
16db81b5cc Make RegionInterface private
If a Wayland protocol deals with regions, they will be exposed as
QRegion objects in public API. Therefore, it makes sense to make
RegionInterface private as it's an implementation detail and it's
not intended to be used in public api.

The corresponding test was dropped because the CompositorInterface
no longer emits a signal to indicate that a wl_region has been created.
It should be also noted that wl_region stuff is already tested via
other means, e.g. surface damage, etc.
2021-03-15 16:28:30 +00:00
Vlad Zahorodnii
9f83741621 Introduce resource_cast<> helper function
Getting the object associated with the particular wl_resource is not
difficult, but it involves a pretty reasonable amount of boilerplate
code.

This change, introduces a helper function with an intend to reduce the
amount of boilerplate code.

It can be used as resource_cast<const ObjectPrivate *>(resource) or
just simply resource_cast<ObjectPrivate *>(resource).
2020-11-04 08:15:31 +02:00
Vlad Zahorodnii
58cd4825e7 Port the wl_region wrapper to the new approach 2020-07-15 11:04:30 +03:00
Aleix Pol
306f242ac8 Port namespaces and includes 2020-04-29 16:56:38 +02:00
Andreas Cord-Landwehr
9267f146fd KWayland: Convert license headers to SPDX
Summary:
Convert license headers to SPDX expressions and add license files as
required by REUSE specification.

Reviewers: zzag

Reviewed By: zzag

Subscribers: kde-frameworks-devel

Tags: #frameworks

Maniphest Tasks: T11550

Differential Revision: https://phabricator.kde.org/D28058
2020-03-16 19:57:44 +01:00
Friedrich W. H. Kossebau
6f69a44e2a Use K_DOXYGEN instead of deprecated DOXYGEN_SHOULD_SKIP_THIS
GIT_SILENT
2020-01-23 12:20:45 +01:00
Martin Gräßlin
ab98448fec [server] Standardize the destructor request handling for Resources
Summary:
This change standardizes the behavior regarding the destructor request.

The destructor should destroy the resource and nothing else. The
Wayland library invokes the static unbind method once the resource is
destroyed. The implementation provided by Resource::Private::unbind
triggers a delete later on the Resource. So there is no need to trigger
a deleteLater from the destructor request callback.

This change adds a generic implementation to Resource::Private which is
now used by all inheriting classes replacing the custom implementations.

Test Plan:
For a few Resources the test is extended to ensure that the Resource
gets deleted on server side.

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D1679
2016-05-30 08:16:07 +02:00
Martin Gräßlin
f4f2725132 [server] Improve the handling when clients disconnect
Summary:
So far the server component performed manual cleanup in some cases
when a client disconnects. But this is not needed: the Wayland library
calls the static unbind methods which do cleanup. If we cleanup ourselves
this can result in double deletes in the worst case, so let's only use
the Wayland functionality.

Adjusted:
* RegionInterface
* SurfaceInterface
* ShellSurfaceInterface (doesn't take a parent anymore)
* DpmsInterface
* QtSurfaceExtensionInterface
* KeyboardInterface
* PointerInterface
* TouchInterface
* DataOfferInterface
* PlasmaShellSurfaceInterface

For each adjusted case a test case is added to verify that the cleanup
works. Exceptions are DpmsInterface as the actual Resource is not exposed
at all in the Server component and DataOfferInterface as that is server
side created.

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D1640
2016-05-19 16:21:27 +02:00
Martin Gräßlin
5e3bb70612 Fix doxygen generation
Doxygen doesn't like our callback listener at all. We need to hide
it from doxygen, otherwise docu doesn't get generated.
2015-09-09 16:39:50 +02:00
Martin Gräßlin
260c33e75d [server] Call wl_resourc_destroy from destroyCallbacks
That's what weston does.
2015-04-20 13:56:41 +02:00
Martin Gräßlin
68ce470231 Add a parentResource to Resource 2014-11-20 16:40:14 +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
7fce72b7d1 Implement the wl_region interface
Compositor::createRegion added which returns a Region. Also server
side part is implemented.
2014-10-16 14:54:17 +02:00