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

unsigned char* xdo_getwinprop ( const xdo_t xdo,
Window  window,
Atom  atom,
long *  nitems,
Atom *  type,
int *  size 
)

Generic property fetch.

Parameters:
window the window to query
atom the Atom to request
nitems the number of items
type the type of the return
size the size of the type
Returns:
data consisting of 'nitems' items of size 'size' and type 'type' will need to be cast to the type before using.

Definition at line 1288 of file xdo.c.

References xdo::xdpy.

                                                                   {
  Atom actual_type;
  int actual_format;
  unsigned long _nitems;
  unsigned long nbytes;
  unsigned long bytes_after; /* unused */
  unsigned char *prop;
  int status;

  status = XGetWindowProperty(xdo->xdpy, window, atom, 0, (~0L),
                              False, AnyPropertyType, &actual_type,
                              &actual_format, &_nitems, &bytes_after,
                              &prop);
  if (status == BadWindow) {
    fprintf(stderr, "window id # 0x%lx does not exists!", window);
    return NULL;
  } if (status != Success) {
    fprintf(stderr, "XGetWindowProperty failed!");
    return NULL;
  }

  if (actual_format == 32)
    nbytes = sizeof(long);
  else if (actual_format == 16)
    nbytes = sizeof(short);
  else if (actual_format == 8)
    nbytes = 1;
  else if (actual_format == 0)
    nbytes = 0;

  *nitems = _nitems;
  *type = actual_type;
  *size = actual_format;
  return prop;
}


Generated by  Doxygen 1.6.0   Back to index