summaryrefslogtreecommitdiffstats
path: root/src/compositor/wayland_wrapper/wlsurface.cpp
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2012-03-01 18:16:23 +0100
committerLaszlo Agocs <laszlo.p.agocs@nokia.com>2012-03-02 13:41:05 +0100
commit70e1dcbff0728ab19d741a77ecd5c9261c4922fe (patch)
treeec1c6a4be7dd88aafb2c9219c398c367ddb572fd /src/compositor/wayland_wrapper/wlsurface.cpp
parent05eb5da1c80411242947a604fa41eaab7a0bd48f (diff)
Improve wayland_cast and introduce resolve to simplify code.
Resolves the wl_resource by accessing the data member. Change-Id: I10912acea0a3ca6abbc067d07d43a46ec65a77aa Reviewed-by: Laszlo Agocs <laszlo.p.agocs@nokia.com>
Diffstat (limited to 'src/compositor/wayland_wrapper/wlsurface.cpp')
-rw-r--r--src/compositor/wayland_wrapper/wlsurface.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/compositor/wayland_wrapper/wlsurface.cpp b/src/compositor/wayland_wrapper/wlsurface.cpp
index 92ee0e7c3..f4fee87ed 100644
--- a/src/compositor/wayland_wrapper/wlsurface.cpp
+++ b/src/compositor/wayland_wrapper/wlsurface.cpp
@@ -69,7 +69,7 @@ namespace Wayland {
void destroy_surface(struct wl_resource *resource)
{
- Surface *surface = wayland_cast<Surface *>((wl_surface *)resource);
+ Surface *surface = resolve<Surface>(resource);
surface->compositor()->surfaceDestroyed(surface);
delete surface;
}
@@ -417,20 +417,21 @@ void Surface::surface_attach(struct wl_client *client, struct wl_resource *surfa
Q_UNUSED(client);
Q_UNUSED(x);
Q_UNUSED(y);
- reinterpret_cast<Surface *>(surface)->attach(reinterpret_cast<struct wl_buffer *>(buffer));
+ resolve<Surface>(surface)->attach(reinterpret_cast<wl_buffer *>(buffer->data));
}
void Surface::surface_damage(struct wl_client *client, struct wl_resource *surface,
int32_t x, int32_t y, int32_t width, int32_t height)
{
Q_UNUSED(client);
- reinterpret_cast<Surface *>(surface)->damage(QRect(x, y, width, height));
+ resolve<Surface>(surface)->damage(QRect(x, y, width, height));
}
+
void Surface::surface_frame(struct wl_client *client,
struct wl_resource *resource,
uint32_t callback)
{
- Surface *surface = reinterpret_cast<Surface *>(resource);
+ Surface *surface = resolve<Surface>(resource);
struct wl_resource *frame_callback = wl_client_add_object(client,&wl_callback_interface,0,callback,surface);
wl_list_insert(&surface->m_frame_callback_list,&frame_callback->link);
}