Skip to content

randr: Correctly get physical size for screen with RandR 1.5

JiangWu requested to merge wujiangGitHub/xserver:master into master

According to the existing calculation method, multiple monitors are spliced into a virtual monitor, and there are some problems in the calculation of the virtual physical size. The existing way to calculate the virtual physical size: the resolution of the last monitor is divided by the resolution of the first monitor, and then multiplied by the physical size of the first monitor.

For example, two monitors are spliced into a virtual monitor, namely VGA-0(1920/477x1080/268+0+0)), DVI-0(1680/477x1050/268+1920+0). Because the resolution of DVI-0 is smaller than that of VGA-0, the virtual physical size will be 0 (1680/1920477=0, 1050/1080268=0).

The virtual physical size should be the virtual display resolution divided by the first display resolution multiplied by the first display physical size. For example mmWidth=double(3600/1920)*477, mmHeight= double(1080/1080)*268.

Signed-off-by: Jiang Wu wujiang@kylinos.cn

Edited by JiangWu

Merge request reports