From 1fc79358584bd847c94f516a0203bef8f2098d0e Mon Sep 17 00:00:00 2001 From: Robert Mader Date: Mon, 8 Apr 2019 18:12:23 +0200 Subject: [PATCH] backends/cursor: Add API to set and get the texture buffer transform In Wayland clients can commit transformed surfaces, so the compositor can directly use them on hardware planes. We already support that for other surfaces, this is the first step to also support it on cursor sprites. https://gitlab.gnome.org/GNOME/mutter/merge_requests/526 --- src/backends/meta-cursor.c | 21 +++++++++++++++++++++ src/backends/meta-cursor.h | 6 ++++++ 2 files changed, 27 insertions(+) diff --git a/src/backends/meta-cursor.c b/src/backends/meta-cursor.c index 8fd6a9cb1..d4087a67f 100644 --- a/src/backends/meta-cursor.c +++ b/src/backends/meta-cursor.c @@ -43,6 +43,7 @@ typedef struct _MetaCursorSpritePrivate CoglTexture2D *texture; float texture_scale; + MetaMonitorTransform texture_transform; int hot_x, hot_y; } MetaCursorSpritePrivate; @@ -110,6 +111,16 @@ meta_cursor_sprite_set_texture_scale (MetaCursorSprite *sprite, priv->texture_scale = scale; } +void +meta_cursor_sprite_set_texture_transform (MetaCursorSprite *sprite, + MetaMonitorTransform transform) +{ + MetaCursorSpritePrivate *priv = + meta_cursor_sprite_get_instance_private (sprite); + + priv->texture_transform = transform; +} + CoglTexture * meta_cursor_sprite_get_cogl_texture (MetaCursorSprite *sprite) { @@ -140,6 +151,15 @@ meta_cursor_sprite_get_texture_scale (MetaCursorSprite *sprite) return priv->texture_scale; } +MetaMonitorTransform +meta_cursor_sprite_get_texture_transform (MetaCursorSprite *sprite) +{ + MetaCursorSpritePrivate *priv = + meta_cursor_sprite_get_instance_private (sprite); + + return priv->texture_transform; +} + void meta_cursor_sprite_prepare_at (MetaCursorSprite *sprite, int x, @@ -164,6 +184,7 @@ meta_cursor_sprite_init (MetaCursorSprite *sprite) meta_cursor_sprite_get_instance_private (sprite); priv->texture_scale = 1.0f; + priv->texture_transform = META_MONITOR_TRANSFORM_NORMAL; } static void diff --git a/src/backends/meta-cursor.h b/src/backends/meta-cursor.h index ebcb8f6d4..5cac34e46 100644 --- a/src/backends/meta-cursor.h +++ b/src/backends/meta-cursor.h @@ -22,6 +22,7 @@ #ifndef META_CURSOR_H #define META_CURSOR_H +#include "backends/meta-backend-types.h" #include "meta/common.h" #include "meta/boxes.h" @@ -57,6 +58,9 @@ void meta_cursor_sprite_set_texture (MetaCursorSprite *sprite, void meta_cursor_sprite_set_texture_scale (MetaCursorSprite *sprite, float scale); +void meta_cursor_sprite_set_texture_transform (MetaCursorSprite *sprite, + MetaMonitorTransform transform); + CoglTexture *meta_cursor_sprite_get_cogl_texture (MetaCursorSprite *sprite); void meta_cursor_sprite_get_hotspot (MetaCursorSprite *sprite, @@ -65,6 +69,8 @@ void meta_cursor_sprite_get_hotspot (MetaCursorSprite *sprite, float meta_cursor_sprite_get_texture_scale (MetaCursorSprite *sprite); +MetaMonitorTransform meta_cursor_sprite_get_texture_transform (MetaCursorSprite *sprite); + gboolean meta_cursor_sprite_is_animated (MetaCursorSprite *sprite); void meta_cursor_sprite_tick_frame (MetaCursorSprite *sprite);