libweston: add weston_head_is_enabled()
authorPekka Paalanen <pekka.paalanen@collabora.co.uk>
Thu, 15 Feb 2018 13:18:20 +0000 (15:18 +0200)
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>
Thu, 12 Apr 2018 11:26:17 +0000 (14:26 +0300)
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.paalanen@collabora.co.uk>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
libweston/compositor.c
libweston/compositor.h

index fd14391..af32c8b 100644 (file)
@@ -4649,6 +4649,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,
index 8ce9a07..a5d07be 100644 (file)
@@ -1980,6 +1980,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);