Status XPanoramiXGetScreenSize ( Display *dpy, Drawable drawable, int screen_num, XPanoramiXInfo *panoramiX_info ) { XExtDisplayInfo *info = find_display (dpy); xPanoramiXGetScreenSizeReply rep; register xPanoramiXGetScreenSizeReq *req; PanoramiXCheckExtension (dpy, info, 0); LockDisplay (dpy); GetReq (PanoramiXGetScreenSize, req); req->reqType = info->codes->major_opcode; req->panoramiXReqType = X_PanoramiXGetScreenSize; req->window = drawable; req->screen = screen_num; /* need to define */ if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { UnlockDisplay (dpy); SyncHandle (); return 0; } UnlockDisplay (dpy); SyncHandle (); panoramiX_info->window = rep.window; panoramiX_info->screen = rep.screen; panoramiX_info->width = rep.width; panoramiX_info->height = rep.height; return 1; }
static Bool event_to_wire(Display *dpy, XEvent *libevent, xEvent *netevent) { Bool status = False; XExtDisplayInfo *info = find_display(dpy); XTrapCheckExtension(dpy,info,False); /* If we had more then one event */ #if XETrapNumberErrors > 1 switch((netevent->u.u.type & 0x7f) - info->codes->first_event) { case XETrapData: #endif { XETrapDataEvent *ev = (XETrapDataEvent *) libevent; xETrapDataEvent *event = (xETrapDataEvent *) netevent; event->type = ev->type; event->detail = ev->detail; event->sequenceNumber = (ev->serial & 0xFFFF); event->idx = ev->idx; (void)memcpy(event->data,ev->data,sizeof(event->data)); status = True; } #if XETrapNumberErrors > 1 } #endif return(status); }
Status XPanoramiXGetScreenCount ( Display *dpy, Drawable drawable, XPanoramiXInfo *panoramiX_info ) { XExtDisplayInfo *info = find_display (dpy); xPanoramiXGetScreenCountReply rep; register xPanoramiXGetScreenCountReq *req; PanoramiXCheckExtension (dpy, info, 0); LockDisplay (dpy); GetReq (PanoramiXGetScreenCount, req); req->reqType = info->codes->major_opcode; req->panoramiXReqType = X_PanoramiXGetScreenCount; req->window = drawable; if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { UnlockDisplay (dpy); SyncHandle (); return 0; } UnlockDisplay (dpy); SyncHandle (); panoramiX_info->window = rep.window; panoramiX_info->ScreenCount = rep.ScreenCount; return 1; }
/* * XdbeGetBackBufferAttributes - * This function returns the attributes associated with the specified * buffer. */ XdbeBackBufferAttributes *XdbeGetBackBufferAttributes( Display *dpy, XdbeBackBuffer buffer) { XExtDisplayInfo *info = find_display(dpy); register xDbeGetBackBufferAttributesReq *req; xDbeGetBackBufferAttributesReply rep; XdbeBackBufferAttributes *attr; DbeCheckExtension(dpy, info, (XdbeBackBufferAttributes *)NULL); if (!(attr = (XdbeBackBufferAttributes *)Xmalloc(sizeof(XdbeBackBufferAttributes)))) { return NULL; } LockDisplay(dpy); DbeGetReq(DbeGetBackBufferAttributes, req, info); req->buffer = buffer; if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { UnlockDisplay (dpy); SyncHandle (); return NULL; } attr->window = rep.attributes; UnlockDisplay (dpy); SyncHandle (); return attr; }
static Bool wire_to_event(Display *dpy, XEvent *libevent, xEvent *netevent) { Bool status = False; XExtDisplayInfo *info = find_display(dpy); XTrapCheckExtension(dpy,info,False); /* If we had more then one event */ #if XETrapNumberErrors > 1 switch((netevent->u.u.type & 0x7f) - info->codes->first_event) { case XETrapData: #endif { XETrapDataEvent *ev = (XETrapDataEvent *) libevent; xETrapDataEvent *event = (xETrapDataEvent *) netevent; ev->type = event->type & 0x7F; ev->detail = event->detail; ev->serial = _XSetLastRequestRead(dpy,(xGenericReply *)netevent); ev->synthetic = ((event->type & 0x80) != 0); ev->display = dpy; ev->idx = event->idx; (void)memcpy(ev->data,event->data,sizeof(ev->data)); status = True; } #if XETrapNumberErrors > 1 } #endif return(status); }
/* * XdbeSwapBuffers - * This function swaps the front and back buffers for a list of windows. * The argument num_windows specifies how many windows are to have their * buffers swapped; it is the number of elements in the swap_info array. * The argument swap_info specifies the information needed per window * to do the swap. */ Status XdbeSwapBuffers ( Display *dpy, XdbeSwapInfo *swap_info, int num_windows) { XExtDisplayInfo *info = find_display (dpy); register xDbeSwapBuffersReq *req; int i; DbeCheckExtension (dpy, info, (Status)0 /* failure */); LockDisplay (dpy); DbeGetReq (DbeSwapBuffers, req, info); req->length += 2*num_windows; req->n = num_windows; /* We need to handle 64-bit machines, where we can not use PackData32 * directly because info would be lost in translating from 32- to 64-bit. * Instead we send data via a loop that accounts for the translation. */ for (i = 0; i < num_windows; i++) { char tmp[4]; Data32 (dpy, (long *)&swap_info[i].swap_window, 4); tmp[0] = swap_info[i].swap_action; Data (dpy, (char *)tmp, 4); } UnlockDisplay (dpy); SyncHandle (); return (Status)1; /* success */ } /* XdbeSwapBuffers() */
XdbeBackBuffer XdbeAllocateBackBufferName( Display *dpy, Window window, XdbeSwapAction swap_action) { XExtDisplayInfo *info = find_display (dpy); register xDbeAllocateBackBufferNameReq *req; XdbeBackBuffer buffer; /* make sure extension is available; if not, return the * third parameter (0). */ DbeCheckExtension (dpy, info, (XdbeBackBuffer)0); /* allocate the id */ buffer = XAllocID (dpy); LockDisplay(dpy); DbeGetReq(DbeAllocateBackBufferName, req, info); req->window = window; req->swapAction = (unsigned char)swap_action; req->buffer = buffer; UnlockDisplay (dpy); SyncHandle (); return buffer; } /* XdbeAllocateBackBufferName() */
/* * XdbeQueryExtension - * Sets major_version_return and minor_verion_return to the major and * minor DBE protocol version supported by the server. If the DBE * library is compatible with the version returned by the server, this * function returns non-zero. If dpy does not support the DBE * extension, or if there was an error during communication with the * server, or if the server and library protocol versions are * incompatible, this functions returns zero. No other Xdbe functions * may be called before this function. If a client violates this rule, * the effects of all subsequent Xdbe calls are undefined. */ Status XdbeQueryExtension ( Display *dpy, int *major_version_return, int *minor_version_return) { XExtDisplayInfo *info = find_display (dpy); xDbeGetVersionReply rep; register xDbeGetVersionReq *req; if (!XextHasExtension (info)) return (Status)0; /* failure */ LockDisplay (dpy); DbeGetReq (DbeGetVersion, req, info); req->majorVersion = DBE_MAJOR_VERSION; req->minorVersion = DBE_MINOR_VERSION; if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { UnlockDisplay (dpy); SyncHandle (); return (Status)0; /* failure */ } *major_version_return = rep.majorVersion; *minor_version_return = rep.minorVersion; UnlockDisplay (dpy); SyncHandle (); if (*major_version_return != DBE_MAJOR_VERSION) return (Status)0; /* failure */ else return (Status)1; /* success */ }
static Bool QueryAttributePermissionsInternal ( Display *dpy, unsigned int attribute, NVCTRLAttributePermissionsRec *permissions, unsigned int reqType ) { XExtDisplayInfo *info = find_display (dpy); xnvCtrlQueryAttributePermissionsReply rep; xnvCtrlQueryAttributePermissionsReq *req; Bool exists; if(!XextHasExtension(info)) return False; XNVCTRLCheckExtension (dpy, info, False); LockDisplay(dpy); GetReq(nvCtrlQueryAttributePermissions, req); req->reqType = info->codes->major_opcode; req->nvReqType = reqType; req->attribute = attribute; if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { UnlockDisplay (dpy); SyncHandle(); return False; } exists = rep.flags; if (exists && permissions) { permissions->type = rep.attr_type; permissions->permissions = rep.perms; } UnlockDisplay(dpy); SyncHandle(); return exists; }
/* * XmbufGetBufferAttributes - * Gets the attributes for the indicated buffer. Returns non-zero on * success and zero if an error occurs. */ Status XmbufGetBufferAttributes ( Display *dpy, Multibuffer b, XmbufBufferAttributes *attr) { XExtDisplayInfo *info = find_display (dpy); register xMbufGetBufferAttributesReq *req; xMbufGetBufferAttributesReply rep; MbufCheckExtension (dpy, info, 0); LockDisplay (dpy); MbufGetReq (MbufGetBufferAttributes, req, info); req->buffer = b; if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { UnlockDisplay (dpy); SyncHandle (); return 0; } attr->window = rep.window; attr->event_mask = rep.eventMask; attr->buffer_index = rep.bufferIndex; attr->side = rep.side; UnlockDisplay (dpy); SyncHandle(); return 1; }
Status XResQueryClientPixmapBytes ( Display *dpy, XID xid, unsigned long *bytes ) { XExtDisplayInfo *info = find_display (dpy); xXResQueryClientPixmapBytesReq *req; xXResQueryClientPixmapBytesReply rep; *bytes = 0; XResCheckExtension (dpy, info, 0); LockDisplay (dpy); GetReq (XResQueryClientPixmapBytes, req); req->reqType = info->codes->major_opcode; req->XResReqType = X_XResQueryClientPixmapBytes; req->xid = xid; if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { UnlockDisplay (dpy); SyncHandle (); return 0; } #ifdef LONG64 *bytes = (rep.bytes_overflow * 4294967295) + rep.bytes; #else *bytes = rep.bytes_overflow ? 0xffffffff : rep.bytes; #endif UnlockDisplay (dpy); SyncHandle (); return 1; }
/* * XmbufCreateBuffers - * Requests that "count" buffers be created with the given update_action * and update_hint and be associated with the indicated window. The * number of buffers created is returned (zero if an error occurred) * and buffers_return is filled in with that many Multibuffer identifiers. */ int XmbufCreateBuffers ( Display *dpy, Window w, int count, int update_action, int update_hint, Multibuffer *buffers) { XExtDisplayInfo *info = find_display (dpy); xMbufCreateImageBuffersReply rep; register xMbufCreateImageBuffersReq *req; int result; MbufCheckExtension (dpy, info, 0); LockDisplay (dpy); XAllocIDs(dpy, buffers, count); MbufGetReq (MbufCreateImageBuffers, req, info); req->window = w; req->updateAction = update_action; req->updateHint = update_hint; req->length += count; count <<= 2; PackData32 (dpy, buffers, count); if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { UnlockDisplay (dpy); SyncHandle (); return 0; } result = rep.numberBuffer; UnlockDisplay (dpy); SyncHandle (); return result; }
Bool XNVCtrlSelectNotify ( Display *dpy, int screen, int type, Bool onoff ) { XExtDisplayInfo *info = find_display (dpy); xnvCtrlSelectNotifyReq *req; if(!XextHasExtension (info)) return False; XNVCTRLCheckExtension (dpy, info, False); LockDisplay (dpy); GetReq (nvCtrlSelectNotify, req); req->reqType = info->codes->major_opcode; req->nvReqType = X_nvCtrlSelectNotify; req->screen = screen; req->notifyType = type; req->onoff = onoff; UnlockDisplay (dpy); SyncHandle (); return True; }
/* * event_to_wire - convert a C event structure to a wire event in * network format */ static Status event_to_wire (Display *dpy, XEvent *libevent, xEvent *netevent) { XExtDisplayInfo *info = find_display (dpy); MbufCheckExtension (dpy, info, 0); switch ((libevent->type & 0x7f) - info->codes->first_event) { case MultibufferClobberNotify: { XmbufClobberNotifyEvent *ev; xMbufClobberNotifyEvent *event; ev = (XmbufClobberNotifyEvent *) libevent; event = (xMbufClobberNotifyEvent *) netevent; event->type = ev->type; event->sequenceNumber = (ev->serial & 0xffff); event->buffer = ev->buffer; event->state = ev->state; return 1; } case MultibufferUpdateNotify: { XmbufUpdateNotifyEvent *ev; xMbufUpdateNotifyEvent *event; ev = (XmbufUpdateNotifyEvent *) libevent; event = (xMbufUpdateNotifyEvent *) netevent; event->type = ev->type; event->sequenceNumber = (ev->serial & 0xffff); event->buffer = ev->buffer; return 1; } } return 0; }
Bool XNVCTRLQueryTargetCount ( Display *dpy, int target_type, int *value ) { XExtDisplayInfo *info = find_display (dpy); xnvCtrlQueryTargetCountReply rep; xnvCtrlQueryTargetCountReq *req; if(!XextHasExtension(info)) return False; XNVCTRLCheckExtension (dpy, info, False); LockDisplay (dpy); GetReq (nvCtrlQueryTargetCount, req); req->reqType = info->codes->major_opcode; req->nvReqType = X_nvCtrlQueryTargetCount; req->target_type = target_type; if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { UnlockDisplay (dpy); SyncHandle (); return False; } if (value) *value = rep.count; UnlockDisplay (dpy); SyncHandle (); return True; }
void XNVCTRLSetTargetAttribute ( Display *dpy, int target_type, int target_id, unsigned int display_mask, unsigned int attribute, int value ) { XExtDisplayInfo *info = find_display (dpy); xnvCtrlSetAttributeReq *req; XNVCTRLSimpleCheckExtension (dpy, info); XNVCTRLCheckTargetData(dpy, info, &target_type, &target_id); LockDisplay (dpy); GetReq (nvCtrlSetAttribute, req); req->reqType = info->codes->major_opcode; req->nvReqType = X_nvCtrlSetAttribute; req->target_type = target_type; req->target_id = target_id; req->display_mask = display_mask; req->attribute = attribute; req->value = value; UnlockDisplay (dpy); SyncHandle (); }
Bool XNVCTRLQueryVersion ( Display *dpy, int *major, int *minor ) { XExtDisplayInfo *info = find_display (dpy); xnvCtrlQueryExtensionReply rep; xnvCtrlQueryExtensionReq *req; if(!XextHasExtension(info)) return False; XNVCTRLCheckExtension (dpy, info, False); LockDisplay (dpy); GetReq (nvCtrlQueryExtension, req); req->reqType = info->codes->major_opcode; req->nvReqType = X_nvCtrlQueryExtension; if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { UnlockDisplay (dpy); SyncHandle (); return False; } if (major) *major = rep.major; if (minor) *minor = rep.minor; UnlockDisplay (dpy); SyncHandle (); return True; }
Bool XNVCTRLIsNvScreen ( Display *dpy, int screen ) { XExtDisplayInfo *info = find_display (dpy); xnvCtrlIsNvReply rep; xnvCtrlIsNvReq *req; Bool isnv; if(!XextHasExtension(info)) return False; XNVCTRLCheckExtension (dpy, info, False); LockDisplay (dpy); GetReq (nvCtrlIsNv, req); req->reqType = info->codes->major_opcode; req->nvReqType = X_nvCtrlIsNv; req->screen = screen; if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { UnlockDisplay (dpy); SyncHandle (); return False; } isnv = rep.isnv; UnlockDisplay (dpy); SyncHandle (); return isnv; }
Status XPanoramiXQueryVersion( Display *dpy, int *major_versionp, int *minor_versionp ) { XExtDisplayInfo *info = find_display (dpy); xPanoramiXQueryVersionReply rep; register xPanoramiXQueryVersionReq *req; PanoramiXCheckExtension (dpy, info, 0); LockDisplay (dpy); GetReq (PanoramiXQueryVersion, req); req->reqType = info->codes->major_opcode; req->panoramiXReqType = X_PanoramiXQueryVersion; req->clientMajor = PANORAMIX_MAJOR_VERSION; req->clientMinor = PANORAMIX_MINOR_VERSION; if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { UnlockDisplay (dpy); SyncHandle (); return 0; } *major_versionp = rep.majorVersion; *minor_versionp = rep.minorVersion; UnlockDisplay (dpy); SyncHandle (); return 1; }
static Bool DRI2Authenticate(Display *dpy, XID window, uint32_t token) { XExtDisplayInfo *info = find_display(dpy); xDRI2AuthenticateReply rep; xDRI2AuthenticateReq *req; DRI2CheckExtension(dpy, info, False); LockDisplay(dpy); GetReq(DRI2Authenticate, req); req->reqType = info->codes->major_opcode; req->dri2ReqType = X_DRI2Authenticate; req->window = window; req->magic = token; if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { UnlockDisplay(dpy); SyncHandle(); return False; } UnlockDisplay(dpy); SyncHandle(); return rep.authenticated ? True : False; }
Status XResQueryVersion( Display *dpy, int *major_version_return, int *minor_version_return ) { XExtDisplayInfo *info = find_display (dpy); xXResQueryVersionReply rep; xXResQueryVersionReq *req; XResCheckExtension (dpy, info, 0); LockDisplay (dpy); GetReq (XResQueryVersion, req); req->reqType = info->codes->major_opcode; req->XResReqType = X_XResQueryVersion; req->client_major = XRES_MAJOR_VERSION; req->client_minor = XRES_MINOR_VERSION; if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { UnlockDisplay (dpy); SyncHandle (); return 0; } *major_version_return = rep.server_major; *minor_version_return = rep.server_minor; UnlockDisplay (dpy); SyncHandle (); return 1; }
Status XevieQueryVersion( Display *dpy, int *major_version_return, int *minor_version_return) { XExtDisplayInfo *info = find_display (dpy); xXevieQueryVersionReply rep; xXevieQueryVersionReq *req; XextCheckExtension(dpy, info, xevie_extension_name, False); major_opcode = info->codes->major_opcode; LockDisplay(dpy); GetReq(XevieQueryVersion, req); req->reqType = major_opcode; req->xevieReqType = X_XevieQueryVersion; req->client_major_version = XEVIE_MAJOR_VERSION; req->client_minor_version = XEVIE_MINOR_VERSION; if (!_XReply(dpy, (xReply *)&rep, 0, xTrue)) { UnlockDisplay(dpy); SyncHandle(); return False; } *major_version_return = rep.server_major_version; *minor_version_return = rep.server_minor_version; UnlockDisplay(dpy); SyncHandle(); return True; }
/* * XmbufChangeBufferAttributes - * Sets the attributes for the indicated buffer. This is currently * limited to the event_mask. */ void XmbufChangeBufferAttributes ( Display *dpy, Multibuffer b, unsigned long valuemask, XmbufSetBufferAttributes *attr) { XExtDisplayInfo *info = find_display (dpy); register xMbufSetBufferAttributesReq *req; MbufSimpleCheckExtension (dpy, info); LockDisplay (dpy); MbufGetReq (MbufSetBufferAttributes, req, info); req->buffer = b; if ((req->valueMask = valuemask)) { /* stolen from lib/X/XWindow.c */ unsigned long values[1]; /* one per element in if stmts below */ unsigned long *v = values; unsigned int nvalues; if (valuemask & MultibufferBufferEventMask) *v++ = attr->event_mask; req->length += (nvalues = v - values); nvalues <<= 2; /* watch out for macros... */ Data32 (dpy, (long *) values, (long)nvalues); } UnlockDisplay (dpy); SyncHandle(); }
const xcb_render_query_pict_formats_reply_t * xcb_render_util_query_formats (xcb_connection_t *c) { connection_cache *info = find_display (c); if (!info) return 0; return info->formats; }
const xcb_render_query_version_reply_t * xcb_render_util_query_version (xcb_connection_t *c) { connection_cache *info = find_display (c); if (!info) return 0; return info->version; }
Bool XNVCTRLQueryTargetBinaryData ( Display *dpy, int target_type, int target_id, unsigned int display_mask, unsigned int attribute, unsigned char **ptr, int *len ) { XExtDisplayInfo *info = find_display (dpy); xnvCtrlQueryBinaryDataReply rep; xnvCtrlQueryBinaryDataReq *req; Bool exists; int length, numbytes, slop; if (!ptr) return False; if(!XextHasExtension(info)) return False; XNVCTRLCheckExtension (dpy, info, False); XNVCTRLCheckTargetData(dpy, info, &target_type, &target_id); LockDisplay (dpy); GetReq (nvCtrlQueryBinaryData, req); req->reqType = info->codes->major_opcode; req->nvReqType = X_nvCtrlQueryBinaryData; req->target_type = target_type; req->target_id = target_id; req->display_mask = display_mask; req->attribute = attribute; if (!_XReply (dpy, (xReply *) &rep, 0, False)) { UnlockDisplay (dpy); SyncHandle (); return False; } length = rep.length; numbytes = rep.n; slop = numbytes & 3; exists = rep.flags; if (exists) { *ptr = (unsigned char *) Xmalloc(numbytes); } if (!exists || !*ptr) { _XEatData(dpy, length); UnlockDisplay (dpy); SyncHandle (); return False; } else { _XRead(dpy, (char *) *ptr, numbytes); if (slop) _XEatData(dpy, 4-slop); } if (len) *len = numbytes; UnlockDisplay (dpy); SyncHandle (); return exists; }
Bool XeviQueryExtension (Display *dpy) { XExtDisplayInfo *info = find_display (dpy); if (XextHasExtension(info)) { return True; } else { return False; } }
int XLbxGetEventBase(Display *dpy) { XExtDisplayInfo *info = find_display (dpy); if (XextHasExtension(info)) { return info->codes->first_event; } else { return -1; } }
static Bool wire_to_event(Display *dpy, XEvent *re, xEvent *event) { XExtDisplayInfo *info = find_display(dpy); DRI2CheckExtension(dpy, info, False); TRACE("dri2 wire_to_event\n"); return False; }
static Status event_to_wire(Display *dpy, XEvent *re, xEvent *event) { XExtDisplayInfo *info = find_display(dpy); DRI2CheckExtension(dpy, info, False); TRACE("dri2 event_to_wire\n"); return False; }