Problem with multiple monitors + scale factors under X11
Steps to Reproduce (for bugs)
- Set the global Qt scale factor to 1.5 in LXQt Session Settings.
- Set up a double screen.
- Run screengrab.
Then its screenshots are ridiculous.
Screenshots are OK with either a double screen or a scale factor.
Possible Solution
I found the problem while fixing another problem. Will fix this one too when I feel motivated to do boring jobs.
System Information
Latest LXQt
It's very likely that this is about a Qt bug. Also see https://github.com/lxqt/pcmanfm-qt/issues/1145
The way screengrab does area capture is wrong. First it captures the whole thing (all screens), and then it tries to display it in your main monitor to select from (which obviously doesn't fit). Rather than just directly select from actual screen content like gimp and other screengrabbers (ie, from XFCE) do. Even if there is a qt bug, it is a poor design choice.
Screengrab avoids dealing with X11 directly and uses QSreen::grabWindow. Generally, we avoid X11 codes everywhere and use the available Qt or tier-1 KDE methods instead.
As far as I tested with pcmanfm-qt (suffering from a similar issue with multi-screen + scale factors), the screen coordinates are reported correctly. Why the first screen is painted incorrectly, I don't know yet.