Get an X window ID

Pat Kane pekane52 at gmail.com
Thu May 17 11:42:01 PDT 2007


Thanks for the NetWM tip, I will take a look at the
spec:  http://standards.freedesktop.org/wm-spec/wm-spec-1.4.html
It may help me with a problem I am currently working on,
I need a way to attach a label (window decoration) to windows.

The particular problem that I used my PID_HACK to debug
was on a legacy AIX CDE box, which predates the NetWM
work.  I could not find a call like "getpeerucred()" on AIX,
it appears that that is a Solaris feature... but since I am
about to moved to Solaris 10 devel, that is another
good tip.

Pat
---


On 5/17/07, Daniel Stone <daniel at fooishbar.org> wrote:
> On Thu, May 17, 2007 at 11:00:33AM -0500, Pat Kane wrote:
> > Are you allowed to change Xlib and the X server?
> >
> > If so then this hack might help.
> >
> > A while ago I needed to know, from inside the X server,
> > the PID of a process that created an X connection.
> >
> > I used spare pad bytes in the  xConnClientPrefix initial
> > connection setup message to pass the PID from the client
> > to the X server.  Note that clients might not be on the
> > same machine so you also need the hostname of the client.
>
> NetWM already allows you to use properties to encode the pid and
> hostname of clients as window properties.  I believe the server can
> already get the PID of a client via getpeerucred() or similar.
>
> Cheers,
> Daniel
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
>
> iD8DBQFGTI4FRkzMgPKxYGwRAsdlAJ4s2X5tuQkMwNeqA4RlatlC7CmCJACdG0ao
> CyP2r6eMYMaIa+EGVdMRGZo=
> =bbV6
> -----END PGP SIGNATURE-----
>
>



More information about the xorg mailing list