diff options
Diffstat (limited to 'libjava/gnu/awt/xlib/XEventLoop.java')
-rw-r--r-- | libjava/gnu/awt/xlib/XEventLoop.java | 75 |
1 files changed, 42 insertions, 33 deletions
diff --git a/libjava/gnu/awt/xlib/XEventLoop.java b/libjava/gnu/awt/xlib/XEventLoop.java index ad5e963..5f5026b 100644 --- a/libjava/gnu/awt/xlib/XEventLoop.java +++ b/libjava/gnu/awt/xlib/XEventLoop.java @@ -118,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); |