/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* This is an implementation of a GraphicsEnvironment object for the default
* local GraphicsEnvironment used by the Java Runtime Environment for Mac OS X
* GUI environments.
*
* @see GraphicsDevice
* @see GraphicsConfiguration
*/
// Global initialization of the Cocoa runtime.
private static native void initCocoa();
/**
* Fetch an array of all valid CoreGraphics display identifiers.
*/
private static native int[] getDisplayIDs();
/**
* Fetch the CoreGraphics display ID for the 'main' display.
*/
private static native int getMainDisplayID();
/**
* Noop function that just acts as an entry point for someone to force a
* static initialization of this class.
*/
public static void init() { }
static {
if (isHeadless()) return null;
initCocoa();
return null;
}
});
// Install the correct surface manager factory.
}
/**
* Register the instance with CGDisplayRegisterReconfigurationCallback().
* The registration uses a weak global reference -- if our instance is
* garbage collected, the reference will be dropped.
*
* @return Return the registration context (a pointer).
*/
private native long registerDisplayReconfiguration();
/**
* Remove the instance's registration with CGDisplayRemoveReconfigurationCallback()
*/
/** Available CoreGraphics displays. */
/** Reference to the display reconfiguration callback context. */
private final long displayReconfigContext;
/**
* Construct a new instance.
*/
public CGraphicsEnvironment() {
if (isHeadless()) {
displayReconfigContext = 0L;
return;
}
/* Populate the device table */
initDevices();
/* Register our display reconfiguration listener */
if (displayReconfigContext == 0L) {
throw new RuntimeException("Could not register CoreGraphics display reconfiguration callback");
}
}
/**
* Called by the CoreGraphics Display Reconfiguration Callback.
*
* @param displayId CoreGraphics displayId
* @param removed true if displayId was removed, false otherwise.
*/
synchronized (this) {
gd.displayChanged();
}
}
initDevices();
}
try {
super.finalize();
} finally {
}
}
/**
* (Re)create all CGraphicsDevices, reuses a devices if it is possible.
*/
private void initDevices() {
synchronized (this) {
int mainID = getMainDisplayID();
// initialization of the graphics device may change
// list of displays on hybrid systems via an activation
// of discrete video.
// So, we initialize the main display first, and then
// retrieve actual list of displays.
}
for (final int id : getDisplayIDs()) {
: new CGraphicsDevice(id));
}
}
}
final int mainDisplayID = getMainDisplayID();
if (d == null) {
// we do not expect that this may happen, the only response
// is to re-initialize the list of devices
initDevices();
}
return d;
}
}
}
protected synchronized int getNumScreens() {
}
throw new UnsupportedOperationException("This method is unused and should not be called in this implementation");
}
public boolean isDisplayLocal() {
return true;
}
for (int i = 0; i < numLogical; i++)
{
}
return newFonts;
}
}