monitor-manager: Take panel-orientation into account for physical size

Just like we swap the x and y resolution of the monitor modes when
the panel-orientation requires 90 or 270 degree rotation to compensate,
we should do the same for the width and height in mm of the monitor.

https://bugzilla.gnome.org/show_bug.cgi?id=782294
This commit is contained in:
Hans de Goede 2017-10-25 15:44:10 +02:00 committed by Jonas Ådahl
parent dd43d04d42
commit 0bbda3ad87
2 changed files with 23 additions and 4 deletions

View File

@ -489,8 +489,6 @@ meta_create_kms_output (MetaGpuKms *gpu_kms,
output->gpu = gpu;
output->winsys_id = connector->connector_id;
output->name = make_output_name (connector);
output->width_mm = connector->mmWidth;
output->height_mm = connector->mmHeight;
switch (connector->subpixel)
{
@ -518,6 +516,17 @@ meta_create_kms_output (MetaGpuKms *gpu_kms,
output_kms->connector = connector;
find_connector_properties (gpu_kms, output);
if (meta_monitor_transform_is_rotated (output->panel_orientation_transform))
{
output->width_mm = connector->mmHeight;
output->height_mm = connector->mmWidth;
}
else
{
output->width_mm = connector->mmWidth;
output->height_mm = connector->mmHeight;
}
init_output_modes (output, gpu_kms);
/* FIXME: MSC feature bit? */

View File

@ -769,8 +769,6 @@ meta_create_xrandr_output (MetaGpuXrandr *gpu_xrandr,
meta_output_parse_edid (output, edid);
g_bytes_unref (edid);
output->width_mm = xrandr_output->mm_width;
output->height_mm = xrandr_output->mm_height;
output->subpixel_order = COGL_SUBPIXEL_ORDER_UNKNOWN;
output->hotplug_mode_update = output_get_hotplug_mode_update (output);
output->suggested_x = output_get_suggested_x (output);
@ -779,6 +777,18 @@ meta_create_xrandr_output (MetaGpuXrandr *gpu_xrandr,
output->panel_orientation_transform =
output_get_panel_orientation_transform (output);
if (meta_monitor_transform_is_rotated (
output->panel_orientation_transform))
{
output->width_mm = xrandr_output->mm_height;
output->height_mm = xrandr_output->mm_width;
}
else
{
output->width_mm = xrandr_output->mm_width;
output->height_mm = xrandr_output->mm_height;
}
output_get_tile_info (output);
output_get_modes (output, xrandr_output);
output_get_crtcs (output, xrandr_output);