1
0
Fork 0

backends/native: Set hotspot property on updates

Add a `has_update` flag to the cursor hotspot struct
to allow selective update of the hotsport property
only when it will take an effect.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3337>
This commit is contained in:
Albert Esteve 2024-01-08 15:40:52 +01:00
parent 4b9d1271a0
commit 3885d2b3f6
3 changed files with 33 additions and 0 deletions

View file

@ -612,6 +612,37 @@ process_plane_assignment (MetaKmsImplDevice *impl_device,
}
}
}
if (plane_assignment->cursor_hotspot.has_update)
{
struct {
MetaKmsPlaneProp prop;
uint64_t value;
} props[] = {
{
.prop = META_KMS_PLANE_PROP_HOTSPOT_X,
.value = plane_assignment->cursor_hotspot.is_valid ?
plane_assignment->cursor_hotspot.x :
0,
},
{
.prop = META_KMS_PLANE_PROP_HOTSPOT_Y,
.value = plane_assignment->cursor_hotspot.is_valid ?
plane_assignment->cursor_hotspot.y :
0,
},
};
for (i = 0; i < G_N_ELEMENTS (props); i++)
{
if (!add_plane_property (impl_device,
plane, req,
props[i].prop,
props[i].value,
error))
return FALSE;
}
}
}
else
{

View file

@ -66,6 +66,7 @@ typedef struct _MetaKmsPlaneAssignment
MetaKmsPlaneRotation rotation;
struct {
gboolean has_update;
gboolean is_valid;
int x;
int y;

View file

@ -607,6 +607,7 @@ meta_kms_plane_assignment_set_cursor_hotspot (MetaKmsPlaneAssignment *plane_assi
int x,
int y)
{
plane_assignment->cursor_hotspot.has_update = TRUE;
plane_assignment->cursor_hotspot.is_valid = TRUE;
plane_assignment->cursor_hotspot.x = x;
plane_assignment->cursor_hotspot.y = y;