[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: X window display sizes



your name wrote:
> There was an earlier question about finding the size of the display
> screen. I am familiar with David's answer:-
> 
>         DEVICE, GET_SCREEN_SIZE = My_screen_size
> 
> However, I am running under OpenVMS, CDE, Motif with X-windows. In my
> application, I create displays on a number of display devices using the
> DISPLAY_NAME keyword to WIDGET_BASE.
> 
> Does anyone know how I can find the size of these (remote) displays?
> Some of these displays are PCs with an X-window emulator, so the
> resolution may be changed by the users without the knowledge of the
> system.

I don't know of any way to do this using IDL commands. The only
information you can return about a widget on a remote display seems to
be the geometry of the widget itself, e.g.

base = widget_base(display_name='merlin.gecm.com:0')
text = widget_text(base, value='Hello world')
widget_control, base, /realize
info = widget_info(base, /geometry)
print, info

However you can find the remote display dimensions using a spawn
command, e.g.

display = 'merlin.hp.com:0'
command = string(display, $    ; csh syntax
  format='("setenv DISPLAY ", a, " ; xdpyinfo | fgrep dimensions")')
command = string(display, $    ; ksh syntax
  format='("export DISPLAY=", a, " ; xdpyinfo | fgrep dimensions")')
spawn, command, result
print, result
  dimensions:    1280x1024 pixels (361x288 millimeters)

I'll leave it as an exercise for the reader to extract the dimension
values from the result string.

Caveats:
(1) This only works if your host system (where IDL is running) is UNIX.
(2) If you don't have permission to create graphics on the remote
display, the spawn command hangs (at least it does on my Linux box,
where the remote display is an NT box running XWin-32).
Cheers,
Liam.

-- 
Liam E. Gumley
Space Science and Engineering Center, UW-Madison
http://cimss.ssec.wisc.edu/~gumley