static char * __glXQueryServerString(Display * dpy, int opcode, CARD32 screen, CARD32 name) { xGLXGenericGetStringReq *req; xGLXSingleReply reply; int length; int numbytes; char *buf; CARD32 for_whom = screen; CARD32 glxCode = X_GLXQueryServerString; LockDisplay(dpy); /* All of the GLX protocol requests for getting a string from the server * look the same. The exact meaning of the for_whom field is usually * either the screen number (for glXQueryServerString) or the context tag * (for GLXSingle). */ GetReq(GLXGenericGetString, req); req->reqType = opcode; req->glxCode = glxCode; req->for_whom = for_whom; req->name = name; _XReply(dpy, (xReply *) & reply, 0, False); length = reply.length * 4; numbytes = reply.size; buf = malloc(numbytes); if (buf != NULL) { _XRead(dpy, buf, numbytes); length -= numbytes; } _XEatData(dpy, length); UnlockDisplay(dpy); SyncHandle(); return buf; }
_X_HIDDEN Status _xiQueryVersion(Display * dpy, int *major, int *minor, XExtDisplayInfo *info) { xXIQueryVersionReq *req; xXIQueryVersionReply rep; LockDisplay(dpy); /* This could mean either a malloc problem, or supported version < XInput_2_0 */ if (_XiCheckExtInit(dpy, XInput_2_0, info) == -1) { XExtensionVersion *ext; XExtDisplayInfo *extinfo = XInput_find_display(dpy); if (!extinfo || !extinfo->data) { *major = 0; *minor = 0; return BadRequest; } ext = ((XInputData*)extinfo->data)->vers; *major = ext->major_version; *minor = ext->minor_version; return BadRequest; } GetReq(XIQueryVersion, req); req->reqType = info->codes->major_opcode; req->ReqType = X_XIQueryVersion; req->major_version = *major; req->minor_version = *minor; if (!_XReply(dpy, (xReply*)&rep, 0, xTrue)) { UnlockDisplay(dpy); return BadImplementation; } *major = rep.major_version; *minor = rep.minor_version; UnlockDisplay(dpy); return Success; }
Atom * XRRListProviderProperties (Display *dpy, RRProvider provider, int *nprop) { XExtDisplayInfo *info = XRRFindDisplay(dpy); xRRListProviderPropertiesReply rep; xRRListProviderPropertiesReq *req; int nbytes, rbytes; Atom *props = NULL; RRCheckExtension (dpy, info, NULL); LockDisplay (dpy); GetReq (RRListProviderProperties, req); req->reqType = info->codes->major_opcode; req->randrReqType = X_RRListProviderProperties; req->provider = provider; if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) { UnlockDisplay (dpy); SyncHandle (); *nprop = 0; return NULL; } if (rep.nAtoms) { rbytes = rep.nAtoms * sizeof (Atom); nbytes = rep.nAtoms << 2; props = (Atom *) Xmalloc (rbytes); if (props == NULL) { _XEatDataWords (dpy, rep.length); UnlockDisplay (dpy); SyncHandle (); *nprop = 0; return NULL; } _XRead32 (dpy, (long *) props, nbytes); } *nprop = rep.nAtoms; UnlockDisplay (dpy); SyncHandle (); return props; }
/** * Destroy a pbuffer. * * This function is used to implement \c glXDestroyPbuffer and * \c glXDestroyGLXPbufferSGIX. * * \note * This function dynamically determines whether to use the SGIX_pbuffer * version of the protocol or the GLX 1.3 version of the protocol. */ static void DestroyPbuffer(Display * dpy, GLXDrawable drawable) { struct glx_display *priv = __glXInitialize(dpy); CARD8 opcode; if ((priv == NULL) || (dpy == NULL) || (drawable == 0)) { return; } opcode = __glXSetupForCommand(dpy); if (!opcode) return; LockDisplay(dpy); if ((priv->majorVersion > 1) || (priv->minorVersion >= 3)) { xGLXDestroyPbufferReq *req; GetReq(GLXDestroyPbuffer, req); req->reqType = opcode; req->glxCode = X_GLXDestroyPbuffer; req->pbuffer = (GLXPbuffer) drawable; } else { xGLXVendorPrivateWithReplyReq *vpreq; CARD32 *data; GetReqExtra(GLXVendorPrivateWithReply, 4, vpreq); data = (CARD32 *) (vpreq + 1); data[0] = (CARD32) drawable; vpreq->reqType = opcode; vpreq->glxCode = X_GLXVendorPrivateWithReply; vpreq->vendorCode = X_GLXvop_DestroyGLXPbufferSGIX; } UnlockDisplay(dpy); SyncHandle(); DestroyDRIDrawable(dpy, drawable, GL_TRUE); return; }
GlyphSet XRenderReferenceGlyphSet (Display *dpy, GlyphSet existing) { XRenderExtDisplayInfo *info = XRenderFindDisplay (dpy); GlyphSet gsid; xRenderReferenceGlyphSetReq *req; RenderCheckExtension (dpy, info, 0); LockDisplay(dpy); GetReq(RenderReferenceGlyphSet, req); req->reqType = info->codes->major_opcode; req->renderReqType = X_RenderReferenceGlyphSet; req->gsid = gsid = XAllocID(dpy); req->existing = existing; UnlockDisplay(dpy); SyncHandle(); return gsid; }
GlyphSet XRenderCreateGlyphSet (Display *dpy, _Xconst XRenderPictFormat *format) { XRenderExtDisplayInfo *info = XRenderFindDisplay (dpy); GlyphSet gsid; xRenderCreateGlyphSetReq *req; RenderCheckExtension (dpy, info, 0); LockDisplay(dpy); GetReq(RenderCreateGlyphSet, req); req->reqType = info->codes->major_opcode; req->renderReqType = X_RenderCreateGlyphSet; req->gsid = gsid = XAllocID(dpy); req->format = format->id; UnlockDisplay(dpy); SyncHandle(); return gsid; }
void XDamageSubtract (Display *dpy, Damage damage, XserverRegion repair, XserverRegion parts) { XDamageExtDisplayInfo *info = XDamageFindDisplay (dpy); xDamageSubtractReq *req; XDamageSimpleCheckExtension (dpy, info); LockDisplay (dpy); GetReq (DamageSubtract, req); req->reqType = info->codes->major_opcode; req->damageReqType = X_DamageSubtract; req->damage = damage; req->repair = repair; req->parts = parts; UnlockDisplay (dpy); SyncHandle (); }
Pixmap XCompositeNameWindowPixmap (Display *dpy, Window window) { XCompositeExtDisplayInfo *info = XCompositeFindDisplay (dpy); xCompositeNameWindowPixmapReq *req; Pixmap pixmap; XCompositeCheckExtension (dpy, info, 0); LockDisplay (dpy); GetReq (CompositeNameWindowPixmap, req); req->reqType = info->codes->major_opcode; req->compositeReqType = X_CompositeNameWindowPixmap; req->window = window; pixmap = req->pixmap = XAllocID (dpy); UnlockDisplay (dpy); SyncHandle (); return pixmap; }
void DRI2DestroyDrawable(Display * dpy, XID drawable) { XExtDisplayInfo *info = DRI2FindDisplay(dpy); xDRI2DestroyDrawableReq *req; XextSimpleCheckExtension(dpy, info, dri2ExtensionName); XSync(dpy, False); LockDisplay(dpy); GetReq(DRI2DestroyDrawable, req); req->reqType = info->codes->major_opcode; req->dri2ReqType = X_DRI2DestroyDrawable; req->drawable = drawable; UnlockDisplay(dpy); SyncHandle(); }
Bool XDGASetClientVersion( Display *dpy ){ XExtDisplayInfo *info = xdga_find_display (dpy); xXDGASetClientVersionReq *req; XDGACheckExtension (dpy, info, False); LockDisplay(dpy); GetReq(XDGASetClientVersion, req); req->reqType = info->codes->major_opcode; req->dgaReqType = X_XDGASetClientVersion; req->major = XDGA_MAJOR_VERSION; req->minor = XDGA_MINOR_VERSION; UnlockDisplay(dpy); SyncHandle(); return True; }
void XFixesChangeCursor (Display *dpy, Cursor source, Cursor destination) { XFixesExtDisplayInfo *info = XFixesFindDisplay (dpy); xXFixesChangeCursorReq *req; XFixesSimpleCheckExtension (dpy, info); if (info->major_version < 2) return; LockDisplay (dpy); GetReq (XFixesChangeCursor, req); req->reqType = info->codes->major_opcode; req->xfixesReqType = X_XFixesChangeCursor; req->source = source; req->destination = destination; UnlockDisplay(dpy); SyncHandle(); }
void XFixesDestroyPointerBarrier(Display *dpy, PointerBarrier b) { XFixesExtDisplayInfo *info = XFixesFindDisplay (dpy); xXFixesDestroyPointerBarrierReq *req; XFixesSimpleCheckExtension (dpy, info); if (info->major_version < 5) return; LockDisplay (dpy); GetReq (XFixesDestroyPointerBarrier, req); req->reqType = info->codes->major_opcode; req->xfixesReqType = X_XFixesDestroyPointerBarrier; req->barrier = b; UnlockDisplay (dpy); SyncHandle(); }
int XSetInputFocus( register Display *dpy, Window focus, int revert_to, Time time) { register xSetInputFocusReq *req; LockDisplay(dpy); GetReq(SetInputFocus, req); req->focus = focus; req->revertTo = revert_to; req->time = time; UnlockDisplay(dpy); SyncHandle(); return 1; }
int XSetSelectionOwner( register Display *dpy, Atom selection, Window owner, Time time) { register xSetSelectionOwnerReq *req; LockDisplay(dpy); GetReq(SetSelectionOwner,req); req->selection = selection; req->window = owner; req->time = time; UnlockDisplay(dpy); SyncHandle(); return 1; }
XserverRegion XCompositeCreateRegionFromBorderClip (Display *dpy, Window window) { XCompositeExtDisplayInfo *info = XCompositeFindDisplay (dpy); xCompositeCreateRegionFromBorderClipReq *req; XserverRegion region; XCompositeCheckExtension (dpy, info, 0); LockDisplay (dpy); GetReq (CompositeCreateRegionFromBorderClip, req); req->reqType = info->codes->major_opcode; req->compositeReqType = X_CompositeCreateRegionFromBorderClip; req->window = window; region = req->region = XAllocID (dpy); UnlockDisplay (dpy); SyncHandle (); return region; }
Bool XNVCTRLSetTargetStringAttribute ( Display *dpy, int target_type, int target_id, unsigned int display_mask, unsigned int attribute, char *ptr ) { XExtDisplayInfo *info = find_display (dpy); xnvCtrlSetStringAttributeReq *req; xnvCtrlSetStringAttributeReply rep; int size; Bool success; if(!XextHasExtension(info)) return False; XNVCTRLCheckExtension (dpy, info, False); size = strlen(ptr)+1; LockDisplay (dpy); GetReq (nvCtrlSetStringAttribute, req); req->reqType = info->codes->major_opcode; req->nvReqType = X_nvCtrlSetStringAttribute; req->target_type = target_type; req->target_id = target_id; req->display_mask = display_mask; req->attribute = attribute; req->length += ((size + 3) & ~3) >> 2; req->num_bytes = size; Data(dpy, ptr, size); if (!_XReply (dpy, (xReply *) &rep, 0, False)) { UnlockDisplay (dpy); SyncHandle (); return False; } UnlockDisplay (dpy); SyncHandle (); success = rep.flags; return success; }
static Bool XNVCTRLQueryValidTargetAttributeValues64 ( Display *dpy, XExtDisplayInfo *info, int target_type, int target_id, unsigned int display_mask, unsigned int attribute, NVCTRLAttributeValidValuesRec *values ) { xnvCtrlQueryValidAttributeValues64Reply rep; xnvCtrlQueryValidAttributeValuesReq *req; Bool exists; LockDisplay(dpy); GetReq(nvCtrlQueryValidAttributeValues, req); req->reqType = info->codes->major_opcode; req->nvReqType = X_nvCtrlQueryValidAttributeValues64; req->target_type = target_type; req->target_id = target_id; req->display_mask = display_mask; req->attribute = attribute; if (!_XReply(dpy, (xReply *)&rep, sz_xnvCtrlQueryValidAttributeValues64Reply_extra, xTrue)) { UnlockDisplay(dpy); SyncHandle(); return False; } exists = rep.flags; if (exists) { values->type = rep.attr_type; if (rep.attr_type == ATTRIBUTE_TYPE_RANGE) { values->u.range.min = rep.min_64; values->u.range.max = rep.max_64; } if (rep.attr_type == ATTRIBUTE_TYPE_INT_BITS) { values->u.bits.ints = rep.bits_64; } values->permissions = rep.perms; } UnlockDisplay(dpy); SyncHandle(); return exists; }
int XSetFontPath ( register Display *dpy, char **directories, int ndirs) { register int n = 0; register int i; register int nbytes; char *p; register xSetFontPathReq *req; int retCode; LockDisplay(dpy); GetReq (SetFontPath, req); req->nFonts = ndirs; for (i = 0; i < ndirs; i++) { n += safestrlen (directories[i]) + 1; } nbytes = (n + 3) & ~3; req->length += nbytes >> 2; if ((p = Xmalloc (nbytes))) { /* * pack into counted strings. */ char *tmp = p; for (i = 0; i < ndirs; i++) { register int length = safestrlen (directories[i]); *p = length; memcpy (p + 1, directories[i], length); p += length + 1; } Data (dpy, tmp, nbytes); Xfree ((char *) tmp); retCode = 1; } else retCode = 0; UnlockDisplay(dpy); SyncHandle(); return (retCode); }
Bool XkbSetIndicatorMap(Display *dpy,unsigned long which,XkbDescPtr xkb) { register xkbSetIndicatorMapReq *req; register int i,bit; int nMaps; xkbIndicatorMapWireDesc *wire; XkbInfoPtr xkbi; if ((dpy->flags & XlibDisplayNoXkb) || (!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL))) return False; if ((!xkb)||(!which)||(!xkb->indicators)) return False; LockDisplay(dpy); xkbi = dpy->xkb_info; GetReq(kbSetIndicatorMap, req); req->reqType = xkbi->codes->major_opcode; req->xkbReqType = X_kbSetIndicatorMap; req->deviceSpec = xkb->device_spec; req->which = (CARD32)which; for (i=nMaps=0,bit=1;i<32;i++,bit<<=1) { if (which&bit) nMaps++; } req->length+= (nMaps*sizeof(XkbIndicatorMapRec))/4; BufAlloc(xkbIndicatorMapWireDesc *,wire, (nMaps*SIZEOF(xkbIndicatorMapWireDesc))); for (i=0,bit=1;i<32;i++,bit<<=1) { if (which&bit) { wire->flags= xkb->indicators->maps[i].flags; wire->whichGroups= xkb->indicators->maps[i].which_groups; wire->groups= xkb->indicators->maps[i].groups; wire->whichMods= xkb->indicators->maps[i].which_mods; wire->mods= xkb->indicators->maps[i].mods.real_mods; wire->virtualMods= xkb->indicators->maps[i].mods.vmods; wire->ctrls= xkb->indicators->maps[i].ctrls; wire++; } } UnlockDisplay(dpy); SyncHandle(); return True; }
int XChangeWindowAttributes ( register Display *dpy, Window w, unsigned long valuemask, XSetWindowAttributes *attributes) { register xChangeWindowAttributesReq *req; LockDisplay(dpy); GetReq(ChangeWindowAttributes,req); req->window = w; valuemask &= AllMaskBits; if ((req->valueMask = valuemask)) _XProcessWindowAttributes (dpy, req, valuemask, attributes); UnlockDisplay(dpy); SyncHandle(); return 1; }
int XEGetAvailableRequest(XETC *tc, XETrapGetAvailRep *ret) { int status = True; Display *dpy = tc->dpy; CARD32 X_XTrapGet = tc->extOpcode; xXTrapGetReq *reqptr; xXTrapGetAvailReply rep; int numlongs = (SIZEOF(xXTrapGetAvailReply) - SIZEOF(xReply) + SIZEOF(CARD32) -1 ) / SIZEOF(CARD32); LockDisplay(dpy); GetReq(XTrapGet,reqptr); reqptr->minor_opcode = XETrap_GetAvailable; reqptr->protocol = XETrapProtocol; status = _XReply(dpy,(xReply *)&rep,numlongs,xTrue); SyncHandle(); UnlockDisplay(dpy); memcpy((char *)ret,&(rep.data),sizeof(XETrapGetAvailRep)); return(status); }
void XFixesSelectCursorInput (Display *dpy, Window win, unsigned long eventMask) { XFixesExtDisplayInfo *info = XFixesFindDisplay (dpy); xXFixesSelectCursorInputReq *req; XFixesSimpleCheckExtension (dpy, info); LockDisplay (dpy); GetReq (XFixesSelectCursorInput, req); req->reqType = info->codes->major_opcode; req->xfixesReqType = X_XFixesSelectCursorInput; req->window = win; req->eventMask = eventMask; UnlockDisplay (dpy); SyncHandle (); }
int XEStartTrapRequest(XETC *tc) { int status = True; Display *dpy = tc->dpy; CARD32 X_XTrap = tc->extOpcode; xXTrapReq *reqptr; status = XEFlushConfig(tc); /* Flushout any pending configuration first */ if (status == True) { /* Add our event handler for the XLib transport */ XETrapSetEventHandler(tc, XETrapData, XETrapDispatchXLib); GetReq(XTrap,reqptr); reqptr->minor_opcode = XETrap_StartTrap; XFlush(dpy); SyncHandle(); BitTrue(tc->values.tc_flags, XETCTrapActive); } return(status); }
int XEGetCurrentRequest(XETC *tc, XETrapGetCurRep *ret) { int status = True; Display *dpy = tc->dpy; CARD32 X_XTrap = tc->extOpcode; xXTrapReq *reqptr; xXTrapGetCurReply rep; int numlongs = (SIZEOF(xXTrapGetCurReply) - SIZEOF(xReply) + SIZEOF(CARD32) -1 ) / SIZEOF(CARD32); status = XEFlushConfig(tc); /* Flushout any pending configuration first */ if (status == True) { LockDisplay(dpy); GetReq(XTrap,reqptr); reqptr->minor_opcode = XETrap_GetCurrent; /* to support comm. w/ V3.1 extensions */ if (tc->protocol == 31) { char tmp[284]; /* need space for the big *old* reply */ numlongs = (284-sizeof(xReply)+sizeof(long)-1)/sizeof(long); status = _XReply(dpy,(xReply *)tmp,numlongs,xTrue); memcpy(&rep,tmp,sizeof(rep)); /* move just what's needed */ } else { status = _XReply(dpy,(xReply *)&rep,numlongs,xTrue); } SyncHandle(); UnlockDisplay(dpy); memcpy((char *)ret->state_flags,rep.data_state_flags,2); memcpy((char *)ret->config.flags.valid,rep.data_config_flags_valid,4); memcpy((char *)ret->config.flags.data,rep.data_config_flags_data,4); memcpy((char *)ret->config.flags.req,rep.data_config_flags_req, XETrapMaxRequest); memcpy((char *)ret->config.flags.event,rep.data_config_flags_event, XETrapMaxEvent); ret->config.max_pkt_size=rep.data_config_max_pkt_size; ret->config.cmd_key=rep.data_config_cmd_key; } return(status); }
void XDGACloseFramebuffer( Display *dpy, int screen ){ XExtDisplayInfo *info = xdga_find_display (dpy); xXDGACloseFramebufferReq *req; XextSimpleCheckExtension (dpy, info, xdga_extension_name); XDGAUnmapFramebuffer(screen); LockDisplay(dpy); GetReq(XDGACloseFramebuffer, req); req->reqType = info->codes->major_opcode; req->dgaReqType = X_XDGACloseFramebuffer; req->screen = screen; UnlockDisplay(dpy); SyncHandle(); }
Damage XDamageCreate (Display *dpy, Drawable drawable, int level) { XDamageExtDisplayInfo *info = XDamageFindDisplay (dpy); xDamageCreateReq *req; Damage damage; XDamageCheckExtension (dpy, info, 0); LockDisplay (dpy); GetReq (DamageCreate, req); req->reqType = info->codes->major_opcode; req->damageReqType = X_DamageCreate; req->damage = damage = XAllocID (dpy); req->drawable = drawable; req->level = level; UnlockDisplay (dpy); SyncHandle (); return damage; }
void XDGASelectInput( Display *dpy, int screen, long mask ){ XExtDisplayInfo *info = xdga_find_display (dpy); xXDGASelectInputReq *req; XextSimpleCheckExtension (dpy, info, xdga_extension_name); LockDisplay(dpy); GetReq(XDGASelectInput, req); req->reqType = info->codes->major_opcode; req->dgaReqType = X_XDGASelectInput; req->screen = screen; req->mask = mask; UnlockDisplay(dpy); SyncHandle(); }
void XDGASync( Display *dpy, int screen ){ XExtDisplayInfo *info = xdga_find_display (dpy); xXDGASyncReply rep; xXDGASyncReq *req; XextSimpleCheckExtension (dpy, info, xdga_extension_name); LockDisplay(dpy); GetReq(XDGASync, req); req->reqType = info->codes->major_opcode; req->dgaReqType = X_XDGASync; req->screen = screen; _XReply(dpy, (xReply *)&rep, 0, xFalse); UnlockDisplay(dpy); SyncHandle(); }
void XDGAInstallColormap( Display *dpy, int screen, Colormap cmap ){ XExtDisplayInfo *info = xdga_find_display (dpy); xXDGAInstallColormapReq *req; XextSimpleCheckExtension (dpy, info, xdga_extension_name); LockDisplay(dpy); GetReq(XDGAInstallColormap, req); req->reqType = info->codes->major_opcode; req->dgaReqType = X_XDGAInstallColormap; req->screen = screen; req->cmap = cmap; UnlockDisplay(dpy); SyncHandle(); }
Bool XNVCTRLSetDDCCIBlockLutOperation ( Display *dpy, int screen, unsigned int display_mask, unsigned int color, // NV_CTRL_DDCCI_RED_LUT, NV_CTRL_DDCCI_GREEN_LUT, NV_CTRL_DDCCI_BLUE_LUT unsigned int offset, unsigned int size, unsigned int *value ) { XExtDisplayInfo *info = find_display (dpy); xnvCtrlSetDDCCIBlockLutOperationReq *req; xnvCtrlSetDDCCIBlockLutOperationReply rep; Bool success; if(!XextHasExtension(info)) return False; XNVCTRLCheckExtension (dpy, info, False); LockDisplay (dpy); GetReq (nvCtrlSetDDCCIBlockLutOperation, req); req->reqType = info->codes->major_opcode; req->nvReqType = X_nvCtrlSetDDCCIBlockLutOperation; req->screen = screen; req->display_mask = display_mask; req->color = color; req->offset = offset; req->size = size; req->num_bytes = size << 2; req->length += (req->num_bytes + 3) >> 2; Data(dpy, (char *)value, req->num_bytes ); if (!_XReply (dpy, (xReply *) &rep, 0, False)) { UnlockDisplay (dpy); SyncHandle (); return False; } UnlockDisplay (dpy); SyncHandle (); success = rep.flags; return success; }