[GRASS5] winname.h inconsistency found

Hi all,

I've been long time wondering why tcltkgrass stopped closing monitors and
restoring them on reload. That's what I found out:

gui.tcl, line 1159:
} elseif {[regexp -nocase {^ *Name:.*GRASS.*Monitor: *(.*)} $line buffer monitor]}
in proc search_xdrivers, which must return a list of opened drivers (as parameter to stop_monitors, for example. But: trying to parse a string that *must* contain the word "GRASS" we'd fail to compose this list, as the window title has no word 'GRASS' - only version number (see winname.h and Graph_Set.c in XDRIVER sources.

There are at least two ways to fix this bug, - change the parser code in gui.tcl (which I did to finally see my black windows hop-hop-hop), or add the word GRASS to window name.

--alex

Alex Shevlakov wrote:

I've been long time wondering why tcltkgrass stopped closing monitors and
restoring them on reload. That's what I found out:

gui.tcl, line 1159:
} elseif {[regexp -nocase {^ *Name:.*GRASS.*Monitor: *(.*)} $line buffer monitor]}

in proc search_xdrivers, which must return a list of opened drivers
(as parameter to stop_monitors, for example. But: trying to parse a
string that *must* contain the word "GRASS" we'd fail to compose this
list, as the window title has no word 'GRASS' - only version number
(see winname.h and Graph_Set.c in XDRIVER sources.

There are at least two ways to fix this bug, - change the parser code
in gui.tcl (which I did to finally see my black windows hop-hop-hop),
or add the word GRASS to window name.

I would have thought that parsing the output from "d.mon -L" would be
preferable. That should work for all drivers, not just XDRIVER.

Apart from that, the WM_CLASS property should always have "XDRIVER" as
the "name" field.

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

Glynn Clements wrote:

> I've been long time wondering why tcltkgrass stopped closing monitors and
> restoring them on reload. That's what I found out:
>
> gui.tcl, line 1159:
> } elseif {[regexp -nocase {^ *Name:.*GRASS.*Monitor: *(.*)} $line buffer monitor]}
>
> in proc search_xdrivers, which must return a list of opened drivers
> (as parameter to stop_monitors, for example. But: trying to parse a
> string that *must* contain the word "GRASS" we'd fail to compose this
> list, as the window title has no word 'GRASS' - only version number
> (see winname.h and Graph_Set.c in XDRIVER sources.
>
> There are at least two ways to fix this bug, - change the parser code
> in gui.tcl (which I did to finally see my black windows hop-hop-hop),
> or add the word GRASS to window name.

I would have thought that parsing the output from "d.mon -L" would be
preferable. That should work for all drivers, not just XDRIVER.

Apart from that, the WM_CLASS property should always have "XDRIVER" as
the "name" field.

  revision 1.15
  date: 2002/05/27 08:51:40; author: alex; state: Exp; lines: +1 -1
  Added GRASS to window title

Note: this is a workaround, not a fix.

It won't work for drivers other than XDRIVER, and it won't work for
the libW11 version of XDRIVER (although that's not really relevant
until someone gets native (non-X11) Tcl/Tk working with Cygwin).

Also, the regexp seems a bit too general; it might conceivably match a
Netscape window for an HTML file whose title contains the words
"GRASS" and "Monitor".

Basically, all monitor management should be done through d.mon;
anything else is a hack.

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