129 switch (e.get_type()) { 130 case XConstants.FocusIn: 131 case XConstants.FocusOut: 132 return true; 133 } 134 } 135 return super.isEventDisabled(e); 136 } 137 138 public void handleConfigureNotifyEvent(XEvent xev) 139 { 140 assert (SunToolkit.isAWTLockHeldByCurrentThread()); 141 XConfigureEvent xe = xev.get_xconfigure(); 142 if (xembedLog.isLoggable(PlatformLogger.Level.FINE)) { 143 xembedLog.fine(xe.toString()); 144 } 145 146 // fix for 5063031 147 // if we use super.handleConfigureNotifyEvent() we would get wrong 148 // size and position because embedded frame really is NOT a decorated one 149 checkIfOnNewScreen(toGlobal(new Rectangle(xe.get_x(), 150 xe.get_y(), 151 xe.get_width(), 152 xe.get_height()))); 153 154 Rectangle oldBounds = getBounds(); 155 156 synchronized (getStateLock()) { 157 x = xe.get_x(); 158 y = xe.get_y(); 159 width = xe.get_width(); 160 height = xe.get_height(); 161 162 dimensions.setClientSize(width, height); 163 dimensions.setLocation(x, y); 164 } 165 166 if (!getLocation().equals(oldBounds.getLocation())) { 167 handleMoved(dimensions); 168 } 169 reconfigureContentWindow(dimensions); 170 } 171 172 protected void traverseOutForward() { 173 if (embedder != null && embedder.isActive()) { 174 if (embedder.isApplicationActive()) { 175 xembedLog.fine("Traversing out Forward"); 176 embedder.traverseOutForward(); 177 } 178 } 179 } 180 198 } 199 200 // don't use getBounds() inherited from XDecoratedPeer 201 public Rectangle getBounds() { 202 return new Rectangle(x, y, width, height); 203 } 204 205 public void setBoundsPrivate(int x, int y, int width, int height) { 206 setBounds(x, y, width, height, SET_BOUNDS | NO_EMBEDDED_CHECK); 207 } 208 209 public Rectangle getBoundsPrivate() { 210 int x = 0, y = 0; 211 int w = 0, h = 0; 212 XWindowAttributes attr = new XWindowAttributes(); 213 214 XToolkit.awtLock(); 215 try { 216 XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(), 217 getWindow(), attr.pData); 218 x = attr.get_x(); 219 y = attr.get_y(); 220 w = attr.get_width(); 221 h = attr.get_height(); 222 } finally { 223 XToolkit.awtUnlock(); 224 } 225 attr.dispose(); 226 227 return new Rectangle(x, y, w, h); 228 } 229 void registerAccelerator(AWTKeyStroke stroke) { 230 if (stroke == null) return; 231 strokes.add(stroke); 232 if (embedder != null && embedder.isActive()) { 233 embedder.registerAccelerator(stroke, strokes.size()-1); 234 } 235 } 236 237 void unregisterAccelerator(AWTKeyStroke stroke) { 238 if (stroke == null) return; 239 if (embedder != null && embedder.isActive()) { 240 int index = strokes.indexOf(stroke); 241 embedder.unregisterAccelerator(index); 259 void notifyStopped() { 260 if (embedder != null && embedder.isActive()) { 261 for (int i = strokes.size() - 1; i >= 0; i--) { 262 embedder.unregisterAccelerator(i); 263 } 264 } 265 } 266 267 long getFocusTargetWindow() { 268 return getWindow(); 269 } 270 271 boolean isXEmbedActive() { 272 return embedder != null && embedder.isActive(); 273 } 274 275 public int getAbsoluteX() 276 { 277 Point absoluteLoc = XlibUtil.translateCoordinates(getWindow(), 278 XToolkit.getDefaultRootWindow(), 279 new Point(0, 0)); 280 return absoluteLoc != null ? absoluteLoc.x : 0; 281 } 282 283 public int getAbsoluteY() 284 { 285 Point absoluteLoc = XlibUtil.translateCoordinates(getWindow(), 286 XToolkit.getDefaultRootWindow(), 287 new Point(0, 0)); 288 return absoluteLoc != null ? absoluteLoc.y : 0; 289 } 290 291 public int getWidth() { 292 return width; 293 } 294 public int getHeight() { 295 return height; 296 } 297 298 public Dimension getSize() { 299 return new Dimension(width, height); 300 } 301 302 // override XWindowPeer's method to let the embedded frame to block 303 // the containing window 304 public void setModalBlocked(Dialog blocker, boolean blocked) { 305 super.setModalBlocked(blocker, blocked); 306 307 EmbeddedFrame frame = (EmbeddedFrame)target; | 129 switch (e.get_type()) { 130 case XConstants.FocusIn: 131 case XConstants.FocusOut: 132 return true; 133 } 134 } 135 return super.isEventDisabled(e); 136 } 137 138 public void handleConfigureNotifyEvent(XEvent xev) 139 { 140 assert (SunToolkit.isAWTLockHeldByCurrentThread()); 141 XConfigureEvent xe = xev.get_xconfigure(); 142 if (xembedLog.isLoggable(PlatformLogger.Level.FINE)) { 143 xembedLog.fine(xe.toString()); 144 } 145 146 // fix for 5063031 147 // if we use super.handleConfigureNotifyEvent() we would get wrong 148 // size and position because embedded frame really is NOT a decorated one 149 checkIfOnNewScreen(toGlobal(new Rectangle(scaleDown(xe.get_x()), 150 scaleDown(xe.get_y()), 151 scaleDown(xe.get_width()), 152 scaleDown(xe.get_height())))); 153 154 Rectangle oldBounds = getBounds(); 155 156 synchronized (getStateLock()) { 157 x = scaleDown(xe.get_x()); 158 y = scaleDown(xe.get_y()); 159 width = scaleDown(xe.get_width()); 160 height = scaleDown(xe.get_height()); 161 162 dimensions.setClientSize(width, height); 163 dimensions.setLocation(x, y); 164 } 165 166 if (!getLocation().equals(oldBounds.getLocation())) { 167 handleMoved(dimensions); 168 } 169 reconfigureContentWindow(dimensions); 170 } 171 172 protected void traverseOutForward() { 173 if (embedder != null && embedder.isActive()) { 174 if (embedder.isApplicationActive()) { 175 xembedLog.fine("Traversing out Forward"); 176 embedder.traverseOutForward(); 177 } 178 } 179 } 180 198 } 199 200 // don't use getBounds() inherited from XDecoratedPeer 201 public Rectangle getBounds() { 202 return new Rectangle(x, y, width, height); 203 } 204 205 public void setBoundsPrivate(int x, int y, int width, int height) { 206 setBounds(x, y, width, height, SET_BOUNDS | NO_EMBEDDED_CHECK); 207 } 208 209 public Rectangle getBoundsPrivate() { 210 int x = 0, y = 0; 211 int w = 0, h = 0; 212 XWindowAttributes attr = new XWindowAttributes(); 213 214 XToolkit.awtLock(); 215 try { 216 XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(), 217 getWindow(), attr.pData); 218 x = scaleDown(attr.get_x()); 219 y = scaleDown(attr.get_y()); 220 w = scaleDown(attr.get_width()); 221 h = scaleDown(attr.get_height()); 222 } finally { 223 XToolkit.awtUnlock(); 224 } 225 attr.dispose(); 226 227 return new Rectangle(x, y, w, h); 228 } 229 void registerAccelerator(AWTKeyStroke stroke) { 230 if (stroke == null) return; 231 strokes.add(stroke); 232 if (embedder != null && embedder.isActive()) { 233 embedder.registerAccelerator(stroke, strokes.size()-1); 234 } 235 } 236 237 void unregisterAccelerator(AWTKeyStroke stroke) { 238 if (stroke == null) return; 239 if (embedder != null && embedder.isActive()) { 240 int index = strokes.indexOf(stroke); 241 embedder.unregisterAccelerator(index); 259 void notifyStopped() { 260 if (embedder != null && embedder.isActive()) { 261 for (int i = strokes.size() - 1; i >= 0; i--) { 262 embedder.unregisterAccelerator(i); 263 } 264 } 265 } 266 267 long getFocusTargetWindow() { 268 return getWindow(); 269 } 270 271 boolean isXEmbedActive() { 272 return embedder != null && embedder.isActive(); 273 } 274 275 public int getAbsoluteX() 276 { 277 Point absoluteLoc = XlibUtil.translateCoordinates(getWindow(), 278 XToolkit.getDefaultRootWindow(), 279 new Point(0, 0), getScale()); 280 return absoluteLoc != null ? absoluteLoc.x : 0; 281 } 282 283 public int getAbsoluteY() 284 { 285 Point absoluteLoc = XlibUtil.translateCoordinates(getWindow(), 286 XToolkit.getDefaultRootWindow(), 287 new Point(0, 0), getScale()); 288 return absoluteLoc != null ? absoluteLoc.y : 0; 289 } 290 291 public int getWidth() { 292 return width; 293 } 294 public int getHeight() { 295 return height; 296 } 297 298 public Dimension getSize() { 299 return new Dimension(width, height); 300 } 301 302 // override XWindowPeer's method to let the embedded frame to block 303 // the containing window 304 public void setModalBlocked(Dialog blocker, boolean blocked) { 305 super.setModalBlocked(blocker, blocked); 306 307 EmbeddedFrame frame = (EmbeddedFrame)target; |