home *** CD-ROM | disk | FTP | other *** search
- package sun.awt;
-
- import java.awt.Component;
- import java.awt.GraphicsConfiguration;
- import java.awt.GraphicsDevice;
- import java.awt.peer.ComponentPeer;
- import java.lang.ref.Reference;
- import java.lang.ref.WeakReference;
- import java.util.Enumeration;
- import java.util.Vector;
-
- public class Win32GraphicsDevice extends GraphicsDevice {
- int screen;
- GraphicsConfiguration[] configs;
- GraphicsConfiguration defaultConfig;
- int defaultPixID = -1;
- private Vector nonDefaultGCs;
-
- public Win32GraphicsDevice(int var1) {
- this.screen = var1;
- }
-
- public int getType() {
- return 0;
- }
-
- public int getScreen() {
- return this.screen;
- }
-
- public String getIDstring() {
- return "\\Display" + this.screen;
- }
-
- public GraphicsConfiguration[] getConfigurations() {
- if (this.configs == null) {
- int var1 = this.getMaxConfigs(this.screen);
- this.defaultPixID = this.getDefaultPixID(this.screen);
- Vector var2 = new Vector(var1);
- if (this.defaultPixID == 0) {
- this.defaultConfig = Win32GraphicsConfig.getConfig(this, this.defaultPixID);
- var2.addElement(this.defaultConfig);
- } else {
- for(int var3 = 1; var3 <= var1; ++var3) {
- if (this.isPixFmtSupported(var3, this.screen)) {
- if (var3 == this.defaultPixID) {
- this.defaultConfig = Win32GraphicsConfig.getConfig(this, var3);
- var2.addElement(this.defaultConfig);
- } else {
- var2.addElement(Win32GraphicsConfig.getConfig(this, var3));
- }
- }
- }
- }
-
- this.configs = new GraphicsConfiguration[var2.size()];
- var2.copyInto(this.configs);
- }
-
- return this.configs;
- }
-
- protected native int getMaxConfigs(int var1);
-
- protected native boolean isPixFmtSupported(int var1, int var2);
-
- protected native int getDefaultPixID(int var1);
-
- public GraphicsConfiguration getDefaultConfiguration() {
- if (this.defaultConfig == null) {
- this.defaultPixID = this.getDefaultPixID(this.screen);
- this.defaultConfig = Win32GraphicsConfig.getConfig(this, this.defaultPixID);
- }
-
- return this.defaultConfig;
- }
-
- public String toString() {
- return "Win32GraphicsDevice[screen=" + this.screen + "]";
- }
-
- public void displayModeChanged() {
- this.defaultConfig = null;
- this.defaultPixID = this.getDefaultPixID(this.screen);
- this.configs = null;
- this.invalidateGCs();
- }
-
- public synchronized void addNonDefaultGC(WeakReference var1) {
- if (((Reference)var1).get() instanceof Component) {
- if (this.nonDefaultGCs == null) {
- this.nonDefaultGCs = new Vector(1);
- }
-
- this.nonDefaultGCs.addElement(var1);
- }
-
- }
-
- private void invalidateGCs() {
- if (this.nonDefaultGCs != null) {
- Enumeration var5 = this.nonDefaultGCs.elements();
-
- while(var5.hasMoreElements()) {
- WeakReference var1 = (WeakReference)var5.nextElement();
- Object var2 = ((Reference)var1).get();
- if (var2 != null && var2 instanceof Component) {
- Component var3 = (Component)var2;
- this.resetComponentGC(var3);
- ComponentPeer var4 = var3.getPeer();
- if (var4 != null) {
- this.resetPeerGC(var4);
- }
- }
- }
- }
-
- }
-
- private native void resetComponentGC(Component var1);
-
- private native void resetPeerGC(ComponentPeer var1);
- }
-