[winGRASS] Re: [GRASS5] Windows native Xdriver

Mike Thomas mthomas at gil.com.au
Thu May 2 16:39:02 EDT 2002


Hi Glynn

> > As /dev doesn't exist on my computer, this wonn't work for me (and I
suspect
> > many Cygwin users).
>
> Cygwin implements device files such as /dev/tty, /dev/null and
> /dev/windows internally. Try "ls -l /dev/windows"; it works, even
> though there isn't a /dev/directory.

Spot on, thanks.  I appreciate your patient technical explanations - my
personal programming preferences lie far away from the world of sockets and
Unix emulation on Windows!

Getting back to your earlier request for feedback on Windows NT, using:

    fd = open ("/dev/windows", O_NONBLOCK, 0);

on my Windows XP computer is an improvement as it allows 3 Xdriver window
refreshes (generated by covering and then uncovering the window with the
Grass console window) before the XDriver degenerates into the buffered event
behaviour described earlier.
.
This is probably being caused by the repeated opening using up some internal
fd buffer - caching the fd by making it static cures the problem:

-------------------------------------------------------------------
int
XConnectionNumber(Display* display)
{
 static int fd = 0;
 NT_debug ("XConnectionNumber\n");
 if ( 0 == fd ) {
   fd = open ("/dev/windows", O_NONBLOCK, 0);
   if ( -1 == fd ) {
     NT_log ("XConnectionNumber unable to open /dev/windows, errno = %d\n",
errno);
   }
 }
 return ( fd );
}
-------------------------------------------------------------------

This, of course assumes that nobody will close the fd.  Is that likely?

I'll check in the changes when a little more testing has been done and when
I have an answer to the above question.

Cheers

MIke Thomas.





More information about the grass-windows mailing list