Esempio n. 1
0
static int
ProcPanoramiXShapeMask(ClientPtr client)
{
    REQUEST(xShapeMaskReq);
    PanoramiXRes *win, *pmap;
    int j, result;

    REQUEST_SIZE_MATCH(xShapeMaskReq);

    result = dixLookupResourceByType((pointer *) &win, stuff->dest, XRT_WINDOW,
                                     client, DixWriteAccess);
    if (result != Success)
        return result;

    if (stuff->src != None) {
        result = dixLookupResourceByType((pointer *) &pmap, stuff->src,
                                         XRT_PIXMAP, client, DixReadAccess);
        if (result != Success)
            return result;
    }
    else
        pmap = NULL;

    FOR_NSCREENS(j) {
        stuff->dest = win->info[j].id;
        if (pmap)
            stuff->src = pmap->info[j].id;
        result = ProcShapeMask(client);
        if (result != Success)
            break;
    }
    return result;
}
Esempio n. 2
0
/** When Xinerama is active, the client pixmaps are always obtained from
 * screen 0.  When screen 0 is detached, the pixmaps must be obtained
 * from any other screen that is not detached.  Usually, this is screen
 * 1. */
static DMXScreenInfo *dmxFindAlternatePixmap(DrawablePtr pDrawable, XID *draw)
{
#ifdef PANORAMIX
    PanoramiXRes  *pXinPix;
    int           i;
    DMXScreenInfo *dmxScreen;
            
    if (noPanoramiXExtension)               return NULL;
    if (pDrawable->type != DRAWABLE_PIXMAP) return NULL;

    if (Success != dixLookupResourceByType((pointer*) &pXinPix,
					   pDrawable->id, XRT_PIXMAP,
					   NullClient, DixUnknownAccess))
        return NULL;

    FOR_NSCREENS_FORWARD_SKIP(i) {
        dmxScreen = &dmxScreens[i];
        if (dmxScreen->beDisplay) {
            PixmapPtr     pSrc;
            dmxPixPrivPtr pSrcPriv;
            
            dixLookupResourceByType((pointer*) &pSrc, pXinPix->info[i].id,
				    RT_PIXMAP, NullClient, DixUnknownAccess);
            pSrcPriv = DMX_GET_PIXMAP_PRIV(pSrc);
            if (pSrcPriv->pixmap) {
                *draw = pSrcPriv->pixmap;
                return dmxScreen;
            }
        }
    }
#endif
    return NULL;
}
Esempio n. 3
0
static int
ProcPanoramiXShapeCombine(ClientPtr client)
{
    REQUEST(xShapeCombineReq);
    PanoramiXRes *win, *win2;
    int j, result;

    REQUEST_AT_LEAST_SIZE(xShapeCombineReq);

    result = dixLookupResourceByType((pointer *) &win, stuff->dest, XRT_WINDOW,
                                     client, DixWriteAccess);
    if (result != Success)
        return result;

    result = dixLookupResourceByType((pointer *) &win2, stuff->src, XRT_WINDOW,
                                     client, DixReadAccess);
    if (result != Success)
        return result;

    FOR_NSCREENS(j) {
        stuff->dest = win->info[j].id;
        stuff->src = win2->info[j].id;
        result = ProcShapeCombine(client);
        if (result != Success)
            break;
    }
    return result;
}
Esempio n. 4
0
static int 
XineramaXvShmPutImage(ClientPtr client)
{
    REQUEST(xvShmPutImageReq);
    PanoramiXRes *draw, *gc, *port;
    Bool send_event = stuff->send_event;
    Bool isRoot;
    int result, i, x, y;

    REQUEST_SIZE_MATCH(xvShmPutImageReq);

    result = dixLookupResourceByClass((pointer *)&draw, stuff->drawable,
				      XRC_DRAWABLE, client, DixWriteAccess);
    if (result != Success)
	return (result == BadValue) ? BadDrawable : result;

    result = dixLookupResourceByType((pointer *)&gc, stuff->gc,
				     XRT_GC, client, DixReadAccess);
    if (result != Success)
        return result;

    result = dixLookupResourceByType((pointer *)&port, stuff->port,
				     XvXRTPort, client, DixReadAccess);
    if (result != Success)
	return result;
 
    isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;

    x = stuff->drw_x;
    y = stuff->drw_y;

    FOR_NSCREENS_BACKWARD(i) {
	if(port->info[i].id) {
	   stuff->drawable = draw->info[i].id;
	   stuff->port = port->info[i].id;
	   stuff->gc = gc->info[i].id;
	   stuff->drw_x = x;
	   stuff->drw_y = y;
	   if(isRoot) {
		stuff->drw_x -= screenInfo.screens[i]->x;
		stuff->drw_y -= screenInfo.screens[i]->y;
	   }
	   stuff->send_event = (send_event && !i) ? 1 : 0;

	   result = ProcXvShmPutImage(client);
	}
    }
    return result;
}
static void
SecurityClientState(CallbackListPtr *pcbl, pointer unused, pointer calldata)
{
    NewClientInfoRec *pci = calldata;
    SecurityStateRec *state;
    SecurityAuthorizationPtr pAuth;
    int rc;

    state = dixLookupPrivate(&pci->client->devPrivates, stateKey);

    switch (pci->client->clientState) {
    case ClientStateInitial:
	state->trustLevel = XSecurityClientTrusted;
	state->authId = None;
	state->haveState = TRUE;
	break;

    case ClientStateRunning:
	state->authId = AuthorizationIDOfClient(pci->client);
	rc = dixLookupResourceByType((pointer *)&pAuth, state->authId,
			       SecurityAuthorizationResType, serverClient,
			       DixGetAttrAccess);
	if (rc == Success) {
	    /* it is a generated authorization */
	    pAuth->refcnt++;
	    if (pAuth->refcnt == 1 && pAuth->timer)
		TimerCancel(pAuth->timer);

	    state->trustLevel = pAuth->trustLevel;
	}
	break;

    case ClientStateGone:
    case ClientStateRetained:
	rc = dixLookupResourceByType((pointer *)&pAuth, state->authId,
			       SecurityAuthorizationResType, serverClient,
			       DixGetAttrAccess);
	if (rc == Success) {
	    /* it is a generated authorization */
	    pAuth->refcnt--;
	    if (pAuth->refcnt == 0)
		SecurityStartAuthorizationTimer(pAuth);
	}
	break;

    default:
	break;
    }
}
Esempio n. 6
0
int __glXDisp_UseXFont(__GLXclientState *cl, GLbyte *pc)
{
    ClientPtr client = cl->client;
    xGLXUseXFontReq *req;
    FontPtr pFont;
    GC *pGC;
    GLuint currentListIndex;
    __GLXcontext *cx;
    int error;

    req = (xGLXUseXFontReq *) pc;
    cx = __glXForceCurrent(cl, req->contextTag, &error);
    if (!cx) {
	return error;
    }

    CALL_GetIntegerv( GET_DISPATCH(), (GL_LIST_INDEX, (GLint*) &currentListIndex) );
    if (currentListIndex != 0) {
	/*
	** A display list is currently being made.  It is an error
	** to try to make a font during another lists construction.
	*/
	client->errorValue = cx->id;
	return __glXError(GLXBadContextState);
    }

    /*
    ** Font can actually be either the ID of a font or the ID of a GC
    ** containing a font.
    */

    error = dixLookupResourceByType((pointer *)&pFont,
				    req->font, RT_FONT,
				    client, DixReadAccess);
    if (error != Success) {
	error = dixLookupResourceByType((pointer *)&pGC,
					req->font, RT_GC,
					client, DixReadAccess);
        if (error != Success) {
	    client->errorValue = req->font;
            return error == BadGC ? BadFont : error;
	}
	pFont = pGC->font;
    }

    return MakeBitmapsFromFont(pFont, req->first, req->count,
				    req->listBase);
}
Esempio n. 7
0
void
AppleWMSendEvent (int type, unsigned int mask, int which, int arg) {
    WMEventPtr      *pHead, pEvent;
    ClientPtr       client;
    xAppleWMNotifyEvent se;
    int             i;

    i = dixLookupResourceByType((pointer *)&pHead, eventResource, EventType, serverClient, DixReadAccess);
    if (i != Success || !pHead)
        return;
    for (pEvent = *pHead; pEvent; pEvent = pEvent->next) {
        client = pEvent->client;
        if ((pEvent->mask & mask) == 0
                || client == serverClient || client->clientGone)
        {
            continue;
        }
        se.type = type + WMEventBase;
        se.kind = which;
        se.arg = arg;
        se.sequenceNumber = client->sequence;
        se.time = currentTime.milliseconds;
        WriteEventsToClient (client, 1, (xEvent *) &se);
    }
}
Esempio n. 8
0
int
ChangeGCXIDs(ClientPtr client, GC * pGC, BITS32 mask, CARD32 *pC32)
{
    ChangeGCVal vals[GCLastBit + 1];
    int i;

    if (mask & ~GCAllBits) {
        client->errorValue = mask;
        return BadValue;
    }
    for (i = Ones(mask); i--;)
        vals[i].val = pC32[i];
    for (i = 0; i < ARRAY_SIZE(xidfields); ++i) {
        int offset, rc;

        if (!(mask & xidfields[i].mask))
            continue;
        offset = Ones(mask & (xidfields[i].mask - 1));
        if (xidfields[i].mask == GCClipMask && vals[offset].val == None) {
            vals[offset].ptr = NullPixmap;
            continue;
        }
        rc = dixLookupResourceByType(&vals[offset].ptr, vals[offset].val,
                                     xidfields[i].type, client,
                                     xidfields[i].access_mode);
        if (rc != Success) {
            client->errorValue = vals[offset].val;
            return rc;
        }
    }
    return ChangeGC(client, pGC, mask, vals);
}
Esempio n. 9
0
int
dixLookupFontable(FontPtr *pFont, XID id, ClientPtr client, Mask access)
{
    int rc;
    GC *pGC;
    client->errorValue = id;		/* EITHER font or gc */
    rc = dixLookupResourceByType((pointer *) pFont, id, RT_FONT, client, access);
    if (rc != BadFont)
	return rc;
    rc = dixLookupResourceByType((pointer *) &pGC, id, RT_GC, client, access);
    if (rc == BadGC)
	return BadFont;
    if (rc == Success)
	*pFont = pGC->font;
    return rc;
}
Esempio n. 10
0
 /*ARGSUSED*/ static int
