本文整理汇总了C++中SyncHandle函数的典型用法代码示例。如果您正苦于以下问题:C++ SyncHandle函数的具体用法?C++ SyncHandle怎么用?C++ SyncHandle使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SyncHandle函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SDL_NAME
Bool SDL_NAME(XF86DGASetViewPort)(
Display* dpy,
int screen,
int x,
int y
){
XExtDisplayInfo *info = SDL_NAME(xdga_find_display) (dpy);
xXF86DGASetViewPortReq *req;
XF86DGACheckExtension (dpy, info, False);
LockDisplay(dpy);
GetReq(XF86DGASetViewPort, req);
req->reqType = info->codes->major_opcode;
req->dgaReqType = X_XF86DGASetViewPort;
req->screen = screen;
req->x = x;
req->y = y;
UnlockDisplay(dpy);
SyncHandle();
XSync(dpy,False);
return True;
}
示例2: glAreTexturesResidentEXT
GLboolean
glAreTexturesResidentEXT(GLsizei n, const GLuint * textures,
GLboolean * residences)
{
struct glx_context *const gc = __glXGetCurrentContext();
if (gc->isDirect) {
return GET_DISPATCH()->AreTexturesResident(n, textures, residences);
}
else {
struct glx_context *const gc = __glXGetCurrentContext();
Display *const dpy = gc->currentDpy;
GLboolean retval = (GLboolean) 0;
const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
if (__builtin_expect((n >= 0) && (dpy != NULL), 1)) {
GLubyte const *pc =
__glXSetupVendorRequest(gc, X_GLXVendorPrivateWithReply,
X_GLvop_AreTexturesResidentEXT,
cmdlen);
(void) memcpy((void *) (pc + 0), (void *) (&n), 4);
(void) memcpy((void *) (pc + 4), (void *) (textures), (n * 4));
if (n & 3) {
/* see comments in __indirect_glAreTexturesResident() */
GLboolean *res4 = malloc((n + 3) & ~3);
retval = (GLboolean) __glXReadReply(dpy, 1, res4, GL_TRUE);
memcpy(residences, res4, n);
free(res4);
}
else {
retval = (GLboolean) __glXReadReply(dpy, 1, residences, GL_TRUE);
}
UnlockDisplay(dpy);
SyncHandle();
}
return retval;
}
}
示例3: XDrawArcs
int
XDrawArcs(
register Display *dpy,
Drawable d,
GC gc,
XArc *arcs,
int n_arcs)
{
register xPolyArcReq *req;
register long len;
LockDisplay(dpy);
FlushGC(dpy, gc);
GetReq(PolyArc,req);
req->drawable = d;
req->gc = gc->gid;
len = ((long)n_arcs) * arc_scale;
SetReqLen(req, len, 1);
len <<= 2; /* watch out for macros... */
Data16 (dpy, (short *) arcs, len);
UnlockDisplay(dpy);
SyncHandle();
return 1;
}
示例4: DRI2CopyRegion
void
DRI2CopyRegion(Display * dpy, XID drawable, XserverRegion region,
CARD32 dest, CARD32 src)
{
XExtDisplayInfo *info = DRI2FindDisplay(dpy);
xDRI2CopyRegionReq *req;
xDRI2CopyRegionReply rep;
XextSimpleCheckExtension(dpy, info, dri2ExtensionName);
LockDisplay(dpy);
GetReq(DRI2CopyRegion, req);
req->reqType = info->codes->major_opcode;
req->dri2ReqType = X_DRI2CopyRegion;
req->drawable = drawable;
req->region = region;
req->dest = dest;
req->src = src;
_XReply(dpy, (xReply *) & rep, 0, xFalse);
UnlockDisplay(dpy);
SyncHandle();
}
示例5: XGetScreenSaver
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;
}
示例6: XNVCTRLSetAttribute
void XNVCTRLSetAttribute (
Display *dpy,
int screen,
unsigned int display_mask,
unsigned int attribute,
int value
)
{
XExtDisplayInfo *info = find_display (dpy);
xnvCtrlSetAttributeReq *req;
XNVCTRLSimpleCheckExtension (dpy, info);
LockDisplay (dpy);
GetReq (nvCtrlSetAttribute, req);
req->reqType = info->codes->major_opcode;
req->nvReqType = X_nvCtrlSetAttribute;
req->screen = screen;
req->display_mask = display_mask;
req->attribute = attribute;
req->value = value;
UnlockDisplay (dpy);
SyncHandle ();
}
示例7: XRemoveHost
int
XRemoveHost (
register Display *dpy,
XHostAddress *host)
{
register xChangeHostsReq *req;
register int length;
XServerInterpretedAddress *siAddr;
int addrlen;
if (host->family == FamilyServerInterpreted) {
siAddr = (XServerInterpretedAddress *) host->address;
addrlen = siAddr->typelength + siAddr->valuelength + 1;
} else {
addrlen = host->length;
}
length = (addrlen + 3) & ~0x3; /* round up */
LockDisplay(dpy);
GetReqExtra (ChangeHosts, length, req);
req->mode = HostDelete;
req->hostFamily = host->family;
req->hostLength = addrlen;
if (host->family == FamilyServerInterpreted) {
char *dest = (char *) NEXTPTR(req,xChangeHostsReq);
memcpy(dest, siAddr->type, siAddr->typelength);
dest[siAddr->typelength] = '\0';
memcpy(dest + siAddr->typelength + 1,siAddr->value,siAddr->valuelength);
} else {
memcpy((char *) NEXTPTR(req,xChangeHostsReq), host->address, addrlen);
}
UnlockDisplay(dpy);
SyncHandle();
return 1;
}
示例8: XkbGetIndicatorState
Status
XkbGetIndicatorState(Display *dpy,unsigned deviceSpec,unsigned *pStateRtrn)
{
register xkbGetIndicatorStateReq *req;
xkbGetIndicatorStateReply rep;
XkbInfoPtr xkbi;
Bool ok;
if ((dpy->flags & XlibDisplayNoXkb) ||
(!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL)))
return BadAccess;
LockDisplay(dpy);
xkbi = dpy->xkb_info;
GetReq(kbGetIndicatorState, req);
req->reqType = xkbi->codes->major_opcode;
req->xkbReqType = X_kbGetIndicatorState;
req->deviceSpec = deviceSpec;
ok=_XReply(dpy, (xReply *)&rep, 0, xFalse);
if (ok && (pStateRtrn!=NULL))
*pStateRtrn= rep.state;
UnlockDisplay(dpy);
SyncHandle();
return (ok?Success:BadImplementation);
}
示例9: DPMSForceLevel
Status
DPMSForceLevel(Display *dpy, CARD16 level)
{
XExtDisplayInfo *info = find_display (dpy);
register xDPMSForceLevelReq *req;
DPMSCheckExtension (dpy, info, 0);
if ((level != DPMSModeOn) &&
(level != DPMSModeStandby) &&
(level != DPMSModeSuspend) &&
(level != DPMSModeOff))
return BadValue;
LockDisplay(dpy);
GetReq(DPMSForceLevel, req);
req->reqType = info->codes->major_opcode;
req->dpmsReqType = X_DPMSForceLevel;
req->level = level;
UnlockDisplay(dpy);
SyncHandle();
return 1;
}
示例10: XpSelectInput
void
XpSelectInput (
Display *dpy,
XPContext print_context,
unsigned long event_mask
)
{
xPrintSelectInputReq *req;
XExtDisplayInfo *info = (XExtDisplayInfo *) xp_find_display (dpy);
if (XpCheckExtInit(dpy, XP_INITIAL_RELEASE) == -1)
return; /* NoSuchExtension NULL */
LockDisplay (dpy);
GetReq(PrintSelectInput,req);
req->reqType = info->codes->major_opcode;
req->printReqType = X_PrintSelectInput;
req->printContext = print_context;
req->eventMask = event_mask;
UnlockDisplay (dpy);
SyncHandle ();
}
示例11: XRenderSetPictureFilter
void
XRenderSetPictureFilter (Display *dpy,
Picture picture,
const char *filter,
XFixed *params,
int nparams)
{
XRenderExtDisplayInfo *info = XRenderFindDisplay (dpy);
xRenderSetPictureFilterReq *req;
int nbytes = strlen (filter);
RenderSimpleCheckExtension (dpy, info);
LockDisplay(dpy);
GetReq(RenderSetPictureFilter, req);
req->reqType = info->codes->major_opcode;
req->renderReqType = X_RenderSetPictureFilter;
req->picture = picture;
req->nbytes = nbytes;
req->length += ((nbytes + 3) >> 2) + nparams;
Data (dpy, filter, nbytes);
Data (dpy, (_Xconst char *)params, nparams << 2);
UnlockDisplay(dpy);
SyncHandle();
}
示例12: GetDrawableAttribute
/**
* Get a drawable's attribute.
*
* This function is used to implement \c glXGetSelectedEvent and
* \c glXGetSelectedEventSGIX.
*
* \note
* This function dynamically determines whether to use the SGIX_pbuffer
* version of the protocol or the GLX 1.3 version of the protocol.
*
* \todo
* The number of attributes returned is likely to be small, probably less than
* 10. Given that, this routine should try to use an array on the stack to
* capture the reply rather than always calling Xmalloc.
*
* \todo
* This function needs to be modified to work with direct-rendering drivers.
*/
static int
GetDrawableAttribute(Display * dpy, GLXDrawable drawable,
int attribute, unsigned int *value)
{
__GLXdisplayPrivate *priv;
xGLXGetDrawableAttributesReply reply;
CARD32 *data;
CARD8 opcode;
unsigned int length;
unsigned int i;
unsigned int num_attributes;
GLboolean use_glx_1_3;
if ((dpy == NULL) || (drawable == 0)) {
return 0;
}
priv = __glXInitialize(dpy);
use_glx_1_3 = ((priv->majorVersion > 1) || (priv->minorVersion >= 3));
*value = 0;
opcode = __glXSetupForCommand(dpy);
if (!opcode)
return 0;
LockDisplay(dpy);
if (use_glx_1_3) {
xGLXGetDrawableAttributesReq *req;
GetReqExtra(GLXGetDrawableAttributes, 4, req);
req->reqType = opcode;
req->glxCode = X_GLXGetDrawableAttributes;
req->drawable = drawable;
}
else {
xGLXVendorPrivateWithReplyReq *vpreq;
GetReqExtra(GLXVendorPrivateWithReply, 4, vpreq);
data = (CARD32 *) (vpreq + 1);
data[0] = (CARD32) drawable;
vpreq->reqType = opcode;
vpreq->glxCode = X_GLXVendorPrivateWithReply;
vpreq->vendorCode = X_GLXvop_GetDrawableAttributesSGIX;
}
_XReply(dpy, (xReply *) & reply, 0, False);
if (reply.type == X_Error) {
UnlockDisplay(dpy);
SyncHandle();
return 0;
}
length = reply.length;
if (length) {
num_attributes = (use_glx_1_3) ? reply.numAttribs : length / 2;
data = (CARD32 *) Xmalloc(length * sizeof(CARD32));
if (data == NULL) {
/* Throw data on the floor */
_XEatData(dpy, length);
}
else {
_XRead(dpy, (char *) data, length * sizeof(CARD32));
/* Search the set of returned attributes for the attribute requested by
* the caller.
*/
for (i = 0; i < num_attributes; i++) {
if (data[i * 2] == attribute) {
*value = data[(i * 2) + 1];
break;
}
}
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
{
__GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable, NULL);
//.........这里部分代码省略.........
示例13: XChangeDeviceProperty
void
XChangeDeviceProperty(Display* dpy, XDevice* dev,
Atom property, Atom type,
int format, int mode,
_Xconst unsigned char *data, int nelements)
{
xChangeDevicePropertyReq *req;
int len;
XExtDisplayInfo *info = XInput_find_display(dpy);
LockDisplay(dpy);
if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
return;
GetReq(ChangeDeviceProperty, req);
req->reqType = info->codes->major_opcode;
req->ReqType = X_ChangeDeviceProperty;
req->deviceid = dev->device_id;
req->property = property;
req->type = type;
req->mode = mode;
if (nelements < 0) {
req->nUnits = 0;
req->format = 0; /* ask for garbage, get garbage */
} else {
req->nUnits = nelements;
req->format = format;
}
switch (req->format) {
case 8:
len = ((long)nelements + 3) >> 2;
if (dpy->bigreq_size || req->length + len <= (unsigned) 65535) {
SetReqLen(req, len, len);
Data (dpy, (_Xconst char *)data, nelements);
} /* else force BadLength */
break;
case 16:
len = ((long)nelements + 1) >> 1;
if (dpy->bigreq_size || req->length + len <= (unsigned) 65535) {
SetReqLen(req, len, len);
len = (long)nelements << 1;
Data16 (dpy, (_Xconst short *) data, len);
} /* else force BadLength */
break;
case 32:
len = nelements;
if (dpy->bigreq_size || req->length + len <= (unsigned) 65535) {
SetReqLen(req, len, len);
len = (long)nelements << 2;
Data32 (dpy, (_Xconst long *) data, len);
} /* else force BadLength */
break;
default:
/* BadValue will be generated */ ;
}
UnlockDisplay(dpy);
SyncHandle();
}
示例14: find_display
/*
* XdbeGetVisualInfo -
* This function returns information about which visuals support
* double buffering. The argument num_screens specifies how many
* elements there are in the screen_specifiers list. Each drawable
* in screen_specifiers designates a screen for which the supported
* visuals are being requested. If num_screens is zero, information
* for all screens is requested. In this case, upon return from this
* function, num_screens will be set to the number of screens that were
* found. If an error occurs, this function returns NULL, else it returns
* a pointer to a list of XdbeScreenVisualInfo structures of length
* num_screens. The nth element in the returned list corresponds to the
* nth drawable in the screen_specifiers list, unless num_screens was
* passed in with the value zero, in which case the nth element in the
* returned list corresponds to the nth screen of the server, starting
* with screen zero.
*/
XdbeScreenVisualInfo *XdbeGetVisualInfo (
Display *dpy,
Drawable *screen_specifiers,
int *num_screens) /* SEND and RETURN */
{
XExtDisplayInfo *info = find_display(dpy);
register xDbeGetVisualInfoReq *req;
xDbeGetVisualInfoReply rep;
XdbeScreenVisualInfo *scrVisInfo;
int i;
DbeCheckExtension (dpy, info, (XdbeScreenVisualInfo *)NULL);
LockDisplay (dpy);
DbeGetReq(DbeGetVisualInfo, req, info);
req->length = 2 + *num_screens;
req->n = *num_screens;
Data32 (dpy, screen_specifiers, (*num_screens * sizeof (CARD32)));
if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) {
UnlockDisplay (dpy);
SyncHandle ();
return NULL;
}
/* return the number of screens actually found if we
* requested information about all screens (*num_screens == 0)
*/
if (*num_screens == 0)
*num_screens = rep.m;
/* allocate list of visual information to be returned */
if (!(scrVisInfo =
(XdbeScreenVisualInfo *)Xmalloc(
(unsigned)(*num_screens * sizeof(XdbeScreenVisualInfo))))) {
UnlockDisplay (dpy);
SyncHandle ();
return NULL;
}
for (i = 0; i < *num_screens; i++)
{
int nbytes;
int j;
long c;
_XRead32 (dpy, &c, sizeof(CARD32));
scrVisInfo[i].count = c;
nbytes = scrVisInfo[i].count * sizeof(XdbeVisualInfo);
/* if we can not allocate the list of visual/depth info
* then free the lists that we already allocate as well
* as the visual info list itself
*/
if (!(scrVisInfo[i].visinfo = (XdbeVisualInfo *)Xmalloc(
(unsigned)nbytes))) {
for (j = 0; j < i; j++) {
Xfree ((char *)scrVisInfo[j].visinfo);
}
Xfree ((char *)scrVisInfo);
UnlockDisplay (dpy);
SyncHandle ();
return NULL;
}
/* Read the visual info item into the wire structure. Then copy each
* element into the library structure. The element sizes and/or
* padding may be different in the two structures.
*/
for (j = 0; j < scrVisInfo[i].count; j++) {
xDbeVisInfo xvi;
_XRead (dpy, (char *)&xvi, sizeof(xDbeVisInfo));
scrVisInfo[i].visinfo[j].visual = xvi.visualID;
scrVisInfo[i].visinfo[j].depth = xvi.depth;
scrVisInfo[i].visinfo[j].perflevel = xvi.perfLevel;
}
}
UnlockDisplay (dpy);
//.........这里部分代码省略.........
示例15: XvMCCreateSurface
PUBLIC
Status XvMCCreateSurface(Display *dpy, XvMCContext *context, XvMCSurface *surface)
{
XvMCContextPrivate *context_priv;
struct pipe_context *pipe;
XvMCSurfacePrivate *surface_priv;
struct pipe_video_buffer tmpl;
XVMC_MSG(XVMC_TRACE, "[XvMC] Creating surface %p.\n", surface);
assert(dpy);
if (!context)
return XvMCBadContext;
if (!surface)
return XvMCBadSurface;
context_priv = context->privData;
pipe = context_priv->pipe;
surface_priv = CALLOC(1, sizeof(XvMCSurfacePrivate));
if (!surface_priv)
return BadAlloc;
memset(&tmpl, 0, sizeof(tmpl));
tmpl.buffer_format = pipe->screen->get_video_param
(
pipe->screen,
context_priv->decoder->profile,
context_priv->decoder->entrypoint,
PIPE_VIDEO_CAP_PREFERED_FORMAT
);
tmpl.chroma_format = context_priv->decoder->chroma_format;
tmpl.width = context_priv->decoder->width;
tmpl.height = context_priv->decoder->height;
tmpl.interlaced = pipe->screen->get_video_param
(
pipe->screen,
context_priv->decoder->profile,
context_priv->decoder->entrypoint,
PIPE_VIDEO_CAP_PREFERS_INTERLACED
);
surface_priv->video_buffer = pipe->create_video_buffer(pipe, &tmpl);
if (!surface_priv->video_buffer) {
FREE(surface_priv);
return BadAlloc;
}
surface_priv->context = context;
surface->surface_id = XAllocID(dpy);
surface->context_id = context->context_id;
surface->surface_type_id = context->surface_type_id;
surface->width = context->width;
surface->height = context->height;
surface->privData = surface_priv;
SyncHandle();
XVMC_MSG(XVMC_TRACE, "[XvMC] Surface %p created.\n", surface);
return Success;
}