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

int xdo_get_desktop_for_window ( const xdo_t xdo,
Window  wid,
long *  desktop 
)

Get the desktop a window is on. Uses _NET_WM_DESKTOP of the EWMH spec.

Parameters:
wid the window to query
deskto pointer to long where the desktop of the window is stored

Definition at line 545 of file xdo.c.

References xdo::xdpy.

                                                                            {
  Atom type;
  int size;
  long nitems;
  unsigned char *data;
  Atom request;

  if (_xdo_ewmh_is_supported(xdo, "_NET_WM_DESKTOP") == False) {
    fprintf(stderr,
            "Your windowmanager claims not to support _NET_WM_DESKTOP, "
            "so the attempt to query a window's desktop location was "
            "aborted.\n");
    return XDO_ERROR;
  }

  request = XInternAtom(xdo->xdpy, "_NET_WM_DESKTOP", False);

  data = xdo_getwinprop(xdo, wid, request, &nitems, &type, &size);

  if (nitems > 0) {
    *desktop = *((long*)data);
  } else {
    *desktop = -1;
  }
  free(data);

  return _is_success("XGetWindowProperty[_NET_WM_DESKTOP]",
                     *desktop == -1);
}


Generated by  Doxygen 1.6.0   Back to index