dave giffin wrote:
> 
> 
> I need to be able to tell which process a given window
> was created by. (Window ID=>Process ID)
> 
> Apparently, X servers don't know which process a
> client is, they just get a socket (b/c of X's network
> transparency).
> 
> It has been suggested that I could run a program like
> netstat on the client machine(which in my case is the
> same machine running the server) to get a list of
> which sockets belong to which processes.
> 
> Then, I need to get the ID of the foreign socket
> (socket ID on client end) from which a window was
> created.
> 
> What would work well is if the socket ID and the
> client/window ID could be written to STDOUT or STDIN
> when the window is created. Then I can have a script
> read the server's STDOUT or STDIN and compare it to
> the list of socket IDs and process IDs from netstat on
> the client machine (which for my purposes is on the
> same machine as the server).
> 
> MY PROBLEM: I don't know how to get XFree86 to write
> the socket ID and client ID when a window is created!
> 
> Today, I was looking at the XFree86(4.3.0) source code
> for the first time and trying some different hacks to
> get the info I wanted to print.
> 
> In xc/programs/Xserver/dix/dispatch.c, I found
> ProcCreateWindow and the ClientPtr structure. I was
> able to get X to print client->index and
> client->OsPrivate->fd when a new window was created.
> 
> Which is what I want, except that the client index
> that is printed is always 2 and the socket ID is
> always 13. 13 is the ID of the socket that X listens
> on and I think 2 is the server client?
> 
> What am I doing wrong?
> 
> How can I print the Window ID and foreign/from socket
> ID of a client when a window is created?
> 
> :) thanx


This does indeed sound like the 'hard way'...  There has been some work
on various window manager projects to tie this information together. For
example, in the development code for enlightenment, the direction taken
was to tag application windows on launch with their process id as a
property.  Then the window manager has no trouble retrieving this
information at a later time.

Would something like that work for you?  Or is there some reason you
feel it needs to be done at the xfree86 level?

-- 
Kevin
_______________________________________________
Devel mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/devel

Reply via email to