1279 } 1280 return; 1281 } 1282 } 1283 } 1284 1285 // Note, the method is not called: 1286 // - when the opposite (gaining focus) window is an owned/owner window. 1287 // - for a simple window in any case. 1288 if (!becomesFocused && 1289 (isGrabbing() || this.isOneOfOwnersOf(grabbingWindow))) 1290 { 1291 if (focusLog.isLoggable(PlatformLogger.Level.FINE)) { 1292 focusLog.fine("ungrabbing on " + grabbingWindow); 1293 } 1294 // ungrab a simple window if its owner looses activation. 1295 grabbingWindow.ungrab(); 1296 } 1297 1298 KeyboardFocusManagerPeer kfmPeer = LWKeyboardFocusManagerPeer.getInstance(); 1299 kfmPeer.setCurrentFocusedWindow(becomesFocused ? getTarget() : null); 1300 1301 int eventID = becomesFocused ? WindowEvent.WINDOW_GAINED_FOCUS : WindowEvent.WINDOW_LOST_FOCUS; 1302 WindowEvent windowEvent = new TimedWindowEvent(getTarget(), eventID, opposite, System.currentTimeMillis()); 1303 1304 // TODO: wrap in SequencedEvent 1305 postEvent(windowEvent); 1306 } 1307 1308 /* 1309 * Retrieves the owner of the peer. 1310 * Note: this method returns the owner which can be activated, (i.e. the instance 1311 * of Frame or Dialog may be returned). 1312 */ 1313 static LWWindowPeer getOwnerFrameDialog(LWWindowPeer peer) { 1314 Window owner = (peer != null ? peer.getTarget().getOwner() : null); 1315 while (owner != null && !(owner instanceof Frame || owner instanceof Dialog)) { 1316 owner = owner.getOwner(); 1317 } 1318 return owner == null ? null : | 1279 } 1280 return; 1281 } 1282 } 1283 } 1284 1285 // Note, the method is not called: 1286 // - when the opposite (gaining focus) window is an owned/owner window. 1287 // - for a simple window in any case. 1288 if (!becomesFocused && 1289 (isGrabbing() || this.isOneOfOwnersOf(grabbingWindow))) 1290 { 1291 if (focusLog.isLoggable(PlatformLogger.Level.FINE)) { 1292 focusLog.fine("ungrabbing on " + grabbingWindow); 1293 } 1294 // ungrab a simple window if its owner looses activation. 1295 grabbingWindow.ungrab(); 1296 } 1297 1298 KeyboardFocusManagerPeer kfmPeer = LWKeyboardFocusManagerPeer.getInstance(); 1299 1300 if (!becomesFocused && kfmPeer.getCurrentFocusedWindow() != getTarget()) { 1301 // late window focus lost event - ingoring 1302 return; 1303 } 1304 1305 kfmPeer.setCurrentFocusedWindow(becomesFocused ? getTarget() : null); 1306 1307 int eventID = becomesFocused ? WindowEvent.WINDOW_GAINED_FOCUS : WindowEvent.WINDOW_LOST_FOCUS; 1308 WindowEvent windowEvent = new TimedWindowEvent(getTarget(), eventID, opposite, System.currentTimeMillis()); 1309 1310 // TODO: wrap in SequencedEvent 1311 postEvent(windowEvent); 1312 } 1313 1314 /* 1315 * Retrieves the owner of the peer. 1316 * Note: this method returns the owner which can be activated, (i.e. the instance 1317 * of Frame or Dialog may be returned). 1318 */ 1319 static LWWindowPeer getOwnerFrameDialog(LWWindowPeer peer) { 1320 Window owner = (peer != null ? peer.getTarget().getOwner() : null); 1321 while (owner != null && !(owner instanceof Frame || owner instanceof Dialog)) { 1322 owner = owner.getOwner(); 1323 } 1324 return owner == null ? null : |