cursor-renderer-native: Take panel-orientation into account for sprite transform

When calculating the transform we should apply to the cursor sprite
before uploading it to the cursor plane, we must also take into
account non upright mounted LCD panels.

Otherwise the cursor ends up 90 degrees rotated on devices where the
LCD panel is mounted 90 degrees rotated in its enclosure.

This commit fixes this by calling meta_monitor_logical_to_crtc_transform
in get_common_crtc_sprite_transform_for_logical_monitors to adjust the
transform for each Monitor in the LogicalMonitor.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1123

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1153
This commit is contained in:
Hans de Goede 2020-03-27 14:57:27 +01:00 committed by Jonas Ådahl
parent 6aa546145f
commit da600b8400

View File

@ -823,16 +823,23 @@ get_common_crtc_sprite_transform_for_logical_monitors (MetaCursorRenderer *ren
MetaLogicalMonitor *logical_monitor = l->data;
graphene_rect_t logical_monitor_rect =
meta_rectangle_to_graphene_rect (&logical_monitor->rect);
MetaMonitorTransform tmp_transform;
MetaMonitorTransform logical_transform, tmp_transform;
GList *monitors, *l_mon;
if (!graphene_rect_intersection (&cursor_rect,
&logical_monitor_rect,
NULL))
continue;
logical_transform = meta_logical_monitor_get_transform (logical_monitor);
monitors = meta_logical_monitor_get_monitors (logical_monitor);
for (l_mon = monitors; l_mon; l_mon = l_mon->next)
{
MetaMonitor *monitor = l_mon->data;
tmp_transform = meta_monitor_transform_relative_transform (
meta_cursor_sprite_get_texture_transform (cursor_sprite),
meta_logical_monitor_get_transform (logical_monitor));
meta_monitor_logical_to_crtc_transform (monitor, logical_transform));
if (has_visible_crtc_sprite && transform != tmp_transform)
return FALSE;
@ -840,6 +847,7 @@ get_common_crtc_sprite_transform_for_logical_monitors (MetaCursorRenderer *ren
has_visible_crtc_sprite = TRUE;
transform = tmp_transform;
}
}
if (!has_visible_crtc_sprite)
return FALSE;