XDPSshare.c revision 824
/*
*
* (c) Copyright 1990-1994 Adobe Systems Incorporated.
* All rights reserved.
*
* Permission to use, copy, modify, distribute, and sublicense this software
* and its documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notices appear in all copies and that
* both those copyright notices and this permission notice appear in
* supporting documentation and that the name of Adobe Systems Incorporated
* not be used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission. No trademark license
* to use the Adobe trademarks is hereby granted. If the Adobe trademark
* "Display PostScript"(tm) is used to describe this software, its
* functionality or for any other purpose, such use shall be limited to a
* statement that this software works in conjunction with the Display
* PostScript system. Proper trademark attribution to reflect Adobe's
* ownership of the trademark shall be given whenever any such reference to
* the Display PostScript system is made.
*
* ADOBE MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THE SOFTWARE FOR
* ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
* ADOBE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON- INFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL ADOBE BE LIABLE
* TO YOU OR ANY OTHER PARTY FOR ANY SPECIAL, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE, STRICT LIABILITY OR ANY OTHER ACTION ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ADOBE WILL NOT
* PROVIDE ANY TRAINING OR OTHER SUPPORT FOR THE SOFTWARE.
*
* Adobe, PostScript, and Display PostScript are trademarks of Adobe Systems
* Incorporated which may be registered in certain jurisdictions
*
* Author: Adobe Systems Incorporated
*/
/* $XFree86: xc/lib/dpstk/XDPSshare.c,v 1.2 2000/06/07 22:03:01 tsi Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <DPS/dpsXclient.h>
#include <DPS/dpsXshare.h>
#include "XDPSswraps.h"
#include "dpsXcommonI.h"
static int extensionId = 0;
/*
Alloc...Info allocates an info entry and stores it at the head of the list.
Find...Info looks for an info entry and returns NULL if not found.
Lookup...Info looks for an info entry and creates one if not found.
*/
typedef struct _ContextInfoRec {
int extensionId;
unsigned long initFlags;
struct _DisplayInfoRec *displayInfo;
typedef struct _DisplayInfoRec {
int *depthsForScreen;
int **validDepths;
GC **gcForDepth;
struct _DisplayInfoRec *next;
/* If a display is in displayList, it means that we have looked to see if
the extension exists on the display. If context is not NULL, the
display has a default context associated with it. */
{
c->extensionId = extensionId;
return c;
}
{
}
{
}
/* May only be called for a display in the display list. */
static ContextInfo LookupContext(
{
if (c != NULL) return c;
/* Create one */
c = AllocContextInfo(context);
return c;
}
static DisplayInfo AllocDisplayInfo(
{
register int i;
d->next = displayList;
displayList = d;
d->defaultContext = context;
for (i = 0; i < ScreenCount(display); i++) {
}
return d;
}
{
DisplayInfo d = displayList;
return d;
}
{
return d;
}
{
if (c == NULL) return dps_status_unregistered_context;
return dps_status_success;
}
unsigned long bit,
{
if (c == NULL) {
return dps_status_unregistered_context;
}
return dps_status_success;
}
int XDPSSetContextDepth(
int depth)
{
(XDPSStandardColormap *) NULL,
(XDPSStandardColormap *) NULL,
}
int height)
{
return dps_status_success;
}
int XDPSSetContextRGBMap(
{
}
{
}
{
int s = XScreenNumberOfScreen(screen);
register int i;
XGCValues v;
Pixmap p;
for (i = 0; i < d->depthsForScreen[s] &&
d->validDepths[s][i] != depth; i++) {}
if (i >= d->depthsForScreen[s]) return NULL;
if (d->gcForDepth[s][i] == 0) { /* Not "None" -- used calloc */
RootWindowOfScreen(screen), 0, &v);
} else {
p = XCreatePixmap(d->display,
XFreePixmap(d->display, p);
}
}
return d->gcForDepth[s][i];
}
int depth,
int height,
unsigned int flags)
{
DisplayInfo d;
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;
if (flags & XDPSContextScreenDepth) {
return dps_status_illegal_value;
}
}
if (flags & XDPSContextDrawable) {
doDrawable = True;
}
if (flags & XDPSContextRGBMap) {
(XStandardColormap *) NULL);
} else {
}
}
if (flags & XDPSContextGrayMap) {
return dps_status_illegal_value;
} else {
return dps_status_illegal_value;
}
}
}
return dps_status_success;
}
int depth,
int height,
unsigned int flags,
{
int status;
if (c == NULL) return dps_status_unregistered_context;
return status;
}
{
if (c == NULL) return dps_status_illegal_value;
return dps_status_success;
}
{
/* We want to keep 0 as an unassigned value */
return dps_status_success;
}
{
return dps_status_success;
}
{
return dps_status_success;
}
int XDPSSetContextGState(
{
return dps_status_success;
}
{
int status;
return status;
}
{
return dps_status_success;
}
{
ContextInfo c;
/* Get the display */
if (makeSharedContext) { /* Install as shared ctxt for this display */
} else { /* Just add to the context list */
}
if (!inited) {
}
}
{
ContextInfo c;
else {
c = AllocContextInfo(context);
d->defaultContext = context;
c->displayInfo = d;
(void) XDPSSetContextDepth(context,
DefaultScreen(display)));
}
}
else d->extensionPresent = ext_yes;
return context;
}
{
if (c == NULL) return;
}
free((char *) c);
}
{
if (c == NULL) return;
}
free((char *) c);
}
{
DisplayInfo d;
register int i, j;
d = *dp;
for (i = 0; i < ScreenCount(display); i++) {
#ifdef NO_XLISTDEPTHS
free((char *) d->validDepths[i]);
#else
XFree((char *) d->validDepths[i]);
#endif
for (j = 0; j < d->depthsForScreen[i]; j++) {
if (d->gcForDepth[i][j] != 0) {
}
}
}
free((char *) d->depthsForScreen);
free((char *) d->validDepths);
free((char *) d->gcForDepth);
free((char *) d);
}
{
if (c == NULL) return dps_status_unregistered_context;
/* Check if already in desired state */
if (enable) {
}
c->enableText = True;
return dps_status_success;
}
/* disabling, currently enabled */
DPSUnchainContext(c->text);
c->enableText = False;
return dps_status_success;
}
{
if (d->extensionPresent != ext_no_idea) {
return (d->extensionPresent == ext_yes);
}
/* Check if the extension is present by trying to initialize it */
d->extensionPresent = ext_no;
} else d->extensionPresent = ext_yes;
return (d->extensionPresent == ext_yes);
}
int PSDefineAsUserObj(void)
{
return DPSDefineAsUserObj(DPSGetCurrentContext());
}
void PSRedefineUserObj(int uo)
{
}
void PSUndefineUserObj(int uo)
{
}
{
int out = DPSNewUserObjectIndex();
/* We want to keep 0 as an unassigned value */
return out;
}
{
}
{
}
int PSReserveUserObjIndices(int number)
{
}
{
int out = DPSNewUserObjectIndex();
/* We want to keep 0 as an unassigned value */
number--;
while (number-- > 0) (void) DPSNewUserObjectIndex();
return out;
}
{
}
{
/* Nothing left any more */
}
#ifdef NO_XLISTDEPTHS
/* This function copyright 1989 Massachusetts Institute of Technology */
/*
* XListDepths - return info from connection setup
*/
int *XListDepths (
int scrnum,
int *countp)
{
int count;
int *depths;
register int i;
} else {
/* a screen must have a depth */
return NULL;
}
return depths;
}
#endif /* NO_XLISTDEPTHS */