diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 4a173977216..cd7d66af18b 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,8 @@ +2004-01-19 Fernando Nasser + + * java/awt/EventQueue.java (getCurrentEvent): Consider that system + events may be handled by any queue in the stack. + 2004-01-19 Kim Ho * gnu/java/awt/peer/gtk/GtkFramePeer.java (getMenuBarHeight): Added diff --git a/libjava/java/awt/EventQueue.java b/libjava/java/awt/EventQueue.java index 41dad066989..4cb0703ec62 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; }