[PATCH xserver] xcb: Correctly get physical size for screen with RandR 1.5

wujiang wujiang at kylinos.cn
Wed May 11 03:24:39 UTC 2022


According to the existing method, two physical screens (1920x1080)
are spliced into a virtual screen, mmwdith and mmheight are the
size of the first screen, and if the resolutions of the two
physical screens are inconsistent, mmwidth and mmheight may be 0.
This should be the resolution of the virtual screen divided by
the resolution of the first screen.

Signed-off-by: wujiang <wujiang at kylinos.cn>
---
 randr/rrmonitor.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/randr/rrmonitor.c b/randr/rrmonitor.c
index e62bd484d..7b0bbfcd5 100644
--- a/randr/rrmonitor.c
+++ b/randr/rrmonitor.c
@@ -156,8 +156,8 @@ RRMonitorGetGeometry(RRMonitorPtr monitor, RRMonitorGeometryPtr geometry)
 
         /* Adjust physical sizes to account for total area */
         if (active_crtcs > 1 && first.box.x2 != first.box.x1 && first.box.y2 != first.box.y1) {
-            geometry->mmWidth = (this.box.x2 - this.box.x1) / (first.box.x2 - first.box.x1) * first.mmWidth;
-            geometry->mmHeight = (this.box.y2 - this.box.y1) / (first.box.y2 - first.box.y1) * first.mmHeight;
+            geometry->mmWidth = ((double)(geometry->box.x2 - geometry->box.x1) / (first.box.x2 - first.box.x1)) * first.mmWidth;
+            geometry->mmHeight = ((double)(geometry->box.y2 - geometry->box.y1) / (first.box.y2 - first.box.y1)) * first.mmHeight;
         }
     } else {
         *geometry = monitor->geometry;
-- 
2.25.1



More information about the xorg-devel mailing list