Java Code Examples for java.awt.event.InvocationEvent

The following examples show how to use java.awt.event.InvocationEvent. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: jdk8u_jdk   Source File: LWCToolkit.java    License: GNU General Public License v2.0 6 votes vote down vote up
public static void invokeLater(Runnable event, Component component)
        throws InvocationTargetException {
    final InvocationEvent invocationEvent =
            new InvocationEvent(component != null ? component : Toolkit.getDefaultToolkit(), event);

    if (component != null) {
        final AppContext appContext = SunToolkit.targetToAppContext(component);
        SunToolkit.postEvent(appContext, invocationEvent);

        // 3746956 - flush events from PostEventQueue to prevent them from getting stuck and causing a deadlock
        SunToolkit.flushPendingEvents(appContext);
    } else {
        // This should be the equivalent to EventQueue.invokeAndWait
        ((LWCToolkit)Toolkit.getDefaultToolkit()).getSystemEventQueueForInvokeAndWait().postEvent(invocationEvent);
    }

    final Throwable eventException = invocationEvent.getException();
    if (eventException == null) return;

    if (eventException instanceof UndeclaredThrowableException) {
        throw new InvocationTargetException(((UndeclaredThrowableException)eventException).getUndeclaredThrowable());
    }
    throw new InvocationTargetException(eventException);
}
 
Example 2
Source Project: jdk8u-jdk   Source File: WEmbeddedFrame.java    License: GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("deprecation")
public void synthesizeWindowActivation(final boolean activate) {
    if (!activate || EventQueue.isDispatchThread()) {
        ((WFramePeer)getPeer()).emulateActivation(activate);
    } else {
        // To avoid focus concurrence b/w IE and EmbeddedFrame
        // activation is postponed by means of posting it to EDT.
        Runnable r = new Runnable() {
            public void run() {
                ((WFramePeer)getPeer()).emulateActivation(true);
            }
        };
        WToolkit.postEvent(WToolkit.targetToAppContext(this),
                           new InvocationEvent(this, r));
    }
}
 
Example 3
Source Project: dragonwell8_jdk   Source File: LWCToolkit.java    License: GNU General Public License v2.0 6 votes vote down vote up
public static void invokeLater(Runnable event, Component component)
        throws InvocationTargetException {
    final InvocationEvent invocationEvent =
            new InvocationEvent(component != null ? component : Toolkit.getDefaultToolkit(), event);

    if (component != null) {
        final AppContext appContext = SunToolkit.targetToAppContext(component);
        SunToolkit.postEvent(appContext, invocationEvent);

        // 3746956 - flush events from PostEventQueue to prevent them from getting stuck and causing a deadlock
        SunToolkit.flushPendingEvents(appContext);
    } else {
        // This should be the equivalent to EventQueue.invokeAndWait
        ((LWCToolkit)Toolkit.getDefaultToolkit()).getSystemEventQueueForInvokeAndWait().postEvent(invocationEvent);
    }

    final Throwable eventException = invocationEvent.getException();
    if (eventException == null) return;

    if (eventException instanceof UndeclaredThrowableException) {
        throw new InvocationTargetException(((UndeclaredThrowableException)eventException).getUndeclaredThrowable());
    }
    throw new InvocationTargetException(eventException);
}
 
Example 4
@SuppressWarnings("deprecation")
public void synthesizeWindowActivation(final boolean activate) {
    if (!activate || EventQueue.isDispatchThread()) {
        ((WFramePeer)getPeer()).emulateActivation(activate);
    } else {
        // To avoid focus concurrence b/w IE and EmbeddedFrame
        // activation is postponed by means of posting it to EDT.
        Runnable r = new Runnable() {
            public void run() {
                ((WFramePeer)getPeer()).emulateActivation(true);
            }
        };
        WToolkit.postEvent(WToolkit.targetToAppContext(this),
                           new InvocationEvent(this, r));
    }
}
 
