GDK Event skipping...



Hey,

Okay I'm stumped. Been fiddling for a while... but...

I need to do in GDK the equivalent of a:

while (XCheckTypedWindowEvent
           (disp, ev->xmotion.window, MotionNotify, ev));

That is, in a MotionNotify event, to skip over all the other queued
MotionNotify events and continue on to process the most recent one...

(Doing intensive graphical work in the MotionNotify, Motion events tend
to build up in the queue faster than they can be dispatched...)

I tried something really crufty like:

   if (gdk_events_pending())             
   {
      if ((e = gdk_event_get()) != NULL)
      {
         if (e->type == GDK_MOTION_NOTIFY)
         {
            D(5, ("skipping event, new one coming\n"));
            event = e;
         }
         else
            gdk_event_put((GdkEvent *) e);
      }
   }

Which *sometimes* prints the debugging message, when things are *really*
crawling, but it doesn't skip all the duplicate events...

Have I missed something really simple in the API, or do I have to
reinvent XCheckTypedEvent myself? Any tips?

Tom.
-- 
            .------------------------------------------------------.
    .^.     | Tom Gilbert, England | http://www.linuxbrit.co.uk    |
    /V\     |----------------------| gilbertt@linuxbrit.co.uk      |
   // \\    | Sites I recommend:   `-------------------------------|
  /(   )\   | www.freshmeat.net www.enlightenment.org slashdot.org |
   ^^-^^    `------------------------------------------------------'





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]