diff options
Diffstat (limited to 'libjava/gnu/awt/xlib/XEventLoop.java')
-rw-r--r-- | libjava/gnu/awt/xlib/XEventLoop.java | 88 |
1 files changed, 44 insertions, 44 deletions
diff --git a/libjava/gnu/awt/xlib/XEventLoop.java b/libjava/gnu/awt/xlib/XEventLoop.java index 4d293208939..5f5026b0cdb 100644 --- a/libjava/gnu/awt/xlib/XEventLoop.java +++ b/libjava/gnu/awt/xlib/XEventLoop.java @@ -48,17 +48,8 @@ public class XEventLoop implements Runnable void postNextEvent() { - try - { - AWTEvent evt = getNextEvent(); - queue.postEvent(evt); - - } - catch (InterruptedException ie) - { - // FIXME: what now? - System.err.println(ie); - } + AWTEvent evt = getNextEvent(); + queue.postEvent(evt); } /** get next event. Will block until events become available. */ @@ -127,57 +118,66 @@ public class XEventLoop implements Runnable * AWT event. */ - AWTEvent createEvent() + AWTEvent createEvent () { + int type = anyEvent.getType (); + // Ignore some events without further processing + switch (type) + { + // ignore "no expose" events, which are generated whenever a pixmap + // is copied to copied to a window which is entirely unobscured + case XAnyEvent.TYPE_NO_EXPOSE: + case XAnyEvent.TYPE_UNMAP_NOTIFY: // ignore for now + case XAnyEvent.TYPE_MAP_NOTIFY: // ignore for now + case XAnyEvent.TYPE_REPARENT_NOTIFY: // ignore for now + return null; + default: + break; // continue processing events not in ignore list + } /* avoid attempting to get client data before client data has been set. */ Object peer; synchronized (this) - { - peer = anyEvent.getWindow().getClientData(); - } - + { + peer = anyEvent.getWindow ().getClientData (); + } + Component source = null; - + // Try to identify source component - + if (peer instanceof XCanvasPeer) - { - source = ((XCanvasPeer) peer).getComponent(); - } - + { + source = ((XCanvasPeer) peer).getComponent (); + } + if (source == null) - { - String msg = "unable to locate source for event (" + - anyEvent + ")"; - throw new RuntimeException(msg); - } - + { + String msg = "unable to locate source for event (" + + anyEvent + "): peer=" + peer; + throw new RuntimeException (msg); + } + /* if a mapping from anyEvent to AWTEvent is possible, construct a new AWTEvent and return it. */ - - int type = anyEvent.getType(); + switch (type) - { + { case XAnyEvent.TYPE_EXPOSE: - return createPaintEvent(source); + return createPaintEvent (source); case XAnyEvent.TYPE_BUTTON_PRESS: case XAnyEvent.TYPE_BUTTON_RELEASE: - return createMouseEvent(type, source); - case XAnyEvent.TYPE_UNMAP_NOTIFY: - case XAnyEvent.TYPE_MAP_NOTIFY: - case XAnyEvent.TYPE_REPARENT_NOTIFY: - return null; // ignore for now + return createMouseEvent (type, source); case XAnyEvent.TYPE_CONFIGURE_NOTIFY: - configureNotify(peer); - return null; - + configureNotify (peer); + return null; + default: - String msg = "Do no know how to handle event (" + anyEvent + ")"; - throw new RuntimeException(msg); - } + String msg = "Do no know how to handle event (" + anyEvent + ")"; + throw new RuntimeException (msg); + } } - + AWTEvent createPaintEvent(Component src) { XExposeEvent expose = new XExposeEvent(anyEvent); |