Example 5
public void replaceSurfaceDataLater() {
    Runnable r = new Runnable() {
        @Override
        public void run() {
            // Shouldn't do anything if object is disposed in meanwhile
            // No need for sync as disposeAction in Window is performed
            // on EDT
            if (!isDisposed()) {
                try {
                    replaceSurfaceData();
                } catch (InvalidPipeException e) {
                    // REMIND : what do we do if our surface creation failed?
                }
            }
        }
    };
    Component c = (Component)target;
    // Fix 6255371.
    if (!PaintEventDispatcher.getPaintEventDispatcher().queueSurfaceDataReplacing(c, r)) {
        postEvent(new InvocationEvent(c, r));
    }
}
 
Example 6
Source Project: openjdk-8   Source File: WComponentPeer.java    License: GNU General Public License v2.0 6 votes vote down vote up
public void replaceSurfaceDataLater() {
    Runnable r = new Runnable() {
        public void run() {
            // Shouldn't do anything if object is disposed in meanwhile
            // No need for sync as disposeAction in Window is performed
            // on EDT
            if (!isDisposed()) {
                try {
                    replaceSurfaceData();
                } catch (InvalidPipeException e) {
                    // REMIND : what do we do if our surface creation failed?
                }
            }
        }
    };
    Component c = (Component)target;
    // Fix 6255371.
    if (!PaintEventDispatcher.getPaintEventDispatcher().queueSurfaceDataReplacing(c, r)) {
        postEvent(new InvocationEvent(c, r));
    }
}
 
Example 7
Source Project: TencentKona-8   Source File: LWCToolkit.java    License: GNU General Public License v2.0 6 votes vote down vote up
public static void invokeLater(Runnable event, Component component)
        throws InvocationTargetException {
    final InvocationEvent invocationEvent =
            new InvocationEvent(component != null ? component : Toolkit.getDefaultToolkit(), event);

    if (component != null) {
        final AppContext appContext = SunToolkit.targetToAppContext(component);
        SunToolkit.postEvent(appContext, invocationEvent);

        // 3746956 - flush events from PostEventQueue to prevent them from getting stuck and causing a deadlock
        SunToolkit.flushPendingEvents(appContext);
    } else {
        // This should be the equivalent to EventQueue.invokeAndWait
        ((LWCToolkit)Toolkit.getDefaultToolkit()).getSystemEventQueueForInvokeAndWait().postEvent(invocationEvent);
    }

    final Throwable eventException = invocationEvent.getException();
    if (eventException == null) return;

    if (eventException instanceof UndeclaredThrowableException) {
        throw new InvocationTargetException(((UndeclaredThrowableException)eventException).getUndeclaredThrowable());
    }
    throw new InvocationTargetException(eventException);
}
 
Example 8
Source Project: TencentKona-8   Source File: WEmbeddedFrame.java    License: GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("deprecation")
public void synthesizeWindowActivation(final boolean activate) {
    if (!activate || EventQueue.isDispatchThread()) {
        ((WFramePeer)getPeer()).emulateActivation(activate);
    } else {
        // To avoid focus concurrence b/w IE and EmbeddedFrame
        // activation is postponed by means of posting it to EDT.
        Runnable r = new Runnable() {
            public void run() {
                ((WFramePeer)getPeer()).emulateActivation(true);
            }
        };
        WToolkit.postEvent(WToolkit.targetToAppContext(this),
                           new InvocationEvent(this, r));
    }
}
 
Example 9
public void replaceSurfaceDataLater() {
    Runnable r = new Runnable() {
        public void run() {
            // Shouldn't do anything if object is disposed in meanwhile
            // No need for sync as disposeAction in Window is performed
            // on EDT
            if (!isDisposed()) {
                try {
                    replaceSurfaceData();
                } catch (InvalidPipeException e) {
                    // REMIND : what do we do if our surface creation failed?
                }
            }
        }
    };
    Component c = (Component)target;
    // Fix 6255371.
    if (!PaintEventDispatcher.getPaintEventDispatcher().queueSurfaceDataReplacing(c, r)) {
        postEvent(new InvocationEvent(c, r));
    }
}
 
Example 10
Source Project: jdk8u_jdk   Source File: LWCToolkit.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Checks if there's an active SelectorPerformer corresponding to the invocation's AppContext,
 * adds the invocation to the SelectorPerformer's queue and returns true.
 * Otherwise does nothing and returns false.
 */
