1 /* |
1 /* |
2 * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. |
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. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
49 private volatile double xResolution; |
49 private volatile double xResolution; |
50 private volatile double yResolution; |
50 private volatile double yResolution; |
51 private volatile Rectangle bounds; |
51 private volatile Rectangle bounds; |
52 private volatile int scale; |
52 private volatile int scale; |
53 |
53 |
54 // Array of all GraphicsConfig instances for this device |
54 private final GraphicsConfiguration config; |
55 private final GraphicsConfiguration[] configs; |
|
56 |
|
57 // Default config (temporarily hard coded) |
|
58 private final int DEFAULT_CONFIG = 0; |
|
59 |
55 |
60 private static AWTPermission fullScreenExclusivePermission; |
56 private static AWTPermission fullScreenExclusivePermission; |
61 |
57 |
62 // Save/restore DisplayMode for the Full Screen mode |
58 // Save/restore DisplayMode for the Full Screen mode |
63 private DisplayMode originalMode; |
59 private DisplayMode originalMode; |
64 |
60 |
65 public CGraphicsDevice(final int displayID) { |
61 public CGraphicsDevice(final int displayID) { |
66 this.displayID = displayID; |
62 this.displayID = displayID; |
67 configs = new GraphicsConfiguration[] { |
63 config = CGLGraphicsConfig.getConfig(this, displayID, 0); |
68 CGLGraphicsConfig.getConfig(this, displayID, 0) |
|
69 }; |
|
70 } |
64 } |
71 |
65 |
72 /** |
66 /** |
73 * Return a list of all configurations. |
67 * Return a list of all configurations. |
74 */ |
68 */ |
75 @Override |
69 @Override |
76 public GraphicsConfiguration[] getConfigurations() { |
70 public GraphicsConfiguration[] getConfigurations() { |
77 return configs.clone(); |
71 return new GraphicsConfiguration[]{config}; |
78 } |
72 } |
79 |
73 |
80 /** |
74 /** |
81 * Return the default configuration. |
75 * Return the default configuration. |
82 */ |
76 */ |
83 @Override |
77 @Override |
84 public GraphicsConfiguration getDefaultConfiguration() { |
78 public GraphicsConfiguration getDefaultConfiguration() { |
85 return configs[DEFAULT_CONFIG]; |
79 return config; |
86 } |
80 } |
87 |
81 |
88 /** |
82 /** |
89 * Return a human-readable screen description. |
83 * Return a human-readable screen description. |
90 */ |
84 */ |