diff options
Diffstat (limited to 'libjava/gnu/awt/xlib/XEventLoop.java')
-rw-r--r-- | libjava/gnu/awt/xlib/XEventLoop.java | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/libjava/gnu/awt/xlib/XEventLoop.java b/libjava/gnu/awt/xlib/XEventLoop.java index 149ee736d7c..d0c46a804d5 100644 --- a/libjava/gnu/awt/xlib/XEventLoop.java +++ b/libjava/gnu/awt/xlib/XEventLoop.java @@ -21,12 +21,13 @@ import java.awt.event.InputEvent; import java.awt.event.MouseEvent; import java.util.Vector; -public class XEventLoop +public class XEventLoop implements Runnable { Display display; EventQueue queue; XAnyEvent anyEvent; - + private Thread eventLoopThread; + LightweightRedirector lightweightRedirector = new LightweightRedirector(); public XEventLoop(Display display, EventQueue queue) @@ -35,13 +36,17 @@ public class XEventLoop this.queue = queue; anyEvent = new XAnyEvent(display); + eventLoopThread = new Thread(this, "AWT thread for XEventLoop"); + eventLoopThread.start(); } - void interrupt() + public void run () { - anyEvent.interrupt(); + // FIXME: do we need an interrupt mechanism for window shutdown? + while (true) + postNextEvent (true); } - + /** If there's an event available, post it. * @return true if an event was posted */ @@ -65,7 +70,7 @@ public class XEventLoop AWTEvent event = null; if (loadNextEvent(block)) { - event = createEvent(); + event = createEvent(); event = lightweightRedirector.redirect(event); } return event; |