1 /*
2 * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
32 import java.security.PrivilegedAction;
33 import sun.security.action.GetIntegerAction;
34 import com.sun.java.swing.plaf.gtk.GTKConstants.TextDirection;
35 import sun.java2d.opengl.OGLRenderQueue;
36 import java.lang.reflect.InvocationTargetException;
37
38 public abstract class UNIXToolkit extends SunToolkit
39 {
40 /** All calls into GTK should be synchronized on this lock */
41 public static final Object GTK_LOCK = new Object();
42
43 private static final int[] BAND_OFFSETS = { 0, 1, 2 };
44 private static final int[] BAND_OFFSETS_ALPHA = { 0, 1, 2, 3 };
45 private static final int DEFAULT_DATATRANSFER_TIMEOUT = 10000;
46
47 private Boolean nativeGTKAvailable;
48 private Boolean nativeGTKLoaded;
49 private BufferedImage tmpImage = null;
50
51 public static int getDatatransferTimeout() {
52 Integer dt = (Integer)AccessController.doPrivileged(
53 new GetIntegerAction("sun.awt.datatransfer.timeout"));
54 if (dt == null || dt <= 0) {
55 return DEFAULT_DATATRANSFER_TIMEOUT;
56 } else {
57 return dt;
58 }
59 }
60
61 /**
62 * Returns true if the native GTK libraries are capable of being
63 * loaded and are expected to work properly, false otherwise. Note
64 * that this method will not leave the native GTK libraries loaded if
65 * they haven't already been loaded. This allows, for example, Swing's
66 * GTK L&F to test for the presence of native GTK support without
67 * leaving the native libraries loaded. To attempt long-term loading
68 * of the native GTK libraries, use the loadGTK() method instead.
69 */
70 @Override
71 public boolean isNativeGTKAvailable() {
72 synchronized (GTK_LOCK) {
|
1 /*
2 * Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
32 import java.security.PrivilegedAction;
33 import sun.security.action.GetIntegerAction;
34 import com.sun.java.swing.plaf.gtk.GTKConstants.TextDirection;
35 import sun.java2d.opengl.OGLRenderQueue;
36 import java.lang.reflect.InvocationTargetException;
37
38 public abstract class UNIXToolkit extends SunToolkit
39 {
40 /** All calls into GTK should be synchronized on this lock */
41 public static final Object GTK_LOCK = new Object();
42
43 private static final int[] BAND_OFFSETS = { 0, 1, 2 };
44 private static final int[] BAND_OFFSETS_ALPHA = { 0, 1, 2, 3 };
45 private static final int DEFAULT_DATATRANSFER_TIMEOUT = 10000;
46
47 private Boolean nativeGTKAvailable;
48 private Boolean nativeGTKLoaded;
49 private BufferedImage tmpImage = null;
50
51 public static int getDatatransferTimeout() {
52 Integer dt = AccessController.doPrivileged(
53 new GetIntegerAction("sun.awt.datatransfer.timeout"));
54 if (dt == null || dt <= 0) {
55 return DEFAULT_DATATRANSFER_TIMEOUT;
56 } else {
57 return dt;
58 }
59 }
60
61 /**
62 * Returns true if the native GTK libraries are capable of being
63 * loaded and are expected to work properly, false otherwise. Note
64 * that this method will not leave the native GTK libraries loaded if
65 * they haven't already been loaded. This allows, for example, Swing's
66 * GTK L&F to test for the presence of native GTK support without
67 * leaving the native libraries loaded. To attempt long-term loading
68 * of the native GTK libraries, use the loadGTK() method instead.
69 */
70 @Override
71 public boolean isNativeGTKAvailable() {
72 synchronized (GTK_LOCK) {
|