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

Markus Neteler neteler at itc.it
Tue Oct 28 11:58:05 EST 2003


On Tue, Oct 28, 2003 at 11:07:45AM +0000, Glynn Clements wrote:
> 
> 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 file Graph_Set.c is not linked from 5.3 into 5.7 but
a slightly different version (includes new cursor definition etc
and the change for WhitePixel).

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

Do you mean line 374 (5.7)? This part of the file is a bit cryptic for
me (from line 369 onwards):

    XSetWindowBackgroundPixmap(dpy, grwin, bkupmap);
    XSetForeground(dpy, gc, BlackPixel(dpy, scrn));  <===== !?
    XFillRectangle(dpy, bkupmap, gc, 0, 0, xwa.width, xwa.height);

    XSetBackground(dpy, gc, BlackPixel(dpy, scrn));
    XSetForeground(dpy, gc, WhitePixel(dpy, scrn));  <===== !?

In fact, I don't know X functions at all.

> 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).

Unfortunately I don't know anything about these details.
 
> > > 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?

No idea. Does
src/libes/D/Derase.c
tell us something?

-> int Derase(char *color)

So far it works, I prefer to leave further changes to X experts.




More information about the grass-dev mailing list