diff options
author | fnasser <fnasser@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-01-13 02:56:18 +0000 |
---|---|---|
committer | fnasser <fnasser@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-01-13 02:56:18 +0000 |
commit | ebc2b28b731d6c611104f023d2c8f0ca6396c1bf (patch) | |
tree | 9e6e74eb87e7a8132ad1b698944f567961ef8d13 | |
parent | 2a222da1dc6437af56241c50361f4ae8d41fc919 (diff) | |
download | gcc-ebc2b28b731d6c611104f023d2c8f0ca6396c1bf.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@75788 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | libjava/ChangeLog | 6 | ||||
-rw-r--r-- | libjava/java/awt/Dialog.java | 31 |
2 files changed, 28 insertions, 9 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 1952bfe6037..6252810397b 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -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 diff --git a/libjava/java/awt/Dialog.java b/libjava/java/awt/Dialog.java index fd1eb4fbc22..5516ff906d0 100644 --- a/libjava/java/awt/Dialog.java +++ b/libjava/java/awt/Dialog.java @@ -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; + } } } |