~emersion/grim#100: 
Grim captures incorrect area in a multi monitor setup

Hello,

I use a 4 monitor setup

Left: 3840x2160 at 0x0, scale 1.33, transform 1 Top: 5120x1440 at 1619x0, scale 1, transform 2 Bottom: 5120x1440 at 1619x1440, scale 1, transform 0 Right: 3840x2160 at 6739x0, scale 1.33, transform 3

This result in a near perfect rectangle (1619 x 1.3333 = ~2160), (5120 + 1619 = 6739)

If I run grim with no arguments, I get this )Note: Had to scale image down by 50% for imgur upload limit.)

The top and bottom monitor seem correct, however, the left monitor is shifted to the left, and the right monitor is shifted upwards. I think potentially there is an issue to do with transform or scaling that is causing it.

I also tried capturing an area using grim -g and slurp. Slurp seems to produce the correct coordinates (eg 0, 0 for the top left) however, when I run grim -g "0, 0 100x100" the captured image is off to the right in the same way that the full capture is.

Hopefully this is enough information, thanks for taking the time to look at this :)

Status
REPORTED
Submitter
~azelphur
Assigned to
No-one
Submitted
3 months ago
Updated
2 months ago
Labels
No labels applied.

~big_gnome 2 months ago*

I am encountering the same issue. I tried debugging the issue, assuming the 0,0 coordinate on a second monitor could have been shifted at some point when running the grim (either while taking the screenshot or while rendering occurs). I tried playing with some parameters in render.c and output_layout.c in order to tweak image sizes and positions (e.g. setting y coordinate to negative value) but with no success.

Also, I have confirmed, that the issue indeed occurs only when the monitor have both scaling and transform applied. When monitor is only scaled/transformed -- problem doesn't occur. Having multi-monitor setup is also irrelevant, I have reproduced the issue on one monitor as well.

AFAIK, only screenshooting tool for wayland compositors implementing needed protocols are grim and wayshot, so I tried it out. Interestingly, it seems to have the same issue, though I suspect they have adopted parts of grim's algorithm on rust, including something, that is causing this issue.