1135 focusLog.fine("the window is not focusable"); 1136 return; 1137 } 1138 if (becomesFocused) { 1139 synchronized (getPeerTreeLock()) { 1140 if (blocker != null) { 1141 if (focusLog.isLoggable(PlatformLogger.FINEST)) { 1142 focusLog.finest("the window is blocked by " + blocker); 1143 } 1144 return; 1145 } 1146 } 1147 } 1148 1149 // Note, the method is not called: 1150 // - when the opposite (gaining focus) window is an owned/owner window. 1151 // - for a simple window in any case. 1152 if (!becomesFocused && 1153 (isGrabbing() || getOwnerFrameDialog(grabbingWindow) == this)) 1154 { 1155 focusLog.fine("ungrabbing on " + grabbingWindow); 1156 // ungrab a simple window if its owner looses activation. 1157 grabbingWindow.ungrab(); 1158 } 1159 1160 KeyboardFocusManagerPeer kfmPeer = LWKeyboardFocusManagerPeer.getInstance(); 1161 kfmPeer.setCurrentFocusedWindow(becomesFocused ? getTarget() : null); 1162 1163 int eventID = becomesFocused ? WindowEvent.WINDOW_GAINED_FOCUS : WindowEvent.WINDOW_LOST_FOCUS; 1164 WindowEvent windowEvent = new TimedWindowEvent(getTarget(), eventID, opposite, System.currentTimeMillis()); 1165 1166 // TODO: wrap in SequencedEvent 1167 postEvent(windowEvent); 1168 } 1169 1170 static LWWindowPeer getOwnerFrameDialog(LWWindowPeer peer) { 1171 Window owner = (peer != null ? peer.getTarget().getOwner() : null); 1172 while (owner != null && !(owner instanceof Frame || owner instanceof Dialog)) { 1173 owner = owner.getOwner(); 1174 } 1175 return owner != null ? (LWWindowPeer)owner.getPeer() : null; | 1135 focusLog.fine("the window is not focusable"); 1136 return; 1137 } 1138 if (becomesFocused) { 1139 synchronized (getPeerTreeLock()) { 1140 if (blocker != null) { 1141 if (focusLog.isLoggable(PlatformLogger.FINEST)) { 1142 focusLog.finest("the window is blocked by " + blocker); 1143 } 1144 return; 1145 } 1146 } 1147 } 1148 1149 // Note, the method is not called: 1150 // - when the opposite (gaining focus) window is an owned/owner window. 1151 // - for a simple window in any case. 1152 if (!becomesFocused && 1153 (isGrabbing() || getOwnerFrameDialog(grabbingWindow) == this)) 1154 { 1155 if (focusLog.isLoggable(PlatformLogger.FINE)) { 1156 focusLog.fine("ungrabbing on " + grabbingWindow); 1157 } 1158 // ungrab a simple window if its owner looses activation. 1159 grabbingWindow.ungrab(); 1160 } 1161 1162 KeyboardFocusManagerPeer kfmPeer = LWKeyboardFocusManagerPeer.getInstance(); 1163 kfmPeer.setCurrentFocusedWindow(becomesFocused ? getTarget() : null); 1164 1165 int eventID = becomesFocused ? WindowEvent.WINDOW_GAINED_FOCUS : WindowEvent.WINDOW_LOST_FOCUS; 1166 WindowEvent windowEvent = new TimedWindowEvent(getTarget(), eventID, opposite, System.currentTimeMillis()); 1167 1168 // TODO: wrap in SequencedEvent 1169 postEvent(windowEvent); 1170 } 1171 1172 static LWWindowPeer getOwnerFrameDialog(LWWindowPeer peer) { 1173 Window owner = (peer != null ? peer.getTarget().getOwner() : null); 1174 while (owner != null && !(owner instanceof Frame || owner instanceof Dialog)) { 1175 owner = owner.getOwner(); 1176 } 1177 return owner != null ? (LWWindowPeer)owner.getPeer() : null; |