< prev index next >

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

Print this page




 153         }
 154 
 155         screen = -1;
 156     }
 157 
 158     /**
 159      * Called after window creation, descendants should override to initialize Window
 160      * with class-specific values and perform post-initialization actions.
 161      */
 162     void postInit(XCreateWindowParams params) {
 163         if (log.isLoggable(PlatformLogger.Level.FINE)) {
 164             log.fine("WM name is " + getWMName());
 165         }
 166         updateWMName();
 167 
 168         // Set WM_CLIENT_LEADER property
 169         initClientLeader();
 170     }
 171 
 172     /**
 173      * Creates window using parameters <code>params</code>
 174      * If params contain flag DELAYED doesn't do anything.
 175      * Note: Descendants can call this method to create the window
 176      * at the time different to instance construction.
 177      */
 178     protected final void init(XCreateWindowParams params) {
 179         awtLock();
 180         initialising = InitialiseState.INITIALISING;
 181         awtUnlock();
 182 
 183         try {
 184             if (!Boolean.TRUE.equals(params.get(DELAYED))) {
 185                 preInit(params);
 186                 create(params);
 187                 postInit(params);
 188             } else {
 189                 instantPreInit(params);
 190                 delayedParams = params;
 191             }
 192             awtLock();
 193             initialising = InitialiseState.INITIALISED;


 283         }
 284         params.putIfNull(PARENT_WINDOW, Long.valueOf(XToolkit.getDefaultRootWindow()));
 285         params.putIfNull(BOUNDS, new Rectangle(DEF_LOCATION, DEF_LOCATION, MIN_SIZE, MIN_SIZE));
 286         params.putIfNull(DEPTH, Integer.valueOf((int)XConstants.CopyFromParent));
 287         params.putIfNull(VISUAL, Long.valueOf(XConstants.CopyFromParent));
 288         params.putIfNull(VISUAL_CLASS, Integer.valueOf(XConstants.InputOnly));
 289         params.putIfNull(VALUE_MASK, Long.valueOf(XConstants.CWEventMask));
 290         Rectangle bounds = (Rectangle)params.get(BOUNDS);
 291         bounds.width = Math.max(MIN_SIZE, bounds.width);
 292         bounds.height = Math.max(MIN_SIZE, bounds.height);
 293 
 294         Long eventMaskObj = (Long)params.get(EVENT_MASK);
 295         long eventMask = eventMaskObj != null ? eventMaskObj.longValue() : 0;
 296         // We use our own synthetic grab see XAwtState.getGrabWindow()
 297         // (see X vol. 1, 8.3.3.2)
 298         eventMask |= XConstants.PropertyChangeMask | XConstants.OwnerGrabButtonMask;
 299         params.put(EVENT_MASK, Long.valueOf(eventMask));
 300     }
 301 
 302     /**
 303      * Creates window with parameters specified by <code>params</code>
 304      * @see #init
 305      */
 306     private final void create(XCreateWindowParams params) {
 307         XToolkit.awtLock();
 308         try {
 309             XSetWindowAttributes xattr = new XSetWindowAttributes();
 310             try {
 311                 checkParams(params);
 312 
 313                 long value_mask = ((Long)params.get(VALUE_MASK)).longValue();
 314 
 315                 Long eventMask = (Long)params.get(EVENT_MASK);
 316                 xattr.set_event_mask(eventMask.longValue());
 317                 value_mask |= XConstants.CWEventMask;
 318 
 319                 Long border_pixel = (Long)params.get(BORDER_PIXEL);
 320                 if (border_pixel != null) {
 321                     xattr.set_border_pixel(border_pixel.longValue());
 322                     value_mask |= XConstants.CWBorderPixel;
 323                 }




 153         }
 154 
 155         screen = -1;
 156     }
 157 
 158     /**
 159      * Called after window creation, descendants should override to initialize Window
 160      * with class-specific values and perform post-initialization actions.
 161      */
 162     void postInit(XCreateWindowParams params) {
 163         if (log.isLoggable(PlatformLogger.Level.FINE)) {
 164             log.fine("WM name is " + getWMName());
 165         }
 166         updateWMName();
 167 
 168         // Set WM_CLIENT_LEADER property
 169         initClientLeader();
 170     }
 171 
 172     /**
 173      * Creates window using parameters {@code params}
 174      * If params contain flag DELAYED doesn't do anything.
 175      * Note: Descendants can call this method to create the window
 176      * at the time different to instance construction.
 177      */
 178     protected final void init(XCreateWindowParams params) {
 179         awtLock();
 180         initialising = InitialiseState.INITIALISING;
 181         awtUnlock();
 182 
 183         try {
 184             if (!Boolean.TRUE.equals(params.get(DELAYED))) {
 185                 preInit(params);
 186                 create(params);
 187                 postInit(params);
 188             } else {
 189                 instantPreInit(params);
 190                 delayedParams = params;
 191             }
 192             awtLock();
 193             initialising = InitialiseState.INITIALISED;


 283         }
 284         params.putIfNull(PARENT_WINDOW, Long.valueOf(XToolkit.getDefaultRootWindow()));
 285         params.putIfNull(BOUNDS, new Rectangle(DEF_LOCATION, DEF_LOCATION, MIN_SIZE, MIN_SIZE));
 286         params.putIfNull(DEPTH, Integer.valueOf((int)XConstants.CopyFromParent));
 287         params.putIfNull(VISUAL, Long.valueOf(XConstants.CopyFromParent));
 288         params.putIfNull(VISUAL_CLASS, Integer.valueOf(XConstants.InputOnly));
 289         params.putIfNull(VALUE_MASK, Long.valueOf(XConstants.CWEventMask));
 290         Rectangle bounds = (Rectangle)params.get(BOUNDS);
 291         bounds.width = Math.max(MIN_SIZE, bounds.width);
 292         bounds.height = Math.max(MIN_SIZE, bounds.height);
 293 
 294         Long eventMaskObj = (Long)params.get(EVENT_MASK);
 295         long eventMask = eventMaskObj != null ? eventMaskObj.longValue() : 0;
 296         // We use our own synthetic grab see XAwtState.getGrabWindow()
 297         // (see X vol. 1, 8.3.3.2)
 298         eventMask |= XConstants.PropertyChangeMask | XConstants.OwnerGrabButtonMask;
 299         params.put(EVENT_MASK, Long.valueOf(eventMask));
 300     }
 301 
 302     /**
 303      * Creates window with parameters specified by {@code params}
 304      * @see #init
 305      */
 306     private final void create(XCreateWindowParams params) {
 307         XToolkit.awtLock();
 308         try {
 309             XSetWindowAttributes xattr = new XSetWindowAttributes();
 310             try {
 311                 checkParams(params);
 312 
 313                 long value_mask = ((Long)params.get(VALUE_MASK)).longValue();
 314 
 315                 Long eventMask = (Long)params.get(EVENT_MASK);
 316                 xattr.set_event_mask(eventMask.longValue());
 317                 value_mask |= XConstants.CWEventMask;
 318 
 319                 Long border_pixel = (Long)params.get(BORDER_PIXEL);
 320                 if (border_pixel != null) {
 321                     xattr.set_border_pixel(border_pixel.longValue());
 322                     value_mask |= XConstants.CWBorderPixel;
 323                 }


< prev index next >