libweston: add weston_head_is_enabled()

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>
This commit is contained in:
Pekka Paalanen
2018-02-15 15:18:20 +02:00
parent 7fe858be81
commit 8e552fd3bf
2 changed files with 24 additions and 0 deletions
+21
View File
@@ -4649,6 +4649,27 @@ weston_head_is_connected(struct weston_head *head)
return head->connected; 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. */ /* Move other outputs when one is resized so the space remains contiguous. */
static void static void
weston_compositor_reflow_outputs(struct weston_compositor *compositor, weston_compositor_reflow_outputs(struct weston_compositor *compositor,
+3
View File
@@ -1980,6 +1980,9 @@ weston_head_set_internal(struct weston_head *head);
bool bool
weston_head_is_connected(struct weston_head *head); weston_head_is_connected(struct weston_head *head);
bool
weston_head_is_enabled(struct weston_head *head);
void void
weston_output_set_scale(struct weston_output *output, weston_output_set_scale(struct weston_output *output,
int32_t scale); int32_t scale);