libweston: add weston_head_{is,set}_non_desktop()

Add non-desktop property for weston_heads representing displays that the
desktop should not be extended to by default, e.g. head mounted displays.

Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
This commit is contained in:
Philipp Zabel 2018-08-30 17:38:03 +02:00 committed by Daniel Stone
parent fff2797c88
commit c18ffd3939
2 changed files with 42 additions and 0 deletions

View File

@ -4939,6 +4939,25 @@ weston_head_set_monitor_strings(struct weston_head *head,
weston_head_set_device_changed(head);
}
/** Store display non-desktop status
*
* \param head The head to modify.
* \param non_desktop Whether the head connects to a non-desktop display.
*
* \memberof weston_head
* \internal
*/
WL_EXPORT void
weston_head_set_non_desktop(struct weston_head *head, bool non_desktop)
{
if (head->non_desktop == non_desktop)
return;
head->non_desktop = non_desktop;
weston_head_set_device_changed(head);
}
/** Store physical image size
*
* \param head The head to modify.
@ -5103,6 +5122,22 @@ weston_head_is_device_changed(struct weston_head *head)
return head->device_changed;
}
/** Does the head represent a non-desktop display?
*
* \param head The head to query.
* \return True if the device is a non-desktop display.
*
* Non-desktop heads are not attached to outputs by default.
* This stops weston from extending the desktop onto head mounted displays.
*
* \memberof weston_head
*/
WL_EXPORT bool
weston_head_is_non_desktop(struct weston_head *head)
{
return head->non_desktop;
}
/** Acknowledge device information change
*
* \param head The head to acknowledge.

View File

@ -196,6 +196,7 @@ struct weston_head {
char *name; /**< head name, e.g. connector name */
bool connected; /**< is physically connected */
bool non_desktop; /**< non-desktop display, e.g. HMD */
};
struct weston_output {
@ -2222,6 +2223,9 @@ weston_head_set_monitor_strings(struct weston_head *head,
const char *model,
const char *serialno);
void
weston_head_set_non_desktop(struct weston_head *head, bool non_desktop);
void
weston_head_set_physical_size(struct weston_head *head,
int32_t mm_width, int32_t mm_height);
@ -2245,6 +2249,9 @@ weston_head_is_enabled(struct weston_head *head);
bool
weston_head_is_device_changed(struct weston_head *head);
bool
weston_head_is_non_desktop(struct weston_head *head);
void
weston_head_reset_device_changed(struct weston_head *head);