1 /*
2 * Copyright (c) 1997, 2011, 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
308 if (security != null) {
309 if (fullScreenExclusivePermission == null) {
310 fullScreenExclusivePermission =
311 new AWTPermission("fullScreenExclusive");
312 }
313 try {
314 security.checkPermission(fullScreenExclusivePermission);
315 } catch (SecurityException e) {
316 return false;
317 }
318 }
319 }
320 return fsAvailable;
321 }
322
323 @Override
324 public boolean isDisplayChangeSupported() {
325 return (isFullScreenSupported() && (getFullScreenWindow() != null));
326 }
327
328 private static void enterFullScreenExclusive(Window w) {
329 X11ComponentPeer peer = (X11ComponentPeer)w.getPeer();
330 if (peer != null) {
331 enterFullScreenExclusive(peer.getContentWindow());
332 peer.setFullScreenExclusiveModeState(true);
333 }
334 }
335
336 private static void exitFullScreenExclusive(Window w) {
337 X11ComponentPeer peer = (X11ComponentPeer)w.getPeer();
338 if (peer != null) {
339 peer.setFullScreenExclusiveModeState(false);
340 exitFullScreenExclusive(peer.getContentWindow());
341 }
342 }
343
344 @Override
345 public synchronized void setFullScreenWindow(Window w) {
346 Window old = getFullScreenWindow();
347 if (w == old) {
348 return;
349 }
350
351 boolean fsSupported = isFullScreenSupported();
352 if (fsSupported && old != null) {
353 // enter windowed mode (and restore original display mode)
354 exitFullScreenExclusive(old);
355 setDisplayMode(origDisplayMode);
|
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
308 if (security != null) {
309 if (fullScreenExclusivePermission == null) {
310 fullScreenExclusivePermission =
311 new AWTPermission("fullScreenExclusive");
312 }
313 try {
314 security.checkPermission(fullScreenExclusivePermission);
315 } catch (SecurityException e) {
316 return false;
317 }
318 }
319 }
320 return fsAvailable;
321 }
322
323 @Override
324 public boolean isDisplayChangeSupported() {
325 return (isFullScreenSupported() && (getFullScreenWindow() != null));
326 }
327
328 @SuppressWarnings("deprecation")
329 private static void enterFullScreenExclusive(Window w) {
330 X11ComponentPeer peer = (X11ComponentPeer)w.getPeer();
331 if (peer != null) {
332 enterFullScreenExclusive(peer.getContentWindow());
333 peer.setFullScreenExclusiveModeState(true);
334 }
335 }
336
337 @SuppressWarnings("deprecation")
338 private static void exitFullScreenExclusive(Window w) {
339 X11ComponentPeer peer = (X11ComponentPeer)w.getPeer();
340 if (peer != null) {
341 peer.setFullScreenExclusiveModeState(false);
342 exitFullScreenExclusive(peer.getContentWindow());
343 }
344 }
345
346 @Override
347 public synchronized void setFullScreenWindow(Window w) {
348 Window old = getFullScreenWindow();
349 if (w == old) {
350 return;
351 }
352
353 boolean fsSupported = isFullScreenSupported();
354 if (fsSupported && old != null) {
355 // enter windowed mode (and restore original display mode)
356 exitFullScreenExclusive(old);
357 setDisplayMode(origDisplayMode);
|