diff options
author | Pekka Paalanen <pekka.paalanen@collabora.co.uk> | 2017-03-27 15:14:32 +0300 |
---|---|---|
committer | Pekka Paalanen <pekka.paalanen@collabora.co.uk> | 2017-07-25 16:08:48 +0300 |
commit | 9ffb25009cbf2996f53b4ceb39cb9a7af1508ebf (patch) | |
tree | ee1e06386af507ad0008ed91524639a0059e6da7 /desktop-shell | |
parent | 0079a949e09816a7ae1ea0de69196c2a0e0875e7 (diff) |
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>
Diffstat (limited to 'desktop-shell')
-rw-r--r-- | desktop-shell/input-panel.c | 2 | ||||
-rw-r--r-- | desktop-shell/shell.c | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/desktop-shell/input-panel.c b/desktop-shell/input-panel.c index 40a4092e..e6b1541a 100644 --- a/desktop-shell/input-panel.c +++ b/desktop-shell/input-panel.c @@ -274,7 +274,7 @@ input_panel_surface_set_toplevel(struct wl_client *client, wl_list_insert(&shell->input_panel.surfaces, &input_panel_surface->link); - input_panel_surface->output = wl_resource_get_user_data(output_resource); + input_panel_surface->output = weston_output_from_resource(output_resource); input_panel_surface->panel = 0; } diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index f1577c12..832a7b74 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -2941,7 +2941,7 @@ desktop_shell_set_background(struct wl_client *client, surface->committed = background_committed; surface->committed_private = shell; weston_surface_set_label_func(surface, background_get_label); - surface->output = wl_resource_get_user_data(output_resource); + surface->output = weston_output_from_resource(output_resource); view->output = surface->output; weston_desktop_shell_send_configure(resource, 0, surface_resource, @@ -3026,7 +3026,7 @@ desktop_shell_set_panel(struct wl_client *client, surface->committed = panel_committed; surface->committed_private = shell; weston_surface_set_label_func(surface, panel_get_label); - surface->output = wl_resource_get_user_data(output_resource); + surface->output = weston_output_from_resource(output_resource); view->output = surface->output; weston_desktop_shell_send_configure(resource, 0, surface_resource, |