diff --git a/include/libweston/libweston.h b/include/libweston/libweston.h index 1439775e..d036c5bb 100644 --- a/include/libweston/libweston.h +++ b/include/libweston/libweston.h @@ -207,6 +207,10 @@ struct weston_head { int32_t mm_width; /**< physical image width in mm */ int32_t mm_height; /**< physical image height in mm */ + + /** WL_OUTPUT_TRANSFORM enum to apply to match native orientation */ + uint32_t transform; + char *make; /**< monitor manufacturer (PNP ID) */ char *model; /**< monitor model */ char *serial_number; /**< monitor serial */ @@ -1954,6 +1958,9 @@ weston_head_get_name(struct weston_head *head); struct weston_output * weston_head_get_output(struct weston_head *head); +uint32_t +weston_head_get_transform(struct weston_head *head); + void weston_head_detach(struct weston_head *head); diff --git a/libweston/backend.h b/libweston/backend.h index ff10b363..8e91746b 100644 --- a/libweston/backend.h +++ b/libweston/backend.h @@ -138,6 +138,10 @@ weston_head_set_physical_size(struct weston_head *head, void weston_head_set_subpixel(struct weston_head *head, enum wl_output_subpixel sp); + +void +weston_head_set_transform(struct weston_head *head, uint32_t transform); + /* weston_output */ void diff --git a/libweston/compositor.c b/libweston/compositor.c index 29c0ab18..35da1e65 100644 --- a/libweston/compositor.c +++ b/libweston/compositor.c @@ -5422,6 +5422,28 @@ weston_head_set_non_desktop(struct weston_head *head, bool non_desktop) weston_head_set_device_changed(head); } +/** Store display transformation + * + * \param head The head to modify. + * \param transform The transformation to apply for this head + * + * This may set the device_changed flag. + * + * \ingroup head + * \internal + */ +WL_EXPORT void +weston_head_set_transform(struct weston_head *head, uint32_t transform) +{ + if (head->transform == transform) + return; + + head->transform = transform; + + weston_head_set_device_changed(head); +} + + /** Store physical image size * * \param head The head to modify. @@ -5683,6 +5705,24 @@ weston_head_get_output(struct weston_head *head) return head->output; } +/** Get the head's native transformation + * + * \param head The head to query. + * \return The head's native transform, as a WL_OUTPUT_TRANSFORM_* value + * + * A weston_head may have a 'native' transform provided by the backend. + * Examples include panels which are physically rotated, where the rotation + * is recorded and described as part of the system configuration. This call + * will return any known native transform for the head. + * + * \ingroup head + */ +WL_EXPORT uint32_t +weston_head_get_transform(struct weston_head *head) +{ + return head->transform; +} + /** Add destroy callback for a head * * \param head The head to watch for.