diff options
Diffstat (limited to 'libjava/java/awt/EventQueue.java')
-rw-r--r-- | libjava/java/awt/EventQueue.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/libjava/java/awt/EventQueue.java b/libjava/java/awt/EventQueue.java index 41dad06..4cb0703 100644 --- a/libjava/java/awt/EventQueue.java +++ b/libjava/java/awt/EventQueue.java @@ -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; } |