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

View 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,

View 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);