EventQueue.java (getCurrentEvent): Consider that system events may be handled by any queue in the stack.

* java/awt/EventQueue.java (getCurrentEvent): Consider that system
        events may be handled by any queue in the stack.

From-SVN: r76150
This commit is contained in:
Fernando Nasser 2004-01-19 14:51:54 +00:00 committed by Fernando Nasser
parent 2c20a17152
commit aadc6da0c4
2 changed files with 17 additions and 2 deletions

View file

@ -293,8 +293,18 @@ public class EventQueue
public static AWTEvent getCurrentEvent()
{
EventQueue eq = Toolkit.getDefaultToolkit().getSystemEventQueue();
if (Thread.currentThread() != eq.dispatchThread)
return null;
Thread ct = Thread.currentThread();
/* Find out if this thread is the dispatch thread for any of the
EventQueues in the chain */
while (ct != eq.dispatchThread)
{
// Try next EventQueue, if any
if (eq.next == null)
return null; // Not an event dispatch thread
eq = eq.next;
}
return eq.currentEvent;
}