src/macosx/classes/sun/lwawt/LWWindowPeer.java

Print this page

        

*** 230,249 **** protected void setVisibleImpl(final boolean visible) { super.setVisibleImpl(visible); // TODO: update graphicsConfig, see 4868278 platformWindow.setVisible(visible); if (isSimpleWindow()) { ! LWKeyboardFocusManagerPeer manager = LWKeyboardFocusManagerPeer. ! getInstance(getAppContext()); if (visible) { if (!getTarget().isAutoRequestFocus()) { return; } else { requestWindowFocus(CausedFocusEvent.Cause.ACTIVATION); } ! } else if (manager.getCurrentFocusedWindow() == getTarget()) { // Transfer focus to the owner. LWWindowPeer owner = getOwnerFrameDialog(LWWindowPeer.this); if (owner != null) { owner.requestWindowFocus(CausedFocusEvent.Cause.ACTIVATION); } --- 230,248 ---- protected void setVisibleImpl(final boolean visible) { super.setVisibleImpl(visible); // TODO: update graphicsConfig, see 4868278 platformWindow.setVisible(visible); if (isSimpleWindow()) { ! KeyboardFocusManagerPeer kfmPeer = LWKeyboardFocusManagerPeer.getInstance(); if (visible) { if (!getTarget().isAutoRequestFocus()) { return; } else { requestWindowFocus(CausedFocusEvent.Cause.ACTIVATION); } ! } else if (kfmPeer.getCurrentFocusedWindow() == getTarget()) { // Transfer focus to the owner. LWWindowPeer owner = getOwnerFrameDialog(LWWindowPeer.this); if (owner != null) { owner.requestWindowFocus(CausedFocusEvent.Cause.ACTIVATION); }
*** 900,922 **** * Called by the delegate when a key is pressed. */ public void dispatchKeyEvent(int id, long when, int modifiers, int keyCode, char keyChar, int keyLocation) { ! LWComponentPeer focusOwner = ! LWKeyboardFocusManagerPeer.getInstance(getAppContext()). ! getFocusOwner(); // Null focus owner may receive key event when // application hides the focused window upon ESC press // (AWT transfers/clears the focus owner) and pending ESC release // may come to already hidden window. This check eliminates NPE. if (focusOwner != null) { KeyEvent event = ! new KeyEvent(focusOwner.getTarget(), id, when, modifiers, keyCode, keyChar, keyLocation); ! focusOwner.postEvent(event); } } // ---- UTILITY METHODS ---- // --- 899,921 ---- * Called by the delegate when a key is pressed. */ public void dispatchKeyEvent(int id, long when, int modifiers, int keyCode, char keyChar, int keyLocation) { ! KeyboardFocusManagerPeer kfmPeer = LWKeyboardFocusManagerPeer.getInstance(); ! Component focusOwner = kfmPeer.getCurrentFocusOwner(); // Null focus owner may receive key event when // application hides the focused window upon ESC press // (AWT transfers/clears the focus owner) and pending ESC release // may come to already hidden window. This check eliminates NPE. if (focusOwner != null) { KeyEvent event = ! new KeyEvent(focusOwner, id, when, modifiers, keyCode, keyChar, keyLocation); ! LWComponentPeer peer = (LWComponentPeer)focusOwner.getPeer(); ! peer.postEvent(event); } } // ---- UTILITY METHODS ---- //
*** 1229,1242 **** return; } } } ! LWKeyboardFocusManagerPeer manager = LWKeyboardFocusManagerPeer. ! getInstance(getAppContext()); ! ! Window oppositeWindow = becomesFocused ? manager.getCurrentFocusedWindow() : null; // Note, the method is not called: // - when the opposite (gaining focus) window is an owned/owner window. // - for a simple window in any case. if (!becomesFocused && --- 1228,1239 ---- return; } } } ! KeyboardFocusManagerPeer kfmPeer = LWKeyboardFocusManagerPeer.getInstance(); ! Window oppositeWindow = becomesFocused ? kfmPeer.getCurrentFocusedWindow() : null; // Note, the method is not called: // - when the opposite (gaining focus) window is an owned/owner window. // - for a simple window in any case. if (!becomesFocused &&
*** 1245,1255 **** focusLog.fine("ungrabbing on " + grabbingWindow); // ungrab a simple window if its owner looses activation. grabbingWindow.ungrab(); } ! manager.setFocusedWindow(becomesFocused ? LWWindowPeer.this : null); int eventID = becomesFocused ? WindowEvent.WINDOW_GAINED_FOCUS : WindowEvent.WINDOW_LOST_FOCUS; WindowEvent windowEvent = new WindowEvent(getTarget(), eventID, oppositeWindow); // TODO: wrap in SequencedEvent --- 1242,1252 ---- focusLog.fine("ungrabbing on " + grabbingWindow); // ungrab a simple window if its owner looses activation. grabbingWindow.ungrab(); } ! kfmPeer.setCurrentFocusedWindow(becomesFocused ? getTarget() : null); int eventID = becomesFocused ? WindowEvent.WINDOW_GAINED_FOCUS : WindowEvent.WINDOW_LOST_FOCUS; WindowEvent windowEvent = new WindowEvent(getTarget(), eventID, oppositeWindow); // TODO: wrap in SequencedEvent