[GRASS5] Re: [GRASSLIST:1560] Re: back ground

Glynn Clements glynn.clements at virgin.net
Tue Oct 28 06:07:45 EST 2003


Markus Neteler wrote:

> > > > > how can i change the back ground,black to white,to viwe the maps in
> > > > > GRASS 5.0.0?
> > > >
> > > > d.erase color=white
> > > 
> > > Which change is necessary for GRASS 5.7 to keep the white
> > > standard background when resizing the monitor? 
> > 
> > Copy Serve_Xevent.c; on line 292, change BlackPixel to WhitePixel.
> 
> Thanks. I have subitted
>      if (strcmp(DEFAULT_FG_COLOR, "black"))
>        XSetForeground(dpy, gc, BlackPixel(dpy, scrn));
>      else
>        XSetForeground(dpy, gc, WhitePixel(dpy, scrn));
> 
> to CVS. Now it works both for 5.3 and 5.7.

For consistency, you should do this in both Graph_Set.c and
Serve_Xevent.c. Graph_Set.c sets the background colour at startup,
Serve_Xevent.c does it when the window is resized. Presumably you want
them both to be the same, right?

The 5.7 version of Graph_Set.c uses WhitePixel regardless of the
DEFAULT_FG_COLOR setting (line 385).

Better still, use XLookupColor() instead of {Black,White}Pixel(). Note
that {Black,White}Pixel() don't necessarily return the values for
black and white respectively, but for the nominal "black" and "white"
pixels (e.g. if a server has an option for inverse video, black and
white will be swapped; XFree86 4.x allows the nominal black/white
colours to be set in XF86Config).

> > BTW, I'm not sure if these lines (266+) have any relevance.
> > 
> >     /* set standard color to black and erase */
> >     Standard_color(BLACK);
> >     Erase();
> 
> They don't harm in this context. Do you mean that they are useless?

I mean that they appear to be useless, although I'm not entirely sure. 
Maybe the display library needs to be told what the background colour
is?

-- 
Glynn Clements <glynn.clements at virgin.net>




More information about the grass-dev mailing list