[PATCH weston v3 04/36] libweston: use head in wl_output global
Pekka Paalanen
ppaalanen at gmail.com
Tue Oct 31 11:48:14 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 | 10 ++++++----
libweston/compositor.h | 2 ++
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/libweston/compositor.c b/libweston/compositor.c
index 00b2dd3f..f1b2bfb5 100644
--- a/libweston/compositor.c
+++ b/libweston/compositor.c
@@ -4316,10 +4316,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);
@@ -4329,7 +4329,8 @@ 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);
wl_output_send_geometry(resource,
output->x,
@@ -4635,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 19971132..5a6bc632 100644
--- a/libweston/compositor.h
+++ b/libweston/compositor.h
@@ -152,6 +152,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