Re: GDK Event skipping...



* Tom Gilbert (gilbertt@tomgilbert.freeserve.co.uk) wrote:
> * Tom Gilbert (gilbertt@tomgilbert.freeserve.co.uk) wrote:
> > Hey,
> > 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);
> >       }
> >    }
> 
> Urm. Okay, ignore the bug in my test code, I actually do it in a while()
> in my app, honest ;-) The results are the same...

Oh n/m I fixed it. For anyone else's reference:

   if (gdk_events_pending())
   {
      while ((e = (GdkEventMotion *) 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);
            break;
         }
      }
   }

Having conclusively proved I suck, I humbly withdraw ;-) Unless anyone
has a cleaner/faster solution for me?

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]