mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-22 12:55:58 +01:00
compositor: add wlr_surface_set_preferred_buffer_transform()
References: https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/220
This commit is contained in:
parent
42edd36785
commit
dae2deb3c9
2 changed files with 28 additions and 0 deletions
|
@ -165,6 +165,8 @@ struct wlr_surface {
|
|||
bool opaque;
|
||||
|
||||
int32_t preferred_buffer_scale;
|
||||
bool preferred_buffer_transform_sent;
|
||||
enum wl_output_transform preferred_buffer_transform;
|
||||
};
|
||||
|
||||
struct wlr_renderer;
|
||||
|
@ -330,6 +332,15 @@ void wlr_surface_unlock_cached(struct wlr_surface *surface, uint32_t seq);
|
|||
void wlr_surface_set_preferred_buffer_scale(struct wlr_surface *surface,
|
||||
int32_t scale);
|
||||
|
||||
/**
|
||||
* Set the preferred buffer transform for the surface.
|
||||
*
|
||||
* This sends an event to the client indicating the preferred transform to use
|
||||
* for buffers attached to this surface.
|
||||
*/
|
||||
void wlr_surface_set_preferred_buffer_transform(struct wlr_surface *surface,
|
||||
enum wl_output_transform transform);
|
||||
|
||||
/**
|
||||
* Create the wl_compositor global, which can be used by clients to create
|
||||
* surfaces and regions.
|
||||
|
|
|
@ -1106,6 +1106,23 @@ void wlr_surface_set_preferred_buffer_scale(struct wlr_surface *surface,
|
|||
surface->preferred_buffer_scale = scale;
|
||||
}
|
||||
|
||||
void wlr_surface_set_preferred_buffer_transform(struct wlr_surface *surface,
|
||||
enum wl_output_transform transform) {
|
||||
if (wl_resource_get_version(surface->resource) <
|
||||
WL_SURFACE_PREFERRED_BUFFER_TRANSFORM_SINCE_VERSION) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (surface->preferred_buffer_transform == transform &&
|
||||
surface->preferred_buffer_transform_sent) {
|
||||
return;
|
||||
}
|
||||
|
||||
wl_surface_send_preferred_buffer_transform(surface->resource, transform);
|
||||
surface->preferred_buffer_transform_sent = true;
|
||||
surface->preferred_buffer_transform = transform;
|
||||
}
|
||||
|
||||
static const struct wl_compositor_interface compositor_impl;
|
||||
|
||||
static struct wlr_compositor *compositor_from_resource(
|
||||
|
|
Loading…
Reference in a new issue