|
|
1.1 ! root 1: #include "copyright.h" ! 2: ! 3: /* $Header: XGetWAttrs.c,v 11.18 87/09/11 08:09:17 toddb Exp $ */ ! 4: /* Copyright Massachusetts Institute of Technology 1986 */ ! 5: ! 6: #define NEED_REPLIES ! 7: #include "Xlibint.h" ! 8: ! 9: Status XGetWindowAttributes(dpy, w, att) ! 10: register Display *dpy; ! 11: Window w; ! 12: XWindowAttributes *att; ! 13: ! 14: { ! 15: xGetWindowAttributesReply rep; ! 16: xGetGeometryReply rep2; ! 17: register xResourceReq *req1; ! 18: register xResourceReq *req2; ! 19: register int i; ! 20: register Screen *sp; ! 21: ! 22: LockDisplay(dpy); ! 23: GetResReq(GetWindowAttributes, w, req1); ! 24: if (!_XReply (dpy, (xReply *)&rep, ! 25: (sizeof(xGetWindowAttributesReply) - sizeof(xReply)) >> 2, xTrue)) { ! 26: UnlockDisplay(dpy); ! 27: SyncHandle(); ! 28: return (0); ! 29: } ! 30: att->class = rep.class; ! 31: att->bit_gravity = rep.bitGravity; ! 32: att->win_gravity = rep.winGravity; ! 33: att->backing_store = rep.backingStore; ! 34: att->backing_planes = rep.backingBitPlanes; ! 35: att->backing_pixel = rep.backingPixel; ! 36: att->save_under = rep.saveUnder; ! 37: att->colormap = rep.colormap; ! 38: att->map_installed = rep.mapInstalled; ! 39: att->map_state = rep.mapState; ! 40: att->all_event_masks = rep.allEventMasks; ! 41: att->your_event_mask = rep.yourEventMask; ! 42: att->do_not_propagate_mask = rep.doNotPropagateMask; ! 43: att->override_redirect = rep.override; ! 44: att->visual = _XVIDtoVisual (dpy, rep.visualID); ! 45: ! 46: GetResReq(GetGeometry, w, req2); ! 47: ! 48: if (!_XReply (dpy, (xReply *)&rep2, 0, xTrue)) { ! 49: UnlockDisplay(dpy); ! 50: SyncHandle(); ! 51: return (0); ! 52: } ! 53: att->x = rep2.x; ! 54: att->y = rep2.y; ! 55: att->width = rep2.width; ! 56: att->height = rep2.height; ! 57: att->border_width = rep2.borderWidth; ! 58: att->depth = rep2.depth; ! 59: att->root = rep2.root; ! 60: /* find correct screen so that applications find it easier.... */ ! 61: for (i = 0; i < dpy->nscreens; i++) { ! 62: sp = &dpy->screens[i]; ! 63: if (sp->root == att->root) { ! 64: att->screen = sp; ! 65: break; ! 66: } ! 67: } ! 68: UnlockDisplay(dpy); ! 69: SyncHandle(); ! 70: return(1); ! 71: } ! 72:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.