[PATCH weston v5 03/36] libweston: use head in wl_output global
Pekka Paalanen
ppaalanen at gmail.com
Thu Dec 14 11:40:40 UTC 2017
From: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
As a wl_output represents weston_head, use a weston_head pointer as the
wl_output global's user data.
Signed-off-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
---
libweston/compositor.c | 11 +++++++----
libweston/compositor.h | 2 ++
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/libweston/compositor.c b/libweston/compositor.c
index 9f1c6d83..5be9e91e 100644
--- a/libweston/compositor.c
+++ b/libweston/compositor.c
@@ -4315,10 +4315,10 @@ static void
bind_output(struct wl_client *client,
void *data, uint32_t version, uint32_t id)
{
- struct weston_output *output = data;
+ struct weston_head *head = data;
+ struct weston_output *output = head->output;
struct weston_mode *mode;
struct wl_resource *resource;
- struct weston_head *head = &output->head;
resource = wl_resource_create(client, &wl_output_interface,
version, id);
@@ -4328,8 +4328,10 @@ bind_output(struct wl_client *client,
}
wl_list_insert(&head->resource_list, wl_resource_get_link(resource));
- wl_resource_set_implementation(resource, &output_interface, data, unbind_resource);
+ wl_resource_set_implementation(resource, &output_interface, output,
+ unbind_resource);
+ assert(output);
wl_output_send_geometry(resource,
output->x,
output->y,
@@ -4634,9 +4636,10 @@ weston_compositor_add_output(struct weston_compositor *compositor,
output->enabled = true;
head = &output->head;
+ head->output = output;
head->global = wl_global_create(compositor->wl_display,
&wl_output_interface, 3,
- output, bind_output);
+ head, bind_output);
wl_signal_emit(&compositor->output_created_signal, output);
diff --git a/libweston/compositor.h b/libweston/compositor.h
index 76b966ee..cc74bfc9 100644
--- a/libweston/compositor.h
+++ b/libweston/compositor.h
@@ -153,6 +153,8 @@ enum dpms_enum {
* (windowed nested backends).
*/
struct weston_head {
+ struct weston_output *output; /**< the output driving this head */
+
struct wl_list resource_list; /**< wl_output protocol objects */
struct wl_global *global; /**< wl_output global */
--
2.13.6
More information about the wayland-devel
mailing list