public static boolean offer(InvocationEvent invocation) {
    Object source = invocation.getSource();

    SelectorPerformer performer = (source instanceof Component) ?
            getInstance((Component)source) :
            getInstance(Toolkit.getDefaultToolkit().getSystemEventQueue());

    if (performer == null) return false;

    synchronized (performer.invocations) {
        if (!performer.invocations.isEmpty()) {
            performer.invocations.peek().add(invocation);
            return true;
        }
    }
    return false;
}
 
Example 11
Source Project: jdk8u60   Source File: WEmbeddedFrame.java    License: GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("deprecation")
public void synthesizeWindowActivation(final boolean activate) {
    if (!activate || EventQueue.isDispatchThread()) {
        ((WFramePeer)getPeer()).emulateActivation(activate);
    } else {
        // To avoid focus concurrence b/w IE and EmbeddedFrame
        // activation is postponed by means of posting it to EDT.
        Runnable r = new Runnable() {
            public void run() {
                ((WFramePeer)getPeer()).emulateActivation(true);
            }
        };
        WToolkit.postEvent(WToolkit.targetToAppContext(this),
                           new InvocationEvent(this, r));
    }
}
 
Example 12
Source Project: openjdk-jdk8u   Source File: WEmbeddedFrame.java    License: GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("deprecation")
public void synthesizeWindowActivation(final boolean activate) {
    if (!activate || EventQueue.isDispatchThread()) {
        ((WFramePeer)getPeer()).emulateActivation(activate);
    } else {
        // To avoid focus concurrence b/w IE and EmbeddedFrame
        // activation is postponed by means of posting it to EDT.
        Runnable r = new Runnable() {
            public void run() {
                ((WFramePeer)getPeer()).emulateActivation(true);
            }
        };
        WToolkit.postEvent(WToolkit.targetToAppContext(this),
                           new InvocationEvent(this, r));
    }
}
 
Example 13
public static void invokeLater(Runnable event, Component component)
        throws InvocationTargetException {
    final InvocationEvent invocationEvent =
            new InvocationEvent(component != null ? component : Toolkit.getDefaultToolkit(), event);

    if (component != null) {
        final AppContext appContext = SunToolkit.targetToAppContext(component);
        SunToolkit.postEvent(appContext, invocationEvent);

        // 3746956 - flush events from PostEventQueue to prevent them from getting stuck and causing a deadlock
        SunToolkit.flushPendingEvents(appContext);
    } else {
        // This should be the equivalent to EventQueue.invokeAndWait
        ((LWCToolkit)Toolkit.getDefaultToolkit()).getSystemEventQueueForInvokeAndWait().postEvent(invocationEvent);
    }

    final Throwable eventException = invocationEvent.getException();
    if (eventException == null) return;

    if (eventException instanceof UndeclaredThrowableException) {
        throw new InvocationTargetException(((UndeclaredThrowableException)eventException).getUndeclaredThrowable());
    }
    throw new InvocationTargetException(eventException);
}
 
Example 14
@SuppressWarnings("deprecation")
public void synthesizeWindowActivation(final boolean activate) {
    if (!activate || EventQueue.isDispatchThread()) {
        ((WFramePeer)getPeer()).emulateActivation(activate);
    } else {
        // To avoid focus concurrence b/w IE and EmbeddedFrame
        // activation is postponed by means of posting it to EDT.
        Runnable r = new Runnable() {
            public void run() {
                ((WFramePeer)getPeer()).emulateActivation(true);
            }
        };
        WToolkit.postEvent(WToolkit.targetToAppContext(this),
                           new InvocationEvent(this, r));
    }
}
 
Example 15
@SuppressWarnings("deprecation")
public void synthesizeWindowActivation(final boolean activate) {
    if (!activate || EventQueue.isDispatchThread()) {
        ((WFramePeer)getPeer()).emulateActivation(activate);
    } else {
        // To avoid focus concurrence b/w IE and EmbeddedFrame
        // activation is postponed by means of posting it to EDT.
        Runnable r = new Runnable() {
            public void run() {
                ((WFramePeer)getPeer()).emulateActivation(true);
            }
        };
        WToolkit.postEvent(WToolkit.targetToAppContext(this),
                           new InvocationEvent(this, r));
    }
}
 
