91 import java.security.PrivilegedAction;
92 import java.util.HashMap;
93 import java.util.Locale;
94 import java.util.Map;
95 import java.util.MissingResourceException;
96 import java.util.Objects;
97 import java.util.ResourceBundle;
98 import java.util.concurrent.Callable;
99
100 import javax.swing.UIManager;
101
102 import com.apple.laf.AquaMenuBarUI;
103 import sun.awt.AWTAccessor;
104 import sun.awt.AppContext;
105 import sun.awt.CGraphicsConfig;
106 import sun.awt.CGraphicsDevice;
107 import sun.awt.LightweightFrame;
108 import sun.awt.SunToolkit;
109 import sun.awt.datatransfer.DataTransferer;
110 import sun.awt.util.ThreadGroupUtils;
111 import sun.java2d.opengl.OGLRenderQueue;
112 import sun.lwawt.LWComponentPeer;
113 import sun.lwawt.LWCursorManager;
114 import sun.lwawt.LWToolkit;
115 import sun.lwawt.LWWindowPeer;
116 import sun.lwawt.LWWindowPeer.PeerType;
117 import sun.lwawt.PlatformComponent;
118 import sun.lwawt.PlatformDropTarget;
119 import sun.lwawt.PlatformWindow;
120 import sun.lwawt.SecurityWarningWindow;
121 import sun.security.action.GetBooleanAction;
122
123 @SuppressWarnings("serial") // JDK implementation class
124 final class NamedCursor extends Cursor {
125 NamedCursor(String name) {
126 super(name);
127 }
128 }
129
130 /**
459 }
460
461 @Override
462 public native void beep();
463
464 @Override
465 public int getScreenResolution() throws HeadlessException {
466 return (int) ((CGraphicsDevice) GraphicsEnvironment
467 .getLocalGraphicsEnvironment().getDefaultScreenDevice())
468 .getXResolution();
469 }
470
471 @Override
472 public Insets getScreenInsets(final GraphicsConfiguration gc) {
473 return ((CGraphicsConfig) gc).getDevice().getScreenInsets();
474 }
475
476 @Override
477 public void sync() {
478 // flush the OGL pipeline (this is a no-op if OGL is not enabled)
479 OGLRenderQueue.sync();
480 // setNeedsDisplay() selector was sent to the appropriate CALayer so now
481 // we have to flush the native selectors queue.
482 flushNativeSelectors();
483 }
484
485 @Override
486 public RobotPeer createRobot(Robot target, GraphicsDevice screen) {
487 return new CRobot(target, (CGraphicsDevice)screen);
488 }
489
490 private native boolean isCapsLockOn();
491
492 /*
493 * NOTE: Among the keys this method is supposed to check,
494 * only Caps Lock works as a true locking key with OS X.
495 * There is no Scroll Lock key on modern Apple keyboards,
496 * and with a PC keyboard plugged in Scroll Lock is simply
497 * ignored: no LED lights up if you press it.
498 * The key located at the same position on Apple keyboards
499 * as Num Lock on PC keyboards is called Clear, doesn't lock
|
91 import java.security.PrivilegedAction;
92 import java.util.HashMap;
93 import java.util.Locale;
94 import java.util.Map;
95 import java.util.MissingResourceException;
96 import java.util.Objects;
97 import java.util.ResourceBundle;
98 import java.util.concurrent.Callable;
99
100 import javax.swing.UIManager;
101
102 import com.apple.laf.AquaMenuBarUI;
103 import sun.awt.AWTAccessor;
104 import sun.awt.AppContext;
105 import sun.awt.CGraphicsConfig;
106 import sun.awt.CGraphicsDevice;
107 import sun.awt.LightweightFrame;
108 import sun.awt.SunToolkit;
109 import sun.awt.datatransfer.DataTransferer;
110 import sun.awt.util.ThreadGroupUtils;
111 import sun.java2d.macos.MacOSFlags;
112 import sun.java2d.metal.MTLRenderQueue;
113 import sun.java2d.opengl.OGLRenderQueue;
114 import sun.lwawt.LWComponentPeer;
115 import sun.lwawt.LWCursorManager;
116 import sun.lwawt.LWToolkit;
117 import sun.lwawt.LWWindowPeer;
118 import sun.lwawt.LWWindowPeer.PeerType;
119 import sun.lwawt.PlatformComponent;
120 import sun.lwawt.PlatformDropTarget;
121 import sun.lwawt.PlatformWindow;
122 import sun.lwawt.SecurityWarningWindow;
123 import sun.security.action.GetBooleanAction;
124
125 @SuppressWarnings("serial") // JDK implementation class
126 final class NamedCursor extends Cursor {
127 NamedCursor(String name) {
128 super(name);
129 }
130 }
131
132 /**
461 }
462
463 @Override
464 public native void beep();
465
466 @Override
467 public int getScreenResolution() throws HeadlessException {
468 return (int) ((CGraphicsDevice) GraphicsEnvironment
469 .getLocalGraphicsEnvironment().getDefaultScreenDevice())
470 .getXResolution();
471 }
472
473 @Override
474 public Insets getScreenInsets(final GraphicsConfiguration gc) {
475 return ((CGraphicsConfig) gc).getDevice().getScreenInsets();
476 }
477
478 @Override
479 public void sync() {
480 // flush the OGL pipeline (this is a no-op if OGL is not enabled)
481 if (MacOSFlags.isMetalEnabled()) {
482 MTLRenderQueue.sync();
483 } else {
484 OGLRenderQueue.sync();
485 }
486 // setNeedsDisplay() selector was sent to the appropriate CALayer so now
487 // we have to flush the native selectors queue.
488 flushNativeSelectors();
489 }
490
491 @Override
492 public RobotPeer createRobot(Robot target, GraphicsDevice screen) {
493 return new CRobot(target, (CGraphicsDevice)screen);
494 }
495
496 private native boolean isCapsLockOn();
497
498 /*
499 * NOTE: Among the keys this method is supposed to check,
500 * only Caps Lock works as a true locking key with OS X.
501 * There is no Scroll Lock key on modern Apple keyboards,
502 * and with a PC keyboard plugged in Scroll Lock is simply
503 * ignored: no LED lights up if you press it.
504 * The key located at the same position on Apple keyboards
505 * as Num Lock on PC keyboards is called Clear, doesn't lock
|