From 0bbda3ad87257f0c64a21253a1f6f585b342b018 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Wed, 25 Oct 2017 15:44:10 +0200 Subject: [PATCH] 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 --- src/backends/native/meta-output-kms.c | 13 +++++++++++-- src/backends/x11/meta-output-xrandr.c | 14 ++++++++++++-- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/backends/native/meta-output-kms.c b/src/backends/native/meta-output-kms.c index b373b7298..1b633b155 100644 --- a/src/backends/native/meta-output-kms.c +++ b/src/backends/native/meta-output-kms.c @@ -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? */ diff --git a/src/backends/x11/meta-output-xrandr.c b/src/backends/x11/meta-output-xrandr.c index 4fed6e5d9..1f44cb168 100644 --- a/src/backends/x11/meta-output-xrandr.c +++ b/src/backends/x11/meta-output-xrandr.c @@ -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);