1 /*
2 * Copyright (c) 2012, 2019, 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
46
47 /**
48 * CoreGraphics display ID. This identifier can become non-valid at any time
49 * therefore methods, which is using this id should be ready to it.
50 */
51 private volatile int displayID;
52 private volatile double xResolution;
53 private volatile double yResolution;
54 private volatile Rectangle bounds;
55 private volatile int scale;
56
57 private final GraphicsConfiguration config;
58
59 private static AWTPermission fullScreenExclusivePermission;
60
61 // Save/restore DisplayMode for the Full Screen mode
62 private DisplayMode originalMode;
63
64 public CGraphicsDevice(final int displayID) {
65 this.displayID = displayID;
66 config = CGLGraphicsConfig.getConfig(this, displayID, 0);
67 // initializes default device state, might be redundant step since we
68 // call "displayChanged()" later anyway, but we do not want to leave the
69 // device in an inconsistent state after construction
70 displayChanged();
71 }
72
73 /**
74 * Return a list of all configurations.
75 */
76 @Override
77 public GraphicsConfiguration[] getConfigurations() {
78 return new GraphicsConfiguration[]{config};
79 }
80
81 /**
82 * Return the default configuration.
83 */
84 @Override
85 public GraphicsConfiguration getDefaultConfiguration() {
86 return config;
|
1 /*
2 * Copyright (c) 2012, 2020, 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
46
47 /**
48 * CoreGraphics display ID. This identifier can become non-valid at any time
49 * therefore methods, which is using this id should be ready to it.
50 */
51 private volatile int displayID;
52 private volatile double xResolution;
53 private volatile double yResolution;
54 private volatile Rectangle bounds;
55 private volatile int scale;
56
57 private final GraphicsConfiguration config;
58
59 private static AWTPermission fullScreenExclusivePermission;
60
61 // Save/restore DisplayMode for the Full Screen mode
62 private DisplayMode originalMode;
63
64 public CGraphicsDevice(final int displayID) {
65 this.displayID = displayID;
66 config = CGLGraphicsConfig.getConfig(this);
67 // initializes default device state, might be redundant step since we
68 // call "displayChanged()" later anyway, but we do not want to leave the
69 // device in an inconsistent state after construction
70 displayChanged();
71 }
72
73 /**
74 * Return a list of all configurations.
75 */
76 @Override
77 public GraphicsConfiguration[] getConfigurations() {
78 return new GraphicsConfiguration[]{config};
79 }
80
81 /**
82 * Return the default configuration.
83 */
84 @Override
85 public GraphicsConfiguration getDefaultConfiguration() {
86 return config;
|