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

Re: Grabbing the pointer with OpenGL



Jan Ekholm wrote:
> 
> On Wed, 11 Apr 2001, Mads Bondo Dydensborg wrote:
> 
> >I have looked at XGrabPointer, but I ran away scared by the man page. And
> >it is not very portable either, I guess.
> 
> I've used it for another (non-game) project, and it sure was fun when the
> application hung for some reason... Remote login and kill. :-)

When that's a serious risk, I build a 'watchdog' timer into the code...
something like:

  void tidyExit ( int )
  {
    release the mouse
    exit ( 1 ) ;  /* Failed */
  }


  int main ()
  {
    signal ( SIGALRM, tidyExit ) ;
    .
    .
  }

...then in the main loop of your program, add:

   alarm ( 5 ) ;

...so that if your program should fail to go around the main loop at least once every
5 seconds (to reset the alarm call), it'll get an alarm signal, tidy up cleanly and exit.

This used to be a life-saver when I worked with Voodoo-1 and -2 cards.

-- 
Steve Baker   HomeEmail: <sjbaker1@airmail.net>
              WorkEmail: <sjbaker@link.com>
              HomePage : http://web2.airmail.net/sjbaker1
              Projects : http://plib.sourceforge.net
                         http://tuxaqfh.sourceforge.net
                         http://tuxkart.sourceforge.net
                         http://prettypoly.sourceforge.net
                         http://freeglut.sourceforge.net

---------------------------------------------------------------------
To unsubscribe, e-mail: linuxgames-unsubscribe@sunsite.dk
For additional commands, e-mail: linuxgames-help@sunsite.dk