2003-11-14 16:54:54 +01:00
|
|
|
/***********************************************************
|
|
|
|
|
|
|
|
Copyright 1987, 1998 The Open Group
|
|
|
|
|
|
|
|
Permission to use, copy, modify, distribute, and sell this software and its
|
|
|
|
documentation for any purpose is hereby granted without fee, provided that
|
|
|
|
the above copyright notice appear in all copies and that both that
|
|
|
|
copyright notice and this permission notice appear in supporting
|
|
|
|
documentation.
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
|
|
|
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
|
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
|
|
|
|
Except as contained in this notice, the name of The Open Group shall not be
|
|
|
|
used in advertising or otherwise to promote the sale, use or other dealings
|
|
|
|
in this Software without prior written authorization from The Open Group.
|
|
|
|
|
|
|
|
|
|
|
|
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
|
|
|
|
|
|
|
|
All Rights Reserved
|
|
|
|
|
|
|
|
Permission to use, copy, modify, and distribute this software and its
|
|
|
|
documentation for any purpose and without fee is hereby granted,
|
|
|
|
provided that the above copyright notice appear in all copies and that
|
|
|
|
both that copyright notice and this permission notice appear in
|
|
|
|
supporting documentation, and that the name of Digital not be
|
|
|
|
used in advertising or publicity pertaining to distribution of the
|
|
|
|
software without specific, written prior permission.
|
|
|
|
|
|
|
|
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
|
|
|
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
|
|
|
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
|
|
|
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
|
|
|
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
|
|
|
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
|
|
|
SOFTWARE.
|
|
|
|
|
|
|
|
******************************************************************/
|
|
|
|
|
|
|
|
|
2005-07-03 09:02:09 +02:00
|
|
|
#ifdef HAVE_DIX_CONFIG_H
|
|
|
|
#include <dix-config.h>
|
|
|
|
#endif
|
|
|
|
|
2005-04-20 14:25:48 +02:00
|
|
|
#include <X11/X.h>
|
|
|
|
#include <X11/Xmd.h>
|
|
|
|
#include <X11/Xproto.h>
|
2005-07-03 10:53:54 +02:00
|
|
|
#include "misc.h"
|
2003-11-14 16:54:54 +01:00
|
|
|
#include "resource.h"
|
|
|
|
#include "gcstruct.h"
|
|
|
|
#include "pixmapstr.h"
|
|
|
|
#include "dixfontstr.h"
|
|
|
|
#include "scrnintstr.h"
|
|
|
|
#include "region.h"
|
2010-05-17 19:23:44 +02:00
|
|
|
#include "dixstruct.h"
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2007-04-04 21:59:51 +02:00
|
|
|
#include "privates.h"
|
2003-11-14 16:54:54 +01:00
|
|
|
#include "dix.h"
|
2007-08-14 19:09:38 +02:00
|
|
|
#include "xace.h"
|
2003-11-14 16:54:54 +01:00
|
|
|
#include <assert.h>
|
|
|
|
|
2003-11-14 17:49:22 +01:00
|
|
|
extern FontPtr defaultFont;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2005-03-08 00:02:59 +01:00
|
|
|
static Bool CreateDefaultTile(GCPtr pGC);
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2007-03-25 18:27:01 +02:00
|
|
|
static unsigned char DefaultDash[2] = {4, 4};
|
2003-11-14 16:54:54 +01:00
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2005-03-08 00:02:59 +01:00
|
|
|
ValidateGC(DrawablePtr pDraw, GC *pGC)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
(*pGC->funcs->ValidateGC) (pGC, pGC->stateChanges, pDraw);
|
|
|
|
pGC->stateChanges = 0;
|
|
|
|
pGC->serialNumber = pDraw->serialNumber;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-05-08 04:38:05 +02:00
|
|
|
/*
|
|
|
|
* ChangeGC/ChangeGCXIDs:
|
|
|
|
*
|
|
|
|
* The client performing the gc change must be passed so that access
|
|
|
|
* checks can be performed on any tiles, stipples, or fonts that are
|
|
|
|
* specified. ddxen can call this too; they should normally pass
|
|
|
|
* NullClient for the client since any access checking should have
|
2003-11-14 16:54:54 +01:00
|
|
|
* already been done at a higher level.
|
|
|
|
*
|
2010-05-08 04:38:05 +02:00
|
|
|
* If you have any XIDs, you must use ChangeGCXIDs:
|
2003-11-14 16:54:54 +01:00
|
|
|
*
|
|
|
|
* CARD32 v[2];
|
2010-05-08 04:38:05 +02:00
|
|
|
* v[0] = FillTiled;
|
|
|
|
* v[1] = pid;
|
|
|
|
* ChangeGCXIDs(client, pGC, GCFillStyle|GCTile, v);
|
2003-11-14 16:54:54 +01:00
|
|
|
*
|
2010-05-08 04:38:05 +02:00
|
|
|
* However, if you need to pass a pointer to a pixmap or font, you must
|
|
|
|
* use ChangeGC:
|
2003-11-14 16:54:54 +01:00
|
|
|
*
|
|
|
|
* ChangeGCVal v[2];
|
|
|
|
* v[0].val = FillTiled;
|
2003-11-14 17:49:22 +01:00
|
|
|
* v[1].ptr = pPixmap;
|
2010-05-08 04:38:05 +02:00
|
|
|
* ChangeGC(client, pGC, GCFillStyle|GCTile, v);
|
2003-11-14 16:54:54 +01:00
|
|
|
*
|
2010-05-08 04:38:05 +02:00
|
|
|
* If you have neither XIDs nor pointers, you can use either function,
|
|
|
|
* but ChangeGC will do less work.
|
|
|
|
*
|
|
|
|
* ChangeGCVal v[2];
|
|
|
|
* v[0].val = foreground;
|
|
|
|
* v[1].val = background;
|
|
|
|
* ChangeGC(client, pGC, GCForeground|GCBackground, v);
|
2003-11-14 16:54:54 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#define NEXTVAL(_type, _var) { \
|
|
|
|
_var = (_type)(pUnion->val); pUnion++; \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define NEXT_PTR(_type, _var) { \
|
Pre-validate ChangeGC XIDs.
In order to execute a wire-level ChangeGC request, we need to look up
the resources named by any XIDs in the value-list. Various places in the
server already have pointers to the resources they want to set into the
GC, though, so over time the interface has evolved to accept either XIDs
or pointers, with several different function call signatures used in
different eras.
This patch makes the existing code require pointers to resources rather
than XIDs, and adds a simple wrapper that looks up any XIDs. The old
dixChangeGC API is preserved by delegating to whichever implementation
is appropriate.
This affects error-handling: If any of the XIDs are invalid, then the GC
is unchanged, and its ChangeGC callback is not invoked. This change is
allowed by the protocol spec, which says, "The order in which components
are verified and altered is server-dependent. If an error is generated,
a subset of the components may have been altered."
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2010-05-08 03:11:36 +02:00
|
|
|
_var = (_type)pUnion->ptr; pUnion++; }
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2010-05-08 04:38:05 +02:00
|
|
|
int
|
Pre-validate ChangeGC XIDs.
In order to execute a wire-level ChangeGC request, we need to look up
the resources named by any XIDs in the value-list. Various places in the
server already have pointers to the resources they want to set into the
GC, though, so over time the interface has evolved to accept either XIDs
or pointers, with several different function call signatures used in
different eras.
This patch makes the existing code require pointers to resources rather
than XIDs, and adds a simple wrapper that looks up any XIDs. The old
dixChangeGC API is preserved by delegating to whichever implementation
is appropriate.
This affects error-handling: If any of the XIDs are invalid, then the GC
is unchanged, and its ChangeGC callback is not invoked. This change is
allowed by the protocol spec, which says, "The order in which components
are verified and altered is server-dependent. If an error is generated,
a subset of the components may have been altered."
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2010-05-08 03:11:36 +02:00
|
|
|
ChangeGC(ClientPtr client, GC *pGC, BITS32 mask, ChangeGCValPtr pUnion)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-03-08 08:20:19 +01:00
|
|
|
BITS32 index2;
|
Pre-validate ChangeGC XIDs.
In order to execute a wire-level ChangeGC request, we need to look up
the resources named by any XIDs in the value-list. Various places in the
server already have pointers to the resources they want to set into the
GC, though, so over time the interface has evolved to accept either XIDs
or pointers, with several different function call signatures used in
different eras.
This patch makes the existing code require pointers to resources rather
than XIDs, and adds a simple wrapper that looks up any XIDs. The old
dixChangeGC API is preserved by delegating to whichever implementation
is appropriate.
This affects error-handling: If any of the XIDs are invalid, then the GC
is unchanged, and its ChangeGC callback is not invoked. This change is
allowed by the protocol spec, which says, "The order in which components
are verified and altered is server-dependent. If an error is generated,
a subset of the components may have been altered."
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2010-05-08 03:11:36 +02:00
|
|
|
int error = 0;
|
2007-03-08 08:20:19 +01:00
|
|
|
PixmapPtr pPixmap;
|
|
|
|
BITS32 maskQ;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
Pre-validate ChangeGC XIDs.
In order to execute a wire-level ChangeGC request, we need to look up
the resources named by any XIDs in the value-list. Various places in the
server already have pointers to the resources they want to set into the
GC, though, so over time the interface has evolved to accept either XIDs
or pointers, with several different function call signatures used in
different eras.
This patch makes the existing code require pointers to resources rather
than XIDs, and adds a simple wrapper that looks up any XIDs. The old
dixChangeGC API is preserved by delegating to whichever implementation
is appropriate.
This affects error-handling: If any of the XIDs are invalid, then the GC
is unchanged, and its ChangeGC callback is not invoked. This change is
allowed by the protocol spec, which says, "The order in which components
are verified and altered is server-dependent. If an error is generated,
a subset of the components may have been altered."
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2010-05-08 03:11:36 +02:00
|
|
|
assert(pUnion);
|
2003-11-14 16:54:54 +01:00
|
|
|
pGC->serialNumber |= GC_CHANGE_SERIAL_BIT;
|
|
|
|
|
|
|
|
maskQ = mask; /* save these for when we walk the GCque */
|
|
|
|
while (mask && !error)
|
|
|
|
{
|
2003-11-14 17:49:22 +01:00
|
|
|
index2 = (BITS32) lowbit (mask);
|
|
|
|
mask &= ~index2;
|
|
|
|
pGC->stateChanges |= index2;
|
|
|
|
switch (index2)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
case GCFunction:
|
|
|
|
{
|
|
|
|
CARD8 newalu;
|
|
|
|
NEXTVAL(CARD8, newalu);
|
|
|
|
if (newalu <= GXset)
|
|
|
|
pGC->alu = newalu;
|
|
|
|
else
|
|
|
|
{
|
2010-05-09 04:18:11 +02:00
|
|
|
if (client)
|
|
|
|
client->errorValue = newalu;
|
2003-11-14 16:54:54 +01:00
|
|
|
error = BadValue;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case GCPlaneMask:
|
|
|
|
NEXTVAL(unsigned long, pGC->planemask);
|
|
|
|
break;
|
|
|
|
case GCForeground:
|
|
|
|
NEXTVAL(unsigned long, pGC->fgPixel);
|
|
|
|
/*
|
|
|
|
* this is for CreateGC
|
|
|
|
*/
|
|
|
|
if (!pGC->tileIsPixel && !pGC->tile.pixmap)
|
|
|
|
{
|
|
|
|
pGC->tileIsPixel = TRUE;
|
|
|
|
pGC->tile.pixel = pGC->fgPixel;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GCBackground:
|
|
|
|
NEXTVAL(unsigned long, pGC->bgPixel);
|
|
|
|
break;
|
|
|
|
case GCLineWidth: /* ??? line width is a CARD16 */
|
|
|
|
NEXTVAL(CARD16, pGC->lineWidth);
|
|
|
|
break;
|
|
|
|
case GCLineStyle:
|
|
|
|
{
|
|
|
|
unsigned int newlinestyle;
|
|
|
|
NEXTVAL(unsigned int, newlinestyle);
|
|
|
|
if (newlinestyle <= LineDoubleDash)
|
|
|
|
pGC->lineStyle = newlinestyle;
|
|
|
|
else
|
|
|
|
{
|
2010-05-09 04:18:11 +02:00
|
|
|
if (client)
|
|
|
|
client->errorValue = newlinestyle;
|
2003-11-14 16:54:54 +01:00
|
|
|
error = BadValue;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case GCCapStyle:
|
|
|
|
{
|
|
|
|
unsigned int newcapstyle;
|
|
|
|
NEXTVAL(unsigned int, newcapstyle);
|
|
|
|
if (newcapstyle <= CapProjecting)
|
|
|
|
pGC->capStyle = newcapstyle;
|
|
|
|
else
|
|
|
|
{
|
2010-05-09 04:18:11 +02:00
|
|
|
if (client)
|
|
|
|
client->errorValue = newcapstyle;
|
2003-11-14 16:54:54 +01:00
|
|
|
error = BadValue;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case GCJoinStyle:
|
|
|
|
{
|
|
|
|
unsigned int newjoinstyle;
|
|
|
|
NEXTVAL(unsigned int, newjoinstyle);
|
|
|
|
if (newjoinstyle <= JoinBevel)
|
|
|
|
pGC->joinStyle = newjoinstyle;
|
|
|
|
else
|
|
|
|
{
|
2010-05-09 04:18:11 +02:00
|
|
|
if (client)
|
|
|
|
client->errorValue = newjoinstyle;
|
2003-11-14 16:54:54 +01:00
|
|
|
error = BadValue;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case GCFillStyle:
|
|
|
|
{
|
|
|
|
unsigned int newfillstyle;
|
|
|
|
NEXTVAL(unsigned int, newfillstyle);
|
|
|
|
if (newfillstyle <= FillOpaqueStippled)
|
|
|
|
pGC->fillStyle = newfillstyle;
|
|
|
|
else
|
|
|
|
{
|
2010-05-09 04:18:11 +02:00
|
|
|
if (client)
|
|
|
|
client->errorValue = newfillstyle;
|
2003-11-14 16:54:54 +01:00
|
|
|
error = BadValue;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case GCFillRule:
|
|
|
|
{
|
|
|
|
unsigned int newfillrule;
|
|
|
|
NEXTVAL(unsigned int, newfillrule);
|
|
|
|
if (newfillrule <= WindingRule)
|
|
|
|
pGC->fillRule = newfillrule;
|
|
|
|
else
|
|
|
|
{
|
2010-05-09 04:18:11 +02:00
|
|
|
if (client)
|
|
|
|
client->errorValue = newfillrule;
|
2003-11-14 16:54:54 +01:00
|
|
|
error = BadValue;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case GCTile:
|
Pre-validate ChangeGC XIDs.
In order to execute a wire-level ChangeGC request, we need to look up
the resources named by any XIDs in the value-list. Various places in the
server already have pointers to the resources they want to set into the
GC, though, so over time the interface has evolved to accept either XIDs
or pointers, with several different function call signatures used in
different eras.
This patch makes the existing code require pointers to resources rather
than XIDs, and adds a simple wrapper that looks up any XIDs. The old
dixChangeGC API is preserved by delegating to whichever implementation
is appropriate.
This affects error-handling: If any of the XIDs are invalid, then the GC
is unchanged, and its ChangeGC callback is not invoked. This change is
allowed by the protocol spec, which says, "The order in which components
are verified and altered is server-dependent. If an error is generated,
a subset of the components may have been altered."
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2010-05-08 03:11:36 +02:00
|
|
|
NEXT_PTR(PixmapPtr, pPixmap);
|
2010-05-08 05:00:40 +02:00
|
|
|
if ((pPixmap->drawable.depth != pGC->depth) ||
|
|
|
|
(pPixmap->drawable.pScreen != pGC->pScreen))
|
|
|
|
{
|
|
|
|
error = BadMatch;
|
|
|
|
}
|
2003-11-14 16:54:54 +01:00
|
|
|
else
|
|
|
|
{
|
2010-05-08 05:00:40 +02:00
|
|
|
pPixmap->refcnt++;
|
|
|
|
if (!pGC->tileIsPixel)
|
|
|
|
(* pGC->pScreen->DestroyPixmap)(pGC->tile.pixmap);
|
|
|
|
pGC->tileIsPixel = FALSE;
|
|
|
|
pGC->tile.pixmap = pPixmap;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GCStipple:
|
Pre-validate ChangeGC XIDs.
In order to execute a wire-level ChangeGC request, we need to look up
the resources named by any XIDs in the value-list. Various places in the
server already have pointers to the resources they want to set into the
GC, though, so over time the interface has evolved to accept either XIDs
or pointers, with several different function call signatures used in
different eras.
This patch makes the existing code require pointers to resources rather
than XIDs, and adds a simple wrapper that looks up any XIDs. The old
dixChangeGC API is preserved by delegating to whichever implementation
is appropriate.
This affects error-handling: If any of the XIDs are invalid, then the GC
is unchanged, and its ChangeGC callback is not invoked. This change is
allowed by the protocol spec, which says, "The order in which components
are verified and altered is server-dependent. If an error is generated,
a subset of the components may have been altered."
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2010-05-08 03:11:36 +02:00
|
|
|
NEXT_PTR(PixmapPtr, pPixmap);
|
2010-05-08 05:00:40 +02:00
|
|
|
if ((pPixmap->drawable.depth != 1) ||
|
|
|
|
(pPixmap->drawable.pScreen != pGC->pScreen))
|
|
|
|
{
|
|
|
|
error = BadMatch;
|
|
|
|
}
|
2003-11-14 16:54:54 +01:00
|
|
|
else
|
|
|
|
{
|
2010-05-08 05:00:40 +02:00
|
|
|
pPixmap->refcnt++;
|
|
|
|
if (pGC->stipple)
|
|
|
|
(* pGC->pScreen->DestroyPixmap)(pGC->stipple);
|
|
|
|
pGC->stipple = pPixmap;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GCTileStipXOrigin:
|
|
|
|
NEXTVAL(INT16, pGC->patOrg.x);
|
|
|
|
break;
|
|
|
|
case GCTileStipYOrigin:
|
|
|
|
NEXTVAL(INT16, pGC->patOrg.y);
|
|
|
|
break;
|
|
|
|
case GCFont:
|
|
|
|
{
|
|
|
|
FontPtr pFont;
|
Pre-validate ChangeGC XIDs.
In order to execute a wire-level ChangeGC request, we need to look up
the resources named by any XIDs in the value-list. Various places in the
server already have pointers to the resources they want to set into the
GC, though, so over time the interface has evolved to accept either XIDs
or pointers, with several different function call signatures used in
different eras.
This patch makes the existing code require pointers to resources rather
than XIDs, and adds a simple wrapper that looks up any XIDs. The old
dixChangeGC API is preserved by delegating to whichever implementation
is appropriate.
This affects error-handling: If any of the XIDs are invalid, then the GC
is unchanged, and its ChangeGC callback is not invoked. This change is
allowed by the protocol spec, which says, "The order in which components
are verified and altered is server-dependent. If an error is generated,
a subset of the components may have been altered."
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2010-05-08 03:11:36 +02:00
|
|
|
NEXT_PTR(FontPtr, pFont);
|
2010-05-08 05:00:40 +02:00
|
|
|
pFont->refcnt++;
|
|
|
|
if (pGC->font)
|
|
|
|
CloseFont(pGC->font, (Font)0);
|
|
|
|
pGC->font = pFont;
|
2003-11-14 16:54:54 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case GCSubwindowMode:
|
|
|
|
{
|
|
|
|
unsigned int newclipmode;
|
|
|
|
NEXTVAL(unsigned int, newclipmode);
|
|
|
|
if (newclipmode <= IncludeInferiors)
|
|
|
|
pGC->subWindowMode = newclipmode;
|
|
|
|
else
|
|
|
|
{
|
2010-05-09 04:18:11 +02:00
|
|
|
if (client)
|
|
|
|
client->errorValue = newclipmode;
|
2003-11-14 16:54:54 +01:00
|
|
|
error = BadValue;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case GCGraphicsExposures:
|
|
|
|
{
|
|
|
|
unsigned int newge;
|
|
|
|
NEXTVAL(unsigned int, newge);
|
|
|
|
if (newge <= xTrue)
|
|
|
|
pGC->graphicsExposures = newge;
|
|
|
|
else
|
|
|
|
{
|
2010-05-09 04:18:11 +02:00
|
|
|
if (client)
|
|
|
|
client->errorValue = newge;
|
2003-11-14 16:54:54 +01:00
|
|
|
error = BadValue;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case GCClipXOrigin:
|
|
|
|
NEXTVAL(INT16, pGC->clipOrg.x);
|
|
|
|
break;
|
|
|
|
case GCClipYOrigin:
|
|
|
|
NEXTVAL(INT16, pGC->clipOrg.y);
|
|
|
|
break;
|
|
|
|
case GCClipMask:
|
Pre-validate ChangeGC XIDs.
In order to execute a wire-level ChangeGC request, we need to look up
the resources named by any XIDs in the value-list. Various places in the
server already have pointers to the resources they want to set into the
GC, though, so over time the interface has evolved to accept either XIDs
or pointers, with several different function call signatures used in
different eras.
This patch makes the existing code require pointers to resources rather
than XIDs, and adds a simple wrapper that looks up any XIDs. The old
dixChangeGC API is preserved by delegating to whichever implementation
is appropriate.
This affects error-handling: If any of the XIDs are invalid, then the GC
is unchanged, and its ChangeGC callback is not invoked. This change is
allowed by the protocol spec, which says, "The order in which components
are verified and altered is server-dependent. If an error is generated,
a subset of the components may have been altered."
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2010-05-08 03:11:36 +02:00
|
|
|
NEXT_PTR(PixmapPtr, pPixmap);
|
2003-11-14 16:54:54 +01:00
|
|
|
if (pPixmap)
|
|
|
|
{
|
|
|
|
if ((pPixmap->drawable.depth != 1) ||
|
|
|
|
(pPixmap->drawable.pScreen != pGC->pScreen))
|
|
|
|
{
|
|
|
|
error = BadMatch;
|
2010-05-08 05:00:40 +02:00
|
|
|
break;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
2010-05-08 05:00:40 +02:00
|
|
|
pPixmap->refcnt++;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
2010-05-08 05:00:40 +02:00
|
|
|
(*pGC->funcs->ChangeClip)(pGC, pPixmap ? CT_PIXMAP : CT_NONE,
|
|
|
|
(pointer)pPixmap, 0);
|
2003-11-14 16:54:54 +01:00
|
|
|
break;
|
|
|
|
case GCDashOffset:
|
|
|
|
NEXTVAL(INT16, pGC->dashOffset);
|
|
|
|
break;
|
|
|
|
case GCDashList:
|
|
|
|
{
|
|
|
|
CARD8 newdash;
|
|
|
|
NEXTVAL(CARD8, newdash);
|
|
|
|
if (newdash == 4)
|
|
|
|
{
|
|
|
|
if (pGC->dash != DefaultDash)
|
|
|
|
{
|
2010-05-05 20:44:06 +02:00
|
|
|
free(pGC->dash);
|
2003-11-14 16:54:54 +01:00
|
|
|
pGC->numInDashList = 2;
|
|
|
|
pGC->dash = DefaultDash;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (newdash != 0)
|
|
|
|
{
|
|
|
|
unsigned char *dash;
|
|
|
|
|
2010-05-05 20:44:06 +02:00
|
|
|
dash = malloc(2 * sizeof(unsigned char));
|
2003-11-14 16:54:54 +01:00
|
|
|
if (dash)
|
|
|
|
{
|
|
|
|
if (pGC->dash != DefaultDash)
|
2010-05-05 20:44:06 +02:00
|
|
|
free(pGC->dash);
|
2003-11-14 16:54:54 +01:00
|
|
|
pGC->numInDashList = 2;
|
|
|
|
pGC->dash = dash;
|
|
|
|
dash[0] = newdash;
|
|
|
|
dash[1] = newdash;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
error = BadAlloc;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-05-09 04:18:11 +02:00
|
|
|
if (client)
|
|
|
|
client->errorValue = newdash;
|
2003-11-14 16:54:54 +01:00
|
|
|
error = BadValue;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case GCArcMode:
|
|
|
|
{
|
|
|
|
unsigned int newarcmode;
|
|
|
|
NEXTVAL(unsigned int, newarcmode);
|
|
|
|
if (newarcmode <= ArcPieSlice)
|
|
|
|
pGC->arcMode = newarcmode;
|
|
|
|
else
|
|
|
|
{
|
2010-05-09 04:18:11 +02:00
|
|
|
if (client)
|
|
|
|
client->errorValue = newarcmode;
|
2003-11-14 16:54:54 +01:00
|
|
|
error = BadValue;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
2010-05-09 04:18:11 +02:00
|
|
|
if (client)
|
|
|
|
client->errorValue = maskQ;
|
2003-11-14 16:54:54 +01:00
|
|
|
error = BadValue;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} /* end while mask && !error */
|
|
|
|
|
|
|
|
if (pGC->fillStyle == FillTiled && pGC->tileIsPixel)
|
|
|
|
{
|
|
|
|
if (!CreateDefaultTile (pGC))
|
|
|
|
{
|
|
|
|
pGC->fillStyle = FillSolid;
|
|
|
|
error = BadAlloc;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
(*pGC->funcs->ChangeGC)(pGC, maskQ);
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
#undef NEXTVAL
|
|
|
|
#undef NEXT_PTR
|
|
|
|
|
Pre-validate ChangeGC XIDs.
In order to execute a wire-level ChangeGC request, we need to look up
the resources named by any XIDs in the value-list. Various places in the
server already have pointers to the resources they want to set into the
GC, though, so over time the interface has evolved to accept either XIDs
or pointers, with several different function call signatures used in
different eras.
This patch makes the existing code require pointers to resources rather
than XIDs, and adds a simple wrapper that looks up any XIDs. The old
dixChangeGC API is preserved by delegating to whichever implementation
is appropriate.
This affects error-handling: If any of the XIDs are invalid, then the GC
is unchanged, and its ChangeGC callback is not invoked. This change is
allowed by the protocol spec, which says, "The order in which components
are verified and altered is server-dependent. If an error is generated,
a subset of the components may have been altered."
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2010-05-08 03:11:36 +02:00
|
|
|
static const struct {
|
|
|
|
BITS32 mask;
|
|
|
|
RESTYPE type;
|
|
|
|
Mask access_mode;
|
|
|
|
} xidfields[] = {
|
|
|
|
{ GCTile, RT_PIXMAP, DixReadAccess },
|
|
|
|
{ GCStipple, RT_PIXMAP, DixReadAccess },
|
|
|
|
{ GCFont, RT_FONT, DixUseAccess },
|
|
|
|
{ GCClipMask, RT_PIXMAP, DixReadAccess },
|
|
|
|
};
|
|
|
|
|
2010-05-08 04:38:05 +02:00
|
|
|
int
|
Pre-validate ChangeGC XIDs.
In order to execute a wire-level ChangeGC request, we need to look up
the resources named by any XIDs in the value-list. Various places in the
server already have pointers to the resources they want to set into the
GC, though, so over time the interface has evolved to accept either XIDs
or pointers, with several different function call signatures used in
different eras.
This patch makes the existing code require pointers to resources rather
than XIDs, and adds a simple wrapper that looks up any XIDs. The old
dixChangeGC API is preserved by delegating to whichever implementation
is appropriate.
This affects error-handling: If any of the XIDs are invalid, then the GC
is unchanged, and its ChangeGC callback is not invoked. This change is
allowed by the protocol spec, which says, "The order in which components
are verified and altered is server-dependent. If an error is generated,
a subset of the components may have been altered."
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2010-05-08 03:11:36 +02:00
|
|
|
ChangeGCXIDs(ClientPtr client, GC *pGC, BITS32 mask, CARD32 *pC32)
|
|
|
|
{
|
|
|
|
ChangeGCVal vals[GCLastBit + 1];
|
|
|
|
int i;
|
2010-05-09 04:08:47 +02:00
|
|
|
if (mask & ~GCAllBits)
|
Pre-validate ChangeGC XIDs.
In order to execute a wire-level ChangeGC request, we need to look up
the resources named by any XIDs in the value-list. Various places in the
server already have pointers to the resources they want to set into the
GC, though, so over time the interface has evolved to accept either XIDs
or pointers, with several different function call signatures used in
different eras.
This patch makes the existing code require pointers to resources rather
than XIDs, and adds a simple wrapper that looks up any XIDs. The old
dixChangeGC API is preserved by delegating to whichever implementation
is appropriate.
This affects error-handling: If any of the XIDs are invalid, then the GC
is unchanged, and its ChangeGC callback is not invoked. This change is
allowed by the protocol spec, which says, "The order in which components
are verified and altered is server-dependent. If an error is generated,
a subset of the components may have been altered."
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2010-05-08 03:11:36 +02:00
|
|
|
{
|
2010-05-09 04:18:11 +02:00
|
|
|
client->errorValue = mask;
|
Pre-validate ChangeGC XIDs.
In order to execute a wire-level ChangeGC request, we need to look up
the resources named by any XIDs in the value-list. Various places in the
server already have pointers to the resources they want to set into the
GC, though, so over time the interface has evolved to accept either XIDs
or pointers, with several different function call signatures used in
different eras.
This patch makes the existing code require pointers to resources rather
than XIDs, and adds a simple wrapper that looks up any XIDs. The old
dixChangeGC API is preserved by delegating to whichever implementation
is appropriate.
This affects error-handling: If any of the XIDs are invalid, then the GC
is unchanged, and its ChangeGC callback is not invoked. This change is
allowed by the protocol spec, which says, "The order in which components
are verified and altered is server-dependent. If an error is generated,
a subset of the components may have been altered."
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2010-05-08 03:11:36 +02:00
|
|
|
return BadValue;
|
|
|
|
}
|
2010-05-14 09:18:14 +02:00
|
|
|
for (i = Ones(mask); i--; )
|
Pre-validate ChangeGC XIDs.
In order to execute a wire-level ChangeGC request, we need to look up
the resources named by any XIDs in the value-list. Various places in the
server already have pointers to the resources they want to set into the
GC, though, so over time the interface has evolved to accept either XIDs
or pointers, with several different function call signatures used in
different eras.
This patch makes the existing code require pointers to resources rather
than XIDs, and adds a simple wrapper that looks up any XIDs. The old
dixChangeGC API is preserved by delegating to whichever implementation
is appropriate.
This affects error-handling: If any of the XIDs are invalid, then the GC
is unchanged, and its ChangeGC callback is not invoked. This change is
allowed by the protocol spec, which says, "The order in which components
are verified and altered is server-dependent. If an error is generated,
a subset of the components may have been altered."
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2010-05-08 03:11:36 +02:00
|
|
|
vals[i].val = pC32[i];
|
|
|
|
for (i = 0; i < sizeof(xidfields) / sizeof(*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)
|
|
|
|
{
|
2010-05-09 04:18:11 +02:00
|
|
|
client->errorValue = vals[offset].val;
|
Pre-validate ChangeGC XIDs.
In order to execute a wire-level ChangeGC request, we need to look up
the resources named by any XIDs in the value-list. Various places in the
server already have pointers to the resources they want to set into the
GC, though, so over time the interface has evolved to accept either XIDs
or pointers, with several different function call signatures used in
different eras.
This patch makes the existing code require pointers to resources rather
than XIDs, and adds a simple wrapper that looks up any XIDs. The old
dixChangeGC API is preserved by delegating to whichever implementation
is appropriate.
This affects error-handling: If any of the XIDs are invalid, then the GC
is unchanged, and its ChangeGC callback is not invoked. This change is
allowed by the protocol spec, which says, "The order in which components
are verified and altered is server-dependent. If an error is generated,
a subset of the components may have been altered."
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2010-05-08 03:11:36 +02:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ChangeGC(client, pGC, mask, vals);
|
|
|
|
}
|
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
/* CreateGC(pDrawable, mask, pval, pStatus)
|
|
|
|
creates a default GC for the given drawable, using mask to fill
|
|
|
|
in any non-default values.
|
|
|
|
Returns a pointer to the new GC on success, NULL otherwise.
|
|
|
|
returns status of non-default fields in pStatus
|
|
|
|
BUG:
|
|
|
|
should check for failure to create default tile
|
|
|
|
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
GCPtr
|
2007-08-14 19:09:38 +02:00
|
|
|
CreateGC(DrawablePtr pDrawable, BITS32 mask, XID *pval, int *pStatus,
|
|
|
|
XID gcid, ClientPtr client)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-03-08 08:20:19 +01:00
|
|
|
GCPtr pGC;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2010-04-27 02:22:21 +02:00
|
|
|
pGC = dixAllocateObjectWithPrivates(GC, PRIVATE_GC);
|
2003-11-14 16:54:54 +01:00
|
|
|
if (!pGC)
|
|
|
|
{
|
|
|
|
*pStatus = BadAlloc;
|
|
|
|
return (GCPtr)NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
pGC->pScreen = pDrawable->pScreen;
|
|
|
|
pGC->depth = pDrawable->depth;
|
|
|
|
pGC->alu = GXcopy; /* dst <- src */
|
|
|
|
pGC->planemask = ~0;
|
|
|
|
pGC->serialNumber = GC_CHANGE_SERIAL_BIT;
|
|
|
|
pGC->funcs = 0;
|
|
|
|
pGC->fgPixel = 0;
|
|
|
|
pGC->bgPixel = 1;
|
|
|
|
pGC->lineWidth = 0;
|
|
|
|
pGC->lineStyle = LineSolid;
|
|
|
|
pGC->capStyle = CapButt;
|
|
|
|
pGC->joinStyle = JoinMiter;
|
|
|
|
pGC->fillStyle = FillSolid;
|
|
|
|
pGC->fillRule = EvenOddRule;
|
|
|
|
pGC->arcMode = ArcPieSlice;
|
2009-02-08 18:59:17 +01:00
|
|
|
pGC->tile.pixel = 0;
|
|
|
|
pGC->tile.pixmap = NullPixmap;
|
2003-11-14 16:54:54 +01:00
|
|
|
if (mask & GCForeground)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* magic special case -- ChangeGC checks for this condition
|
|
|
|
* and snags the Foreground value to create a pseudo default-tile
|
|
|
|
*/
|
|
|
|
pGC->tileIsPixel = FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pGC->tileIsPixel = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
pGC->patOrg.x = 0;
|
|
|
|
pGC->patOrg.y = 0;
|
|
|
|
pGC->subWindowMode = ClipByChildren;
|
|
|
|
pGC->graphicsExposures = TRUE;
|
|
|
|
pGC->clipOrg.x = 0;
|
|
|
|
pGC->clipOrg.y = 0;
|
|
|
|
pGC->clientClipType = CT_NONE;
|
|
|
|
pGC->clientClip = (pointer)NULL;
|
|
|
|
pGC->numInDashList = 2;
|
|
|
|
pGC->dash = DefaultDash;
|
|
|
|
pGC->dashOffset = 0;
|
|
|
|
|
|
|
|
/* use the default font and stipple */
|
|
|
|
pGC->font = defaultFont;
|
|
|
|
defaultFont->refcnt++;
|
|
|
|
pGC->stipple = pGC->pScreen->PixmapPerDepth[0];
|
|
|
|
pGC->stipple->refcnt++;
|
|
|
|
|
2010-05-20 19:46:43 +02:00
|
|
|
/* this is not a scratch GC */
|
|
|
|
pGC->scratch_inuse = FALSE;
|
|
|
|
|
2007-08-14 19:09:38 +02:00
|
|
|
/* security creation/labeling check */
|
2007-09-05 17:18:36 +02:00
|
|
|
*pStatus = XaceHook(XACE_RESOURCE_ACCESS, client, gcid, RT_GC, pGC,
|
|
|
|
RT_NONE, NULL, DixCreateAccess|DixSetAttrAccess);
|
2007-08-14 19:09:38 +02:00
|
|
|
if (*pStatus != Success)
|
|
|
|
goto out;
|
|
|
|
|
2010-05-09 04:08:47 +02:00
|
|
|
pGC->stateChanges = GCAllBits;
|
2003-11-14 16:54:54 +01:00
|
|
|
if (!(*pGC->pScreen->CreateGC)(pGC))
|
|
|
|
*pStatus = BadAlloc;
|
|
|
|
else if (mask)
|
2010-05-08 04:38:05 +02:00
|
|
|
*pStatus = ChangeGCXIDs(client, pGC, mask, pval);
|
2003-11-14 16:54:54 +01:00
|
|
|
else
|
|
|
|
*pStatus = Success;
|
2007-08-14 19:09:38 +02:00
|
|
|
|
|
|
|
out:
|
2003-11-14 16:54:54 +01:00
|
|
|
if (*pStatus != Success)
|
|
|
|
{
|
|
|
|
if (!pGC->tileIsPixel && !pGC->tile.pixmap)
|
|
|
|
pGC->tileIsPixel = TRUE; /* undo special case */
|
|
|
|
FreeGC(pGC, (XID)0);
|
|
|
|
pGC = (GCPtr)NULL;
|
|
|
|
}
|
|
|
|
|
2010-06-06 16:18:40 +02:00
|
|
|
return pGC;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static Bool
|
2005-03-08 00:02:59 +01:00
|
|
|
CreateDefaultTile (GCPtr pGC)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2010-05-08 23:10:51 +02:00
|
|
|
ChangeGCVal tmpval[3];
|
2003-11-14 16:54:54 +01:00
|
|
|
PixmapPtr pTile;
|
|
|
|
GCPtr pgcScratch;
|
|
|
|
xRectangle rect;
|
|
|
|
CARD16 w, h;
|
|
|
|
|
|
|
|
w = 1;
|
|
|
|
h = 1;
|
|
|
|
(*pGC->pScreen->QueryBestSize)(TileShape, &w, &h, pGC->pScreen);
|
|
|
|
pTile = (PixmapPtr)
|
|
|
|
(*pGC->pScreen->CreatePixmap)(pGC->pScreen,
|
2007-10-31 22:15:35 +01:00
|
|
|
w, h, pGC->depth, 0);
|
2003-11-14 16:54:54 +01:00
|
|
|
pgcScratch = GetScratchGC(pGC->depth, pGC->pScreen);
|
|
|
|
if (!pTile || !pgcScratch)
|
|
|
|
{
|
|
|
|
if (pTile)
|
|
|
|
(*pTile->drawable.pScreen->DestroyPixmap)(pTile);
|
|
|
|
if (pgcScratch)
|
|
|
|
FreeScratchGC(pgcScratch);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2010-05-08 23:10:51 +02:00
|
|
|
tmpval[0].val = GXcopy;
|
|
|
|
tmpval[1].val = pGC->tile.pixel;
|
|
|
|
tmpval[2].val = FillSolid;
|
2010-05-08 04:38:05 +02:00
|
|
|
(void)ChangeGC(NullClient, pgcScratch, GCFunction | GCForeground | GCFillStyle, tmpval);
|
2003-11-14 16:54:54 +01:00
|
|
|
ValidateGC((DrawablePtr)pTile, pgcScratch);
|
|
|
|
rect.x = 0;
|
|
|
|
rect.y = 0;
|
|
|
|
rect.width = w;
|
|
|
|
rect.height = h;
|
|
|
|
(*pgcScratch->ops->PolyFillRect)((DrawablePtr)pTile, pgcScratch, 1, &rect);
|
|
|
|
/* Always remember to free the scratch graphics context after use. */
|
|
|
|
FreeScratchGC(pgcScratch);
|
|
|
|
|
|
|
|
pGC->tileIsPixel = FALSE;
|
|
|
|
pGC->tile.pixmap = pTile;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2007-03-08 08:20:19 +01:00
|
|
|
CopyGC(GC *pgcSrc, GC *pgcDst, BITS32 mask)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-03-08 08:20:19 +01:00
|
|
|
BITS32 index2;
|
|
|
|
BITS32 maskQ;
|
|
|
|
int error = 0;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
if (pgcSrc == pgcDst)
|
|
|
|
return Success;
|
|
|
|
pgcDst->serialNumber |= GC_CHANGE_SERIAL_BIT;
|
|
|
|
pgcDst->stateChanges |= mask;
|
|
|
|
maskQ = mask;
|
|
|
|
while (mask)
|
|
|
|
{
|
2003-11-14 17:49:22 +01:00
|
|
|
index2 = (BITS32) lowbit (mask);
|
|
|
|
mask &= ~index2;
|
|
|
|
switch (index2)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
case GCFunction:
|
|
|
|
pgcDst->alu = pgcSrc->alu;
|
|
|
|
break;
|
|
|
|
case GCPlaneMask:
|
|
|
|
pgcDst->planemask = pgcSrc->planemask;
|
|
|
|
break;
|
|
|
|
case GCForeground:
|
|
|
|
pgcDst->fgPixel = pgcSrc->fgPixel;
|
|
|
|
break;
|
|
|
|
case GCBackground:
|
|
|
|
pgcDst->bgPixel = pgcSrc->bgPixel;
|
|
|
|
break;
|
|
|
|
case GCLineWidth:
|
|
|
|
pgcDst->lineWidth = pgcSrc->lineWidth;
|
|
|
|
break;
|
|
|
|
case GCLineStyle:
|
|
|
|
pgcDst->lineStyle = pgcSrc->lineStyle;
|
|
|
|
break;
|
|
|
|
case GCCapStyle:
|
|
|
|
pgcDst->capStyle = pgcSrc->capStyle;
|
|
|
|
break;
|
|
|
|
case GCJoinStyle:
|
|
|
|
pgcDst->joinStyle = pgcSrc->joinStyle;
|
|
|
|
break;
|
|
|
|
case GCFillStyle:
|
|
|
|
pgcDst->fillStyle = pgcSrc->fillStyle;
|
|
|
|
break;
|
|
|
|
case GCFillRule:
|
|
|
|
pgcDst->fillRule = pgcSrc->fillRule;
|
|
|
|
break;
|
|
|
|
case GCTile:
|
|
|
|
{
|
|
|
|
if (EqualPixUnion(pgcDst->tileIsPixel,
|
|
|
|
pgcDst->tile,
|
|
|
|
pgcSrc->tileIsPixel,
|
|
|
|
pgcSrc->tile))
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (!pgcDst->tileIsPixel)
|
|
|
|
(* pgcDst->pScreen->DestroyPixmap)(pgcDst->tile.pixmap);
|
|
|
|
pgcDst->tileIsPixel = pgcSrc->tileIsPixel;
|
|
|
|
pgcDst->tile = pgcSrc->tile;
|
|
|
|
if (!pgcDst->tileIsPixel)
|
|
|
|
pgcDst->tile.pixmap->refcnt++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case GCStipple:
|
|
|
|
{
|
|
|
|
if (pgcDst->stipple == pgcSrc->stipple)
|
|
|
|
break;
|
|
|
|
if (pgcDst->stipple)
|
|
|
|
(* pgcDst->pScreen->DestroyPixmap)(pgcDst->stipple);
|
|
|
|
pgcDst->stipple = pgcSrc->stipple;
|
|
|
|
if (pgcDst->stipple)
|
|
|
|
pgcDst->stipple->refcnt ++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case GCTileStipXOrigin:
|
|
|
|
pgcDst->patOrg.x = pgcSrc->patOrg.x;
|
|
|
|
break;
|
|
|
|
case GCTileStipYOrigin:
|
|
|
|
pgcDst->patOrg.y = pgcSrc->patOrg.y;
|
|
|
|
break;
|
|
|
|
case GCFont:
|
|
|
|
if (pgcDst->font == pgcSrc->font)
|
|
|
|
break;
|
|
|
|
if (pgcDst->font)
|
|
|
|
CloseFont(pgcDst->font, (Font)0);
|
|
|
|
if ((pgcDst->font = pgcSrc->font) != NullFont)
|
|
|
|
(pgcDst->font)->refcnt++;
|
|
|
|
break;
|
|
|
|
case GCSubwindowMode:
|
|
|
|
pgcDst->subWindowMode = pgcSrc->subWindowMode;
|
|
|
|
break;
|
|
|
|
case GCGraphicsExposures:
|
|
|
|
pgcDst->graphicsExposures = pgcSrc->graphicsExposures;
|
|
|
|
break;
|
|
|
|
case GCClipXOrigin:
|
|
|
|
pgcDst->clipOrg.x = pgcSrc->clipOrg.x;
|
|
|
|
break;
|
|
|
|
case GCClipYOrigin:
|
|
|
|
pgcDst->clipOrg.y = pgcSrc->clipOrg.y;
|
|
|
|
break;
|
|
|
|
case GCClipMask:
|
|
|
|
(* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc);
|
|
|
|
break;
|
|
|
|
case GCDashOffset:
|
|
|
|
pgcDst->dashOffset = pgcSrc->dashOffset;
|
|
|
|
break;
|
|
|
|
case GCDashList:
|
|
|
|
if (pgcSrc->dash == DefaultDash)
|
|
|
|
{
|
|
|
|
if (pgcDst->dash != DefaultDash)
|
|
|
|
{
|
2010-05-05 20:44:06 +02:00
|
|
|
free(pgcDst->dash);
|
2003-11-14 16:54:54 +01:00
|
|
|
pgcDst->numInDashList = pgcSrc->numInDashList;
|
|
|
|
pgcDst->dash = pgcSrc->dash;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
unsigned char *dash;
|
|
|
|
unsigned int i;
|
|
|
|
|
2010-05-05 20:44:06 +02:00
|
|
|
dash = malloc(pgcSrc->numInDashList * sizeof(unsigned char));
|
2003-11-14 16:54:54 +01:00
|
|
|
if (dash)
|
|
|
|
{
|
|
|
|
if (pgcDst->dash != DefaultDash)
|
2010-05-05 20:44:06 +02:00
|
|
|
free(pgcDst->dash);
|
2003-11-14 16:54:54 +01:00
|
|
|
pgcDst->numInDashList = pgcSrc->numInDashList;
|
|
|
|
pgcDst->dash = dash;
|
|
|
|
for (i=0; i<pgcSrc->numInDashList; i++)
|
|
|
|
dash[i] = pgcSrc->dash[i];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
error = BadAlloc;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GCArcMode:
|
|
|
|
pgcDst->arcMode = pgcSrc->arcMode;
|
|
|
|
break;
|
|
|
|
default:
|
2010-05-09 04:18:11 +02:00
|
|
|
FatalError ("CopyGC: Unhandled mask!\n");
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (pgcDst->fillStyle == FillTiled && pgcDst->tileIsPixel)
|
|
|
|
{
|
|
|
|
if (!CreateDefaultTile (pgcDst))
|
|
|
|
{
|
|
|
|
pgcDst->fillStyle = FillSolid;
|
|
|
|
error = BadAlloc;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
(*pgcDst->funcs->CopyGC) (pgcSrc, maskQ, pgcDst);
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
2005-03-08 00:02:59 +01:00
|
|
|
/**
|
|
|
|
* does the diX part of freeing the characteristics in the GC.
|
|
|
|
*
|
|
|
|
* \param value must conform to DeleteType
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2005-03-08 00:02:59 +01:00
|
|
|
FreeGC(pointer value, XID gid)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
GCPtr pGC = (GCPtr)value;
|
|
|
|
|
|
|
|
CloseFont(pGC->font, (Font)0);
|
|
|
|
(* pGC->funcs->DestroyClip)(pGC);
|
|
|
|
|
|
|
|
if (!pGC->tileIsPixel)
|
|
|
|
(* pGC->pScreen->DestroyPixmap)(pGC->tile.pixmap);
|
|
|
|
if (pGC->stipple)
|
|
|
|
(* pGC->pScreen->DestroyPixmap)(pGC->stipple);
|
|
|
|
|
|
|
|
(*pGC->funcs->DestroyGC) (pGC);
|
|
|
|
if (pGC->dash != DefaultDash)
|
2010-05-05 20:44:06 +02:00
|
|
|
free(pGC->dash);
|
2010-04-27 02:22:21 +02:00
|
|
|
dixFreeObjectWithPrivates(pGC, PRIVATE_GC);
|
2010-06-06 16:18:40 +02:00
|
|
|
return Success;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* CreateScratchGC(pScreen, depth)
|
|
|
|
like CreateGC, but doesn't do the default tile or stipple,
|
|
|
|
since we can't create them without already having a GC. any code
|
|
|
|
using the tile or stipple has to set them explicitly anyway,
|
|
|
|
since the state of the scratch gc is unknown. This is OK
|
|
|
|
because ChangeGC() has to be able to deal with NULL tiles and
|
|
|
|
stipples anyway (in case the CreateGC() call has provided a
|
|
|
|
value for them -- we can't set the default tile until the
|
|
|
|
client-supplied attributes are installed, since the fgPixel
|
|
|
|
is what fills the default tile. (maybe this comment should
|
|
|
|
go with CreateGC() or ChangeGC().)
|
|
|
|
*/
|
|
|
|
|
2010-05-19 23:16:20 +02:00
|
|
|
static GCPtr
|
2005-03-08 00:02:59 +01:00
|
|
|
CreateScratchGC(ScreenPtr pScreen, unsigned depth)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-03-08 08:20:19 +01:00
|
|
|
GCPtr pGC;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2010-04-27 02:22:21 +02:00
|
|
|
pGC = dixAllocateObjectWithPrivates(GC, PRIVATE_GC);
|
2003-11-14 16:54:54 +01:00
|
|
|
if (!pGC)
|
|
|
|
return (GCPtr)NULL;
|
|
|
|
|
|
|
|
pGC->pScreen = pScreen;
|
|
|
|
pGC->depth = depth;
|
|
|
|
pGC->alu = GXcopy; /* dst <- src */
|
|
|
|
pGC->planemask = ~0;
|
|
|
|
pGC->serialNumber = 0;
|
|
|
|
pGC->fgPixel = 0;
|
|
|
|
pGC->bgPixel = 1;
|
|
|
|
pGC->lineWidth = 0;
|
|
|
|
pGC->lineStyle = LineSolid;
|
|
|
|
pGC->capStyle = CapButt;
|
|
|
|
pGC->joinStyle = JoinMiter;
|
|
|
|
pGC->fillStyle = FillSolid;
|
|
|
|
pGC->fillRule = EvenOddRule;
|
|
|
|
pGC->arcMode = ArcPieSlice;
|
|
|
|
pGC->font = defaultFont;
|
|
|
|
if ( pGC->font) /* necessary, because open of default font could fail */
|
|
|
|
pGC->font->refcnt++;
|
|
|
|
pGC->tileIsPixel = TRUE;
|
|
|
|
pGC->tile.pixel = 0;
|
2009-02-08 18:59:17 +01:00
|
|
|
pGC->tile.pixmap = NullPixmap;
|
2003-11-14 16:54:54 +01:00
|
|
|
pGC->stipple = NullPixmap;
|
|
|
|
pGC->patOrg.x = 0;
|
|
|
|
pGC->patOrg.y = 0;
|
|
|
|
pGC->subWindowMode = ClipByChildren;
|
|
|
|
pGC->graphicsExposures = TRUE;
|
|
|
|
pGC->clipOrg.x = 0;
|
|
|
|
pGC->clipOrg.y = 0;
|
|
|
|
pGC->clientClipType = CT_NONE;
|
|
|
|
pGC->dashOffset = 0;
|
|
|
|
pGC->numInDashList = 2;
|
|
|
|
pGC->dash = DefaultDash;
|
|
|
|
|
2010-05-20 19:46:43 +02:00
|
|
|
/* scratch GCs in the GCperDepth pool start off unused */
|
|
|
|
pGC->scratch_inuse = FALSE;
|
|
|
|
|
2010-05-09 04:08:47 +02:00
|
|
|
pGC->stateChanges = GCAllBits;
|
2003-11-14 16:54:54 +01:00
|
|
|
if (!(*pScreen->CreateGC)(pGC))
|
|
|
|
{
|
|
|
|
FreeGC(pGC, (XID)0);
|
|
|
|
pGC = (GCPtr)NULL;
|
|
|
|
}
|
|
|
|
return pGC;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2005-03-08 00:02:59 +01:00
|
|
|
FreeGCperDepth(int screenNum)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-03-08 08:20:19 +01:00
|
|
|
int i;
|
|
|
|
ScreenPtr pScreen;
|
2003-11-14 16:54:54 +01:00
|
|
|
GCPtr *ppGC;
|
|
|
|
|
|
|
|
pScreen = screenInfo.screens[screenNum];
|
|
|
|
ppGC = pScreen->GCperDepth;
|
|
|
|
|
|
|
|
for (i = 0; i <= pScreen->numDepths; i++)
|
2010-05-20 19:46:43 +02:00
|
|
|
{
|
2003-11-14 16:54:54 +01:00
|
|
|
(void)FreeGC(ppGC[i], (XID)0);
|
2010-05-20 19:46:43 +02:00
|
|
|
ppGC[i] = NULL;
|
|
|
|
}
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
Bool
|
2005-03-08 00:02:59 +01:00
|
|
|
CreateGCperDepth(int screenNum)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-03-08 08:20:19 +01:00
|
|
|
int i;
|
|
|
|
ScreenPtr pScreen;
|
2003-11-14 16:54:54 +01:00
|
|
|
DepthPtr pDepth;
|
|
|
|
GCPtr *ppGC;
|
|
|
|
|
|
|
|
pScreen = screenInfo.screens[screenNum];
|
|
|
|
ppGC = pScreen->GCperDepth;
|
|
|
|
/* do depth 1 separately because it's not included in list */
|
|
|
|
if (!(ppGC[0] = CreateScratchGC(pScreen, 1)))
|
|
|
|
return FALSE;
|
|
|
|
ppGC[0]->graphicsExposures = FALSE;
|
2005-07-23 19:49:45 +02:00
|
|
|
/* Make sure we don't overflow GCperDepth[] */
|
|
|
|
if( pScreen->numDepths > MAXFORMATS )
|
|
|
|
return FALSE;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
pDepth = pScreen->allowedDepths;
|
|
|
|
for (i=0; i<pScreen->numDepths; i++, pDepth++)
|
|
|
|
{
|
|
|
|
if (!(ppGC[i+1] = CreateScratchGC(pScreen, pDepth->depth)))
|
|
|
|
{
|
|
|
|
for (; i >= 0; i--)
|
|
|
|
(void)FreeGC(ppGC[i], (XID)0);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
ppGC[i+1]->graphicsExposures = FALSE;
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
Bool
|
2005-03-08 00:02:59 +01:00
|
|
|
CreateDefaultStipple(int screenNum)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-03-08 08:20:19 +01:00
|
|
|
ScreenPtr pScreen;
|
2010-05-08 23:10:51 +02:00
|
|
|
ChangeGCVal tmpval[3];
|
2003-11-14 16:54:54 +01:00
|
|
|
xRectangle rect;
|
|
|
|
CARD16 w, h;
|
|
|
|
GCPtr pgcScratch;
|
|
|
|
|
|
|
|
pScreen = screenInfo.screens[screenNum];
|
|
|
|
|
|
|
|
w = 16;
|
|
|
|
h = 16;
|
|
|
|
(* pScreen->QueryBestSize)(StippleShape, &w, &h, pScreen);
|
|
|
|
if (!(pScreen->PixmapPerDepth[0] =
|
2007-10-31 22:15:35 +01:00
|
|
|
(*pScreen->CreatePixmap)(pScreen, w, h, 1, 0)))
|
2003-11-14 16:54:54 +01:00
|
|
|
return FALSE;
|
|
|
|
/* fill stipple with 1 */
|
2010-05-08 23:10:51 +02:00
|
|
|
tmpval[0].val = GXcopy;
|
|
|
|
tmpval[1].val = 1;
|
|
|
|
tmpval[2].val = FillSolid;
|
2003-11-14 16:54:54 +01:00
|
|
|
pgcScratch = GetScratchGC(1, pScreen);
|
|
|
|
if (!pgcScratch)
|
|
|
|
{
|
|
|
|
(*pScreen->DestroyPixmap)(pScreen->PixmapPerDepth[0]);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2010-05-08 04:38:05 +02:00
|
|
|
(void)ChangeGC(NullClient, pgcScratch, GCFunction|GCForeground|GCFillStyle, tmpval);
|
2003-11-14 16:54:54 +01:00
|
|
|
ValidateGC((DrawablePtr)pScreen->PixmapPerDepth[0], pgcScratch);
|
|
|
|
rect.x = 0;
|
|
|
|
rect.y = 0;
|
|
|
|
rect.width = w;
|
|
|
|
rect.height = h;
|
|
|
|
(*pgcScratch->ops->PolyFillRect)((DrawablePtr)pScreen->PixmapPerDepth[0],
|
|
|
|
pgcScratch, 1, &rect);
|
|
|
|
FreeScratchGC(pgcScratch);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2005-03-08 00:02:59 +01:00
|
|
|
FreeDefaultStipple(int screenNum)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
ScreenPtr pScreen = screenInfo.screens[screenNum];
|
|
|
|
(*pScreen->DestroyPixmap)(pScreen->PixmapPerDepth[0]);
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2007-03-08 08:20:19 +01:00
|
|
|
SetDashes(GCPtr pGC, unsigned offset, unsigned ndash, unsigned char *pdash)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-03-08 08:20:19 +01:00
|
|
|
long i;
|
|
|
|
unsigned char *p, *indash;
|
2003-11-14 16:54:54 +01:00
|
|
|
BITS32 maskQ = 0;
|
|
|
|
|
|
|
|
i = ndash;
|
|
|
|
p = pdash;
|
|
|
|
while (i--)
|
|
|
|
{
|
|
|
|
if (!*p++)
|
|
|
|
{
|
|
|
|
/* dash segment must be > 0 */
|
|
|
|
return BadValue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ndash & 1)
|
2010-05-05 20:44:06 +02:00
|
|
|
p = malloc(2 * ndash * sizeof(unsigned char));
|
2003-11-14 16:54:54 +01:00
|
|
|
else
|
2010-05-05 20:44:06 +02:00
|
|
|
p = malloc(ndash * sizeof(unsigned char));
|
2003-11-14 16:54:54 +01:00
|
|
|
if (!p)
|
|
|
|
return BadAlloc;
|
|
|
|
|
|
|
|
pGC->serialNumber |= GC_CHANGE_SERIAL_BIT;
|
|
|
|
if (offset != pGC->dashOffset)
|
|
|
|
{
|
|
|
|
pGC->dashOffset = offset;
|
|
|
|
pGC->stateChanges |= GCDashOffset;
|
|
|
|
maskQ |= GCDashOffset;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pGC->dash != DefaultDash)
|
2010-05-05 20:44:06 +02:00
|
|
|
free(pGC->dash);
|
2003-11-14 16:54:54 +01:00
|
|
|
pGC->numInDashList = ndash;
|
|
|
|
pGC->dash = p;
|
|
|
|
if (ndash & 1)
|
|
|
|
{
|
|
|
|
pGC->numInDashList += ndash;
|
|
|
|
indash = pdash;
|
|
|
|
i = ndash;
|
|
|
|
while (i--)
|
|
|
|
*p++ = *indash++;
|
|
|
|
}
|
|
|
|
while(ndash--)
|
|
|
|
*p++ = *pdash++;
|
|
|
|
pGC->stateChanges |= GCDashList;
|
|
|
|
maskQ |= GCDashList;
|
|
|
|
|
|
|
|
if (pGC->funcs->ChangeGC)
|
|
|
|
(*pGC->funcs->ChangeGC) (pGC, maskQ);
|
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2005-03-08 00:02:59 +01:00
|
|
|
VerifyRectOrder(int nrects, xRectangle *prects, int ordering)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-03-08 08:20:19 +01:00
|
|
|
xRectangle *prectP, *prectN;
|
|
|
|
int i;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
switch(ordering)
|
|
|
|
{
|
|
|
|
case Unsorted:
|
|
|
|
return CT_UNSORTED;
|
|
|
|
case YSorted:
|
|
|
|
if(nrects > 1)
|
|
|
|
{
|
|
|
|
for(i = 1, prectP = prects, prectN = prects + 1;
|
|
|
|
i < nrects;
|
|
|
|
i++, prectP++, prectN++)
|
|
|
|
if(prectN->y < prectP->y)
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
return CT_YSORTED;
|
|
|
|
case YXSorted:
|
|
|
|
if(nrects > 1)
|
|
|
|
{
|
|
|
|
for(i = 1, prectP = prects, prectN = prects + 1;
|
|
|
|
i < nrects;
|
|
|
|
i++, prectP++, prectN++)
|
|
|
|
if((prectN->y < prectP->y) ||
|
|
|
|
( (prectN->y == prectP->y) &&
|
|
|
|
(prectN->x < prectP->x) ) )
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
return CT_YXSORTED;
|
|
|
|
case YXBanded:
|
|
|
|
if(nrects > 1)
|
|
|
|
{
|
|
|
|
for(i = 1, prectP = prects, prectN = prects + 1;
|
|
|
|
i < nrects;
|
|
|
|
i++, prectP++, prectN++)
|
|
|
|
if((prectN->y != prectP->y &&
|
|
|
|
prectN->y < prectP->y + (int) prectP->height) ||
|
|
|
|
((prectN->y == prectP->y) &&
|
|
|
|
(prectN->height != prectP->height ||
|
|
|
|
prectN->x < prectP->x + (int) prectP->width)))
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
return CT_YXBANDED;
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
int
|
2005-03-08 00:02:59 +01:00
|
|
|
SetClipRects(GCPtr pGC, int xOrigin, int yOrigin, int nrects,
|
|
|
|
xRectangle *prects, int ordering)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
|
|
|
int newct, size;
|
|
|
|
xRectangle *prectsNew;
|
|
|
|
|
|
|
|
newct = VerifyRectOrder(nrects, prects, ordering);
|
|
|
|
if (newct < 0)
|
2010-06-06 16:18:40 +02:00
|
|
|
return BadMatch;
|
2003-11-14 16:54:54 +01:00
|
|
|
size = nrects * sizeof(xRectangle);
|
2010-05-05 20:44:06 +02:00
|
|
|
prectsNew = malloc(size);
|
2003-11-14 16:54:54 +01:00
|
|
|
if (!prectsNew && size)
|
|
|
|
return BadAlloc;
|
|
|
|
|
|
|
|
pGC->serialNumber |= GC_CHANGE_SERIAL_BIT;
|
|
|
|
pGC->clipOrg.x = xOrigin;
|
|
|
|
pGC->stateChanges |= GCClipXOrigin;
|
|
|
|
|
|
|
|
pGC->clipOrg.y = yOrigin;
|
|
|
|
pGC->stateChanges |= GCClipYOrigin;
|
|
|
|
|
|
|
|
if (size)
|
|
|
|
memmove((char *)prectsNew, (char *)prects, size);
|
|
|
|
(*pGC->funcs->ChangeClip)(pGC, newct, (pointer)prectsNew, nrects);
|
|
|
|
if (pGC->funcs->ChangeGC)
|
|
|
|
(*pGC->funcs->ChangeGC) (pGC, GCClipXOrigin|GCClipYOrigin|GCClipMask);
|
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
sets reasonable defaults
|
|
|
|
if we can get a pre-allocated one, use it and mark it as used.
|
|
|
|
if we can't, create one out of whole cloth (The Velveteen GC -- if
|
|
|
|
you use it often enough it will become real.)
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
GCPtr
|
2007-03-08 08:20:19 +01:00
|
|
|
GetScratchGC(unsigned depth, ScreenPtr pScreen)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2007-03-08 08:20:19 +01:00
|
|
|
int i;
|
|
|
|
GCPtr pGC;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
for (i=0; i<=pScreen->numDepths; i++)
|
2010-05-20 19:46:43 +02:00
|
|
|
{
|
|
|
|
pGC = pScreen->GCperDepth[i];
|
|
|
|
if (pGC && pGC->depth == depth && !pGC->scratch_inuse)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2010-05-20 19:46:43 +02:00
|
|
|
pGC->scratch_inuse = TRUE;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
pGC->alu = GXcopy;
|
|
|
|
pGC->planemask = ~0;
|
|
|
|
pGC->serialNumber = 0;
|
|
|
|
pGC->fgPixel = 0;
|
|
|
|
pGC->bgPixel = 1;
|
|
|
|
pGC->lineWidth = 0;
|
|
|
|
pGC->lineStyle = LineSolid;
|
|
|
|
pGC->capStyle = CapButt;
|
|
|
|
pGC->joinStyle = JoinMiter;
|
|
|
|
pGC->fillStyle = FillSolid;
|
|
|
|
pGC->fillRule = EvenOddRule;
|
|
|
|
pGC->arcMode = ArcChord;
|
|
|
|
pGC->patOrg.x = 0;
|
|
|
|
pGC->patOrg.y = 0;
|
|
|
|
pGC->subWindowMode = ClipByChildren;
|
|
|
|
pGC->graphicsExposures = FALSE;
|
|
|
|
pGC->clipOrg.x = 0;
|
|
|
|
pGC->clipOrg.y = 0;
|
|
|
|
if (pGC->clientClipType != CT_NONE)
|
|
|
|
(*pGC->funcs->ChangeClip) (pGC, CT_NONE, NULL, 0);
|
2010-05-09 04:08:47 +02:00
|
|
|
pGC->stateChanges = GCAllBits;
|
2003-11-14 16:54:54 +01:00
|
|
|
return pGC;
|
|
|
|
}
|
2010-05-20 19:46:43 +02:00
|
|
|
}
|
2003-11-14 16:54:54 +01:00
|
|
|
/* if we make it this far, need to roll our own */
|
|
|
|
pGC = CreateScratchGC(pScreen, depth);
|
|
|
|
if (pGC)
|
|
|
|
pGC->graphicsExposures = FALSE;
|
|
|
|
return pGC;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
if the gc to free is in the table of pre-existing ones,
|
|
|
|
mark it as available.
|
|
|
|
if not, free it for real
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2007-03-08 08:20:19 +01:00
|
|
|
FreeScratchGC(GCPtr pGC)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2010-05-20 19:46:43 +02:00
|
|
|
if (pGC->scratch_inuse)
|
|
|
|
pGC->scratch_inuse = FALSE;
|
|
|
|
else
|
|
|
|
FreeGC(pGC, (GContext)0);
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|