ShapeFreeClient(pointer data, XID id)
{
    ShapeEventPtr pShapeEvent;
    WindowPtr pWin;
    ShapeEventPtr *pHead, pCur, pPrev;
    int rc;

    pShapeEvent = (ShapeEventPtr) data;
    pWin = pShapeEvent->window;
    rc = dixLookupResourceByType((pointer *) &pHead, pWin->drawable.id,
                                 ShapeEventType, serverClient, DixReadAccess);
    if (rc == Success) {
        pPrev = 0;
        for (pCur = *pHead; pCur && pCur != pShapeEvent; pCur = pCur->next)
            pPrev = pCur;
        if (pCur) {
            if (pPrev)
                pPrev->next = pShapeEvent->next;
            else
                *pHead = pShapeEvent->next;
        }
    }
    free((pointer) pShapeEvent);
    return 1;
}
Esempio n. 11
0
/*ARGSUSED*/
static int
WMFreeClient(void *data, XID id)
{
    WMEventPtr pEvent;
    WMEventPtr   *pHead, pCur, pPrev;
    int i;

    pEvent = (WMEventPtr)data;
    i = dixLookupResourceByType(
        (void **)&pHead, eventResource, EventType, serverClient,
        DixReadAccess |
        DixWriteAccess | DixDestroyAccess);
    if (i == Success && pHead) {
        pPrev = 0;
        for (pCur = *pHead; pCur && pCur != pEvent; pCur = pCur->next)
            pPrev = pCur;
        if (pCur) {
            if (pPrev)
                pPrev->next = pEvent->next;
            else
                *pHead = pEvent->next;
        }
        updateEventMask(pHead);
    }
    free((void *)pEvent);
    return 1;
}
Esempio n. 12
0
static void
vfbUninstallColormap(ColormapPtr pmap)
{
#if XORG < 113
    ColormapPtr curpmap = InstalledMaps[pmap->pScreen->myNum];
#else
    ColormapPtr curpmap = GetInstalledColormap(pmap->pScreen);
#endif

    if(pmap == curpmap)
    {
	if (pmap->mid != pmap->pScreen->defColormap)
	{
#if XORG < 111
	    curpmap = (ColormapPtr) LookupIDByType(pmap->pScreen->defColormap,
						   RT_COLORMAP);
#else
	    int rc =  dixLookupResourceByType((void * *) &curpmap, pmap->pScreen->defColormap,
					      RT_COLORMAP, serverClient, DixUnknownAccess);
	    if (rc != Success)
		ErrorF("Failed to uninstall color map\n");
	    else
#endif
		(*pmap->pScreen->InstallColormap)(curpmap);
	}
    }
}
Esempio n. 13
0
static int
XvdiSendVideoNotify(XvPortPtr pPort, DrawablePtr pDraw, int reason)
{
  xvEvent event;
  XvVideoNotifyPtr pn;

  dixLookupResourceByType((pointer *)&pn, pDraw->id, XvRTVideoNotifyList,
			  serverClient, DixReadAccess);

  while (pn) 
    {
      if (pn->client)
	{
	  event.u.u.type = XvEventBase + XvVideoNotify;
	  event.u.u.sequenceNumber = pn->client->sequence;
	  event.u.videoNotify.time = currentTime.milliseconds;
	  event.u.videoNotify.drawable = pDraw->id;
	  event.u.videoNotify.port = pPort->id;
	  event.u.videoNotify.reason = reason;
	  TryClientEvents(pn->client, NULL, (xEventPtr)&event, 1,
                          NoEventMask, NoEventMask, NullGrab);
	}
      pn = pn->next;
    }

  return Success;

}
Esempio n. 14
0
/* replaced by dixLookupResourceByType */
pointer
LookupIDByType(XID id, RESTYPE rtype)
{
    pointer val;
    dixLookupResourceByType(&val, id, rtype, NullClient, DixUnknownAccess);
    return val;
}
Esempio n. 15
0
static int
XineramaXvStopVideo(ClientPtr client)
{
   int result, i;
   PanoramiXRes *draw, *port;
   REQUEST(xvStopVideoReq);
   REQUEST_SIZE_MATCH(xvStopVideoReq);

   result = dixLookupResourceByClass((pointer *)&draw, stuff->drawable,
				     XRC_DRAWABLE, client, DixWriteAccess);
   if (result != Success)
       return (result == BadValue) ? BadDrawable : result;

   result = dixLookupResourceByType((pointer *)&port, stuff->port,
				    XvXRTPort, client, DixReadAccess);
   if (result != Success)
       return result;

   FOR_NSCREENS_BACKWARD(i) {
	if(port->info[i].id) {
	   stuff->drawable = draw->info[i].id;
	   stuff->port = port->info[i].id;
	   result = ProcXvStopVideo(client);
     	}
   }

   return result;
}
Esempio n. 16
0
int
ProcXFixesCreateRegionFromBitmap(ClientPtr client)
{
    RegionPtr pRegion;
    PixmapPtr pPixmap;
    int rc;

    REQUEST(xXFixesCreateRegionFromBitmapReq);

    REQUEST_SIZE_MATCH(xXFixesCreateRegionFromBitmapReq);
    LEGAL_NEW_RESOURCE(stuff->region, client);

    rc = dixLookupResourceByType((void **) &pPixmap, stuff->bitmap, RT_PIXMAP,
                                 client, DixReadAccess);
    if (rc != Success) {
        client->errorValue = stuff->bitmap;
        return rc;
    }
    if (pPixmap->drawable.depth != 1)
        return BadMatch;

    pRegion = BitmapToRegion(pPixmap->drawable.pScreen, pPixmap);

    if (!pRegion)
        return BadAlloc;

    if (!AddResource(stuff->region, RegionResType, (void *) pRegion))
        return BadAlloc;

    return Success;
}
void
winMWExtWMUpdateIcon(Window id)
{
    WindowPtr pWin;
    HICON hIcon, hiconOld;

    dixLookupResourceByType((pointer) &pWin, id, RT_WINDOW, NullClient,
                            DixUnknownAccess);
    hIcon = winOverrideIcon((unsigned long) pWin);

    if (!hIcon)
        hIcon = winXIconToHICON(pWin, GetSystemMetrics(SM_CXICON));

    if (hIcon) {
        win32RootlessWindowPtr pRLWinPriv
            = (win32RootlessWindowPtr) RootlessFrameForWindow(pWin, FALSE);

        if (pRLWinPriv->hWnd) {

            hiconOld = (HICON) SendMessage(pRLWinPriv->hWnd,
                                           WM_SETICON, ICON_BIG,
                                           (LPARAM) hIcon);
            winDestroyIcon(hiconOld);
        }
        hIcon = NULL;
    }
}
Esempio n. 18
0
/** Free the previously allocated Glyph Sets for each screen. */
static int
dmxProcRenderFreeGlyphSet(ClientPtr client)
{
    GlyphSetPtr glyphSet;

    REQUEST(xRenderFreeGlyphSetReq);

    REQUEST_SIZE_MATCH(xRenderFreeGlyphSetReq);
    dixLookupResourceByType((pointer *) &glyphSet,
                            stuff->glyphset, GlyphSetType,
                            client, DixDestroyAccess);

    if (glyphSet && glyphSet->refcnt == 1) {
        dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);
        int i;

        for (i = 0; i < dmxNumScreens; i++) {
            DMXScreenInfo *dmxScreen = &dmxScreens[i];

            if (dmxScreen->beDisplay) {
                if (dmxBEFreeGlyphSet(screenInfo.screens[i], glyphSet))
                    dmxSync(dmxScreen, FALSE);
            }
        }

        MAXSCREENSFREE(glyphPriv->glyphSets);
        free(glyphPriv);
        DMX_SET_GLYPH_PRIV(glyphSet, NULL);
    }

    return dmxSaveRenderVector[stuff->renderReqType] (client);
}
Esempio n. 19
0
File: randr.c Progetto: hush-z/VMGL
/*ARGSUSED*/
static int
RRFreeClient (pointer data, XID id)
{
    RREventPtr   pRREvent;
    WindowPtr	    pWin;
    RREventPtr   *pHead, pCur, pPrev;

    pRREvent = (RREventPtr) data;
    pWin = pRREvent->window;
    dixLookupResourceByType((pointer *)&pHead, pWin->drawable.id,
                            RREventType, serverClient, DixDestroyAccess);
    if (pHead) {
        pPrev = 0;
        for (pCur = *pHead; pCur && pCur != pRREvent; pCur=pCur->next)
            pPrev = pCur;
        if (pCur)
        {
            if (pPrev)
                pPrev->next = pRREvent->next;
            else
                *pHead = pRREvent->next;
        }
    }
    xfree ((pointer) pRREvent);
    return 1;
}
Esempio n. 20
0
CursorPtr
CreateRootCursor(char *unused1, unsigned int unused2)
{
    CursorPtr 	curs;
    FontPtr 	cursorfont;
    int	err;
    XID		fontID;

    fontID = FakeClientID(0);
    err = OpenFont(serverClient, fontID, FontLoadAll | FontOpenSync,
	(unsigned)strlen(defaultCursorFont), defaultCursorFont);
    if (err != Success)
	return NullCursor;

    err = dixLookupResourceByType((pointer *)&cursorfont, fontID, RT_FONT,
				  serverClient, DixReadAccess);
    if (err != Success)
	return NullCursor;
    if (AllocGlyphCursor(fontID, 0, fontID, 1, 0, 0, 0, ~0, ~0, ~0,
			 &curs, serverClient, (XID)0) != Success)
	return NullCursor;

    if (!AddResource(FakeClientID(0), RT_CURSOR, (pointer)curs))
	return NullCursor;

    return curs;
}
static int
XineramaXvPutStill(ClientPtr client)
{
    REQUEST(xvPutImageReq);
    PanoramiXRes *draw, *gc, *port;
    Bool isRoot;
    int result, i, x, y;

    REQUEST_AT_LEAST_SIZE(xvPutImageReq);

    result = dixLookupResourceByClass((pointer *)&draw, stuff->drawable,
				      XRC_DRAWABLE, client, DixWriteAccess);
    if (result != Success)
	return (result == BadValue) ? BadDrawable : result;

    result = dixLookupResourceByType((pointer *)&gc, stuff->gc,
				     XRT_GC, client, DixReadAccess);
    if (result != Success)
        return (result == BadValue) ? BadGC : result;

    result = dixLookupResourceByType((pointer *)&port, stuff->port,
				     XvXRTPort, client, DixReadAccess);
    if (result != Success)
	return (result == BadValue) ? _XvBadPort : result;

    isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root;

    x = stuff->drw_x;
    y = stuff->drw_y;

    FOR_NSCREENS_BACKWARD(i) {
        if(port->info[i].id) {
           stuff->drawable = draw->info[i].id;
           stuff->port = port->info[i].id;
           stuff->gc = gc->info[i].id;
           stuff->drw_x = x;
           stuff->drw_y = y;
           if(isRoot) {
                stuff->drw_x -= panoramiXdataPtr[i].x;
                stuff->drw_y -= panoramiXdataPtr[i].y;
           }

           result = ProcXvPutStill(client);
        }
    }
    return result;
}
Esempio n. 22
0
/** Add glyphs to the Glyph Set on each screen. */
static int
dmxProcRenderAddGlyphs(ClientPtr client)
{
    int ret;

    REQUEST(xRenderAddGlyphsReq);

    ret = dmxSaveRenderVector[stuff->renderReqType] (client);

    if (ret == Success) {
        GlyphSetPtr glyphSet;
        dmxGlyphPrivPtr glyphPriv;
        int i;
        int nglyphs;
        CARD32 *gids;
        Glyph *gidsCopy;
        xGlyphInfo *gi;
        CARD8 *bits;
        int nbytes;

        dixLookupResourceByType((pointer *) &glyphSet,
                                stuff->glyphset, GlyphSetType,
                                client, DixReadAccess);
        glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet);

        nglyphs = stuff->nglyphs;
        gids = (CARD32 *) (stuff + 1);
        gi = (xGlyphInfo *) (gids + nglyphs);
        bits = (CARD8 *) (gi + nglyphs);
        nbytes = ((stuff->length << 2) -
                  sizeof(xRenderAddGlyphsReq) -
                  (sizeof(CARD32) + sizeof(xGlyphInfo)) * nglyphs);

        gidsCopy = malloc(sizeof(*gidsCopy) * nglyphs);
        for (i = 0; i < nglyphs; i++)
            gidsCopy[i] = gids[i];

        /* FIXME: Will this ever fail? */
        for (i = 0; i < dmxNumScreens; i++) {
            DMXScreenInfo *dmxScreen = &dmxScreens[i];

            if (dmxScreen->beDisplay) {
                XRenderAddGlyphs(dmxScreen->beDisplay,
                                 glyphPriv->glyphSets[i],
                                 gidsCopy,
                                 (XGlyphInfo *) gi,
                                 nglyphs, (char *) bits, nbytes);
                dmxSync(dmxScreen, FALSE);
            }
        }
        free(gidsCopy);
    }

    return ret;
}
Esempio n. 23
0
/** Create a Glyph Set on each screen.  Save the glyphset ID from each
 *  screen in the Glyph Set's private structure.  Fail if the format
 *  requested is not available or if the Glyph Set cannot be created on
 *  the screen. */
