summaryrefslogtreecommitdiffstats
path: root/src/compositor/wayland_wrapper
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
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')
-rw-r--r--src/compositor/wayland_wrapper/wldatadevicemanager.cpp2
-rw-r--r--src/compositor/wayland_wrapper/wlextendedsurface.cpp2
-rw-r--r--src/compositor/wayland_wrapper/wlinputdevice.cpp6
-rw-r--r--src/compositor/wayland_wrapper/wlshellsurface.cpp2
-rw-r--r--src/compositor/wayland_wrapper/wlsubsurface.cpp2
-rw-r--r--src/compositor/wayland_wrapper/wlsurface.cpp9
6 files changed, 12 insertions, 11 deletions
diff --git a/src/compositor/wayland_wrapper/wldatadevicemanager.cpp b/src/compositor/wayland_wrapper/wldatadevicemanager.cpp
index b8c417193..04214ef8b 100644
--- a/src/compositor/wayland_wrapper/wldatadevicemanager.cpp
+++ b/src/compositor/wayland_wrapper/wldatadevicemanager.cpp
@@ -204,7 +204,7 @@ void DataDeviceManager::get_data_device(struct wl_client *client,
struct wl_resource *input_device_resource)
{
DataDeviceManager *data_device_manager = static_cast<DataDeviceManager *>(data_device_manager_resource->data);
- InputDevice *input_device = reinterpret_cast<InputDevice *>(input_device_resource->data);
+ InputDevice *input_device = resolve<InputDevice>(input_device_resource);
input_device->clientRequestedDataDevice(data_device_manager,client,id);
}
diff --git a/src/compositor/wayland_wrapper/wlextendedsurface.cpp b/src/compositor/wayland_wrapper/wlextendedsurface.cpp
index fe4e487ad..948990484 100644
--- a/src/compositor/wayland_wrapper/wlextendedsurface.cpp
+++ b/src/compositor/wayland_wrapper/wlextendedsurface.cpp
@@ -71,7 +71,7 @@ void SurfaceExtensionGlobal::get_extended_surface(struct wl_client *client,
struct wl_resource *surface_resource)
{
Q_UNUSED(surface_extension_resource);
- Surface *surface = reinterpret_cast<Surface *>(surface_resource);
+ Surface *surface = resolve<Surface>(surface_resource);
new ExtendedSurface(client,id,surface);
}
diff --git a/src/compositor/wayland_wrapper/wlinputdevice.cpp b/src/compositor/wayland_wrapper/wlinputdevice.cpp
index edf55d7fb..72b735a2f 100644
--- a/src/compositor/wayland_wrapper/wlinputdevice.cpp
+++ b/src/compositor/wayland_wrapper/wlinputdevice.cpp
@@ -207,7 +207,7 @@ void InputDevice::sendFullTouchEvent(QTouchEvent *event)
Surface *InputDevice::keyboardFocus() const
{
- return wayland_cast<Surface *>(base()->keyboard_focus);
+ return wayland_cast<Surface>(base()->keyboard_focus);
}
void InputDevice::setKeyboardFocus(Surface *surface)
@@ -218,7 +218,7 @@ void InputDevice::setKeyboardFocus(Surface *surface)
Surface *InputDevice::mouseFocus() const
{
- return wayland_cast<Surface *>(base()->pointer_focus);
+ return wayland_cast<Surface>(base()->pointer_focus);
}
void InputDevice::setMouseFocus(Surface *surface, const QPoint &globalPos, const QPoint &localPos)
@@ -320,7 +320,7 @@ void InputDevice::input_device_attach(struct wl_client *client,
struct wl_input_device *device_base = reinterpret_cast<struct wl_input_device *>(device_resource->data);
struct wl_buffer *buffer = reinterpret_cast<struct wl_buffer *>(buffer_resource);
- InputDevice *inputDevice = wayland_cast<InputDevice *>(device_base);
+ InputDevice *inputDevice = wayland_cast<InputDevice>(device_base);
if (wl_buffer_is_shm(buffer)) {
ShmBuffer *shmBuffer = static_cast<ShmBuffer *>(buffer->user_data);
if (shmBuffer) {
diff --git a/src/compositor/wayland_wrapper/wlshellsurface.cpp b/src/compositor/wayland_wrapper/wlshellsurface.cpp
index 365989934..39c60a2ee 100644
--- a/src/compositor/wayland_wrapper/wlshellsurface.cpp
+++ b/src/compositor/wayland_wrapper/wlshellsurface.cpp
@@ -66,7 +66,7 @@ void Shell::get_shell_surface(struct wl_client *client,
struct wl_resource *surface_super)
{
Q_UNUSED(shell_resource);
- Surface *surface = reinterpret_cast<Surface *>(surface_super);
+ Surface *surface = resolve<Surface>(surface_super);
new ShellSurface(client,id,surface);
}
diff --git a/src/compositor/wayland_wrapper/wlsubsurface.cpp b/src/compositor/wayland_wrapper/wlsubsurface.cpp
index ed3c0a9b0..564045896 100644
--- a/src/compositor/wayland_wrapper/wlsubsurface.cpp
+++ b/src/compositor/wayland_wrapper/wlsubsurface.cpp
@@ -62,7 +62,7 @@ void SubSurfaceExtensionGlobal::bind_func(wl_client *client, void *data, uint32_
void SubSurfaceExtensionGlobal::get_sub_surface_aware_surface(wl_client *client, wl_resource *sub_surface_extension_resource, uint32_t id, wl_resource *surface_resource)
{
Q_UNUSED(sub_surface_extension_resource);
- Surface *surface = reinterpret_cast<Surface *>(surface_resource);
+ Surface *surface = resolve<Surface>(surface_resource);
new SubSurface(client,id,surface);
}
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);
}