Esempio n. 1
0
int
XSetClipRectangles (
    register Display *dpy,
    GC gc,
    int clip_x_origin,
    int clip_y_origin,
    XRectangle *rectangles,
    int n,
    int ordering)
{
    LockDisplay(dpy);
    _XSetClipRectangles (dpy, gc, clip_x_origin, clip_y_origin, rectangles, n,
                    ordering);
    UnlockDisplay(dpy);
    SyncHandle();
    return 1;
}
Esempio n. 2
0
void
XFixesShowCursor (Display *dpy, Window win)
{
    XFixesExtDisplayInfo	*info = XFixesFindDisplay (dpy);
    xXFixesShowCursorReq	*req;

    XFixesSimpleCheckExtension (dpy, info);
    if (info->major_version < 4)
	return;
    LockDisplay (dpy);
    GetReq (XFixesShowCursor, req);
    req->reqType = info->codes->major_opcode;
    req->xfixesReqType = X_XFixesShowCursor;
    req->window = win;
    UnlockDisplay (dpy);
    SyncHandle ();
}
Esempio n. 3
0
static GLboolean
 getFBConfigs(struct glx_screen *psc, struct glx_display *priv, int screen)
{
   xGLXGetFBConfigsReq *fb_req;
   xGLXGetFBConfigsSGIXReq *sgi_req;
   xGLXVendorPrivateWithReplyReq *vpreq;
   xGLXGetFBConfigsReply reply;
   Display *dpy = priv->dpy;

   psc->serverGLXexts =
      __glXQueryServerString(dpy, priv->majorOpcode, screen, GLX_EXTENSIONS);

   LockDisplay(dpy);

   psc->configs = NULL;
   if (atof(priv->serverGLXversion) >= 1.3) {
      GetReq(GLXGetFBConfigs, fb_req);
      fb_req->reqType = priv->majorOpcode;
      fb_req->glxCode = X_GLXGetFBConfigs;
      fb_req->screen = screen;
   }
   else if (strstr(psc->serverGLXexts, "GLX_SGIX_fbconfig") != NULL) {
      GetReqExtra(GLXVendorPrivateWithReply,
                  sz_xGLXGetFBConfigsSGIXReq -
                  sz_xGLXVendorPrivateWithReplyReq, vpreq);
      sgi_req = (xGLXGetFBConfigsSGIXReq *) vpreq;
      sgi_req->reqType = priv->majorOpcode;
      sgi_req->glxCode = X_GLXVendorPrivateWithReply;
      sgi_req->vendorCode = X_GLXvop_GetFBConfigsSGIX;
      sgi_req->screen = screen;
   }
   else
      goto out;

   if (!_XReply(dpy, (xReply *) & reply, 0, False))
      goto out;

   psc->configs = createConfigsFromProperties(dpy,
                                              reply.numFBConfigs,
                                              reply.numAttribs * 2,
                                              screen, GL_TRUE);

 out:
   UnlockDisplay(dpy);
   return psc->configs != NULL;
}
Esempio n. 4
0
/*
 * XdbeDeallocateBackBufferName - 
 *	This function frees a drawable ID, buffer, that was obtained via
 *	XdbeAllocateBackBufferName.  The buffer must refer to the back buffer
 *	of the specified window, or a protocol error results.
 */
