コード例 #1
0
ファイル: dmxgcops.c プロジェクト: 4eremuxa/xserver
/** 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;
}
コード例 #2
0
ファイル: dmxgcops.c プロジェクト: Agnarr/xserver
/** 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 (!(pXinPix = (PanoramiXRes *)LookupIDByType(pDrawable->id, XRT_PIXMAP)))
        return NULL;

    for (i = 1; i < PanoramiXNumScreens; i++) {
        dmxScreen = &dmxScreens[i];
        if (dmxScreen->beDisplay) {
            PixmapPtr     pSrc;
            dmxPixPrivPtr pSrcPriv;
            
            pSrc = (PixmapPtr)LookupIDByType(pXinPix->info[i].id,
                                             RT_PIXMAP);
            pSrcPriv = DMX_GET_PIXMAP_PRIV(pSrc);
            if (pSrcPriv->pixmap) {
                *draw = pSrcPriv->pixmap;
                return dmxScreen;
            }
        }
    }
#endif
    return NULL;
}
コード例 #3
0
ファイル: dmxpict.c プロジェクト: Agnesa/xserver
/** Create a picture on the appropriate screen.  This is the actual
 *  function that creates the picture.  However, if the associated
 *  window has not yet been created due to lazy window creation, then
 *  delay the picture creation until the window is mapped. */
static Picture
dmxDoCreatePicture(PicturePtr pPicture)
{
    DrawablePtr pDraw = pPicture->pDrawable;
    ScreenPtr pScreen = pDraw->pScreen;
    DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
    XRenderPictFormat *pFormat;
    Drawable draw;

    if (pPicture->pDrawable->type == DRAWABLE_WINDOW) {
        dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV((WindowPtr) (pDraw));

        if (!(draw = pWinPriv->window)) {
            /* Window has not been created yet due to the window
             * optimization.  Delay picture creation until window is
             * mapped.
             */
            pWinPriv->hasPict = TRUE;
            return 0;
        }
    }
    else {
        dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV((PixmapPtr) (pDraw));

        if (!(draw = pPixPriv->pixmap)) {
            /* FIXME: Zero width/height pixmap?? */
            return 0;
        }
    }

    /* This should not be reached if the back-end display has been
     * detached because the pWinPriv->window or the pPixPriv->pixmap
     * will be NULL; however, we add it here for completeness
     */
    if (!dmxScreen->beDisplay)
        return 0;

    pFormat = dmxFindFormat(dmxScreen, pPicture->pFormat);

    return XRenderCreatePicture(dmxScreen->beDisplay, draw, pFormat, 0, 0);
}
コード例 #4
0
/** Set the values in the graphics context on the back-end server
 *  associated with \a pGC's screen. */
void
dmxChangeGC(GCPtr pGC, unsigned long mask)
{
    ScreenPtr pScreen = pGC->pScreen;
    DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
    dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC);
    XGCValues v;

    DMX_GC_FUNC_PROLOGUE(pGC);
#if 0
    pGC->funcs->ChangeGC(pGC, mask);
#endif

    /* Handle "magic special case" from CreateGC */
    if (pGCPriv->msc) {
        /* The "magic special case" is used to handle the case where a
         * foreground pixel is set when the GC is created so that a
         * "pseudo default-tile" can be created and used in case the
         * fillstyle was set to FillTiled.  This specific case is tested
         * in xtest (XCreateGC test #3).  What has happened in dix by
         * the time it reaches here is (1) the pGC->tile.pixel has been
         * set to pGC->fgPixel and pGC->tileIsPixel is set, (2) if a
         * tile has also been set, then pGC->tileIsPixel is unset and
         * pGC->tile.pixmap is initialized; else, the default tile is
         * created and pGC->tileIsPixel is unset and pGC->tile.pixmap is
         * initialized to the "pseudo default-tile".  In either case,
         * pGC->tile.pixmap is set; however, in the "magic special case"
         * the mask is not updated to allow us to detect that we should
         * initialize the GCTile in the back-end server.  Thus, we catch
         * this case in dmxCreateGC and add GCTile to the mask here.
         * Are there any cases that I've missed?
         */

        /* Make sure that the tile.pixmap is set, just in case the user
         * set GCTile in the mask but forgot to set vals.pixmap
         */
        if (pGC->tile.pixmap)
            mask |= GCTile;

        /* This only happens once when the GC is created */
        pGCPriv->msc = FALSE;
    }

    /* Update back-end server's gc */
    if (mask & GCFunction)
        v.function = pGC->alu;
    if (mask & GCPlaneMask)
        v.plane_mask = pGC->planemask;
    if (mask & GCForeground)
        v.foreground = pGC->fgPixel;
    if (mask & GCBackground)
        v.background = pGC->bgPixel;
    if (mask & GCLineWidth)
        v.line_width = pGC->lineWidth;
    if (mask & GCLineStyle)
        v.line_style = pGC->lineStyle;
    if (mask & GCCapStyle)
        v.cap_style = pGC->capStyle;
    if (mask & GCJoinStyle)
        v.join_style = pGC->joinStyle;
    if (mask & GCFillStyle)
        v.fill_style = pGC->fillStyle;
    if (mask & GCFillRule)
        v.fill_rule = pGC->fillRule;
    if (mask & GCTile) {
        if (pGC->tileIsPixel) {
            mask &= ~GCTile;
        }
        else {
            dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pGC->tile.pixmap);

            v.tile = (Drawable) pPixPriv->pixmap;
        }
    }
    if (mask & GCStipple) {
        dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pGC->stipple);

        v.stipple = (Drawable) pPixPriv->pixmap;
    }
    if (mask & GCTileStipXOrigin)
        v.ts_x_origin = pGC->patOrg.x;
    if (mask & GCTileStipYOrigin)
        v.ts_y_origin = pGC->patOrg.y;
    if (mask & GCFont) {
        if (dmxScreen->beDisplay) {
            dmxFontPrivPtr pFontPriv;

            pFontPriv = FontGetPrivate(pGC->font, dmxFontPrivateIndex);
            v.font = pFontPriv->font[pScreen->myNum]->fid;
        }
        else {
            mask &= ~GCFont;
        }
    }
    if (mask & GCSubwindowMode)
        v.subwindow_mode = pGC->subWindowMode;

    /* Graphics exposures are not needed on the back-ends since they can
       be generated on the front-end thereby saving bandwidth. */
    if (mask & GCGraphicsExposures)
        mask &= ~GCGraphicsExposures;

    if (mask & GCClipXOrigin)
        v.clip_x_origin = pGC->clipOrg.x;
    if (mask & GCClipYOrigin)
        v.clip_y_origin = pGC->clipOrg.y;
    if (mask & GCClipMask)
        mask &= ~GCClipMask;    /* See ChangeClip */
    if (mask & GCDashOffset)
        v.dash_offset = pGC->dashOffset;
    if (mask & GCDashList) {
        mask &= ~GCDashList;
        if (dmxScreen->beDisplay)
            XSetDashes(dmxScreen->beDisplay, pGCPriv->gc,
                       pGC->dashOffset, (char *) pGC->dash, pGC->numInDashList);
    }
    if (mask & GCArcMode)
        v.arc_mode = pGC->arcMode;

    if (mask && dmxScreen->beDisplay) {
        XChangeGC(dmxScreen->beDisplay, pGCPriv->gc, mask, &v);
        dmxSync(dmxScreen, FALSE);
    }

    DMX_GC_FUNC_EPILOGUE(pGC);
}