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

Print this page




 128     }
 129 
 130     /**
 131      * When the parent window is activated this method is called for all EmbeddedFrames in it.
 132      *
 133      * For the CEmbeddedFrame which had focus before the deactivation this method triggers
 134      * focus events in the following order:
 135      *  1. WINDOW_ACTIVATED for this EmbeddedFrame
 136      *  2. WINDOW_GAINED_FOCUS for this EmbeddedFrame
 137      *  3. FOCUS_GAINED for the most recent focus owner in this EmbeddedFrame
 138      *
 139      * The caller must not requestFocus on the EmbeddedFrame together with calling this method.
 140      *
 141      * @param parentWindowActive true if the window is activated, false otherwise
 142      */
 143     // handleWindowFocusEvent is called for all applets, when the browser
 144     // becomes active/inactive. This event should be filtered out for
 145     // non-focused applet. This method can be called from different threads.
 146     public void handleWindowFocusEvent(boolean parentWindowActive) {
 147         this.parentWindowActive = parentWindowActive;










 148         // ignore focus "lost" native request as it may mistakenly
 149         // deactivate active window (see 8001161)
 150         if (focusedWindow == this && parentWindowActive) {
 151             responder.handleWindowFocusEvent(parentWindowActive, null);
 152         }
 153     }
 154 
 155     public boolean isParentWindowActive() {
 156         return parentWindowActive;
 157     }
 158 }


 128     }
 129 
 130     /**
 131      * When the parent window is activated this method is called for all EmbeddedFrames in it.
 132      *
 133      * For the CEmbeddedFrame which had focus before the deactivation this method triggers
 134      * focus events in the following order:
 135      *  1. WINDOW_ACTIVATED for this EmbeddedFrame
 136      *  2. WINDOW_GAINED_FOCUS for this EmbeddedFrame
 137      *  3. FOCUS_GAINED for the most recent focus owner in this EmbeddedFrame
 138      *
 139      * The caller must not requestFocus on the EmbeddedFrame together with calling this method.
 140      *
 141      * @param parentWindowActive true if the window is activated, false otherwise
 142      */
 143     // handleWindowFocusEvent is called for all applets, when the browser
 144     // becomes active/inactive. This event should be filtered out for
 145     // non-focused applet. This method can be called from different threads.
 146     public void handleWindowFocusEvent(boolean parentWindowActive) {
 147         this.parentWindowActive = parentWindowActive;
 148         // If several applets are running in different browser's windows, it is necessary to
 149         // detect the switching between the parent windows and update focusedWindow accordingly.
 150         synchronized (classLock) {
 151             if (parentWindowActive && focusedWindow != this &&
 152                 (focusedWindow == null || (focusedWindow != null && !focusedWindow.isParentWindowActive()))) {
 153                 // It looks like we have switched to another browser window, let's set focus to
 154                 // the first applet in this window.
 155                 focusedWindow = this;
 156             }
 157         }
 158         // ignore focus "lost" native request as it may mistakenly
 159         // deactivate active window (see 8001161)
 160         if (focusedWindow == this && parentWindowActive) {
 161             responder.handleWindowFocusEvent(parentWindowActive, null);
 162         }
 163     }
 164 
 165     public boolean isParentWindowActive() {
 166         return parentWindowActive;
 167     }
 168 }