int XSync ( register Display *dpy, Bool discard) { xGetInputFocusReply rep; register xReq *req; LockDisplay(dpy); GetEmptyReq(GetInputFocus, req); (void) _XReply (dpy, (xReply *)&rep, 0, xTrue); if (discard && dpy->head) { _XQEvent *qelt; for (qelt=dpy->head; qelt; qelt=qelt->next) qelt->qserial_num = 0; ((_XQEvent *)dpy->tail)->next = dpy->qfree; dpy->qfree = (_XQEvent *)dpy->head; dpy->head = dpy->tail = NULL; dpy->qlen = 0; } UnlockDisplay(dpy); return 1; }
int XNoOp (register Display *dpy) { _X_UNUSED register xReq *req; LockDisplay(dpy); GetEmptyReq(NoOperation, req); UnlockDisplay(dpy); SyncHandle(); return 1; }
int FSSync( FSServer *svr, Bool discard) { fsListExtensionsReply rep; fsReq *req; GetEmptyReq(ListExtensions, req); (void) _FSReply(svr, (fsReply *) & rep, 0, fsTrue); if (discard && svr->head) { ((_FSQEvent *) svr->tail)->next = _FSqfree; _FSqfree = (_FSQEvent *) svr->head; svr->head = svr->tail = NULL; svr->qlen = 0; } return 1; }
int XGetPointerControl( register Display *dpy, /* the following are return only vars */ int *accel_numer, int *accel_denom, int *threshold) { xGetPointerControlReply rep; xReq *req; LockDisplay(dpy); GetEmptyReq(GetPointerControl, req); (void) _XReply (dpy, (xReply *)&rep, 0, xTrue); *accel_numer = rep.accelNumerator; *accel_denom = rep.accelDenominator; *threshold = rep.threshold; UnlockDisplay(dpy); SyncHandle(); return 1; }
int XGetScreenSaver( register Display *dpy, /* the following are return only vars */ int *timeout, int *interval, int *prefer_blanking, int *allow_exp) /*boolean */ { xGetScreenSaverReply rep; register xReq *req; LockDisplay(dpy); GetEmptyReq(GetScreenSaver, req); (void) _XReply (dpy, (xReply *)&rep, 0, xTrue); *timeout = rep.timeout; *interval = rep.interval; *prefer_blanking = rep.preferBlanking; *allow_exp = rep.allowExposures; UnlockDisplay(dpy); SyncHandle(); return 1; }
Status XReconfigureWMWindow ( register Display *dpy, Window w, int screen, unsigned int mask, XWindowChanges *changes) { XConfigureRequestEvent ev; Window root = RootWindow (dpy, screen); _XAsyncHandler async; _XAsyncErrorState async_state; /* * Only need to go through the trouble if we are actually changing the * stacking mode. */ if (!(mask & CWStackMode)) { XConfigureWindow (dpy, w, mask, changes); return True; } /* * We need to inline XConfigureWindow and XSync so that everything is done * while the display is locked. */ LockDisplay(dpy); /* * XConfigureWindow (dpy, w, mask, changes); */ { unsigned long values[7]; register unsigned long *value = values; long nvalues; register xConfigureWindowReq *req; GetReq(ConfigureWindow, req); async_state.min_sequence_number = dpy->request; async_state.max_sequence_number = dpy->request; async_state.error_code = BadMatch; async_state.major_opcode = X_ConfigureWindow; async_state.minor_opcode = 0; async_state.error_count = 0; async.next = dpy->async_handlers; async.handler = _XAsyncErrorHandler; async.data = (XPointer)&async_state; dpy->async_handlers = &async; req->window = w; mask &= AllMaskBits; req->mask = mask; if (mask & CWX) *value++ = changes->x; if (mask & CWY) *value++ = changes->y; if (mask & CWWidth) *value++ = changes->width; if (mask & CWHeight) *value++ = changes->height; if (mask & CWBorderWidth) *value++ = changes->border_width; if (mask & CWSibling) *value++ = changes->sibling; if (mask & CWStackMode) *value++ = changes->stack_mode; req->length += (nvalues = value - values); nvalues <<= 2; /* watch out for macros... */ Data32 (dpy, (long *) values, nvalues); } /* * XSync (dpy, 0) */ { xGetInputFocusReply rep; register xReq *req; GetEmptyReq(GetInputFocus, req); (void) _XReply (dpy, (xReply *)&rep, 0, xTrue); } DeqAsyncHandler(dpy, &async); UnlockDisplay(dpy); SyncHandle(); /* * If the request succeeded, then everything is okay; otherwise, send event */ if (!async_state.error_count) return True; ev.type = ConfigureRequest; ev.window = w; ev.parent = root; ev.value_mask = (mask & AllMaskBits); ev.x = changes->x; ev.y = changes->y; ev.width = changes->width; ev.height = changes->height; ev.border_width = changes->border_width; ev.above = changes->sibling; ev.detail = changes->stack_mode; return (XSendEvent (dpy, root, False, SubstructureRedirectMask|SubstructureNotifyMask, (XEvent *)&ev)); }