The platform plugins are implemented to grab the entire screen if
no window ID is provided. They do not grab the entire virtual
screen, just the screen the method is called on.
On macOS, the implementation ignored the window parameter, and
always grabbed the entire virtual screen. This change fixes the
cocoa implementation. The test passes in local tests (with two
displays with different dpr). Since grabbing a screen returns an
image with managed colors, we need to convert it to sRGB color
spec first, otherwise displaying a grabbed image will produce
different results. This will need to be changed once Qt supports
a fully color managed flow.
The test does not cover the case where a window spans multiple
displays, since this is generally not supported at least on macOS.
The code that exists in QCocoaScreen to handle that case is
untested, but with the exception of the optimization it is also
unchanged.
Done-with: Morten Sørvig <morten.sorvig@qt.io>
Change-Id: I8ac1233e56d559230ff9e10111abfb6227431e8c
Fixes: QTBUG-84876
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>