libweston: introduce weston_output_from_resource()
This is a simple wrapper for casting the user data of a wl_resource into
a struct weston_output pointer. Using the wrapper clearly marks all the
places where a wl_output protocol object is used.
Replace ALL wl_output related calls to wl_resource_get_user_data() with
a call to weston_output_from_resource().
v2: add type assert in weston_output_from_resource().
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Armin Krezović <krezovic.armin@gmail.com>
diff --git a/tests/weston-test.c b/tests/weston-test.c
index 0123e99..189fcc1 100644
--- a/tests/weston-test.c
+++ b/tests/weston-test.c
@@ -473,7 +473,7 @@
struct wl_resource *buffer_resource)
{
struct weston_output *output =
- wl_resource_get_user_data(output_resource);
+ weston_output_from_resource(output_resource);
struct weston_buffer *buffer =
weston_buffer_from_resource(buffer_resource);