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

Print this page




  41 public class CGraphicsEnvironment extends SunGraphicsEnvironment {
  42     // Global initialization of the Cocoa runtime.
  43     private static native void initCocoa();
  44 
  45     /**
  46      * Fetch an array of all valid CoreGraphics display identifiers.
  47      */
  48     private static native int[] getDisplayIDs();
  49 
  50     /**
  51      * Fetch the CoreGraphics display ID for the 'main' display.
  52      */
  53     private static native int getMainDisplayID();
  54 
  55     /**
  56      * Noop function that just acts as an entry point for someone to force a static initialization of this class.
  57      */
  58     public static void init() { }
  59 
  60     static {
  61         java.security.AccessController.doPrivileged(new sun.security.action.LoadLibraryAction("awt"));
  62         java.security.AccessController.doPrivileged(new java.security.PrivilegedAction<Object>() {
  63             public Object run() {






  64                 if (isHeadless()) return null;
  65                 initCocoa();
  66                 return null;
  67             }
  68         });
  69 
  70         // Install the correct surface manager factory.
  71         SurfaceManagerFactory.setInstance(new MacosxSurfaceManagerFactory());
  72     }
  73 
  74     /**
  75      * Register the instance with CGDisplayRegisterReconfigurationCallback()
  76      * The registration uses a weak global reference -- if our instance is garbage collected, the reference will be dropped.
  77      *
  78      * @return Return the registration context (a pointer).
  79      */
  80     private native long registerDisplayReconfiguration();
  81 
  82     /**
  83      * Remove the instance's registration with CGDisplayRemoveReconfigurationCallback()




  41 public class CGraphicsEnvironment extends SunGraphicsEnvironment {
  42     // Global initialization of the Cocoa runtime.
  43     private static native void initCocoa();
  44 
  45     /**
  46      * Fetch an array of all valid CoreGraphics display identifiers.
  47      */
  48     private static native int[] getDisplayIDs();
  49 
  50     /**
  51      * Fetch the CoreGraphics display ID for the 'main' display.
  52      */
  53     private static native int getMainDisplayID();
  54 
  55     /**
  56      * Noop function that just acts as an entry point for someone to force a static initialization of this class.
  57      */
  58     public static void init() { }
  59 
  60     static {
  61         java.security.AccessController.doPrivileged(new java.security.PrivilegedAction<Void>() {
  62             public Void run() {
  63                 System.loadLibrary("awt");
  64                 return null;
  65             }
  66         });
  67 
  68         java.security.AccessController.doPrivileged(new java.security.PrivilegedAction<Void>() {
  69             public Void run() {
  70                 if (isHeadless()) return null;
  71                 initCocoa();
  72                 return null;
  73             }
  74         });
  75 
  76         // Install the correct surface manager factory.
  77         SurfaceManagerFactory.setInstance(new MacosxSurfaceManagerFactory());
  78     }
  79 
  80     /**
  81      * Register the instance with CGDisplayRegisterReconfigurationCallback()
  82      * The registration uses a weak global reference -- if our instance is garbage collected, the reference will be dropped.
  83      *
  84      * @return Return the registration context (a pointer).
  85      */
  86     private native long registerDisplayReconfiguration();
  87 
  88     /**
  89      * Remove the instance's registration with CGDisplayRemoveReconfigurationCallback()