27 28 import java.awt.*; 29 import java.awt.datatransfer.Clipboard; 30 import java.awt.dnd.*; 31 import java.awt.dnd.peer.DragSourceContextPeer; 32 import java.awt.event.InputEvent; 33 import java.awt.event.InvocationEvent; 34 import java.awt.event.KeyEvent; 35 import java.awt.im.InputMethodHighlight; 36 import java.awt.peer.*; 37 import java.lang.reflect.*; 38 import java.security.*; 39 import java.util.*; 40 import java.util.concurrent.Callable; 41 42 import sun.awt.*; 43 import sun.lwawt.*; 44 import sun.lwawt.LWWindowPeer.PeerType; 45 import sun.security.action.GetBooleanAction; 46 47 class NamedCursor extends Cursor { 48 NamedCursor(String name) { 49 super(name); 50 } 51 } 52 53 /** 54 * Mac OS X Cocoa-based AWT Toolkit. 55 */ 56 public final class LWCToolkit extends LWToolkit { 57 // While it is possible to enumerate all mouse devices 58 // and query them for the number of buttons, the code 59 // that does it is rather complex. Instead, we opt for 60 // the easy way and just support up to 5 mouse buttons, 61 // like Windows. 62 private static final int BUTTONS = 5; 63 64 private static native void initIDs(); 65 66 private static CInputMethodDescriptor sInputMethodDescriptor; 67 68 static { 69 System.err.flush(); 70 java.security.AccessController.doPrivileged(new java.security.PrivilegedAction<Object>() { 71 public Object run() { 72 System.loadLibrary("awt"); 73 System.loadLibrary("fontmanager"); 74 return null; 75 } 76 }); 77 if (!GraphicsEnvironment.isHeadless()) { 78 initIDs(); 79 } 80 inAWT = AccessController.doPrivileged(new PrivilegedAction<Boolean>() { 81 @Override 82 public Boolean run() { 83 return !Boolean.parseBoolean(System.getProperty("javafx.embed.singleThread", "false")); 84 } 85 }); 86 } 87 88 /* 89 * If true we operate in normal mode and nested runloop is executed in JavaRunLoopMode 90 * If false we operate in singleThreaded FX/AWT interop mode and nested loop uses NSDefaultRunLoopMode 91 */ 92 private static final boolean inAWT; 93 94 public LWCToolkit() { 95 SunToolkit.setDataTransfererClassName("sun.lwawt.macosx.CDataTransferer"); 96 | 27 28 import java.awt.*; 29 import java.awt.datatransfer.Clipboard; 30 import java.awt.dnd.*; 31 import java.awt.dnd.peer.DragSourceContextPeer; 32 import java.awt.event.InputEvent; 33 import java.awt.event.InvocationEvent; 34 import java.awt.event.KeyEvent; 35 import java.awt.im.InputMethodHighlight; 36 import java.awt.peer.*; 37 import java.lang.reflect.*; 38 import java.security.*; 39 import java.util.*; 40 import java.util.concurrent.Callable; 41 42 import sun.awt.*; 43 import sun.lwawt.*; 44 import sun.lwawt.LWWindowPeer.PeerType; 45 import sun.security.action.GetBooleanAction; 46 47 import sun.util.CoreResourceBundleControl; 48 49 class NamedCursor extends Cursor { 50 NamedCursor(String name) { 51 super(name); 52 } 53 } 54 55 /** 56 * Mac OS X Cocoa-based AWT Toolkit. 57 */ 58 public final class LWCToolkit extends LWToolkit { 59 // While it is possible to enumerate all mouse devices 60 // and query them for the number of buttons, the code 61 // that does it is rather complex. Instead, we opt for 62 // the easy way and just support up to 5 mouse buttons, 63 // like Windows. 64 private static final int BUTTONS = 5; 65 66 private static native void initIDs(); 67 68 private static CInputMethodDescriptor sInputMethodDescriptor; 69 70 static { 71 System.err.flush(); 72 73 ResourceBundle platformResources = java.security.AccessController.doPrivileged( 74 new java.security.PrivilegedAction<ResourceBundle>() { 75 public ResourceBundle run() { 76 ResourceBundle platformResources = null; 77 try { 78 platformResources = 79 ResourceBundle.getBundle("sun.awt.resources.awtosx", 80 CoreResourceBundleControl.getRBControlInstance()); 81 } catch (MissingResourceException e) { 82 // No resource file; defaults will be used. 83 } 84 85 System.loadLibrary("awt"); 86 System.loadLibrary("fontmanager"); 87 88 return platformResources; 89 } 90 }); 91 92 AWTAccessor.getToolkitAccessor().setPlatformResources(platformResources); 93 94 if (!GraphicsEnvironment.isHeadless()) { 95 initIDs(); 96 } 97 inAWT = AccessController.doPrivileged(new PrivilegedAction<Boolean>() { 98 @Override 99 public Boolean run() { 100 return !Boolean.parseBoolean(System.getProperty("javafx.embed.singleThread", "false")); 101 } 102 }); 103 } 104 105 /* 106 * If true we operate in normal mode and nested runloop is executed in JavaRunLoopMode 107 * If false we operate in singleThreaded FX/AWT interop mode and nested loop uses NSDefaultRunLoopMode 108 */ 109 private static final boolean inAWT; 110 111 public LWCToolkit() { 112 SunToolkit.setDataTransfererClassName("sun.lwawt.macosx.CDataTransferer"); 113 |