Commit cc11dca9 by Fernando Nasser Committed by Fernando Nasser

Dialog.java (show): Enable blocking for all modal dialogs and run secondary dispatch thread to...

        * 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
parent bc298aa7
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> 2004-01-12 Graydon Hoare <graydon@redhat.com>
* gnu/java/awt/gtk/GdkGraphics2D.java * gnu/java/awt/gtk/GdkGraphics2D.java
......
...@@ -88,6 +88,12 @@ private boolean undecorated = false; ...@@ -88,6 +88,12 @@ private boolean undecorated = false;
*/ */
private boolean blocked = 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 ...@@ -394,20 +400,22 @@ public synchronized void
show() show()
{ {
super.show(); super.show();
if (isModal()) if (isModal())
{ {
// If already shown (and blocked) just return // If already shown (and blocked) just return
if (blocked) if (blocked)
return; return;
/* FIXME: Currently this thread may block forever if it called from /* If show is called in the dispatch thread for a modal dialog it will
the event dispatch thread, so we only do this for FileDialog which block so we must run another thread so the events keep being
only depends on a signal which is delivered in the Gtk thread. dispatched.*/
Remove this test when we add code to start another event if (EventQueue.isDispatchThread ())
dispatch thread. */ {
if ((Thread.currentThread () instanceof EventDispatchThread) && EventQueue eq = Toolkit.getDefaultToolkit().getSystemEventQueue();
!(this instanceof FileDialog)) eq2 = new EventQueue ();
return; eq.push (eq2);
}
try try
{ {
...@@ -418,8 +426,13 @@ show() ...@@ -418,8 +426,13 @@ show()
catch (InterruptedException e) catch (InterruptedException e)
{ {
blocked = false; blocked = false;
return;
} }
if (eq2 != null)
{
eq2.pop ();
eq2 = null;
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment