From: Pekka Paalanen <pekka.paala...@collabora.co.uk>

Enabled is orthogonal from connected. A connected head could be
disabled, or a disconnected head could in the future be enabled.

Compositors quite likely want to check if a head is already enabled
before starting to take it into use.

Signed-off-by: Pekka Paalanen <pekka.paala...@collabora.co.uk>
Reviewed-by: Derek Foreman <der...@osg.samsung.com>
---
 libweston/compositor.c | 21 +++++++++++++++++++++
 libweston/compositor.h |  3 +++
 2 files changed, 24 insertions(+)

diff --git a/libweston/compositor.c b/libweston/compositor.c
index ee7e29c8..d1cfc109 100644
--- a/libweston/compositor.c
+++ b/libweston/compositor.c
@@ -4640,6 +4640,27 @@ weston_head_is_connected(struct weston_head *head)
        return head->connected;
 }
 
+/** Is the head currently enabled?
+ *
+ * \param head The head to query.
+ * \return Video status.
+ *
+ * Returns true if the head is currently transmitting a video stream.
+ *
+ * This is independent of the head being connected.
+ *
+ * \sa weston_head_is_connected
+ * \memberof weston_head
+ */
+WL_EXPORT bool
+weston_head_is_enabled(struct weston_head *head)
+{
+       if (!head->output)
+               return false;
+
+       return head->output->enabled;
+}
+
 /* Move other outputs when one is resized so the space remains contiguous. */
 static void
 weston_compositor_reflow_outputs(struct weston_compositor *compositor,
diff --git a/libweston/compositor.h b/libweston/compositor.h
index 1612fe95..bad73599 100644
--- a/libweston/compositor.h
+++ b/libweston/compositor.h
@@ -1974,6 +1974,9 @@ weston_head_set_internal(struct weston_head *head);
 bool
 weston_head_is_connected(struct weston_head *head);
 
+bool
+weston_head_is_enabled(struct weston_head *head);
+
 void
 weston_output_set_scale(struct weston_output *output,
                        int32_t scale);
-- 
2.13.6

_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to