Find the answer to your Linux question:
Results 1 to 6 of 6
I am writing a media player that uses one process to play the media and another as the frontend. I am using XReparentWindow to reparent the media player window into ...
  1. #1
    Just Joined!
    Join Date
    Nov 2008
    Posts
    3

    XReparentWindow complications

    I am writing a media player that uses one process to play the media and another as the frontend. I am using XReparentWindow to reparent the media player window into the frontend window.

    This works fine until I try to reparent the window again, for example to go fullscreen. When I call XReparentWindow a second time I get BadDrawable errors from the media player.

    Is there something I can do to prevent getting errors when calling XReparentWindow, such as handling some event? Are there any complications from reparenting a window from one process into another rather than using it in a single process?

  2. #2
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    First, there are events associated with reparenting a window. Google this:
    Code:
    man xreparentwindow
    for details.

    But it's more likely that the problem is that more than one process is involved. My first guess is that you're somehow communicating the window ID from one process to another. If that's the case, don't do it. If more than one process is cooperating in using the same windows, each should maintain its own list of window ID's. The X Window system runs on a thin wire model; it makes no assumption that clients are on the same host as the X Window server, or on the same host as other clients.

    This might not be what's causing your problem, but it's the best I can offer.
    --
    Bill

    Old age and treachery will overcome youth and skill.

  3. #3
    Just Joined!
    Join Date
    Nov 2008
    Posts
    3
    You are correct, I am communicating the window ID from one process to another. If I can not pass the parent window ID from my frontend to the media player for use in XReparentWindow how do I obtain a usable window ID? Is there a function for retrieving a window ID for a window created by another process?

  4. #4
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    Is there a function for retrieving a window ID for a window created by another process?
    I'll answer this only hesitantly. The reason I hesitate is that I suspect that this is not really the problem. I can't put a finger on it, but I suspect that there's a subtle bug elsewhere.

    But.

    What you can do is pass from one process to another the geometry (location and width and height) of the window in question. There's a good chance that there's only one such window. If there's more than one, then chances are that one is a parent of the other, and you can also pass whether you want the parent window or the child window. Then the receiving process can use XQueryTree() to find the window that corresponds to the geometry.

    That's not rocket science, but it's not the sort of thing you bang out in five minutes, either. So please please please keep looking for some alternative explanation, something related to a bug somewhere.

    I wish I could be more helpful.
    --
    Bill

    Old age and treachery will overcome youth and skill.

  5. #5
    Just Joined!
    Join Date
    Nov 2008
    Posts
    3
    Quote Originally Posted by wje_lf View Post
    I can't put a finger on it, but I suspect that there's a subtle bug elsewhere.
    That is certainly a possibility, but the errors only occur after calling XReparentWindow so I figured that was a good place to start looking for coding bugs. I think your suggestions have at least pointed me in the right direction. Thanks for the help.

    I would still appreciate other suggestions anyone might have.

  6. #6
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    I would still appreciate other suggestions anyone might have.
    Me too. Anyone else out there with ideas?
    --
    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
  •  
...