Find the answer to your Linux question:
Results 1 to 4 of 4
Hello everybody, I am writing a program using xlib to check a window B that was created from another window A. How to get information from window B to know ...
  1. #1
    Just Joined!
    Join Date
    Jul 2008
    Posts
    2

    (xlib help) How to know the window created from which window?

    Hello everybody,

    I am writing a program using xlib to check a window B that was created from another window A.
    How to get information from window B to know that window B was created from window A ?
    ex.To check the pidgin conversation window then get the buddy list window id.

    Thanks in advance,

    Cyrus

  2. #2
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    Use XQueryTree().
    --
    Bill

    Old age and treachery will overcome youth and skill.

  3. #3
    Just Joined!
    Join Date
    Jul 2008
    Posts
    2
    Thanks for quick reply.

    I have tried XQueryTree the windowB to get parent window, but if windowB have been reparented the XQueryTree can't get the relationship with windowA.
    It seems that the only way to get the window hierarchy is to XQueryTree the "Root" window not directly XQueryTree a children window.

    Cyrus

  4. #4
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    It's not clear that reparenting is what's going on here.

    It's my impression (though I could be wrong) that reparenting is only done by the window manager, and only done to top-level windows. So if window B was originally a descendant (perhaps a child) of window A, then the window manager would not reparent window B.

    But the application itself could have created window B so that it is not a child, but is some other descendant, of window A. If that's the case, simply take window B and find its parent, and that parent's parent, and so on, to see whether window A is an ancestor of window B.

    That sounds complicated, but it is less complicated than taking the root window and figuring out the whole window structure.

    If you've already done that, though, you might want to stick with code that works. :)
    --
    Bill

    Old age and treachery will overcome youth and skill.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...