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

Glynn Clements glynn.clements at virgin.net
Wed Oct 29 02:20:35 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 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).

I know. Either:

a) copy Serve_Xevent.c, and revert the 5.3 version so it is consistent
with the 5.3 version of Graph_Set.c, or:

b) modify the 5.3 version of Graph_Set.c so that it is consistent with
the shared version of Serve_Xevent.c.

My point is that the behaviour should be the same for both the startup
and resize cases. Given that, currently, Serve_Xevent.c is shared
between 5.3 and 5.7, both the 5.3 and 5.7 versions of Graph_Set.c need
to be consistent with it.

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

These are the lines in question; in my local copy, they look like
this (starting at 381):

    /* Now create a pixmap that will contain same contents as the
     * window. It will be used to redraw from after expose events */
    bkupmap = XCreatePixmap(dpy, grwin, xwa.width, xwa.height, xwa.depth);
    XSetWindowBackgroundPixmap(dpy, grwin, bkupmap);
    XSetForeground(dpy, gc, WhitePixel(dpy, scrn));
    XFillRectangle(dpy, bkupmap, gc, 0, 0, xwa.width, xwa.height);

Presumably this has been changed since I last did a "cvs update" for
5.7 (I haven't really been following it, so updates aren't
particularly frequent.).

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




More information about the grass-dev mailing list