This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix to EventQueue 4/7


On Fri, 2004-01-16 at 12:21, Fernando Nasser wrote:
> If a queue has been pushed we could wrongly return null.
> 
> 2004-01-16  Fernando Nasser  <fnasser@redhat.com>
> 
>          * java/awt/EventQueue.java (getCurrentEvent): Consider that system
>          events may be handled by any queue in the stack.

Looks good.  Thanks,

Tom

________________________________________________________________________
> Index: java/awt/EventQueue.java
> ===================================================================
> RCS file: /cvs/gcc/gcc/libjava/java/awt/EventQueue.java,v
> retrieving revision 1.13
> diff -u -p -r1.13 EventQueue.java
> --- java/awt/EventQueue.java	16 Jan 2004 16:15:49 -0000	1.13
> +++ java/awt/EventQueue.java	16 Jan 2004 17:11:01 -0000
> @@ -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;
>    }
>  


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]