1 /*
2 * Copyright (c) 1997, 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
215
216 public boolean isDisplayLocal() {
217 if (isDisplayLocal == null) {
218 SunToolkit.awtLock();
219 try {
220 if (isDisplayLocal == null) {
221 isDisplayLocal = Boolean.valueOf(_isDisplayLocal());
222 }
223 } finally {
224 SunToolkit.awtUnlock();
225 }
226 }
227 return isDisplayLocal.booleanValue();
228 }
229
230 private static boolean _isDisplayLocal() {
231 if (isHeadless()) {
232 return true;
233 }
234
235 String isRemote = (String)java.security.AccessController.doPrivileged(
236 new sun.security.action.GetPropertyAction("sun.java2d.remote"));
237 if (isRemote != null) {
238 return isRemote.equals("false");
239 }
240
241 int shm = checkShmExt();
242 if (shm != -1) {
243 return (shm == 1);
244 }
245
246 // If XServer doesn't support ShMem extension,
247 // try the other way
248
249 String display = getDisplayString();
250 int ind = display.indexOf(':');
251 final String hostName = display.substring(0, ind);
252 if (ind <= 0) {
253 // ':0' case
254 return true;
255 }
|
1 /*
2 * Copyright (c) 1997, 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
215
216 public boolean isDisplayLocal() {
217 if (isDisplayLocal == null) {
218 SunToolkit.awtLock();
219 try {
220 if (isDisplayLocal == null) {
221 isDisplayLocal = Boolean.valueOf(_isDisplayLocal());
222 }
223 } finally {
224 SunToolkit.awtUnlock();
225 }
226 }
227 return isDisplayLocal.booleanValue();
228 }
229
230 private static boolean _isDisplayLocal() {
231 if (isHeadless()) {
232 return true;
233 }
234
235 String isRemote = java.security.AccessController.doPrivileged(
236 new sun.security.action.GetPropertyAction("sun.java2d.remote"));
237 if (isRemote != null) {
238 return isRemote.equals("false");
239 }
240
241 int shm = checkShmExt();
242 if (shm != -1) {
243 return (shm == 1);
244 }
245
246 // If XServer doesn't support ShMem extension,
247 // try the other way
248
249 String display = getDisplayString();
250 int ind = display.indexOf(':');
251 final String hostName = display.substring(0, ind);
252 if (ind <= 0) {
253 // ':0' case
254 return true;
255 }
|