[comp.windows.x] Raising shell windows

dshr@SUN.COM (David Rosenthal) (10/21/88)

> Is there an easy way for a shell window to raise itself above its siblings?
> Before you rush to tell me about XRaiseWindow, I would point out that shell
> windows ("shell" as in Xt) are typically reparented by one's favorite
> window manager and are not immediate siblings of other shell windows.
> I know I could get the parent of the shell from XQueryTree but this seems
> a less than desirable solution since it implied knowledge of what the
> window manager does with shell windows.

There are a number of answers to this question:

The Short Answer

As usual,  you simply do what you would have done in the absence of a
window manager.  You do a ConfigureWindow request.  It may work
immediately (if the wm does not reparent) or it may result in a request
to the wm (if it reparents),  but you don't need to worry about this.

Slightly Longer Answer

Do a ConfigureWindow,  but make sure the "sibling" parameter is None.
The reason for this is that the WM may have reparented you,  so you
may no longer know any siblings of the window.  If you get the sibling
wrong,  there will be an error.  So use None.

Remember that your request is just that;  the actual effect of what
you do is up to the policy of the window manager you run.  You are
requesting an allocation of real resources,  and you may not get what
you ask for.  You cannot insist on being on top.

Even Longer Answer
> 
> I know that this is not a normal request for a window to make -- normally
> such requests are made of the window manager itself.  The scenario is this:
> I have an editor that stores the name of the file being edited as a property
> of the window (and also whether it has been edited or not).  I have another
> application, xmake, which runs make, puts the output in a TextWidget,
> and provides a "NextError" command.  This command picks up the next error
> message, searches the window tree to find a window containing that file,
> and requests that that window show the line in question.  It does that last
> bit by setting a "request-line" property on the appropriate window.  When
> the window is notified that someone has requested a particular line, I would
> like it to do its utmost to show the line in question.  Moving the text 
> within the window is no problem.  I would also like to ensure that the window
> be visible.  (And not tiny, either).

You are describing the behaviour of a "Window Group" - see the Inter-Client
Communications Conventions Manual.  In fact,  what you probably want is that
the window with the line will appear at the top of the GROUP,  not at the
top of the entire stack.  Make all the edit windows a group,  use one as
the group leader,  keep a list of the members on that window,  and you don't have
to traverse the tree (expensive and error-prone,  unless you grab the server
which is anti-social).

	David.