diff options
-rw-r--r-- | libjava/ChangeLog | 12 | ||||
-rw-r--r-- | libjava/gnu/awt/xlib/XCanvasPeer.java | 9 | ||||
-rw-r--r-- | libjava/gnu/awt/xlib/XEventLoop.java | 15 | ||||
-rw-r--r-- | libjava/gnu/awt/xlib/XToolkit.java | 17 | ||||
-rw-r--r-- | libjava/gnu/gcj/xlib/natXAnyEvent.cc | 5 |
5 files changed, 41 insertions, 17 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index dd315ec..9645824 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,15 @@ +2005-04-07 Scott Gilbertson <scottg@mantatest.com> + * gnu/gcj/xlib/natXAnyEvent.cc (loadNext): Added timeout. + * gnu/awt/xlib/XCanvasPeer.java (setBackground): Removed + throw UnsupportedOperationException, fixed comments. + (setFont, setForeground): Fixed comments. + * gnu/awt/xlib/XEventLoop.java (postNextEvent): Changed + return type to boolean. + (getNextEvent): Fixed javadocs. + * gnu/awt/xlib/XToolkit.java (interrupted): Removed field. + (nativeQueueEmpty): Removed unused code. + (iterateNativeQueue): Removed outer loop. + 2005-03-06 Roger Sayle <roger@eyesopen.com> PR libgcj/20155 diff --git a/libjava/gnu/awt/xlib/XCanvasPeer.java b/libjava/gnu/awt/xlib/XCanvasPeer.java index 5daee59..83646b1 100644 --- a/libjava/gnu/awt/xlib/XCanvasPeer.java +++ b/libjava/gnu/awt/xlib/XCanvasPeer.java @@ -349,7 +349,8 @@ public class XCanvasPeer implements CanvasPeer public void setBackground(Color color) { - throw new UnsupportedOperationException("not implemented"); + /* default canvas peer does not keep track of background, since it won't + * paint anything. */ } public void setBounds(int x, int y, int width, int height) @@ -405,13 +406,13 @@ public class XCanvasPeer implements CanvasPeer public void setFont(Font font) { - /* default canvas peer does keep track of font, since it won't - write anything. */ + /* default canvas peer does not keep track of font, since it won't + paint anything. */ } public void setForeground(Color color) { - /* default canvas peer does keep track of foreground, since it won't + /* default canvas peer does not keep track of foreground, since it won't paint anything. */ } diff --git a/libjava/gnu/awt/xlib/XEventLoop.java b/libjava/gnu/awt/xlib/XEventLoop.java index 8f78287..149ee73 100644 --- a/libjava/gnu/awt/xlib/XEventLoop.java +++ b/libjava/gnu/awt/xlib/XEventLoop.java @@ -42,15 +42,20 @@ public class XEventLoop anyEvent.interrupt(); } - void postNextEvent(boolean block) + /** If there's an event available, post it. + * @return true if an event was posted + */ + boolean postNextEvent(boolean block) { AWTEvent evt = getNextEvent(block); if (evt != null) queue.postEvent(evt); + return evt != null; } - /** get next event. Will block until events become available. */ - + /** Get the next event. + * @param block If true, block until an event becomes available + */ public AWTEvent getNextEvent(boolean block) { // ASSERT: @@ -62,7 +67,7 @@ public class XEventLoop { event = createEvent(); event = lightweightRedirector.redirect(event); - } + } return event; } @@ -169,7 +174,7 @@ public class XEventLoop return null; default: - String msg = "Do no know how to handle event (" + anyEvent + ")"; + String msg = "Do not know how to handle event (" + anyEvent + ")"; throw new RuntimeException (msg); } } diff --git a/libjava/gnu/awt/xlib/XToolkit.java b/libjava/gnu/awt/xlib/XToolkit.java index 1e937c2..c6e140e 100644 --- a/libjava/gnu/awt/xlib/XToolkit.java +++ b/libjava/gnu/awt/xlib/XToolkit.java @@ -444,8 +444,6 @@ public class XToolkit extends ClasspathToolkit throw new java.lang.UnsupportedOperationException (); } - boolean interrupted; - public boolean nativeQueueEmpty() { return eventLoop.isIdle(); @@ -453,14 +451,19 @@ public class XToolkit extends ClasspathToolkit public void wakeNativeQueue() { - interrupted = true; eventLoop.interrupt(); } + /** Checks the native event queue for events. If blocking, waits until an + * event is available before returning, unless interrupted by + * wakeNativeQueue. If non-blocking, returns immediately even if no + * event is available. + * + * @param locked The calling EventQueue + * @param block If true, waits for a native event before returning + */ public void iterateNativeQueue(java.awt.EventQueue locked, boolean block) { - interrupted = false; - while (!interrupted) - eventLoop.postNextEvent(block); - }; + eventLoop.postNextEvent(block); + } } diff --git a/libjava/gnu/gcj/xlib/natXAnyEvent.cc b/libjava/gnu/gcj/xlib/natXAnyEvent.cc index 0bef563..26d3b60 100644 --- a/libjava/gnu/gcj/xlib/natXAnyEvent.cc +++ b/libjava/gnu/gcj/xlib/natXAnyEvent.cc @@ -69,11 +69,14 @@ jboolean gnu::gcj::xlib::XAnyEvent::loadNext(jboolean block) int xfd = XConnectionNumber(dpy); int pipefd = pipe[0]; int n = (xfd > pipefd ? xfd : pipefd) + 1; + struct timeval timeout; + timeout.tv_usec = 100000; // 100ms timeout + timeout.tv_sec = 0; fd_set rfds; FD_ZERO(&rfds); FD_SET(xfd, &rfds); FD_SET(pipefd, &rfds); - int sel = _Jv_select (n, &rfds, NULL, NULL, NULL); + int sel = _Jv_select (n, &rfds, NULL, NULL, &timeout); if (sel > 0) { if (FD_ISSET(xfd, &rfds)) |