<AWT Dev>  Review Request: 8225118 Robot.createScreenCapture() returns black image on HiDPI linux with gtk3
anton.tarasov at jetbrains.com
Fri May 31 16:11:46 UTC 2019
Please review the fix for JDK 13:
The problem with Robot.createScreenCapture() on gtk3 is in the following
function call (quoting from gtk3_interface.h):
fp_gdk_pixbuf_get_from_drawable = dl_symbol("gdk_pixbuf_get_from_window")
which, as you can see, is resolved to another function in gtk3 (unlike
gtk2) due to its deprecation.
The spec  states that the passed size is scaled:
"the width and height arguments scaled by the scale factor of window"
however this fact is not taken into account and so the returned pixbuf has
wrong size and is then ignored.
To meet the spec, I retrieve the root window scale and downscale the size,
ceiling the result. Also, I weaken the condition where the pixbuf size is
compared to the passed size, from "==" to ">=". My reasoning is this:
1) The original passed size (of the screen) may appear to be lossy due to
2) The weakened condition is enough for the valid pixbuf copying.
The test (which I've modified to allow its run on Linux) reproduces the
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the awt-dev