src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java

Print this page




  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 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     static native void startNativeNestedEventLoop();
  67 



  68     static native void stopNativeNestedEventLoop();
  69 
  70     private static CInputMethodDescriptor sInputMethodDescriptor;
  71 
  72     static {
  73         System.err.flush();
  74         java.security.AccessController.doPrivileged(new java.security.PrivilegedAction<Object>() {
  75             public Object run() {
  76                 System.loadLibrary("awt");
  77                 System.loadLibrary("fontmanager");
  78                 return null;
  79             }
  80         });
  81         if (!GraphicsEnvironment.isHeadless()) {
  82             initIDs();
  83         }
  84     }
  85 
  86     static String getSystemProperty(final String name, final String deflt) {
  87         return AccessController.doPrivileged (new PrivilegedAction<String>() {




  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 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     // On Mac OS we don't need to actually start the new event loop since there is
  67     // a mechanic that allows us to just reschedule the next event in a native event loop
  68     // for immediate execution and because this method is being called repeatedly we just
  69     // ecexuting one such event every time we call this method
  70     static native void startNativeNestedEventLoop();
  71 
  72     // Since we don't start an additional event loop this method is a no-op
  73     // and shouldn't be caled, left only for the beter understanding of the concept on
  74     // other OS'es
  75     static native void stopNativeNestedEventLoop();
  76 
  77     private static CInputMethodDescriptor sInputMethodDescriptor;
  78 
  79     static {
  80         System.err.flush();
  81         java.security.AccessController.doPrivileged(new java.security.PrivilegedAction<Object>() {
  82             public Object run() {
  83                 System.loadLibrary("awt");
  84                 System.loadLibrary("fontmanager");
  85                 return null;
  86             }
  87         });
  88         if (!GraphicsEnvironment.isHeadless()) {
  89             initIDs();
  90         }
  91     }
  92 
  93     static String getSystemProperty(final String name, final String deflt) {
  94         return AccessController.doPrivileged (new PrivilegedAction<String>() {