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

int xdo_window_get_active ( const xdo_t xdo,
Window *  window_ret 
)

Get the currently-active window. Requires your window manager to support this. Uses _NET_ACTIVE_WINDOW from the EWMH spec.

Parameters:
window_ret Pointer to Window where the active window is stored.

Definition at line 575 of file xdo.c.

References xdo::xdpy.

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

  if (_xdo_ewmh_is_supported(xdo, "_NET_ACTIVE_WINDOW") == False) {
    fprintf(stderr,
            "Your windowmanager claims not to support _NET_ACTIVE_WINDOW, "
            "so the attempt to query the active window aborted.\n");
    return XDO_ERROR;
  }

  request = XInternAtom(xdo->xdpy, "_NET_ACTIVE_WINDOW", False);
  root = XDefaultRootWindow(xdo->xdpy);
  data = xdo_getwinprop(xdo, root, request, &nitems, &type, &size);

  if (nitems > 0) {
    *window_ret = *((Window*)data);
  } else {
    *window_ret = 0;
  }
  free(data);

  return _is_success("XGetWindowProperty[_NET_ACTIVE_WINDOW]",
                     *window_ret == 0);
}


Generated by  Doxygen 1.6.0   Back to index