diff options
author | Samuel Rødal <samuel.rodal@digia.com> | 2013-04-18 16:37:19 +0200 |
---|---|---|
committer | Samuel Rødal <samuel.rodal@digia.com> | 2013-04-23 14:18:36 +0200 |
commit | 755fac09a8656545c272528e531ba4732154ae3c (patch) | |
tree | 735744938d7149b9c1d799bfcd7d0ca03759d8a6 /src/compositor/wayland_wrapper/qwlregion.cpp | |
parent | c2d41eee09a1c88641c6f866528c661728a0bf2f (diff) |
Adapted Surface and Region to use the qtwaylandscanner.
This requires some slight additions to the qtwaylandscanner to handle
the pattern of the wl_resource not being owned by the generated class.
Change-Id: Ia49c8129cee3a203ca9a727e83fafd3dfc653e75
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Diffstat (limited to 'src/compositor/wayland_wrapper/qwlregion.cpp')
-rw-r--r-- | src/compositor/wayland_wrapper/qwlregion.cpp | 37 |
1 files changed, 15 insertions, 22 deletions
diff --git a/src/compositor/wayland_wrapper/qwlregion.cpp b/src/compositor/wayland_wrapper/qwlregion.cpp index c9e452528..69f382404 100644 --- a/src/compositor/wayland_wrapper/qwlregion.cpp +++ b/src/compositor/wayland_wrapper/qwlregion.cpp @@ -46,45 +46,38 @@ QT_BEGIN_NAMESPACE namespace QtWayland { -void destroy_region(struct wl_resource *resource) +Region::Region(struct wl_client *client, uint32_t id) + : QtWaylandServer::wl_region(client, id) { - delete resolve<Region>(resource); } -Region::Region(struct wl_client *client, uint32_t id) +Region::~Region() { - addClientResource(client, base(), id, &wl_region_interface, - ®ion_interface, destroy_region); } -Region::~Region() +Region *Region::fromResource(struct ::wl_resource *resource) { + return static_cast<Region *>(Resource::fromResource(resource)->region); } -const struct wl_region_interface Region::region_interface = { - region_destroy, - region_add, - region_subtract -}; +void Region::region_destroy_resource(Resource *) +{ + delete this; +} -void Region::region_destroy(wl_client *client, wl_resource *region) +void Region::region_destroy(Resource *resource) { - Q_UNUSED(client); - wl_resource_destroy(region); + wl_resource_destroy(resource->handle); } -void Region::region_add(wl_client *client, wl_resource *region, - int32_t x, int32_t y, int32_t w, int32_t h) +void Region::region_add(Resource *, int32_t x, int32_t y, int32_t w, int32_t h) { - Q_UNUSED(client); - resolve<Region>(region)->m_region += QRect(x, y, w, h); + m_region += QRect(x, y, w, h); } -void Region::region_subtract(wl_client *client, wl_resource *region, - int32_t x, int32_t y, int32_t w, int32_t h) +void Region::region_subtract(Resource *, int32_t x, int32_t y, int32_t w, int32_t h) { - Q_UNUSED(client); - resolve<Region>(region)->m_region -= QRect(x, y, w, h); + m_region -= QRect(x, y, w, h); } } |