static int
dmxProcRenderCreateGlyphSet(ClientPtr client)
{
    int ret;

    REQUEST(xRenderCreateGlyphSetReq);

    ret = dmxSaveRenderVector[stuff->renderReqType] (client);

    if (ret == Success) {
        GlyphSetPtr glyphSet;
        dmxGlyphPrivPtr glyphPriv;
        int i;

        /* Look up glyphSet that was just created ???? */
        /* Store glyphsets from backends in glyphSet->devPrivate ????? */
        /* Make sure we handle all errors here!! */

        dixLookupResourceByType((pointer *) &glyphSet,
                                stuff->gsid, GlyphSetType,
                                client, DixDestroyAccess);

        glyphPriv = malloc(sizeof(dmxGlyphPrivRec));
        if (!glyphPriv)
            return BadAlloc;
        glyphPriv->glyphSets = NULL;
        MAXSCREENSALLOC_RETURN(glyphPriv->glyphSets, BadAlloc);
        DMX_SET_GLYPH_PRIV(glyphSet, glyphPriv);

        for (i = 0; i < dmxNumScreens; i++) {
            DMXScreenInfo *dmxScreen = &dmxScreens[i];
            int beret;

            if (!dmxScreen->beDisplay) {
                glyphPriv->glyphSets[i] = 0;
                continue;
            }

            if ((beret = dmxBECreateGlyphSet(i, glyphSet)) != Success) {
                int j;

                /* Free the glyph sets we've allocated thus far */
                for (j = 0; j < i; j++)
                    dmxBEFreeGlyphSet(screenInfo.screens[j], glyphSet);

                /* Free the resource created by render */
                FreeResource(stuff->gsid, RT_NONE);

                return beret;
            }
        }
    }

    return ret;
}
Esempio n. 24
0
int
present_select_input(ClientPtr client, XID eid, WindowPtr window, CARD32 mask)
{
    present_window_priv_ptr window_priv;
    present_event_ptr event;
    int ret;

    /* Check to see if we're modifying an existing event selection */
    ret = dixLookupResourceByType((void **) &event, eid, present_event_type,
                                  client, DixWriteAccess);
    if (ret == Success) {
        /* Match error for the wrong window; also don't modify some other
         * client's event selection
         */
        if (event->window != window || event->client != client)
            return BadMatch;

        if (mask)
            event->mask = mask;
        else
            FreeResource(eid, RT_NONE);
        return Success;
    }
    if (ret != BadValue)
        return ret;

    if (mask == 0)
        return Success;

    LEGAL_NEW_RESOURCE(eid, client);

    window_priv = present_get_window_priv(window, TRUE);
    if (!window_priv)
        return BadAlloc;

    event = calloc (1, sizeof (present_event_rec));
    if (!event)
        return BadAlloc;

    event->client = client;
    event->window = window;
    event->id = eid;
    event->mask = mask;

    event->next = window_priv->events;
    window_priv->events = event;

    if (!AddResource(event->id, present_event_type, (void *) event))
        return BadAlloc;

    return Success;
}
Esempio n. 25
0
/* replaced by dixLookupResourceByType */
pointer
SecurityLookupIDByType(ClientPtr client, XID id, RESTYPE rtype,
		       Mask access_mode)
{
    pointer retval;
    int i = dixLookupResourceByType(&retval, id, rtype, client, access_mode);
    static int warn = 1;
    if (warn > 0 && --warn)
	ErrorF("Warning: LookupIDByType()/SecurityLookupIDByType() "
	       "are deprecated.  Please convert your driver/module "
	       "to use dixLookupResourceByType().\n");
    return (i == Success) ? retval : NULL;
}
Esempio n. 26
0
static int 
ProcXvMCCreateSurface(ClientPtr client)
{
    CARD32 *data = NULL;
    int dwords = 0;
    int result;
    XvMCContextPtr pContext;
    XvMCSurfacePtr pSurface;
    XvMCScreenPtr pScreenPriv;
    xvmcCreateSurfaceReply rep;
    REQUEST(xvmcCreateSurfaceReq);
    REQUEST_SIZE_MATCH(xvmcCreateSurfaceReq);

    result = dixLookupResourceByType((pointer *)&pContext, stuff->context_id,
				     XvMCRTContext, client, DixUseAccess);
    if (result != Success)
        return result;

    pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen);

    if(!(pSurface = malloc(sizeof(XvMCSurfaceRec)))) 
        return BadAlloc;

    pSurface->surface_id = stuff->surface_id;
    pSurface->surface_type_id = pContext->surface_type_id;
    pSurface->context = pContext;

    result = (*pScreenPriv->adaptors[pContext->adapt_num].CreateSurface)(
                pSurface, &dwords, &data);

    if(result != Success) {
        free(pSurface);
        return result;
    }

    rep.type = X_Reply;
    rep.sequenceNumber = client->sequence;
    rep.length = dwords;

    WriteToClient(client, sizeof(xvmcCreateSurfaceReply), (char*)&rep);
    if(dwords)
      WriteToClient(client, dwords << 2, (char*)data);
    AddResource(pSurface->surface_id, XvMCRTSurface, pSurface);

    free(data);

    pContext->refcnt++;

    return Success;
}
Esempio n. 27
0
int
ProcXFixesCreateRegionFromWindow (ClientPtr client)
{
    RegionPtr	pRegion;
    Bool	copy = TRUE;
    WindowPtr	pWin;
    int rc;
    REQUEST (xXFixesCreateRegionFromWindowReq);
    
    REQUEST_SIZE_MATCH (xXFixesCreateRegionFromWindowReq);
    LEGAL_NEW_RESOURCE (stuff->region, client);
    rc = dixLookupResourceByType((pointer *)&pWin, stuff->window, RT_WINDOW,
			   client, DixGetAttrAccess);
    if (rc != Success)
    {
	client->errorValue = stuff->window;
	return rc;
    }
    switch (stuff->kind) {
    case WindowRegionBounding:
	pRegion = wBoundingShape(pWin);
	if (!pRegion)
	{
	    pRegion = CreateBoundingShape (pWin);
	    copy = FALSE;
	}
	break;
    case WindowRegionClip:
	pRegion = wClipShape(pWin);
	if (!pRegion)
	{
	    pRegion = CreateClipShape (pWin);
	    copy = FALSE;
	}
	break;
    default:
	client->errorValue = stuff->kind;
	return BadValue;
    }
    if (copy && pRegion)
	pRegion = XFixesRegionCopy (pRegion);
    if (!pRegion)
	return BadAlloc;
    if (!AddResource (stuff->region, RegionResType, (pointer) pRegion))
	return BadAlloc;
    
    return Success;
}
Esempio n. 28
0
void
__glXFreeGLXWindow(__glXWindow * pGlxWindow)
{
    if (!pGlxWindow->idExists && !pGlxWindow->refcnt) {
        WindowPtr pWindow = (WindowPtr) pGlxWindow->pDraw;
        WindowPtr ret;

        dixLookupResourceByType((pointer) &ret,
                                pWindow->drawable.id, RT_WINDOW,
                                NullClient, DixUnknownAccess);
        if (ret == pWindow) {
            (*pGlxWindow->pScreen->DestroyWindow) (pWindow);
        }

        free(pGlxWindow);
    }
}
Esempio n. 29
0
static int 
ProcXvMCDestroySubpicture(ClientPtr client)
{
    pointer val;
    int rc;
    REQUEST(xvmcDestroySubpictureReq);
    REQUEST_SIZE_MATCH(xvmcDestroySubpictureReq);

    rc = dixLookupResourceByType(&val, stuff->subpicture_id, XvMCRTSubpicture,
				 client, DixDestroyAccess);
    if (rc != Success)
        return rc;

    FreeResource(stuff->subpicture_id, RT_NONE);

    return Success;
}
Esempio n. 30
0
File: randr.c Progetto: hush-z/VMGL
static int
TellChanged (WindowPtr pWin, pointer value)
{
    RREventPtr			*pHead, pRREvent;
    ClientPtr			client;
    ScreenPtr			pScreen = pWin->drawable.pScreen;
    rrScrPriv(pScreen);
    int				i;

    dixLookupResourceByType((pointer *)&pHead, pWin->drawable.id,
                            RREventType, serverClient, DixReadAccess);
    if (!pHead)
        return WT_WALKCHILDREN;

    for (pRREvent = *pHead; pRREvent; pRREvent = pRREvent->next)
    {
        client = pRREvent->client;
        if (client == serverClient || client->clientGone)
            continue;

        if (pRREvent->mask & RRScreenChangeNotifyMask)
            RRDeliverScreenEvent (client, pWin, pScreen);

        if (pRREvent->mask & RRCrtcChangeNotifyMask)
        {
            for (i = 0; i < pScrPriv->numCrtcs; i++)
            {
                RRCrtcPtr   crtc = pScrPriv->crtcs[i];
                if (crtc->changed)
                    RRDeliverCrtcEvent (client, pWin, crtc);
            }
        }

        if (pRREvent->mask & RROutputChangeNotifyMask)
        {
            for (i = 0; i < pScrPriv->numOutputs; i++)
            {
                RROutputPtr   output = pScrPriv->outputs[i];
                if (output->changed)
                    RRDeliverOutputEvent (client, pWin, output);
            }
        }
    }
    return WT_WALKCHILDREN;
}