Commit 63783a5
committed
Fix X11 multi-monitor capture on HiDPI (screen cut/shift, inflated canvas)
x11LegacyScreenshot() multiplied the united logical geometry by a single
devicePixelRatio and drew each screen at its logical top-left. When the
ratio is not 1 and the monitors have different sizes, the composite is wrong.
On the xcb backend the virtual-desktop layout uses native (device) pixel
offsets, while each screen reports a logical size (its device size divided by
its ratio). Multiplying the whole union by one ratio double-counts the
offsets: a 7680x3996 desktop is captured as 10560x5373, and the region the
GUI overlay selects is cut or shifted onto the wrong monitor.
grabWindow(0) already returns the device-pixel pixmap of each screen, and
geometry().topLeft() is the native offset on xcb. So draw each pixmap at its
native offset using its own physical size, and never scale. The canvas is the
union of those device-pixel rectangles.
Tested on X11/awesome, nvidia driver, Xft.dpi 168 (ratio 1.75), three
monitors of two sizes (3264x1836 and two 3840x2160 in an L shape). Capture is
now pixel-aligned to the framebuffer (per-monitor RMSE < 0.02), against
10560x5373 before.1 parent b2b60c5 commit 63783a5
1 file changed
Lines changed: 27 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
870 | 870 | | |
871 | 871 | | |
872 | 872 | | |
873 | | - | |
874 | | - | |
875 | | - | |
876 | | - | |
877 | | - | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
878 | 891 | | |
879 | | - | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
880 | 897 | | |
881 | 898 | | |
882 | | - | |
883 | | - | |
884 | | - | |
885 | | - | |
| 899 | + | |
| 900 | + | |
886 | 901 | | |
887 | 902 | | |
888 | 903 | | |
889 | | - | |
890 | | - | |
891 | | - | |
892 | | - | |
| 904 | + | |
| 905 | + | |
893 | 906 | | |
894 | 907 | | |
895 | 908 | | |
| |||
0 commit comments