Beispiel #1
0
_X_EXPORT
Bool CompositeRegisterAlternateVisuals (ScreenPtr pScreen, VisualID *vids,
					int nVisuals)
{
    CompScreenPtr cs = GetCompScreen (pScreen);
    return compRegisterAlternateVisuals(cs, vids, nVisuals);
}
Beispiel #2
0
/*
 * Create an overlay client object for the given client
 */
CompOverlayClientPtr
compCreateOverlayClient (ScreenPtr pScreen, ClientPtr pClient)
{
    CompScreenPtr    cs = GetCompScreen(pScreen);
    CompOverlayClientPtr pOc;

    pOc = (CompOverlayClientPtr) malloc(sizeof(CompOverlayClientRec));
    if (pOc == NULL)
	return NULL;

    pOc->pClient = pClient;
    pOc->pScreen = pScreen;
    pOc->resource = FakeClientID(pClient->index);
    pOc->pNext = cs->pOverlayClients;
    cs->pOverlayClients = pOc;

    /* 
     * Create a resource for this element so it can be deleted
     * when the client goes away.
     */
    if (!AddResource (pOc->resource, CompositeClientOverlayType, (pointer) pOc))
	return NULL;

    return pOc;
}
Beispiel #3
0
/*
 * Create the overlay window and map it
 */
Bool
compCreateOverlayWindow(ScreenPtr pScreen)
{
    CompScreenPtr cs = GetCompScreen(pScreen);
    WindowPtr pRoot = pScreen->root;
    WindowPtr pWin;
    XID attrs[] = { None, TRUE };       /* backPixmap, overrideRedirect */
    int result;
    int w = pScreen->width;
    int h = pScreen->height;

#ifdef PANORAMIX
    if (!noPanoramiXExtension) {
        w = PanoramiXPixWidth;
        h = PanoramiXPixHeight;
    }
#endif

    pWin = cs->pOverlayWin =
        CreateWindow(cs->overlayWid, pRoot, 0, 0, w, h, 0,
                     InputOutput, CWBackPixmap | CWOverrideRedirect, &attrs[0],
                     pRoot->drawable.depth,
                     serverClient, pScreen->rootVisual, &result);
    if (pWin == NULL)
        return FALSE;

    if (!AddResource(pWin->drawable.id, RT_WINDOW, (pointer) pWin))
        return FALSE;

    MapWindow(pWin, serverClient);

    return TRUE;
}
Beispiel #4
0
static int
createCompOverlayClient (ClientPtr pClient, ScreenPtr pScreen)
{
    CompScreenPtr    cs = GetCompScreen(pScreen);
    CompOverlayClientPtr pOc;

    pOc = (CompOverlayClientPtr) xalloc(sizeof(CompOverlayClientRec));
    if (pOc == NULL) {
	return BadAlloc;
    }
    pOc->pClient = pClient;
    pOc->pScreen = pScreen;
    pOc->resource = FakeClientID(pClient->index);
    pOc->pNext = cs->pOverlayClients;
    cs->pOverlayClients = pOc;

    /* 
     * Create a resource for this element so it can be deleted
     * when the client goes away.
     */
    if (!AddResource (pOc->resource, CompositeClientOverlayType, 
		      (pointer) pOc)) {
	xfree(pOc);
	return BadAlloc;
    }

    return Success;
}
Beispiel #5
0
static Bool
compCloseScreen(ScreenPtr pScreen)
{
    CompScreenPtr cs = GetCompScreen(pScreen);
    Bool ret;

    free(cs->alternateVisuals);

    pScreen->CloseScreen = cs->CloseScreen;
    pScreen->InstallColormap = cs->InstallColormap;
    pScreen->ChangeWindowAttributes = cs->ChangeWindowAttributes;
    pScreen->ReparentWindow = cs->ReparentWindow;
    pScreen->ConfigNotify = cs->ConfigNotify;
    pScreen->MoveWindow = cs->MoveWindow;
    pScreen->ResizeWindow = cs->ResizeWindow;
    pScreen->ChangeBorderWidth = cs->ChangeBorderWidth;

    pScreen->ClipNotify = cs->ClipNotify;
    pScreen->UnrealizeWindow = cs->UnrealizeWindow;
    pScreen->RealizeWindow = cs->RealizeWindow;
    pScreen->DestroyWindow = cs->DestroyWindow;
    pScreen->CreateWindow = cs->CreateWindow;
    pScreen->CopyWindow = cs->CopyWindow;
    pScreen->PositionWindow = cs->PositionWindow;

    pScreen->GetImage = cs->GetImage;
    pScreen->GetSpans = cs->GetSpans;
    pScreen->SourceValidate = cs->SourceValidate;

    free(cs);
    dixSetPrivate(&pScreen->devPrivates, CompScreenPrivateKey, NULL);
    ret = (*pScreen->CloseScreen) (pScreen);

    return ret;
}
Beispiel #6
0
/*
 * Create the overlay window and map it
 */
