+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
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)
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. */
}
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:
{
event = createEvent();
event = lightweightRedirector.redirect(event);
- }
+ }
return event;
}
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);
}
}
throw new java.lang.UnsupportedOperationException ();
}
- boolean interrupted;
-
public boolean nativeQueueEmpty()
{
return eventLoop.isIdle();
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);
+ }
}
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))