<AWT Dev> Taking screenshots on x11 composite desktop produce wrong result

Mario Torre neugens at redhat.com
Wed Apr 6 11:19:25 UTC 2016

On Wed, Apr 6, 2016 at 12:50 PM, Semyon Sadetsky
<semyon.sadetsky at oracle.com> wrote:
> Hello Mario,
> Seems X11 call would be the best solution for AWT Robot screenshots under
> Linux. I'm ready to approve it as a default solution.
> But it seems to me better to preserve the current GTK dependent code as a
> kind of alternative solution for platforms where GTK is better supported. Is
> it reasonable for you?

Do you have in mind some compile time switch to select the appropriate
code path, or to invert the existing code path to default to x11?

Generally, I'm a bit unsure what to do. While I agree X11 is currently
the best most compatible and widespread solution, my main problem with
it is that with Wayland on the horizon it will be more complex to
support. For JDK8 I would not bother too much as I expect it being EOL
before Wayland becomes really a problem[1][2], but JDK9 may likely see
a lot of Wayland systems during its lifetime. On the other end,
keeping the GTK code around means we will likely end up in a situation
where we may have gtk2 and 3 loaded at the same time, unless the gtk 3
patches discussed elsewhere are pushed, so any fix on this bug should
be postponed until we see what's the actual code that goes in
regarding gtk3 support.

I would say that the best approach is to abstract this code away so
there's just one place where we request the screenshot from and let
the backend decide if it's gtk or x11, this way we have a proper fall
back that depends on using/not using gtk, and which version of gtk,
but I'm not sure about the level of refactoring this option imply.

In the long run, we will need to cleanup also the XPeer and all the
Xlib code and abstract it away or simply replace with GTK or something
else that hides the Wayland/X11 details, the screenshots are just the
tip of the iceberg... So overall, I don't know what's best here :)


[1] But then, who knows...
[2] In fact, I've been looking at various bugs reported against
Wayland that all point to Wayland poor support of X11 application so
far or general instability.

More information about the awt-dev mailing list