I realize this isn't exactly what you were asking to do, but perhaps you
should look at the manpage for XCirculateSubwindows.

XCirculateSubwindowsDown will lower your top window to the bottom and
the one below it will be on top.   This is very similar to what you
wanted to do and doesn't require you to parse the window tree.

Keep in mind though, for some users, the topmost window is not always
the one that has focus (this is even true of win32 programming when
focus follows pointer (or win32 XMouse) is set), and you must
specifically set input focus to the window.   Also some users detest
it (read as "I hate it") when window stacking order is changed on them
by applications.

-- Nathan Laredo
[EMAIL PROTECTED]

On Mon, 12 Jul 2004 11:02:05 +0300, Eugen Andronic
<[EMAIL PROTECTED]> wrote:
> Hello all,
> I'm new to X window programming, so maybe my problem is very simple for many
> of you. The problem is:
> I have a "stack" of apps running on top of the X. None of them are "stay on
> top". Let's say the following windows are on the system:
> 
> desktop, x1, x2, ....., xn
> 
> From the xi window I want to find the main window of the app bellow xi ( let's
> say xi-1) and to give it the focus.
> 
> My attempt was:
>        int root;
>        int parent;
>        unsigned int nchildren;
>        int* children;
>        Display* d;
> 
>        d = XOpenDisplay("");
>        int w = XDefaultRootWindow(d); //w should be the desktop
>        int ret = XQueryTree(d, w, (Window*)&root, (Window*)&parent,
> (Window**)&children, &nchildren );
> 
> I have the ID of my window and I want to find which is the window imediately
> bellow it. Following the man of XQueryTree I thought the IDs are from bottom
> to top but I'm not sure the list is "sorted" from the point of view of "Z"
> order.
>        so, my need is ID_bellow_me = Some_Func_To_Find_The_ID();
> 
> and then,
>        XSetInputFocus( d, ID_bellow_me, RevertToNone, CurrentTime );
>        XFree( children );
>        XCloseDisplay(d);
> 
> Thanks for your help,
> Eugen
> 
> _______________________________________________
> Devel mailing list
> [EMAIL PROTECTED]
> http://XFree86.Org/mailman/listinfo/devel
>
_______________________________________________
Devel mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/devel

Reply via email to