Logo Search packages:      
Sourcecode: xdotool version File versions  Download package

int xdo_window_get_pid ( const xdo_t xdo,
Window  window 
)

Get the PID owning a window. Not all applications support this. It looks at the _NET_WM_PID property of the window.

Parameters:
window the window to query.
Returns:
the process id or 0 if no pid found.

Definition at line 1595 of file xdo.c.

References xdo::xdpy.

                                                        {
  Atom type;
  int size;
  long nitems;
  unsigned char *data;
  int window_pid = 0;

  if (_NET_WM_PID == (Atom)-1) {
    _NET_WM_PID = XInternAtom(xdo->xdpy, "_NET_WM_PID", False);
  }

  data = xdo_getwinprop(xdo, window, _NET_WM_PID, &nitems, &type, &size);

  if (nitems > 0) {
    /* The data itself is unsigned long, but everyone uses int as pid values */
    window_pid = (int) *((unsigned long *)data);
  }
  free(data);

  return window_pid;
}


Generated by  Doxygen 1.6.0   Back to index