diff options
| author | Bent Bisballe Nyeng <deva@aasimon.org> | 2013-03-09 20:01:41 +0100 | 
|---|---|---|
| committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2013-03-09 20:01:41 +0100 | 
| commit | 221f7216d1b6fda90f1aba36b2509aa62e158bee (patch) | |
| tree | a8b7eab0d4561514a5dd201b5ff52d4793b1b09b | |
| parent | 1fe04afd8dd8addcc8902ea3c1c0f77d148cd1b7 (diff) | |
Ignore duplicate mouxe move events in X11. Only play the last one. Also a bit of spring cleaning...
| -rw-r--r-- | plugingui/eventhandler.cc | 55 | 
1 files changed, 8 insertions, 47 deletions
| diff --git a/plugingui/eventhandler.cc b/plugingui/eventhandler.cc index 088380f..57718c2 100644 --- a/plugingui/eventhandler.cc +++ b/plugingui/eventhandler.cc @@ -296,47 +296,15 @@ GUI::Event *GUI::EventHandler::getNextEvent()    XEvent xe;    XNextEvent(gctx->display, &xe); -  //printf("XEvent ?%d[%d]\n", ConfigureNotify, xe.type); - -/** - * KeyPress                2 - * KeyRelease              3 - * ButtonPress             4 - * ButtonRelease           5 - * MotionNotify            6 - * EnterNotify             7 - * LeaveNotify             8 - * FocusIn                 9 - * FocusOut                10 - * KeymapNotify            11 - * Expose                  12 - * GraphicsExpose          13 - * NoExpose                14 - * VisibilityNotify        15 - * CreateNotify            16 - * DestroyNotify           17 - * UnmapNotify             18 - * MapNotify               19 - * MapRequest              20 - * ReparentNotify          21 - * ConfigureNotify         22 - * ConfigureRequest        23 - * GravityNotify           24 - * ResizeRequest           25 - * CirculateNotify         26 - * CirculateRequest        27 - * PropertyNotify          28 - * SelectionClear          29 - * SelectionRequest        30 - * SelectionNotify         31 - * ColormapNotify          32 - * ClientMessage           33 - * MappingNotify           34 - * GenericEvent            35 - * LASTEvent               36      // must be bigger than any event # - **/ -    if(xe.type == MotionNotify) { +    while(true) { // Hack to make sure only the last event is played. +      if(!hasEvent()) break; +      XEvent nxe; +      XPeekEvent(gctx->display, &nxe); +      if(nxe.type != MotionNotify) break; +      XNextEvent(gctx->display, &xe); +    } +      MouseMoveEvent *e = new MouseMoveEvent();      e->window_id = xe.xmotion.window;      e->x = xe.xmotion.x; @@ -355,13 +323,6 @@ GUI::Event *GUI::EventHandler::getNextEvent()    }    if(xe.type == ConfigureNotify) { -    /* -    if(hasEvent()) { // Hack to make sure only the last resize event is played. -      XEvent nxe; -      XPeekEvent(gctx->display, &nxe); -      if(xe.type == ConfigureNotify) return NULL; -    } -    */      ResizeEvent *e = new ResizeEvent();      e->window_id = xe.xconfigure.window;      //    e->x = xe.xconfigure.x; | 
