/** Process an event. */ void ProcessEvent(XEvent *event) { switch(event->type) { case ButtonPress: case ButtonRelease: HandleButtonEvent(&event->xbutton); break; case KeyPress: HandleKeyPress(&event->xkey); break; case KeyRelease: HandleKeyRelease(&event->xkey); break; case EnterNotify: HandleEnterNotify(&event->xcrossing); break; case MotionNotify: while(JXCheckTypedEvent(display, MotionNotify, event)); UpdateTime(event); HandleMotionNotify(&event->xmotion); break; case LeaveNotify: case DestroyNotify: case Expose: case ConfigureNotify: break; default: Debug("Unknown event type: %d", event->type); break; } }
/** Discard motion events for the specified window. */ void DiscardMotionEvents(XEvent *event, Window w) { XEvent temp; while(JXCheckTypedEvent(display, MotionNotify, &temp)) { SetMousePosition(temp.xmotion.x_root, temp.xmotion.y_root); if(temp.xmotion.window == w) { *event = temp; } } }
/** Discard motion events for the specified window. */ void DiscardMotionEvents(XEvent *event, Window w) { XEvent temp; JXSync(display, False); while(JXCheckTypedEvent(display, MotionNotify, &temp)) { UpdateTime(&temp); SetMousePosition(temp.xmotion.x_root, temp.xmotion.y_root, temp.xmotion.window); if(temp.xmotion.window == w) { *event = temp; } } }