[comp.windows.x] Parent window

parlette@nas.nasa.gov (Edward B. Parlette) (12/17/90)

From within my client program I would like to be able to
pop my 'parent window' forward.  (By 'parent window' I mean the
xterm window that the user used to start my program).  This would
allow me to use stderr and stdout for writing error messages. ( I know
there are better ways of informing the user of errors but for 
other reasons I need to be able to do this. )  Thanks for any info.


kelvin				email: kelvin@calvin.larc.nasa.gov
calvin.larc.nasa.gov

aw@bae.bae.bellcore.com (Andrew Wason) (12/18/90)

In article <1990Dec17.135127.867@nas.nasa.gov>, parlette@nas.nasa.gov (Edward B. Parlette) writes:
> From within my client program I would like to be able to
> pop my 'parent window' forward.  (By 'parent window' I mean the
> xterm window that the user used to start my program).  This would
> allow me to use stderr and stdout for writing error messages. ( I know
> there are better ways of informing the user of errors but for 
> other reasons I need to be able to do this. )  Thanks for any info.

Xterm sets the environment variable WINDOWID to the window ID
of the xterm window.  You could do an XRaiseWindow() on this.
But are you sure your client will always be started from an xterm
(not a window manager menu, or from an rsh to another machine,
or from a cmdtool or something else)?

Andrew

--------------------------------------------------------------------------------
Andrew Wason                                        Bell Communications Research
aw@cellar.bae.bellcore.com                          Piscataway, NJ
bellcore!cellar!aw

etaylor@wilkins.iaims.bcm.tmc.edu (Eric Taylor) (12/19/90)

In article <1990Dec17.135127.867@nas.nasa.gov>, parlette@nas.nasa.gov (Edward B. Parlette) writes:
|> 
|> 
|> From within my client program I would like to be able to
|> pop my 'parent window' forward.  (By 'parent window' I mean the
|> xterm window that the user used to start my program).  This would
|> allow me to use stderr and stdout for writing error messages. ( I know
|> there are better ways of informing the user of errors but for 
|> other reasons I need to be able to do this. )  Thanks for any info.

The xterm window has no relationship to the X application
you ran.  It is not a 'parent window'.  It do not believe 
there is any kind of link from your application to the
window id of the xterm that brought it up.  I . E.  an xterm
from an entirely different display could have brought up 
your application.
--
					Eric Taylor
					Baylor College of Medicine
					etaylor@wilkins.bcm.tmc.edu
					(713) 798-3776

mouse@LARRY.MCRCIM.MCGILL.EDU (12/21/90)

> From within my client program I would like to be able to pop my
> 'parent window' forward.  (By 'parent window' I mean the xterm window
> that the user used to start my program).

First, there may not be any such window.  The program may have been
started from the user's .xinitrc or .xsession, by a window manager menu
entry, via rsh, from a dumb terminal, from a non-xterm terminal window,
etc, etc.

Second, you may not be able to in any case; the window manager can deny
the request.

Third, even if the window exists and it is successfully uniconized and
brought forward, it may not be visible even then (think tvtwm with the
"parent window" off in some other part of the desktop).

> This would allow me to use stderr and stdout for writing error
> messages.

The only way to ensure that something printed to stdout or stderr is
visible is to arrange it yourself, by putting it in a window somewhere
in your application.  (Okay, so even that doesn't ensure it; the app
could be invisible for any of various reasons.  But it's as close as
you can reasonably come.)

					der Mouse

			old: mcgill-vision!mouse
			new: mouse@larry.mcrcim.mcgill.edu

gjw@ANDREAS.WR.USGS.GOV (Gregory J. Woodhouse) (12/21/90)

>> From within my client program I would like to be able to pop my
>> 'parent window' forward.  (By 'parent window' I mean the xterm window
>> that the user used to start my program).
>
>First, there may not be any such window.  The program may have been
>started from the user's .xinitrc or .xsession, by a window manager menu
>entry, via rsh, from a dumb terminal, from a non-xterm terminal window,
>etc, etc.
>
>Second, you may not be able to in any case; the window manager can deny
>the request.
>
>Third, even if the window exists and it is successfully uniconized and
>brought forward, it may not be visible even then (think tvtwm with the
>"parent window" off in some other part of the desktop).
>
>> This would allow me to use stderr and stdout for writing error
>> messages.

Why not use pipe or socketpair in conjunction with dup ro force said
output to be written onto a pipe?  Then you could have a program which
reads the "new stderr" and when it sees data it pops a window using
XMapRaised and writes into the window.  Maybe it could even grab the
pointer and wait for a ButtonPress before unmapping the diagnostic
window.

Just an idea.
-----------------------------------------------------------------------------
Gregory Woodhouse          |We know that the center of the earth
gjw@andreas.wr.usgs.gov    |is a fiery molten mass...but it's not
(415) 329-4694 (office)    |good to dwell on it.
(415) 325-7802 (home)      |
U.S. Geological Survey / 345 Middlefield Rd. MS 977 / Menlo Park, CA 94025
-----------------------------------------------------------------------------