Commit d5d74adf by Thomas Fitzsimmons Committed by Thomas Fitzsimmons

Robot.java (waitForIdle): Call invokeAndWait on an empty Runnable.

2005-02-22  Thomas Fitzsimmons  <fitzsim@redhat.com>

	* java/awt/Robot.java (waitForIdle): Call invokeAndWait on an
	empty Runnable.

From-SVN: r95384
parent d5c9fbd9
2005-02-22 Thomas Fitzsimmons <fitzsim@redhat.com> 2005-02-22 Thomas Fitzsimmons <fitzsim@redhat.com>
* java/awt/Robot.java (waitForIdle): Call invokeAndWait on an
empty Runnable.
PR libgcj/17952: PR libgcj/17952:
* gnu/java/awt/peer/gtk/GtkWindowPeer.java, * gnu/java/awt/peer/gtk/GtkWindowPeer.java,
jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
......
...@@ -40,6 +40,7 @@ package java.awt; ...@@ -40,6 +40,7 @@ package java.awt;
import gnu.java.awt.ClasspathToolkit; import gnu.java.awt.ClasspathToolkit;
import java.lang.reflect.InvocationTargetException;
import java.awt.event.InputEvent; import java.awt.event.InputEvent;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.awt.peer.RobotPeer; import java.awt.peer.RobotPeer;
...@@ -53,8 +54,8 @@ import java.awt.peer.RobotPeer; ...@@ -53,8 +54,8 @@ import java.awt.peer.RobotPeer;
* *
* Since Robot generates native windowing system events, rather than * Since Robot generates native windowing system events, rather than
* simply inserting {@link AWTEvents} on the AWT event queue, its use * simply inserting {@link AWTEvents} on the AWT event queue, its use
* is not restricted to Java programs. It can be to programatically * is not restricted to Java programs. It can be used to
* drive any graphical application. * programatically drive any graphical application.
* *
* This implementation requires an X server that supports the XTest * This implementation requires an X server that supports the XTest
* extension. * extension.
...@@ -384,7 +385,8 @@ public class Robot ...@@ -384,7 +385,8 @@ public class Robot
} }
/** /**
* Wait until the event dispatch thread is idle. * Wait until all events currently on the event queue have been
* dispatched.
*/ */
public void waitForIdle () public void waitForIdle ()
{ {
...@@ -393,17 +395,17 @@ public class Robot ...@@ -393,17 +395,17 @@ public class Robot
+ "the event dispatch thread"); + "the event dispatch thread");
EventQueue q = Toolkit.getDefaultToolkit ().getSystemEventQueue (); EventQueue q = Toolkit.getDefaultToolkit ().getSystemEventQueue ();
try
while (q.peekEvent () != null) {
q.invokeAndWait (new Runnable () { public void run () { } });
}
catch (InterruptedException e)
{
System.err.println ("Robot: waitForIdle interrupted");
}
catch (InvocationTargetException e)
{ {
try System.err.println ("Robot: waitForIdle cannot invoke target");
{
wait ();
}
catch (InterruptedException e)
{
System.err.println ("Robot: waitForIdle interrupted");
}
} }
} }
......
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