src/java.desktop/unix/classes/sun/awt/X11/XBaseWindow.java

Print this page




  62     long window;
  63     boolean visible;
  64     boolean mapped;
  65     boolean embedded;
  66     Rectangle maxBounds;
  67     volatile XBaseWindow parentWindow;
  68 
  69     private boolean disposed;
  70 
  71     private long screen;
  72     private XSizeHints hints;
  73     private XWMHints wmHints;
  74 
  75     static final int MIN_SIZE = 1;
  76     static final int DEF_LOCATION = 1;
  77 
  78     private static XAtom wm_client_leader;
  79 
  80     static enum InitialiseState {
  81         INITIALISING,
  82         NOT_INITIALISED,
  83         INITIALISED,
  84         FAILED_INITIALISATION
  85     };
  86 
  87     private InitialiseState initialising;
  88 
  89     int x;
  90     int y;
  91     int width;
  92     int height;
  93 
  94     void awtLock() {
  95         XToolkit.awtLock();
  96     }
  97 
  98     void awtUnlock() {
  99         XToolkit.awtUnlock();
 100     }
 101 
 102     void awtLockNotifyAll() {


 105 
 106     void awtLockWait() throws InterruptedException {
 107         XToolkit.awtLockWait();
 108     }
 109 
 110     // To prevent errors from overriding obsolete methods
 111     protected final void init(long parentWindow, Rectangle bounds) {}
 112     protected final void preInit() {}
 113     protected final void postInit() {}
 114 
 115     // internal lock for synchronizing state changes and paint calls, initialized in preInit.
 116     // the order with other locks: AWTLock -> stateLock
 117     static class StateLock extends Object { }
 118     protected StateLock state_lock;
 119 
 120     /**
 121      * Called for delayed inits during construction
 122      */
 123     void instantPreInit(XCreateWindowParams params) {
 124         state_lock = new StateLock();
 125         initialising = InitialiseState.NOT_INITIALISED;
 126     }
 127 
 128     /**
 129      * Called before window creation, descendants should override to initialize the data,
 130      * initialize params.
 131      */
 132     void preInit(XCreateWindowParams params) {
 133         state_lock = new StateLock();
 134         initialising = InitialiseState.NOT_INITIALISED;
 135         embedded = Boolean.TRUE.equals(params.get(EMBEDDED));
 136         visible = Boolean.TRUE.equals(params.get(VISIBLE));
 137 
 138         Object parent = params.get(PARENT);
 139         if (parent instanceof XBaseWindow) {
 140             parentWindow = (XBaseWindow)parent;
 141         } else {
 142             Long parentWindowID = (Long)params.get(PARENT_WINDOW);
 143             if (parentWindowID != null) {
 144                 parentWindow = XToolkit.windowToXWindow(parentWindowID);
 145             }
 146         }
 147 
 148         Long eventMask = (Long)params.get(EVENT_MASK);
 149         if (eventMask != null) {
 150             long mask = eventMask.longValue();
 151             mask |= XConstants.SubstructureNotifyMask;
 152             params.put(EVENT_MASK, mask);
 153         }
 154 


 206             awtLockNotifyAll();
 207             awtUnlock();
 208         }
 209     }
 210 
 211     public boolean checkInitialised() {
 212         awtLock();
 213         try {
 214             switch (initialising) {
 215               case INITIALISED:
 216                   return true;
 217               case INITIALISING:
 218                   try {
 219                       while (initialising != InitialiseState.INITIALISED) {
 220                           awtLockWait();
 221                       }
 222                   } catch (InterruptedException ie) {
 223                       return false;
 224                   }
 225                   return true;
 226               case NOT_INITIALISED:
 227               case FAILED_INITIALISATION:
 228                   return false;
 229               default:
 230                   return false;
 231             }
 232         } finally {
 233             awtUnlock();
 234         }
 235     }
 236 
 237     /*
 238      * Creates an invisible InputOnly window without an associated Component.
 239      */
 240     XBaseWindow() {
 241         this(new XCreateWindowParams());
 242     }
 243 
 244     /**
 245      * Creates normal child window
 246      */




  62     long window;
  63     boolean visible;
  64     boolean mapped;
  65     boolean embedded;
  66     Rectangle maxBounds;
  67     volatile XBaseWindow parentWindow;
  68 
  69     private boolean disposed;
  70 
  71     private long screen;
  72     private XSizeHints hints;
  73     private XWMHints wmHints;
  74 
  75     static final int MIN_SIZE = 1;
  76     static final int DEF_LOCATION = 1;
  77 
  78     private static XAtom wm_client_leader;
  79 
  80     static enum InitialiseState {
  81         INITIALISING,

  82         INITIALISED,
  83         FAILED_INITIALISATION
  84     };
  85 
  86     private InitialiseState initialising;
  87 
  88     int x;
  89     int y;
  90     int width;
  91     int height;
  92 
  93     void awtLock() {
  94         XToolkit.awtLock();
  95     }
  96 
  97     void awtUnlock() {
  98         XToolkit.awtUnlock();
  99     }
 100 
 101     void awtLockNotifyAll() {


 104 
 105     void awtLockWait() throws InterruptedException {
 106         XToolkit.awtLockWait();
 107     }
 108 
 109     // To prevent errors from overriding obsolete methods
 110     protected final void init(long parentWindow, Rectangle bounds) {}
 111     protected final void preInit() {}
 112     protected final void postInit() {}
 113 
 114     // internal lock for synchronizing state changes and paint calls, initialized in preInit.
 115     // the order with other locks: AWTLock -> stateLock
 116     static class StateLock extends Object { }
 117     protected StateLock state_lock;
 118 
 119     /**
 120      * Called for delayed inits during construction
 121      */
 122     void instantPreInit(XCreateWindowParams params) {
 123         state_lock = new StateLock();

 124     }
 125 
 126     /**
 127      * Called before window creation, descendants should override to initialize the data,
 128      * initialize params.
 129      */
 130     void preInit(XCreateWindowParams params) {
 131         state_lock = new StateLock();

 132         embedded = Boolean.TRUE.equals(params.get(EMBEDDED));
 133         visible = Boolean.TRUE.equals(params.get(VISIBLE));
 134 
 135         Object parent = params.get(PARENT);
 136         if (parent instanceof XBaseWindow) {
 137             parentWindow = (XBaseWindow)parent;
 138         } else {
 139             Long parentWindowID = (Long)params.get(PARENT_WINDOW);
 140             if (parentWindowID != null) {
 141                 parentWindow = XToolkit.windowToXWindow(parentWindowID);
 142             }
 143         }
 144 
 145         Long eventMask = (Long)params.get(EVENT_MASK);
 146         if (eventMask != null) {
 147             long mask = eventMask.longValue();
 148             mask |= XConstants.SubstructureNotifyMask;
 149             params.put(EVENT_MASK, mask);
 150         }
 151 


 203             awtLockNotifyAll();
 204             awtUnlock();
 205         }
 206     }
 207 
 208     public boolean checkInitialised() {
 209         awtLock();
 210         try {
 211             switch (initialising) {
 212               case INITIALISED:
 213                   return true;
 214               case INITIALISING:
 215                   try {
 216                       while (initialising != InitialiseState.INITIALISED) {
 217                           awtLockWait();
 218                       }
 219                   } catch (InterruptedException ie) {
 220                       return false;
 221                   }
 222                   return true;

 223               case FAILED_INITIALISATION:
 224                   return false;
 225               default:
 226                   return false;
 227             }
 228         } finally {
 229             awtUnlock();
 230         }
 231     }
 232 
 233     /*
 234      * Creates an invisible InputOnly window without an associated Component.
 235      */
 236     XBaseWindow() {
 237         this(new XCreateWindowParams());
 238     }
 239 
 240     /**
 241      * Creates normal child window
 242      */