Bool
compCreateOverlayWindow (ScreenPtr pScreen)
{
    CompScreenPtr   cs = GetCompScreen(pScreen);
    WindowPtr	    pRoot = pScreen->root;
    WindowPtr	    pWin;
    XID		    attrs[] = { None, TRUE }; /* backPixmap, overrideRedirect */
    int		    result;

    pWin = cs->pOverlayWin = 
	CreateWindow (cs->overlayWid, pRoot,
		      0, 0, pScreen->width, pScreen->height, 0, 
		      InputOutput, CWBackPixmap | CWOverrideRedirect, &attrs[0],
		      pRoot->drawable.depth, 
		      serverClient, pScreen->rootVisual, &result);
    if (pWin == NULL)
	return FALSE;

    if (!AddResource(pWin->drawable.id, RT_WINDOW, (pointer)pWin))
	return FALSE;

    MapWindow(pWin, serverClient);

    return TRUE;
}
Beispiel #7
0
/* Fake backing store via automatic redirection */
static Bool
compChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
{
    ScreenPtr pScreen = pWin->drawable.pScreen;
    CompScreenPtr cs = GetCompScreen (pScreen);
    Bool ret;

    pScreen->ChangeWindowAttributes = cs->ChangeWindowAttributes;
    ret = pScreen->ChangeWindowAttributes(pWin, mask);

    if (ret && (mask & CWBackingStore) &&
	    pScreen->backingStoreSupport != NotUseful) {
	if (pWin->backingStore != NotUseful) {
	    compRedirectWindow(serverClient, pWin, CompositeRedirectAutomatic);
	    pWin->backStorage = (pointer) (intptr_t) 1;
	} else {
	    compUnredirectWindow(serverClient, pWin,
				 CompositeRedirectAutomatic);
	    pWin->backStorage = NULL;
	}
    }

    pScreen->ChangeWindowAttributes = compChangeWindowAttributes;

    return ret;
}
Beispiel #8
0
static Bool
compCloseScreen (int index, ScreenPtr pScreen)
{
    CompScreenPtr   cs = GetCompScreen (pScreen);
    Bool	    ret;

    xfree (cs->alternateVisuals);

    pScreen->CloseScreen = cs->CloseScreen;
    pScreen->BlockHandler = cs->BlockHandler;
    pScreen->InstallColormap = cs->InstallColormap;
    pScreen->ChangeWindowAttributes = cs->ChangeWindowAttributes;
    pScreen->ReparentWindow = cs->ReparentWindow;
    pScreen->MoveWindow = cs->MoveWindow;
    pScreen->ResizeWindow = cs->ResizeWindow;
    pScreen->ChangeBorderWidth = cs->ChangeBorderWidth;
    
    pScreen->ClipNotify = cs->ClipNotify;
    pScreen->UnrealizeWindow = cs->UnrealizeWindow;
    pScreen->RealizeWindow = cs->RealizeWindow;
    pScreen->DestroyWindow = cs->DestroyWindow;
    pScreen->CreateWindow = cs->CreateWindow;
    pScreen->CopyWindow = cs->CopyWindow;
    pScreen->PositionWindow = cs->PositionWindow;

    xfree (cs);
    dixSetPrivate(&pScreen->devPrivates, CompScreenPrivateKey, NULL);
    ret = (*pScreen->CloseScreen) (index, pScreen);

    return ret;
}
Beispiel #9
0
/*
 * Destroy the overlay window
 */