Example 16
Source Project: openjdk-jdk9   Source File: WEmbeddedFrame.java    License: GNU General Public License v2.0 6 votes vote down vote up
public void synthesizeWindowActivation(final boolean activate) {
    final FramePeer peer = AWTAccessor.getComponentAccessor().getPeer(this);
    if (!activate || EventQueue.isDispatchThread()) {
        peer.emulateActivation(activate);
    } else {
        // To avoid focus concurrence b/w IE and EmbeddedFrame
        // activation is postponed by means of posting it to EDT.
        Runnable r = new Runnable() {
            public void run() {
                peer.emulateActivation(true);
            }
        };
        WToolkit.postEvent(WToolkit.targetToAppContext(this),
                           new InvocationEvent(this, r));
    }
}
 
Example 17
Source Project: openjdk-jdk9   Source File: WComponentPeer.java    License: GNU General Public License v2.0 6 votes vote down vote up
public void replaceSurfaceDataLater() {
    Runnable r = new Runnable() {
        @Override
        public void run() {
            // Shouldn't do anything if object is disposed in meanwhile
            // No need for sync as disposeAction in Window is performed
            // on EDT
            if (!isDisposed()) {
                try {
                    replaceSurfaceData();
                } catch (InvalidPipeException e) {
                    // REMIND : what do we do if our surface creation failed?
                }
            }
        }
    };
    Component c = (Component)target;
    // Fix 6255371.
    if (!PaintEventDispatcher.getPaintEventDispatcher().queueSurfaceDataReplacing(c, r)) {
        postEvent(new InvocationEvent(c, r));
    }
}
 
Example 18
Source Project: jdk8u_jdk   Source File: WEmbeddedFrame.java    License: GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("deprecation")
public void synthesizeWindowActivation(final boolean activate) {
    if (!activate || EventQueue.isDispatchThread()) {
        ((WFramePeer)getPeer()).emulateActivation(activate);
    } else {
        // To avoid focus concurrence b/w IE and EmbeddedFrame
        // activation is postponed by means of posting it to EDT.
        Runnable r = new Runnable() {
            public void run() {
                ((WFramePeer)getPeer()).emulateActivation(true);
            }
        };
        WToolkit.postEvent(WToolkit.targetToAppContext(this),
                           new InvocationEvent(this, r));
    }
}
 
Example 19
Source Project: jdk8u-jdk   Source File: WEmbeddedFrame.java    License: GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("deprecation")
public void synthesizeWindowActivation(final boolean activate) {
    if (!activate || EventQueue.isDispatchThread()) {
        ((WFramePeer)getPeer()).emulateActivation(activate);
    } else {
        // To avoid focus concurrence b/w IE and EmbeddedFrame
        // activation is postponed by means of posting it to EDT.
        Runnable r = new Runnable() {
            public void run() {
                ((WFramePeer)getPeer()).emulateActivation(true);
            }
        };
        WToolkit.postEvent(WToolkit.targetToAppContext(this),
                           new InvocationEvent(this, r));
    }
}
 
Example 20
Source Project: jdk8u-jdk   Source File: WComponentPeer.java    License: GNU General Public License v2.0 6 votes vote down vote up
public void replaceSurfaceDataLater() {
    Runnable r = new Runnable() {
        @Override
        public void run() {
            // Shouldn't do anything if object is disposed in meanwhile
            // No need for sync as disposeAction in Window is performed
            // on EDT
            if (!isDisposed()) {
                try {
                    replaceSurfaceData();
                } catch (InvalidPipeException e) {
                    // REMIND : what do we do if our surface creation failed?
                }
            }
        }
    };
    Component c = (Component)target;
    // Fix 6255371.
    if (!PaintEventDispatcher.getPaintEventDispatcher().queueSurfaceDataReplacing(c, r)) {
        postEvent(new InvocationEvent(c, r));
    }
}
 
