< prev index next >
src/java.desktop/unix/classes/sun/awt/UNIXToolkit.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 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
@@ -27,15 +27,14 @@
import java.awt.RenderingHints;
import static java.awt.RenderingHints.*;
import java.awt.color.ColorSpace;
import java.awt.image.*;
import java.security.AccessController;
-import java.security.PrivilegedAction;
import sun.security.action.GetIntegerAction;
import com.sun.java.swing.plaf.gtk.GTKConstants.TextDirection;
+import sun.awt.X11.XToolkit;
import sun.java2d.opengl.OGLRenderQueue;
-import java.lang.reflect.InvocationTargetException;
public abstract class UNIXToolkit extends SunToolkit
{
/** All calls into GTK should be synchronized on this lock */
public static final Object GTK_LOCK = new Object();
@@ -71,20 +70,20 @@
public boolean isNativeGTKAvailable() {
synchronized (GTK_LOCK) {
if (nativeGTKLoaded != null) {
// We've already attempted to load GTK, so just return the
// status of that attempt.
- return nativeGTKLoaded.booleanValue();
+ return nativeGTKLoaded;
} else if (nativeGTKAvailable != null) {
// We've already checked the availability of the native GTK
// libraries, so just return the status of that attempt.
- return nativeGTKAvailable.booleanValue();
+ return nativeGTKAvailable;
} else {
boolean success = check_gtk();
- nativeGTKAvailable = Boolean.valueOf(success);
+ nativeGTKAvailable = success;
return success;
}
}
}
@@ -97,15 +96,19 @@
* lightweight boolean check, no native calls required).
*/
public boolean loadGTK() {
synchronized (GTK_LOCK) {
if (nativeGTKLoaded == null) {
- boolean success = load_gtk();
- nativeGTKLoaded = Boolean.valueOf(success);
+ XToolkit.awtLock();
+ try {
+ nativeGTKLoaded = load_gtk();
+ } finally {
+ XToolkit.awtUnlock();
+ }
}
}
- return nativeGTKLoaded.booleanValue();
+ return nativeGTKLoaded;
}
/**
* Overridden to handle GTK icon loading
*/
@@ -250,10 +253,11 @@
private native boolean load_stock_icon(int widget_type, String stock_id,
int iconSize, int textDirection, String detail);
private native void nativeSync();
+ @Override
public void sync() {
// flush the X11 buffer
nativeSync();
// now flush the OGL pipeline (this is a no-op if OGL is not enabled)
OGLRenderQueue.sync();
@@ -264,10 +268,12 @@
* It builds this by querying the Gnome desktop properties to return
* them as platform independent hints.
* This requires that the Gnome properties have already been gathered.
*/
public static final String FONTCONFIGAAHINT = "fontconfig/Antialias";
+
+ @Override
protected RenderingHints getDesktopAAHints() {
Object aaValue = getDesktopProperty("gnome.Xft/Antialias");
if (aaValue == null) {
@@ -286,12 +292,12 @@
/* 0 means off, 1 means some ON. What would any other value mean?
* If we require "1" to enable AA then some new value would cause
* us to default to "OFF". I don't think that's the best guess.
* So if its !=0 then lets assume AA.
*/
- boolean aa = Boolean.valueOf(((aaValue instanceof Number) &&
- ((Number)aaValue).intValue() != 0));
+ boolean aa = ((aaValue instanceof Number)
+ && ((Number) aaValue).intValue() != 0);
Object aaHint;
if (aa) {
String subpixOrder =
(String)getDesktopProperty("gnome.Xft/RGBA");
< prev index next >