--- old/src/java.desktop/unix/classes/sun/awt/X11/XRobotPeer.java 2016-05-30 11:48:57.221268095 +0200 +++ new/src/java.desktop/unix/classes/sun/awt/X11/XRobotPeer.java 2016-05-30 11:48:57.097270007 +0200 @@ -35,8 +35,14 @@ class XRobotPeer implements RobotPeer { - private static volatile boolean isGtkSupported; + static final boolean tryGtk; + static { + tryGtk = Boolean.getBoolean("awt.robot.gtk"); + } + + private static volatile boolean useGtk; private X11GraphicsConfig xgc = null; + /* * native implementation uses some static shared data (pipes, processes) * so use a class lock to synchronize native method calls @@ -49,13 +55,16 @@ setup(tk.getNumberOfButtons(), AWTAccessor.getInputEventAccessor().getButtonDownMasks()); - Toolkit toolkit = Toolkit.getDefaultToolkit(); - if (!isGtkSupported) { + boolean isGtkSupported = false; + if (tryGtk && !isGtkSupported) { + Toolkit toolkit = Toolkit.getDefaultToolkit(); if (toolkit instanceof UNIXToolkit && ((UNIXToolkit) toolkit).loadGTK()) { isGtkSupported = true; } } + + useGtk = (tryGtk && isGtkSupported); } @Override @@ -104,7 +113,7 @@ public int getRGBPixel(int x, int y) { int pixelArray[] = new int[1]; getRGBPixelsImpl(xgc, x, y, 1, 1, xgc.getScale(), pixelArray, - isGtkSupported); + useGtk); return pixelArray[0]; } @@ -112,7 +121,7 @@ public int [] getRGBPixels(Rectangle bounds) { int pixelArray[] = new int[bounds.width*bounds.height]; getRGBPixelsImpl(xgc, bounds.x, bounds.y, bounds.width, bounds.height, - xgc.getScale(), pixelArray, isGtkSupported); + xgc.getScale(), pixelArray, useGtk); return pixelArray; }