< prev index next >

src/java.desktop/unix/classes/sun/awt/X11/XRobotPeer.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 23,33 **** * questions. */ package sun.awt.X11; import java.awt.*; ! import java.awt.peer.*; import java.security.AccessController; import java.security.PrivilegedAction; import sun.awt.AWTAccessor; import sun.awt.SunToolkit; --- 23,33 ---- * questions. */ package sun.awt.X11; import java.awt.*; ! import java.awt.peer.RobotPeer; import java.security.AccessController; import java.security.PrivilegedAction; import sun.awt.AWTAccessor; import sun.awt.SunToolkit;
*** 35,77 **** import sun.awt.X11GraphicsConfig; import sun.awt.X11GraphicsEnvironment; class XRobotPeer implements RobotPeer { - static final boolean tryGtk; static { loadNativeLibraries(); - tryGtk = AccessController.doPrivileged((PrivilegedAction<Boolean>)() - -> Boolean.getBoolean("awt.robot.gtk")); } ! private static boolean isGtkSupported = false; ! 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 */ ! static Object robotLock = new Object(); XRobotPeer(GraphicsConfiguration gc) { ! this.xgc = (X11GraphicsConfig)gc; SunToolkit tk = (SunToolkit)Toolkit.getDefaultToolkit(); setup(tk.getNumberOfButtons(), AWTAccessor.getInputEventAccessor().getButtonDownMasks()); ! boolean isGtkSupported = false; ! if (tryGtk) { ! if (tk instanceof UNIXToolkit && ((UNIXToolkit) tk).loadGTK()) { ! isGtkSupported = true; } } - useGtk = (tryGtk && isGtkSupported); - } - @Override public void dispose() { // does nothing } --- 35,72 ---- import sun.awt.X11GraphicsConfig; import sun.awt.X11GraphicsEnvironment; class XRobotPeer implements RobotPeer { static { loadNativeLibraries(); } ! private final boolean useGtk; ! private final X11GraphicsConfig xgc; /* * native implementation uses some static shared data (pipes, processes) * so use a class lock to synchronize native method calls */ ! static final Object robotLock = new Object(); XRobotPeer(GraphicsConfiguration gc) { ! xgc = (X11GraphicsConfig)gc; SunToolkit tk = (SunToolkit)Toolkit.getDefaultToolkit(); setup(tk.getNumberOfButtons(), AWTAccessor.getInputEventAccessor().getButtonDownMasks()); ! if (!(tk instanceof UNIXToolkit) || "false".equals(AccessController. ! doPrivileged((PrivilegedAction<String>)() -> ! System.getProperty("awt.robot.gtk")))) { ! useGtk = false; ! } else { ! useGtk = ((UNIXToolkit) tk).loadGTK(); } } @Override public void dispose() { // does nothing }
< prev index next >