Status XdbeDeallocateBackBufferName (
    Display *dpy,
    XdbeBackBuffer buffer)
{
    XExtDisplayInfo *info = find_display (dpy);
    register xDbeDeallocateBackBufferNameReq *req;

    DbeCheckExtension (dpy, info, (Status)0 /* failure */);

    LockDisplay (dpy);
    DbeGetReq (DbeDeallocateBackBufferName, req, info);
    req->buffer = buffer;
    UnlockDisplay (dpy);
    SyncHandle ();

    return (Status)1; /* success */
}
Esempio n. 5
0
Bool
ephyrHostGLXQueryVersion(int *a_major, int *a_minor)
{
    Bool is_ok = FALSE;
    Display *dpy = hostx_get_display();
    int major_opcode = 0;
    xGLXQueryVersionReq *req = NULL;
    xGLXQueryVersionReply reply;

    EPHYR_RETURN_VAL_IF_FAIL(a_major && a_minor, FALSE);
    EPHYR_LOG("enter\n");

    if (glx_major) {
        *a_major = glx_major;
        *a_minor = glx_minor;
        return TRUE;
    }

    if (!ephyrHostGLXGetMajorOpcode(&major_opcode)) {
        EPHYR_LOG_ERROR("failed to get major opcode\n");
        goto out;
    }
    EPHYR_LOG("major opcode: %d\n", major_opcode);

    /* Send the glXQueryVersion request */
    memset(&reply, 0, sizeof(reply));
    LockDisplay(dpy);
    GetReq(GLXQueryVersion, req);
    req->reqType = major_opcode;
    req->glxCode = X_GLXQueryVersion;
    req->majorVersion = 2;
    req->minorVersion = 1;
    _XReply(dpy, (xReply *) &reply, 0, False);
    UnlockDisplay(dpy);
    SyncHandle();

    *a_major = glx_major = reply.majorVersion;
    *a_minor = glx_minor = reply.minorVersion;

    EPHYR_LOG("major:%d, minor:%d\n", *a_major, *a_minor);

    is_ok = TRUE;
 out:
    EPHYR_LOG("leave\n");
    return is_ok;
}
Esempio n. 6
0
File: XvMC.c Progetto: aosm/X11libs
Status _xvmc_destroy_context (
    Display *dpy,
    XvMCContext *context
)
{
    XExtDisplayInfo *info = xvmc_find_display(dpy);
    xvmcDestroyContextReq  *req;

    XvMCCheckExtension (dpy, info, BadImplementation);

    LockDisplay (dpy);
    XvMCGetReq (DestroyContext, req);
    req->context_id = context->context_id;
    UnlockDisplay (dpy);
    SyncHandle ();
    return Success;
}
Esempio n. 7
0
File: XvMC.c Progetto: aosm/X11libs
Status _xvmc_destroy_subpicture(
    Display *dpy,
    XvMCSubpicture *subpicture
)
{
    XExtDisplayInfo *info = xvmc_find_display(dpy);
    xvmcDestroySubpictureReq  *req;

    XvMCCheckExtension (dpy, info, BadImplementation);

    LockDisplay (dpy);
    XvMCGetReq (DestroySubpicture, req);
    req->subpicture_id = subpicture->subpicture_id; 
    UnlockDisplay (dpy);
    SyncHandle ();
    return Success;
}
Esempio n. 8
0
int
XRaiseWindow (
    register Display *dpy,
    Window w)
{
    register xConfigureWindowReq *req;
    unsigned long val = Above;		/* needed for macro below */

    LockDisplay(dpy);
    GetReqExtra(ConfigureWindow, 4, req);
    req->window = w;
    req->mask = CWStackMode;
    OneDataCard32 (dpy, NEXTPTR(req,xConfigureWindowReq), val);
    UnlockDisplay(dpy);
    SyncHandle();
    return 1;
}
void
XRRDeleteProviderProperty (Display *dpy, RRProvider provider, Atom property)
{
    XExtDisplayInfo		*info = XRRFindDisplay(dpy);
    xRRDeleteProviderPropertyReq *req;

    RRSimpleCheckExtension (dpy, info);

    LockDisplay(dpy);
    GetReq(RRDeleteProviderProperty, req);
    req->reqType = info->codes->major_opcode;
    req->randrReqType = X_RRDeleteProviderProperty;
    req->provider = provider;
    req->property = property;
    UnlockDisplay(dpy);
    SyncHandle();
}
Esempio n. 10
0
File: XERqsts.c Progetto: aosm/X11
int XEGetStatisticsRequest(XETC *tc, XETrapGetStatsRep *ret) 
{ 
    int status = True;
    Display *dpy = tc->dpy;
    CARD32 X_XTrap = tc->extOpcode;
    xXTrapReq *reqptr;
    xXTrapGetStatsReply rep; 
    status = XEFlushConfig(tc); /* Flushout any pending configuration first */
    if (status == True)
    {
        LockDisplay(dpy); 
        GetReq(XTrap,reqptr);
        reqptr->minor_opcode = XETrap_GetStatistics;
        /* to support comm. w/ V3.1 extensions */
#ifndef CRAY
        if (tc->protocol == 31)
        {   /* this is the way we used to do it which breaks Cray's */
#ifndef VECTORED_EVENTS
            int numlongs = (1060-sizeof(xReply)+sizeof(long)-1)/sizeof(long);
#else
            int numlongs = (1544-sizeof(xReply)+sizeof(long)-1)/sizeof(long);
#endif
            status = _XReply(dpy,(xReply *)&rep,numlongs,xTrue); 
            if (status == True)
            {   /* need to shift it back into the data struct */
                xXTrapGetStatsReply tmp; 
                tmp = rep; 
                memcpy(&(rep.data),&(tmp.pad0), sizeof(rep.data));
            }
        }
        else
#endif /* CRAY */
        {   /* this is the way we do it for V3.2 */
            int numbytes = SIZEOF(xXTrapGetStatsReply) - SIZEOF(xReply);
            status = _XReply(dpy, (xReply *)&rep, 0, xFalse); 
            if (status == True)
            {
                status = _XRead(dpy, (char *)&rep.data, numbytes);
            }
        }
        SyncHandle(); 
        UnlockDisplay(dpy); 
        memcpy(ret,&(rep.data),sizeof(XETrapGetStatsRep)); 
    }
    return(status);
}
Esempio n. 11
0
void
XRenderSetPictureClipRectangles (Display	*dpy,
				 Picture	picture,
				 int		xOrigin,
				 int		yOrigin,
				 _Xconst XRectangle	*rects,
				 int		n)
{
    XRenderExtDisplayInfo	    *info = XRenderFindDisplay (dpy);
    
    RenderSimpleCheckExtension (dpy, info);
    LockDisplay(dpy);
    _XRenderSetPictureClipRectangles (dpy, info, picture, 
				      xOrigin, yOrigin, rects, n);
    UnlockDisplay (dpy);
    SyncHandle ();
}
Esempio n. 12
0
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 = (char *) Xmalloc(numbytes);
   if (buf != NULL) {
      _XRead(dpy, buf, numbytes);
      length -= numbytes;
   }

   _XEatData(dpy, length);

   UnlockDisplay(dpy);
   SyncHandle();

   return buf;
}
Esempio n. 13
0
/**
 * 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 ((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;
}
Esempio n. 14
0
int
XQueryColors(
    register Display *dpy,
    Colormap cmap,
    XColor *defs, 		/* RETURN */
    int ncolors)
{
    register int i;
    xrgb *color;
    xQueryColorsReply rep;
    long nbytes;
    register xQueryColorsReq *req;

    LockDisplay(dpy);
    GetReq(QueryColors, req);

    req->cmap = cmap;
    req->length += ncolors; /* each pixel is a CARD32 */

    for (i = 0; i < ncolors; i++)
      Data32 (dpy, (long *)&defs[i].pixel, 4L);
       /* XXX this isn't very efficient */

    if (_XReply(dpy, (xReply *) &rep, 0, xFalse) != 0) {
	if ((color = (xrgb *)
	    Xmalloc((unsigned) (nbytes = (long) ncolors * SIZEOF(xrgb))))) {

	    _XRead(dpy, (char *) color, nbytes);

	    for (i = 0; i < ncolors; i++) {
		register XColor *def = &defs[i];
		register xrgb *rgb = &color[i];
		def->red = rgb->red;
		def->green = rgb->green;
		def->blue = rgb->blue;
		def->flags = DoRed | DoGreen | DoBlue;
	    }
	    Xfree((char *)color);
	}
	else _XEatData(dpy, (unsigned long) nbytes);
    }
    UnlockDisplay(dpy);
    SyncHandle();
    return 1;
}
Esempio n. 15
0
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;
}
Esempio n. 16
0
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;
}
Esempio n. 17
0
int
XFreeGC (
    register Display *dpy,
    GC gc)
    {
    register xResourceReq *req;
    register _XExtension *ext;
    LockDisplay(dpy);
    /* call out to any extensions interested */
    for (ext = dpy->ext_procs; ext; ext = ext->next)
	if (ext->free_GC) (*ext->free_GC)(dpy, gc, &ext->codes);
    GetResReq (FreeGC, gc->gid, req);
    UnlockDisplay(dpy);
    SyncHandle();
    _XFreeExtData(gc->ext_data);
    Xfree (gc);
    return 1;
    }
