[GRASS5] xwindows - how to capture window geometry for monitor

Glynn Clements glynn.clements at virgin.net
Thu Mar 25 16:15:19 EST 2004

Michael Barton wrote:

> I need to capture the geometry of the currently active display monitor. 
> I can identify which monitor is active, but don't know how to capture 
> its dimensions. I know this can be done and have puzzled over the code 
> of gui.tcl which apparently does this, but can't decipher the relevant 
> portion. I'm sure someone out there knows how to do this.

The official mechanism is to use the R_screen_{left,rite,top,bot}
functions from the raster library. However, I've just noticed that
they won't work for an XDRIVER instance which has been resized
interactively; I can fix that easily enough.

The mechanism which gui.tcl uses (xwininfo) should be avoided, as:

1. It will only work with X windows; it won't work with the
wingrass_generic XDRIVER, or with a future native MacOSX driver.

2. It won't work for anything other than XDRIVER, e.g. the CELL, PNG
or HTMLMAP drivers.

Furthermore, that particular hack should be removed from gui.tcl at
the earliest opportunity.

Currently, there doesn't appear to be any mechanism to obtain this
information from within a script. I'm willing to write the
necessary C code, but would appreciate suggestions regarding how it
should be implemented (e.g. whether it's a separate utility, an
extension to d.mon, etc).

Glynn Clements <glynn.clements at virgin.net>

More information about the grass-dev mailing list