void
compDestroyOverlayWindow (ScreenPtr pScreen)
{
    CompScreenPtr cs = GetCompScreen(pScreen);

    cs->pOverlayWin = NullWindow;
    FreeResource (cs->overlayWid, RT_NONE);
}
Beispiel #10
0
static void
compReportDamage (DamagePtr pDamage, RegionPtr pRegion, void *closure)
{
    WindowPtr	    pWin = (WindowPtr) closure;
    ScreenPtr	    pScreen = pWin->drawable.pScreen;
    CompScreenPtr   cs = GetCompScreen (pScreen);
    CompWindowPtr   cw = GetCompWindow (pWin);

    cs->damaged = TRUE;
    cw->damaged = TRUE;
}
Beispiel #11
0
static void
compBlockHandler(ScreenPtr pScreen, pointer pTimeout, pointer pReadmask)
{
    CompScreenPtr cs = GetCompScreen(pScreen);

    pScreen->BlockHandler = cs->BlockHandler;
    compScreenUpdate(pScreen);
    (*pScreen->BlockHandler) (pScreen, pTimeout, pReadmask);

    /* Next damage will restore the block handler */
    cs->BlockHandler = NULL;
}
Beispiel #12
0
/*
 * Return the client's first overlay client rec from the given screen
 */
