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

Print this page

        

*** 143,152 **** --- 143,162 ---- // handleWindowFocusEvent is called for all applets, when the browser // becomes active/inactive. This event should be filtered out for // non-focused applet. This method can be called from different threads. public void handleWindowFocusEvent(boolean parentWindowActive) { this.parentWindowActive = parentWindowActive; + // If several applets are running in different browser's windows, it is necessary to + // detect the switching between the parent windows and update focusedWindow accordingly. + synchronized (classLock) { + if (parentWindowActive && focusedWindow != this && + (focusedWindow == null || (focusedWindow != null && !focusedWindow.isParentWindowActive()))) { + // It looks like we have switched to another browser window, let's set focus to + // the first applet in this window. + focusedWindow = this; + } + } // ignore focus "lost" native request as it may mistakenly // deactivate active window (see 8001161) if (focusedWindow == this && parentWindowActive) { responder.handleWindowFocusEvent(parentWindowActive, null); }