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>
dev
Philipp Zabel 6 years ago committed by Daniel Stone
parent fff2797c88
commit c18ffd3939
  1. 35
      libweston/compositor.c
  2. 7
      libweston/compositor.h

@ -4939,6 +4939,25 @@ weston_head_set_monitor_strings(struct weston_head *head,
weston_head_set_device_changed(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 /** Store physical image size
* *
* \param head The head to modify. * \param head The head to modify.
@ -5103,6 +5122,22 @@ weston_head_is_device_changed(struct weston_head *head)
return head->device_changed; 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 /** Acknowledge device information change
* *
* \param head The head to acknowledge. * \param head The head to acknowledge.

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

Loading…
Cancel
Save