> > Given a Window (ex. Window w, from an event or somewhere else) is it 
> > possible to determine the program that owns that window?
> > To be exact, I want the pid of the process owing the window.
> 
> in pure X... you can't. end of story. Now.. if clients were to put 
> properties on their windows with machine names, PID's etc... that 
> would help

Thanks for that rather discourageing answer... :-(

> (I'd point you to a little handy LD_PRELOAD tool called ehack - it's 
> in enlightenment CVS under the e17/apps/e tree. it's an LD_PRELOAD 
> library that forces an X app to put many properties on their top-level 
> windows. one of these is their PID) :)

I will take a look at that. Thanks.

> I also think that the EWMH hints specify a PID property - but its not 
> enforced.

I have been looking at that, but not many windows sets that hint.

I better tell the whole story behind my question (so others might think 
of a way around the problem):

I want to build a windowmanager (just for fun, not anything big, but 
just a light version of blackbox or something like that).
I have a list of programs that the user can execute by pressing a key.
When a key is pressed I do the following:
   pid_t *pid = (pid_t *) malloc( sizeof( pid_t ) );

   if( !pid )
      return;

   if( !(*pid = fork()) ) {
      setsid();
      execvp( cmd, NULL );
   } else
      processes = list_insert( processes, pid );

I keep a list of processes.
Now when the window for that command (cmd) comes up, I want to make the 
connection between the pid and the window. But in a CreateNotify event 
all I get is a window. I can't seem to make the connection between what 
window belongs to what process.

Martin Ehmsen
-- 
How we do it ...
Geometers do it with involutions.
Geometres do it symmetrically.
Graph theorists do it in four colours.
Hilbert spacers do it orthogonally.
_______________________________________________
Devel mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/devel

Reply via email to