Re: mapping pid to window handle
From: Kip Rugger (kbr_at_pangea.ca)
Date: 03/09/04
- Previous message: Daniel Ganek: "Re: remote X session"
- In reply to: Xin Li: "mapping pid to window handle"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 9 Mar 2004 12:02:03 -0600
Xin Li <xinli1@illinoisalumni.org> wrote:
>Hi,
>
>I need to find some way to map a given process id to a window handle,
>assuming the PID is responsible for launching a window. The larger
>picture is that, I am writing a launcher where the user can specify a
>program to run. Once the program is launched, the launcher needs to
>return the window handle associated with the primary window of the
>application.
>
>So far, I'm trying to use the _NET_WM_PID atom to grab the PID
>associated with a particular window handle. However, not all
>applications set the _NET_WM_PID property. Mozilla is one such
>example. I feel like there should be some fairly straight forward way
>of getting the window handle associated with a pid, or the pid
>associated with a window handle reliably.
>
>Any help would be greatly appreciated.
>
>TIA
>Xin Li
So if I understand you correctly, you are forking off the app -- thus
you know the pid -- and then you are searching the windows for the
property. And it doesn't work.
The way to do this type of thing is to use the XC-APPGROUP extension
(you can check if you have it with xdpyinfo). The extension allows
you to flag an application at launch time as belonging to an appgroup,
and you can get events and make queries based on this. In your case,
you want to get events when the app creates top-level windows.
I recently posted sample code to allow you to embed one application in
another. You actually want the non-embeded case (or so it sounds),
but it is very similar. The code is at
http://groups.google.com/groups?q=appgroup+group:comp.windows.x.*&hl=en&
lr=&ie=UTF-8&group=comp.windows.x.*&selm=buhtoo%24fu%241%40rugger.nodomain.
ca&rnum=3
- Previous message: Daniel Ganek: "Re: remote X session"
- In reply to: Xin Li: "mapping pid to window handle"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|