Пример #1
0
static void HandlePreviewStatus(
    DPSContext context,
    int status)
{
    unsigned long serial;
    Display *dpy;
    StatusInfo *info = StatusList;

    while (info != NULL && info->ctxt != context) info = info->next;
    if (info == NULL) return;

    (void) XDPSXIDFromContext(&dpy, context);
    serial = LastKnownRequestProcessed(dpy);

    /* This event is from before our imaging; send to old status proc. */
    if (serial < info->startReqNum) {
	(*info->oldProc) (context, status);
	return;
    }

    /* This event is from during our imaging; ignore it */
    if (serial < info->endReqNum) return;

    /* This event is juuuuust right. */
    if (status == PSFROZEN) *info->doneFlag = True;
}
Пример #2
0
void
XDPSReconcileRequests(
    register DPSContext ctxt)
{
    Display *dpy;
    register ContextXID cxid;
    register DPSContext curCtxt;

    for (curCtxt = ctxt; curCtxt; curCtxt = curCtxt->chainChild)
        {
	cxid = XDPSXIDFromContext(&dpy, curCtxt);
	if (dpy == (Display *)NULL || cxid == None)
	    break;  /* Skip text contexts */
	XDPSLReconcileRequests(dpy, cxid);
        }
}
Пример #3
0
void XDPSRegisterContext(DPSContext context, Bool makeSharedContext)
{
    Display *display;
    Bool inited;
    ContextInfo c;
    
    /* Get the display */
    (void) XDPSXIDFromContext(&display, context);

    if (makeSharedContext) {	/* Install as shared ctxt for this display */
        c = LookupContext(display, context);
	c->displayInfo->defaultContext = context;
    } else {			/* Just add to the context list */
        c = LookupContext(display, context);
    }

    c->displayInfo->extensionPresent = ext_yes;

    (void) _XDPSTestComponentInitialized(context, dps_init_bit_share, &inited);
    if (!inited) {
	(void) _XDPSSetComponentInitialized(context, dps_init_bit_share);
	_DPSSInstallDPSlibDict(context);
    }
}
Пример #4
0
int XDPSSetContextParameters(
    DPSContext context,
    Screen *screen,
    int depth,
    Drawable drawable,
    int height,
    XDPSStandardColormap *rgbMap,
    XDPSStandardColormap *grayMap,
    unsigned int flags)
{
    ContextInfo c = FindContextInfo(context);
    Bool doDepth = False, doDrawable = False, doRGB = False, doGray = False;
    Colormap map = None;
    XStandardColormap cmap;
    GC gc;
    GContext gctx = None;
    DisplayInfo d;
    Display *dpy;
    int rgb_base_pixel = 0;
    int red_max = 0;
    int red_mult = 0;
    int green_max = 0;
    int green_mult = 0;
    int blue_max = 0;
    int blue_mult = 0;
    int gray_base_pixel = 0;
    int gray_max = 0;
    int gray_mult = 0;
    
    if (c == NULL) return dps_status_unregistered_context;
    d = c->displayInfo;

    (void) XDPSXIDFromContext(&dpy, context);

    if (flags & XDPSContextScreenDepth) {
	doDepth = True;

	if (DisplayOfScreen(screen) != dpy) {
	    return dps_status_illegal_value;
	}

	gc = DisplayInfoSharedGC(d, screen, depth);
	if (gc == NULL) return dps_status_illegal_value;

	gctx = XGContextFromGC(gc);
    }

    if (flags & XDPSContextDrawable) {
	doDrawable = True;
	if (drawable != None && height <= 0) return dps_status_illegal_value;
    }

    if (flags & XDPSContextRGBMap) {
	doRGB = True;
	if (rgbMap == NULL) {
	    XDPSGetDefaultColorMaps(dpy, screen, drawable, &cmap,
				    (XStandardColormap *) NULL);
	    rgb_base_pixel = cmap.base_pixel;
	    red_max = cmap.red_max;
	    red_mult = cmap.red_mult;
	    green_max = cmap.green_max;
	    green_mult = cmap.green_mult;
	    blue_max = cmap.blue_max;
	    blue_mult = cmap.blue_mult;
	    map = cmap.colormap;
	} else {
	    rgb_base_pixel = rgbMap->base_pixel;
	    red_max = rgbMap->red_max;
	    red_mult = rgbMap->red_mult;
	    green_max = rgbMap->green_max;
	    green_mult = rgbMap->green_mult;
	    blue_max = rgbMap->blue_max;
	    blue_mult = rgbMap->blue_mult;
	    map = rgbMap->colormap;
	}
    }

    if (flags & XDPSContextGrayMap) {
	doGray = True;
	if (grayMap == NULL) {
	    XDPSGetDefaultColorMaps(dpy, screen, drawable,
				    (XStandardColormap *) NULL, &cmap);
	    gray_base_pixel = cmap.base_pixel;
	    gray_max = cmap.red_max;
	    gray_mult = cmap.red_mult;
	    if (doRGB && map != cmap.colormap) {
		return dps_status_illegal_value;
	    } else map = cmap.colormap;
	} else {
	    gray_base_pixel = grayMap->base_pixel;
	    gray_max = grayMap->red_max;
	    gray_mult = grayMap->red_mult;
	    if (doRGB && map != grayMap->colormap) {
		return dps_status_illegal_value;
	    } else map = grayMap->colormap;
	}
    } 

    if (doDepth || doDrawable || doRGB || doGray) {
	_DPSSSetContextParameters(context, gctx, drawable, height, map,
				  rgb_base_pixel, red_max, red_mult,
				  green_max, green_mult, blue_max, blue_mult,
				  gray_base_pixel, gray_max, gray_mult,
				  doDepth, doDrawable, doRGB, doGray);
    }
    return dps_status_success;
}