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

Andrew Hughes gnu.andrew at redhat.com
Wed Mar 9 16:39:25 UTC 2016

----- Original Message -----
> Hi Sergey,
> Here is a proposed fix for JDK9, it removes the dependencies on GTK
> and use only X11 calls:
> http://cr.openjdk.java.net/~neugens/8150954/webrev.02/
> I only tried this on a RHEL 7.2 so far but it seems to compile and
> work as expected, and doesn't require to regenerate the configure
> machinery either.
> I'm not sure if you prefer to go to the extra length of using dynamic
> loading for those functions, my assumption is that any system that has
> XRender will likely also have XComposite (even if no composite manager
> is around), but I don't know for sure.
> I'm still not totally convinced we should use X11 directly, instead we
> should probably move to using GTK always[1], but I realise this is the
> longest path[2].
> Cheers,
> Mario
> [1] GTK3 possibly.
> [2] And of course, I'm totally willing to help here.
> On Wed, Mar 2, 2016 at 5:45 PM, Mario Torre <neugens at redhat.com> wrote:
> > On Wed, Mar 2, 2016 at 5:24 PM, Sergey Bylokhov
> > <Sergey.Bylokhov at oracle.com> wrote:
> >> Hi, Mario.
> >> I assume that it works exactly the same as gtk version? if yes then it
> >> will
> >> be good to change the code in jdk9 as well and remove this dependency?
> >
> > You mean to remove the dependency on GTK and use the X11 code?
> >
> > It would make sense to try to avoid loading GTK at all if we don't
> > need it, so I would prefer this. On the other end, with Wayland
> > approaching we should move to a platform agnostic toolkit (GTK or find
> > an alternative).
> >
> > Eventually, I would like to see (in the long run at least) more
> > abstraction here, the way everything is mixed up makes things more
> > complicated.
> >
> > So bottom line I'm open to make this change, let me know if you would
> > like me to port this code to JDK9 and remove the current references to
> > GTK in Robot.c.
> >
> > Cheers,
> > Mario

This looks preferable to the Gtk+ version. The Gtk+2 version will hit issues
when loading Gtk+2 in Java code where the native code is using Gtk+3 (e.g.
Eclipse, LibreOffice). At the moment, loading Gtk+2 is confined to loading the look and
feel, but the current changes in 9 would expand its use to whenever Robot is used.
Andrew :)

Senior Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)

PGP Key: ed25519/35964222 (hkp://keys.gnupg.net)
Fingerprint = 5132 579D D154 0ED2 3E04  C5A0 CFDA 0F9B 3596 4222

More information about the awt-dev mailing list