CompOverlayClientPtr
compFindOverlayClient (ScreenPtr pScreen, ClientPtr pClient)
{
    CompScreenPtr	    cs = GetCompScreen(pScreen);
    CompOverlayClientPtr    pOc;

    for (pOc = cs->pOverlayClients; pOc != NULL; pOc = pOc->pNext)
	if (pOc->pClient == pClient)
	    return pOc;

    return NULL;           
}
Beispiel #13
0
static void
compScreenUpdate (ScreenPtr pScreen)
{
    CompScreenPtr   cs = GetCompScreen (pScreen);

    compCheckTree (pScreen);
    if (cs->damaged)
    {
	compWindowUpdate (WindowTable[pScreen->myNum]);
	cs->damaged = FALSE;
    }
}
Beispiel #14
0
int
ProcCompositeGetOverlayWindow (ClientPtr client)
{
    REQUEST(xCompositeGetOverlayWindowReq); 
    xCompositeGetOverlayWindowReply rep;
    WindowPtr pWin;
    ScreenPtr pScreen;
    CompScreenPtr cs;
    CompOverlayClientPtr pOc;

    REQUEST_SIZE_MATCH(xCompositeGetOverlayWindowReq);
    pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW);
    if (!pWin)
    {
	client->errorValue = stuff->window;
	return BadWindow;
    }
    pScreen = pWin->drawable.pScreen;

    cs = GetCompScreen(pScreen);
    if (cs->pOverlayWin == NULL) {
	cs->pOverlayWin = createOverlayWindow(pScreen);
	if (cs->pOverlayWin == NULL) {
	    return BadAlloc;
	}
    }
    MapWindow(cs->pOverlayWin, serverClient);

    /* Record that client is using this overlay window */
    pOc = findCompOverlayClient(client, pScreen);
    if (pOc == NULL) {
	int ret = createCompOverlayClient(client, pScreen);
	if (ret != Success) {
	    return ret;
	}
    }

    rep.type = X_Reply;
    rep.sequenceNumber = client->sequence;
    rep.length = 0;
    rep.overlayWin = cs->pOverlayWin->drawable.id;

    if (client->swapped)
    {
	int n;
	swaps(&rep.sequenceNumber, n);
    	swapl(&rep.length, n);
	swapl(&rep.overlayWin, n);
    }
    (void) WriteToClient(client, sz_xCompositeGetOverlayWindowReply, (char *)&rep);

    return client->noClientException;
}
Beispiel #15
0
static void
compBlockHandler(int i, pointer blockData, pointer pTimeout, pointer pReadmask)
{
    ScreenPtr pScreen = screenInfo.screens[i];
    CompScreenPtr cs = GetCompScreen(pScreen);

    pScreen->BlockHandler = cs->BlockHandler;
    compScreenUpdate(pScreen);
    (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask);

    /* Next damage will restore the block handler */
    cs->BlockHandler = NULL;
}
Beispiel #16
0
static void
compGetSpans(DrawablePtr pDrawable, int wMax, DDXPointPtr ppt, int *pwidth,
             int nspans, char *pdstStart)
{
    ScreenPtr pScreen = pDrawable->pScreen;
    CompScreenPtr cs = GetCompScreen(pScreen);

    pScreen->GetSpans = cs->GetSpans;
    if (pDrawable->type == DRAWABLE_WINDOW)
        compPaintChildrenToWindow((WindowPtr) pDrawable);
    (*pScreen->GetSpans) (pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
    cs->GetSpans = pScreen->GetSpans;
    pScreen->GetSpans = compGetSpans;
}
Beispiel #17
0
/* Return the screen's overlay client list element for the given client */
static CompOverlayClientPtr
findCompOverlayClient (ClientPtr pClient, ScreenPtr pScreen) 
{
    CompScreenPtr    cs = GetCompScreen(pScreen);
    CompOverlayClientPtr pOc;

    for (pOc = cs->pOverlayClients; pOc != NULL; pOc = pOc->pNext) {
	if (pOc->pClient == pClient) {
	    return pOc;
	}
    }

    return NULL;           
}
Beispiel #18
0
/* 
 * Delete all the hide-counts list elements for this screen.
 */
void
deleteCompOverlayClientsForScreen (ScreenPtr pScreen)
{
    CompScreenPtr    cs = GetCompScreen(pScreen);
    CompOverlayClientPtr pOc, pTmp;

    pOc = cs->pOverlayClients;
    while (pOc != NULL) {
	pTmp = pOc->pNext;
	FreeResource(pOc->resource, 0);
	pOc = pTmp;
    }
    cs->pOverlayClients = NULL;
}
Beispiel #19
0
static void
compBlockHandler (int	    i,
		  pointer   blockData,
		  pointer   pTimeout,
		  pointer   pReadmask)
{
    ScreenPtr	    pScreen = screenInfo.screens[i];
    CompScreenPtr   cs = GetCompScreen (pScreen);

    pScreen->BlockHandler = cs->BlockHandler;
    compScreenUpdate (pScreen);
    (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask);
    cs->BlockHandler = pScreen->BlockHandler;
    pScreen->BlockHandler = compBlockHandler;
}
Beispiel #20
0
static void
compGetImage(DrawablePtr pDrawable,
             int sx, int sy,
             int w, int h,
             unsigned int format, unsigned long planemask, char *pdstLine)
{
    ScreenPtr pScreen = pDrawable->pScreen;
    CompScreenPtr cs = GetCompScreen(pScreen);

    pScreen->GetImage = cs->GetImage;
    if (pDrawable->type == DRAWABLE_WINDOW)
        compPaintChildrenToWindow((WindowPtr) pDrawable);
    (*pScreen->GetImage) (pDrawable, sx, sy, w, h, format, planemask, pdstLine);
    cs->GetImage = pScreen->GetImage;
    pScreen->GetImage = compGetImage;
}
Beispiel #21
0
static void
compInstallColormap (ColormapPtr pColormap)
{
    VisualPtr	    pVisual = pColormap->pVisual;
    ScreenPtr	    pScreen = pColormap->pScreen;
    CompScreenPtr   cs = GetCompScreen (pScreen);
    int		    a;

    for (a = 0; a < NUM_COMP_ALTERNATE_VISUALS; a++)
	if (pVisual->vid == cs->alternateVisuals[a])
	    return;
    pScreen->InstallColormap = cs->InstallColormap;
    (*pScreen->InstallColormap) (pColormap);
    cs->InstallColormap = pScreen->InstallColormap;
    pScreen->InstallColormap = compInstallColormap;
}
Beispiel #22
0
static void
compSourceValidate(DrawablePtr pDrawable,
                   int x, int y,
                   int width, int height, unsigned int subWindowMode)
{
    ScreenPtr pScreen = pDrawable->pScreen;
    CompScreenPtr cs = GetCompScreen(pScreen);

    pScreen->SourceValidate = cs->SourceValidate;
    if (pDrawable->type == DRAWABLE_WINDOW && subWindowMode == IncludeInferiors)
        compPaintChildrenToWindow((WindowPtr) pDrawable);
    if (pScreen->SourceValidate)
        (*pScreen->SourceValidate) (pDrawable, x, y, width, height,
                                    subWindowMode);
    cs->SourceValidate = pScreen->SourceValidate;
    pScreen->SourceValidate = compSourceValidate;
}
Beispiel #23
0
/* Fake backing store via automatic redirection */
static Bool
compChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
{
    ScreenPtr pScreen = pWin->drawable.pScreen;
    CompScreenPtr cs = GetCompScreen(pScreen);
    Bool ret;

    pScreen->ChangeWindowAttributes = cs->ChangeWindowAttributes;
    ret = pScreen->ChangeWindowAttributes(pWin, mask);

    if (ret && (mask & CWBackingStore) &&
        pScreen->backingStoreSupport != NotUseful)
        compCheckBackingStore(pWin);

    pScreen->ChangeWindowAttributes = compChangeWindowAttributes;

    return ret;
}
Beispiel #24
0
static int
FreeCompositeClientOverlay (pointer value, XID ccwid)
{
    CompOverlayClientPtr pOc = (CompOverlayClientPtr) value;
    ScreenPtr pScreen = pOc->pScreen;
    CompScreenPtr cs;

    deleteCompOverlayClient(pOc, pScreen);

    /* Unmap overlay window when there are no more clients using it */
    cs = GetCompScreen(pScreen);
    if (cs->pOverlayClients == NULL) {
	if (cs->pOverlayWin != NULL) {
	    UnmapWindow(cs->pOverlayWin, FALSE);
	}
    }

    return Success;
}
Beispiel #25
0
/* 
 * Delete the given overlay client list element from its screen list.
 */
void
compFreeOverlayClient(CompOverlayClientPtr pOcToDel)
{
    ScreenPtr pScreen = pOcToDel->pScreen;
    CompScreenPtr cs = GetCompScreen(pScreen);
    CompOverlayClientPtr *pPrev, pOc;

    for (pPrev = &cs->pOverlayClients; (pOc = *pPrev); pPrev = &pOc->pNext) {
        if (pOc == pOcToDel) {
            *pPrev = pOc->pNext;
            free(pOc);
            break;
        }
    }

    /* Destroy overlay window when there are no more clients using it */
    if (cs->pOverlayClients == NULL)
        compDestroyOverlayWindow(pScreen);
}
Beispiel #26
0
Bool
CompositeRegisterImplicitRedirectionException(ScreenPtr pScreen,
                                              VisualID parentVisual,
                                              VisualID winVisual)
{
    CompScreenPtr cs = GetCompScreen(pScreen);
    CompImplicitRedirectException *p;

    p = reallocarray(cs->implicitRedirectExceptions,
                     cs->numImplicitRedirectExceptions + 1, sizeof(p[0]));
    if (p == NULL)
        return FALSE;

    p[cs->numImplicitRedirectExceptions].parentVisual = parentVisual;
    p[cs->numImplicitRedirectExceptions].winVisual = winVisual;

    cs->implicitRedirectExceptions = p;
    cs->numImplicitRedirectExceptions++;

    return TRUE;
}
Beispiel #27
0
static Bool
compCloseScreen (int index, ScreenPtr pScreen)
{
    CompScreenPtr   cs = GetCompScreen (pScreen);
    Bool	    ret;

    xfree (cs->alternateVisuals);

    pScreen->CloseScreen = cs->CloseScreen;
    pScreen->BlockHandler = cs->BlockHandler;
    pScreen->InstallColormap = cs->InstallColormap;
    pScreen->ReparentWindow = cs->ReparentWindow;
    pScreen->MoveWindow = cs->MoveWindow;
    pScreen->ResizeWindow = cs->ResizeWindow;
    pScreen->ChangeBorderWidth = cs->ChangeBorderWidth;
    
    pScreen->ClipNotify = cs->ClipNotify;
    pScreen->PaintWindowBackground = cs->PaintWindowBackground;
    pScreen->UnrealizeWindow = cs->UnrealizeWindow;
    pScreen->RealizeWindow = cs->RealizeWindow;
    pScreen->DestroyWindow = cs->DestroyWindow;
    pScreen->CreateWindow = cs->CreateWindow;
    pScreen->CopyWindow = cs->CopyWindow;
    pScreen->PositionWindow = cs->PositionWindow;

    deleteCompOverlayClientsForScreen(pScreen);

    /* 
    ** Note: no need to call DeleteWindow; the server has
    ** already destroyed it.
    */
    cs->pOverlayWin = NULL;

    xfree (cs);
    pScreen->devPrivates[CompScreenPrivateIndex].ptr = 0;
    ret = (*pScreen->CloseScreen) (index, pScreen);

    return ret;
}
Beispiel #28
0
/* 
 * Delete the given overlay client list element from its screen list.
 */
static void
deleteCompOverlayClient (CompOverlayClientPtr pOcToDel, ScreenPtr pScreen)
{
    CompScreenPtr    cs = GetCompScreen(pScreen);
    CompOverlayClientPtr pOc, pNext;
    CompOverlayClientPtr pOcLast = NULL;

    pOc = cs->pOverlayClients;
    while (pOc != NULL) {
	pNext = pOc->pNext;
	if (pOc == pOcToDel) {
	    xfree(pOc);
	    if (pOcLast == NULL) {
		cs->pOverlayClients = pNext;
	    } else {
		pOcLast->pNext = pNext;
	    }
	    break;
	}
	pOcLast = pOc;
	pOc = pNext;
    }
}
Beispiel #29
0
static void
compReportDamage(DamagePtr pDamage, RegionPtr pRegion, void *closure)
{
    WindowPtr pWin = (WindowPtr) closure;
    ScreenPtr pScreen = pWin->drawable.pScreen;
    CompScreenPtr cs = GetCompScreen(pScreen);
    CompWindowPtr cw = GetCompWindow(pWin);

    if (!cs->BlockHandler) {
        cs->BlockHandler = pScreen->BlockHandler;
        pScreen->BlockHandler = compBlockHandler;
    }
    cw->damaged = TRUE;

    /* Mark the ancestors */
    pWin = pWin->parent;
    while (pWin) {
        if (pWin->damagedDescendants)
            break;
        pWin->damagedDescendants = TRUE;
        pWin = pWin->parent;
    }
}
Beispiel #30
0
int
ProcCompositeReleaseOverlayWindow (ClientPtr client)
{
    REQUEST(xCompositeReleaseOverlayWindowReq); 
    WindowPtr pWin;
    ScreenPtr pScreen;
    CompOverlayClientPtr pOc;
    CompScreenPtr cs;

    REQUEST_SIZE_MATCH(xCompositeReleaseOverlayWindowReq);
    pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW);
    if (!pWin)
    {
	client->errorValue = stuff->window;
	return BadWindow;
    }
    pScreen = pWin->drawable.pScreen;

    /* 
     * Has client queried a reference to the overlay window
     * on this screen? If not, generate an error.
     */
    pOc = findCompOverlayClient(client, pWin->drawable.pScreen);
    if (pOc == NULL) {
	return BadMatch;
    }

    FreeResource(pOc->resource, 0);

    cs = GetCompScreen(pScreen);
    if (cs->pOverlayClients == NULL) {
	UnmapWindow(cs->pOverlayWin, FALSE);
    }

    return client->noClientException;
}