/*
* 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 GraphicsDevice object for a single
* X11 screen.
*
* @see GraphicsEnvironment
* @see GraphicsConfiguration
*/
public class X11GraphicsDevice
extends GraphicsDevice
implements DisplayChangedListener
{
int screen;
private boolean shutdownHookRegistered;
}
/*
* Initialize JNI field and method IDs for fields that may be
* accessed from C.
*/
private static native void initIDs();
static {
if (!GraphicsEnvironment.isHeadless()) {
initIDs();
}
}
/**
* Returns the X11 screen of the device.
*/
public int getScreen() {
return screen;
}
synchronized (x11ProxyKeyMap) {
if (o == null) {
o = new Object();
}
return o;
}
}
/**
* Returns the X11 Display of this device.
* This method is also in MDrawingSurfaceInfo but need it here
* to be able to allow a GraphicsConfigTemplate to get the Display.
*/
public native long getDisplay();
/**
* Returns the type of the graphics device.
* @see #TYPE_RASTER_SCREEN
* @see #TYPE_PRINTER
* @see #TYPE_IMAGE_BUFFER
*/
public int getType() {
return TYPE_RASTER_SCREEN;
}
/**
* Returns the identification string associated with this graphics
* device.
*/
return ":0."+screen;
}
/**
* Returns all of the graphics
* configurations associated with this graphics device.
*/
synchronized (configLock) {
}
}
}
private void makeConfigurations() {
int i = 1; // Index 0 is always the default config
if (defaultConfig == null) {
}
else {
}
boolean dbeSupported = isDBESupported();
doubleBufferVisuals = new HashSet();
}
for ( ; i < num; i++) {
if (glxSupported) {
}
boolean doubleBuffer =
(dbeSupported &&
if (xrenderSupported) {
} else {
getConfigColormap(i, screen),
}
}
}
}
}
/*
* Returns the number of X11 visuals representable as an
* X11GraphicsConfig object.
*/
/*
* Returns the visualid for the given index of graphics configurations.
*/
/*
* Returns the depth for the given index of graphics configurations.
*/
/*
* Returns the colormap for the given index of graphics configurations.
*/
// Whether or not double-buffering extension is supported
public static native boolean isDBESupported();
// Callback for adding a new double buffer visual into our set
}
// Enumerates all visuals that support double buffering
/**
* Returns the default graphics configuration
* associated with this graphics device.
*/
if (defaultConfig == null) {
synchronized (configLock) {
}
}
return defaultConfig;
}
private void makeDefaultConfiguration() {
if (defaultConfig == null) {
if (X11GraphicsEnvironment.isGLXAvailable()) {
if (X11GraphicsEnvironment.isGLXVerbose()) {
if (defaultConfig != null) {
} else {
}
screen);
}
}
if (defaultConfig == null) {
boolean doubleBuffer = false;
doubleBufferVisuals = new HashSet();
}
if (X11GraphicsEnvironment.isXRenderAvailable()) {
if (X11GraphicsEnvironment.isXRenderVerbose()) {
}
} else {
}
}
}
}
private static native boolean initXrandrExtension();
int displayMode);
/**
* Returns true only if:
* - the Xrandr extension is present
* - the necessary Xrandr functions were loaded successfully
* - XINERAMA is not enabled
*/
private static synchronized boolean isXrandrExtensionSupported() {
if (xrandrExtSupported == null) {
}
return xrandrExtSupported.booleanValue();
}
public boolean isFullScreenSupported() {
// REMIND: for now we will only allow fullscreen exclusive mode
// on the primary screen; we could change this behavior slightly
// in the future by allowing only one screen to be in fullscreen
// exclusive mode at any given time...
if (fsAvailable) {
if (fullScreenExclusivePermission == null) {
new AWTPermission("fullScreenExclusive");
}
try {
} catch (SecurityException e) {
return false;
}
}
}
return fsAvailable;
}
public boolean isDisplayChangeSupported() {
}
}
}
peer.setFullScreenExclusiveModeState(false);
}
}
if (w == old) {
return;
}
boolean fsSupported = isFullScreenSupported();
// enter windowed mode (and restore original display mode)
}
super.setFullScreenWindow(w);
if (fsSupported && w != null) {
// save original display mode
if (origDisplayMode == null) {
}
// enter fullscreen mode
}
}
}
if (isFullScreenSupported()) {
return getCurrentDisplayMode(screen);
} else {
if (origDisplayMode == null) {
}
return origDisplayMode;
}
}
if (!isFullScreenSupported()) {
return super.getDisplayModes();
}
}
if (!isDisplayChangeSupported()) {
super.setDisplayMode(dm);
return;
}
Window w = getFullScreenWindow();
if (w == null) {
throw new IllegalStateException("Must be in fullscreen mode " +
"in order to set display mode");
}
return;
}
{
throw new IllegalArgumentException("Invalid display mode");
}
if (!shutdownHookRegistered) {
// register a shutdown hook so that we return to the
// original DisplayMode when the VM exits (if the application
// is already in the original DisplayMode at that time, this
// hook will have no effect)
shutdownHookRegistered = true;
}
public void run() {
}
}
};
return null;
}
};
}
// switch to the new DisplayMode
dm.getRefreshRate());
// update bounds of the fullscreen window
// configDisplayMode() is synchronous, so the display change will be
// complete by the time we get here (and it is therefore safe to call
// displayChanged() now)
}
if (!isDisplayChangeSupported()) {
return null;
}
{
return mode;
}
}
return null;
}
/**
* From the DisplayChangedListener interface; called from
* X11GraphicsEnvironment when the display mode has been changed.
*/
public synchronized void displayChanged() {
// reset the list of configs (and default config)
// reset the native data structures associated with this device (they
// will be reinitialized when the GraphicsConfigs are configured)
// pass on to all top-level windows on this screen
}
/**
* From the DisplayChangedListener interface; devices do not need
* to react to this event.
*/
public void paletteChanged() {
}
/**
* Add a DisplayChangeListener to be notified when the display settings
* are changed. Typically, only top-level containers need to be added
* to X11GraphicsDevice.
*/
}
/**
* Remove a DisplayChangeListener from this X11GraphicsDevice.
*/
}
}
}