Re: X device screen size [message #214 is a reply to message #203] |
Thu, 13 February 1992 11:27  |
steve
Messages: 19 Registered: March 1991
|
Junior Member |
|
|
In article <1992Feb13.104900.10013@urz.unibas.ch>, hofer@urz.unibas.ch (Remo Hofer) writes:
> Is there some way to get the screen size of the X display? I use pv-wave 3.10 on a
> Personal Iris. My problem is this: I want to open some centered windows (for menus)
> and a large window covering the whole screen. Since we use several different X window
> servers (other workstations used as X terminals), I cannot use some constant value
> for the screen size. I realized that the X device knows about this info, because I
> can get it on the screen with "HELP, /DEVICE", wich gives:
>
> Available graphics_devices: 4510 CGM HP LJ NULL PCL PS QMS REGIS SIXEL TEK X
> Current graphics device: X
> Server: X11.0, Silicon Graphics Inc., Release 4
> Display Depth, Size: 8 bits, (1280,1024) <-------- Here it is!!!!!
> Visual Class: PseudoColor (3)
> Bits Per RGB: 8
> Physical Color Map Entries (Used / Total): 16 / 256
> Colormap: Shared, 16 colors. Translation table: Enabled
> Dither Method: Ordered
> Write Mask: 255 (decimal) ff (hex)
> Graphics Function: 3 (copy)
> Current Font: <default>
> Default Backing Store: Pixmap.
> Window Status:
> 31) Window (100, 100), Backing store: Pixmap.
>
> But is there a way to get this info into a variable usable for any procedure?
> Thanks in advance for any help
> Greetings Remo Hofer
> --
> RFC822: <hofer@urz.unibas.ch> or <hofer%urz.unibas.ch@CERNVAX.BITNET>
> X.400: S=hofer;OU=urz;O=unibas;P=SWITCH;A=ARCOM;C=CH
> HEPNET/SPAN: CHGATE::YOGI::HOFER or 20579::48130::HOFER
We asked PVI about this, and their reply was that they felt the user shouldn't
need to know. THANKS A LOT!!!
we hacked this up to trick PV-WAVE into supplying the desired information.
It flashes four little windows up when you first call it, but otherwise works
fine for us under OpenWindows using either twm or olwm, and worked on an
X terminal we have under X11r4, though it might require slight hacking
for other server/window manager combos.
;
; FILE: screen_size.pro
; AUTHOR: Steve Swales
; DATE: January 31, 1992 (Created: January 31, 1992)
; PURPOSE: Get what PV-WAVE doesn't want us to get.
;+
; SYNOPSIS: ss = screen_size([ro[,cb]])
; DESCRIPTION: Get what PV-WAVE doesn't want us to get.
;-
function screen_size,ro,cb
common garbage, reparent_offset, screen, crazy_bottom
; first time, we find the paremeters of the screen and
; window manager offsets...
if n_elements(reparent_offset) eq 0 then begin
wpos= intarr(3,6)
for i=0,4 do begin
window,/free,xsize=2,ysize=2
device,get_window_position=w_pos
wpos(1:2,i) = w_pos
wpos(0,i) = !d.window
endfor
window,/free,xsize=2,ysize=2,xpos=0,ypos=100
device,get_window_position=w_pos
reparent_offset = w_pos - [0,100]
wpos(0,5) = !d.window
screen = intarr(2)
screen(0) = max(wpos(1,0:4)) + 2 - reparent_offset(0)
screen(1) = max(wpos(2,0:4)) + 2 - reparent_offset(1)
; this makes little sense... but seems to keep windows w/border
; on screen
if min(wpos(2,0:4)) lt 0 then begin
crazy_bottom = reparent_offset(0)-reparent_offset(1)
endif else begin
crazy_bottom = reparent_offset(0)*2
endelse
for i=0,5 do begin
wdelete,wpos(0,i)
endfor
endif
; printf,-1,'screen is',screen(0),' x',screen(1)
if n_params() gt 0 then ro = reparent_offset
if n_params() gt 1 then cb = crazy_bottom
return,screen
end
--
+---------+------------------------------------------------- -------+---------+
| | Steve Swales (716) 275-7730,-3194,-5101 | |
| | steve@aldur.lle.rochester.edu (128.151.32.171) | |
| | University of Rochester 250 East River Road | |
| | Laboratory for Laser Energetics Rochester, NY 14623 | |
+---------+------------------------------------------------- -------+---------+
|
|
|