diff options
-rw-r--r-- | compositor/cms-colord.c | 17 | ||||
-rw-r--r-- | libweston/compositor.c | 18 | ||||
-rw-r--r-- | libweston/compositor.h | 3 |
3 files changed, 36 insertions, 2 deletions
diff --git a/compositor/cms-colord.c b/compositor/cms-colord.c index f421773b..b68e4921 100644 --- a/compositor/cms-colord.c +++ b/compositor/cms-colord.c @@ -102,10 +102,20 @@ edid_value_valid(const char *str) static gchar * get_output_id(struct cms_colord *cms, struct weston_output *o) { - struct weston_head *head = &o->head; + struct weston_head *head; const gchar *tmp; GString *device_id; + /* XXX: What to do with multiple heads? + * This is potentially unstable, if head configuration is changed + * while the output is enabled. */ + head = weston_output_get_first_head(o); + + if (wl_list_length(&o->head_list) > 1) { + weston_log("colord: WARNING: multiple heads are not supported (output %s).\n", + o->name); + } + /* see https://github.com/hughsie/colord/blob/master/doc/device-and-profile-naming-spec.txt * for format and allowed values */ device_id = g_string_new("xrandr"); @@ -231,7 +241,7 @@ colord_notifier_output_destroy(struct wl_listener *listener, void *data) static void colord_output_created(struct cms_colord *cms, struct weston_output *o) { - struct weston_head *head = &o->head; + struct weston_head *head; CdDevice *device; const gchar *tmp; gchar *device_id; @@ -239,6 +249,9 @@ colord_output_created(struct cms_colord *cms, struct weston_output *o) GHashTable *device_props; struct cms_output *ocms; + /* XXX: What to do with multiple heads? */ + head = weston_output_get_first_head(o); + /* create device */ device_id = get_output_id(cms, o); weston_log("colord: output added %s\n", device_id); diff --git a/libweston/compositor.c b/libweston/compositor.c index c3a94d35..f5695f87 100644 --- a/libweston/compositor.c +++ b/libweston/compositor.c @@ -5249,6 +5249,24 @@ weston_output_release(struct weston_output *output) free(output->name); } +/** When you need a head... + * + * This function is a hack, used until all code has been converted to become + * multi-head aware. + * + * \param output The weston_output whose head to get. + * \return The first head in the output's list. + */ +WL_EXPORT struct weston_head * +weston_output_get_first_head(struct weston_output *output) +{ + if (wl_list_empty(&output->head_list)) + return NULL; + + return container_of(output->head_list.next, + struct weston_head, output_link); +} + static void destroy_viewport(struct wl_resource *resource) { diff --git a/libweston/compositor.h b/libweston/compositor.h index 604792a5..d606fc9b 100644 --- a/libweston/compositor.h +++ b/libweston/compositor.h @@ -2000,6 +2000,9 @@ weston_pending_output_coldplug(struct weston_compositor *compositor); struct weston_head * weston_head_from_resource(struct wl_resource *resource); +struct weston_head * +weston_output_get_first_head(struct weston_output *output); + #ifdef __cplusplus } #endif |