src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java
Print this page
*** 101,134 ****
static int arrowCursor;
static TreeMap<Long, XBaseWindow> winMap = new TreeMap<>();
static HashMap<Object, Object> specialPeerMap = new HashMap<>();
static HashMap<Long, Collection<XEventDispatcher>> winToDispatcher = new HashMap<>();
- private static long _display;
static UIDefaults uidefaults;
! static X11GraphicsEnvironment localEnv;
! static X11GraphicsDevice device;
! static final X11GraphicsConfig config;
static int awt_multiclick_time;
static boolean securityWarningEnabled;
private static volatile int screenWidth = -1, screenHeight = -1; // Dimensions of default screen
static long awt_defaultFg; // Pixel
private static XMouseInfoPeer xPeer;
static {
initSecurityWarning();
if (GraphicsEnvironment.isHeadless()) {
config = null;
} else {
localEnv = (X11GraphicsEnvironment) GraphicsEnvironment
.getLocalGraphicsEnvironment();
device = (X11GraphicsDevice) localEnv.getDefaultScreenDevice();
! config = (X11GraphicsConfig) (device.getDefaultConfiguration());
! if (device != null) {
! _display = device.getDisplay();
! }
setupModifierMap();
initIDs();
setBackingStoreType();
}
}
--- 101,135 ----
static int arrowCursor;
static TreeMap<Long, XBaseWindow> winMap = new TreeMap<>();
static HashMap<Object, Object> specialPeerMap = new HashMap<>();
static HashMap<Long, Collection<XEventDispatcher>> winToDispatcher = new HashMap<>();
static UIDefaults uidefaults;
! static final X11GraphicsEnvironment localEnv;
! private static final X11GraphicsDevice device;
! private static final X11GraphicsConfig config;
! private static final long display;
static int awt_multiclick_time;
static boolean securityWarningEnabled;
private static volatile int screenWidth = -1, screenHeight = -1; // Dimensions of default screen
static long awt_defaultFg; // Pixel
private static XMouseInfoPeer xPeer;
static {
initSecurityWarning();
if (GraphicsEnvironment.isHeadless()) {
+ localEnv = null;
+ device = null;
config = null;
+ display = 0;
} else {
localEnv = (X11GraphicsEnvironment) GraphicsEnvironment
.getLocalGraphicsEnvironment();
device = (X11GraphicsDevice) localEnv.getDefaultScreenDevice();
! config = (X11GraphicsConfig) device.getDefaultConfiguration();
! display = device.getDisplay();
setupModifierMap();
initIDs();
setBackingStoreType();
}
}
*** 195,208 ****
{
e.printStackTrace();
}
}
! static Object displayLock = new Object();
!
public static long getDisplay() {
! return _display;
}
public static long getDefaultRootWindow() {
awtLock();
try {
--- 196,217 ----
{
e.printStackTrace();
}
}
! /**
! * Returns the X11 Display of the default screen device.
! *
! * @return X11 Display
! * @throws AWTError thrown if local GraphicsEnvironment is null, which
! * means we are in the headless environment
! */
public static long getDisplay() {
! if (localEnv == null) {
! throw new AWTError("Local GraphicsEnvironment must not be null");
! }
! return display;
}
public static long getDefaultRootWindow() {
awtLock();
try {