]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Dialog.java (show): Enable blocking for all modal dialogs and run secondary dispatch...
authorFernando Nasser <fnasser@redhat.com>
Tue, 13 Jan 2004 02:56:18 +0000 (02:56 +0000)
committerFernando Nasser <fnasser@gcc.gnu.org>
Tue, 13 Jan 2004 02:56:18 +0000 (02:56 +0000)
        * java/awt/Dialog.java (show): Enable blocking for all modal dialogs
        and run secondary dispatch thread to process event queue while this
        thread is blocked.

From-SVN: r75788

libjava/ChangeLog
libjava/java/awt/Dialog.java

index 1952bfe6037a330f96ffc8ad93605275719a15f7..6252810397be582fb5c15b0b703483d7f681abb7 100644 (file)
@@ -1,3 +1,9 @@
+2004-01-12  Fernando Nasser  <fnasser@redhat.com>
+
+       * java/awt/Dialog.java (show): Enable blocking for all modal dialogs
+       and run secondary dispatch thread to process event queue while this
+       thread is blocked.
+
 2004-01-12  Graydon Hoare  <graydon@redhat.com>
 
        * gnu/java/awt/gtk/GdkGraphics2D.java
index fd1eb4fbc222187233f6111dcb1ea6a04be9c6d8..5516ff906d00e57ce51a41c89e7f3296d0ca0ecb 100644 (file)
@@ -88,6 +88,12 @@ private boolean undecorated = false;
   */
 private boolean blocked = false;
 
+/**
+  * Secondary EventQueue to handle AWT events while
+  * we are blocked for modality in show
+  */
+private EventQueue eq2 = null;
+
 /*************************************************************************/
 
 /*
@@ -394,20 +400,22 @@ public synchronized void
 show()
 {
   super.show();
+  
   if (isModal())
     {
       // If already shown (and blocked) just return
       if (blocked)
        return;
 
-      /* FIXME: Currently this thread may block forever if it called from
-         the event dispatch thread, so we only do this for FileDialog which
-         only depends on a signal which is delivered in the Gtk thread.
-         Remove this test when we add code to start another event
-         dispatch thread. */
-      if ((Thread.currentThread () instanceof EventDispatchThread) &&
-          !(this instanceof FileDialog))
-        return;
+      /* If show is called in the dispatch thread for a modal dialog it will
+         block so we must run another thread so the events keep being
+        dispatched.*/
+      if (EventQueue.isDispatchThread ())
+        {
+         EventQueue eq = Toolkit.getDefaultToolkit().getSystemEventQueue();
+          eq2 = new EventQueue ();
+         eq.push (eq2);
+       }
       
       try 
         {
@@ -418,8 +426,13 @@ show()
       catch (InterruptedException e)
         {
          blocked = false;
-         return;
         }
+       
+      if (eq2 != null)
+        {
+         eq2.pop ();
+         eq2 = null;
+       }
     }  
 }