Example 21
Source Project: jdk8u-dev-jdk   Source File: WComponentPeer.java    License: GNU General Public License v2.0 6 votes vote down vote up
public void replaceSurfaceDataLater() {
    Runnable r = new Runnable() {
        @Override
        public void run() {
            // Shouldn't do anything if object is disposed in meanwhile
            // No need for sync as disposeAction in Window is performed
            // on EDT
            if (!isDisposed()) {
                try {
                    replaceSurfaceData();
                } catch (InvalidPipeException e) {
                    // REMIND : what do we do if our surface creation failed?
                }
            }
        }
    };
    Component c = (Component)target;
    // Fix 6255371.
    if (!PaintEventDispatcher.getPaintEventDispatcher().queueSurfaceDataReplacing(c, r)) {
        postEvent(new InvocationEvent(c, r));
    }
}
 
Example 22
public void postIfNotPending(Component heavy, InvocationEvent in) {
    boolean shouldPost = false;
    synchronized (this) {
        if (!pending) {
            pending = shouldPost = true;
        }
    }
    if (shouldPost) {
        SunToolkit.postEvent(SunToolkit.targetToAppContext(heavy), in);
    }
}
 
Example 23
Source Project: dragonwell8_jdk   Source File: LWCToolkit.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Kicks an event over to the appropriate eventqueue and waits for it to
 * finish To avoid deadlocking, we manually run the NSRunLoop while waiting
 * Any selector invoked using ThreadUtilities performOnMainThread will be
 * processed in doAWTRunLoop The InvocationEvent will call
 * LWCToolkit.stopAWTRunLoop() when finished, which will stop our manual
 * runloop Does not dispatch native events while in the loop
 */
public static void invokeAndWait(Runnable runnable, Component component)
        throws InvocationTargetException {
    final long mediator = createAWTRunLoopMediator();

    InvocationEvent invocationEvent =
            new InvocationEvent(component != null ? component : Toolkit.getDefaultToolkit(),
                    runnable,
                    () -> {
                        if (mediator != 0) {
                            stopAWTRunLoop(mediator);
                        }
                    },
                    true);

    if (component != null) {
        AppContext appContext = SunToolkit.targetToAppContext(component);
        SunToolkit.postEvent(appContext, invocationEvent);

        // 3746956 - flush events from PostEventQueue to prevent them from getting stuck and causing a deadlock
        SunToolkit.flushPendingEvents(appContext);
    } else {
        // This should be the equivalent to EventQueue.invokeAndWait
        ((LWCToolkit)Toolkit.getDefaultToolkit()).getSystemEventQueueForInvokeAndWait().postEvent(invocationEvent);
    }

    doAWTRunLoop(mediator, false);

    Throwable eventException = invocationEvent.getException();
    if (eventException != null) {
        if (eventException instanceof UndeclaredThrowableException) {
            eventException = ((UndeclaredThrowableException)eventException).getUndeclaredThrowable();
        }
        throw new InvocationTargetException(eventException);
    }
}
 
Example 24
private void showInputMethodMenuOnRequesterEDT(Component requester)
    throws InterruptedException, InvocationTargetException {

    if (requester == null){
        return;
    }

    class AWTInvocationLock {}
    Object lock = new AWTInvocationLock();

    InvocationEvent event =
            new InvocationEvent(requester,
                                new Runnable() {
                                    public void run() {
                                        showInputMethodMenu();
                                    }
                                },
                                lock,
                                true);

    AppContext requesterAppContext = SunToolkit.targetToAppContext(requester);
    synchronized (lock) {
        SunToolkit.postEvent(requesterAppContext, event);
        while (!event.isDispatched()) {
            lock.wait();
        }
    }

    Throwable eventThrowable = event.getThrowable();
    if (eventThrowable != null) {
        throw new InvocationTargetException(eventThrowable);
    }
}
 
Example 25
public void postIfNotPending(Component heavy, InvocationEvent in) {
    boolean shouldPost = false;
    synchronized (this) {
        if (!pending) {
            pending = shouldPost = true;
        }
    }
    if (shouldPost) {
        SunToolkit.postEvent(SunToolkit.targetToAppContext(heavy), in);
    }
}
 