Esempio n. 18
0
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();
}
Esempio n. 19
0
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();
}
Esempio n. 20
0
static int
InitModMap(
    Display *dpy)
{
    register XModifierKeymap *map;

    if (! (map = XGetModifierMapping(dpy)))
	return 0;
    LockDisplay(dpy);
    if (dpy->modifiermap)
	XFreeModifiermap(dpy->modifiermap);
    dpy->modifiermap = map;
    dpy->free_funcs->modifiermap = XFreeModifiermap;
    if (dpy->keysyms)
	ResetModMap(dpy);
    UnlockDisplay(dpy);
    return 1;
}
Esempio n. 21
0
File: xme.c Progetto: 0-14N/NDroid
void XiGMiscChangeResolution(Display *dpy, int screen, int view, int width, int height, int refresh)
{
  xXiGMiscChangeResolutionReq *req;
  XExtDisplayInfo *info = XiGMiscFindDisplay(dpy);

  XiGMiscSimpleCheckExtension(dpy, info);

  LockDisplay (dpy);
  XiGMiscGetReq (XiGMiscChangeResolution, req, info);
  req->screen = screen;
  req->view = view;
  req->width = width;
  req->height = height;
  req->refresh = refresh;

  UnlockDisplay(dpy);
  SyncHandle();
}
Esempio n. 22
0
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;
}
Esempio n. 23
0
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;
}
Esempio n. 24
0
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;
}
Esempio n. 25
0
int
XSetWindowBorderWidth(
    Display *dpy,
    Window w,
    unsigned int width)
{
    unsigned long lwidth = width;	/* must be CARD32 */

    register xConfigureWindowReq *req;
    LockDisplay(dpy);
    GetReqExtra(ConfigureWindow, 4, req);
    req->window = w;
    req->mask = CWBorderWidth;
    OneDataCard32 (dpy, NEXTPTR(req,xConfigureWindowReq), lwidth);
    UnlockDisplay(dpy);
    SyncHandle();
    return 1;
}
Esempio n. 26
0
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();
}
Esempio n. 27
0
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;
}
Esempio n. 28
0
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;
}
Esempio n. 29
0
void
__glXSendErrorForXcb(Display * dpy, const xcb_generic_error_t *err)
{
   xError error;

   LockDisplay(dpy);

   error.type = X_Error;
   error.errorCode = err->error_code;
   error.sequenceNumber = err->sequence;
   error.resourceID = err->resource_id;
   error.minorCode = err->minor_code;
   error.majorCode = err->major_code;

   _XError(dpy, &error);

   UnlockDisplay(dpy);
}
Esempio n. 30
0
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 ();
}