summaryrefslogtreecommitdiffstats
path: root/libjava/classpath/gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/classpath/gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java')
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java108
1 files changed, 54 insertions, 54 deletions
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java b/libjava/classpath/gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java
index 58b5834cb73..1c849dfc091 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java
@@ -52,28 +52,28 @@ import gnu.classpath.Pointer;
class GdkScreenGraphicsDevice extends GraphicsDevice
{
private final int native_state = GtkGenericPeer.getUniqueInteger ();
-
+
private Window fullscreenWindow;
-
+
private boolean oldWindowDecorationState;
-
+
private Rectangle oldWindowBounds;
-
+
private Rectangle bounds;
-
+
private GdkGraphicsConfiguration[] configurations;
-
+
/** The <code>GdkGraphicsEnvironment</code> instance that created this
* <code>GdkScreenGraphicsDevice</code>. This is only needed for native
* methods which need to access the 'native_state' field storing a pointer
* to a GdkDisplay object.
- */
+ */
GdkGraphicsEnvironment env;
-
+
/** An identifier that is created by Gdk
*/
String idString;
-
+
/** The display modes supported by this <code>GdkScreenGraphicsDevice</code>.
* If the array is <code>null</code> <code>nativeGetDisplayModes</code> has
* to be called.
@@ -85,7 +85,7 @@ class GdkScreenGraphicsDevice extends GraphicsDevice
* is still <code>null</code> afterwards, the XRandR extension is available
* and display mode changes are possible. If it is non-null XRandR is not
* available, no display mode changes are possible and no other native
- * method must be called.
+ * method must be called.
*/
DisplayMode fixedDisplayMode;
@@ -107,14 +107,14 @@ class GdkScreenGraphicsDevice extends GraphicsDevice
GtkToolkit.initializeGlobalIDs();
initIDs();
}
-
+
static native void initIDs();
-
+
GdkScreenGraphicsDevice (GdkGraphicsEnvironment e)
{
super();
env = e;
-
+
configurations = new GdkGraphicsConfiguration[1];
configurations[0] = new GdkGraphicsConfiguration(this);
}
@@ -126,13 +126,13 @@ class GdkScreenGraphicsDevice extends GraphicsDevice
{
fixedDisplayMode = nativeGetFixedDisplayMode(env);
}
-
+
/** Depending on the availability of the XRandR extension the method returns
* the screens' non-changeable display mode or null, meaning that XRandR can
* handle display mode changes.
*/
native DisplayMode nativeGetFixedDisplayMode(GdkGraphicsEnvironment env);
-
+
public int getType ()
{
// Gdk manages only raster screens.
@@ -143,17 +143,17 @@ class GdkScreenGraphicsDevice extends GraphicsDevice
{
if (idString == null)
idString = nativeGetIDString();
-
+
return idString;
}
-
- private native String nativeGetIDString();
+
+ private native String nativeGetIDString();
public GraphicsConfiguration[] getConfigurations ()
{
return (GraphicsConfiguration[]) configurations.clone();
}
-
+
public GraphicsConfiguration getDefaultConfiguration ()
{
return configurations[0];
@@ -172,7 +172,7 @@ class GdkScreenGraphicsDevice extends GraphicsDevice
{
if (fixedDisplayMode != null)
return fixedDisplayMode;
-
+
synchronized (this)
{
if (displayModes == null)
@@ -181,28 +181,28 @@ class GdkScreenGraphicsDevice extends GraphicsDevice
int index = nativeGetDisplayModeIndex(env);
int rate = nativeGetDisplayModeRate(env);
-
+
return new DisplayMode(displayModes[index].width,
displayModes[index].height,
DisplayMode.BIT_DEPTH_MULTI,
rate);
}
-
+
native int nativeGetDisplayModeIndex(GdkGraphicsEnvironment env);
-
+
native int nativeGetDisplayModeRate(GdkGraphicsEnvironment env);
-
+
public DisplayMode[] getDisplayModes()
{
if (fixedDisplayMode != null)
return new DisplayMode[] { fixedDisplayMode };
-
+
synchronized (this)
{
if (displayModes == null)
displayModes = nativeGetDisplayModes(env);
}
-
+
ArrayList<DisplayMode> list = new ArrayList<DisplayMode>();
for(int i=0;i<displayModes.length;i++)
for(int j=0;j<displayModes[i].rates.length;j++)
@@ -210,10 +210,10 @@ class GdkScreenGraphicsDevice extends GraphicsDevice
displayModes[i].height,
DisplayMode.BIT_DEPTH_MULTI,
displayModes[i].rates[j]));
-
+
return list.toArray(new DisplayMode[list.size()]);
}
-
+
native X11DisplayMode[] nativeGetDisplayModes(GdkGraphicsEnvironment env);
/**
@@ -226,7 +226,7 @@ class GdkScreenGraphicsDevice extends GraphicsDevice
{
return true;
}
-
+
public boolean isDisplayChangeSupported()
{
return fixedDisplayMode == null;
@@ -236,16 +236,16 @@ class GdkScreenGraphicsDevice extends GraphicsDevice
{
if (fixedDisplayMode != null)
throw new UnsupportedOperationException("Cannnot change display mode.");
-
+
if (dm == null)
throw new IllegalArgumentException("DisplayMode must not be null.");
-
+
synchronized (this)
{
if (displayModes == null)
displayModes = nativeGetDisplayModes(env);
}
-
+
for (int i=0; i<displayModes.length; i++)
if (displayModes[i].width == dm.getWidth()
&& displayModes[i].height == dm.getHeight())
@@ -255,19 +255,19 @@ class GdkScreenGraphicsDevice extends GraphicsDevice
nativeSetDisplayMode(env,
i,
(short) dm.getRefreshRate());
-
+
bounds = null;
}
-
+
return;
}
-
+
throw new IllegalArgumentException("Mode not supported by this device.");
}
-
+
native void nativeSetDisplayMode(GdkGraphicsEnvironment env,
int index, short rate);
-
+
/** A class that simply encapsulates the X11 display mode data.
*/
static class X11DisplayMode
@@ -275,16 +275,16 @@ class GdkScreenGraphicsDevice extends GraphicsDevice
short[] rates;
int width;
int height;
-
+
X11DisplayMode(int width, int height, short[] rates)
{
this.width = width;
this.height = height;
this.rates = rates;
}
-
+
}
-
+
public void setFullScreenWindow(Window w)
{
// Bring old fullscreen window back into its original state.
@@ -293,7 +293,7 @@ class GdkScreenGraphicsDevice extends GraphicsDevice
if (fullscreenWindow instanceof Frame)
{
// Decoration state can only be switched when the peer is
- // non-existent. That means we have to dispose the
+ // non-existent. That means we have to dispose the
// Frame.
Frame f = (Frame) fullscreenWindow;
if (oldWindowDecorationState != f.isUndecorated())
@@ -302,13 +302,13 @@ class GdkScreenGraphicsDevice extends GraphicsDevice
f.setUndecorated(oldWindowDecorationState);
}
}
-
+
fullscreenWindow.setBounds(oldWindowBounds);
if (!fullscreenWindow.isVisible())
fullscreenWindow.setVisible(true);
}
-
+
// If applicable remove decoration, then maximize the window and
// bring it to the foreground.
if (w != null)
@@ -323,27 +323,27 @@ class GdkScreenGraphicsDevice extends GraphicsDevice
f.setUndecorated(true);
}
}
-
+
oldWindowBounds = w.getBounds();
-
+
DisplayMode dm = getDisplayMode();
-
+
w.setBounds(0, 0, dm.getWidth(), dm.getHeight());
-
+
if (!w.isVisible())
w.setVisible(true);
-
+
w.requestFocus();
w.toFront();
-
+
}
-
+
fullscreenWindow = w;
}
-
+
public Window getFullScreenWindow()
{
- return fullscreenWindow;
+ return fullscreenWindow;
}
Rectangle getBounds()
@@ -353,10 +353,10 @@ class GdkScreenGraphicsDevice extends GraphicsDevice
if (bounds == null)
bounds = nativeGetBounds();
}
-
+
return bounds;
}
-
+
native Rectangle nativeGetBounds();
}
OpenPOWER on IntegriCloud