Example 26
private void showInputMethodMenuOnRequesterEDT(Component requester)
    throws InterruptedException, InvocationTargetException {

    if (requester == null){
        return;
    }

    class AWTInvocationLock {}
    Object lock = new AWTInvocationLock();

    InvocationEvent event =
            new InvocationEvent(requester,
                                new Runnable() {
                                    public void run() {
                                        showInputMethodMenu();
                                    }
                                },
                                lock,
                                true);

    AppContext requesterAppContext = SunToolkit.targetToAppContext(requester);
    synchronized (lock) {
        SunToolkit.postEvent(requesterAppContext, event);
        while (!event.isDispatched()) {
            lock.wait();
        }
    }

    Throwable eventThrowable = event.getThrowable();
    if (eventThrowable != null) {
        throw new InvocationTargetException(eventThrowable);
    }
}
 
Example 27
Source Project: TencentKona-8   Source File: LWCToolkit.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Kicks an event over to the appropriate eventqueue and waits for it to
 * finish To avoid deadlocking, we manually run the NSRunLoop while waiting
 * Any selector invoked using ThreadUtilities performOnMainThread will be
 * processed in doAWTRunLoop The InvocationEvent will call
 * LWCToolkit.stopAWTRunLoop() when finished, which will stop our manual
 * runloop Does not dispatch native events while in the loop
 */
public static void invokeAndWait(Runnable runnable, Component component)
        throws InvocationTargetException {
    final long mediator = createAWTRunLoopMediator();

    InvocationEvent invocationEvent =
            new InvocationEvent(component != null ? component : Toolkit.getDefaultToolkit(),
                    runnable,
                    () -> {
                        if (mediator != 0) {
                            stopAWTRunLoop(mediator);
                        }
                    },
                    true);

    if (component != null) {
        AppContext appContext = SunToolkit.targetToAppContext(component);
        SunToolkit.postEvent(appContext, invocationEvent);

        // 3746956 - flush events from PostEventQueue to prevent them from getting stuck and causing a deadlock
        SunToolkit.flushPendingEvents(appContext);
    } else {
        // This should be the equivalent to EventQueue.invokeAndWait
        ((LWCToolkit)Toolkit.getDefaultToolkit()).getSystemEventQueueForInvokeAndWait().postEvent(invocationEvent);
    }

    doAWTRunLoop(mediator, false);

    Throwable eventException = invocationEvent.getException();
    if (eventException != null) {
        if (eventException instanceof UndeclaredThrowableException) {
            eventException = ((UndeclaredThrowableException)eventException).getUndeclaredThrowable();
        }
        throw new InvocationTargetException(eventException);
    }
}
 
Example 28
Source Project: jdk8u-dev-jdk   Source File: WComponentPeer.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void disposeLater() {
    postEvent(new InvocationEvent(target, new Runnable() {
        @Override
        public void run() {
            dispose();
        }
    }));
}
 
Example 29
Source Project: TencentKona-8   Source File: WComponentPeer.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void disposeLater() {
    postEvent(new InvocationEvent(target, new Runnable() {
        @Override
        public void run() {
            dispose();
        }
    }));
}
 
Example 30
Source Project: TencentKona-8   Source File: XDecoratedPeer.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void handleWindowFocusIn(long serial) {
    if (null == actualFocusedWindow) {
        super.handleWindowFocusIn(serial);
    } else {
        /*
         * Fix for 6314575.
         * If this is a result of clicking on one of the Frame's component
         * then 'actualFocusedWindow' shouldn't be focused. A decision of focusing
         * it or not should be made after the appropriate Java mouse event (if any)
         * is handled by the component where 'actualFocusedWindow' value may be reset.
         *
         * The fix is based on the empiric fact consisting in that the component
         * receives native mouse event nearly at the same time the Frame receives
         * WM_TAKE_FOCUS (when FocusIn is generated via XSetInputFocus call) but
         * definetely before the Frame gets FocusIn event (when this method is called).
         */
        postEvent(new InvocationEvent(target, new Runnable() {
            public void run() {
                XWindowPeer fw = null;
                synchronized (getStateLock()) {
                    fw = actualFocusedWindow;
                    actualFocusedWindow = null;
                    if (null == fw || !fw.isVisible() || !fw.isFocusableWindow()) {
                        fw = XDecoratedPeer.this;
                    }
                }
                fw.handleWindowFocusIn_Dispatch();
            }
        }));
    }
}