src/macosx/classes/sun/awt/CGraphicsDevice.java

Print this page

        

*** 33,46 **** import java.awt.Window; import java.util.Objects; import sun.java2d.opengl.CGLGraphicsConfig; ! public final class CGraphicsDevice extends GraphicsDevice { ! // CoreGraphics display ID ! private final int displayID; // Array of all GraphicsConfig instances for this device private final GraphicsConfiguration[] configs; // Default config (temporarily hard coded) --- 33,54 ---- import java.awt.Window; import java.util.Objects; import sun.java2d.opengl.CGLGraphicsConfig; ! public final class CGraphicsDevice extends GraphicsDevice ! implements DisplayChangedListener { ! /** ! * CoreGraphics display ID. This identifier can become non-valid at any time ! * therefore methods, which is using this id should be ready to it. ! */ ! private volatile int displayID; ! private volatile Insets screenInsets; ! private volatile double xResolution; ! private volatile double yResolution; ! private volatile int scale; // Array of all GraphicsConfig instances for this device private final GraphicsConfiguration[] configs; // Default config (temporarily hard coded)
*** 49,59 **** private static AWTPermission fullScreenExclusivePermission; // Save/restore DisplayMode for the Full Screen mode private DisplayMode originalMode; ! public CGraphicsDevice(int displayID) { this.displayID = displayID; configs = new GraphicsConfiguration[] { CGLGraphicsConfig.getConfig(this, 0) }; } --- 57,67 ---- private static AWTPermission fullScreenExclusivePermission; // Save/restore DisplayMode for the Full Screen mode private DisplayMode originalMode; ! public CGraphicsDevice(final int displayID) { this.displayID = displayID; configs = new GraphicsConfiguration[] { CGLGraphicsConfig.getConfig(this, 0) }; }
*** 87,97 **** /** * Return a human-readable screen description. */ @Override public String getIDstring() { ! return "Display " + this.displayID; } /** * Returns the type of the graphics device. * @see #TYPE_RASTER_SCREEN --- 95,105 ---- /** * Return a human-readable screen description. */ @Override public String getIDstring() { ! return "Display " + displayID; } /** * Returns the type of the graphics device. * @see #TYPE_RASTER_SCREEN
*** 102,120 **** public int getType() { return TYPE_RASTER_SCREEN; } public double getXResolution() { ! return nativeGetXResolution(displayID); } public double getYResolution() { ! return nativeGetYResolution(displayID); } public Insets getScreenInsets() { ! return nativeGetScreenInsets(displayID); } /** * Enters full-screen mode, or returns to windowed mode. */ --- 110,150 ---- public int getType() { return TYPE_RASTER_SCREEN; } public double getXResolution() { ! return xResolution; } public double getYResolution() { ! return yResolution; } public Insets getScreenInsets() { ! return screenInsets; ! } ! ! public int getScaleFactor() { ! return scale; ! } ! ! public void invalidate(final int defaultDisplayID) { ! displayID = defaultDisplayID; ! } ! ! @Override ! public void displayChanged() { ! xResolution = nativeGetXResolution(displayID); ! yResolution = nativeGetYResolution(displayID); ! screenInsets = nativeGetScreenInsets(displayID); ! scale = (int) nativeGetScaleFactor(displayID); ! //TODO configs/fullscreenWindow/modes? ! } ! ! @Override ! public void paletteChanged() { ! // devices do not need to react to this event. } /** * Enters full-screen mode, or returns to windowed mode. */
*** 217,230 **** @Override public DisplayMode[] getDisplayModes() { return nativeGetDisplayModes(displayID); } - public int getScaleFactor() { - return (int) nativeGetScaleFactor(displayID); - } - private static native double nativeGetScaleFactor(int displayID); private static native void nativeSetDisplayMode(int displayID, int w, int h, int bpp, int refrate); private static native DisplayMode nativeGetDisplayMode(int displayID); --- 247,256 ----