[comp.windows.x] Window sizes

jon@oddhack.caltech.edu (Jon Leech) (07/15/87)

Summary:

Expires:

Sender:

Followup-To:

Keywords:



    Is it possible for a program running in an xterm or hpterm (I
think hpterm is only in the HP X distribution) window to query the
window for its size? That is to say, using X library calls rather
than the 'resize' mechanism, which doesn't seem to exist in hpterm
windows and is kind of klunky anyway. The 'xwininfo' program does
basically what I want, but it appears to require human interaction to
select a window. Also, I would like the size in rows and columns of
text, not pixels.

    We are running X 10.4 on HP 9000/320 workstations.

    Thanks,

--
    Jon Leech (jon@csvax.caltech.edu || ...seismo!cit-vax!jon)
    Caltech Computer Science Graphics Group
    __@/

SUSHIDO - The Way of the Tuna

swick@ATHENA.MIT.EDU (Ralph R. Swick) (07/15/87)

>     Is it possible for a program running in an xterm or hpterm (I
> think hpterm is only in the HP X distribution) window to query the
> window for its size?

On systems that support SIGWINCH, you should use the standard os mechanisms,
as xterm reports the proper thing to the os.

Without SIGWINCH, you'll need to know the window id (to do the Xlib query
for the window geometry) and the font id (to do the Xlib query for character
width and height) and then you can do the computation to get rows/columns.

xterm/10.4 sets the WINDOWID environment variable, but doesn't tell you
the font it's been asked to use.

-Ralph

bob%tut.cis.ohio-state.edu@osu-eddie.UUCP (Bob Sutterfield) (07/16/87)

In article <3239@cit-vax.Caltech.Edu> jon@oddhack.Caltech.EDU (Jon Leech) writes:
>
>    Is it possible for a program running in an xterm or hpterm (I
>think hpterm is only in the HP X distribution) window to query the
>window for its size?  ...Also, I would like the size in rows and
>columns of text, not pixels.

Look in the document `Xterm Control Sequences', under `Sun TTY
emulation'.  You want to send "\e[18t", and will get back
"\e[8;<rows>;<columns>t" where \e is the escape character (octal 33)
and <rows> and <columns> are strings of decimal digits.

You can find the document as X.V10R4/doc/Control.doc.
-=-
 Bob Sutterfield, Department of Computer and Information Science
 The Ohio State University; 2036 Neil Ave. Columbus OH USA 43210-1277
 bob@ohio-state.{arpa,csnet} or ...!cbosgd!osu-eddie!bob
 soon: bob@aargh.cis.ohio-state.edu