Skip to content

Instantly share code, notes, and snippets.

@chjj
Created November 1, 2011 08:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chjj/1330126 to your computer and use it in GitHub Desktop.
Save chjj/1330126 to your computer and use it in GitHub Desktop.
x frame extents
static void
get_frame_extents(Display *dpy, Window w, int *top) {
long *extents;
Atom actual_type;
int actual_format;
unsigned long nitems, bytes_after;
unsigned char *data = NULL;
int result;
*top = 0;
result = XGetWindowProperty(
dpy, w, XInternAtom(dpy, "_NET_FRAME_EXTENTS", False),
0, 4, False, AnyPropertyType,
&actual_type, &actual_format,
&nitems, &bytes_after, &data);
if (result == Success) {
printf("nitems: %u, after: %u\n", nitems, bytes_after);
if ((nitems == 4) && (bytes_after == 0)) {
extents = (long *)data;
*top = (int) *(extents + 2);
}
XFree(data);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment