[winGRASS] Re: generic Windows GRASS driver

Mike Thomas miketh at brisbane.paradigmgeo.com
Thu Sep 20 19:32:06 EDT 2001


Hi there.

Thanks for the messages.

Yes, I had to add similar defines to those Malcolm suggested and some dummy
functions based on earlier suggestions by Glynn to get it to compile.  I'll
compare my changes to Malcolm's to see if there is anything I have missed.

I defined X11R3 also on Glynn's suggestion, which removes some of the
missing functions.

I got around the XOpenDisplay (NULL) problem by patching libW11, so I might
try using Malcolm's approach instead.

Following Markus's separate request I'll send details of what I have done
later in the day - time soon for the morning team meeting.

Cheers

Mike Thomas


----- Original Message -----
From: Malcolm Blue <mblue at nb.sympatico.ca>
To: Glynn Clements <glynn.clements at virgin.net>; Mike Thomas
<miketh at brisbane.paradigmgeo.com>
Cc: <wingrass at grass.itc.it>; Roberto Flor <flor at itc.it>
Sent: Friday, September 21, 2001 9:05 AM
Subject: RE: [winGRASS] Re: generic Windows GRASS driver


> Mike, Glynn,
>
> I took a slightly different approach to this than Glynn suggests,
resulting
> in messier code:
>
> [Note that this code was from Glynn's late April revision to the display
> devices code - there may be changes since then]
>
> >From lib/main.c
>
>    /* We are free to run now.  No one is using our socket/FIFOs.
> */
>     /* If we are to run in background, we will have foreground == 0 from
> */
>     /* the syntax check above. */
>
>     if (!foreground)
>     {
> #ifndef __NoX__
>         if (pid = fork())
> #else
> if (pid = 1)
> #endif
>         {
>             if (pid > 0)        /* parent exits */
>             {
>                 fprintf(stderr,"Graphics driver [%s] started\n", me);
> #ifndef __NoX__
>                 exit(0);
> #endif
>             }
>
> Messy, but it worked.  I used __NoX__ rather than __W98__ to seperate
those
> set of changes. I recommend following Glynn's much simpler solution.  I
> believe that I was just being careful in case someone added additional
uses
> for the foreground and pid variables in later versions of the code.
>
> The other major change was in XDRIVER/XDRIVER24/Graph_Set.c
>
>     /* Open the display using the $DISPLAY environment variable to
>      * locate the X server. Return 0 if cannot open. */
> #ifndef __NoX__
>     if (!(dpy = XOpenDisplay(NULL))) {
>         fprintf(stderr, "Graph_Set: can't open Display %s\n",
> XDisplayName(NULL));
> #else
>     if (!(dpy = XOpenDisplay(""))) {
>         fprintf(stderr, "Graph_Set: can't open Display \n");
> #endif
>         return -1;
>     }
>
>
> This fixes the Null String vs NULL difference that I mentioned earlier.
>
> As I think I identified in April or May, I was successful in getting the
> Vector display commands to work, but did not get Raster working.  I
haven't
> had time to go back to this.
>
> Mike:  Add the defines in my earlier message to xlib.h or some other
header,
> and you should be able to get vector graphics to work.  There are still a
> couple of X function calls that I had excluded (using #ifndef) dealing
with
> the color map (wonder why the Raster graphics didn't work?), plus the
> XNoOp(dpy) in Work.c  (you probably already found that one).
>
> Good Luck,
>
> Malcolm
>
> -----Original Message-----
> From: wingrass-admin at grass.itc.it [mailto:wingrass-admin at grass.itc.it]On
> Behalf Of Glynn Clements
> Sent: Thursday, September 20, 2001 11:34 AM
> To: Mike Thomas
> Cc: wingrass at grass.itc.it; Roberto Flor
> Subject: Re: [winGRASS] Re: generic Windows GRASS driver
>
>
>
> Mike Thomas wrote:
>
> > Debugging the libW11 version of the XDriver - the exposition of my logic
> may
> > be a little laborious, but I am coming to grips with the differences
> between
> > X11 and Windows from behind the pole position.
> >
> > OK - further to the report below, it seems that the libW11 display
window
> > closes down as soon as the parent XDRIVER exits - that is, when the
> message:
> >
> >     Graphics driver [x0] started - exiting
> >
> > appears.
> >
> > My interpretation of this is that the new window is not running as a
> > separate process and therefore is doomed to die with the process that
> > launches it (ie the parent XDriver).
> >
> > I assume that this is not the case with X11 - that is, that the window
is
> > under the control of the XServer rather than the XDriver and is
therefore
> > preserved.
>
> Yep. The child process inherits the descriptor which is the connection
> to the X server, allowing it to continue from where the parent left
> off.
>
> > On this basis I used the __W98__ define to stop the parent from exiting.
> > This buys a display which waits for a response (looping on do_work(0)).
>
> You would also need to disable the fork(). Not only is the child
> process is of no use (as it can't make use of the window which the
> parent created), it will interfere with the parent (as it will be
> reading from the control socket, "stealing" data which should be read
> by the parent).
>
> This simplest way to avoid the fork is to add the following at an
> appropriate point in main.c:
>
> #ifdef __W98__
> foreground = 1;
> #endif
>
> --
> Glynn Clements <glynn.clements at virgin.net>
> _______________________________________________
> winGRASS mailing list
> winGRASS at grass.itc.it
> http://grass.itc.it/mailman/listinfo/wingrass
>
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.281 / Virus Database: 149 - Release Date: 9/18/2001
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.281 / Virus Database: 149 - Release Date: 9/18/2001
>




More information about the grass-windows mailing list