X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fx11%2Ffg_main_x11.c;h=8a8514e2f1d8918220319b9699adeb354780b2cc;hb=8c3eab0efb7f82a94014e0c1342c287e19461041;hp=e72db37b562e1e3447ffb91d1b67837eb875e8ef;hpb=5b3d339481bac6dbaeb599bffc1325f716585bfe;p=freeglut diff --git a/src/x11/fg_main_x11.c b/src/x11/fg_main_x11.c index e72db37..8a8514e 100644 --- a/src/x11/fg_main_x11.c +++ b/src/x11/fg_main_x11.c @@ -40,6 +40,8 @@ # define VFPRINTF(s,f,a) #endif +#include "fg_main.h" + /* * Try to get the maximum value allowed for ints, falling back to the minimum * guaranteed by ISO C99 if there is no suitable header. @@ -55,6 +57,9 @@ # define MIN(a,b) (((a)<(b)) ? (a) : (b)) #endif +/* used in the event handling code to match and discard stale mouse motion events */ +static Bool match_motion(Display *dpy, XEvent *xev, XPointer arg); + /* * TODO BEFORE THE STABLE RELEASE: * @@ -295,7 +300,7 @@ static const char* fghColormapStateToString( int state ) } } -static void fghPrintEvent( XEvent *event ) +__fg_unused static void fghPrintEvent( XEvent *event ) { switch( event->type ) { @@ -788,6 +793,13 @@ void fgPlatformProcessSingleEvent ( void ) case MotionNotify: { + /* if GLUT_SKIP_STALE_MOTION_EVENTS is true, then discard all but + * the last motion event from the queue + */ + if(fgState.SkipStaleMotion) { + while(XCheckIfEvent(fgDisplay.pDisplay.Display, &event, match_motion, 0)); + } + GETWINDOW( xmotion ); GETMOUSE( xmotion ); @@ -1077,6 +1089,11 @@ void fgPlatformProcessSingleEvent ( void ) } +static Bool match_motion(Display *dpy, XEvent *xev, XPointer arg) +{ + return xev->type == MotionNotify; +} + void fgPlatformMainLoopPreliminaryWork ( void ) { }