615 } |
615 } |
616 } |
616 } |
617 |
617 |
618 public void handleWindowFocusIn_Dispatch() { |
618 public void handleWindowFocusIn_Dispatch() { |
619 if (EventQueue.isDispatchThread()) { |
619 if (EventQueue.isDispatchThread()) { |
620 XKeyboardFocusManagerPeer.setCurrentNativeFocusedWindow((Window) target); |
620 XKeyboardFocusManagerPeer.getInstance().setCurrentFocusedWindow((Window) target); |
621 WindowEvent we = new WindowEvent((Window)target, WindowEvent.WINDOW_GAINED_FOCUS); |
621 WindowEvent we = new WindowEvent((Window)target, WindowEvent.WINDOW_GAINED_FOCUS); |
622 SunToolkit.setSystemGenerated(we); |
622 SunToolkit.setSystemGenerated(we); |
623 target.dispatchEvent(we); |
623 target.dispatchEvent(we); |
624 } |
624 } |
625 } |
625 } |
626 |
626 |
627 public void handleWindowFocusInSync(long serial) { |
627 public void handleWindowFocusInSync(long serial) { |
628 WindowEvent we = new WindowEvent((Window)target, WindowEvent.WINDOW_GAINED_FOCUS); |
628 WindowEvent we = new WindowEvent((Window)target, WindowEvent.WINDOW_GAINED_FOCUS); |
629 XKeyboardFocusManagerPeer.setCurrentNativeFocusedWindow((Window) target); |
629 XKeyboardFocusManagerPeer.getInstance().setCurrentFocusedWindow((Window) target); |
630 sendEvent(we); |
630 sendEvent(we); |
631 } |
631 } |
632 // NOTE: This method may be called by privileged threads. |
632 // NOTE: This method may be called by privileged threads. |
633 // DO NOT INVOKE CLIENT CODE ON THIS THREAD! |
633 // DO NOT INVOKE CLIENT CODE ON THIS THREAD! |
634 public void handleWindowFocusIn(long serial) { |
634 public void handleWindowFocusIn(long serial) { |
635 WindowEvent we = new WindowEvent((Window)target, WindowEvent.WINDOW_GAINED_FOCUS); |
635 WindowEvent we = new WindowEvent((Window)target, WindowEvent.WINDOW_GAINED_FOCUS); |
636 /* wrap in Sequenced, then post*/ |
636 /* wrap in Sequenced, then post*/ |
637 XKeyboardFocusManagerPeer.setCurrentNativeFocusedWindow((Window) target); |
637 XKeyboardFocusManagerPeer.getInstance().setCurrentFocusedWindow((Window) target); |
638 postEvent(wrapInSequenced((AWTEvent) we)); |
638 postEvent(wrapInSequenced((AWTEvent) we)); |
639 } |
639 } |
640 |
640 |
641 // NOTE: This method may be called by privileged threads. |
641 // NOTE: This method may be called by privileged threads. |
642 // DO NOT INVOKE CLIENT CODE ON THIS THREAD! |
642 // DO NOT INVOKE CLIENT CODE ON THIS THREAD! |
643 public void handleWindowFocusOut(Window oppositeWindow, long serial) { |
643 public void handleWindowFocusOut(Window oppositeWindow, long serial) { |
644 WindowEvent we = new WindowEvent((Window)target, WindowEvent.WINDOW_LOST_FOCUS, oppositeWindow); |
644 WindowEvent we = new WindowEvent((Window)target, WindowEvent.WINDOW_LOST_FOCUS, oppositeWindow); |
645 XKeyboardFocusManagerPeer.setCurrentNativeFocusedWindow(null); |
645 XKeyboardFocusManagerPeer.getInstance().setCurrentFocusedWindow(null); |
646 XKeyboardFocusManagerPeer.setCurrentNativeFocusOwner(null); |
646 XKeyboardFocusManagerPeer.getInstance().setCurrentFocusOwner(null); |
647 /* wrap in Sequenced, then post*/ |
647 /* wrap in Sequenced, then post*/ |
648 postEvent(wrapInSequenced((AWTEvent) we)); |
648 postEvent(wrapInSequenced((AWTEvent) we)); |
649 } |
649 } |
650 public void handleWindowFocusOutSync(Window oppositeWindow, long serial) { |
650 public void handleWindowFocusOutSync(Window oppositeWindow, long serial) { |
651 WindowEvent we = new WindowEvent((Window)target, WindowEvent.WINDOW_LOST_FOCUS, oppositeWindow); |
651 WindowEvent we = new WindowEvent((Window)target, WindowEvent.WINDOW_LOST_FOCUS, oppositeWindow); |
652 XKeyboardFocusManagerPeer.setCurrentNativeFocusedWindow(null); |
652 XKeyboardFocusManagerPeer.getInstance().setCurrentFocusedWindow(null); |
653 XKeyboardFocusManagerPeer.setCurrentNativeFocusOwner(null); |
653 XKeyboardFocusManagerPeer.getInstance().setCurrentFocusOwner(null); |
654 sendEvent(we); |
654 sendEvent(we); |
655 } |
655 } |
656 |
656 |
657 /* --- DisplayChangedListener Stuff --- */ |
657 /* --- DisplayChangedListener Stuff --- */ |
658 |
658 |
1823 public boolean requestWindowFocus(long time, boolean timeProvided) { |
1823 public boolean requestWindowFocus(long time, boolean timeProvided) { |
1824 focusLog.fine("Request for window focus"); |
1824 focusLog.fine("Request for window focus"); |
1825 // If this is Frame or Dialog we can't assure focus request success - but we still can try |
1825 // If this is Frame or Dialog we can't assure focus request success - but we still can try |
1826 // If this is Window and its owner Frame is active we can be sure request succedded. |
1826 // If this is Window and its owner Frame is active we can be sure request succedded. |
1827 Window ownerWindow = XWindowPeer.getDecoratedOwner((Window)target); |
1827 Window ownerWindow = XWindowPeer.getDecoratedOwner((Window)target); |
1828 Window focusedWindow = XKeyboardFocusManagerPeer.getCurrentNativeFocusedWindow(); |
1828 Window focusedWindow = XKeyboardFocusManagerPeer.getInstance().getCurrentFocusedWindow(); |
1829 Window activeWindow = XWindowPeer.getDecoratedOwner(focusedWindow); |
1829 Window activeWindow = XWindowPeer.getDecoratedOwner(focusedWindow); |
1830 |
1830 |
1831 if (isWMStateNetHidden()) { |
1831 if (isWMStateNetHidden()) { |
1832 focusLog.fine("The window is unmapped, so rejecting the request"); |
1832 focusLog.fine("The window is unmapped, so rejecting the request"); |
1833 return false; |
1833 return false; |