Merge branch 'master' of git+ssh://git.freedesktop.org/git/xorg/xserver into glucose-2

Conflicts:

	hw/xfree86/Makefile.am
This commit is contained in:
Alan Hourihane 2008-07-21 10:11:28 +01:00
commit c5d4553240
373 changed files with 5242 additions and 57303 deletions

View file

@ -5,14 +5,6 @@ if COMPOSITE
COMPOSITE_DIR=composite
endif
if XTRAP
XTRAP_DIR=XTrap
endif
if MFB
MFB_DIR=mfb
endif
if GLX
GLX_DIR=glx
endif
@ -48,11 +40,9 @@ SUBDIRS = \
Xi \
xkb \
$(DBE_DIR) \
$(MFB_DIR) \
$(RECORD_DIR) \
xfixes \
damageext \
$(XTRAP_DIR) \
$(COMPOSITE_DIR) \
$(GLX_DIR) \
exa \
@ -93,11 +83,9 @@ DIST_SUBDIRS = \
Xi \
xkb \
dbe \
mfb \
record \
xfixes \
damageext \
XTrap \
composite \
glx \
exa \

View file

@ -1,5 +0,0 @@
noinst_LTLIBRARIES = libxtrap.la
AM_CFLAGS = $(DIX_CFLAGS)
libxtrap_la_SOURCES = xtrapddmi.c xtrapdi.c xtrapdiswp.c xtrapditbl.c

View file

@ -1,161 +0,0 @@
/*****************************************************************************
Copyright 1987, 1988, 1989, 1990, 1991 by Digital Equipment Corp., Maynard, MA
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.
*****************************************************************************/
/*
* ABSTRACT:
*
* This module is the platform-specific but conditionally independent
* code for the XTrap extension (usually I/O or platform setup).
* This is shared code and is subject to change only by team approval.
*
* CONTRIBUTORS:
*
* Dick Annicchiarico
* Robert Chesler
* Gene Durso
* Marc Evans
* Alan Jamison
* Mark Henry
* Ken Miller
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <errno.h>
#include <X11/Xos.h>
#ifdef PC
# include "fcntl.h"
# include "io.h"
# define O_NDELAY 0L
#endif
#define NEED_REPLIES
#define NEED_EVENTS
#include <X11/X.h> /* From library include environment */
#include "inputstr.h" /* From server include env. (must be before Xlib.h!) */
#ifdef PC
# include "scrintst.h" /* Screen struct */
# include "extnsist.h"
#else
# include "extnsionst.h" /* Server ExtensionEntry definitions */
# include "scrnintstr.h" /* Screen struct */
#endif
#include "inputstr.h"
#include <X11/extensions/xtrapdi.h>
#include <X11/extensions/xtrapddmi.h>
#include <X11/extensions/xtrapproto.h>
extern int XETrapErrorBase;
extern xXTrapGetAvailReply XETrap_avail;
extern DevicePtr XETrapKbdDev;
extern DevicePtr XETrapPtrDev;
/*
* DESCRIPTION:
*
* This function performs the platform specific setup for server
* extension implementations.
*/
void XETrapPlatformSetup()
{
}
#if !defined _XINPUT
/*
* DESCRIPTION:
*
* This routine processes the simulation of some input event.
*
*/
int XETrapSimulateXEvent(register xXTrapInputReq *request,
register ClientPtr client)
{
ScreenPtr pScr = NULL;
int status = Success;
xEvent xev;
register int x = request->input.x;
register int y = request->input.y;
DevicePtr keydev = (DevicePtr)PickKeyboard(client);
DevicePtr ptrdev = (DevicePtr)PickPointer(client);
if (request->input.screen < screenInfo.numScreens)
{
pScr = screenInfo.screens[request->input.screen];
}
else
{ /* Trying to play bogus events to this WS! */
#ifdef VERBOSE
ErrorF("%s: Trying to send events to screen %d!\n", XTrapExtName,
request->input.screen);
#endif
status = XETrapErrorBase + BadScreen;
}
/* Fill in the event structure with the information
* Note: root, event, child, eventX, eventY, state, and sameScreen
* are all updated by FixUpEventFromWindow() when the events
* are delivered via DeliverDeviceEvents() or whatever. XTrap
* needs to only concern itself with type, detail, time, rootX,
* and rootY.
*/
if (status == Success)
{
xev.u.u.type = request->input.type;
xev.u.u.detail = request->input.detail;
xev.u.keyButtonPointer.time = GetTimeInMillis();
xev.u.keyButtonPointer.rootX = x;
xev.u.keyButtonPointer.rootY = y;
if (request->input.type == MotionNotify)
{ /* Set new cursor position on screen */
XETrap_avail.data.cur_x = x;
XETrap_avail.data.cur_y = y;
NewCurrentScreen (inputInfo.pointer, pScr, x, y); /* fix from amnonc@mercury.co.il */
if (!(*pScr->SetCursorPosition)(inputInfo.pointer, pScr, x, y, xFalse))
{
status = BadImplementation;
}
}
}
if (status == Success)
{
switch(request->input.type)
{ /* Now process the event appropriately */
case KeyPress:
case KeyRelease:
(*XETrapKbdDev->realInputProc)(&xev,(DeviceIntPtr)keydev, 1L);
break;
case MotionNotify:
case ButtonPress:
case ButtonRelease:
(*XETrapPtrDev->realInputProc)(&xev,(DeviceIntPtr)ptrdev, 1L);
break;
default:
status = BadValue;
break;
}
}
return(status);
}
#endif /* _XINPUT */

File diff suppressed because it is too large Load diff

View file

@ -1,937 +0,0 @@
/****************************************************************************
Copyright 1987, 1988, 1989, 1990, 1991, 1992 by
Digital Equipment Corp., Maynard, MA
X11R6 Changes Copyright (c) 1994 by Robert Chesler of Absol-Puter, Hudson, NH.
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 AND ABSOL-PUTER DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL DIGITAL OR ABSOL-PUTER 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.
*****************************************************************************/
/*
* ABSTRACT:
*
* This module is the device independent module responsible for all
* routines required for proper communication in a heterogeneous
* networking environment (i.e. client & server on different endian
* machines). The bulk of this module is patterned after X11/R4's
* server/dix/swapreq.c ; however, they infact swap fields
* in the exact opposite order since XTrap requires "unswapped" data
* to become "swapped" before sending it to a "swapped" client.
*
* CONTRIBUTORS:
*
* Ken Miller
* Marc Evans
*
* CHANGES:
*
* Robert Chesler - added client arg for X11R6 port in many spots
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/X.h>
#define NEED_REPLIES
#define NEED_EVENTS
#include <X11/Xproto.h>
#include <X11/Xprotostr.h>
#include <X11/extensions/xtrapdi.h>
#include "input.h" /* Server DevicePtr definitions */
#include "misc.h"
#include "dixstruct.h"
#ifdef PC
# include "extnsist.h"
#else
# include "extnsionst.h" /* Server ExtensionEntry definitions */
#endif
# include "swapreq.h" /* Server SwapColorItem definition */
#include <X11/extensions/xtrapddmi.h>
#include <X11/extensions/xtrapproto.h>
/* In-coming XTrap requests needing to be swapped to native format */
int sXETrapReset(xXTrapReq *request, ClientPtr client)
{
register char n;
swaps(&(request->length),n);
return(XETrapReset(request,client));
}
int sXETrapGetAvailable(xXTrapGetReq *request, ClientPtr client)
{
register char n;
swaps(&(request->length),n);
swaps(&(request->protocol),n);
return(XETrapGetAvailable(request,client));
}
int sXETrapConfig(xXTrapConfigReq *request, ClientPtr client)
{
register char n;
swaps(&(request->length),n);
swaps(&(request->config_max_pkt_size),n);
return(XETrapConfig(request,client));
}
int sXETrapStartTrap(xXTrapReq *request, ClientPtr client)
{
register char n;
swaps(&(request->length),n);
return(XETrapStartTrap(request,client));
}
int sXETrapStopTrap(xXTrapReq *request, ClientPtr client)
{
register char n;
swaps(&(request->length),n);
return(XETrapStopTrap(request,client));
}
int sXETrapGetCurrent(xXTrapReq *request, ClientPtr client)
{
register char n;
swaps(&(request->length),n);
return(XETrapGetCurrent(request,client));
}
int sXETrapGetStatistics(xXTrapReq *request, ClientPtr client)
{
register char n;
swaps(&(request->length),n);
return(XETrapGetStatistics(request,client));
}
#ifndef _XINPUT
int sXETrapSimulateXEvent(xXTrapInputReq *request, ClientPtr client)
{
register char n;
swaps(&(request->input.x),n);
swaps(&(request->input.y),n);
return(XETrapSimulateXEvent(request,client));
}
#endif
int sXETrapGetVersion(xXTrapGetReq *request, ClientPtr client)
{
register char n;
swaps(&(request->length),n);
swaps(&(request->protocol),n);
return(XETrapGetVersion(request,client));
}
int sXETrapGetLastInpTime(xXTrapReq *request, ClientPtr client)
{
register char n;
swaps(&(request->length),n);
return(XETrapGetLastInpTime(request,client));
}
/* Out-going XTrap replies needing to be swapped *from* native format */
void sReplyXETrapGetAvail(ClientPtr client, int size, char *reply)
{
xXTrapGetAvailReply *rep = (xXTrapGetAvailReply *)reply;
register char n;
swaps(&(rep->hdr.sequenceNumber),n);
swapl(&(rep->hdr.length),n);
swapl(&(rep->data.pf_ident),n);
swaps(&(rep->data.xtrap_release),n);
swaps(&(rep->data.xtrap_version),n);
swaps(&(rep->data.xtrap_revision),n);
swaps(&(rep->data.max_pkt_size),n);
swapl(&(rep->data.major_opcode),n);
swapl(&(rep->data.event_base),n);
swaps(&(rep->data.cur_x),n);
swaps(&(rep->data.cur_y),n);
(void)WriteToClient(client,size,reply);
return;
}
void sReplyXETrapGetVers(ClientPtr client, int size, char *reply)
{
xXTrapGetVersReply *rep = (xXTrapGetVersReply *)reply;
register char n;
swaps(&(rep->hdr.sequenceNumber),n);
swapl(&(rep->hdr.length),n);
swaps(&(rep->data.xtrap_release),n);
swaps(&(rep->data.xtrap_version),n);
swaps(&(rep->data.xtrap_revision),n);
(void)WriteToClient(client,size,reply);
return;
}
void sReplyXETrapGetLITim(ClientPtr client, int size, char *reply)
{
xXTrapGetLITimReply *rep = (xXTrapGetLITimReply *)reply;
register char n;
swaps(&(rep->hdr.sequenceNumber),n);
swapl(&(rep->hdr.length),n);
swapl(&(rep->data_last_time),n);
(void)WriteToClient(client,size,reply);
return;
}
void sReplyXETrapGetCur(ClientPtr client, int size, char *reply)
{
xXTrapGetCurReply *rep = (xXTrapGetCurReply *)reply;
register char n;
swaps(&(rep->hdr.sequenceNumber),n);
swapl(&(rep->hdr.length),n);
swaps(&(rep->data_config_max_pkt_size),n);
(void)WriteToClient(client,size,reply);
return;
}
void sReplyXETrapGetStats(ClientPtr client, int size, char *reply)
{
xXTrapGetStatsReply *rep = (xXTrapGetStatsReply *)reply;
register char n;
register int i;
long *p;
swaps(&(rep->sequenceNumber),n);
swapl(&(rep->length),n);
for (i=0L, p = (long *)rep->data.requests; i<256L; i++, p++)
{
swapl(p,n);
}
for (i=0L, p = (long *)rep->data.events; i<XETrapCoreEvents; i++, p++)
{
swapl(p,n);
}
(void)WriteToClient(client,size,reply);
return;
}
/* Out-going XTrap I/O header needing to be swapped *from* native format */
void sXETrapHeader(XETrapHeader *hdr)
{
register char n;
swapl(&(hdr->count), n);
swapl(&(hdr->timestamp), n);
swaps(&(hdr->win_x), n);
swaps(&(hdr->win_y), n);
swaps(&(hdr->client), n);
}
/* Out-going requests needing to be swapped *from* native format
* aka swapreq.c "equivalents"
*/
/* The following is used for all requests that have
no fields to be swapped (except "length") */
void XETSwSimpleReq(register xReq *data)
{
register char n;
swaps(&(data->length), n);
}
/* The following is used for all requests that have
only a single 32-bit field to be swapped, coming
right after the "length" field */
void XETSwResourceReq(register xResourceReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->id), n);
}
void XETSwCreateWindow(register xCreateWindowReq *data,ClientPtr client)
{
register char n;
swapl(&(data->wid), n);
swapl(&(data->parent), n);
swaps(&(data->x), n);
swaps(&(data->y), n);
swaps(&(data->width), n);
swaps(&(data->height), n);
swaps(&(data->borderWidth), n);
swaps(&(data->class), n);
swapl(&(data->visual), n);
swapl(&(data->mask), n);
SwapRestL(data);
swaps(&(data->length), n);
}
void XETSwChangeWindowAttributes(register xChangeWindowAttributesReq *data,
ClientPtr client)
{
register char n;
swapl(&(data->window), n);
swapl(&(data->valueMask), n);
SwapRestL(data);
swaps(&(data->length), n);
}
void XETSwReparentWindow(register xReparentWindowReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->window), n);
swapl(&(data->parent), n);
swaps(&(data->x), n);
swaps(&(data->y), n);
}
void XETSwConfigureWindow(xConfigureWindowReq *data, ClientPtr client)
{
register char n;
swapl(&(data->window), n);
swaps(&(data->mask), n);
SwapRestL(data);
swaps(&(data->length), n);
}
void XETSwInternAtom(register xInternAtomReq *data)
{
register char n;
swaps(&(data->length), n);
swaps(&(data->nbytes), n);
}
void XETSwChangeProperty(register xChangePropertyReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->window), n);
swapl(&(data->property), n);
swapl(&(data->type), n);
switch ( data->format ) {
case 8L : break;
case 16L:
SwapShorts((short *)(data + 1), data->nUnits);
break;
case 32L:
SwapLongs((CARD32 *)(data + 1), data->nUnits);
break;
}
swapl(&(data->nUnits), n);
}
void XETSwDeleteProperty(register xDeletePropertyReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->window), n);
swapl(&(data->property), n);
}
void XETSwGetProperty(register xGetPropertyReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->window), n);
swapl(&(data->property), n);
swapl(&(data->type), n);
swapl(&(data->longOffset), n);
swapl(&(data->longLength), n);
}
void XETSwSetSelectionOwner(register xSetSelectionOwnerReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->window), n);
swapl(&(data->selection), n);
swapl(&(data->time), n);
}
void XETSwConvertSelection(register xConvertSelectionReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->requestor), n);
swapl(&(data->selection), n);
swapl(&(data->target), n);
swapl(&(data->property), n);
swapl(&(data->time), n);
}
void XETSwSendEvent(register xSendEventReq *data)
{
register char n;
xEvent eventT;
EventSwapPtr proc;
swapl(&(data->destination), n);
swapl(&(data->eventMask), n);
/* Swap event */
proc = EventSwapVector[data->event.u.u.type & 0177];
if (!proc || proc == NotImplemented)
(*proc)(&(data->event), &eventT);
data->event = eventT;
swaps(&(data->length), n);
}
void XETSwGrabPointer(register xGrabPointerReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->grabWindow), n);
swaps(&(data->eventMask), n);
swapl(&(data->confineTo), n);
swapl(&(data->cursor), n);
swapl(&(data->time), n);
}
void XETSwGrabButton(register xGrabButtonReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->grabWindow), n);
swaps(&(data->eventMask), n);
swapl(&(data->confineTo), n);
swapl(&(data->cursor), n);
swaps(&(data->modifiers), n);
}
void XETSwUngrabButton(register xUngrabButtonReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->grabWindow), n);
swaps(&(data->modifiers), n);
}
void XETSwChangeActivePointerGrab(register xChangeActivePointerGrabReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->cursor), n);
swapl(&(data->time), n);
swaps(&(data->eventMask), n);
}
void XETSwGrabKeyboard(register xGrabKeyboardReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->grabWindow), n);
swapl(&(data->time), n);
}
void XETSwGrabKey(register xGrabKeyReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->grabWindow), n);
swaps(&(data->modifiers), n);
}
void XETSwUngrabKey(register xUngrabKeyReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->grabWindow), n);
swaps(&(data->modifiers), n);
}
void XETSwGetMotionEvents(register xGetMotionEventsReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->window), n);
swapl(&(data->start), n);
swapl(&(data->stop), n);
}
void XETSwTranslateCoords(register xTranslateCoordsReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->srcWid), n);
swapl(&(data->dstWid), n);
swaps(&(data->srcX), n);
swaps(&(data->srcY), n);
}
void XETSwWarpPointer(register xWarpPointerReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->srcWid), n);
swapl(&(data->dstWid), n);
swaps(&(data->srcX), n);
swaps(&(data->srcY), n);
swaps(&(data->srcWidth), n);
swaps(&(data->srcHeight), n);
swaps(&(data->dstX), n);
swaps(&(data->dstY), n);
}
void XETSwSetInputFocus(register xSetInputFocusReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->focus), n);
swapl(&(data->time), n);
}
void XETSwOpenFont(register xOpenFontReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->fid), n);
swaps(&(data->nbytes), n);
}
void XETSwListFonts(register xListFontsReq *data)
{
register char n;
swaps(&(data->length), n);
swaps(&(data->maxNames), n);
swaps(&(data->nbytes), n);
}
void XETSwListFontsWithInfo(register xListFontsWithInfoReq *data)
{
register char n;
swaps(&(data->length), n);
swaps(&(data->maxNames), n);
swaps(&(data->nbytes), n);
}
void XETSwSetFontPath(register xSetFontPathReq *data)
{
register char n;
swaps(&(data->length), n);
swaps(&(data->nFonts), n);
}
void XETSwCreatePixmap(register xCreatePixmapReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->pid), n);
swapl(&(data->drawable), n);
swaps(&(data->width), n);
swaps(&(data->height), n);
}
void XETSwCreateGC(register xCreateGCReq *data, ClientPtr client)
{
register char n;
swapl(&(data->gc), n);
swapl(&(data->drawable), n);
swapl(&(data->mask), n);
SwapRestL(data);
swaps(&(data->length), n);
}
void XETSwChangeGC(register xChangeGCReq *data, ClientPtr client)
{
register char n;
swapl(&(data->gc), n);
swapl(&(data->mask), n);
SwapRestL(data);
swaps(&(data->length), n);
}
void XETSwCopyGC(register xCopyGCReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->srcGC), n);
swapl(&(data->dstGC), n);
swapl(&(data->mask), n);
}
void XETSwSetDashes(register xSetDashesReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->gc), n);
swaps(&(data->dashOffset), n);
swaps(&(data->nDashes), n);
}
void XETSwSetClipRectangles(register xSetClipRectanglesReq *data, ClientPtr
client)
{
register char n;
swapl(&(data->gc), n);
swaps(&(data->xOrigin), n);
swaps(&(data->yOrigin), n);
SwapRestS(data);
swaps(&(data->length), n);
}
void XETSwClearToBackground(register xClearAreaReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->window), n);
swaps(&(data->x), n);
swaps(&(data->y), n);
swaps(&(data->width), n);
swaps(&(data->height), n);
}
void XETSwCopyArea(register xCopyAreaReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->srcDrawable), n);
swapl(&(data->dstDrawable), n);
swapl(&(data->gc), n);
swaps(&(data->srcX), n);
swaps(&(data->srcY), n);
swaps(&(data->dstX), n);
swaps(&(data->dstY), n);
swaps(&(data->width), n);
swaps(&(data->height), n);
}
void XETSwCopyPlane(register xCopyPlaneReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->srcDrawable), n);
swapl(&(data->dstDrawable), n);
swapl(&(data->gc), n);
swaps(&(data->srcX), n);
swaps(&(data->srcY), n);
swaps(&(data->dstX), n);
swaps(&(data->dstY), n);
swaps(&(data->width), n);
swaps(&(data->height), n);
swapl(&(data->bitPlane), n);
}
/* The following routine is used for all Poly drawing requests
(except FillPoly, which uses a different request format) */
void XETSwPoly(register xPolyPointReq *data, ClientPtr client)
{
register char n;
swapl(&(data->drawable), n);
swapl(&(data->gc), n);
SwapRestS(data);
swaps(&(data->length), n);
}
/* cannot use XETSwPoly for this one, because xFillPolyReq
* is longer than xPolyPointReq, and we don't want to swap
* the difference as shorts!
*/
void XETSwFillPoly(register xFillPolyReq *data, ClientPtr client)
{
register char n;
swapl(&(data->drawable), n);
swapl(&(data->gc), n);
SwapRestS(data);
swaps(&(data->length), n);
}
void XETSwPutImage(register xPutImageReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->drawable), n);
swapl(&(data->gc), n);
swaps(&(data->width), n);
swaps(&(data->height), n);
swaps(&(data->dstX), n);
swaps(&(data->dstY), n);
/* Image should already be swapped */
}
void XETSwGetImage(register xGetImageReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->drawable), n);
swaps(&(data->x), n);
swaps(&(data->y), n);
swaps(&(data->width), n);
swaps(&(data->height), n);
swapl(&(data->planeMask), n);
}
/* ProcPolyText used for both PolyText8 and PolyText16 */
void XETSwPolyText(register xPolyTextReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->drawable), n);
swapl(&(data->gc), n);
swaps(&(data->x), n);
swaps(&(data->y), n);
}
/* ProcImageText used for both ImageText8 and ImageText16 */
void XETSwImageText(register xImageTextReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->drawable), n);
swapl(&(data->gc), n);
swaps(&(data->x), n);
swaps(&(data->y), n);
}
void XETSwCreateColormap(register xCreateColormapReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->mid), n);
swapl(&(data->window), n);
swapl(&(data->visual), n);
}
void XETSwCopyColormapAndFree(register xCopyColormapAndFreeReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->mid), n);
swapl(&(data->srcCmap), n);
}
void XETSwAllocColor (register xAllocColorReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->cmap), n);
swaps(&(data->red), n);
swaps(&(data->green), n);
swaps(&(data->blue), n);
}
void XETSwAllocNamedColor (register xAllocNamedColorReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->cmap), n);
swaps(&(data->nbytes), n);
}
void XETSwAllocColorCells (register xAllocColorCellsReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->cmap), n);
swaps(&(data->colors), n);
swaps(&(data->planes), n);
}
void XETSwAllocColorPlanes(register xAllocColorPlanesReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->cmap), n);
swaps(&(data->colors), n);
swaps(&(data->red), n);
swaps(&(data->green), n);
swaps(&(data->blue), n);
}
void XETSwFreeColors (register xFreeColorsReq *data, ClientPtr
client)
{
register char n;
swapl(&(data->cmap), n);
swapl(&(data->planeMask), n);
SwapRestL(data);
swaps(&(data->length), n);
}
void XETSwStoreColors (register xStoreColorsReq *data,ClientPtr
client)
{
register char n;
unsigned long count;
xColorItem *pItem;
swapl(&(data->cmap), n);
pItem = (xColorItem *) &(data[1]);
for(count = LengthRestB(data)/sizeof(xColorItem); count != 0; count--)
SwapColorItem(pItem++);
swaps(&(data->length), n);
}
void XETSwStoreNamedColor (register xStoreNamedColorReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->cmap), n);
swapl(&(data->pixel), n);
swaps(&(data->nbytes), n);
}
void XETSwQueryColors(register xQueryColorsReq *data, ClientPtr client)
{
register char n;
swapl(&(data->cmap), n);
SwapRestL(data);
swaps(&(data->length), n);
}
void XETSwLookupColor(register xLookupColorReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->cmap), n);
swaps(&(data->nbytes), n);
}
void XETSwCreateCursor(register xCreateCursorReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->cid), n);
swapl(&(data->source), n);
swapl(&(data->mask), n);
swaps(&(data->foreRed), n);
swaps(&(data->foreGreen), n);
swaps(&(data->foreBlue), n);
swaps(&(data->backRed), n);
swaps(&(data->backGreen), n);
swaps(&(data->backBlue), n);
swaps(&(data->x), n);
swaps(&(data->y), n);
}
void XETSwCreateGlyphCursor(register xCreateGlyphCursorReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->cid), n);
swapl(&(data->source), n);
swapl(&(data->mask), n);
swaps(&(data->sourceChar), n);
swaps(&(data->maskChar), n);
swaps(&(data->foreRed), n);
swaps(&(data->foreGreen), n);
swaps(&(data->foreBlue), n);
swaps(&(data->backRed), n);
swaps(&(data->backGreen), n);
swaps(&(data->backBlue), n);
}
void XETSwRecolorCursor(register xRecolorCursorReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->cursor), n);
swaps(&(data->foreRed), n);
swaps(&(data->foreGreen), n);
swaps(&(data->foreBlue), n);
swaps(&(data->backRed), n);
swaps(&(data->backGreen), n);
swaps(&(data->backBlue), n);
}
void XETSwQueryBestSize (register xQueryBestSizeReq *data)
{
register char n;
swaps(&(data->length), n);
swapl(&(data->drawable), n);
swaps(&(data->width), n);
swaps(&(data->height), n);
}
void XETSwQueryExtension (register xQueryExtensionReq *data)
{
register char n;
swaps(&(data->length), n);
swaps(&(data->nbytes), n);
}
void XETSwChangeKeyboardMapping (register xChangeKeyboardMappingReq *data)
{
register char n;
register long *p;
register int i, count;
swaps(&(data->length), n);
p = (long *)&(data[1]);
count = data->keyCodes * data->keySymsPerKeyCode;
for(i = 0; i < count; i++)
{
swapl(p, n);
p++;
}
}
void XETSwChangeKeyboardControl (register xChangeKeyboardControlReq *data,
ClientPtr client)
{
register char n;
swapl(&(data->mask), n);
SwapRestL(data);
swaps(&(data->length), n);
}
void XETSwChangePointerControl (register xChangePointerControlReq *data)
{
register char n;
swaps(&(data->length), n);
swaps(&(data->accelNum), n);
swaps(&(data->accelDenum), n);
swaps(&(data->threshold), n);
}
void XETSwSetScreenSaver (register xSetScreenSaverReq *data)
{
register char n;
swaps(&(data->length), n);
swaps(&(data->timeout), n);
swaps(&(data->interval), n);
}
void XETSwChangeHosts(register xChangeHostsReq *data)
{
register char n;
swaps(&(data->length), n);
swaps(&(data->hostLength), n);
}
void XETSwRotateProperties(register xRotatePropertiesReq *data, ClientPtr client)
{
register char n;
swapl(&(data->window), n);
swaps(&(data->nAtoms), n);
swaps(&(data->nPositions), n);
SwapRestL(data);
swaps(&(data->length), n);
}
/*ARGSUSED*/
void XETSwNoOperation(xReq *data)
{
/* noop -- don't do anything */
}

View file

@ -1,243 +0,0 @@
/****************************************************************************
Copyright 1987, 1988, 1989, 1990, 1991 by Digital Equipment Corp., Maynard, MA
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.
*****************************************************************************/
/*
* ABSTRACT:
*
* This module is contains Vector tables used for swapping and general
* dispatch by the XTrap server extension.
*
* CONTRIBUTORS:
*
* Ken Miller
* Marc Evans
*
*/
/*-----------------*
* Include Files *
*-----------------*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <stdlib.h>
#include <X11/X.h>
#define NEED_REPLIES
#define NEED_EVENTS
#include <X11/Xproto.h>
#include <X11/Xprotostr.h>
#include <X11/extensions/xtrapdi.h>
#include "input.h" /* Server DevicePtr definitions */
#include "misc.h"
#include "dixstruct.h"
#ifdef PC
# include "extnsist.h"
#else
# include "extnsionst.h" /* Server ExtensionEntry definitions */
#endif
#include <X11/extensions/xtrapddmi.h>
#include <X11/extensions/xtrapproto.h>
globaldef void_function XETSwProcVector[256L] =
{
(void_function)ProcBadRequest,
XETSwCreateWindow,
XETSwChangeWindowAttributes,
XETSwResourceReq, /* GetWindowAttributes */
XETSwResourceReq, /* DestroyWindow */
XETSwResourceReq, /* 5 DestroySubwindows */
XETSwResourceReq, /* XETSwChangeSaveSet, */
XETSwReparentWindow,
XETSwResourceReq, /* MapWindow */
XETSwResourceReq, /* MapSubwindows */
XETSwResourceReq, /* 10 UnmapWindow */
XETSwResourceReq, /* UnmapSubwindows */
XETSwConfigureWindow,
XETSwResourceReq, /* XETSwCirculateWindow, */
XETSwResourceReq, /* GetGeometry */
XETSwResourceReq, /* 15 QueryTree */
XETSwInternAtom,
XETSwResourceReq, /* XETSwGetAtomName, */
XETSwChangeProperty,
XETSwDeleteProperty,
XETSwGetProperty, /* 20 */
XETSwResourceReq, /* XETSwListProperties, */
XETSwSetSelectionOwner,
XETSwResourceReq, /* XETSwGetSelectionOwner, */
XETSwConvertSelection,
XETSwSendEvent, /* 25 */
XETSwGrabPointer,
XETSwResourceReq, /* XETSwUngrabPointer, */
XETSwGrabButton,
XETSwUngrabButton,
XETSwChangeActivePointerGrab, /* 30 */
XETSwGrabKeyboard,
XETSwResourceReq, /* XETSwUngrabKeyboard, */
XETSwGrabKey,
XETSwUngrabKey,
XETSwResourceReq, /* 35 XETSwAllowEvents, */
XETSwSimpleReq, /* XETSwGrabServer, */
XETSwSimpleReq, /* XETSwUngrabServer, */
XETSwResourceReq, /* XETSwQueryPointer, */
XETSwGetMotionEvents,
XETSwTranslateCoords, /*40 */
XETSwWarpPointer,
XETSwSetInputFocus,
XETSwSimpleReq, /* XETSwGetInputFocus, */
XETSwSimpleReq, /* QueryKeymap, */
XETSwOpenFont, /* 45 */
XETSwResourceReq, /* XETSwCloseFont, */
XETSwResourceReq, /* XETSwQueryFont, */
XETSwResourceReq, /* XETSwQueryTextExtents, */
XETSwListFonts,
XETSwListFontsWithInfo, /* 50 */
XETSwSetFontPath,
XETSwSimpleReq, /* GetFontPath, */
XETSwCreatePixmap,
XETSwResourceReq, /* XETSwFreePixmap, */
XETSwCreateGC, /* 55 */
XETSwChangeGC,
XETSwCopyGC,
XETSwSetDashes,
XETSwSetClipRectangles,
XETSwResourceReq, /* 60 XETSwFreeGC, */
XETSwClearToBackground,
XETSwCopyArea,
XETSwCopyPlane,
XETSwPoly, /* PolyPoint, */
XETSwPoly, /* 65 PolyLine */
XETSwPoly, /* PolySegment, */
XETSwPoly, /* PolyRectangle, */
XETSwPoly, /* PolyArc, */
XETSwFillPoly,
XETSwPoly, /* 70 PolyFillRectangle */
XETSwPoly, /* PolyFillArc, */
XETSwPutImage,
XETSwGetImage,
XETSwPolyText,
XETSwPolyText, /* 75 */
XETSwImageText,
XETSwImageText,
XETSwCreateColormap,
XETSwResourceReq, /* XETSwFreeColormap, */
XETSwCopyColormapAndFree, /* 80 */
XETSwResourceReq, /* XETSwInstallColormap, */
XETSwResourceReq, /* XETSwUninstallColormap, */
XETSwResourceReq, /* XETSwListInstalledColormaps, */
XETSwAllocColor,
XETSwAllocNamedColor, /* 85 */
XETSwAllocColorCells,
XETSwAllocColorPlanes,
XETSwFreeColors,
XETSwStoreColors,
XETSwStoreNamedColor, /* 90 */
XETSwQueryColors,
XETSwLookupColor,
XETSwCreateCursor,
XETSwCreateGlyphCursor,
XETSwResourceReq, /* 95 XETSwFreeCursor, */
XETSwRecolorCursor,
XETSwQueryBestSize,
XETSwQueryExtension,
XETSwSimpleReq, /* ListExtensions, */
XETSwChangeKeyboardMapping, /* 100 */
XETSwSimpleReq, /* GetKeyboardMapping, */
XETSwChangeKeyboardControl,
XETSwSimpleReq, /* GetKeyboardControl, */
XETSwSimpleReq, /* Bell, */
XETSwChangePointerControl, /* 105 */
XETSwSimpleReq, /* GetPointerControl, */
XETSwSetScreenSaver,
XETSwSimpleReq, /* GetScreenSaver, */
XETSwChangeHosts,
XETSwSimpleReq, /* 110 ListHosts, */
XETSwSimpleReq, /* XETSwChangeAccessControl, */
XETSwSimpleReq, /* XETSwChangeCloseDownMode, */
XETSwResourceReq, /* XETSwKillClient, */
XETSwRotateProperties,
XETSwSimpleReq, /* 115 ForceScreenSaver */
XETSwSimpleReq, /* SetPointerMapping, */
XETSwSimpleReq, /* GetPointerMapping, */
XETSwSimpleReq, /* SetModifierMapping, */
XETSwSimpleReq, /* GetModifierMapping, */
NotImplemented, /* 120 */
NotImplemented,
NotImplemented,
NotImplemented,
NotImplemented,
NotImplemented, /* 125 */
NotImplemented,
XETSwNoOperation
};
/* NOTE: This array must align with the values of the constants used
* as minor_opcode values in the request structure. Failure to do this
* could result in random code paths.
*/
globaldef int_function XETrapDispatchVector[10L] =
{
XETrapReset, /* 0 XETrap_Reset */
XETrapGetAvailable, /* 1 XETrap_GetAvailable */
XETrapConfig, /* 2 XETrap_Config */
XETrapStartTrap, /* 3 XETrap_StartTrap */
XETrapStopTrap, /* 4 XETrap_StopTrap */
XETrapGetCurrent, /* 5 XETrap_GetCurrent */
XETrapGetStatistics, /* 6 XETrap_GetStatistics */
#ifndef _XINPUT
XETrapSimulateXEvent, /* 7 XETrap_SimulateXEvent */
#endif
XETrapGetVersion, /* 8 XETrap_GetVersion */
XETrapGetLastInpTime, /* 9 XETrap_GetLastInpTime */
};
/* NOTE: This array must align with the values of the constants used
* as minor_opcode values in the request structure. Failure to do this
* could result in random code paths.
*/
globaldef int_function XETSwDispatchVector[10L] =
{
sXETrapReset, /* 0 XETrap_Reset */
sXETrapGetAvailable, /* 1 XETrap_GetAvailable */
sXETrapConfig, /* 2 XETrap_Config */
sXETrapStartTrap, /* 3 XETrap_StartTrap */
sXETrapStopTrap, /* 4 XETrap_StopTrap */
sXETrapGetCurrent, /* 5 XETrap_GetCurrent */
sXETrapGetStatistics, /* 6 XETrap_GetStatistics */
#ifndef _XINPUT
sXETrapSimulateXEvent, /* 7 XETrap_SimulateXEvent */
#endif
sXETrapGetVersion, /* 8 XETrap_GetVersion */
sXETrapGetLastInpTime, /* 9 XETrap_GetLastInpTime */
};
/* ProcVector shadow vector */
globaldef int_function XETrapProcVector[256L] = {XETrapRequestVector};
/*
* Events are faked as if they're vectored since that's
* the way it'll eventually be (X11 R5?).
*/
#ifndef VECTORED_EVENTS
globaldef int_function EventProcVector[XETrapCoreEvents] = {NULL};
#endif
globaldef int_function XETrapEventProcVector[XETrapCoreEvents] = {NULL};

View file

@ -106,12 +106,6 @@ if MULTIBUFFER
MODULE_SRCS += $(MULTIBUFFER_SRCS)
endif
# Font Cache extension
FONTCACHE_SRCS = fontcache.c
if FONTCACHE
MODULE_SRCS += $(FONTCACHE_SRCS)
endif
# XF86 Big Font extension
BIGFONT_SRCS = xf86bigfont.c
if XF86BIGFONT

View file

@ -1,323 +0,0 @@
/*-
* Copyright (c) 1998-1999 Shunsuke Akiyama <akiyama@jp.FreeBSD.org>.
* All rights reserved.
* Copyright (c) 1998-1999 X-TrueType Server Project, All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/* THIS IS NOT AN X CONSORTIUM STANDARD */
#define NEED_REPLIES
#define NEED_EVENTS
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <X11/X.h>
#include <X11/Xproto.h>
#include "misc.h"
#include "dixstruct.h"
#include "extnsionst.h"
#include "scrnintstr.h"
#include "inputstr.h"
#include "servermd.h"
#define _FONTCACHE_SERVER_
#include <X11/extensions/fontcacheP.h>
#include <X11/extensions/fontcachstr.h>
#include <X11/Xfuncproto.h>
#include "swaprep.h"
#include "modinit.h"
static int miscErrorBase;
static void FontCacheResetProc(
ExtensionEntry* /* extEntry */
);
static DISPATCH_PROC(ProcFontCacheDispatch);
static DISPATCH_PROC(ProcFontCacheGetCacheSettings);
static DISPATCH_PROC(ProcFontCacheGetCacheStatistics);
static DISPATCH_PROC(ProcFontCacheQueryVersion);
static DISPATCH_PROC(ProcFontCacheChangeCacheSettings);
static DISPATCH_PROC(SProcFontCacheDispatch);
static DISPATCH_PROC(SProcFontCacheGetCacheSettings);
static DISPATCH_PROC(SProcFontCacheGetCacheStatistics);
static DISPATCH_PROC(SProcFontCacheQueryVersion);
static DISPATCH_PROC(SProcFontCacheChangeCacheSettings);
void
FontCacheExtensionInit(INITARGS)
{
ExtensionEntry* extEntry;
if (
(extEntry = AddExtension(FONTCACHENAME,
FontCacheNumberEvents,
FontCacheNumberErrors,
ProcFontCacheDispatch,
SProcFontCacheDispatch,
FontCacheResetProc,
StandardMinorOpcode))) {
miscErrorBase = extEntry->errorBase;
}
}
/*ARGSUSED*/
static void
FontCacheResetProc (extEntry)
ExtensionEntry* extEntry;
{
}
static int
ProcFontCacheQueryVersion(client)
ClientPtr client;
{
xFontCacheQueryVersionReply rep;
int n;
REQUEST_SIZE_MATCH(xFontCacheQueryVersionReq);
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
rep.majorVersion = FONTCACHE_MAJOR_VERSION;
rep.minorVersion = FONTCACHE_MINOR_VERSION;
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
swaps(&rep.majorVersion, n);
swaps(&rep.minorVersion, n);
}
WriteToClient(client, SIZEOF(xFontCacheQueryVersionReply), (char *)&rep);
return (client->noClientException);
}
static int
ProcFontCacheGetCacheSettings(client)
ClientPtr client;
{
xFontCacheGetCacheSettingsReply rep;
FontCacheSettings cinfo;
int n;
REQUEST_SIZE_MATCH(xFontCacheGetCacheSettingsReq);
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.length = 0;
/* XXX */
FontCacheGetSettings(&cinfo);
rep.himark = cinfo.himark;
rep.lowmark = cinfo.lowmark;
rep.balance = cinfo.balance;
rep.reserve0 = 0;
rep.reserve1 = 0;
rep.reserve2 = 0;
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
swapl(&rep.himark, n);
swapl(&rep.lowmark, n);
swapl(&rep.balance, n);
swapl(&rep.reserve0, n);
swapl(&rep.reserve1, n);
swapl(&rep.reserve2, n);
}
/* XXX */
WriteToClient(client, SIZEOF(xFontCacheGetCacheSettingsReply),
(char *)&rep);
return (client->noClientException);
}
static int
ProcFontCacheGetCacheStatistics(client)
ClientPtr client;
{
xFontCacheGetCacheStatisticsReply rep;
FontCacheStatistics cstats;
int n;
REQUEST_SIZE_MATCH(xFontCacheGetCacheStatisticsReq);
rep.type = X_Reply;
rep.sequenceNumber = client->sequence;
rep.length = (sz_xFontCacheGetCacheStatisticsReply - 32) >> 2;
/* XXX */
FontCacheGetStatistics(&cstats);
rep.purge_runs = cstats.purge_runs;
rep.purge_stat = cstats.purge_stat;
rep.balance = cstats.balance;
rep.reserve0 = 0;
rep.f_hits = cstats.f.hits;
rep.f_misshits = cstats.f.misshits;
rep.f_purged = cstats.f.purged;
rep.f_usage = cstats.f.usage;
rep.f_reserve0 = 0;
rep.v_hits = cstats.v.hits;
rep.v_misshits = cstats.v.misshits;
rep.v_purged = cstats.v.purged;
rep.v_usage = cstats.v.usage;
rep.v_reserve0 = 0;
if (client->swapped) {
swaps(&rep.sequenceNumber, n);
swapl(&rep.length, n);
swapl(&rep.purge_runs, n);
swapl(&rep.purge_stat, n);
swapl(&rep.balance, n);
swapl(&rep.reserve0, n);
swapl(&rep.f_hits, n);
swapl(&rep.f_misshits, n);
swapl(&rep.f_purged, n);
swapl(&rep.f_usage, n);
swapl(&rep.f_reserve0, n);
swapl(&rep.v_hits, n);
swapl(&rep.v_misshits, n);
swapl(&rep.v_purged, n);
swapl(&rep.v_usage, n);
swapl(&rep.v_reserve0, n);
}
/* XXX */
WriteToClient(client, SIZEOF(xFontCacheGetCacheStatisticsReply),
(char *)&rep);
return (client->noClientException);
}
static int
ProcFontCacheChangeCacheSettings(client)
ClientPtr client;
{
FontCacheSettings cs;
REQUEST(xFontCacheChangeCacheSettingsReq);
REQUEST_SIZE_MATCH(xFontCacheChangeCacheSettingsReq);
/* XXX */
cs.himark = stuff->himark;
cs.lowmark = stuff->lowmark;
cs.balance = stuff->balance;
if (cs.himark < 0 || cs.lowmark < 0)
return BadValue;
if (cs.himark <= cs.lowmark)
return BadValue;
if (!(10 <= cs.balance && cs.balance <= 90))
return BadValue;
if (FontCacheChangeSettings(&cs) == 0)
return miscErrorBase + FontCacheCannotAllocMemory;
/* XXX */
return (client->noClientException);
}
static int
ProcFontCacheDispatch (client)
ClientPtr client;
{
REQUEST(xReq);
switch (stuff->data)
{
case X_FontCacheQueryVersion:
return ProcFontCacheQueryVersion(client);
case X_FontCacheGetCacheSettings:
return ProcFontCacheGetCacheSettings(client);
case X_FontCacheGetCacheStatistics:
return ProcFontCacheGetCacheStatistics(client);
case X_FontCacheChangeCacheSettings:
return ProcFontCacheChangeCacheSettings(client);
default:
return miscErrorBase + FontCacheBadProtocol;
}
}
static int
SProcFontCacheQueryVersion(client)
ClientPtr client;
{
int n;
REQUEST(xFontCacheQueryVersionReq);
swaps(&stuff->length, n);
return ProcFontCacheQueryVersion(client);
}
static int
SProcFontCacheGetCacheSettings(client)
ClientPtr client;
{
int n;
REQUEST(xFontCacheGetCacheSettingsReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xFontCacheGetCacheSettingsReq);
return ProcFontCacheGetCacheSettings(client);
}
static int
SProcFontCacheGetCacheStatistics(client)
ClientPtr client;
{
int n;
REQUEST(xFontCacheGetCacheStatisticsReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xFontCacheGetCacheStatisticsReq);
return ProcFontCacheGetCacheStatistics(client);
}
static int
SProcFontCacheChangeCacheSettings(client)
ClientPtr client;
{
int n;
REQUEST(xFontCacheChangeCacheSettingsReq);
swaps(&stuff->length, n);
REQUEST_SIZE_MATCH(xFontCacheChangeCacheSettingsReq);
/* XXX */
swapl(&stuff->himark, n);
swapl(&stuff->lowmark, n);
swapl(&stuff->balance, n);
/* XXX */
return ProcFontCacheChangeCacheSettings(client);
}
static int
SProcFontCacheDispatch (client)
ClientPtr client;
{
REQUEST(xReq);
switch (stuff->data)
{
case X_FontCacheQueryVersion:
return SProcFontCacheQueryVersion(client);
case X_FontCacheGetCacheSettings:
return SProcFontCacheGetCacheSettings(client);
case X_FontCacheGetCacheStatistics:
return SProcFontCacheGetCacheStatistics(client);
case X_FontCacheChangeCacheSettings:
return SProcFontCacheChangeCacheSettings(client);
default:
return miscErrorBase + FontCacheBadProtocol;
}
}

View file

@ -36,12 +36,15 @@
#define SERVER_GE_MAJOR 1
#define SERVER_GE_MINOR 0
#define rClient(obj) (clients[CLIENT_ID((obj)->resource)])
int GEEventBase;
int GEErrorBase;
DevPrivateKey GEClientPrivateKey = &GEClientPrivateKey;
int GEEventType; /* The opcode for all GenericEvents will have. */
int RT_GECLIENT = 0;
GEExtension GEExtensions[MAXEXTENSIONS];
@ -53,6 +56,7 @@ static const int version_requests[] = {
/* Forward declarations */
static void SGEGenericEvent(xEvent* from, xEvent* to);
static void GERecalculateWinMask(WindowPtr pWin);
#define NUM_VERSION_REQUESTS (sizeof (version_requests) / sizeof (version_requests[0]))
@ -211,6 +215,43 @@ SGEGenericEvent(xEvent* from, xEvent* to)
GEExtensions[gefrom->extension & 0x7F].evswap(gefrom, geto);
}
/**
* Resource callback, invoked when the client disconnects and the associated
* GE masks must be destroyed.
*/
int
GEClientGone(WindowPtr pWin, XID id)
{
GenericClientMasksPtr gclmask;
GenericMaskPtr gmask, prev = NULL;
if (!pWin || !pWin->optional)
return Success;
gclmask = pWin->optional->geMasks;
for (gmask = gclmask->geClients; gmask; gmask = gmask->next)
{
if (gmask->resource == id)
{
if (prev)
{
prev->next = gmask->next;
xfree(gmask);
} else {
gclmask->geClients = NULL;
CheckWindowOptionalNeed(pWin);
GERecalculateWinMask(pWin);
xfree(gmask);
}
return Success;
}
prev = gmask;
}
FatalError("Client not a GE client");
return BadImplementation;
}
/* Init extension, register at server.
* Since other extensions may rely on XGE (XInput does already), it is a good
* idea to init XGE first, before any other extension.
@ -234,6 +275,9 @@ GEExtensionInit(void)
GEErrorBase = extEntry->errorBase;
GEEventType = GEEventBase;
RT_GECLIENT = CreateNewResourceType((DeleteType)GEClientGone);
RegisterResourceName(RT_GECLIENT, "GECLIENT");
memset(GEExtensions, 0, sizeof(GEExtensions));
EventSwapVector[GenericEvent] = (EventSwapPtr) SGEGenericEvent;
@ -338,7 +382,7 @@ GEWindowSetMask(ClientPtr pClient, DeviceIntPtr pDev,
cli = evmasks->geClients;
while(cli)
{
if (cli->client == pClient && cli->dev == pDev)
if (rClient(cli) == pClient && cli->dev == pDev)
break;
cli = cli->next;
}
@ -352,16 +396,17 @@ GEWindowSetMask(ClientPtr pClient, DeviceIntPtr pDev,
return;
}
cli->next = evmasks->geClients;
cli->client = pClient;
cli->resource = FakeClientID(pClient->index);
cli->dev = pDev;
evmasks->geClients = cli;
AddResource(cli->resource, RT_GECLIENT, (pointer)pWin);
}
cli->eventMask[extension] = mask;
} else
{
/* remove client. */
cli = pWin->optional->geMasks->geClients;
if (cli->client == pClient && cli->dev == pDev)
if (rClient(cli) == pClient && cli->dev == pDev)
{
pWin->optional->geMasks->geClients = cli->next;
xfree(cli);
@ -372,7 +417,7 @@ GEWindowSetMask(ClientPtr pClient, DeviceIntPtr pDev,
while(cli)
{
if (cli->client == pClient && cli->dev == pDev)
if (rClient(cli) == pClient && cli->dev == pDev)
{
prev->next = cli->next;
xfree(cli);

View file

@ -43,10 +43,10 @@ from the author.
* A grab has only one instance of this struct.
*/
typedef struct _GenericMaskRec {
ClientPtr client; /* client who set the event mask */
struct _GenericMaskRec* next;
XID resource; /* id for the resource manager */
DeviceIntPtr dev;
Mask eventMask[MAXEXTENSIONS]; /* one mask per extension */
struct _GenericMaskRec* next;
} GenericMaskRec, *GenericMaskPtr;

View file

@ -47,7 +47,7 @@ in this Software without prior written authorization from The Open Group.
#include <X11/extensions/multibufst.h>
#include <stdio.h>
#if !defined(WIN32) && !defined(Lynx)
#if !defined(WIN32)
#include <sys/time.h>
#endif

View file

@ -34,13 +34,8 @@ in this Software without prior written authorization from The Open Group.
#endif
#include <sys/types.h>
#ifndef Lynx
#include <sys/ipc.h>
#include <sys/shm.h>
#else
#include <ipc.h>
#include <shm.h>
#endif
#include <unistd.h>
#include <sys/stat.h>
#define NEED_REPLIES

View file

@ -72,7 +72,7 @@ PERFORMANCE OF THIS SOFTWARE.
#include <X11/extensions/syncstr.h>
#include <stdio.h>
#if !defined(WIN32) && !defined(Lynx)
#if !defined(WIN32)
#include <sys/time.h>
#endif

View file

@ -55,6 +55,7 @@ of the copyright holder.
#include <xkbsrv.h>
#include "../os/osdep.h"
#include "modinit.h"
#define NoSuchEvent 0x80000000

View file

@ -2031,6 +2031,8 @@ SELinuxExtensionInit(INITARGS)
ProcSELinuxDispatch, SProcSELinuxDispatch,
SELinuxResetProc, StandardMinorOpcode);
AddExtensionAlias("Flask", extEntry);
/* Label objects that were created before we could register ourself */
SELinuxLabelInitial();
}

View file

@ -24,14 +24,9 @@
#include "xvmcext.h"
#ifdef HAS_XVMCSHM
#ifndef Lynx
#include <sys/ipc.h>
#include <sys/types.h>
#include <sys/shm.h>
#else
#include <ipc.h>
#include <shm.h>
#endif /* Lynx */
#endif /* HAS_XVMCSHM */

View file

@ -94,7 +94,9 @@ libXi_la_SOURCES = \
ungrdevk.h \
warpdevp.c \
warpdevp.h \
xiselev.c \
xiselev.h
xiproperty.c \
xiproperty.h \
xiselev.c \
xiselev.h
EXTRA_DIST = stubs.c

View file

@ -80,7 +80,7 @@ ProcXChangeDeviceHierarchy(ClientPtr client)
xAnyHierarchyChangeInfo *any;
int required_len = sizeof(xChangeDeviceHierarchyReq);
char n;
int rc;
int rc = Success;
int nchanges = 0;
deviceHierarchyChangedEvent ev;

View file

@ -245,20 +245,9 @@ ProcXChangeDeviceControl(ClientPtr client)
break;
case DEVICE_CORE:
c = (xDeviceCoreCtl *)&stuff[1];
status = ChangeDeviceControl(client, dev, (xDeviceCtl *) c);
if (status == Success) {
dev->coreEvents = c->status;
ret = Success;
} else if (status == DeviceBusy) {
rep.status = DeviceBusy;
ret = Success;
} else {
ret = BadMatch;
}
/* Sorry, no device core switching no more. If you want a device to
* send core events, attach it to a master device */
ret = BadMatch;
break;
case DEVICE_ENABLE:
e = (xDeviceEnableCtl *)&stuff[1];

View file

@ -587,8 +587,6 @@ DeepCopyDeviceClasses(DeviceIntPtr from, DeviceIntPtr to)
if (from->button)
{
int i;
DeviceIntPtr sd;
if (!to->button)
{
classes = dixLookupPrivate(&to->devPrivates,
@ -603,20 +601,6 @@ DeepCopyDeviceClasses(DeviceIntPtr from, DeviceIntPtr to)
classes->button = NULL;
}
to->button->buttonsDown = 0;
memset(to->button->down, 0, MAP_LENGTH);
/* merge button states from all attached devices */
for (sd = inputInfo.devices; sd; sd = sd->next)
{
if (sd->isMaster || sd->u.master != to)
continue;
for (i = 0; i < MAP_LENGTH; i++)
{
to->button->down[i] += sd->button->down[i];
to->button->buttonsDown++;
}
}
#ifdef XKB
if (from->button->xkb_acts)
{
@ -923,8 +907,10 @@ UpdateDeviceState(DeviceIntPtr device, xEvent* xE, int count)
if (!b)
return DONT_PROCESS;
if (b->down[key]++ > 0)
kptr = &b->down[key >> 3];
if ((*kptr & bit) != 0)
return DONT_PROCESS;
*kptr |= bit;
if (device->valuator)
device->valuator->motionHintWindow = NullWindow;
b->buttonsDown++;
@ -938,10 +924,25 @@ UpdateDeviceState(DeviceIntPtr device, xEvent* xE, int count)
if (!b)
return DONT_PROCESS;
if (b->down[key] == 0)
return DONT_PROCESS;
if (--b->down[key] > 0)
kptr = &b->down[key>>3];
if (!(*kptr & bit))
return DONT_PROCESS;
if (device->isMaster) {
DeviceIntPtr sd;
/*
* Leave the button down if any slave has the
* button still down. Note that this depends on the
* event being delivered through the slave first
*/
for (sd = inputInfo.devices; sd; sd = sd->next) {
if (sd->isMaster || sd->u.master != device)
continue;
if ((sd->button->down[key>>3] & bit) != 0)
return DONT_PROCESS;
}
}
*kptr &= ~bit;
if (device->valuator)
device->valuator->motionHintWindow = NullWindow;
if (b->buttonsDown >= 1 && !--b->buttonsDown)
@ -1066,9 +1067,11 @@ ProcessOtherEvent(xEventPtr xE, DeviceIntPtr device, int count)
(key == device->deviceGrab.activatingKey))
deactivateDeviceGrab = TRUE;
} else if (xE->u.u.type == DeviceButtonPress) {
xE->u.u.detail = key;
if (xE->u.u.detail == 0)
xE->u.u.detail = b->map[key];
if (xE->u.u.detail == 0) {
xE->u.u.detail = key;
return;
}
if (!grab && CheckDeviceGrabs(device, xE, 0, count))
{
/* if a passive grab was activated, the event has been sent
@ -1077,9 +1080,11 @@ ProcessOtherEvent(xEventPtr xE, DeviceIntPtr device, int count)
}
} else if (xE->u.u.type == DeviceButtonRelease) {
xE->u.u.detail = key;
if (xE->u.u.detail == 0)
xE->u.u.detail = b->map[key];
if (xE->u.u.detail == 0) {
xE->u.u.detail = key;
return;
}
if (!b->state && device->deviceGrab.fromPassiveGrab)
deactivateDeviceGrab = TRUE;
}
@ -1094,6 +1099,7 @@ ProcessOtherEvent(xEventPtr xE, DeviceIntPtr device, int count)
if (deactivateDeviceGrab == TRUE)
(*device->deviceGrab.DeactivateGrab) (device);
xE->u.u.detail = key;
}
_X_EXPORT int
@ -1148,9 +1154,11 @@ FixDeviceStateNotify(DeviceIntPtr dev, deviceStateNotify * ev, KeyClassPtr k,
ev->num_valuators = 0;
if (b) {
int i;
ev->classes_reported |= (1 << ButtonClass);
ev->num_buttons = b->numButtons;
memmove((char *)&ev->buttons[0], (char *)b->down, 4);
for (i = 0; i < 32; i++)
SetBitIf(ev->buttons, b->down, i);
} else if (k) {
ev->classes_reported |= (1 << KeyClass);
ev->num_keys = k->curKeySyms.maxKeyCode - k->curKeySyms.minKeyCode;
@ -1265,11 +1273,13 @@ DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail,
first += 3;
nval -= 3;
if (nbuttons > 32) {
int i;
(ev - 1)->deviceid |= MORE_EVENTS;
bev = (deviceButtonStateNotify *) ev++;
bev->type = DeviceButtonStateNotify;
bev->deviceid = dev->id;
memmove((char *)&bev->buttons[0], (char *)&b->down[4], 28);
for (i = 32; i < MAP_LENGTH; i++)
SetBitIf(bev->buttons, b->down, i);
}
if (nval > 0) {
(ev - 1)->deviceid |= MORE_EVENTS;
@ -1687,7 +1697,7 @@ SetButtonMapping(ClientPtr client, DeviceIntPtr dev, int nElts, BYTE * map)
if (BadDeviceMap(&map[0], nElts, 1, 255, &client->errorValue))
return BadValue;
for (i = 0; i < nElts; i++)
if ((b->map[i + 1] != map[i]) && BitIsOn(b->down, i + 1))
if ((b->map[i + 1] != map[i]) && (b->down[i + 1]))
return MappingBusy;
for (i = 0; i < nElts; i++)
b->map[i + 1] = map[i];

View file

@ -175,7 +175,7 @@ ProcXExtendedGrabDevice(ClientPtr client)
(XGenericEventMask*)(((XEventClass*)&stuff[1]) + stuff->event_count);
gemasks = xcalloc(1, sizeof(GenericMaskRec));
gemasks->client = client;
gemasks->resource = FakeClientID(client->index);
gemasks->next = NULL;
gemasks->eventMask[xgeMask->extension & 0x7F] = xgeMask->evmask;
@ -184,16 +184,11 @@ ProcXExtendedGrabDevice(ClientPtr client)
gemasks->eventMask[xgeMask->extension & 0x7F]= xgeMask->evmask;
}
ExtGrabDevice(client, dev, stuff->device_mode,
grab_window, confineTo, time, stuff->owner_events,
cursor, tmp[stuff->deviceid].mask,
gemasks);
if (rc != Success) {
errval = 0;
goto cleanup;
}
rep.status = ExtGrabDevice(client, dev, stuff->device_mode,
grab_window, confineTo, time,
stuff->owner_events, cursor,
tmp[stuff->deviceid].mask,
gemasks);
cleanup:
if (gemasks)

View file

@ -122,6 +122,8 @@ SOFTWARE.
#include "ungrdevk.h"
#include "warpdevp.h"
#include "xiselev.h"
#include "xiproperty.c"
#include "xiproperty.h"
static Mask lastExtEventMask = 1;
@ -217,7 +219,13 @@ static int (*ProcIVector[])(ClientPtr) = {
ProcXSetClientPointer, /* 42 */
ProcXGetClientPointer, /* 43 */
ProcXiSelectEvent, /* 44 */
ProcXExtendedGrabDevice /* 45 */
ProcXExtendedGrabDevice, /* 45 */
ProcXListDeviceProperties, /* 46 */
ProcXQueryDeviceProperty, /* 47 */
ProcXConfigureDeviceProperty, /* 48 */
ProcXChangeDeviceProperty, /* 49 */
ProcXDeleteDeviceProperty, /* 50 */
ProcXGetDeviceProperty /* 51 */
};
/* For swapped clients */
@ -267,7 +275,13 @@ static int (*SProcIVector[])(ClientPtr) = {
SProcXSetClientPointer, /* 42 */
SProcXGetClientPointer, /* 43 */
SProcXiSelectEvent, /* 44 */
SProcXExtendedGrabDevice /* 45 */
SProcXExtendedGrabDevice, /* 45 */
SProcXListDeviceProperties, /* 46 */
SProcXQueryDeviceProperty, /* 47 */
SProcXConfigureDeviceProperty, /* 48 */
SProcXChangeDeviceProperty, /* 49 */
SProcXDeleteDeviceProperty, /* 50 */
SProcXGetDeviceProperty /* 51 */
};
/*****************************************************************
@ -1127,6 +1141,7 @@ XInputExtensionInit(void)
IEventBase = extEntry->eventBase;
AllExtensionVersions[IReqCode - 128] = thisversion;
MakeDeviceTypeAtoms();
XIInitKnownProperties();
RT_INPUTCLIENT = CreateNewResourceType((DeleteType) InputClientGone);
RegisterResourceName(RT_INPUTCLIENT, "INPUTCLIENT");
FixExtensionEvents(extEntry);

View file

@ -95,7 +95,7 @@ ProcXGetDeviceMotionEvents(ClientPtr client)
INT32 *coords = NULL, *bufptr;
xGetDeviceMotionEventsReply rep;
unsigned long i;
int rc, num_events, axes, size = 0, tsize;
int rc, num_events, axes, size = 0;
unsigned long nEvents;
DeviceIntPtr dev;
TimeStamp start, stop;

View file

@ -119,7 +119,7 @@ ProcXQueryDeviceState(ClientPtr client)
total_length += (sizeof(xValuatorState) + (v->numAxes * sizeof(int)));
num_classes++;
}
buf = (char *)xalloc(total_length);
buf = (char *)xcalloc(total_length, 1);
if (!buf)
return BadAlloc;
savbuf = buf;
@ -139,8 +139,8 @@ ProcXQueryDeviceState(ClientPtr client)
tb->class = ButtonClass;
tb->length = sizeof(xButtonState);
tb->num_buttons = b->numButtons;
for (i = 0; i < 32; i++)
tb->buttons[i] = b->down[i];
for (i = 0; i < MAP_LENGTH; i++)
SetBitIf(tb->buttons, b->down, i);
buf += sizeof(xButtonState);
}

View file

@ -106,10 +106,10 @@ HandleDevicePresenceMask(ClientPtr client, WindowPtr win,
if (mask == 0)
return Success;
/* We always only use mksidx = 0 for events not bound to
/* We always only use mksidx = MAX_DEVICES for events not bound to
* devices */
if (AddExtensionClient (win, client, mask, 0) != Success)
if (AddExtensionClient (win, client, mask, MAX_DEVICES) != Success)
return BadAlloc;
RecalculateDeviceDeliverableEvents(win);

882
Xi/xiproperty.c Normal file
View file

@ -0,0 +1,882 @@
/*
* Copyright © 2006 Keith Packard
* Copyright © 2008 Peter Hutterer
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WAXIANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WAXIANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS 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.
*
*/
/* This code is a modified version of randr/rrproperty.c */
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "dix.h"
#include "inputstr.h"
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exglobals.h"
#include "exevents.h"
#include "swaprep.h"
#include "xiproperty.h"
/**
* Properties used or alloced from inside the server.
*/
static struct dev_properties
{
Atom type;
char *name;
} dev_properties[] = {
{0, XI_PROP_ENABLED}
};
static long XIPropHandlerID = 1;
/**
* Return the type assigned to the specified atom or 0 if the atom isn't known
* to the DIX.
*/
_X_EXPORT Atom
XIGetKnownProperty(char *name)
{
int i;
for (i = 0; i < (sizeof(dev_properties)/sizeof(struct dev_properties)); i++)
{
if (strcmp(name, dev_properties[i].name) == 0)
return dev_properties[i].type;
}
return 0;
}
/**
* Init those properties that are allocated by the server and most likely used
* by the DIX or the DDX.
*/
void
XIInitKnownProperties(void)
{
int i;
for (i = 0; i < (sizeof(dev_properties)/sizeof(struct dev_properties)); i++)
{
dev_properties[i].type =
MakeAtom(dev_properties[i].name,
strlen(dev_properties[i].name),
TRUE);
}
}
/* Registers a new property handler on the given device and returns a unique
* identifier for this handler. This identifier is required to unregister the
* property handler again.
* @return The handler's identifier or 0 if an error occured.
*/
long
XIRegisterPropertyHandler(DeviceIntPtr dev,
Bool (*SetProperty) (DeviceIntPtr dev,
Atom property,
XIPropertyValuePtr prop),
Bool (*GetProperty) (DeviceIntPtr dev,
Atom property))
{
XIPropertyHandlerPtr new_handler;
new_handler = xcalloc(1, sizeof(XIPropertyHandler));
if (!new_handler)
return 0;
new_handler->id = XIPropHandlerID++;
new_handler->SetProperty = SetProperty;
new_handler->GetProperty = GetProperty;
new_handler->next = dev->properties.handlers;
dev->properties.handlers = new_handler;
return new_handler->id;
}
void
XIUnRegisterPropertyHandler(DeviceIntPtr dev, long id)
{
XIPropertyHandlerPtr curr, prev = NULL;
curr = dev->properties.handlers;
while(curr && curr->id != id)
{
prev = curr;
curr = curr->next;
}
if (!curr)
return;
if (!prev) /* first one */
dev->properties.handlers = curr->next;
else
prev->next = curr->next;
xfree(curr);
}
static void
XIInitDevicePropertyValue (XIPropertyValuePtr property_value)
{
property_value->type = None;
property_value->format = 0;
property_value->size = 0;
property_value->data = NULL;
}
static XIPropertyPtr
XICreateDeviceProperty (Atom property)
{
XIPropertyPtr prop;
prop = (XIPropertyPtr)xalloc(sizeof(XIPropertyRec));
if (!prop)
return NULL;
prop->next = NULL;
prop->propertyName = property;
prop->is_pending = FALSE;
prop->range = FALSE;
prop->fromClient = FALSE;
prop->immutable = FALSE;
prop->num_valid = 0;
prop->valid_values = NULL;
XIInitDevicePropertyValue (&prop->current);
XIInitDevicePropertyValue (&prop->pending);
return prop;
}
static void
XIDestroyDeviceProperty (XIPropertyPtr prop)
{
if (prop->valid_values)
xfree (prop->valid_values);
if (prop->current.data)
xfree(prop->current.data);
if (prop->pending.data)
xfree(prop->pending.data);
xfree(prop);
}
/* This function destroys all of the device's property-related stuff,
* including removing all device handlers.
* DO NOT CALL FROM THE DRIVER.
*/
void
XIDeleteAllDeviceProperties (DeviceIntPtr device)
{
XIPropertyPtr prop, next;
XIPropertyHandlerPtr curr_handler, next_handler;
devicePropertyNotifyEvent event;
for (prop = device->properties.properties; prop; prop = next)
{
next = prop->next;
event.type = GenericEvent;
event.extension = IReqCode;
event.evtype = XI_DevicePropertyNotify;
event.length = 0;
event.deviceid = device->id;
event.state = PropertyDelete;
event.atom = prop->propertyName;
event.time = currentTime.milliseconds;
SendEventToAllWindows(device, XI_DevicePropertyNotifyMask,
(xEvent*)&event, 1);
XIDestroyDeviceProperty(prop);
}
/* Now free all handlers */
curr_handler = device->properties.handlers;
while(curr_handler)
{
next_handler = curr_handler->next;
xfree(curr_handler);
curr_handler = next_handler;
}
}
int
XIDeleteDeviceProperty (DeviceIntPtr device, Atom property, Bool fromClient)
{
XIPropertyPtr prop, *prev;
devicePropertyNotifyEvent event;
for (prev = &device->properties.properties; (prop = *prev); prev = &(prop->next))
if (prop->propertyName == property)
break;
if (!prop->fromClient && fromClient)
return BadAtom;
if (prop)
{
*prev = prop->next;
event.type = GenericEvent;
event.extension = IReqCode;
event.length = 0;
event.evtype = XI_DevicePropertyNotify;
event.deviceid = device->id;
event.state = PropertyDelete;
event.atom = prop->propertyName;
event.time = currentTime.milliseconds;
SendEventToAllWindows(device, XI_DevicePropertyNotifyMask,
(xEvent*)&event, 1);
XIDestroyDeviceProperty (prop);
}
return Success;
}
int
XIChangeDeviceProperty (DeviceIntPtr dev, Atom property, Atom type,
int format, int mode, unsigned long len,
pointer value, Bool sendevent, Bool pending,
Bool fromClient)
{
XIPropertyPtr prop;
devicePropertyNotifyEvent event;
int size_in_bytes;
int total_size;
unsigned long total_len;
XIPropertyValuePtr prop_value;
XIPropertyValueRec new_value;
Bool add = FALSE;
size_in_bytes = format >> 3;
/* first see if property already exists */
prop = XIQueryDeviceProperty (dev, property);
if (!prop) /* just add to list */
{
prop = XICreateDeviceProperty (property);
if (!prop)
return(BadAlloc);
prop->fromClient = fromClient;
add = TRUE;
mode = PropModeReplace;
}
if (pending && prop->is_pending)
prop_value = &prop->pending;
else
prop_value = &prop->current;
/* To append or prepend to a property the request format and type
must match those of the already defined property. The
existing format and type are irrelevant when using the mode
"PropModeReplace" since they will be written over. */
if ((format != prop_value->format) && (mode != PropModeReplace))
return(BadMatch);
if ((prop_value->type != type) && (mode != PropModeReplace))
return(BadMatch);
new_value = *prop_value;
if (mode == PropModeReplace)
total_len = len;
else
total_len = prop_value->size + len;
if (mode == PropModeReplace || len > 0)
{
pointer new_data = NULL, old_data = NULL;
total_size = total_len * size_in_bytes;
new_value.data = (pointer)xalloc (total_size);
if (!new_value.data && total_size)
{
if (add)
XIDestroyDeviceProperty (prop);
return BadAlloc;
}
new_value.size = len;
new_value.type = type;
new_value.format = format;
switch (mode) {
case PropModeReplace:
new_data = new_value.data;
old_data = NULL;
break;
case PropModeAppend:
new_data = (pointer) (((char *) new_value.data) +
(prop_value->size * size_in_bytes));
old_data = new_value.data;
break;
case PropModePrepend:
new_data = new_value.data;
old_data = (pointer) (((char *) new_value.data) +
(prop_value->size * size_in_bytes));
break;
}
if (new_data)
memcpy ((char *) new_data, (char *) value, len * size_in_bytes);
if (old_data)
memcpy ((char *) old_data, (char *) prop_value->data,
prop_value->size * size_in_bytes);
/* We must set pendingProperties TRUE before we commit to the driver,
we're in a single thread after all
*/
if (pending && prop->is_pending)
dev->properties.pendingProperties = TRUE;
if (pending && dev->properties.handlers)
{
XIPropertyHandlerPtr handler = dev->properties.handlers;
while(handler)
{
if (handler->SetProperty &&
!handler->SetProperty(dev, prop->propertyName, &new_value))
{
if (new_value.data)
xfree (new_value.data);
return (BadValue);
}
handler = handler->next;
}
}
if (prop_value->data)
xfree (prop_value->data);
*prop_value = new_value;
}
else if (len == 0)
{
/* do nothing */
}
if (add)
{
prop->next = dev->properties.properties;
dev->properties.properties = prop;
}
if (sendevent)
{
event.type = GenericEvent;
event.extension = IReqCode;
event.length = 0;
event.evtype = XI_DevicePropertyNotify;
event.deviceid = dev->id;
event.state = PropertyNewValue;
event.atom = prop->propertyName;
event.time = currentTime.milliseconds;
SendEventToAllWindows(dev, XI_DevicePropertyNotifyMask,
(xEvent*)&event, 1);
}
return(Success);
}
XIPropertyPtr
XIQueryDeviceProperty (DeviceIntPtr dev, Atom property)
{
XIPropertyPtr prop;
for (prop = dev->properties.properties; prop; prop = prop->next)
if (prop->propertyName == property)
return prop;
return NULL;
}
XIPropertyValuePtr
XIGetDeviceProperty (DeviceIntPtr dev, Atom property, Bool pending)
{
XIPropertyPtr prop = XIQueryDeviceProperty (dev, property);
if (!prop)
return NULL;
if (pending && prop->is_pending)
return &prop->pending;
else {
/* If we can, try to update the property value first */
if (dev->properties.handlers)
{
XIPropertyHandlerPtr handler = dev->properties.handlers;
while(handler)
{
if (handler->GetProperty)
handler->GetProperty(dev, prop->propertyName);
handler = handler->next;
}
}
return &prop->current;
}
}
int
XIConfigureDeviceProperty (DeviceIntPtr dev, Atom property,
Bool pending, Bool range, Bool immutable,
int num_values, INT32 *values)
{
XIPropertyPtr prop = XIQueryDeviceProperty (dev, property);
Bool add = FALSE;
INT32 *new_values;
if (!prop)
{
prop = XICreateDeviceProperty (property);
if (!prop)
return(BadAlloc);
add = TRUE;
} else if (prop->immutable && !immutable)
return(BadAccess);
/*
* ranges must have even number of values
*/
if (range && (num_values & 1))
return BadMatch;
new_values = xalloc (num_values * sizeof (INT32));
if (!new_values && num_values)
return BadAlloc;
if (num_values)
memcpy (new_values, values, num_values * sizeof (INT32));
/*
* Property moving from pending to non-pending
* loses any pending values
*/
if (prop->is_pending && !pending)
{
if (prop->pending.data)
xfree (prop->pending.data);
XIInitDevicePropertyValue (&prop->pending);
}
prop->is_pending = pending;
prop->range = range;
prop->immutable = immutable;
prop->num_valid = num_values;
if (prop->valid_values)
xfree (prop->valid_values);
prop->valid_values = new_values;
if (add) {
prop->next = dev->properties.properties;
dev->properties.properties = prop;
}
return Success;
}
int
ProcXListDeviceProperties (ClientPtr client)
{
Atom *pAtoms = NULL, *temppAtoms;
xListDevicePropertiesReply rep;
int numProps = 0;
DeviceIntPtr dev;
XIPropertyPtr prop;
int rc = Success;
REQUEST(xListDevicePropertiesReq);
REQUEST_SIZE_MATCH(xListDevicePropertiesReq);
rc = dixLookupDevice (&dev, stuff->deviceid, client, DixReadAccess);
if (rc != Success)
return rc;
for (prop = dev->properties.properties; prop; prop = prop->next)
numProps++;
if (numProps)
if(!(pAtoms = (Atom *)xalloc(numProps * sizeof(Atom))))
return(BadAlloc);
rep.repType = X_Reply;
rep.RepType = X_ListDeviceProperties;
rep.length = (numProps * sizeof(Atom)) >> 2;
rep.sequenceNumber = client->sequence;
rep.nAtoms = numProps;
if (client->swapped)
{
int n;
swaps (&rep.sequenceNumber, n);
swapl (&rep.length, n);
}
temppAtoms = pAtoms;
for (prop = dev->properties.properties; prop; prop = prop->next)
*temppAtoms++ = prop->propertyName;
WriteReplyToClient(client, sizeof(xListDevicePropertiesReply), &rep);
if (numProps)
{
client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write;
WriteSwappedDataToClient(client, numProps * sizeof(Atom), pAtoms);
xfree(pAtoms);
}
return rc;
}
int
ProcXQueryDeviceProperty (ClientPtr client)
{
REQUEST(xQueryDevicePropertyReq);
xQueryDevicePropertyReply rep;
DeviceIntPtr dev;
XIPropertyPtr prop;
int rc;
REQUEST_SIZE_MATCH(xQueryDevicePropertyReq);
rc = dixLookupDevice (&dev, stuff->deviceid, client, DixReadAccess);
if (rc != Success)
return rc;
prop = XIQueryDeviceProperty (dev, stuff->property);
if (!prop)
return BadName;
rep.repType = X_Reply;
rep.length = prop->num_valid;
rep.sequenceNumber = client->sequence;
rep.pending = prop->is_pending;
rep.range = prop->range;
rep.immutable = prop->immutable;
rep.fromClient = prop->fromClient;
if (client->swapped)
{
int n;
swaps (&rep.sequenceNumber, n);
swapl (&rep.length, n);
}
WriteReplyToClient (client, sizeof (xQueryDevicePropertyReply), &rep);
if (prop->num_valid)
{
client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write;
WriteSwappedDataToClient(client, prop->num_valid * sizeof(INT32),
prop->valid_values);
}
return(client->noClientException);
}
int
ProcXConfigureDeviceProperty (ClientPtr client)
{
REQUEST(xConfigureDevicePropertyReq);
DeviceIntPtr dev;
int num_valid;
int rc;
REQUEST_AT_LEAST_SIZE(xConfigureDevicePropertyReq);
rc = dixLookupDevice (&dev, stuff->deviceid, client, DixReadAccess);
if (rc != Success)
return rc;
num_valid = stuff->length - (sizeof (xConfigureDevicePropertyReq) >> 2);
return XIConfigureDeviceProperty (dev, stuff->property,
stuff->pending, stuff->range,
FALSE, num_valid,
(INT32 *) (stuff + 1));
}
int
ProcXChangeDeviceProperty (ClientPtr client)
{
REQUEST(xChangeDevicePropertyReq);
DeviceIntPtr dev;
char format, mode;
unsigned long len;
int sizeInBytes;
int totalSize;
int rc;
REQUEST_AT_LEAST_SIZE(xChangeDevicePropertyReq);
UpdateCurrentTime();
format = stuff->format;
mode = stuff->mode;
if ((mode != PropModeReplace) && (mode != PropModeAppend) &&
(mode != PropModePrepend))
{
client->errorValue = mode;
return BadValue;
}
if ((format != 8) && (format != 16) && (format != 32))
{
client->errorValue = format;
return BadValue;
}
len = stuff->nUnits;
if (len > ((0xffffffff - sizeof(xChangePropertyReq)) >> 2))
return BadLength;
sizeInBytes = format>>3;
totalSize = len * sizeInBytes;
REQUEST_FIXED_SIZE(xChangeDevicePropertyReq, totalSize);
rc = dixLookupDevice (&dev, stuff->deviceid, client, DixWriteAccess);
if (rc != Success)
return rc;
if (!ValidAtom(stuff->property))
{
client->errorValue = stuff->property;
return(BadAtom);
}
if (!ValidAtom(stuff->type))
{
client->errorValue = stuff->type;
return(BadAtom);
}
rc = XIChangeDeviceProperty(dev, stuff->property,
stuff->type, (int)format,
(int)mode, len, (pointer)&stuff[1], TRUE,
TRUE, TRUE);
return rc;
}
int
ProcXDeleteDeviceProperty (ClientPtr client)
{
REQUEST(xDeleteDevicePropertyReq);
DeviceIntPtr dev;
int rc;
REQUEST_SIZE_MATCH(xDeleteDevicePropertyReq);
UpdateCurrentTime();
rc = dixLookupDevice (&dev, stuff->deviceid, client, DixWriteAccess);
if (rc != Success)
return rc;
if (!ValidAtom(stuff->property))
{
client->errorValue = stuff->property;
return (BadAtom);
}
rc = XIDeleteDeviceProperty(dev, stuff->property, TRUE);
return rc;
}
int
ProcXGetDeviceProperty (ClientPtr client)
{
REQUEST(xGetDevicePropertyReq);
XIPropertyPtr prop, *prev;
XIPropertyValuePtr prop_value;
unsigned long n, len, ind;
DeviceIntPtr dev;
xGetDevicePropertyReply reply;
int rc;
REQUEST_SIZE_MATCH(xGetDevicePropertyReq);
if (stuff->delete)
UpdateCurrentTime();
rc = dixLookupDevice (&dev, stuff->deviceid, client,
stuff->delete ? DixWriteAccess :
DixReadAccess);
if (rc != Success)
return rc;
if (!ValidAtom(stuff->property))
{
client->errorValue = stuff->property;
return(BadAtom);
}
if ((stuff->delete != xTrue) && (stuff->delete != xFalse))
{
client->errorValue = stuff->delete;
return(BadValue);
}
if ((stuff->type != AnyPropertyType) && !ValidAtom(stuff->type))
{
client->errorValue = stuff->type;
return(BadAtom);
}
for (prev = &dev->properties.properties; (prop = *prev); prev = &prop->next)
if (prop->propertyName == stuff->property)
break;
reply.repType = X_Reply;
reply.RepType = X_GetDeviceProperty;
reply.sequenceNumber = client->sequence;
reply.deviceid = dev->id;
if (!prop)
{
reply.nItems = 0;
reply.length = 0;
reply.bytesAfter = 0;
reply.propertyType = None;
reply.format = 0;
WriteReplyToClient(client, sizeof(xGetDevicePropertyReply), &reply);
return(client->noClientException);
}
if (prop->immutable && stuff->delete)
return BadAccess;
prop_value = XIGetDeviceProperty(dev, stuff->property, stuff->pending);
if (!prop_value)
return BadAtom;
/* If the request type and actual type don't match. Return the
property information, but not the data. */
if (((stuff->type != prop_value->type) &&
(stuff->type != AnyPropertyType))
)
{
reply.bytesAfter = prop_value->size;
reply.format = prop_value->format;
reply.length = 0;
reply.nItems = 0;
reply.propertyType = prop_value->type;
WriteReplyToClient(client, sizeof(xGetDevicePropertyReply), &reply);
return(client->noClientException);
}
/*
* Return type, format, value to client
*/
n = (prop_value->format/8) * prop_value->size; /* size (bytes) of prop */
ind = stuff->longOffset << 2;
/* If longOffset is invalid such that it causes "len" to
be negative, it's a value error. */
if (n < ind)
{
client->errorValue = stuff->longOffset;
return BadValue;
}
len = min(n - ind, 4 * stuff->longLength);
reply.bytesAfter = n - (ind + len);
reply.format = prop_value->format;
reply.length = (len + 3) >> 2;
if (prop_value->format)
reply.nItems = len / (prop_value->format / 8);
else
reply.nItems = 0;
reply.propertyType = prop_value->type;
if (stuff->delete && (reply.bytesAfter == 0))
{
devicePropertyNotifyEvent event;
event.type = GenericEvent;
event.extension = IReqCode;
event.length = 0;
event.evtype = XI_DevicePropertyNotify;
event.deviceid = dev->id;
event.state = PropertyDelete;
event.atom = prop->propertyName;
event.time = currentTime.milliseconds;
SendEventToAllWindows(dev, XI_DevicePropertyNotifyMask,
(xEvent*)&event, 1);
}
WriteReplyToClient(client, sizeof(xGenericReply), &reply);
if (len)
{
switch (reply.format) {
case 32: client->pSwapReplyFunc = (ReplySwapPtr)CopySwap32Write; break;
case 16: client->pSwapReplyFunc = (ReplySwapPtr)CopySwap16Write; break;
default: client->pSwapReplyFunc = (ReplySwapPtr)WriteToClient; break;
}
WriteSwappedDataToClient(client, len,
(char *)prop_value->data + ind);
}
if (stuff->delete && (reply.bytesAfter == 0))
{ /* delete the Property */
*prev = prop->next;
XIDestroyDeviceProperty (prop);
}
return(client->noClientException);
}
int
SProcXListDeviceProperties (ClientPtr client)
{
REQUEST(xListDevicePropertiesReq);
REQUEST_SIZE_MATCH(xListDevicePropertiesReq);
(void) stuff;
return BadImplementation;
}
int
SProcXQueryDeviceProperty (ClientPtr client)
{
REQUEST(xQueryDevicePropertyReq);
REQUEST_SIZE_MATCH(xQueryDevicePropertyReq);
(void) stuff;
return BadImplementation;
}
int
SProcXConfigureDeviceProperty (ClientPtr client)
{
REQUEST(xConfigureDevicePropertyReq);
REQUEST_SIZE_MATCH(xConfigureDevicePropertyReq);
(void) stuff;
return BadImplementation;
}
int
SProcXChangeDeviceProperty (ClientPtr client)
{
REQUEST(xChangeDevicePropertyReq);
REQUEST_SIZE_MATCH(xChangeDevicePropertyReq);
(void) stuff;
return BadImplementation;
}
int
SProcXDeleteDeviceProperty (ClientPtr client)
{
REQUEST(xDeleteDevicePropertyReq);
REQUEST_SIZE_MATCH(xDeleteDevicePropertyReq);
(void) stuff;
return BadImplementation;
}
int
SProcXGetDeviceProperty (ClientPtr client)
{
REQUEST(xGetDevicePropertyReq);
REQUEST_SIZE_MATCH(xGetDevicePropertyReq);
(void) stuff;
return BadImplementation;
}

45
Xi/xiproperty.h Normal file
View file

@ -0,0 +1,45 @@
/*
* Copyright © 2008 Peter Hutterer
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) 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 AUTHORS OR COPYRIGHT HOLDERS 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.
*
* Author: Peter Hutterer
*/
#ifndef XIPROPERTY_C
#define XIPROPERTY_C
int ProcXListDeviceProperties (ClientPtr client);
int ProcXQueryDeviceProperty (ClientPtr client);
int ProcXConfigureDeviceProperty (ClientPtr client);
int ProcXChangeDeviceProperty (ClientPtr client);
int ProcXDeleteDeviceProperty (ClientPtr client);
int ProcXGetDeviceProperty (ClientPtr client);
int SProcXListDeviceProperties (ClientPtr client);
int SProcXQueryDeviceProperty (ClientPtr client);
int SProcXConfigureDeviceProperty (ClientPtr client);
int SProcXChangeDeviceProperty (ClientPtr client);
int SProcXDeleteDeviceProperty (ClientPtr client);
int SProcXGetDeviceProperty (ClientPtr client);
void XIInitKnownProperties(void);
#endif /* XIPROPERTY_C */

View file

@ -82,6 +82,9 @@ compRedirectWindow (ClientPtr pClient, WindowPtr pWin, int update)
return Success;
}
if (!pWin->parent)
return BadMatch;
/*
* Only one Manual update is allowed
*/

View file

@ -3,7 +3,7 @@ AM_CFLAGS = @DIX_CFLAGS@
noinst_LIBRARIES = libconfig.a
libconfig_a_SOURCES = config.c config-backends.h
if HAVE_DBUS
if CONFIG_NEED_DBUS
AM_CFLAGS += @DBUS_CFLAGS@
libconfig_a_SOURCES += dbus-core.c
endif

View file

@ -27,7 +27,7 @@
#include <dix-config.h>
#endif
#ifdef HAVE_DBUS
#ifdef CONFIG_NEED_DBUS
#include <dbus/dbus.h>
typedef void (*config_dbus_core_connect_hook)(DBusConnection *connection,

View file

@ -262,17 +262,7 @@ device_added(LibHalContext *hal_ctx, const char *udi)
* Since we can't predict the order in which the keys
* arrive, we need to store them.
*/
#ifndef HAVE_STRCASESTR
int psi_key_len = strlen(psi_key);
char *lower_psi_key = xalloc(psi_key_len + 1);
CopyISOLatin1Lowered((unsigned char *) lower_psi_key,
(unsigned char *) psi_key,
psi_key_len);
if ((tmp = strstr(lower_psi_key, "xkb")))
#else
if ((tmp = strcasestr(psi_key, "xkb")))
#endif
{
if (!strcasecmp(&tmp[3], "layout"))
{
@ -301,9 +291,6 @@ device_added(LibHalContext *hal_ctx, const char *udi)
add_option(&options, psi_key + sizeof(LIBHAL_PROP_KEY)-1, tmp_val);
xfree(tmp_val);
}
#ifndef HAVE_STRCASESTR
xfree(lower_psi_key);
#endif
}
} else if (!strncasecmp(psi_key, LIBHAL_XKB_PROP_KEY, sizeof(LIBHAL_XKB_PROP_KEY)-1)){

View file

@ -127,6 +127,7 @@ AC_CHECK_HEADER([sys/endian.h], [HAVE_SYS_ENDIAN_H="yes"], [HAVE_SYS_ENDIAN_H="n
if test "x$HAVE_SYS_ENDIAN_H" = "xyes" ; then
AC_MSG_CHECKING([for __swap16 variant of <sys/endian.h> byteswapping macros])
AC_LINK_IFELSE([AC_LANG_PROGRAM([
#include <sys/types.h>
#include <sys/endian.h>
], [
int a = 1, b;
@ -137,6 +138,7 @@ b = __swap16(a);
AC_MSG_CHECKING([for bswap16 variant of <sys/endian.h> byteswapping macros])
AC_LINK_IFELSE([AC_LANG_PROGRAM([
#include <sys/types.h>
#include <sys/endian.h>
], [
int a = 1, b;
@ -174,19 +176,6 @@ dnl has it in libc), or if libdl is needed to get it.
AC_CHECK_FUNC([dlopen], [],
AC_CHECK_LIB([dl], [dlopen], DLOPEN_LIBS="-ldl"))
case $host_os in
linux*|darwin*)
AC_DEFINE(HAVE_URANDOM, 1, [Has /dev/urandom]) ;;
freebsd*|netbsd*|openbsd*|dragonfly*)
AC_DEFINE(HAVE_URANDOM, 1, [Has /dev/urandom]) ;;
solaris*)
# Solaris 8 with patches, or Solaris 9 or later have /dev/urandom
if test -r /dev/urandom ; then
AC_DEFINE(HAVE_URANDOM, 1, [Has /dev/urandom])
fi ;;
*) ;;
esac
dnl Checks for library functions.
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp strchr strrchr \
@ -262,6 +251,8 @@ AM_CONDITIONAL(FREEBSD_KLDLOAD, [test "x$ac_cv_sys_linker_h" = xyes])
AC_CACHE_CHECK([for SYSV IPC],
ac_cv_sysv_ipc,
[AC_TRY_LINK([
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
],[
{
@ -379,7 +370,7 @@ case $host_os in
AC_DEFINE(PCVT_SUPPORT, 1, [System has PCVT console])
AC_DEFINE(SYSCONS_SUPPORT, 1, [System has syscons console])
DRI=yes
PKG_CHECK_EXISTS([dri2proto >= 1.1 libdrm >= 2.3.1], DRI2=yes, DRI2=no)
PKG_CHECK_EXISTS([dri2proto >= 1.1 libdrm >= 2.3.2], DRI2=yes, DRI2=no)
;;
*netbsd*)
AC_DEFINE(CSRG_BASED, 1, [System is BSD-like])
@ -387,7 +378,7 @@ case $host_os in
AC_DEFINE(PCVT_SUPPORT, 1, [System has PCVT console])
AC_DEFINE(WSCONS_SUPPORT, 1, [System has wscons console])
DRI=yes
PKG_CHECK_EXISTS([dri2proto >= 1.1 libdrm >= 2.3.1], DRI2=yes, DRI2=no)
PKG_CHECK_EXISTS([dri2proto >= 1.1 libdrm >= 2.3.2], DRI2=yes, DRI2=no)
;;
*openbsd*)
AC_DEFINE(CSRG_BASED, 1, [System is BSD-like])
@ -396,7 +387,7 @@ case $host_os in
;;
*linux*)
DRI=yes
PKG_CHECK_EXISTS([dri2proto >= 1.1 libdrm >= 2.3.1], DRI2=yes, DRI2=no)
PKG_CHECK_EXISTS([dri2proto >= 1.1 libdrm >= 2.3.2], DRI2=yes, DRI2=no)
KDRIVE_HW=yes
;;
*solaris*)
@ -422,7 +413,7 @@ VENDOR_MAN_VERSION="Version ${PACKAGE_VERSION}"
VENDOR_NAME="The X.Org Foundation"
VENDOR_NAME_SHORT="X.Org"
RELEASE_DATE="5 September 2007"
RELEASE_DATE="(unreleased)"
VENDOR_WEB="http://wiki.x.org"
m4_ifdef([AS_HELP_STRING], , [m4_define([AS_HELP_STRING], m4_defn([AC_HELP_STRING]))])
@ -503,9 +494,9 @@ AC_ARG_ENABLE(install-libxf86config,
[Install libxf86config (default: disabled)]),
[INSTALL_LIBXF86CONFIG=$enableval],
[INSTALL_LIBXF86CONFIG=no])
AC_ARG_ENABLE(builtin-fonts, AS_HELP_STRING([--enable-builtin-fonts], [Use only built-in fonts (default: use external)]),
AC_ARG_ENABLE(builtin-fonts, AS_HELP_STRING([--enable-builtin-fonts], [Use only built-in fonts (default: yes)]),
[BUILTIN_FONTS=$enableval],
[BUILTIN_FONTS=no])
[BUILTIN_FONTS=yes])
AC_ARG_ENABLE(null-root-cursor, AS_HELP_STRING([--enable-null-root-cursor], [Use an empty root cursor (default: use core cursor)]),
[NULL_ROOT_CURSOR=$enableval],
[NULL_ROOT_CURSOR=no])
@ -529,7 +520,6 @@ AC_ARG_ENABLE(registry, AS_HELP_STRING([--disable-registry], [Build string
AC_ARG_ENABLE(composite, AS_HELP_STRING([--disable-composite], [Build Composite extension (default: enabled)]), [COMPOSITE=$enableval], [COMPOSITE=yes])
AC_ARG_ENABLE(mitshm, AS_HELP_STRING([--disable-shm], [Build SHM extension (default: enabled)]), [MITSHM=$enableval], [MITSHM=yes])
AC_ARG_ENABLE(xres, AS_HELP_STRING([--disable-xres], [Build XRes extension (default: enabled)]), [RES=$enableval], [RES=yes])
AC_ARG_ENABLE(xtrap, AS_HELP_STRING([--disable-xtrap], [Build XTrap extension (default: enabled)]), [XTRAP=$enableval], [XTRAP=yes])
AC_ARG_ENABLE(record, AS_HELP_STRING([--enable-record], [Build Record extension (default: disabled)]), [RECORD=$enableval], [RECORD=no])
AC_ARG_ENABLE(xv, AS_HELP_STRING([--disable-xv], [Build Xv extension (default: enabled)]), [XV=$enableval], [XV=yes])
AC_ARG_ENABLE(xvmc, AS_HELP_STRING([--disable-xvmc], [Build XvMC extension (default: enabled)]), [XVMC=$enableval], [XVMC=yes])
@ -542,7 +532,6 @@ AC_ARG_ENABLE(dri, AS_HELP_STRING([--enable-dri], [Build DRI extensio
AC_ARG_ENABLE(dri2, AS_HELP_STRING([--enable-dri2], [Build DRI2 extension (default: auto)]), [DRI2=$enableval])
AC_ARG_ENABLE(xinerama, AS_HELP_STRING([--disable-xinerama], [Build Xinerama extension (default: enabled)]), [XINERAMA=$enableval], [XINERAMA=yes])
AC_ARG_ENABLE(xf86vidmode, AS_HELP_STRING([--disable-xf86vidmode], [Build XF86VidMode extension (default: auto)]), [XF86VIDMODE=$enableval], [XF86VIDMODE=auto])
AC_ARG_ENABLE(xf86misc, AS_HELP_STRING([--disable-xf86misc], [Build XF86Misc extension (default: auto)]), [XF86MISC=$enableval], [XF86MISC=auto])
AC_ARG_ENABLE(xace, AS_HELP_STRING([--disable-xace], [Build X-ACE extension (default: enabled)]), [XACE=$enableval], [XACE=yes])
AC_ARG_ENABLE(xselinux, AS_HELP_STRING([--disable-xselinux], [Build SELinux extension (default: disabled)]), [XSELINUX=$enableval], [XSELINUX=no])
AC_ARG_ENABLE(xcsecurity, AS_HELP_STRING([--disable-xcsecurity], [Build Security extension (default: disabled)]), [XCSECURITY=$enableval], [XCSECURITY=no])
@ -550,9 +539,8 @@ AC_ARG_ENABLE(xcalibrate, AS_HELP_STRING([--enable-xcalibrate], [Build XCali
AC_ARG_ENABLE(tslib, AS_HELP_STRING([--enable-tslib], [Build kdrive tslib touchscreen support (default: disabled)]), [TSLIB=$enableval], [TSLIB=no])
AC_ARG_ENABLE(xevie, AS_HELP_STRING([--disable-xevie], [Build XEvIE extension (default: enabled)]), [XEVIE=$enableval], [XEVIE=yes])
AC_ARG_ENABLE(multibuffer, AS_HELP_STRING([--enable-multibuffer], [Build Multibuffer extension (default: disabled)]), [MULTIBUFFER=$enableval], [MULTIBUFFER=no])
AC_ARG_ENABLE(fontcache, AS_HELP_STRING([--enable-fontcache], [Build FontCache extension (default: disabled)]), [FONTCACHE=$enableval], [FONTCACHE=no])
AC_ARG_ENABLE(dbe, AS_HELP_STRING([--disable-dbe], [Build DBE extension (default: enabled)]), [DBE=$enableval], [DBE=yes])
AC_ARG_ENABLE(xf86bigfont, AS_HELP_STRING([--disable-xf86bigfont], [Build XF86 Big Font extension (default: enabled)]), [XF86BIGFONT=$enableval], [XF86BIGFONT=auto])
AC_ARG_ENABLE(xf86bigfont, AS_HELP_STRING([--disable-xf86bigfont], [Build XF86 Big Font extension (default: disabled)]), [XF86BIGFONT=$enableval], [XF86BIGFONT=no])
AC_ARG_ENABLE(dpms, AS_HELP_STRING([--disable-dpms], [Build DPMS extension (default: enabled)]), [DPMSExtension=$enableval], [DPMSExtension=yes])
AC_ARG_ENABLE(config-dbus, AS_HELP_STRING([--enable-config-dbus], [Build D-BUS API support (default: no)]), [CONFIG_DBUS_API=$enableval], [CONFIG_DBUS_API=no])
AC_ARG_ENABLE(config-hal, AS_HELP_STRING([--disable-config-hal], [Build HAL support (default: auto)]), [CONFIG_HAL=$enableval], [CONFIG_HAL=auto])
@ -565,8 +553,6 @@ AC_ARG_ENABLE(xvfb, AS_HELP_STRING([--enable-xvfb], [Build Xvfb server
AC_ARG_ENABLE(xnest, AS_HELP_STRING([--enable-xnest], [Build Xnest server (default: auto)]), [XNEST=$enableval], [XNEST=auto])
AC_ARG_ENABLE(xquartz, AS_HELP_STRING([--enable-xquartz], [Build Xquartz server for OS-X (default: auto)]), [XQUARTZ=$enableval], [XQUARTZ=auto])
AC_ARG_ENABLE(xwin, AS_HELP_STRING([--enable-xwin], [Build XWin server (default: auto)]), [XWIN=$enableval], [XWIN=auto])
dnl legacy fb support
AC_ARG_ENABLE(mfb, AS_HELP_STRING([--enable-mfb], [Build legacy mono framebuffer support (default: disable)]), [MFB=$enableval], [MFB=no])
dnl kdrive and its subsystems
AC_ARG_ENABLE(kdrive, AS_HELP_STRING([--enable-kdrive], [Build kdrive servers (default: no)]), [KDRIVE=$enableval], [KDRIVE=no])
AC_ARG_ENABLE(xephyr, AS_HELP_STRING([--enable-xephyr], [Build the kdrive Xephyr server (default: auto)]), [XEPHYR=$enableval], [XEPHYR=auto])
@ -662,8 +648,6 @@ case $host_os in
COMPOSITE=no
DGA=no
DPMSExtension=no
XF86BIGFONT=no
XF86MISC=no
XF86VIDMODE=no
fi
;;
@ -677,14 +661,7 @@ XEXT_LIB='$(top_builddir)/Xext/libXext.la'
XEXTXORG_LIB='$(top_builddir)/Xext/libXextbuiltin.la'
dnl Core modules for most extensions, et al.
# Require updated renderproto for ABI sanity if we're 64-bit.
if test "$ac_cv_sizeof_unsigned_long" = 8; then
RENDERPROTO="[renderproto >= 0.9.3]"
else
RENDERPROTO="renderproto"
fi
REQUIRED_MODULES="[randrproto >= 1.2] $RENDERPROTO [fixesproto >= 4.0] [damageproto >= 1.1] xcmiscproto [xextproto >= 7.0.3] [xproto >= 7.0.13] xtrans [scrnsaverproto >= 1.1] bigreqsproto resourceproto fontsproto [inputproto >= 1.9.99.1] [kbproto >= 1.0.3]"
REQUIRED_MODULES="[randrproto >= 1.2] [renderproto >= 0.9.3] [fixesproto >= 4.0] [damageproto >= 1.1] xcmiscproto [xextproto >= 7.0.3] [xproto >= 7.0.13] xtrans [scrnsaverproto >= 1.1] bigreqsproto resourceproto fontsproto [inputproto >= 1.9.99.1] [kbproto >= 1.0.3]"
REQUIRED_LIBS="xfont xau fontenc [pixman-1 >= 0.9.5]"
dnl HAVE_DBUS is true if we actually have the D-Bus library, whereas
@ -705,7 +682,7 @@ if test "x$CONFIG_DBUS_API" = xyes; then
fi
AC_DEFINE(CONFIG_DBUS_API, 1, [Use the D-Bus input configuration API])
NEED_DBUS="yes"
CONFIG_NEED_DBUS="yes"
fi
AM_CONDITIONAL(CONFIG_DBUS_API, [test "x$CONFIG_DBUS_API" = xyes])
@ -720,13 +697,15 @@ if test "x$CONFIG_HAL" = xyes; then
AC_DEFINE(CONFIG_HAL, 1, [Use the HAL hotplug API])
REQUIRED_LIBS="$REQUIRED_LIBS hal"
NEED_DBUS="yes"
CONFIG_NEED_DBUS="yes"
fi
AM_CONDITIONAL(CONFIG_HAL, [test "x$CONFIG_HAL" = xyes])
if test "x$NEED_DBUS" = xyes; then
if test "x$CONFIG_NEED_DBUS" = xyes; then
REQUIRED_LIBS="$REQUIRED_LIBS dbus-1"
AC_DEFINE(CONFIG_NEED_DBUS, 1, [Use D-Bus for input hotplug])
fi
AM_CONDITIONAL(CONFIG_NEED_DBUS, [test "x$CONFIG_NEED_DBUS" = xyes])
CONFIG_LIB='$(top_builddir)/config/libconfig.a'
AC_MSG_CHECKING([for glibc...])
@ -827,13 +806,6 @@ if test "x$MITSHM" = xyes; then
AC_DEFINE(HAS_SHM, 1, [Support SHM])
fi
AM_CONDITIONAL(XTRAP, [test "x$XTRAP" = xyes])
if test "x$XTRAP" = xyes; then
AC_DEFINE(XTRAP, 1, [Support XTrap extension])
REQUIRED_MODULES="$REQUIRED_MODULES trapproto"
XTRAP_LIB='$(top_builddir)/XTrap/libxtrap.la'
fi
AM_CONDITIONAL(RECORD, [test "x$RECORD" = xyes])
if test "x$RECORD" = xyes; then
AC_DEFINE(XRECORD, 1, [Support Record extension])
@ -883,7 +855,7 @@ if test "x$DRI" = xyes; then
AC_DEFINE(XF86DRI, 1, [Build DRI extension])
PKG_CHECK_MODULES([DRIPROTO], [xf86driproto])
PKG_CHECK_MODULES([LIBDRM], [libdrm >= 2.3.0])
PKG_CHECK_MODULES([GL], [glproto >= 1.4.1 gl >= 7.1.0])
PKG_CHECK_MODULES([GL], [glproto >= 1.4.1 dri >= 7.1.0])
PKG_CHECK_EXISTS(libdrm >= 2.2.0,
[AC_DEFINE([HAVE_LIBDRM_2_2], 1,
[Has version 2.2 (or newer) of the drm library])])
@ -898,7 +870,7 @@ if test "x$DRI2" = xyes; then
# FIXME: Bump the versions once we have releases of these.
AC_DEFINE(DRI2, 1, [Build DRI2 extension])
PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= 1.1])
PKG_CHECK_MODULES([LIBDRM], [libdrm >= 2.3.1])
PKG_CHECK_MODULES([LIBDRM], [libdrm >= 2.3.2])
fi
AM_CONDITIONAL(XINERAMA, [test "x$XINERAMA" = xyes])
@ -946,12 +918,6 @@ if test "x$MULTIBUFFER" = xyes; then
# Requires xextproto which is always required
fi
AM_CONDITIONAL(FONTCACHE, [test "x$FONTCACHE" = xyes])
if test "x$FONTCACHE" = xyes; then
AC_DEFINE(FONTCACHE, 1, [Build FontCache extension])
REQUIRED_MODULES="$REQUIRED_MODULES fontcacheproto"
fi
AM_CONDITIONAL(DBE, [test "x$DBE" = xyes])
if test "x$DBE" = xyes; then
AC_DEFINE(DBE, 1, [Support DBE extension])
@ -970,7 +936,6 @@ fi
if test "x$BUILTIN_FONTS" = xyes; then
AC_DEFINE(BUILTIN_FONTS, 1, [Use only built-in fonts])
AC_DEFINE(NOFONTSERVERACCESS, 1, [Avoid using a font server])
FONTPATH="built-ins"
fi
@ -1019,6 +984,8 @@ AC_CHECK_FUNC(strcasecmp, [], AC_DEFINE([NEED_STRCASECMP], 1,
[Do not have 'strcasecmp'.]))
AC_CHECK_FUNC(strncasecmp, [], AC_DEFINE([NEED_STRNCASECMP], 1,
[Do not have 'strncasecmp'.]))
AC_CHECK_FUNC(strcasestr, [], AC_DEFINE([NEED_STRCASESTR], 1,
[Do not have 'strcasestr'.]))
if test "x$NULL_ROOT_CURSOR" = xyes; then
AC_DEFINE(NULL_ROOT_CURSOR, 1, [Use an empty root cursor])
@ -1083,8 +1050,6 @@ AC_SUBST([VENDOR_NAME_SHORT])
AC_SUBST([VENDOR_RELEASE])
AC_SUBST([VENDOR_MAN_VERSION])
AC_DEFINE(DDXOSINIT, 1, [Use OsVendorInit])
AC_DEFINE(SERVER_LOCK, 1, [Use a lock to prevent multiple servers on a display])
AC_DEFINE(SMART_SCHEDULE, 1, [Include time-based scheduler])
AC_DEFINE(NO_LIBCWRAPPER, 1, [Define to 1 if modules should avoid the libcwrapper])
@ -1114,26 +1079,30 @@ MIEXT_SHADOW_INC='-I$(top_srcdir)/miext/shadow'
MIEXT_SHADOW_LIB='$(top_builddir)/miext/shadow/libshadow.la'
CORE_INCS='-I$(top_srcdir)/include -I$(top_builddir)/include'
PKG_CHECK_MODULES([XSERVERCFLAGS], [$REQUIRED_MODULES $REQUIRED_LIBS])
PKG_CHECK_MODULES([XSERVERLIBS], [$REQUIRED_LIBS])
# OpenSSL used for SHA1 hashing in render/glyph.c, but we don't need all of
# the OpenSSL libraries, just libcrypto
# Some systems have matching functionality in the smaller/simpler libmd
# Builders who want to force a choice can set SHA1_LIB and SHA1_CFLAGS
if test "x$SHA1_LIB" = "x" ; then
AC_CHECK_LIB([md], [SHA1Init], [SHA1_LIB="-lmd"
AC_DEFINE([HAVE_SHA1_IN_LIBMD], [1],
[Define to use libmd SHA1 functions instead of OpenSSL libcrypto])])
AC_CHECK_LIB([md], [SHA1Init], [SHA1_LIB="-lmd"
AC_DEFINE([HAVE_SHA1_IN_LIBMD], [1],
[Use libmd SHA1 functions instead of OpenSSL libcrypto])])
fi
if test "x$SHA1_LIB" = "x" ; then
PKG_CHECK_EXISTS([openssl],
[PKG_CHECK_MODULES([OPENSSL], [openssl],
[OPENSSL_LIB_FLAGS=`$PKG_CONFIG --libs-only-L --libs-only-other openssl`])])
SHA1_LIB="$OPENSSL_LIB_FLAGS -lcrypto"
SHA1_CFLAGS="$OPENSSL_CFLAGS"
PKG_CHECK_EXISTS([OPENSSL], [openssl], [HAVE_OPENSSL_PKC=yes],
[HAVE_OPENSSL_PKC=no])
if test "x$HAVE_OPENSSL_PKC" = xyes; then
REQUIRED_LIBS="$REQUIRED_LIBS openssl"
else
AC_CHECK_LIB([crypto], [SHA1_Init], [SHA1_LIB="-lcrypto"],
[AC_MSG_ERROR([OpenSSL must be installed in order to build the X server.])])
fi
fi
PKG_CHECK_MODULES([XSERVERCFLAGS], [$REQUIRED_MODULES $REQUIRED_LIBS])
PKG_CHECK_MODULES([XSERVERLIBS], [$REQUIRED_LIBS])
# Autotools has some unfortunate issues with library handling. In order to
# get a server to rebuild when a dependency in the tree is changed, it must
# be listed in SERVERNAME_DEPENDENCIES. However, no system libraries may be
@ -1218,8 +1187,8 @@ AC_MSG_RESULT([$XVFB])
AM_CONDITIONAL(XVFB, [test "x$XVFB" = xyes])
if test "x$XVFB" = xyes; then
XVFB_LIBS="$FB_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB"
XVFB_SYS_LIBS="$XVFBMODULES_LIBS"
XVFB_LIBS="$FB_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB"
XVFB_SYS_LIBS="$XVFBMODULES_LIBS $GLX_SYS_LIBS"
AC_SUBST([XVFB_LIBS])
AC_SUBST([XVFB_SYS_LIBS])
fi
@ -1236,8 +1205,8 @@ AC_MSG_RESULT([$XNEST])
AM_CONDITIONAL(XNEST, [test "x$XNEST" = xyes])
if test "x$XNEST" = xyes; then
XNEST_LIBS="$FB_LIB $FIXES_LIB $MI_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $DIX_LIB $OS_LIB $CONFIG_LIB"
XNEST_SYS_LIBS="$XNESTMODULES_LIBS"
XNEST_LIBS="$FB_LIB $FIXES_LIB $MI_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $DIX_LIB $OS_LIB $CONFIG_LIB"
XNEST_SYS_LIBS="$XNESTMODULES_LIBS $GLX_SYS_LIBS"
AC_SUBST([XNEST_LIBS])
AC_SUBST([XNEST_SYS_LIBS])
fi
@ -1361,8 +1330,6 @@ if test "x$XORG" = xyes; then
;;
alpha*)
linux_alpha=yes
XORG_OS_PCI="axp"
xorg_bus_linuxpci="no"
;;
i*86|amd64*|x86_64*)
linux_acpi="yes"
@ -1488,15 +1455,6 @@ if test "x$XORG" = xyes; then
AC_DEFINE(XFreeXDGA, 1, [Build XDGA support])
fi
if test "x$XF86MISC" = xauto; then
PKG_CHECK_MODULES(XF86MISC, xf86miscproto, [XF86MISC=yes], [XF86MISC=no])
fi
if test "x$XF86MISC" = xyes; then
XORG_MODULES="$XORG_MODULES xf86miscproto"
PKG_CHECK_MODULES(XF86MISC, xf86miscproto)
AC_DEFINE(XF86MISC, 1, [Support XFree86 miscellaneous extensions])
fi
if test "x$XF86VIDMODE" = xauto; then
PKG_CHECK_MODULES(XF86VIDMODE, xf86vidmodeproto, [XF86VIDMODE=yes], [XF86VIDMODE=no])
fi
@ -1586,18 +1544,8 @@ AM_CONDITIONAL([LNXACPI], [test "x$linux_acpi" = xyes])
AM_CONDITIONAL([SOLARIS_USL_CONSOLE], [test "x$solaris_usl_console" = xyes])
AM_CONDITIONAL([SOLARIS_ASM_INLINE], [test "x$solaris_asm_inline" = xyes])
AM_CONDITIONAL([DGA], [test "x$DGA" = xyes])
AM_CONDITIONAL([XF86MISC], [test "x$XF86MISC" = xyes])
AM_CONDITIONAL([XF86VIDMODE], [test "x$XF86VIDMODE" = xyes])
dnl legacy fb support
test "x$MFB" = xauto && MFB="$XORG"
AM_CONDITIONAL(MFB, [test "x$MFB" = xyes])
if test "x$MFB" = xyes; then
if test "x$XORG" != xyes; then
AC_MSG_ERROR([legacy fb support requires the Xorg server])
fi
fi
dnl XWin DDX
AC_MSG_CHECKING([whether to build XWin DDX])
@ -1639,19 +1587,12 @@ if test "x$XWIN" = xyes; then
AC_DEFINE(CYGMULTIWINDOW_DEBUG, 1, [Debug window manager])
fi
AC_DEFINE(DDXOSINIT, 1, [Use OsVendorInit])
AC_DEFINE(DDXTIME, 1, [Use GetTimeInMillis])
AC_DEFINE(DDXOSFATALERROR, 1, [Use OsVendorFatalError])
AC_DEFINE(DDXOSVERRORF, 1, [Use OsVendorVErrorF])
AC_DEFINE(DDXBEFORERESET, 1, [Use ddxBeforeReset ])
if test "x$XF86VIDMODE" = xyes; then
AC_MSG_NOTICE([Disabling XF86VidMode extension])
XF86VIDMODE=no
fi
if test "x$XF86MISC" = xyes; then
AC_MSG_NOTICE([Disabling XF86Misc extension])
XF86MISC=no
fi
if test "x$COMPOSITE" = xyes; then
AC_MSG_NOTICE([Disabling Composite extension])
COMPOSITE=no
@ -1673,7 +1614,7 @@ if test "x$XQUARTZ" = xyes; then
AC_DEFINE(ROOTLESS,1,[Build Rootless code])
DARWIN_GLX_LIBS='$(top_builddir)/hw/xquartz/GL/libCGLCore.la $(top_builddir)/glx/libglx.la'
DARWIN_LIBS="$MI_LIB $OS_LIB $DIX_LIB $FB_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $XPSTUBS_LIB $DARWIN_GLX_LIBS"
DARWIN_LIBS="$MI_LIB $OS_LIB $DIX_LIB $FB_LIB $FIXES_LIB $XEXT_LIB $CONFIG_LIB $DBE_LIB $RECORD_LIB $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $XPSTUBS_LIB $DARWIN_GLX_LIBS"
AC_SUBST([DARWIN_LIBS])
AC_CHECK_LIB([Xplugin],[xp_init],[:])
@ -1715,9 +1656,9 @@ if test "x$DMX" = xyes; then
AC_MSG_ERROR([Xdmx build explicitly requested, but required
modules not found.])
fi
DMX_INCLUDES="$XEXT_INC $RENDER_INC $XTRAP_INC $RECORD_INC"
DMX_INCLUDES="$XEXT_INC $RENDER_INC $RECORD_INC"
XDMX_CFLAGS="$DMXMODULES_CFLAGS"
XDMX_LIBS="$XEXT_LIB $FB_LIB $CONFIG_LIB $RENDER_LIB $XTRAP_LIB $RECORD_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $MIEXT_SHADOW_LIB $MIEXT_DAMAGE_LIB"
XDMX_LIBS="$XEXT_LIB $FB_LIB $CONFIG_LIB $RENDER_LIB $RECORD_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $MIEXT_SHADOW_LIB $MIEXT_DAMAGE_LIB"
XDMX_SYS_LIBS="$DMXMODULES_LIBS"
AC_SUBST([XDMX_CFLAGS])
AC_SUBST([XDMX_LIBS])
@ -1843,7 +1784,7 @@ if test "$KDRIVE" = yes; then
KDRIVE_CFLAGS="$XSERVER_CFLAGS -DHAVE_KDRIVE_CONFIG_H $TSLIB_CFLAGS"
KDRIVE_PURE_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $OS_LIB"
KDRIVE_PURE_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $OS_LIB"
KDRIVE_LIB='$(top_builddir)/hw/kdrive/src/libkdrive.a'
case $host_os in
*linux*)
@ -1870,7 +1811,6 @@ AC_SUBST([KDRIVE_LOCAL_LIBS])
AC_SUBST([KDRIVE_LIBS])
AM_CONDITIONAL(KDRIVELINUX, [test "x$KDRIVELINUX" = xyes])
AM_CONDITIONAL(TSLIB, [test "x$HAVE_TSLIB" = xyes])
AM_CONDITIONAL(H3600_TS, false)
AM_CONDITIONAL(KDRIVEVESA, [test "x$KDRIVEVESA" = xyes])
AM_CONDITIONAL(KDRIVEFBDEV, [test "x$XFBDEV" = xyes])
AM_CONDITIONAL(XSDLSERVER, [test x"$XSDL" = xyes])
@ -1901,7 +1841,10 @@ AC_DEFINE_DIR(XKM_OUTPUT_DIR, XKBOUTPUT, [Path to XKB output dir])
AC_SUBST(XKB_COMPILED_DIR)
dnl and the rest of these are generic, so they're in config.h
AC_DEFINE(XResExtension, 1, [Build XRes extension])
dnl
dnl though, thanks to the passing of some significant amount of time, the
dnl above is probably a complete fallacy, and you should not rely on it.
dnl but this is still actually better than imake, honest. -daniels
AC_TRY_COMPILE([
#include <features.h>
@ -1913,20 +1856,13 @@ AC_TRY_COMPILE([
AC_DEFINE_DIR(PROJECTROOT, prefix, [Overall prefix])
dnl xorgconfig CLI configuration utility
if test "x$XORG" = xyes; then
PKG_CHECK_MODULES([XORGCONFIG_DEP], [xkbfile x11])
AC_SUBST(XORGCONFIG_DEP_CFLAGS)
AC_SUBST(XORGCONFIG_DEP_LIBS)
fi
dnl xorgcfg GUI configuration utility
AC_ARG_ENABLE(xorgcfg, AS_HELP_STRING([--enable-xorgcfg],
[Build xorgcfg GUI configuration utility (default: no)]),
[XORGCFG=$enableval],[XORGCFG=no])
if test x$XORGCFG = xyes ; then
PKG_CHECK_MODULES([XORGCFG_DEP],
[xkbui >= 1.0.2 xkbfile xxf86misc xxf86vm xaw7 xmu xt xpm xext x11])
[xkbui >= 1.0.2 xkbfile xxf86vm xaw7 xmu xt xpm xext x11])
XORGCFG_DEP_CFLAGS="$XORGCFG_DEP_CFLAGS"
AC_CHECK_LIB([curses],[waddstr],
[XORGCFG_DEP_LIBS="$XORGCFG_DEP_LIBS -lcurses"; CURSES=yes],
@ -1992,8 +1928,6 @@ dix/Makefile
doc/Makefile
fb/Makefile
record/Makefile
XTrap/Makefile
mfb/Makefile
config/Makefile
mi/Makefile
miext/Makefile
@ -2038,21 +1972,16 @@ hw/xfree86/os-support/bus/Makefile
hw/xfree86/os-support/hurd/Makefile
hw/xfree86/os-support/misc/Makefile
hw/xfree86/os-support/linux/Makefile
hw/xfree86/os-support/lynxos/Makefile
hw/xfree86/os-support/sco/Makefile
hw/xfree86/os-support/solaris/Makefile
hw/xfree86/os-support/sysv/Makefile
hw/xfree86/os-support/usl/Makefile
hw/xfree86/parser/Makefile
hw/xfree86/rac/Makefile
hw/xfree86/ramdac/Makefile
hw/xfree86/shadowfb/Makefile
hw/xfree86/vbe/Makefile
hw/xfree86/vgahw/Makefile
hw/xfree86/x86emu/Makefile
hw/xfree86/xaa/Makefile
hw/xfree86/xf1bpp/Makefile
hw/xfree86/xf4bpp/Makefile
hw/xfree86/xf8_16bpp/Makefile
hw/xfree86/utils/Makefile
hw/xfree86/utils/cvt/Makefile
@ -2060,7 +1989,6 @@ hw/xfree86/utils/gtf/Makefile
hw/xfree86/utils/ioport/Makefile
hw/xfree86/utils/kbd_mode/Makefile
hw/xfree86/utils/xorgcfg/Makefile
hw/xfree86/utils/xorgconfig/Makefile
hw/dmx/config/Makefile
hw/dmx/doc/Makefile
hw/dmx/examples/Makefile

View file

@ -28,6 +28,7 @@ libdix_la_SOURCES = \
pixmap.c \
privates.c \
property.c \
ptrveloc.c \
registry.c \
resource.c \
selection.c \
@ -35,7 +36,8 @@ libdix_la_SOURCES = \
swapreq.c \
tables.c \
window.c \
strcasecmp.c
strcasecmp.c \
strcasestr.c
EXTRA_DIST = buildatoms BuiltInAtoms CHANGES Xserver.d Xserver-dtrace.h.in

View file

@ -57,11 +57,13 @@ SOFTWARE.
#define NEED_EVENTS
#define NEED_REPLIES
#include <X11/Xproto.h>
#include <X11/Xatom.h>
#include "windowstr.h"
#include "inputstr.h"
#include "scrnintstr.h"
#include "cursorstr.h"
#include "dixstruct.h"
#include "ptrveloc.h"
#include "site.h"
#ifndef XKB_IN_SERVER
#define XKB_IN_SERVER
@ -76,12 +78,14 @@ SOFTWARE.
#include "dispatch.h"
#include "swaprep.h"
#include "dixevents.h"
#include "mipointer.h"
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exglobals.h"
#include "exevents.h"
#include "listdev.h" /* for CopySwapXXXClass */
#include "xiproperty.h"
/** @file
* This file handles input device-related stuff.
@ -91,6 +95,30 @@ DevPrivateKey CoreDevicePrivateKey = &CoreDevicePrivateKey;
/* Used to sture classes currently not in use by an MD */
DevPrivateKey UnusedClassesPrivateKey = &UnusedClassesPrivateKey;
/**
* DIX property handler.
*/
static Bool
DeviceSetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop)
{
if (property == XIGetKnownProperty(XI_PROP_ENABLED))
{
if (prop->format != 8 || prop->type != XA_INTEGER || prop->size != 1)
return FALSE;
if ((*((CARD8*)prop->data)) && !dev->enabled)
EnableDevice(dev);
else if (!(*((CARD8*)prop->data)) && dev->enabled)
DisableDevice(dev);
return TRUE;
}
return TRUE;
}
/**
* Create a new input device and init it to sane values. The device is added
* to the server's off_devices list.
@ -170,8 +198,14 @@ AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart)
/* last valuators */
memset(dev->last.valuators, 0, sizeof(dev->last.valuators));
memset(dev->last.remainder, 0, sizeof(dev->last.remainder));
dev->last.numValuators = 0;
/* device properties */
dev->properties.properties = NULL;
dev->properties.pendingProperties = FALSE;
dev->properties.handlers = NULL;
/* security creation/labeling check
*/
if (XaceHook(XACE_DEVICE_ACCESS, client, dev, DixCreateAccess)) {
@ -186,6 +220,11 @@ AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart)
*prev = dev;
dev->next = NULL;
XIChangeDeviceProperty(dev, XIGetKnownProperty(XI_PROP_ENABLED),
XA_INTEGER, 8, PropModeReplace, 1, &dev->enabled,
FALSE, FALSE, FALSE);
XIRegisterPropertyHandler(dev, DeviceSetProperty, NULL);
return dev;
}
@ -257,6 +296,7 @@ EnableDevice(DeviceIntPtr dev)
mieqResizeEvents(evsize);
OsReleaseSignals();
if ((*prev != dev) || !dev->inited ||
((ret = (*dev->deviceProc)(dev, DEVICE_ON)) != Success)) {
ErrorF("[dix] couldn't enable device %d\n", dev->id);
@ -270,11 +310,15 @@ EnableDevice(DeviceIntPtr dev)
*prev = dev;
dev->next = NULL;
XIChangeDeviceProperty(dev, XIGetKnownProperty(XI_PROP_ENABLED),
XA_INTEGER, 8, PropModeReplace, 1, &dev->enabled,
TRUE, FALSE, FALSE);
ev.type = DevicePresenceNotify;
ev.time = currentTime.milliseconds;
ev.devchange = DeviceEnabled;
ev.deviceid = dev->id;
dummyDev.id = 0;
dummyDev.id = MAX_DEVICES;
SendEventToAllWindows(&dummyDev, DevicePresenceNotifyMask,
(xEvent *) &ev, 1);
@ -334,11 +378,15 @@ DisableDevice(DeviceIntPtr dev)
dev->next = inputInfo.off_devices;
inputInfo.off_devices = dev;
XIChangeDeviceProperty(dev, XIGetKnownProperty(XI_PROP_ENABLED),
XA_INTEGER, 8, PropModeReplace, 1, &dev->enabled,
TRUE, FALSE, FALSE);
ev.type = DevicePresenceNotify;
ev.time = currentTime.milliseconds;
ev.devchange = DeviceDisabled;
ev.deviceid = dev->id;
dummyDev.id = 0;
dummyDev.id = MAX_DEVICES;
SendEventToAllWindows(&dummyDev, DevicePresenceNotifyMask,
(xEvent *) &ev, 1);
@ -378,6 +426,7 @@ ActivateDevice(DeviceIntPtr dev)
ev.deviceid = dev->id;
memset(&dummyDev, 0, sizeof(DeviceIntRec));
dummyDev.id = MAX_DEVICES;
SendEventToAllWindows(&dummyDev, DevicePresenceNotifyMask,
(xEvent *) &ev, 1);
@ -768,6 +817,8 @@ CloseDevice(DeviceIntPtr dev)
if (!dev)
return;
XIDeleteAllDeviceProperties(dev);
if (dev->inited)
(void)(*dev->deviceProc)(dev, DEVICE_CLOSE);
@ -775,6 +826,10 @@ CloseDevice(DeviceIntPtr dev)
if (dev->isMaster && dev->spriteInfo->sprite)
screen->DeviceCursorCleanup(dev, screen);
/* free acceleration info */
if(dev->valuator && dev->valuator->accelScheme.AccelCleanupProc)
dev->valuator->accelScheme.AccelCleanupProc(dev);
xfree(dev->name);
classes = (ClassesPtr)&dev->key;
@ -936,7 +991,7 @@ RemoveDevice(DeviceIntPtr dev)
ev.time = currentTime.milliseconds;
ev.devchange = DeviceRemoved;
ev.deviceid = deviceid;
dummyDev.id = 0;
dummyDev.id = MAX_DEVICES;
SendEventToAllWindows(&dummyDev, DevicePresenceNotifyMask,
(xEvent *) &ev, 1);
}
@ -1152,7 +1207,7 @@ InitButtonClassDeviceStruct(DeviceIntPtr dev, int numButtons,
butc->buttonsDown = 0;
butc->state = 0;
butc->motionMask = 0;
bzero((char *)butc->down, MAP_LENGTH);
bzero((char *)butc->down, sizeof(butc->down));
#ifdef XKB
butc->xkb_acts= NULL;
#endif
@ -1186,8 +1241,6 @@ InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes,
valc->mode = mode;
valc->axes = (AxisInfoPtr)(valc + 1);
valc->axisVal = (int *)(valc->axes + numAxes);
valc->dxremaind = 0;
valc->dyremaind = 0;
dev->valuator = valc;
AllocateMotionHistory(dev);
@ -1199,6 +1252,59 @@ InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes,
}
dev->last.numValuators = numAxes;
if(!dev->isMaster) /* master devs do not accelerate */
InitPointerAccelerationScheme(dev, PtrAccelDefault);
return TRUE;
}
/* global list of acceleration schemes */
ValuatorAccelerationRec pointerAccelerationScheme[] = {
{PtrAccelNoOp, NULL, NULL, NULL},
{PtrAccelPredictable, acceleratePointerPredictable, NULL, AccelerationDefaultCleanup},
{PtrAccelClassic, acceleratePointerClassic, NULL, NULL},
{-1, NULL, NULL, NULL} /* terminator */
};
_X_EXPORT Bool
InitPointerAccelerationScheme(DeviceIntPtr dev,
int scheme)
{
int x, i = -1;
void* data = NULL;
ValuatorClassPtr val;
if(dev->isMaster) /* bail out if called for master devs */
return FALSE;
for(x = 0; pointerAccelerationScheme[x].number >= 0; x++) {
if(pointerAccelerationScheme[x].number == scheme){
i = x;
break;
}
}
if(-1 == i)
return FALSE;
/* init scheme-specific data */
switch(scheme){
case PtrAccelPredictable:
{
DeviceVelocityPtr s;
s = (DeviceVelocityPtr)xalloc(sizeof(DeviceVelocityRec));
InitVelocityData(s);
data = s;
break;
}
default:
break;
}
val = dev->valuator;
val->accelScheme = pointerAccelerationScheme[i];
val->accelScheme.accelData = data;
return TRUE;
}
@ -1478,13 +1584,15 @@ SendMappingNotify(DeviceIntPtr pDev, unsigned request, unsigned firstKeyCode,
}
/*
* n-squared algorithm. n < 255 and don't want to copy the whole thing and
* sort it to do the checking. How often is it called? Just being lazy?
* Check if the given buffer contains elements between low (inclusive) and
* high (inclusive) only.
*
* @return TRUE if the device map is invalid, FALSE otherwise.
*/
Bool
BadDeviceMap(BYTE *buff, int length, unsigned low, unsigned high, XID *errval)
{
int i, j;
int i;
for (i = 0; i < length; i++)
if (buff[i]) /* only check non-zero elements */
@ -1494,12 +1602,6 @@ BadDeviceMap(BYTE *buff, int length, unsigned low, unsigned high, XID *errval)
*errval = buff[i];
return TRUE;
}
for (j = i + 1; j < length; j++)
if (buff[i] == buff[j])
{
*errval = buff[i];
return TRUE;
}
}
return FALSE;
}
@ -1733,7 +1835,7 @@ DoSetPointerMapping(ClientPtr client, DeviceIntPtr device, BYTE *map, int n)
if ((dev->coreEvents || dev == inputInfo.pointer) && dev->button) {
for (i = 0; i < n; i++) {
if ((device->button->map[i + 1] != map[i]) &&
BitIsOn(device->button->down, i + 1)) {
device->button->down[i + 1]) {
return MappingBusy;
}
}
@ -1755,6 +1857,7 @@ ProcSetPointerMapping(ClientPtr client)
{
BYTE *map;
int ret;
int i, j;
DeviceIntPtr ptr = PickPointer(client);
xSetPointerMappingReply rep;
REQUEST(xSetPointerMappingReq);
@ -1781,6 +1884,19 @@ ProcSetPointerMapping(ClientPtr client)
if (BadDeviceMap(&map[0], (int)stuff->nElts, 1, 255, &client->errorValue))
return BadValue;
/* core protocol specs don't allow for duplicate mappings. */
for (i = 0; i < stuff->nElts; i++)
{
for (j = i + 1; j < stuff->nElts; j++)
{
if (map[i] && map[i] == map[j])
{
client->errorValue = map[i];
return BadValue;
}
}
}
ret = DoSetPointerMapping(client, ptr, map, stuff->nElts);
if (ret != Success) {
rep.success = ret;

View file

@ -87,7 +87,7 @@ extern FontPtr defaultFont;
static FontPathElementPtr *font_path_elements = (FontPathElementPtr *) 0;
static int num_fpes = 0;
_X_EXPORT FPEFunctions *fpe_functions = (FPEFunctions *) 0;
static FPEFunctions *fpe_functions = (FPEFunctions *) 0;
static int num_fpe_types = 0;
static unsigned char *font_path_string;
@ -97,7 +97,7 @@ static int size_slept_fpes = 0;
static FontPathElementPtr *slept_fpes = (FontPathElementPtr *) 0;
static FontPatternCachePtr patternCache;
_X_EXPORT int
static int
FontToXError(err)
int err;
{
@ -117,6 +117,16 @@ FontToXError(err)
}
}
static int
LoadGlyphs(ClientPtr client, FontPtr pfont, unsigned nchars, int item_size,
unsigned char *data)
{
if (fpe_functions[pfont->fpe->type].load_glyphs)
return (*fpe_functions[pfont->fpe->type].load_glyphs)
(client, pfont, 0, nchars, item_size, data);
else
return Successful;
}
/*
* adding RT_FONT prevents conflict with default cursor font
@ -470,7 +480,7 @@ OpenFont(ClientPtr client, XID fid, Mask flags, unsigned lenfname, char *pfontna
*
* \param value must conform to DeleteType
*/
_X_EXPORT int
int
CloseFont(pointer value, XID fid)
{
int nscr;
@ -1879,16 +1889,6 @@ GetFontPath(ClientPtr client, int *count, int *length, unsigned char **result)
return Success;
}
_X_EXPORT int
LoadGlyphs(ClientPtr client, FontPtr pfont, unsigned nchars, int item_size, unsigned char *data)
{
if (fpe_functions[pfont->fpe->type].load_glyphs)
return (*fpe_functions[pfont->fpe->type].load_glyphs)
(client, pfont, 0, nchars, item_size, data);
else
return Successful;
}
void
DeleteClientFontStuff(ClientPtr client)
{
@ -1908,23 +1908,12 @@ InitFonts (void)
{
patternCache = MakeFontPatternCache();
#ifndef BUILTIN_FONTS
if (screenInfo.numScreens > screenInfo.numVideoScreens) {
PrinterFontRegisterFpeFunctions();
FontFileCheckRegisterFpeFunctions();
check_fs_register_fpe_functions();
} else
#endif
{
#ifdef BUILTIN_FONTS
BuiltinRegisterFpeFunctions();
BuiltinRegisterFpeFunctions();
#else
FontFileRegisterFpeFunctions();
FontFileRegisterFpeFunctions();
fs_register_fpe_functions();
#endif
#ifndef NOFONTSERVERACCESS
fs_register_fpe_functions();
#endif
}
}
int

View file

@ -422,7 +422,7 @@ static Mask* generic_filters[MAXEXTENSIONS];
static CARD8 criticalEvents[32] =
{
0x7c /* key and button events */
0x7c, 0x30, 0x40 /* key, button, expose, and configure events */
};
#ifdef PANORAMIX
@ -2118,7 +2118,7 @@ DeliverEventsToWindow(DeviceIntPtr pDev, WindowPtr pWin, xEvent
/* Handle generic events */
if (type == GenericEvent)
{
GenericMaskPtr pClient;
GenericMaskPtr gmask;
/* We don't do more than one GenericEvent at a time. */
if (count > 1)
{
@ -2132,16 +2132,16 @@ DeliverEventsToWindow(DeviceIntPtr pDev, WindowPtr pWin, xEvent
return 0;
/* run through all clients, deliver event */
for (pClient = GECLIENT(pWin); pClient; pClient = pClient->next)
for (gmask = GECLIENT(pWin); gmask; gmask = gmask->next)
{
if (pClient->eventMask[GEEXTIDX(pEvents)] & filter)
if (gmask->eventMask[GEEXTIDX(pEvents)] & filter)
{
if (XaceHook(XACE_RECEIVE_ACCESS, pClient->client, pWin,
if (XaceHook(XACE_RECEIVE_ACCESS, rClient(gmask), pWin,
pEvents, count))
/* do nothing */;
else if (TryClientEvents(pClient->client, pDev,
else if (TryClientEvents(rClient(gmask), pDev,
pEvents, count,
pClient->eventMask[GEEXTIDX(pEvents)],
gmask->eventMask[GEEXTIDX(pEvents)],
filter, grab) > 0)
{
deliveries++;
@ -2223,7 +2223,7 @@ DeliverEventsToWindow(DeviceIntPtr pDev, WindowPtr pWin, xEvent
{
GenericClientMasksPtr gemasks = pWin->optional->geMasks;
GenericMaskPtr geclient = gemasks->geClients;
while(geclient && geclient->client != client)
while(geclient && rClient(geclient) != client)
geclient = geclient->next;
if (geclient)
{
@ -3389,7 +3389,7 @@ CheckPassiveGrabsOnWindow(
else
gdev = device;
}
if (gdev)
if (gdev && gdev->key)
xkbi= gdev->key->xkbInfo;
#endif
tempGrab.modifierDevice = grab->modifierDevice;
@ -4077,15 +4077,11 @@ ProcessPointerEvent (xEvent *xE, DeviceIntPtr mouse, int count)
if (xE->u.u.type != MotionNotify)
{
int key;
BYTE *kptr;
int bit;
XE_KBPTR.rootX = pSprite->hot.x;
XE_KBPTR.rootY = pSprite->hot.y;
key = xE->u.u.detail;
kptr = &butc->down[key >> 3];
bit = 1 << (key & 7);
switch (xE->u.u.type)
{
case ButtonPress:
@ -4587,6 +4583,9 @@ DoEnterLeaveEvents(DeviceIntPtr pDev,
WindowPtr toWin,
int mode)
{
if (!IsPointerDevice(pDev))
return;
if (fromWin == toWin)
return;
if (IsParent(fromWin, toWin))
@ -5521,14 +5520,15 @@ InitEvents(void)
FatalError("[dix] Failed to allocate input event list.\n");
}
/**
* This function is deprecated! It shouldn't be used anymore. It used to free
* the spriteTraces, but now they are freed when the SpriteRec is freed.
*/
_X_DEPRECATED void
void
CloseDownEvents(void)
{
int len;
EventListPtr list;
len = GetEventList(&list);
while(len--)
xfree(list[len].event);
}
/**
@ -6172,6 +6172,10 @@ WriteEventsToClient(ClientPtr pClient, int count, xEvent *events)
if (events->u.u.type == GenericEvent)
{
eventlength += ((xGenericEvent*)events)->length * 4;
}
if(pClient->swapped)
{
if (eventlength > swapEventLen)
{
swapEventLen = eventlength;
@ -6182,10 +6186,7 @@ WriteEventsToClient(ClientPtr pClient, int count, xEvent *events)
return;
}
}
}
if(pClient->swapped)
{
for(i = 0; i < count; i++)
{
eventFrom = &events[i];
@ -6196,7 +6197,7 @@ WriteEventsToClient(ClientPtr pClient, int count, xEvent *events)
(*EventSwapVector[eventFrom->u.u.type & 0177])
(eventFrom, eventTo);
(void)WriteToClient(pClient, eventlength, (char *)&eventTo);
(void)WriteToClient(pClient, eventlength, (char *)eventTo);
}
}
else

View file

@ -277,7 +277,7 @@ GetMotionHistory(DeviceIntPtr pDev, xTimecoord **buff, unsigned long start,
int size;
int dflt;
AxisInfo from, *to; /* for scaling */
CARD32 *ocbuf, *icbuf; /* pointer to coordinates for copying */
INT32 *ocbuf, *icbuf; /* pointer to coordinates for copying */
INT16 *corebuf;
AxisInfo core_axis = {0};
@ -295,7 +295,7 @@ GetMotionHistory(DeviceIntPtr pDev, xTimecoord **buff, unsigned long start,
*buff = xalloc(size * pDev->valuator->numMotionEvents);
if (!(*buff))
return 0;
obuff = *buff;
obuff = (char *)*buff;
for (i = pDev->valuator->first_motion;
i != pDev->valuator->last_motion;
@ -487,80 +487,6 @@ GetMaximumEventsNum(void) {
}
/* Originally a part of xf86PostMotionEvent; modifies valuators
* in-place. */
static void
acceleratePointer(DeviceIntPtr pDev, int first_valuator, int num_valuators,
int *valuators)
{
float mult = 0.0;
int dx = 0, dy = 0;
int *px = NULL, *py = NULL;
if (!num_valuators || !valuators)
return;
if (first_valuator == 0) {
dx = valuators[0];
px = &valuators[0];
}
if (first_valuator <= 1 && num_valuators >= (2 - first_valuator)) {
dy = valuators[1 - first_valuator];
py = &valuators[1 - first_valuator];
}
if (!dx && !dy)
return;
if (pDev->ptrfeed && pDev->ptrfeed->ctrl.num) {
/* modeled from xf86Events.c */
if (pDev->ptrfeed->ctrl.threshold) {
if ((abs(dx) + abs(dy)) >= pDev->ptrfeed->ctrl.threshold) {
pDev->valuator->dxremaind = ((float)dx *
(float)(pDev->ptrfeed->ctrl.num)) /
(float)(pDev->ptrfeed->ctrl.den) +
pDev->valuator->dxremaind;
if (px) {
*px = (int)pDev->valuator->dxremaind;
pDev->valuator->dxremaind = pDev->valuator->dxremaind -
(float)(*px);
}
pDev->valuator->dyremaind = ((float)dy *
(float)(pDev->ptrfeed->ctrl.num)) /
(float)(pDev->ptrfeed->ctrl.den) +
pDev->valuator->dyremaind;
if (py) {
*py = (int)pDev->valuator->dyremaind;
pDev->valuator->dyremaind = pDev->valuator->dyremaind -
(float)(*py);
}
}
}
else {
mult = pow((float)dx * (float)dx + (float)dy * (float)dy,
((float)(pDev->ptrfeed->ctrl.num) /
(float)(pDev->ptrfeed->ctrl.den) - 1.0) /
2.0) / 2.0;
if (dx) {
pDev->valuator->dxremaind = mult * (float)dx +
pDev->valuator->dxremaind;
*px = (int)pDev->valuator->dxremaind;
pDev->valuator->dxremaind = pDev->valuator->dxremaind -
(float)(*px);
}
if (dy) {
pDev->valuator->dyremaind = mult * (float)dy +
pDev->valuator->dyremaind;
*py = (int)pDev->valuator->dyremaind;
pDev->valuator->dyremaind = pDev->valuator->dyremaind -
(float)(*py);
}
}
}
}
/**
* Clip an axis to its bounds, which are declared in the call to
* InitValuatorAxisClassStruct.
@ -696,7 +622,8 @@ GetKeyboardValuatorEvents(EventList *events, DeviceIntPtr pDev, int type,
return 0;
map = pDev->key->curKeySyms.map;
sym = map[key_code * pDev->key->curKeySyms.mapWidth];
sym = map[(key_code - pDev->key->curKeySyms.minKeyCode)
* pDev->key->curKeySyms.mapWidth];
master = pDev->u.master;
if (master && master->u.lastSlave != pDev)
@ -787,7 +714,7 @@ GetKeyboardValuatorEvents(EventList *events, DeviceIntPtr pDev, int type,
*
* @param num_events Number of elements in list.
*/
_X_EXPORT EventListPtr
EventListPtr
InitEventList(int num_events)
{
EventListPtr events;
@ -888,6 +815,8 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons,
int *v0 = NULL, *v1 = NULL;
int i;
ms = GetTimeInMillis(); /* before pointer update to help precision */
/* Sanity checks. */
if (type != MotionNotify && type != ButtonPress && type != ButtonRelease)
return 0;
@ -900,8 +829,6 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons,
if (type == MotionNotify && num_valuators <= 0)
return 0;
ms = GetTimeInMillis();
/* Do we need to send a DeviceValuator event? */
if (num_valuators) {
if ((((num_valuators - 1) / 6) + 1) > MAX_VALUATOR_EVENTS)
@ -951,9 +878,11 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons,
}
}
else {
if (flags & POINTER_ACCELERATE)
acceleratePointer(pDev, first_valuator, num_valuators,
valuators);
if (flags & POINTER_ACCELERATE &&
pDev->valuator->accelScheme.AccelSchemeProc){
pDev->valuator->accelScheme.AccelSchemeProc(
pDev, first_valuator, num_valuators, valuators, ms);
}
if(v0) x += *v0;
if(v1) y += *v1;
@ -1030,7 +959,7 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons,
kbp->type = DeviceButtonPress;
else if (type == ButtonRelease)
kbp->type = DeviceButtonRelease;
kbp->detail = pDev->button->map[buttons];
kbp->detail = buttons;
}
kbp->root_x = cx; /* root_x/y always in screen coords */

View file

@ -240,7 +240,7 @@ int dix_main(int argc, char *argv[], char *envp[])
int main(int argc, char *argv[], char *envp[])
#endif
{
int i, j, k;
int i;
char *xauthfile;
HWEventQueueType alwaysCheckForInput[2];
@ -252,10 +252,6 @@ int main(int argc, char *argv[], char *envp[])
CheckUserAuthorization();
#ifdef COMMANDLINE_CHALLENGED_OPERATING_SYSTEMS
ExpandCommandLine(&argc, &argv);
#endif
InitConnectionLimits();
/* prep X authority file from environment; this can be overriden by a
@ -309,22 +305,10 @@ int main(int argc, char *argv[], char *envp[])
SetInputCheck(&alwaysCheckForInput[0], &alwaysCheckForInput[1]);
screenInfo.arraySize = MAXSCREENS;
screenInfo.numScreens = 0;
screenInfo.numVideoScreens = -1;
WindowTable = (WindowPtr *)xalloc(MAXSCREENS * sizeof(WindowPtr));
if (!WindowTable)
FatalError("couldn't create root window table");
/*
* Just in case the ddx doesnt supply a format for depth 1 (like qvss).
*/
j = indexForBitsPerPixel[ 1 ];
k = indexForScanlinePad[ BITMAP_SCANLINE_PAD ];
PixmapWidthPaddingInfo[1].padRoundUp = BITMAP_SCANLINE_PAD-1;
PixmapWidthPaddingInfo[1].padPixelsLog2 = answer[j][k];
j = indexForBitsPerPixel[8]; /* bits per byte */
PixmapWidthPaddingInfo[1].padBytesLog2 = answer[j][k];
PixmapWidthPaddingInfo[1].bitsPerPixel = 1;
InitAtoms();
InitEvents();
InitSelections();
@ -339,8 +323,6 @@ int main(int argc, char *argv[], char *envp[])
if (screenInfo.numScreens < 1)
FatalError("no screens found");
if (screenInfo.numVideoScreens < 0)
screenInfo.numVideoScreens = screenInfo.numScreens;
InitExtensions(argc, argv);
for (i = 0; i < screenInfo.numScreens; i++)
{
@ -437,6 +419,7 @@ int main(int argc, char *argv[], char *envp[])
memset(WindowTable, 0, MAXSCREENS * sizeof(WindowPtr));
CloseDownDevices();
CloseDownEvents();
for (i = screenInfo.numScreens - 1; i >= 0; i--)
{

View file

@ -39,6 +39,12 @@ from The Open Group.
#include "colormapst.h"
#include "inputstr.h"
struct _Private {
DevPrivateKey key;
pointer value;
struct _Private *next;
};
typedef struct _PrivateDesc {
DevPrivateKey key;
unsigned size;
@ -116,6 +122,65 @@ dixAllocatePrivate(PrivateRec **privates, const DevPrivateKey key)
return &ptr->value;
}
/*
* Look up a private pointer.
*/
_X_EXPORT pointer
dixLookupPrivate(PrivateRec **privates, const DevPrivateKey key)
{
PrivateRec *rec = *privates;
pointer *ptr;
while (rec) {
if (rec->key == key)
return rec->value;
rec = rec->next;
}
ptr = dixAllocatePrivate(privates, key);
return ptr ? *ptr : NULL;
}
/*
* Look up the address of a private pointer.
*/
_X_EXPORT pointer *
dixLookupPrivateAddr(PrivateRec **privates, const DevPrivateKey key)
{
PrivateRec *rec = *privates;
while (rec) {
if (rec->key == key)
return &rec->value;
rec = rec->next;
}
return dixAllocatePrivate(privates, key);
}
/*
* Set a private pointer.
*/
_X_EXPORT int
dixSetPrivate(PrivateRec **privates, const DevPrivateKey key, pointer val)
{
PrivateRec *rec;
top:
rec = *privates;
while (rec) {
if (rec->key == key) {
rec->value = val;
return TRUE;
}
rec = rec->next;
}
if (!dixAllocatePrivate(privates, key))
return FALSE;
goto top;
}
/*
* Called to free privates at object deletion time.
*/

View file

@ -359,16 +359,28 @@ V000 SECURITY:AuthorizationRevoked
E000 SECURITY:BadAuthorization
E001 SECURITY:BadAuthorizationProtocol
R000 SELinux:SELinuxQueryVersion
R001 SELinux:SELinuxSetSelectionManager
R002 SELinux:SELinuxGetSelectionManager
R001 SELinux:SELinuxSetDeviceCreateContext
R002 SELinux:SELinuxGetDeviceCreateContext
R003 SELinux:SELinuxSetDeviceContext
R004 SELinux:SELinuxGetDeviceContext
R005 SELinux:SELinuxSetPropertyCreateContext
R006 SELinux:SELinuxGetPropertyCreateContext
R007 SELinux:SELinuxGetPropertyContext
R008 SELinux:SELinuxSetWindowCreateContext
R009 SELinux:SELinuxGetWindowCreateContext
R010 SELinux:SELinuxGetWindowContext
R005 SELinux:SELinuxSetWindowCreateContext
R006 SELinux:SELinuxGetWindowCreateContext
R007 SELinux:SELinuxGetWindowContext
R008 SELinux:SELinuxSetPropertyCreateContext
R009 SELinux:SELinuxGetPropertyCreateContext
R010 SELinux:SELinuxSetPropertyUseContext
R011 SELinux:SELinuxGetPropertyUseContext
R012 SELinux:SELinuxGetPropertyContext
R013 SELinux:SELinuxGetPropertyDataContext
R014 SELinux:SELinuxListProperties
R015 SELinux:SELinuxSetSelectionCreateContext
R016 SELinux:SELinuxGetSelectionCreateContext
R017 SELinux:SELinuxSetSelectionUseContext
R018 SELinux:SELinuxGetSelectionUseContext
R019 SELinux:SELinuxGetSelectionContext
R020 SELinux:SELinuxGetSelectionDataContext
R021 SELinux:SELinuxListSelections
R022 SELinux:SELinuxGetClientContext
R000 SHAPE:QueryVersion
R001 SHAPE:Rectangles
R002 SHAPE:Mask

770
dix/ptrveloc.c Normal file
View file

@ -0,0 +1,770 @@
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <math.h>
#include <ptrveloc.h>
#include <inputstr.h>
#include <assert.h>
/*****************************************************************************
* Predictable pointer ballistics
*
* 2006-2008 by Simon Thum (simon [dot] thum [at] gmx de)
*
* Serves 3 complementary functions:
* 1) provide a sophisticated ballistic velocity estimate to improve
* the relation between velocity (of the device) and acceleration
* 2) make arbitrary acceleration profiles possible
* 3) decelerate by two means (constant and adaptive) if enabled
*
* Important concepts are the
*
* - Scheme
* which selects the basic algorithm
* (see devices.c/InitPointerAccelerationScheme)
* - Profile
* which returns an acceleration
* for a given velocity
*
* The profile can be selected by the user (potentially at runtime).
* the classic profile is intended to cleanly perform old-style
* function selection (threshold =/!= 0)
*
****************************************************************************/
/* fwds */
static inline void
FeedFilterStage(FilterStagePtr s, float value, int tdiff);
extern void
InitFilterStage(FilterStagePtr s, float rdecay, int lutsize);
void
CleanupFilterChain(DeviceVelocityPtr s);
int
SetAccelerationProfile(DeviceVelocityPtr s, int profile_num);
void
InitFilterChain(DeviceVelocityPtr s, float rdecay, float degression,
int stages, int lutsize);
void
CleanupFilterChain(DeviceVelocityPtr s);
static float
SimpleSmoothProfile(DeviceVelocityPtr pVel, float threshold, float acc);
/********************************
* Init/Uninit etc
*******************************/
/**
* Init struct so it should match the average case
*/
void
InitVelocityData(DeviceVelocityPtr s)
{
s->lrm_time = 0;
s->velocity = 0;
s->corr_mul = 10.0; /* dots per 10 milisecond should be usable */
s->const_acceleration = 1.0; /* no acceleration/deceleration */
s->reset_time = 300;
s->last_dx = 0;
s->last_dy = 0;
s->use_softening = 1;
s->min_acceleration = 1.0; /* don't decelerate */
s->coupling = 0.2;
s->profile_private = NULL;
memset(&s->statistics, 0, sizeof(s->statistics));
memset(&s->filters, 0, sizeof(s->filters));
SetAccelerationProfile(s, 0);
InitFilterChain(s, (float)1.0/20.0, 1, 1, 40);
}
/**
* Clean up
*/
static void
FreeVelocityData(DeviceVelocityPtr s){
CleanupFilterChain(s);
SetAccelerationProfile(s, -1);
}
/*
* dix uninit helper, called through scheme
*/
void
AccelerationDefaultCleanup(DeviceIntPtr pDev){
/*sanity check*/
if( pDev->valuator->accelScheme.AccelSchemeProc == acceleratePointerPredictable
&& pDev->valuator->accelScheme.accelData != NULL){
pDev->valuator->accelScheme.AccelSchemeProc = NULL;
FreeVelocityData(pDev->valuator->accelScheme.accelData);
xfree(pDev->valuator->accelScheme.accelData);
pDev->valuator->accelScheme.accelData = NULL;
}
}
/*********************
* Filtering logic
********************/
/**
Initialize a filter chain.
Expected result is a series of filters, each progressively more integrating.
*/
void
InitFilterChain(DeviceVelocityPtr s, float rdecay, float progression, int stages, int lutsize)
{
int fn;
if((stages > 1 && progression < 1.0f) || 0 == progression){
ErrorF("(dix ptracc) invalid filter chain progression specified\n");
return;
}
for(fn = 0; fn < MAX_VELOCITY_FILTERS; fn++){
if(fn < stages){
InitFilterStage(&s->filters[fn], rdecay, lutsize);
}else{
InitFilterStage(&s->filters[fn], 0, 0);
}
rdecay /= progression;
}
}
void
CleanupFilterChain(DeviceVelocityPtr s)
{
int fn;
for(fn = 0; fn < MAX_VELOCITY_FILTERS; fn++)
InitFilterStage(&s->filters[fn], 0, 0);
}
/**
* Adjust weighting decay and lut in sync
* The weight fn is designed so its integral 0->inf is unity, so we end
* up with a stable (basically IIR) filter. It always draws
* towards its more current input values, which have more weight the older
* the last input value is.
*/
void
InitFilterStage(FilterStagePtr s, float rdecay, int lutsize)
{
int x;
float *newlut;
float *oldlut;
s->fading_lut_size = 0; /* prevent access */
/* mb(); concurrency issues may arise */
if(lutsize > 0){
newlut = xalloc (sizeof(float)* lutsize);
if(!newlut)
return;
for(x = 0; x < lutsize; x++)
newlut[x] = pow(0.5, ((float)x) * rdecay);
}else{
newlut = NULL;
}
oldlut = s->fading_lut;
s->fading_lut = newlut;
s->rdecay = rdecay;
s->fading_lut_size = lutsize;
s->current = 0;
if(oldlut != NULL)
xfree(oldlut);
}
static inline void
FeedFilterChain(DeviceVelocityPtr s, float value, int tdiff)
{
int fn;
for(fn = 0; fn < MAX_VELOCITY_FILTERS; fn++){
if(s->filters[fn].rdecay != 0)
FeedFilterStage(&s->filters[fn], value, tdiff);
else break;
}
}
static inline void
FeedFilterStage(FilterStagePtr s, float value, int tdiff){
float fade;
if(tdiff < s->fading_lut_size)
fade = s->fading_lut[tdiff];
else
fade = pow(0.5, ((float)tdiff) * s->rdecay);
s->current *= fade; /* fade out old velocity */
s->current += value * (1.0f - fade); /* and add up current */
}
/**
* Select the most filtered matching result. Also, the first
* mismatching filter will be set to value (coupling).
*/
static inline float
QueryFilterChain(
DeviceVelocityPtr s,
float value,
float maxdiv)
{
int fn, rfn = 0, cfn = -1;
float cur, result = value;
/* try to retrieve most integrated result 'within range'
* Assumption: filter are in order least to most integrating */
for(fn = 0; fn < MAX_VELOCITY_FILTERS; fn++){
if(0.0f == s->filters[fn].rdecay)
break;
cur = s->filters[fn].current;
if (fabs(value - cur) <= 1.0f ||
fabs(value - cur) / (value + cur) <= maxdiv){
result = cur;
rfn = fn; /*remember result determining filter */
} else if(cfn == -1){
cfn = fn; /* rememeber first mismatching filter */
}
}
s->statistics.filter_usecount[rfn]++;
#ifdef SERIOUS_DEBUGGING
ErrorF("(dix ptraccel) result from filter stage %i, input %.2f, output %.2f\n", rfn, value, result);
#endif
/* override one current (coupling) so the filter
* catches up quickly. */
if(cfn != -1)
s->filters[cfn].current = result;
return result;
}
/********************************
* velocity computation
*******************************/
/**
* return the axis if mickey is insignificant and axis-aligned,
* -1 otherwise
* 1 for x-axis
* 2 for y-axis
*/
static inline short
GetAxis(int dx, int dy){
if(dx == 0 || dy == 0){
if(dx == 1 || dx == -1)
return 1;
if(dy == 1 || dy == -1)
return 2;
return -1;
}else{
return -1;
}
}
/**
* Perform velocity approximation
* return true if non-visible state reset is suggested
*/
static short
ProcessVelocityData(DeviceVelocityPtr s, int dx, int dy, int time)
{
float cvelocity;
int diff = time - s->lrm_time;
int cur_ax = GetAxis(dx, dy);
int last_ax = GetAxis(s->last_dx, s->last_dy);
short reset = (diff >= s->reset_time);
if(cur_ax != last_ax && cur_ax != -1 && last_ax != -1 && !reset){
/* correct for the error induced when diagonal movements are
reported as alternating axis mickeys */
dx += s->last_dx;
dy += s->last_dy;
diff += s->last_diff;
s->last_diff = time - s->lrm_time; /* prevent repeating add-up */
#ifdef SERIOUS_DEBUGGING
ErrorF("(dix ptracc) axial correction\n");
#endif
}else{
s->last_diff = diff;
}
/*
* cvelocity is not a real velocity yet, more a motion delta. contant
* acceleration is multiplied here to make the velocity an on-screen
* velocity (px/t as opposed to [insert unit]/t). This is intended to
* make multiple devices with widely varying ConstantDecelerations respond
* similar to acceleration controls.
*/
cvelocity = (float)sqrt(dx*dx + dy*dy) * s->const_acceleration;
s->lrm_time = time;
if (s->reset_time < 0 || diff < 0) { /* disabled or timer overrun? */
/* simply set velocity from current movement, no reset. */
s->velocity = cvelocity;
return 0;
}
if (diff == 0)
diff = 1; /* prevent div-by-zero, though it shouldn't happen anyway*/
/* translate velocity to dots/ms (somewhat untractable in integers,
so we multiply by some per-device adjustable factor) */
cvelocity = cvelocity * s->corr_mul / (float)diff;
/* short-circuit: when nv-reset the rest can be skipped */
if(reset == TRUE){
s->velocity = cvelocity;
return TRUE;
}
/* feed into filter chain */
FeedFilterChain(s, cvelocity, diff);
/* perform coupling and decide final value */
s->velocity = QueryFilterChain(s, cvelocity, s->coupling);
#ifdef SERIOUS_DEBUGGING
ErrorF("(dix ptracc) guess: vel=%.3f diff=%d |%i|%i|%i|%i|\n",
s->velocity, diff,
s->statistics.filter_usecount[0], s->statistics.filter_usecount[1],
s->statistics.filter_usecount[2], s->statistics.filter_usecount[3]);
#endif
return reset;
}
/**
* this flattens significant ( > 1) mickeys a little bit for more steady
* constant-velocity response
*/
static inline float
ApplySimpleSoftening(int od, int d)
{
float res = d;
if (d <= 1 && d >= -1)
return res;
if (d > od)
res -= 0.5;
else if (d < od)
res += 0.5;
return res;
}
static void
ApplySofteningAndConstantDeceleration(
DeviceVelocityPtr s,
int dx,
int dy,
float* fdx,
float* fdy,
short do_soften)
{
if (do_soften && s->use_softening) {
*fdx = ApplySimpleSoftening(s->last_dx, dx);
*fdy = ApplySimpleSoftening(s->last_dy, dy);
} else {
*fdx = dx;
*fdy = dy;
}
*fdx *= s->const_acceleration;
*fdy *= s->const_acceleration;
}
/*****************************************
* Acceleration functions and profiles
****************************************/
/**
* Polynomial function similar previous one, but with f(1) = 1
*/
static float
PolynomialAccelerationProfile(DeviceVelocityPtr pVel, float ignored, float acc)
{
return pow(pVel->velocity, (acc - 1.0) * 0.5);
}
/**
* returns acceleration for velocity.
* This profile selects the two functions like the old scheme did
*/
static float
ClassicProfile(
DeviceVelocityPtr pVel,
float threshold,
float acc)
{
if (threshold) {
return SimpleSmoothProfile (pVel,
threshold,
acc);
} else {
return PolynomialAccelerationProfile (pVel,
0,
acc);
}
}
/**
* Power profile
* This has a completely smooth transition curve, i.e. no jumps in the
* derivatives.
*
* This has the expense of overall response dependency on min-acceleration.
* In effect, min_acceleration mimics const_acceleration in this profile.
*/
static float
PowerProfile(
DeviceVelocityPtr pVel,
float threshold,
float acc)
{
float vel_dist;
acc = (acc-1.0) * 0.1f + 1.0; /* without this, acc of 2 is unuseable */
if (pVel->velocity <= threshold)
return pVel->min_acceleration;
vel_dist = pVel->velocity - threshold;
return (pow(acc, vel_dist)) * pVel->min_acceleration;
}
/**
* just a smooth function in [0..1] -> [0..1]
* - point symmetry at 0.5
* - f'(0) = f'(1) = 0
* - starts faster than sinoids, C1 (Cinf if you dare to ignore endpoints)
*/
static inline float
CalcPenumbralGradient(float x){
x *= 2.0f;
x -= 1.0f;
return 0.5f + (x * sqrt(1.0f - x*x) + asin(x))/M_PI;
}
/**
* acceleration function similar to classic accelerated/unaccelerated,
* but with smooth transition in between (and towards zero for adaptive dec.).
*/
static float
SimpleSmoothProfile(
DeviceVelocityPtr pVel,
float threshold,
float acc)
{
float velocity = pVel->velocity;
if(velocity < 1.0f)
return CalcPenumbralGradient(0.5 + velocity*0.5) * 2.0f - 1.0f;
if(threshold < 1.0f)
threshold = 1.0f;
if (velocity <= threshold)
return 1;
velocity /= threshold;
if (velocity >= acc)
return acc;
else
return 1.0f + (CalcPenumbralGradient(velocity/acc) * (acc - 1.0f));
}
/**
* This profile uses the first half of the penumbral gradient as a start
* and then scales linearly.
*/
static float
SmoothLinearProfile(
DeviceVelocityPtr pVel,
float threshold,
float acc)
{
if(acc > 1.0f)
acc -= 1.0f; /*this is so acc = 1 is no acceleration */
else
return 1.0f;
float nv = (pVel->velocity - threshold) * acc * 0.5f;
float res;
if(nv < 0){
res = 0;
}else if(nv < 2){
res = CalcPenumbralGradient(nv*0.25f)*2.0f;
}else{
nv -= 2.0f;
res = nv * 2.0f / M_PI /* steepness of gradient at 0.5 */
+ 1.0f; /* gradient crosses 2|1 */
}
res += pVel->min_acceleration;
return res;
}
static float
LinearProfile(
DeviceVelocityPtr pVel,
float threshold,
float acc)
{
return acc * pVel->velocity;
}
/**
* Set the profile by number.
* Intended to make profiles exchangeable at runtime.
* If you created a profile, give it a number here to make it selectable.
* In case some profile-specific init is needed, here would be a good place,
* since FreeVelocityData() also calls this with -1.
* returns FALSE (0) if profile number is unknown.
*/
int
SetAccelerationProfile(
DeviceVelocityPtr s,
int profile_num)
{
PointerAccelerationProfileFunc profile;
switch(profile_num){
case -1:
profile = NULL; /* Special case to uninit properly */
break;
case 0:
profile = ClassicProfile;
break;
case 1:
if(NULL == s->deviceSpecificProfile)
return FALSE;
profile = s->deviceSpecificProfile;
break;
case 2:
profile = PolynomialAccelerationProfile;
break;
case 3:
profile = SmoothLinearProfile;
break;
case 4:
profile = SimpleSmoothProfile;
break;
case 5:
profile = PowerProfile;
break;
case 6:
profile = LinearProfile;
break;
default:
return FALSE;
}
if(s->profile_private != NULL){
/* Here one could free old profile-private data */
xfree(s->profile_private);
s->profile_private = NULL;
}
/* Here one could init profile-private data */
s->Profile = profile;
s->statistics.profile_number = profile_num;
return TRUE;
}
/**
* device-specific profile
*
* The device-specific profile is intended as a hook for a driver
* which may want to provide an own acceleration profile.
* It should not rely on profile-private data, instead
* it should do init/uninit in the driver (ie. with DEVICE_INIT and friends).
* Users may override or choose it.
*/
extern void
SetDeviceSpecificAccelerationProfile(
DeviceIntPtr pDev,
PointerAccelerationProfileFunc profile)
{
/*sanity check*/
if( pDev->valuator &&
pDev->valuator->accelScheme.AccelSchemeProc ==
acceleratePointerPredictable &&
pDev->valuator->accelScheme.accelData != NULL){
((DeviceVelocityPtr)
(pDev->valuator->accelScheme.accelData))->deviceSpecificProfile
= profile;
}
}
/********************************
* acceleration schemes
*******************************/
/**
* Modifies valuators in-place.
* This version employs a velocity approximation algorithm to
* enable fine-grained predictable acceleration profiles.
*/
void
acceleratePointerPredictable(DeviceIntPtr pDev, int first_valuator,
int num_valuators, int *valuators, int evtime)
{
float mult = 0.0;
int dx = 0, dy = 0;
int *px = NULL, *py = NULL;
DeviceVelocityPtr velocitydata =
(DeviceVelocityPtr) pDev->valuator->accelScheme.accelData;
float fdx, fdy; /* no need to init */
if (!num_valuators || !valuators || !velocitydata)
return;
if (first_valuator == 0) {
dx = valuators[0];
px = &valuators[0];
}
if (first_valuator <= 1 && num_valuators >= (2 - first_valuator)) {
dy = valuators[1 - first_valuator];
py = &valuators[1 - first_valuator];
}
if (dx || dy){
/* reset nonvisible state? */
if (ProcessVelocityData(velocitydata, dx , dy, evtime)) {
/* set to center of pixel */
pDev->last.remainder[0] = pDev->last.remainder[1] = 0.5f;
/* prevent softening (somewhat quirky solution,
as it depends on the algorithm) */
velocitydata->last_dx = dx;
velocitydata->last_dy = dy;
}
if (pDev->ptrfeed && pDev->ptrfeed->ctrl.num) {
/* invoke acceleration profile to determine acceleration */
mult = velocitydata->Profile(velocitydata,
pDev->ptrfeed->ctrl.threshold,
(float)(pDev->ptrfeed->ctrl.num) /
(float)(pDev->ptrfeed->ctrl.den));
#ifdef SERIOUS_DEBUGGING
ErrorF("(dix ptracc) resulting speed multiplier : %.3f\n", mult);
#endif
/* enforce min_acceleration */
if (mult < velocitydata->min_acceleration) {
#ifdef SERIOUS_DEBUGGING
ErrorF("(dix ptracc) enforced min multiplier : %.3f\n",
velocitydata->min_acceleration);
#endif
mult = velocitydata->min_acceleration;
}
if(mult != 1.0 || velocitydata->const_acceleration != 1.0) {
ApplySofteningAndConstantDeceleration( velocitydata,
dx, dy,
&fdx, &fdy,
mult > 1.0);
if (dx) {
pDev->last.remainder[0] = mult * fdx + pDev->last.remainder[0];
*px = (int)pDev->last.remainder[0];
pDev->last.remainder[0] = pDev->last.remainder[0] - (float)*px;
}
if (dy) {
pDev->last.remainder[1] = mult * fdy + pDev->last.remainder[1];
*py = (int)pDev->last.remainder[1];
pDev->last.remainder[1] = pDev->last.remainder[1] - (float)*py;
}
}
}
}
/* remember last motion delta (for softening/slow movement treatment) */
velocitydata->last_dx = dx;
velocitydata->last_dy = dy;
}
/**
* Originally a part of xf86PostMotionEvent; modifies valuators
* in-place. Retained mostly for embedded scenarios.
*/
void
acceleratePointerClassic(DeviceIntPtr pDev, int first_valuator,
int num_valuators, int *valuators, int ignored)
{
float mult = 0.0;
int dx = 0, dy = 0;
int *px = NULL, *py = NULL;
if (!num_valuators || !valuators)
return;
if (first_valuator == 0) {
dx = valuators[0];
px = &valuators[0];
}
if (first_valuator <= 1 && num_valuators >= (2 - first_valuator)) {
dy = valuators[1 - first_valuator];
py = &valuators[1 - first_valuator];
}
if (!dx && !dy)
return;
if (pDev->ptrfeed && pDev->ptrfeed->ctrl.num) {
/* modeled from xf86Events.c */
if (pDev->ptrfeed->ctrl.threshold) {
if ((abs(dx) + abs(dy)) >= pDev->ptrfeed->ctrl.threshold) {
pDev->last.remainder[0] = ((float)dx *
(float)(pDev->ptrfeed->ctrl.num)) /
(float)(pDev->ptrfeed->ctrl.den) +
pDev->last.remainder[0];
if (px) {
*px = (int)pDev->last.remainder[0];
pDev->last.remainder[0] = pDev->last.remainder[0] -
(float)(*px);
}
pDev->last.remainder[1] = ((float)dy *
(float)(pDev->ptrfeed->ctrl.num)) /
(float)(pDev->ptrfeed->ctrl.den) +
pDev->last.remainder[1];
if (py) {
*py = (int)pDev->last.remainder[1];
pDev->last.remainder[1] = pDev->last.remainder[1] -
(float)(*py);
}
}
}
else {
mult = pow((float)dx * (float)dx + (float)dy * (float)dy,
((float)(pDev->ptrfeed->ctrl.num) /
(float)(pDev->ptrfeed->ctrl.den) - 1.0) /
2.0) / 2.0;
if (dx) {
pDev->last.remainder[0] = mult * (float)dx +
pDev->last.remainder[0];
*px = (int)pDev->last.remainder[0];
pDev->last.remainder[0] = pDev->last.remainder[0] -
(float)(*px);
}
if (dy) {
pDev->last.remainder[1] = mult * (float)dy +
pDev->last.remainder[1];
*py = (int)pDev->last.remainder[1];
pDev->last.remainder[1] = pDev->last.remainder[1] -
(float)(*py);
}
}
}
}

View file

@ -126,10 +126,12 @@ RegisterExtensionNames(ExtensionEntry *extEntry)
rewind(fh);
while (fgets(buf, sizeof(buf), fh)) {
lineobj = NULL;
ptr = strchr(buf, '\n');
if (ptr)
*ptr = 0;
/* Check for comments or empty lines */
switch (buf[0]) {
case PROT_REQUEST:
case PROT_EVENT:
@ -139,48 +141,54 @@ RegisterExtensionNames(ExtensionEntry *extEntry)
case '\0':
continue;
default:
continue;
goto invalid;
}
/* Check for space character in the fifth position */
ptr = strchr(buf, ' ');
if (!ptr || ptr != buf + 4) {
LogMessage(X_WARNING, "Invalid line in " FILENAME ", skipping\n");
continue;
}
if (!ptr || ptr != buf + 4)
goto invalid;
/* Duplicate the string after the space */
lineobj = strdup(ptr + 1);
if (!lineobj)
continue;
/* Check for a colon somewhere on the line */
ptr = strchr(buf, ':');
if (!ptr) {
LogMessage(X_WARNING, "Invalid line in " FILENAME ", skipping\n");
continue;
}
if (!ptr)
goto invalid;
/* Compare the part before colon with the target extension name */
*ptr = 0;
if (strcmp(buf + 5, extEntry->name))
continue;
goto skip;
/* Get the opcode for the request, event, or error */
offset = strtol(buf + 1, &ptr, 10);
if (offset == 0 && ptr == buf + 1) {
LogMessage(X_WARNING, "Invalid line in " FILENAME ", skipping\n");
continue;
}
if (offset == 0 && ptr == buf + 1)
goto invalid;
/* Save the strdup result in the registry */
switch(buf[0]) {
case PROT_REQUEST:
if (extEntry->base)
RegisterRequestName(extEntry->base, offset, lineobj);
else
RegisterRequestName(offset, 0, lineobj);
break;
continue;
case PROT_EVENT:
RegisterEventName(extEntry->eventBase + offset, lineobj);
break;
continue;
case PROT_ERROR:
RegisterErrorName(extEntry->errorBase + offset, lineobj);
break;
continue;
}
invalid:
LogMessage(X_WARNING, "Invalid line in " FILENAME ", skipping\n");
skip:
free(lineobj);
}
}

View file

@ -1,28 +1,31 @@
/************************************************************
Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc.
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 Silicon Graphics not be
used in advertising or publicity pertaining to distribution
of the software without specific prior written permission.
Silicon Graphics makes no representation about the suitability
of this software for any purpose. It is provided "as is"
without any express or implied warranty.
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
GRAPHICS 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.
********************************************************/
/*
* Copyright (c) 1987, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
@ -33,7 +36,7 @@
#ifdef NEED_STRCASECMP
int
xstrcasecmp(char *str1,char *str2)
xstrcasecmp(const char *str1, const char *str2)
{
const u_char *us1 = (const u_char *)str1, *us2 = (const u_char *)str2;
@ -46,3 +49,22 @@ xstrcasecmp(char *str1,char *str2)
return (tolower(*us1) - tolower(*us2));
}
#endif
#ifdef NEED_STRNCASECMP
int
xstrncasecmp(const char *s1, const char *s2, size_t n)
{
if (n != 0) {
const u_char *us1 = (const u_char *)s1, *us2 = (const u_char *)s2;
do {
if (tolower(*us1) != tolower(*us2++))
return (tolower(*us1) - tolower(*--us2));
if (*us1++ == '\0')
break;
} while (--n != 0);
}
return 0;
}
#endif

64
dix/strcasestr.c Normal file
View file

@ -0,0 +1,64 @@
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Chris Torek.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include <ctype.h>
#include <string.h>
#include "dix.h"
/*
* Find the first occurrence of find in s, ignore case.
*/
#ifdef NEED_STRCASESTR
char *
xstrcasestr(const char *s, const char *find)
{
char c, sc;
size_t len;
if ((c = *find++) != 0) {
c = tolower((unsigned char)c);
len = strlen(find);
do {
do {
if ((sc = *s++) == 0)
return (NULL);
} while ((char)tolower((unsigned char)sc) != c);
} while (strncasecmp(s, find, len) != 0);
s--;
}
return ((char *)s);
}
#endif

View file

@ -823,6 +823,8 @@ CreateWindow(Window wid, WindowPtr pParent, int x, int y, unsigned w,
static void
DisposeWindowOptional (WindowPtr pWin)
{
GenericMaskPtr gmask = NULL, next = NULL;
if (!pWin->optional)
return;
/*
@ -856,6 +858,17 @@ DisposeWindowOptional (WindowPtr pWin)
xfree(pWin->optional->access.perm);
xfree(pWin->optional->access.deny);
/* Remove generic event mask allocations */
if (pWin->optional->geMasks)
gmask = pWin->optional->geMasks->geClients;
while(gmask)
{
next = gmask->next;
xfree(gmask);
gmask = next;
}
xfree (pWin->optional->geMasks);
xfree (pWin->optional);
pWin->optional = NULL;
}
@ -930,6 +943,7 @@ CrushTree(WindowPtr pWin)
(*UnrealizeWindow)(pChild);
}
FreeWindowResources(pChild);
dixFreePrivates(pChild->devPrivates);
xfree(pChild);
if ( (pChild = pSib) )
break;
@ -979,6 +993,7 @@ DeleteWindow(pointer value, XID wid)
if (pWin->prevSib)
pWin->prevSib->nextSib = pWin->nextSib;
}
xfree(dixLookupPrivate(&pWin->devPrivates, FocusPrivatesKey));
dixFreePrivates(pWin->devPrivates);
xfree(pWin);
return Success;

View file

@ -314,7 +314,6 @@ exaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth,
if (driver_alloc) {
size_t paddedWidth, datasize;
void *driver_priv;
paddedWidth = ((w * bpp + FB_MASK) >> FB_SHIFT) * sizeof(FbBits);
if (paddedWidth / 4 > 32767 || h > 32767)
@ -327,22 +326,21 @@ exaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth,
datasize = h * paddedWidth;
driver_priv = pExaScr->info->CreatePixmap(pScreen, datasize, 0);
if (!driver_priv) {
pExaPixmap->driverPriv = pExaScr->info->CreatePixmap(pScreen, datasize, 0);
if (!pExaPixmap->driverPriv) {
fbDestroyPixmap(pPixmap);
return NULL;
}
(*pScreen->ModifyPixmapHeader)(pPixmap, w, h, 0, 0,
paddedWidth, NULL);
pExaPixmap->driverPriv = driver_priv;
pExaPixmap->score = EXA_PIXMAP_SCORE_PINNED;
pExaPixmap->fb_ptr = NULL;
} else {
pExaPixmap->driverPriv = NULL;
/* Scratch pixmaps may have w/h equal to zero, and may not be
* migrated.
*/
pExaPixmap->driverPriv = NULL;
/* Scratch pixmaps may have w/h equal to zero, and may not be
* migrated.
*/
if (!w || !h)
pExaPixmap->score = EXA_PIXMAP_SCORE_PINNED;
else

11
fb/fb.h
View file

@ -101,9 +101,6 @@
#if GLYPHPADBYTES != 4
#error "GLYPHPADBYTES must be 4"
#endif
#if GETLEFTBITS_ALIGNMENT != 1
#error "GETLEFTBITS_ALIGNMENT must be 1"
#endif
/* whether to bother to include 24bpp support */
#ifndef FBNO24BIT
#define FB_24BIT
@ -141,7 +138,7 @@ typedef unsigned __int64 FbBits;
defined(ia64) || defined(__ia64__) || \
defined(__sparc64__) || defined(_LP64) || \
defined(__s390x__) || \
defined(amd64) || defined (__amd64__) || defined(__x86_64__) || \
defined(amd64) || defined (__amd64__) \
defined (__powerpc64__) || \
(defined(sgi) && (_MIPS_SZLONG == 64))
typedef unsigned long FbBits;
@ -600,9 +597,7 @@ extern void fbSetBits (FbStip *bits, int stride, FbStip data);
}
extern DevPrivateKey fbGetGCPrivateKey(void);
#ifndef FB_NO_WINDOW_PIXMAPS
extern DevPrivateKey fbGetWinPrivateKey(void);
#endif
extern const GCOps fbGCOps;
extern const GCFuncs fbGCFuncs;
@ -673,12 +668,8 @@ typedef struct {
#define fbGetRotatedPixmap(pGC) ((pGC)->pRotatedPixmap)
#define fbGetScreenPixmap(s) ((PixmapPtr) (s)->devPrivate)
#ifdef FB_NO_WINDOW_PIXMAPS
#define fbGetWindowPixmap(d) fbGetScreenPixmap(((DrawablePtr) (d))->pScreen)
#else
#define fbGetWindowPixmap(pWin) ((PixmapPtr)\
dixLookupPrivate(&((WindowPtr)(pWin))->devPrivates, fbGetWinPrivateKey()))
#endif
#ifdef ROOTLESS
#define __fbPixDrawableX(pPix) ((pPix)->drawable.x)

View file

@ -1,5 +1,4 @@
/*
*
* Copyright © 2000 SuSE, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
@ -544,11 +543,10 @@ fb24_32ReformatTile(PixmapPtr pOldTile, int bitsPerPixel)
int oldXoff, oldYoff;
int newXoff, newYoff;
pNewTile = fbCreatePixmapBpp (pScreen,
pOldTile->drawable.width,
pOldTile->drawable.height,
pOldTile->drawable.depth,
bitsPerPixel, 0);
pNewTile = pScreen->CreatePixmap(pScreen, pOldTile->drawable.width,
pOldTile->drawable.height,
pOldTile->drawable.depth,
pOldTile->usage_hint);
if (!pNewTile)
return 0;
fbGetDrawable (&pOldTile->drawable,

View file

@ -38,13 +38,11 @@ DevPrivateKey fbGetGCPrivateKey(void)
{
return fbGCPrivateKey;
}
#ifndef FB_NO_WINDOW_PIXMAPS
static DevPrivateKey fbWinPrivateKey = &fbWinPrivateKey;
DevPrivateKey fbGetWinPrivateKey(void)
{
return fbWinPrivateKey;
}
#endif
Bool
fbAllocatePrivates(ScreenPtr pScreen, DevPrivateKey *pGCKey)

View file

@ -90,11 +90,7 @@ _fbGetWindowPixmap (WindowPtr pWindow)
void
_fbSetWindowPixmap (WindowPtr pWindow, PixmapPtr pPixmap)
{
#ifdef FB_NO_WINDOW_PIXMAPS
FatalError ("Attempted to set window pixmap without fb support\n");
#else
dixSetPrivate(&pWindow->devPrivates, fbGetWinPrivateKey(), pPixmap);
#endif
}
Bool

View file

@ -31,10 +31,8 @@
Bool
fbCreateWindow(WindowPtr pWin)
{
#ifndef FB_NO_WINDOW_PIXMAPS
dixSetPrivate(&pWin->devPrivates, fbGetWinPrivateKey(),
fbGetScreenPixmap(pWin->drawable.pScreen));
#endif
#ifdef FB_SCREEN_PRIVATE
if (pWin->drawable.bitsPerPixel == 32)
pWin->drawable.bitsPerPixel = fbGetScreenPrivate(pWin->drawable.pScreen)->win32bpp;
@ -227,7 +225,7 @@ fbFillRegionSolid (DrawablePtr pDrawable,
while (n--)
{
#ifndef FB_ACCESS_WRAPPER
if (!try_mmx || !pixman_fill (dst, dstStride, dstBpp,
if (!try_mmx || !pixman_fill ((uint32_t *)dst, dstStride, dstBpp,
pbox->x1 + dstXoff, pbox->y1 + dstYoff,
(pbox->x2 - pbox->x1),
(pbox->y2 - pbox->y1),

View file

@ -40,6 +40,8 @@ glapi_sources = \
glapitemp.h \
glapi.c \
glapi.h \
glapioffsets.h \
glprocs.h \
glthread.c \
glthread.h
@ -67,6 +69,7 @@ libglx_la_SOURCES = \
glxext.h \
glxdriswrast.c \
glxdricommon.c \
glxdricommon.h \
glxscreens.c \
glxscreens.h \
glxserver.h \

View file

@ -251,8 +251,6 @@ extern HIDDEN int __glXDisp_AreTexturesResident(struct __GLXclientStateRec *, GL
extern HIDDEN int __glXDispSwap_AreTexturesResident(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDisp_AreTexturesResidentEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_AreTexturesResidentEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDisp_IsRenderbufferEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_IsRenderbufferEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN void __glXDisp_PointParameterfvEXT(GLbyte * pc);
extern HIDDEN void __glXDispSwap_PointParameterfvEXT(GLbyte * pc);
extern HIDDEN void __glXDisp_Color3bv(GLbyte * pc);
@ -423,6 +421,8 @@ extern HIDDEN void __glXDisp_FramebufferTexture1DEXT(GLbyte * pc);
extern HIDDEN void __glXDispSwap_FramebufferTexture1DEXT(GLbyte * pc);
extern HIDDEN int __glXDisp_GetDrawableAttributes(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_GetDrawableAttributes(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDisp_IsRenderbufferEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN int __glXDispSwap_IsRenderbufferEXT(struct __GLXclientStateRec *, GLbyte *);
extern HIDDEN void __glXDisp_RasterPos2sv(GLbyte * pc);
extern HIDDEN void __glXDispSwap_RasterPos2sv(GLbyte * pc);
extern HIDDEN void __glXDisp_Color4ubv(GLbyte * pc);

View file

@ -714,6 +714,17 @@ __glGetBooleanv_size(GLenum e)
case GL_MAX_TEXTURE_COORDS_ARB:
case GL_MAX_TEXTURE_IMAGE_UNITS_ARB:
case GL_DEPTH_BOUNDS_TEST_EXT:
case GL_ARRAY_BUFFER_BINDING_ARB:
case GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB:
case GL_VERTEX_ARRAY_BUFFER_BINDING_ARB:
case GL_NORMAL_ARRAY_BUFFER_BINDING_ARB:
case GL_COLOR_ARRAY_BUFFER_BINDING_ARB:
case GL_INDEX_ARRAY_BUFFER_BINDING_ARB:
case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB:
case GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB:
case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB:
case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB:
case GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB:
case GL_MAX_ARRAY_TEXTURE_LAYERS_EXT:
case GL_STENCIL_TEST_TWO_SIDE_EXT:
case GL_ACTIVE_STENCIL_FACE_EXT:
@ -1072,6 +1083,7 @@ __glGetVertexAttribdvARB_size(GLenum e)
case GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB:
case GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB:
case GL_CURRENT_VERTEX_ATTRIB_ARB:
case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB:
return 1;
default:
return 0;

View file

@ -73,14 +73,10 @@
#define DMXEXT
/* Disable the extensions that are not currently supported */
#undef BEZIER
#undef PEXEXT
#undef MULTIBUFFER
#undef XV
#undef XIE
#undef DBE
#undef XF86VIDMODE
#undef XF86MISC
#undef XFreeXDGA
#undef XF86DRI
#undef SCREENSAVER
@ -88,6 +84,5 @@
#undef XFIXES
#undef DAMAGE
#undef COMPOSITE
#undef FONTCACHE
#endif /* DMX_CONFIG_H */

View file

@ -1004,8 +1004,7 @@ static int MakeCurrent(__GLXclientState *cl,
prevglxc->pGlxPixmap = 0;
}
if (prevglxc->pGlxReadPixmap &&
prevglxc->pGlxReadPixmap != prevglxc->pGlxPixmap ) {
if (prevglxc->pGlxReadPixmap) {
/*
** The previous drawable was a glx pixmap, release it.
*/
@ -1023,8 +1022,7 @@ static int MakeCurrent(__GLXclientState *cl,
prevglxc->pGlxWindow = 0;
}
if (prevglxc->pGlxReadWindow &&
prevglxc->pGlxReadWindow != prevglxc->pGlxWindow) {
if (prevglxc->pGlxReadWindow) {
/*
** The previous drawable was a glx window, release it.
*/
@ -1042,8 +1040,7 @@ static int MakeCurrent(__GLXclientState *cl,
prevglxc->pGlxPbuffer = 0;
}
if (prevglxc->pGlxReadPbuffer &&
prevglxc->pGlxReadPbuffer != prevglxc->pGlxPbuffer ) {
if (prevglxc->pGlxReadPbuffer) {
/*
** The previous drawable was a glx Pbuffer, release it.
*/
@ -1071,7 +1068,7 @@ static int MakeCurrent(__GLXclientState *cl,
pGlxPixmap->refcnt++;
}
if (pReadGlxPixmap && pReadGlxPixmap != pGlxPixmap) {
if (pReadGlxPixmap) {
pReadGlxPixmap->refcnt++;
}
@ -1079,7 +1076,7 @@ static int MakeCurrent(__GLXclientState *cl,
pGlxWindow->refcnt++;
}
if (pGlxReadWindow && pGlxReadWindow != pGlxWindow) {
if (pGlxReadWindow) {
pGlxReadWindow->refcnt++;
}
@ -1087,7 +1084,7 @@ static int MakeCurrent(__GLXclientState *cl,
pGlxPbuffer->refcnt++;
}
if (pGlxReadPbuffer && pGlxReadPbuffer != pGlxPbuffer) {
if (pGlxReadPbuffer) {
pGlxReadPbuffer->refcnt++;
}

View file

@ -1,17 +0,0 @@
XCOMM $RCSId: xc/programs/Xserver/hw/kdrive/Kdrive.tmpl,v 1.3tsi Exp $
#include <Server.tmpl>
#if BuildRender
RENDERINCS=-I$(KDRIVE)/../../render
#endif
#if BuildRandR
RANDRINCS=-I$(KDRIVE)/../../randr
#endif
KDINCS = -I$(KDRIVE) -I$(XBUILDINCDIR) -I$(FONTINCSRC) \
-I$(KDRIVE)/../../fb -I$(KDRIVE)/../../mi -I$(KDRIVE)/../../Xext \
-I$(KDRIVE)/../../miext/shadow -I$(KDRIVE)/../../miext/layer \
-I$(KDRIVE)/../../include -I$(KDRIVE)/../../os \
-I$(EXTINCSRC) -I$(XINCLUDESRC) $(RENDERINCS) $(RANDRINCS)

View file

@ -78,6 +78,8 @@ Xephyr_DEPENDENCIES = \
$(LIBXEPHYR_HOSTDRI) \
@KDRIVE_LOCAL_LIBS@
Xephyr_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
relink:
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)

View file

@ -526,8 +526,6 @@ ephyrRandRSetConfig (ScreenPtr pScreen,
scrpriv->randr = KdAddRotation (screen->randr, randr);
KdOffscreenSwapOut (screen->pScreen);
ephyrUnmapFramebuffer (screen);
screen->width = newwidth;

View file

@ -565,14 +565,40 @@ hostx_get_visual_masks (EphyrScreenInfo screen,
}
}
static int
hostx_calculate_color_shift(unsigned long mask,
int bits_per_rgb)
{
int shift = 0;
while(mask) {
mask = mask >> bits_per_rgb;
if (mask) shift += bits_per_rgb;
}
return shift;
}
void
hostx_set_cmap_entry(unsigned char idx,
unsigned char r,
unsigned char g,
unsigned char b)
{
/* XXX Will likely break for 8 on 16, not sure if this is correct */
HostX.cmap[idx] = (r << 16) | (g << 8) | (b);
/* need to calculate the shifts for RGB because server could be BGR. */
/* XXX Not sure if this is correct for 8 on 16, but this works for 8 on 24.*/
static int rshift, bshift, gshift = 0;
static int first_time = 1;
if (first_time) {
first_time = 0;
rshift = hostx_calculate_color_shift(HostX.visual->red_mask,
HostX.visual->bits_per_rgb);
gshift = hostx_calculate_color_shift(HostX.visual->green_mask,
HostX.visual->bits_per_rgb);
bshift = hostx_calculate_color_shift(HostX.visual->blue_mask,
HostX.visual->bits_per_rgb);
}
HostX.cmap[idx] = ((r << rshift) & HostX.visual->red_mask) |
((g << gshift) & HostX.visual->green_mask) |
((b << bshift) & HostX.visual->blue_mask);
}
/**

View file

@ -21,6 +21,8 @@ Xfake_LDADD = \
@KDRIVE_LIBS@ \
@XSERVER_LIBS@
Xfake_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
Xfake_DEPENDENCIES = \
libfake.a \
@KDRIVE_LOCAL_LIBS@

View file

@ -324,8 +324,6 @@ fakeRandRSetConfig (ScreenPtr pScreen,
scrpriv->randr = KdAddRotation (screen->randr, randr);
KdOffscreenSwapOut (screen->pScreen);
fakeUnmapFramebuffer (screen);
if (!fakeMapFramebuffer (screen))

View file

@ -22,6 +22,8 @@ Xfbdev_DEPENDENCIES = \
libfbdev.a \
$(KDRIVE_PURE_LIBS)
Xfbdev_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
relink:
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)
endif

View file

@ -99,8 +99,6 @@ fbdevCardInit (KdCardInfo *card)
return TRUE;
}
#define FBDEV_KLUDGE_FORMAT
#ifdef FBDEV_KLUDGE_FORMAT
static Pixel
fbdevMakeContig (Pixel orig, Pixel others)
{
@ -114,7 +112,6 @@ fbdevMakeContig (Pixel orig, Pixel others)
}
return orig;
}
#endif
static Bool
fbdevModeSupported (KdScreenInfo *screen,
@ -261,7 +258,7 @@ fbdevScreenInitialize (KdScreenInfo *screen, FbdevScrPriv *scrpriv)
screen->fb[0].redMask = Mask (priv->var.red.offset, priv->var.red.length);
screen->fb[0].greenMask = Mask (priv->var.green.offset, priv->var.green.length);
screen->fb[0].blueMask = Mask (priv->var.blue.offset, priv->var.blue.length);
#ifdef FBDEV_KLUDGE_FORMAT
/*
* This is a kludge so that Render will work -- fill in the gaps
* in the pixel
@ -278,7 +275,6 @@ fbdevScreenInitialize (KdScreenInfo *screen, FbdevScrPriv *scrpriv)
screen->fb[0].redMask|
screen->fb[0].greenMask);
#endif
allbits = screen->fb[0].redMask | screen->fb[0].greenMask | screen->fb[0].blueMask;
depth = 32;
while (depth && !(allbits & (1 << (depth - 1))))
@ -529,8 +525,6 @@ fbdevRandRSetConfig (ScreenPtr pScreen,
scrpriv->randr = KdAddRotation (screen->randr, randr);
KdOffscreenSwapOut (screen->pScreen);
fbdevUnmapFramebuffer (screen);
if (!fbdevMapFramebuffer (screen))

View file

@ -10,10 +10,6 @@ if TSLIB
TSLIB_C = tslib.c
endif
if H3600_TS
TS_C = ts.c
endif
if KDRIVE_HW
KDRIVE_HW_SOURCES = \
agp.c \
@ -30,5 +26,4 @@ liblinux_a_SOURCES = \
ms.c \
ps2.c \
$(KDRIVE_HW_SOURCES) \
$(TSLIB_C) \
$(TS_C)
$(TSLIB_C)

View file

@ -1,209 +0,0 @@
/*
* Derived from ps2.c by Jim Gettys
*
* Copyright © 1999 Keith Packard
* Copyright © 2000 Compaq Computer Corporation
*
* 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, and that the name of Keith Packard or Compaq not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard and Compaq makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD AND COMPAQ DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
* IN NO EVENT SHALL KEITH PACKARD 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.
*/
#ifdef HAVE_CONFIG_H
#include <kdrive-config.h>
#endif
#define NEED_EVENTS
#include <X11/X.h>
#include <X11/Xproto.h>
#include <X11/Xpoll.h>
#include "inputstr.h"
#include "scrnintstr.h"
#include "kdrive.h"
#include <sys/ioctl.h>
#include <linux/h3600_ts.h> /* touch screen events */
static long lastx = 0, lasty = 0;
int KdTsPhyScreen = 0;
static int
TsReadBytes (int fd, char *buf, int len, int min)
{
int n, tot;
fd_set set;
struct timeval tv;
tot = 0;
while (len)
{
n = read (fd, buf, len);
if (n > 0)
{
tot += n;
buf += n;
len -= n;
}
if (tot % min == 0)
break;
FD_ZERO (&set);
FD_SET (fd, &set);
tv.tv_sec = 0;
tv.tv_usec = 100 * 1000;
n = select (fd + 1, &set, 0, 0, &tv);
if (n <= 0)
break;
}
return tot;
}
static void
TsRead (int tsPort, void *closure)
{
KdPointerInfo *pi = closure;
TS_EVENT event;
int n;
long x, y;
unsigned long flags;
n = TsReadBytes (tsPort, (char *) &event, sizeof (event), sizeof (event));
if (n == sizeof (event))
{
if (event.pressure)
{
/*
* HACK ATTACK. (static global variables used !)
* Here we test for the touch screen driver actually being on the
* touch screen, if it is we send absolute coordinates. If not,
* then we send delta's so that we can track the entire vga screen.
*/
if (KdCurScreen == KdTsPhyScreen) {
flags = KD_BUTTON_1;
x = event.x;
y = event.y;
}
else
{
flags = /* KD_BUTTON_1 |*/ KD_MOUSE_DELTA;
if ((lastx == 0) || (lasty == 0)) {
x = 0;
y = 0;
} else {
x = event.x - lastx;
y = event.y - lasty;
}
lastx = event.x;
lasty = event.y;
}
} else {
flags = KD_MOUSE_DELTA;
x = 0;
y = 0;
lastx = 0;
lasty = 0;
}
KdEnqueuePointerEvent (pi, flags, x, y, 0);
}
}
char *TsNames[] = {
"/dev/ts",
"/dev/h3600_ts" /* temporary name; note this code can try
to open more than one device */
};
#define NUM_TS_NAMES (sizeof (TsNames) / sizeof (TsNames[0]))
static Status
TsInit (KdPointerInfo *pi)
{
int i;
int fd;
int n = 0;
if (!pi->path || strcmp(pi->path, "auto") == 0) {
for (i = 0; i < NUM_TS_NAMES; i++) {
fd = open (TsNames[i], 0);
if (fd >= 0) {
pi->path = KdSaveString (TsNames[i]);
break;
}
}
}
else {
fd = open (pi->path, 0);
}
if (fd < 0) {
ErrorF("TsInit: Couldn't open %s\n", pi->path);
return BadMatch;
}
close(fd);
pi->name = KdSaveString("H3600 Touchscreen");
return Success;
}
static Status
TsEnable (KdPointerInfo *pi)
{
int fd;
if (!pi || !pi->path)
return BadImplementation;
fd = open(pi->path, 0);
if (fd < 0) {
ErrorF("TsInit: Couldn't open %s\n", pi->path);
return BadMatch;
}
struct h3600_ts_calibration cal;
/*
* Check to see if this is a touch screen
*/
if (ioctl (fd, TS_GET_CAL, &cal) != -1) {
mi->driverPrivate = (void *) fd;
if (!KdRegisterFd (fd, TsRead, (void *) mi)) {
close(fd);
return BadAlloc;
}
}
else {
ErrorF("TsEnable: %s is not a touchscreen\n", pi->path);
close (fd);
return BadMatch;
}
return Success;
}
static void
TsFini (KdPointerInfo *pi)
{
KdUnregisterFds (pi, (int)pi->driverPrivate, TRUE);
mi->driverPrivate = NULL;
}
KdPointerDriver TsDriver = {
TsInit,
TsEnable,
TsDisable,
TsFini,
NULL,
};

View file

@ -13,5 +13,7 @@ Xsdl_LDADD = \
Xsdl_DEPENDENCIES = @KDRIVE_LOCAL_LIBS@
Xsdl_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
relink:
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)

View file

@ -12,12 +12,14 @@ KDRIVE_HW_SOURCES = \
vga.h
endif
if XV
KDRIVE_XV_SOURCES = \
kxv.c \
kxv.h
endif
libkdrive_a_SOURCES = \
fourcc.h \
kaa.c \
kaa.h \
kaapict.c \
kasync.c \
kcmap.c \
kcurscol.c \
kdrive.c \
@ -27,12 +29,8 @@ libkdrive_a_SOURCES = \
kkeymap.c \
kmap.c \
kmode.c \
knoop.c \
koffscreen.c \
kshadow.c \
ktest.c \
kxv.c \
kxv.h \
$(KDRIVE_XV_SOURCES) \
$(KDRIVE_HW_SOURCES) \
$(top_srcdir)/mi/miinitext.c

File diff suppressed because it is too large Load diff

View file

@ -1,120 +0,0 @@
/*
* Copyright © 2001 Keith Packard
*
* Partly based on code that is Copyright © The XFree86 Project Inc.
*
* 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, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD 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.
*/
#ifndef _KAA_H_
#define _KAA_H_
#include "picturestr.h"
#define KaaGetScreenPriv(s) ((KaaScreenPrivPtr) \
dixLookupPrivate(&(s)->devPrivates, kaaScreenPrivateKey))
#define KaaScreenPriv(s) KaaScreenPrivPtr pKaaScr = KaaGetScreenPriv(s)
#define KaaGetPixmapPriv(p) ((KaaPixmapPrivPtr) \
dixLookupPrivate(&(p)->devPrivates, kaaPixmapPrivateKey))
#define KaaSetPixmapPriv(p,a) \
dixSetPrivate(&(p)->devPrivates, kaaPixmapPrivateKey, a)
#define KaaPixmapPriv(p) KaaPixmapPrivPtr pKaaPixmap = KaaGetPixmapPriv(p)
typedef struct {
KaaScreenInfoPtr info;
} KaaScreenPrivRec, *KaaScreenPrivPtr;
typedef struct {
KdOffscreenArea *area;
int score;
int devKind;
DevUnion devPrivate;
Bool dirty;
} KaaPixmapPrivRec, *KaaPixmapPrivPtr;
extern DevPrivateKey kaaScreenPrivateKey;
extern DevPrivateKey kaaPixmapPrivateKey;
void
kaaPixmapUseScreen (PixmapPtr pPixmap);
void
kaaPixmapUseMemory (PixmapPtr pPixmap);
void
kaaDrawableDirty(DrawablePtr pDrawable);
Bool
kaaDrawableIsOffscreen (DrawablePtr pDrawable);
Bool
kaaPixmapIsOffscreen(PixmapPtr p);
PixmapPtr
kaaGetOffscreenPixmap (DrawablePtr pDrawable, int *xp, int *yp);
void
kaaMoveInPixmap (PixmapPtr pPixmap);
void
kaaMarkSync (ScreenPtr pScreen);
void
kaaWaitSync (ScreenPtr pScreen);
void
kaaCopyNtoN (DrawablePtr pSrcDrawable,
DrawablePtr pDstDrawable,
GCPtr pGC,
BoxPtr pbox,
int nbox,
int dx,
int dy,
Bool reverse,
Bool upsidedown,
Pixel bitplane,
void *closure);
void
kaaComposite(CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void
kaaRasterizeTrapezoid(PicturePtr pPict,
xTrapezoid *trap,
int xoff,
int yoff);
void
kaaInitTrapOffsets(int grid_order, float *x_offsets, float *y_offsets,
float x_offset, float y_offset);
#endif /* _KAA_H_ */

View file

@ -1,719 +0,0 @@
/*
* Copyright © 2001 Keith Packard
*
* Partly based on code that is Copyright © The XFree86 Project Inc.
*
* 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, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD 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.
*/
#ifdef HAVE_CONFIG_H
#include <kdrive-config.h>
#endif
#include "kdrive.h"
#include "kaa.h"
#ifdef RENDER
#include "mipict.h"
#define KAA_DEBUG_FALLBACKS 0
#if KAA_DEBUG_FALLBACKS
static void kaaCompositeFallbackPictDesc(PicturePtr pict, char *string, int n)
{
char format[20];
char size[20];
char loc;
int temp;
if (!pict) {
snprintf(string, n, "None");
return;
}
switch (pict->format)
{
case PICT_a8r8g8b8:
snprintf(format, 20, "ARGB8888");
break;
case PICT_r5g6b5:
snprintf(format, 20, "RGB565 ");
break;
case PICT_x1r5g5b5:
snprintf(format, 20, "RGB555 ");
break;
case PICT_a8:
snprintf(format, 20, "A8 ");
break;
case PICT_a1:
snprintf(format, 20, "A1 ");
break;
default:
snprintf(format, 20, "0x%x", (int)pict->format);
break;
}
loc = kaaGetOffscreenPixmap(pict->pDrawable, &temp, &temp) ? 's' : 'm';
snprintf(size, 20, "%dx%d%s", pict->pDrawable->width,
pict->pDrawable->height, pict->repeat ?
" R" : "");
snprintf(string, n, "0x%lx:%c fmt %s (%s)", (long)pict, loc, format, size);
}
static void
kaaPrintCompositeFallback(CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst)
{
char sop[20];
char srcdesc[40], maskdesc[40], dstdesc[40];
switch(op)
{
case PictOpSrc:
sprintf(sop, "Src");
break;
case PictOpOver:
sprintf(sop, "Over");
break;
default:
sprintf(sop, "0x%x", (int)op);
break;
}
kaaCompositeFallbackPictDesc(pSrc, srcdesc, 40);
kaaCompositeFallbackPictDesc(pMask, maskdesc, 40);
kaaCompositeFallbackPictDesc(pDst, dstdesc, 40);
ErrorF("Composite fallback: op %s, \n"
" src %s, \n"
" mask %s, \n"
" dst %s, \n",
sop, srcdesc, maskdesc, dstdesc);
}
static void
kaaPrintTrapezoidFallback(PicturePtr pDst)
{
char dstdesc[40];
kaaCompositeFallbackPictDesc(pDst, dstdesc, 40);
ErrorF("Trapezoid fallback: dst %s, %c/%s\n",
dstdesc,
(pDst->polyMode == PolyModePrecise) ? 'p' : 'i',
(pDst->polyEdge == PolyEdgeSharp) ? "a" : "aa");
}
#endif
static Bool
kaaGetPixelFromRGBA(CARD32 *pixel,
CARD16 red,
CARD16 green,
CARD16 blue,
CARD16 alpha,
CARD32 format)
{
int rbits, bbits, gbits, abits;
int rshift, bshift, gshift, ashift;
*pixel = 0;
if (!PICT_FORMAT_COLOR(format))
return FALSE;
rbits = PICT_FORMAT_R(format);
gbits = PICT_FORMAT_G(format);
bbits = PICT_FORMAT_B(format);
abits = PICT_FORMAT_A(format);
if (PICT_FORMAT_TYPE(format) == PICT_TYPE_ARGB) {
bshift = 0;
gshift = bbits;
rshift = gshift + gbits;
ashift = rshift + rbits;
} else { /* PICT_TYPE_ABGR */
rshift = 0;
gshift = rbits;
bshift = gshift + gbits;
ashift = bshift + bbits;
}
*pixel |= ( blue >> (16 - bbits)) << bshift;
*pixel |= ( red >> (16 - rbits)) << rshift;
*pixel |= (green >> (16 - gbits)) << gshift;
*pixel |= (alpha >> (16 - abits)) << ashift;
return TRUE;
}
static Bool
kaaGetRGBAFromPixel(CARD32 pixel,
CARD16 *red,
CARD16 *green,
CARD16 *blue,
CARD16 *alpha,
CARD32 format)
{
int rbits, bbits, gbits, abits;
int rshift, bshift, gshift, ashift;
if (!PICT_FORMAT_COLOR(format))
return FALSE;
rbits = PICT_FORMAT_R(format);
gbits = PICT_FORMAT_G(format);
bbits = PICT_FORMAT_B(format);
abits = PICT_FORMAT_A(format);
if (PICT_FORMAT_TYPE(format) == PICT_TYPE_ARGB) {
bshift = 0;
gshift = bbits;
rshift = gshift + gbits;
ashift = rshift + rbits;
} else { /* PICT_TYPE_ABGR */
rshift = 0;
gshift = rbits;
bshift = gshift + gbits;
ashift = bshift + bbits;
}
*red = ((pixel >> rshift ) & ((1 << rbits) - 1)) << (16 - rbits);
while (rbits < 16) {
*red |= *red >> rbits;
rbits <<= 1;
}
*green = ((pixel >> gshift ) & ((1 << gbits) - 1)) << (16 - gbits);
while (gbits < 16) {
*green |= *green >> gbits;
gbits <<= 1;
}
*blue = ((pixel >> bshift ) & ((1 << bbits) - 1)) << (16 - bbits);
while (bbits < 16) {
*blue |= *blue >> bbits;
bbits <<= 1;
}
if (abits) {
*alpha = ((pixel >> ashift ) & ((1 << abits) - 1)) << (16 - abits);
while (abits < 16) {
*alpha |= *alpha >> abits;
abits <<= 1;
}
} else
*alpha = 0xffff;
return TRUE;
}
static int
kaaTryDriverSolidFill(PicturePtr pSrc,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height)
{
KaaScreenPriv (pDst->pDrawable->pScreen);
RegionRec region;
BoxPtr pbox;
int nbox;
int dst_off_x, dst_off_y;
PixmapPtr pSrcPix, pDstPix;
CARD32 pixel;
CARD16 red, green, blue, alpha;
xDst += pDst->pDrawable->x;
yDst += pDst->pDrawable->y;
xSrc += pSrc->pDrawable->x;
ySrc += pSrc->pDrawable->y;
if (!miComputeCompositeRegion (&region, pSrc, NULL, pDst,
xSrc, ySrc, 0, 0, xDst, yDst,
width, height))
return 1;
if (pSrc->pDrawable->type == DRAWABLE_PIXMAP)
kaaPixmapUseMemory ((PixmapPtr) pSrc->pDrawable);
if (pDst->pDrawable->type == DRAWABLE_PIXMAP)
kaaPixmapUseScreen ((PixmapPtr) pDst->pDrawable);
pDstPix = kaaGetOffscreenPixmap (pDst->pDrawable, &dst_off_x, &dst_off_y);
if (!pDstPix) {
REGION_UNINIT(pDst->pDrawable->pScreen, &region);
return 0;
}
if (pSrc->pDrawable->type == DRAWABLE_WINDOW)
pSrcPix = (*pSrc->pDrawable->pScreen->GetWindowPixmap)(
(WindowPtr) (pSrc->pDrawable));
else
pSrcPix = (PixmapPtr) (pSrc->pDrawable);
/* If source is offscreen, we need to sync the accelerator
* before accessing it. We'd prefer for it to be in memory.
*/
if (kaaPixmapIsOffscreen(pSrcPix)) {
kaaWaitSync(pDst->pDrawable->pScreen);
}
pixel = *(CARD32 *)(pSrcPix->devPrivate.ptr);
if (!kaaGetRGBAFromPixel(pixel, &red, &green, &blue, &alpha,
pSrc->format))
{
REGION_UNINIT(pDst->pDrawable->pScreen, &region);
return -1;
}
kaaGetPixelFromRGBA(&pixel, red, green, blue, alpha,
pDst->format);
if (!(*pKaaScr->info->PrepareSolid) (pDstPix, GXcopy, 0xffffffff, pixel))
{
REGION_UNINIT(pDst->pDrawable->pScreen, &region);
return -1;
}
nbox = REGION_NUM_RECTS(&region);
pbox = REGION_RECTS(&region);
while (nbox--)
{
(*pKaaScr->info->Solid) (pbox->x1 + dst_off_x,
pbox->y1 + dst_off_y,
pbox->x2 + dst_off_x,
pbox->y2 + dst_off_y);
pbox++;
}
(*pKaaScr->info->DoneSolid) ();
kaaMarkSync (pDst->pDrawable->pScreen);
kaaDrawableDirty (pDst->pDrawable);
REGION_UNINIT(pDst->pDrawable->pScreen, &region);
return 1;
}
static int
kaaTryDriverBlend(CARD8 op,
PicturePtr pSrc,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height)
{
KaaScreenPriv (pDst->pDrawable->pScreen);
RegionRec region;
BoxPtr pbox;
int nbox;
int src_off_x, src_off_y, dst_off_x, dst_off_y;
PixmapPtr pSrcPix, pDstPix;
struct _Pixmap srcScratch;
xDst += pDst->pDrawable->x;
yDst += pDst->pDrawable->y;
xSrc += pSrc->pDrawable->x;
ySrc += pSrc->pDrawable->y;
if (!miComputeCompositeRegion (&region, pSrc, NULL, pDst,
xSrc, ySrc, 0, 0, xDst, yDst,
width, height))
return 1;
if (pSrc->pDrawable->type == DRAWABLE_PIXMAP)
kaaPixmapUseScreen ((PixmapPtr) pSrc->pDrawable);
if (pDst->pDrawable->type == DRAWABLE_PIXMAP)
kaaPixmapUseScreen ((PixmapPtr) pDst->pDrawable);
pSrcPix = kaaGetOffscreenPixmap (pSrc->pDrawable, &src_off_x, &src_off_y);
pDstPix = kaaGetOffscreenPixmap (pDst->pDrawable, &dst_off_x, &dst_off_y);
if (!pDstPix) {
REGION_UNINIT(pDst->pDrawable->pScreen, &region);
return 0;
}
if (!pSrcPix && pKaaScr->info->UploadToScratch) {
if ((*pKaaScr->info->UploadToScratch) ((PixmapPtr) pSrc->pDrawable,
&srcScratch))
pSrcPix = &srcScratch;
}
if (!pSrcPix) {
REGION_UNINIT(pDst->pDrawable->pScreen, &region);
return 0;
}
if (!(*pKaaScr->info->PrepareBlend) (op, pSrc, pDst, pSrcPix,
pDstPix))
{
REGION_UNINIT(pDst->pDrawable->pScreen, &region);
return -1;
}
nbox = REGION_NUM_RECTS(&region);
pbox = REGION_RECTS(&region);
xSrc -= xDst;
ySrc -= yDst;
while (nbox--)
{
(*pKaaScr->info->Blend) (pbox->x1 + xSrc + src_off_x,
pbox->y1 + ySrc + src_off_y,
pbox->x1 + dst_off_x,
pbox->y1 + dst_off_y,
pbox->x2 - pbox->x1,
pbox->y2 - pbox->y1);
pbox++;
}
(*pKaaScr->info->DoneBlend) ();
kaaMarkSync (pDst->pDrawable->pScreen);
kaaDrawableDirty (pDst->pDrawable);
REGION_UNINIT(pDst->pDrawable->pScreen, &region);
return 1;
}
static int
kaaTryDriverComposite(CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height)
{
KaaScreenPriv (pDst->pDrawable->pScreen);
RegionRec region;
BoxPtr pbox;
int nbox;
int src_off_x, src_off_y, mask_off_x, mask_off_y, dst_off_x, dst_off_y;
PixmapPtr pSrcPix, pMaskPix = NULL, pDstPix;
struct _Pixmap scratch;
xDst += pDst->pDrawable->x;
yDst += pDst->pDrawable->y;
if (pMask) {
xMask += pMask->pDrawable->x;
yMask += pMask->pDrawable->y;
}
xSrc += pSrc->pDrawable->x;
ySrc += pSrc->pDrawable->y;
if (!miComputeCompositeRegion (&region, pSrc, pMask, pDst,
xSrc, ySrc, xMask, yMask, xDst, yDst,
width, height))
return 1;
if (pKaaScr->info->CheckComposite &&
!(*pKaaScr->info->CheckComposite) (op, pSrc, pMask, pDst))
{
REGION_UNINIT(pDst->pDrawable->pScreen, &region);
return -1;
}
if (pSrc->pDrawable->type == DRAWABLE_PIXMAP)
kaaPixmapUseScreen ((PixmapPtr) pSrc->pDrawable);
if (pMask && pMask->pDrawable->type == DRAWABLE_PIXMAP)
kaaPixmapUseScreen ((PixmapPtr) pMask->pDrawable);
if (pDst->pDrawable->type == DRAWABLE_PIXMAP)
kaaPixmapUseScreen ((PixmapPtr) pDst->pDrawable);
pSrcPix = kaaGetOffscreenPixmap (pSrc->pDrawable, &src_off_x, &src_off_y);
if (pMask)
pMaskPix = kaaGetOffscreenPixmap (pMask->pDrawable, &mask_off_x,
&mask_off_y);
pDstPix = kaaGetOffscreenPixmap (pDst->pDrawable, &dst_off_x, &dst_off_y);
if (!pDstPix) {
REGION_UNINIT(pDst->pDrawable->pScreen, &region);
return 0;
}
if (!pSrcPix && (!pMask || pMaskPix) && pKaaScr->info->UploadToScratch) {
if (pSrc->pDrawable->type == DRAWABLE_WINDOW)
pSrcPix = (*pSrc->pDrawable->pScreen->GetWindowPixmap) (
(WindowPtr) pSrc->pDrawable);
else
pSrcPix = (PixmapPtr) pSrc->pDrawable;
if ((*pKaaScr->info->UploadToScratch) (pSrcPix, &scratch))
pSrcPix = &scratch;
} else if (pSrcPix && pMask && !pMaskPix && pKaaScr->info->UploadToScratch) {
if (pMask->pDrawable->type == DRAWABLE_WINDOW)
pMaskPix = (*pMask->pDrawable->pScreen->GetWindowPixmap) (
(WindowPtr) pMask->pDrawable);
else
pMaskPix = (PixmapPtr) pMask->pDrawable;
if ((*pKaaScr->info->UploadToScratch) (pMaskPix, &scratch))
pMaskPix = &scratch;
}
if (!pSrcPix || (pMask && !pMaskPix)) {
REGION_UNINIT(pDst->pDrawable->pScreen, &region);
return 0;
}
if (!(*pKaaScr->info->PrepareComposite) (op, pSrc, pMask, pDst, pSrcPix,
pMaskPix, pDstPix))
{
REGION_UNINIT(pDst->pDrawable->pScreen, &region);
return -1;
}
nbox = REGION_NUM_RECTS(&region);
pbox = REGION_RECTS(&region);
xMask -= xDst;
yMask -= yDst;
xSrc -= xDst;
ySrc -= yDst;
while (nbox--)
{
(*pKaaScr->info->Composite) (pbox->x1 + xSrc + src_off_x,
pbox->y1 + ySrc + src_off_y,
pbox->x1 + xMask + mask_off_x,
pbox->y1 + yMask + mask_off_y,
pbox->x1 + dst_off_x,
pbox->y1 + dst_off_y,
pbox->x2 - pbox->x1,
pbox->y2 - pbox->y1);
pbox++;
}
(*pKaaScr->info->DoneComposite) ();
kaaMarkSync (pDst->pDrawable->pScreen);
kaaDrawableDirty (pDst->pDrawable);
REGION_UNINIT(pDst->pDrawable->pScreen, &region);
return 1;
}
void
kaaComposite(CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height)
{
KdScreenPriv (pDst->pDrawable->pScreen);
KaaScreenPriv (pDst->pDrawable->pScreen);
int ret = -1;
if (!pMask && pSrc->pDrawable)
{
if (op == PictOpSrc)
{
if (pScreenPriv->enabled && pSrc->pDrawable && pSrc->pDrawable->width == 1 &&
pSrc->pDrawable->height == 1 && pSrc->repeat)
{
ret = kaaTryDriverSolidFill(pSrc, pDst, xSrc, ySrc, xDst, yDst,
width, height);
if (ret == 1)
return;
}
else if (!pSrc->repeat && !pSrc->transform &&
pSrc->format == pDst->format)
{
RegionRec region;
xDst += pDst->pDrawable->x;
yDst += pDst->pDrawable->y;
xSrc += pSrc->pDrawable->x;
ySrc += pSrc->pDrawable->y;
if (!miComputeCompositeRegion (&region, pSrc, pMask, pDst,
xSrc, ySrc, xMask, yMask, xDst,
yDst, width, height))
return;
kaaCopyNtoN (pSrc->pDrawable, pDst->pDrawable, 0,
REGION_RECTS(&region), REGION_NUM_RECTS(&region),
xSrc - xDst, ySrc - yDst,
FALSE, FALSE, 0, 0);
return;
}
}
if (pScreenPriv->enabled && pKaaScr->info->PrepareBlend &&
!pSrc->alphaMap && !pDst->alphaMap)
{
ret = kaaTryDriverBlend(op, pSrc, pDst, xSrc, ySrc, xDst, yDst,
width, height);
if (ret == 1)
return;
}
}
if (pSrc->pDrawable && (!pMask || pMask->pDrawable) &&
pScreenPriv->enabled && pKaaScr->info->PrepareComposite &&
!pSrc->alphaMap && (!pMask || !pMask->alphaMap) && !pDst->alphaMap)
{
ret = kaaTryDriverComposite(op, pSrc, pMask, pDst, xSrc, ySrc, xMask,
yMask, xDst, yDst, width, height);
if (ret == 1)
return;
}
if (ret != 0) {
/* failure to accelerate was not due to pixmaps being in the wrong
* locations.
*/
if (pSrc->pDrawable->type == DRAWABLE_PIXMAP)
kaaPixmapUseMemory ((PixmapPtr) pSrc->pDrawable);
if (pMask && pMask->pDrawable->type == DRAWABLE_PIXMAP)
kaaPixmapUseMemory ((PixmapPtr) pMask->pDrawable);
if (pDst->pDrawable->type == DRAWABLE_PIXMAP)
kaaPixmapUseMemory ((PixmapPtr) pDst->pDrawable);
}
#if KAA_DEBUG_FALLBACKS
kaaPrintCompositeFallback (op, pSrc, pMask, pDst);
#endif
KdCheckComposite (op, pSrc, pMask, pDst, xSrc, ySrc,
xMask, yMask, xDst, yDst, width, height);
}
#endif
static xFixed
miLineFixedX (xLineFixed *l, xFixed y, Bool ceil)
{
xFixed dx = l->p2.x - l->p1.x;
xFixed_32_32 ex = (xFixed_32_32) (y - l->p1.y) * dx;
xFixed dy = l->p2.y - l->p1.y;
if (ceil)
ex += (dy - 1);
return l->p1.x + (xFixed) (ex / dy);
}
/* Need to decide just how much to trim, to maintain translation independence
* when converted to floating point.
*/
#define XFIXED_TO_FLOAT(x) (((float)((x) & 0xffffff00)) / 65536.0)
/* This is just to allow us to work on the hardware side of the problem while
* waiting for cairo to get a new tesselator. We may not be able to support
* RasterizeTrapezoid at all due to the abutting edges requirement, but it might
* be technically legal if we widened the trap by some epsilon, so that alpha
* values at abutting edges were a little too big and capped at one, rather than
* a little too small and looked bad.
*/
void kaaRasterizeTrapezoid(PicturePtr pDst,
xTrapezoid *trap,
int xoff,
int yoff)
{
KdScreenPriv (pDst->pDrawable->pScreen);
KaaScreenPriv (pDst->pDrawable->pScreen);
KaaTrapezoid ktrap;
PixmapPtr pPix;
xFixed x1, x2;
if (!pScreenPriv->enabled ||
!pKaaScr->info->PrepareTrapezoids ||
pDst->pDrawable->type != DRAWABLE_PIXMAP ||
pDst->alphaMap || pDst->format != PICT_a8)
{
KdCheckRasterizeTrapezoid (pDst, trap, xoff, yoff);
#if KAA_DEBUG_FALLBACKS
kaaPrintTrapezoidFallback (pDst);
#endif
return;
}
pPix = (PixmapPtr)pDst->pDrawable;
kaaPixmapUseScreen (pPix);
if (!kaaPixmapIsOffscreen (pPix) ||
!(*pKaaScr->info->PrepareTrapezoids) (pDst, pPix))
{
#if KAA_DEBUG_FALLBACKS
kaaPrintTrapezoidFallback (pDst);
#endif
KdCheckRasterizeTrapezoid (pDst, trap, xoff, yoff);
return;
}
ktrap.ty = XFIXED_TO_FLOAT(trap->top) + yoff;
x1 = miLineFixedX (&trap->left, trap->top, FALSE);
x2 = miLineFixedX (&trap->right, trap->top, TRUE);
ktrap.tl = XFIXED_TO_FLOAT(x1) + xoff;
ktrap.tr = XFIXED_TO_FLOAT(x2) + xoff;
ktrap.by = XFIXED_TO_FLOAT(trap->bottom) + yoff;
x1 = miLineFixedX (&trap->left, trap->bottom, FALSE);
x2 = miLineFixedX (&trap->right, trap->bottom, TRUE);
ktrap.bl = XFIXED_TO_FLOAT(x1) + xoff;
ktrap.br = XFIXED_TO_FLOAT(x2) + xoff;
(*pKaaScr->info->Trapezoids) (&ktrap, 1);
(*pKaaScr->info->DoneTrapezoids) ();
}
void
kaaInitTrapOffsets(int grid_order, float *x_offsets, float *y_offsets,
float x_offset, float y_offset)
{
int i = 0;
float x, y, x_count, y_count;
x_count = (1 << (grid_order / 2)) + 1;
y_count = (1 << (grid_order / 2)) - 1;
x_offset += 1.0 / x_count / 2.0;
y_offset += 1.0 / y_count / 2.0;
for (x = 0; x < x_count; x++) {
for (y = 0; y < y_count; y++) {
x_offsets[i] = x / x_count + x_offset;
y_offsets[i] = y / y_count + y_offset;
i++;
}
}
}

View file

@ -1,341 +0,0 @@
/*
* Copyright © 1999 Keith Packard
*
* 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, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD 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.
*/
#ifdef HAVE_CONFIG_H
#include <kdrive-config.h>
#endif
#include "kdrive.h"
#include "kaa.h"
#include "picturestr.h"
#include "mipict.h"
#include "fbpict.h"
/*
* These functions wrap the low-level fb rendering functions and
* synchronize framebuffer/accelerated drawing by stalling until
* the accelerator is idle
*/
void
KdCheckFillSpans (DrawablePtr pDrawable, GCPtr pGC, int nspans,
DDXPointPtr ppt, int *pwidth, int fSorted)
{
kaaWaitSync (pDrawable->pScreen);
kaaDrawableDirty (pDrawable);
fbFillSpans (pDrawable, pGC, nspans, ppt, pwidth, fSorted);
}
void
KdCheckSetSpans (DrawablePtr pDrawable, GCPtr pGC, char *psrc,
DDXPointPtr ppt, int *pwidth, int nspans, int fSorted)
{
kaaWaitSync (pDrawable->pScreen);
kaaDrawableDirty (pDrawable);
fbSetSpans (pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted);
}
void
KdCheckPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth,
int x, int y, int w, int h, int leftPad, int format,
char *bits)
{
kaaWaitSync (pDrawable->pScreen);
kaaDrawableDirty (pDrawable);
fbPutImage (pDrawable, pGC, depth, x, y, w, h, leftPad, format, bits);
}
RegionPtr
KdCheckCopyArea (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
int srcx, int srcy, int w, int h, int dstx, int dsty)
{
kaaWaitSync (pSrc->pScreen);
kaaDrawableDirty (pDst);
return fbCopyArea (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty);
}
RegionPtr
KdCheckCopyPlane (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
int srcx, int srcy, int w, int h, int dstx, int dsty,
unsigned long bitPlane)
{
kaaWaitSync (pSrc->pScreen);
kaaDrawableDirty (pDst);
return fbCopyPlane (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty,
bitPlane);
}
void
KdCheckPolyPoint (DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
DDXPointPtr pptInit)
{
kaaWaitSync (pDrawable->pScreen);
kaaDrawableDirty (pDrawable);
fbPolyPoint (pDrawable, pGC, mode, npt, pptInit);
}
void
KdCheckPolylines (DrawablePtr pDrawable, GCPtr pGC,
int mode, int npt, DDXPointPtr ppt)
{
if (pGC->lineWidth == 0) {
kaaWaitSync(pDrawable->pScreen);
kaaDrawableDirty (pDrawable);
}
kaaDrawableDirty (pDrawable);
fbPolyLine (pDrawable, pGC, mode, npt, ppt);
}
void
KdCheckPolySegment (DrawablePtr pDrawable, GCPtr pGC,
int nsegInit, xSegment *pSegInit)
{
if (pGC->lineWidth == 0) {
kaaWaitSync(pDrawable->pScreen);
kaaDrawableDirty (pDrawable);
}
kaaDrawableDirty (pDrawable);
fbPolySegment (pDrawable, pGC, nsegInit, pSegInit);
}
void
KdCheckPolyRectangle (DrawablePtr pDrawable, GCPtr pGC,
int nrects, xRectangle *prect)
{
if (pGC->lineWidth == 0) {
kaaWaitSync(pDrawable->pScreen);
kaaDrawableDirty (pDrawable);
}
fbPolyRectangle (pDrawable, pGC, nrects, prect);
}
void
KdCheckPolyArc (DrawablePtr pDrawable, GCPtr pGC,
int narcs, xArc *pArcs)
{
if (pGC->lineWidth == 0)
{
kaaWaitSync(pDrawable->pScreen);
kaaDrawableDirty (pDrawable);
fbPolyArc (pDrawable, pGC, narcs, pArcs);
}
else
miPolyArc (pDrawable, pGC, narcs, pArcs);
}
#if 0
void
KdCheckFillPolygon (DrawablePtr pDrawable, GCPtr pGC,
int shape, int mode, int count, DDXPointPtr pPts)
{
kaaWaitSync(pDrawable->pScreen);
kaaDrawableDirty (pDrawable);
fbFillPolygon (pDrawable, pGC, mode, count, pPts);
}
#endif
void
KdCheckPolyFillRect (DrawablePtr pDrawable, GCPtr pGC,
int nrect, xRectangle *prect)
{
kaaWaitSync(pDrawable->pScreen);
kaaDrawableDirty (pDrawable);
fbPolyFillRect (pDrawable, pGC, nrect, prect);
}
void
KdCheckPolyFillArc (DrawablePtr pDrawable, GCPtr pGC,
int narcs, xArc *pArcs)
{
kaaWaitSync(pDrawable->pScreen);
kaaDrawableDirty (pDrawable);
fbPolyFillArc (pDrawable, pGC, narcs, pArcs);
}
void
KdCheckImageGlyphBlt (DrawablePtr pDrawable, GCPtr pGC,
int x, int y, unsigned int nglyph,
CharInfoPtr *ppci, pointer pglyphBase)
{
kaaWaitSync(pDrawable->pScreen);
kaaDrawableDirty (pDrawable);
fbImageGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
}
void
KdCheckPolyGlyphBlt (DrawablePtr pDrawable, GCPtr pGC,
int x, int y, unsigned int nglyph,
CharInfoPtr *ppci, pointer pglyphBase)
{
kaaWaitSync(pDrawable->pScreen);
kaaDrawableDirty (pDrawable);
fbPolyGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
}
void
KdCheckPushPixels (GCPtr pGC, PixmapPtr pBitmap,
DrawablePtr pDrawable,
int w, int h, int x, int y)
{
kaaWaitSync(pDrawable->pScreen);
kaaDrawableDirty (pDrawable);
fbPushPixels (pGC, pBitmap, pDrawable, w, h, x, y);
}
void
KdCheckGetImage (DrawablePtr pDrawable,
int x, int y, int w, int h,
unsigned int format, unsigned long planeMask,
char *d)
{
kaaWaitSync(pDrawable->pScreen);
fbGetImage (pDrawable, x, y, w, h, format, planeMask, d);
}
void
KdCheckGetSpans (DrawablePtr pDrawable,
int wMax,
DDXPointPtr ppt,
int *pwidth,
int nspans,
char *pdstStart)
{
kaaWaitSync(pDrawable->pScreen);
fbGetSpans (pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
}
void
KdCheckCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
{
kaaWaitSync (pWin->drawable.pScreen);
kaaDrawableDirty ((DrawablePtr)pWin);
fbCopyWindow (pWin, ptOldOrg, prgnSrc);
}
#if KD_MAX_FB > 1
void
KdCheckPaintKey(DrawablePtr pDrawable,
RegionPtr pRegion,
CARD32 pixel,
int layer)
{
kaaWaitSync (pDrawable->pScreen);
kaaDrawableDirty (pDrawable);
fbOverlayPaintKey (pDrawable, pRegion, pixel, layer);
}
void
KdCheckOverlayCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
{
kaaWaitSync (pWin->drawable.pScreen);
kaaDrawableDirty ((DrawablePtr)pWin);
fbOverlayCopyWindow (pWin, ptOldOrg, prgnSrc);
}
#endif
void
KdScreenInitAsync (ScreenPtr pScreen)
{
pScreen->GetImage = KdCheckGetImage;
pScreen->GetSpans = KdCheckGetSpans;
pScreen->CopyWindow = KdCheckCopyWindow;
#ifdef RENDER
KdPictureInitAsync (pScreen);
#endif
}
void
KdCheckComposite (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height)
{
kaaWaitSync (pDst->pDrawable->pScreen);
kaaDrawableDirty (pDst->pDrawable);
fbComposite (op,
pSrc,
pMask,
pDst,
xSrc,
ySrc,
xMask,
yMask,
xDst,
yDst,
width,
height);
}
void
KdCheckRasterizeTrapezoid(PicturePtr pMask,
xTrapezoid *trap,
int x_off,
int y_off)
{
kaaWaitSync (pMask->pDrawable->pScreen);
kaaDrawableDirty (pMask->pDrawable);
fbRasterizeTrapezoid (pMask, trap, x_off, y_off);
}
/*
* Only need to stall for copyarea/copyplane
*/
const GCOps kdAsyncPixmapGCOps = {
fbFillSpans,
fbSetSpans,
fbPutImage,
KdCheckCopyArea,
KdCheckCopyPlane,
fbPolyPoint,
fbPolyLine,
fbPolySegment,
fbPolyRectangle,
fbPolyArc,
fbFillPolygon,
fbPolyFillRect,
fbPolyFillArc,
miPolyText8,
miPolyText16,
miImageText8,
miImageText16,
fbImageGlyphBlt,
fbPolyGlyphBlt,
fbPushPixels
};
void
KdPictureInitAsync (ScreenPtr pScreen)
{
PictureScreenPtr ps;
ps = GetPictureScreen(pScreen);
ps->Composite = KdCheckComposite;
ps->RasterizeTrapezoid = KdCheckRasterizeTrapezoid;
}

View file

@ -1,881 +0,0 @@
/*
* Copyright © 1999 Keith Packard
*
* 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, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD 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.
*/
#ifdef HAVE_CONFIG_H
#include <kdrive-config.h>
#endif
#include "kdrive.h"
#include <stdio.h>
#include "os.h"
#include "opaque.h"
#include <X11/keysym.h>
unsigned char
KdToLower (unsigned char a)
{
if ((a >= XK_A) && (a <= XK_Z))
return a + (XK_a - XK_A);
else if ((a >= XK_Agrave) && (a <= XK_Odiaeresis))
return a + (XK_agrave - XK_Agrave);
else if ((a >= XK_Ooblique) && (a <= XK_Thorn))
return a + (XK_oslash - XK_Ooblique);
else
return a;
}
int
KdStrCaseCmp (const unsigned char *s1, const unsigned char *s2, int l2)
{
unsigned char c1, c2;
for (;;)
{
c1 = KdToLower (*s1++);
if (l2 == 0)
c2 = '\0';
else
c2 = KdToLower (*s2++);
if (!c1 || !c2)
break;
if (c1 != c2)
break;
l2--;
}
return c2 - c1;
}
typedef struct _kdNamedColor {
unsigned short red;
unsigned short green;
unsigned short blue;
const unsigned char *name;
} KdNamedColor;
#define C 0x101
const KdNamedColor KdColors[] = {
{ 240*C, 248*C, 255*C, "alice blue" },
{ 240*C, 248*C, 255*C, "AliceBlue" },
{ 250*C, 235*C, 215*C, "antique white" },
{ 250*C, 235*C, 215*C, "AntiqueWhite" },
{ 255*C, 239*C, 219*C, "AntiqueWhite1" },
{ 238*C, 223*C, 204*C, "AntiqueWhite2" },
{ 205*C, 192*C, 176*C, "AntiqueWhite3" },
{ 139*C, 131*C, 120*C, "AntiqueWhite4" },
{ 127*C, 255*C, 212*C, "aquamarine" },
{ 127*C, 255*C, 212*C, "aquamarine1" },
{ 118*C, 238*C, 198*C, "aquamarine2" },
{ 102*C, 205*C, 170*C, "aquamarine3" },
{ 69*C, 139*C, 116*C, "aquamarine4" },
{ 240*C, 255*C, 255*C, "azure" },
{ 240*C, 255*C, 255*C, "azure1" },
{ 224*C, 238*C, 238*C, "azure2" },
{ 193*C, 205*C, 205*C, "azure3" },
{ 131*C, 139*C, 139*C, "azure4" },
{ 245*C, 245*C, 220*C, "beige" },
{ 255*C, 228*C, 196*C, "bisque" },
{ 255*C, 228*C, 196*C, "bisque1" },
{ 238*C, 213*C, 183*C, "bisque2" },
{ 205*C, 183*C, 158*C, "bisque3" },
{ 139*C, 125*C, 107*C, "bisque4" },
{ 0*C, 0*C, 0*C, "black" },
{ 255*C, 235*C, 205*C, "blanched almond" },
{ 255*C, 235*C, 205*C, "BlanchedAlmond" },
{ 0*C, 0*C, 255*C, "blue" },
{ 138*C, 43*C, 226*C, "blue violet" },
{ 0*C, 0*C, 255*C, "blue1" },
{ 0*C, 0*C, 238*C, "blue2" },
{ 0*C, 0*C, 205*C, "blue3" },
{ 0*C, 0*C, 139*C, "blue4" },
{ 138*C, 43*C, 226*C, "BlueViolet" },
{ 165*C, 42*C, 42*C, "brown" },
{ 255*C, 64*C, 64*C, "brown1" },
{ 238*C, 59*C, 59*C, "brown2" },
{ 205*C, 51*C, 51*C, "brown3" },
{ 139*C, 35*C, 35*C, "brown4" },
{ 222*C, 184*C, 135*C, "burlywood" },
{ 255*C, 211*C, 155*C, "burlywood1" },
{ 238*C, 197*C, 145*C, "burlywood2" },
{ 205*C, 170*C, 125*C, "burlywood3" },
{ 139*C, 115*C, 85*C, "burlywood4" },
{ 95*C, 158*C, 160*C, "cadet blue" },
{ 95*C, 158*C, 160*C, "CadetBlue" },
{ 152*C, 245*C, 255*C, "CadetBlue1" },
{ 142*C, 229*C, 238*C, "CadetBlue2" },
{ 122*C, 197*C, 205*C, "CadetBlue3" },
{ 83*C, 134*C, 139*C, "CadetBlue4" },
{ 127*C, 255*C, 0*C, "chartreuse" },
{ 127*C, 255*C, 0*C, "chartreuse1" },
{ 118*C, 238*C, 0*C, "chartreuse2" },
{ 102*C, 205*C, 0*C, "chartreuse3" },
{ 69*C, 139*C, 0*C, "chartreuse4" },
{ 210*C, 105*C, 30*C, "chocolate" },
{ 255*C, 127*C, 36*C, "chocolate1" },
{ 238*C, 118*C, 33*C, "chocolate2" },
{ 205*C, 102*C, 29*C, "chocolate3" },
{ 139*C, 69*C, 19*C, "chocolate4" },
{ 255*C, 127*C, 80*C, "coral" },
{ 255*C, 114*C, 86*C, "coral1" },
{ 238*C, 106*C, 80*C, "coral2" },
{ 205*C, 91*C, 69*C, "coral3" },
{ 139*C, 62*C, 47*C, "coral4" },
{ 100*C, 149*C, 237*C, "cornflower blue" },
{ 100*C, 149*C, 237*C, "CornflowerBlue" },
{ 255*C, 248*C, 220*C, "cornsilk" },
{ 255*C, 248*C, 220*C, "cornsilk1" },
{ 238*C, 232*C, 205*C, "cornsilk2" },
{ 205*C, 200*C, 177*C, "cornsilk3" },
{ 139*C, 136*C, 120*C, "cornsilk4" },
{ 0*C, 255*C, 255*C, "cyan" },
{ 0*C, 255*C, 255*C, "cyan1" },
{ 0*C, 238*C, 238*C, "cyan2" },
{ 0*C, 205*C, 205*C, "cyan3" },
{ 0*C, 139*C, 139*C, "cyan4" },
{ 0*C, 0*C, 139*C, "dark blue" },
{ 0*C, 139*C, 139*C, "dark cyan" },
{ 184*C, 134*C, 11*C, "dark goldenrod" },
{ 169*C, 169*C, 169*C, "dark gray" },
{ 0*C, 100*C, 0*C, "dark green" },
{ 169*C, 169*C, 169*C, "dark grey" },
{ 189*C, 183*C, 107*C, "dark khaki" },
{ 139*C, 0*C, 139*C, "dark magenta" },
{ 85*C, 107*C, 47*C, "dark olive green" },
{ 255*C, 140*C, 0*C, "dark orange" },
{ 153*C, 50*C, 204*C, "dark orchid" },
{ 139*C, 0*C, 0*C, "dark red" },
{ 233*C, 150*C, 122*C, "dark salmon" },
{ 143*C, 188*C, 143*C, "dark sea green" },
{ 72*C, 61*C, 139*C, "dark slate blue" },
{ 47*C, 79*C, 79*C, "dark slate gray" },
{ 47*C, 79*C, 79*C, "dark slate grey" },
{ 0*C, 206*C, 209*C, "dark turquoise" },
{ 148*C, 0*C, 211*C, "dark violet" },
{ 0*C, 0*C, 139*C, "DarkBlue" },
{ 0*C, 139*C, 139*C, "DarkCyan" },
{ 184*C, 134*C, 11*C, "DarkGoldenrod" },
{ 255*C, 185*C, 15*C, "DarkGoldenrod1" },
{ 238*C, 173*C, 14*C, "DarkGoldenrod2" },
{ 205*C, 149*C, 12*C, "DarkGoldenrod3" },
{ 139*C, 101*C, 8*C, "DarkGoldenrod4" },
{ 169*C, 169*C, 169*C, "DarkGray" },
{ 0*C, 100*C, 0*C, "DarkGreen" },
{ 169*C, 169*C, 169*C, "DarkGrey" },
{ 189*C, 183*C, 107*C, "DarkKhaki" },
{ 139*C, 0*C, 139*C, "DarkMagenta" },
{ 85*C, 107*C, 47*C, "DarkOliveGreen" },
{ 202*C, 255*C, 112*C, "DarkOliveGreen1" },
{ 188*C, 238*C, 104*C, "DarkOliveGreen2" },
{ 162*C, 205*C, 90*C, "DarkOliveGreen3" },
{ 110*C, 139*C, 61*C, "DarkOliveGreen4" },
{ 255*C, 140*C, 0*C, "DarkOrange" },
{ 255*C, 127*C, 0*C, "DarkOrange1" },
{ 238*C, 118*C, 0*C, "DarkOrange2" },
{ 205*C, 102*C, 0*C, "DarkOrange3" },
{ 139*C, 69*C, 0*C, "DarkOrange4" },
{ 153*C, 50*C, 204*C, "DarkOrchid" },
{ 191*C, 62*C, 255*C, "DarkOrchid1" },
{ 178*C, 58*C, 238*C, "DarkOrchid2" },
{ 154*C, 50*C, 205*C, "DarkOrchid3" },
{ 104*C, 34*C, 139*C, "DarkOrchid4" },
{ 139*C, 0*C, 0*C, "DarkRed" },
{ 233*C, 150*C, 122*C, "DarkSalmon" },
{ 143*C, 188*C, 143*C, "DarkSeaGreen" },
{ 193*C, 255*C, 193*C, "DarkSeaGreen1" },
{ 180*C, 238*C, 180*C, "DarkSeaGreen2" },
{ 155*C, 205*C, 155*C, "DarkSeaGreen3" },
{ 105*C, 139*C, 105*C, "DarkSeaGreen4" },
{ 72*C, 61*C, 139*C, "DarkSlateBlue" },
{ 47*C, 79*C, 79*C, "DarkSlateGray" },
{ 151*C, 255*C, 255*C, "DarkSlateGray1" },
{ 141*C, 238*C, 238*C, "DarkSlateGray2" },
{ 121*C, 205*C, 205*C, "DarkSlateGray3" },
{ 82*C, 139*C, 139*C, "DarkSlateGray4" },
{ 47*C, 79*C, 79*C, "DarkSlateGrey" },
{ 0*C, 206*C, 209*C, "DarkTurquoise" },
{ 148*C, 0*C, 211*C, "DarkViolet" },
{ 255*C, 20*C, 147*C, "deep pink" },
{ 0*C, 191*C, 255*C, "deep sky blue" },
{ 255*C, 20*C, 147*C, "DeepPink" },
{ 255*C, 20*C, 147*C, "DeepPink1" },
{ 238*C, 18*C, 137*C, "DeepPink2" },
{ 205*C, 16*C, 118*C, "DeepPink3" },
{ 139*C, 10*C, 80*C, "DeepPink4" },
{ 0*C, 191*C, 255*C, "DeepSkyBlue" },
{ 0*C, 191*C, 255*C, "DeepSkyBlue1" },
{ 0*C, 178*C, 238*C, "DeepSkyBlue2" },
{ 0*C, 154*C, 205*C, "DeepSkyBlue3" },
{ 0*C, 104*C, 139*C, "DeepSkyBlue4" },
{ 105*C, 105*C, 105*C, "dim gray" },
{ 105*C, 105*C, 105*C, "dim grey" },
{ 105*C, 105*C, 105*C, "DimGray" },
{ 105*C, 105*C, 105*C, "DimGrey" },
{ 30*C, 144*C, 255*C, "dodger blue" },
{ 30*C, 144*C, 255*C, "DodgerBlue" },
{ 30*C, 144*C, 255*C, "DodgerBlue1" },
{ 28*C, 134*C, 238*C, "DodgerBlue2" },
{ 24*C, 116*C, 205*C, "DodgerBlue3" },
{ 16*C, 78*C, 139*C, "DodgerBlue4" },
{ 178*C, 34*C, 34*C, "firebrick" },
{ 255*C, 48*C, 48*C, "firebrick1" },
{ 238*C, 44*C, 44*C, "firebrick2" },
{ 205*C, 38*C, 38*C, "firebrick3" },
{ 139*C, 26*C, 26*C, "firebrick4" },
{ 255*C, 250*C, 240*C, "floral white" },
{ 255*C, 250*C, 240*C, "FloralWhite" },
{ 34*C, 139*C, 34*C, "forest green" },
{ 34*C, 139*C, 34*C, "ForestGreen" },
{ 220*C, 220*C, 220*C, "gainsboro" },
{ 248*C, 248*C, 255*C, "ghost white" },
{ 248*C, 248*C, 255*C, "GhostWhite" },
{ 255*C, 215*C, 0*C, "gold" },
{ 255*C, 215*C, 0*C, "gold1" },
{ 238*C, 201*C, 0*C, "gold2" },
{ 205*C, 173*C, 0*C, "gold3" },
{ 139*C, 117*C, 0*C, "gold4" },
{ 218*C, 165*C, 32*C, "goldenrod" },
{ 255*C, 193*C, 37*C, "goldenrod1" },
{ 238*C, 180*C, 34*C, "goldenrod2" },
{ 205*C, 155*C, 29*C, "goldenrod3" },
{ 139*C, 105*C, 20*C, "goldenrod4" },
{ 190*C, 190*C, 190*C, "gray" },
{ 0*C, 0*C, 0*C, "gray0" },
{ 3*C, 3*C, 3*C, "gray1" },
{ 26*C, 26*C, 26*C, "gray10" },
{ 255*C, 255*C, 255*C, "gray100" },
{ 28*C, 28*C, 28*C, "gray11" },
{ 31*C, 31*C, 31*C, "gray12" },
{ 33*C, 33*C, 33*C, "gray13" },
{ 36*C, 36*C, 36*C, "gray14" },
{ 38*C, 38*C, 38*C, "gray15" },
{ 41*C, 41*C, 41*C, "gray16" },
{ 43*C, 43*C, 43*C, "gray17" },
{ 46*C, 46*C, 46*C, "gray18" },
{ 48*C, 48*C, 48*C, "gray19" },
{ 5*C, 5*C, 5*C, "gray2" },
{ 51*C, 51*C, 51*C, "gray20" },
{ 54*C, 54*C, 54*C, "gray21" },
{ 56*C, 56*C, 56*C, "gray22" },
{ 59*C, 59*C, 59*C, "gray23" },
{ 61*C, 61*C, 61*C, "gray24" },
{ 64*C, 64*C, 64*C, "gray25" },
{ 66*C, 66*C, 66*C, "gray26" },
{ 69*C, 69*C, 69*C, "gray27" },
{ 71*C, 71*C, 71*C, "gray28" },
{ 74*C, 74*C, 74*C, "gray29" },
{ 8*C, 8*C, 8*C, "gray3" },
{ 77*C, 77*C, 77*C, "gray30" },
{ 79*C, 79*C, 79*C, "gray31" },
{ 82*C, 82*C, 82*C, "gray32" },
{ 84*C, 84*C, 84*C, "gray33" },
{ 87*C, 87*C, 87*C, "gray34" },
{ 89*C, 89*C, 89*C, "gray35" },
{ 92*C, 92*C, 92*C, "gray36" },
{ 94*C, 94*C, 94*C, "gray37" },
{ 97*C, 97*C, 97*C, "gray38" },
{ 99*C, 99*C, 99*C, "gray39" },
{ 10*C, 10*C, 10*C, "gray4" },
{ 102*C, 102*C, 102*C, "gray40" },
{ 105*C, 105*C, 105*C, "gray41" },
{ 107*C, 107*C, 107*C, "gray42" },
{ 110*C, 110*C, 110*C, "gray43" },
{ 112*C, 112*C, 112*C, "gray44" },
{ 115*C, 115*C, 115*C, "gray45" },
{ 117*C, 117*C, 117*C, "gray46" },
{ 120*C, 120*C, 120*C, "gray47" },
{ 122*C, 122*C, 122*C, "gray48" },
{ 125*C, 125*C, 125*C, "gray49" },
{ 13*C, 13*C, 13*C, "gray5" },
{ 127*C, 127*C, 127*C, "gray50" },
{ 130*C, 130*C, 130*C, "gray51" },
{ 133*C, 133*C, 133*C, "gray52" },
{ 135*C, 135*C, 135*C, "gray53" },
{ 138*C, 138*C, 138*C, "gray54" },
{ 140*C, 140*C, 140*C, "gray55" },
{ 143*C, 143*C, 143*C, "gray56" },
{ 145*C, 145*C, 145*C, "gray57" },
{ 148*C, 148*C, 148*C, "gray58" },
{ 150*C, 150*C, 150*C, "gray59" },
{ 15*C, 15*C, 15*C, "gray6" },
{ 153*C, 153*C, 153*C, "gray60" },
{ 156*C, 156*C, 156*C, "gray61" },
{ 158*C, 158*C, 158*C, "gray62" },
{ 161*C, 161*C, 161*C, "gray63" },
{ 163*C, 163*C, 163*C, "gray64" },
{ 166*C, 166*C, 166*C, "gray65" },
{ 168*C, 168*C, 168*C, "gray66" },
{ 171*C, 171*C, 171*C, "gray67" },
{ 173*C, 173*C, 173*C, "gray68" },
{ 176*C, 176*C, 176*C, "gray69" },
{ 18*C, 18*C, 18*C, "gray7" },
{ 179*C, 179*C, 179*C, "gray70" },
{ 181*C, 181*C, 181*C, "gray71" },
{ 184*C, 184*C, 184*C, "gray72" },
{ 186*C, 186*C, 186*C, "gray73" },
{ 189*C, 189*C, 189*C, "gray74" },
{ 191*C, 191*C, 191*C, "gray75" },
{ 194*C, 194*C, 194*C, "gray76" },
{ 196*C, 196*C, 196*C, "gray77" },
{ 199*C, 199*C, 199*C, "gray78" },
{ 201*C, 201*C, 201*C, "gray79" },
{ 20*C, 20*C, 20*C, "gray8" },
{ 204*C, 204*C, 204*C, "gray80" },
{ 207*C, 207*C, 207*C, "gray81" },
{ 209*C, 209*C, 209*C, "gray82" },
{ 212*C, 212*C, 212*C, "gray83" },
{ 214*C, 214*C, 214*C, "gray84" },
{ 217*C, 217*C, 217*C, "gray85" },
{ 219*C, 219*C, 219*C, "gray86" },
{ 222*C, 222*C, 222*C, "gray87" },
{ 224*C, 224*C, 224*C, "gray88" },
{ 227*C, 227*C, 227*C, "gray89" },
{ 23*C, 23*C, 23*C, "gray9" },
{ 229*C, 229*C, 229*C, "gray90" },
{ 232*C, 232*C, 232*C, "gray91" },
{ 235*C, 235*C, 235*C, "gray92" },
{ 237*C, 237*C, 237*C, "gray93" },
{ 240*C, 240*C, 240*C, "gray94" },
{ 242*C, 242*C, 242*C, "gray95" },
{ 245*C, 245*C, 245*C, "gray96" },
{ 247*C, 247*C, 247*C, "gray97" },
{ 250*C, 250*C, 250*C, "gray98" },
{ 252*C, 252*C, 252*C, "gray99" },
{ 0*C, 255*C, 0*C, "green" },
{ 173*C, 255*C, 47*C, "green yellow" },
{ 0*C, 255*C, 0*C, "green1" },
{ 0*C, 238*C, 0*C, "green2" },
{ 0*C, 205*C, 0*C, "green3" },
{ 0*C, 139*C, 0*C, "green4" },
{ 173*C, 255*C, 47*C, "GreenYellow" },
{ 190*C, 190*C, 190*C, "grey" },
{ 0*C, 0*C, 0*C, "grey0" },
{ 3*C, 3*C, 3*C, "grey1" },
{ 26*C, 26*C, 26*C, "grey10" },
{ 255*C, 255*C, 255*C, "grey100" },
{ 28*C, 28*C, 28*C, "grey11" },
{ 31*C, 31*C, 31*C, "grey12" },
{ 33*C, 33*C, 33*C, "grey13" },
{ 36*C, 36*C, 36*C, "grey14" },
{ 38*C, 38*C, 38*C, "grey15" },
{ 41*C, 41*C, 41*C, "grey16" },
{ 43*C, 43*C, 43*C, "grey17" },
{ 46*C, 46*C, 46*C, "grey18" },
{ 48*C, 48*C, 48*C, "grey19" },
{ 5*C, 5*C, 5*C, "grey2" },
{ 51*C, 51*C, 51*C, "grey20" },
{ 54*C, 54*C, 54*C, "grey21" },
{ 56*C, 56*C, 56*C, "grey22" },
{ 59*C, 59*C, 59*C, "grey23" },
{ 61*C, 61*C, 61*C, "grey24" },
{ 64*C, 64*C, 64*C, "grey25" },
{ 66*C, 66*C, 66*C, "grey26" },
{ 69*C, 69*C, 69*C, "grey27" },
{ 71*C, 71*C, 71*C, "grey28" },
{ 74*C, 74*C, 74*C, "grey29" },
{ 8*C, 8*C, 8*C, "grey3" },
{ 77*C, 77*C, 77*C, "grey30" },
{ 79*C, 79*C, 79*C, "grey31" },
{ 82*C, 82*C, 82*C, "grey32" },
{ 84*C, 84*C, 84*C, "grey33" },
{ 87*C, 87*C, 87*C, "grey34" },
{ 89*C, 89*C, 89*C, "grey35" },
{ 92*C, 92*C, 92*C, "grey36" },
{ 94*C, 94*C, 94*C, "grey37" },
{ 97*C, 97*C, 97*C, "grey38" },
{ 99*C, 99*C, 99*C, "grey39" },
{ 10*C, 10*C, 10*C, "grey4" },
{ 102*C, 102*C, 102*C, "grey40" },
{ 105*C, 105*C, 105*C, "grey41" },
{ 107*C, 107*C, 107*C, "grey42" },
{ 110*C, 110*C, 110*C, "grey43" },
{ 112*C, 112*C, 112*C, "grey44" },
{ 115*C, 115*C, 115*C, "grey45" },
{ 117*C, 117*C, 117*C, "grey46" },
{ 120*C, 120*C, 120*C, "grey47" },
{ 122*C, 122*C, 122*C, "grey48" },
{ 125*C, 125*C, 125*C, "grey49" },
{ 13*C, 13*C, 13*C, "grey5" },
{ 127*C, 127*C, 127*C, "grey50" },
{ 130*C, 130*C, 130*C, "grey51" },
{ 133*C, 133*C, 133*C, "grey52" },
{ 135*C, 135*C, 135*C, "grey53" },
{ 138*C, 138*C, 138*C, "grey54" },
{ 140*C, 140*C, 140*C, "grey55" },
{ 143*C, 143*C, 143*C, "grey56" },
{ 145*C, 145*C, 145*C, "grey57" },
{ 148*C, 148*C, 148*C, "grey58" },
{ 150*C, 150*C, 150*C, "grey59" },
{ 15*C, 15*C, 15*C, "grey6" },
{ 153*C, 153*C, 153*C, "grey60" },
{ 156*C, 156*C, 156*C, "grey61" },
{ 158*C, 158*C, 158*C, "grey62" },
{ 161*C, 161*C, 161*C, "grey63" },
{ 163*C, 163*C, 163*C, "grey64" },
{ 166*C, 166*C, 166*C, "grey65" },
{ 168*C, 168*C, 168*C, "grey66" },
{ 171*C, 171*C, 171*C, "grey67" },
{ 173*C, 173*C, 173*C, "grey68" },
{ 176*C, 176*C, 176*C, "grey69" },
{ 18*C, 18*C, 18*C, "grey7" },
{ 179*C, 179*C, 179*C, "grey70" },
{ 181*C, 181*C, 181*C, "grey71" },
{ 184*C, 184*C, 184*C, "grey72" },
{ 186*C, 186*C, 186*C, "grey73" },
{ 189*C, 189*C, 189*C, "grey74" },
{ 191*C, 191*C, 191*C, "grey75" },
{ 194*C, 194*C, 194*C, "grey76" },
{ 196*C, 196*C, 196*C, "grey77" },
{ 199*C, 199*C, 199*C, "grey78" },
{ 201*C, 201*C, 201*C, "grey79" },
{ 20*C, 20*C, 20*C, "grey8" },
{ 204*C, 204*C, 204*C, "grey80" },
{ 207*C, 207*C, 207*C, "grey81" },
{ 209*C, 209*C, 209*C, "grey82" },
{ 212*C, 212*C, 212*C, "grey83" },
{ 214*C, 214*C, 214*C, "grey84" },
{ 217*C, 217*C, 217*C, "grey85" },
{ 219*C, 219*C, 219*C, "grey86" },
{ 222*C, 222*C, 222*C, "grey87" },
{ 224*C, 224*C, 224*C, "grey88" },
{ 227*C, 227*C, 227*C, "grey89" },
{ 23*C, 23*C, 23*C, "grey9" },
{ 229*C, 229*C, 229*C, "grey90" },
{ 232*C, 232*C, 232*C, "grey91" },
{ 235*C, 235*C, 235*C, "grey92" },
{ 237*C, 237*C, 237*C, "grey93" },
{ 240*C, 240*C, 240*C, "grey94" },
{ 242*C, 242*C, 242*C, "grey95" },
{ 245*C, 245*C, 245*C, "grey96" },
{ 247*C, 247*C, 247*C, "grey97" },
{ 250*C, 250*C, 250*C, "grey98" },
{ 252*C, 252*C, 252*C, "grey99" },
{ 240*C, 255*C, 240*C, "honeydew" },
{ 240*C, 255*C, 240*C, "honeydew1" },
{ 224*C, 238*C, 224*C, "honeydew2" },
{ 193*C, 205*C, 193*C, "honeydew3" },
{ 131*C, 139*C, 131*C, "honeydew4" },
{ 255*C, 105*C, 180*C, "hot pink" },
{ 255*C, 105*C, 180*C, "HotPink" },
{ 255*C, 110*C, 180*C, "HotPink1" },
{ 238*C, 106*C, 167*C, "HotPink2" },
{ 205*C, 96*C, 144*C, "HotPink3" },
{ 139*C, 58*C, 98*C, "HotPink4" },
{ 205*C, 92*C, 92*C, "indian red" },
{ 205*C, 92*C, 92*C, "IndianRed" },
{ 255*C, 106*C, 106*C, "IndianRed1" },
{ 238*C, 99*C, 99*C, "IndianRed2" },
{ 205*C, 85*C, 85*C, "IndianRed3" },
{ 139*C, 58*C, 58*C, "IndianRed4" },
{ 255*C, 255*C, 240*C, "ivory" },
{ 255*C, 255*C, 240*C, "ivory1" },
{ 238*C, 238*C, 224*C, "ivory2" },
{ 205*C, 205*C, 193*C, "ivory3" },
{ 139*C, 139*C, 131*C, "ivory4" },
{ 240*C, 230*C, 140*C, "khaki" },
{ 255*C, 246*C, 143*C, "khaki1" },
{ 238*C, 230*C, 133*C, "khaki2" },
{ 205*C, 198*C, 115*C, "khaki3" },
{ 139*C, 134*C, 78*C, "khaki4" },
{ 230*C, 230*C, 250*C, "lavender" },
{ 255*C, 240*C, 245*C, "lavender blush" },
{ 255*C, 240*C, 245*C, "LavenderBlush" },
{ 255*C, 240*C, 245*C, "LavenderBlush1" },
{ 238*C, 224*C, 229*C, "LavenderBlush2" },
{ 205*C, 193*C, 197*C, "LavenderBlush3" },
{ 139*C, 131*C, 134*C, "LavenderBlush4" },
{ 124*C, 252*C, 0*C, "lawn green" },
{ 124*C, 252*C, 0*C, "LawnGreen" },
{ 255*C, 250*C, 205*C, "lemon chiffon" },
{ 255*C, 250*C, 205*C, "LemonChiffon" },
{ 255*C, 250*C, 205*C, "LemonChiffon1" },
{ 238*C, 233*C, 191*C, "LemonChiffon2" },
{ 205*C, 201*C, 165*C, "LemonChiffon3" },
{ 139*C, 137*C, 112*C, "LemonChiffon4" },
{ 173*C, 216*C, 230*C, "light blue" },
{ 240*C, 128*C, 128*C, "light coral" },
{ 224*C, 255*C, 255*C, "light cyan" },
{ 238*C, 221*C, 130*C, "light goldenrod" },
{ 250*C, 250*C, 210*C, "light goldenrod yellow" },
{ 211*C, 211*C, 211*C, "light gray" },
{ 144*C, 238*C, 144*C, "light green" },
{ 211*C, 211*C, 211*C, "light grey" },
{ 255*C, 182*C, 193*C, "light pink" },
{ 255*C, 160*C, 122*C, "light salmon" },
{ 32*C, 178*C, 170*C, "light sea green" },
{ 135*C, 206*C, 250*C, "light sky blue" },
{ 132*C, 112*C, 255*C, "light slate blue" },
{ 119*C, 136*C, 153*C, "light slate gray" },
{ 119*C, 136*C, 153*C, "light slate grey" },
{ 176*C, 196*C, 222*C, "light steel blue" },
{ 255*C, 255*C, 224*C, "light yellow" },
{ 173*C, 216*C, 230*C, "LightBlue" },
{ 191*C, 239*C, 255*C, "LightBlue1" },
{ 178*C, 223*C, 238*C, "LightBlue2" },
{ 154*C, 192*C, 205*C, "LightBlue3" },
{ 104*C, 131*C, 139*C, "LightBlue4" },
{ 240*C, 128*C, 128*C, "LightCoral" },
{ 224*C, 255*C, 255*C, "LightCyan" },
{ 224*C, 255*C, 255*C, "LightCyan1" },
{ 209*C, 238*C, 238*C, "LightCyan2" },
{ 180*C, 205*C, 205*C, "LightCyan3" },
{ 122*C, 139*C, 139*C, "LightCyan4" },
{ 238*C, 221*C, 130*C, "LightGoldenrod" },
{ 255*C, 236*C, 139*C, "LightGoldenrod1" },
{ 238*C, 220*C, 130*C, "LightGoldenrod2" },
{ 205*C, 190*C, 112*C, "LightGoldenrod3" },
{ 139*C, 129*C, 76*C, "LightGoldenrod4" },
{ 250*C, 250*C, 210*C, "LightGoldenrodYellow" },
{ 211*C, 211*C, 211*C, "LightGray" },
{ 144*C, 238*C, 144*C, "LightGreen" },
{ 211*C, 211*C, 211*C, "LightGrey" },
{ 255*C, 182*C, 193*C, "LightPink" },
{ 255*C, 174*C, 185*C, "LightPink1" },
{ 238*C, 162*C, 173*C, "LightPink2" },
{ 205*C, 140*C, 149*C, "LightPink3" },
{ 139*C, 95*C, 101*C, "LightPink4" },
{ 255*C, 160*C, 122*C, "LightSalmon" },
{ 255*C, 160*C, 122*C, "LightSalmon1" },
{ 238*C, 149*C, 114*C, "LightSalmon2" },
{ 205*C, 129*C, 98*C, "LightSalmon3" },
{ 139*C, 87*C, 66*C, "LightSalmon4" },
{ 32*C, 178*C, 170*C, "LightSeaGreen" },
{ 135*C, 206*C, 250*C, "LightSkyBlue" },
{ 176*C, 226*C, 255*C, "LightSkyBlue1" },
{ 164*C, 211*C, 238*C, "LightSkyBlue2" },
{ 141*C, 182*C, 205*C, "LightSkyBlue3" },
{ 96*C, 123*C, 139*C, "LightSkyBlue4" },
{ 132*C, 112*C, 255*C, "LightSlateBlue" },
{ 119*C, 136*C, 153*C, "LightSlateGray" },
{ 119*C, 136*C, 153*C, "LightSlateGrey" },
{ 176*C, 196*C, 222*C, "LightSteelBlue" },
{ 202*C, 225*C, 255*C, "LightSteelBlue1" },
{ 188*C, 210*C, 238*C, "LightSteelBlue2" },
{ 162*C, 181*C, 205*C, "LightSteelBlue3" },
{ 110*C, 123*C, 139*C, "LightSteelBlue4" },
{ 255*C, 255*C, 224*C, "LightYellow" },
{ 255*C, 255*C, 224*C, "LightYellow1" },
{ 238*C, 238*C, 209*C, "LightYellow2" },
{ 205*C, 205*C, 180*C, "LightYellow3" },
{ 139*C, 139*C, 122*C, "LightYellow4" },
{ 50*C, 205*C, 50*C, "lime green" },
{ 50*C, 205*C, 50*C, "LimeGreen" },
{ 250*C, 240*C, 230*C, "linen" },
{ 255*C, 0*C, 255*C, "magenta" },
{ 255*C, 0*C, 255*C, "magenta1" },
{ 238*C, 0*C, 238*C, "magenta2" },
{ 205*C, 0*C, 205*C, "magenta3" },
{ 139*C, 0*C, 139*C, "magenta4" },
{ 176*C, 48*C, 96*C, "maroon" },
{ 255*C, 52*C, 179*C, "maroon1" },
{ 238*C, 48*C, 167*C, "maroon2" },
{ 205*C, 41*C, 144*C, "maroon3" },
{ 139*C, 28*C, 98*C, "maroon4" },
{ 102*C, 205*C, 170*C, "medium aquamarine" },
{ 0*C, 0*C, 205*C, "medium blue" },
{ 186*C, 85*C, 211*C, "medium orchid" },
{ 147*C, 112*C, 219*C, "medium purple" },
{ 60*C, 179*C, 113*C, "medium sea green" },
{ 123*C, 104*C, 238*C, "medium slate blue" },
{ 0*C, 250*C, 154*C, "medium spring green" },
{ 72*C, 209*C, 204*C, "medium turquoise" },
{ 199*C, 21*C, 133*C, "medium violet red" },
{ 102*C, 205*C, 170*C, "MediumAquamarine" },
{ 0*C, 0*C, 205*C, "MediumBlue" },
{ 186*C, 85*C, 211*C, "MediumOrchid" },
{ 224*C, 102*C, 255*C, "MediumOrchid1" },
{ 209*C, 95*C, 238*C, "MediumOrchid2" },
{ 180*C, 82*C, 205*C, "MediumOrchid3" },
{ 122*C, 55*C, 139*C, "MediumOrchid4" },
{ 147*C, 112*C, 219*C, "MediumPurple" },
{ 171*C, 130*C, 255*C, "MediumPurple1" },
{ 159*C, 121*C, 238*C, "MediumPurple2" },
{ 137*C, 104*C, 205*C, "MediumPurple3" },
{ 93*C, 71*C, 139*C, "MediumPurple4" },
{ 60*C, 179*C, 113*C, "MediumSeaGreen" },
{ 123*C, 104*C, 238*C, "MediumSlateBlue" },
{ 0*C, 250*C, 154*C, "MediumSpringGreen" },
{ 72*C, 209*C, 204*C, "MediumTurquoise" },
{ 199*C, 21*C, 133*C, "MediumVioletRed" },
{ 25*C, 25*C, 112*C, "midnight blue" },
{ 25*C, 25*C, 112*C, "MidnightBlue" },
{ 245*C, 255*C, 250*C, "mint cream" },
{ 245*C, 255*C, 250*C, "MintCream" },
{ 255*C, 228*C, 225*C, "misty rose" },
{ 255*C, 228*C, 225*C, "MistyRose" },
{ 255*C, 228*C, 225*C, "MistyRose1" },
{ 238*C, 213*C, 210*C, "MistyRose2" },
{ 205*C, 183*C, 181*C, "MistyRose3" },
{ 139*C, 125*C, 123*C, "MistyRose4" },
{ 255*C, 228*C, 181*C, "moccasin" },
{ 255*C, 222*C, 173*C, "navajo white" },
{ 255*C, 222*C, 173*C, "NavajoWhite" },
{ 255*C, 222*C, 173*C, "NavajoWhite1" },
{ 238*C, 207*C, 161*C, "NavajoWhite2" },
{ 205*C, 179*C, 139*C, "NavajoWhite3" },
{ 139*C, 121*C, 94*C, "NavajoWhite4" },
{ 0*C, 0*C, 128*C, "navy" },
{ 0*C, 0*C, 128*C, "navy blue" },
{ 0*C, 0*C, 128*C, "NavyBlue" },
{ 253*C, 245*C, 230*C, "old lace" },
{ 253*C, 245*C, 230*C, "OldLace" },
{ 107*C, 142*C, 35*C, "olive drab" },
{ 107*C, 142*C, 35*C, "OliveDrab" },
{ 192*C, 255*C, 62*C, "OliveDrab1" },
{ 179*C, 238*C, 58*C, "OliveDrab2" },
{ 154*C, 205*C, 50*C, "OliveDrab3" },
{ 105*C, 139*C, 34*C, "OliveDrab4" },
{ 255*C, 165*C, 0*C, "orange" },
{ 255*C, 69*C, 0*C, "orange red" },
{ 255*C, 165*C, 0*C, "orange1" },
{ 238*C, 154*C, 0*C, "orange2" },
{ 205*C, 133*C, 0*C, "orange3" },
{ 139*C, 90*C, 0*C, "orange4" },
{ 255*C, 69*C, 0*C, "OrangeRed" },
{ 255*C, 69*C, 0*C, "OrangeRed1" },
{ 238*C, 64*C, 0*C, "OrangeRed2" },
{ 205*C, 55*C, 0*C, "OrangeRed3" },
{ 139*C, 37*C, 0*C, "OrangeRed4" },
{ 218*C, 112*C, 214*C, "orchid" },
{ 255*C, 131*C, 250*C, "orchid1" },
{ 238*C, 122*C, 233*C, "orchid2" },
{ 205*C, 105*C, 201*C, "orchid3" },
{ 139*C, 71*C, 137*C, "orchid4" },
{ 238*C, 232*C, 170*C, "pale goldenrod" },
{ 152*C, 251*C, 152*C, "pale green" },
{ 175*C, 238*C, 238*C, "pale turquoise" },
{ 219*C, 112*C, 147*C, "pale violet red" },
{ 238*C, 232*C, 170*C, "PaleGoldenrod" },
{ 152*C, 251*C, 152*C, "PaleGreen" },
{ 154*C, 255*C, 154*C, "PaleGreen1" },
{ 144*C, 238*C, 144*C, "PaleGreen2" },
{ 124*C, 205*C, 124*C, "PaleGreen3" },
{ 84*C, 139*C, 84*C, "PaleGreen4" },
{ 175*C, 238*C, 238*C, "PaleTurquoise" },
{ 187*C, 255*C, 255*C, "PaleTurquoise1" },
{ 174*C, 238*C, 238*C, "PaleTurquoise2" },
{ 150*C, 205*C, 205*C, "PaleTurquoise3" },
{ 102*C, 139*C, 139*C, "PaleTurquoise4" },
{ 219*C, 112*C, 147*C, "PaleVioletRed" },
{ 255*C, 130*C, 171*C, "PaleVioletRed1" },
{ 238*C, 121*C, 159*C, "PaleVioletRed2" },
{ 205*C, 104*C, 137*C, "PaleVioletRed3" },
{ 139*C, 71*C, 93*C, "PaleVioletRed4" },
{ 255*C, 239*C, 213*C, "papaya whip" },
{ 255*C, 239*C, 213*C, "PapayaWhip" },
{ 255*C, 218*C, 185*C, "peach puff" },
{ 255*C, 218*C, 185*C, "PeachPuff" },
{ 255*C, 218*C, 185*C, "PeachPuff1" },
{ 238*C, 203*C, 173*C, "PeachPuff2" },
{ 205*C, 175*C, 149*C, "PeachPuff3" },
{ 139*C, 119*C, 101*C, "PeachPuff4" },
{ 205*C, 133*C, 63*C, "peru" },
{ 255*C, 192*C, 203*C, "pink" },
{ 255*C, 181*C, 197*C, "pink1" },
{ 238*C, 169*C, 184*C, "pink2" },
{ 205*C, 145*C, 158*C, "pink3" },
{ 139*C, 99*C, 108*C, "pink4" },
{ 221*C, 160*C, 221*C, "plum" },
{ 255*C, 187*C, 255*C, "plum1" },
{ 238*C, 174*C, 238*C, "plum2" },
{ 205*C, 150*C, 205*C, "plum3" },
{ 139*C, 102*C, 139*C, "plum4" },
{ 176*C, 224*C, 230*C, "powder blue" },
{ 176*C, 224*C, 230*C, "PowderBlue" },
{ 160*C, 32*C, 240*C, "purple" },
{ 155*C, 48*C, 255*C, "purple1" },
{ 145*C, 44*C, 238*C, "purple2" },
{ 125*C, 38*C, 205*C, "purple3" },
{ 85*C, 26*C, 139*C, "purple4" },
{ 255*C, 0*C, 0*C, "red" },
{ 255*C, 0*C, 0*C, "red1" },
{ 238*C, 0*C, 0*C, "red2" },
{ 205*C, 0*C, 0*C, "red3" },
{ 139*C, 0*C, 0*C, "red4" },
{ 188*C, 143*C, 143*C, "rosy brown" },
{ 188*C, 143*C, 143*C, "RosyBrown" },
{ 255*C, 193*C, 193*C, "RosyBrown1" },
{ 238*C, 180*C, 180*C, "RosyBrown2" },
{ 205*C, 155*C, 155*C, "RosyBrown3" },
{ 139*C, 105*C, 105*C, "RosyBrown4" },
{ 65*C, 105*C, 225*C, "royal blue" },
{ 65*C, 105*C, 225*C, "RoyalBlue" },
{ 72*C, 118*C, 255*C, "RoyalBlue1" },
{ 67*C, 110*C, 238*C, "RoyalBlue2" },
{ 58*C, 95*C, 205*C, "RoyalBlue3" },
{ 39*C, 64*C, 139*C, "RoyalBlue4" },
{ 139*C, 69*C, 19*C, "saddle brown" },
{ 139*C, 69*C, 19*C, "SaddleBrown" },
{ 250*C, 128*C, 114*C, "salmon" },
{ 255*C, 140*C, 105*C, "salmon1" },
{ 238*C, 130*C, 98*C, "salmon2" },
{ 205*C, 112*C, 84*C, "salmon3" },
{ 139*C, 76*C, 57*C, "salmon4" },
{ 244*C, 164*C, 96*C, "sandy brown" },
{ 244*C, 164*C, 96*C, "SandyBrown" },
{ 46*C, 139*C, 87*C, "sea green" },
{ 46*C, 139*C, 87*C, "SeaGreen" },
{ 84*C, 255*C, 159*C, "SeaGreen1" },
{ 78*C, 238*C, 148*C, "SeaGreen2" },
{ 67*C, 205*C, 128*C, "SeaGreen3" },
{ 46*C, 139*C, 87*C, "SeaGreen4" },
{ 255*C, 245*C, 238*C, "seashell" },
{ 255*C, 245*C, 238*C, "seashell1" },
{ 238*C, 229*C, 222*C, "seashell2" },
{ 205*C, 197*C, 191*C, "seashell3" },
{ 139*C, 134*C, 130*C, "seashell4" },
{ 160*C, 82*C, 45*C, "sienna" },
{ 255*C, 130*C, 71*C, "sienna1" },
{ 238*C, 121*C, 66*C, "sienna2" },
{ 205*C, 104*C, 57*C, "sienna3" },
{ 139*C, 71*C, 38*C, "sienna4" },
{ 135*C, 206*C, 235*C, "sky blue" },
{ 135*C, 206*C, 235*C, "SkyBlue" },
{ 135*C, 206*C, 255*C, "SkyBlue1" },
{ 126*C, 192*C, 238*C, "SkyBlue2" },
{ 108*C, 166*C, 205*C, "SkyBlue3" },
{ 74*C, 112*C, 139*C, "SkyBlue4" },
{ 106*C, 90*C, 205*C, "slate blue" },
{ 112*C, 128*C, 144*C, "slate gray" },
{ 112*C, 128*C, 144*C, "slate grey" },
{ 106*C, 90*C, 205*C, "SlateBlue" },
{ 131*C, 111*C, 255*C, "SlateBlue1" },
{ 122*C, 103*C, 238*C, "SlateBlue2" },
{ 105*C, 89*C, 205*C, "SlateBlue3" },
{ 71*C, 60*C, 139*C, "SlateBlue4" },
{ 112*C, 128*C, 144*C, "SlateGray" },
{ 198*C, 226*C, 255*C, "SlateGray1" },
{ 185*C, 211*C, 238*C, "SlateGray2" },
{ 159*C, 182*C, 205*C, "SlateGray3" },
{ 108*C, 123*C, 139*C, "SlateGray4" },
{ 112*C, 128*C, 144*C, "SlateGrey" },
{ 255*C, 250*C, 250*C, "snow" },
{ 255*C, 250*C, 250*C, "snow1" },
{ 238*C, 233*C, 233*C, "snow2" },
{ 205*C, 201*C, 201*C, "snow3" },
{ 139*C, 137*C, 137*C, "snow4" },
{ 0*C, 255*C, 127*C, "spring green" },
{ 0*C, 255*C, 127*C, "SpringGreen" },
{ 0*C, 255*C, 127*C, "SpringGreen1" },
{ 0*C, 238*C, 118*C, "SpringGreen2" },
{ 0*C, 205*C, 102*C, "SpringGreen3" },
{ 0*C, 139*C, 69*C, "SpringGreen4" },
{ 70*C, 130*C, 180*C, "steel blue" },
{ 70*C, 130*C, 180*C, "SteelBlue" },
{ 99*C, 184*C, 255*C, "SteelBlue1" },
{ 92*C, 172*C, 238*C, "SteelBlue2" },
{ 79*C, 148*C, 205*C, "SteelBlue3" },
{ 54*C, 100*C, 139*C, "SteelBlue4" },
{ 210*C, 180*C, 140*C, "tan" },
{ 255*C, 165*C, 79*C, "tan1" },
{ 238*C, 154*C, 73*C, "tan2" },
{ 205*C, 133*C, 63*C, "tan3" },
{ 139*C, 90*C, 43*C, "tan4" },
{ 216*C, 191*C, 216*C, "thistle" },
{ 255*C, 225*C, 255*C, "thistle1" },
{ 238*C, 210*C, 238*C, "thistle2" },
{ 205*C, 181*C, 205*C, "thistle3" },
{ 139*C, 123*C, 139*C, "thistle4" },
{ 255*C, 99*C, 71*C, "tomato" },
{ 255*C, 99*C, 71*C, "tomato1" },
{ 238*C, 92*C, 66*C, "tomato2" },
{ 205*C, 79*C, 57*C, "tomato3" },
{ 139*C, 54*C, 38*C, "tomato4" },
{ 64*C, 224*C, 208*C, "turquoise" },
{ 0*C, 245*C, 255*C, "turquoise1" },
{ 0*C, 229*C, 238*C, "turquoise2" },
{ 0*C, 197*C, 205*C, "turquoise3" },
{ 0*C, 134*C, 139*C, "turquoise4" },
{ 238*C, 130*C, 238*C, "violet" },
{ 208*C, 32*C, 144*C, "violet red" },
{ 208*C, 32*C, 144*C, "VioletRed" },
{ 255*C, 62*C, 150*C, "VioletRed1" },
{ 238*C, 58*C, 140*C, "VioletRed2" },
{ 205*C, 50*C, 120*C, "VioletRed3" },
{ 139*C, 34*C, 82*C, "VioletRed4" },
{ 245*C, 222*C, 179*C, "wheat" },
{ 255*C, 231*C, 186*C, "wheat1" },
{ 238*C, 216*C, 174*C, "wheat2" },
{ 205*C, 186*C, 150*C, "wheat3" },
{ 139*C, 126*C, 102*C, "wheat4" },
{ 255*C, 255*C, 255*C, "white" },
{ 245*C, 245*C, 245*C, "white smoke" },
{ 245*C, 245*C, 245*C, "WhiteSmoke" },
{ 255*C, 255*C, 0*C, "yellow" },
{ 154*C, 205*C, 50*C, "yellow green" },
{ 255*C, 255*C, 0*C, "yellow1" },
{ 238*C, 238*C, 0*C, "yellow2" },
{ 205*C, 205*C, 0*C, "yellow3" },
{ 139*C, 139*C, 0*C, "yellow4" },
{ 154*C, 205*C, 50*C, "YellowGreen" }
};
#undef C
#define NUM_KD_COLORS (sizeof (KdColors) / sizeof (KdColors[0]))
Bool
OsInitColors()
{
return TRUE;
}
Bool
OsLookupColor(int screen,
char *s_name,
unsigned int len,
unsigned short *pred,
unsigned short *pgreen,
unsigned short *pblue)
{
const KdNamedColor *c;
unsigned char *name = (unsigned char *) s_name;
int low, mid, high;
int r;
low = 0;
high = NUM_KD_COLORS;
while (high - low > 0)
{
mid = (low + high) / 2;
c = &KdColors[mid];
r = KdStrCaseCmp (c->name, name, len);
if (r == 0)
{
*pred = c->red;
*pgreen = c->green;
*pblue = c->blue;
return TRUE;
}
if (r < 0)
{
if (high == mid)
break;
high = mid;
}
else
{
if (low == mid)
break;
low = mid;
}
}
return FALSE;
}

View file

@ -208,7 +208,6 @@ KdDisableScreen (ScreenPtr pScreen)
if (!pScreenPriv->closed)
KdSetRootClip (pScreen, FALSE);
KdDisableColormap (pScreen);
KdOffscreenSwapOut (pScreen);
if (!pScreenPriv->screen->dumb && pScreenPriv->card->cfuncs->disableAccel)
(*pScreenPriv->card->cfuncs->disableAccel) (pScreen);
if (!pScreenPriv->screen->softCursor && pScreenPriv->card->cfuncs->disableCursor)
@ -285,7 +284,6 @@ KdEnableScreen (ScreenPtr pScreen)
pScreenPriv->enabled = TRUE;
pScreenPriv->dpmsState = KD_DPMS_NORMAL;
pScreenPriv->card->selected = pScreenPriv->screen->mynum;
KdOffscreenSwapIn (pScreen);
if (!pScreenPriv->screen->softCursor && pScreenPriv->card->cfuncs->enableCursor)
(*pScreenPriv->card->cfuncs->enableCursor) (pScreen);
if (!pScreenPriv->screen->dumb && pScreenPriv->card->cfuncs->enableAccel)
@ -796,9 +794,6 @@ KdCloseScreen (int index, ScreenPtr pScreen)
else
ret = TRUE;
if (screen->off_screen_base < screen->memory_size)
KdOffscreenFini (pScreen);
if (pScreenPriv->dpmsState != KD_DPMS_NORMAL)
(*card->cfuncs->dpms) (pScreen, KD_DPMS_NORMAL);
@ -1097,9 +1092,6 @@ KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
if (!screen->dumb && card->cfuncs->initAccel)
if (!(*card->cfuncs->initAccel) (pScreen))
screen->dumb = TRUE;
if (screen->off_screen_base < screen->memory_size)
KdOffscreenInit (pScreen);
#ifdef PSEUDO8
(void) p8Init (pScreen, PSEUDO8_USE_DEFAULT);
@ -1393,6 +1385,11 @@ KdInitOutput (ScreenInfo *pScreenInfo,
signal(SIGSEGV, KdBacktrace);
}
void
OsVendorFatalError(void)
{
}
#ifdef DPMSExtension
int
DPMSSet(ClientPtr client, int level)

View file

@ -114,30 +114,6 @@ typedef struct _KdFrameBuffer {
void *closure;
} KdFrameBuffer;
typedef struct _KdOffscreenArea KdOffscreenArea;
typedef void (*KdOffscreenSaveProc) (ScreenPtr pScreen, KdOffscreenArea *area);
typedef enum _KdOffscreenState {
KdOffscreenAvail,
KdOffscreenRemovable,
KdOffscreenLocked,
} KdOffscreenState;
struct _KdOffscreenArea {
int offset;
int save_offset;
int size;
int score;
pointer privData;
KdOffscreenSaveProc save;
KdOffscreenState state;
KdOffscreenArea *next;
};
#define RR_Rotate_All (RR_Rotate_0|RR_Rotate_90|RR_Rotate_180|RR_Rotate_270)
#define RR_Reflect_All (RR_Reflect_X|RR_Reflect_Y)
@ -205,8 +181,6 @@ typedef struct {
int bytesPerPixel[KD_MAX_FB];
int dpmsState;
KdOffscreenArea *off_screen_areas;
ColormapPtr pInstalledmap[KD_MAX_FB]; /* current colormap */
xColorItem systemPalette[KD_MAX_PSEUDO_SIZE];/* saved windows colors */
@ -401,90 +375,6 @@ typedef struct _KdPointerMatrix {
int matrix[2][3];
} KdPointerMatrix;
typedef struct _KaaTrapezoid {
float tl, tr, ty;
float bl, br, by;
} KaaTrapezoid;
typedef struct _KaaScreenInfo {
int offsetAlign;
int pitchAlign;
int flags;
int (*markSync) (ScreenPtr pScreen);
void (*waitMarker) (ScreenPtr pScreen, int marker);
Bool (*PrepareSolid) (PixmapPtr pPixmap,
int alu,
Pixel planemask,
Pixel fg);
void (*Solid) (int x1, int y1, int x2, int y2);
void (*DoneSolid) (void);
Bool (*PrepareCopy) (PixmapPtr pSrcPixmap,
PixmapPtr pDstPixmap,
Bool upsidedown,
Bool reverse,
int alu,
Pixel planemask);
void (*Copy) (int srcX,
int srcY,
int dstX,
int dstY,
int width,
int height);
void (*DoneCopy) (void);
Bool (*PrepareBlend) (int op,
PicturePtr pSrcPicture,
PicturePtr pDstPicture,
PixmapPtr pSrc,
PixmapPtr pDst);
void (*Blend) (int srcX,
int srcY,
int dstX,
int dstY,
int width,
int height);
void (*DoneBlend) (void);
Bool (*CheckComposite) (int op,
PicturePtr pSrcPicture,
PicturePtr pMaskPicture,
PicturePtr pDstPicture);
Bool (*PrepareComposite) (int op,
PicturePtr pSrcPicture,
PicturePtr pMaskPicture,
PicturePtr pDstPicture,
PixmapPtr pSrc,
PixmapPtr pMask,
PixmapPtr pDst);
void (*Composite) (int srcX,
int srcY,
int maskX,
int maskY,
int dstX,
int dstY,
int width,
int height);
void (*DoneComposite) (void);
Bool (*PrepareTrapezoids) (PicturePtr pDstPicture,
PixmapPtr pDst);
void (*Trapezoids) (KaaTrapezoid *traps,
int ntraps);
void (*DoneTrapezoids) (void);
Bool (*UploadToScreen) (PixmapPtr pDst,
char *src,
int src_pitch);
Bool (*UploadToScratch) (PixmapPtr pSrc,
PixmapPtr pDst);
} KaaScreenInfoRec, *KaaScreenInfoPtr;
#define KAA_OFFSCREEN_PIXMAPS (1 << 0)
#define KAA_OFFSCREEN_ALIGN_POT (1 << 1)
/*
* This is the only completely portable way to
* compute this info.
@ -515,119 +405,6 @@ extern KdOsFuncs *kdOsFuncs;
dixSetPrivate(&(pScreen)->devPrivates, kdScreenPrivateKey, v)
#define KdScreenPriv(pScreen) KdPrivScreenPtr pScreenPriv = KdGetScreenPriv(pScreen)
/* kaa.c */
Bool
kaaDrawInit (ScreenPtr pScreen,
KaaScreenInfoPtr pScreenInfo);
void
kaaDrawFini (ScreenPtr pScreen);
void
kaaWrapGC (GCPtr pGC);
void
kaaUnwrapGC (GCPtr pGC);
/* kasync.c */
void
KdCheckFillSpans (DrawablePtr pDrawable, GCPtr pGC, int nspans,
DDXPointPtr ppt, int *pwidth, int fSorted);
void
KdCheckSetSpans (DrawablePtr pDrawable, GCPtr pGC, char *psrc,
DDXPointPtr ppt, int *pwidth, int nspans, int fSorted);
void
KdCheckPutImage (DrawablePtr pDrawable, GCPtr pGC, int depth,
int x, int y, int w, int h, int leftPad, int format,
char *bits);
RegionPtr
KdCheckCopyArea (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
int srcx, int srcy, int w, int h, int dstx, int dsty);
RegionPtr
KdCheckCopyPlane (DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
int srcx, int srcy, int w, int h, int dstx, int dsty,
unsigned long bitPlane);
void
KdCheckPolyPoint (DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
DDXPointPtr pptInit);
void
KdCheckPolylines (DrawablePtr pDrawable, GCPtr pGC,
int mode, int npt, DDXPointPtr ppt);
void
KdCheckPolySegment (DrawablePtr pDrawable, GCPtr pGC,
int nsegInit, xSegment *pSegInit);
void
KdCheckPolyRectangle (DrawablePtr pDrawable, GCPtr pGC,
int nrects, xRectangle *prect);
void
KdCheckPolyArc (DrawablePtr pDrawable, GCPtr pGC,
int narcs, xArc *pArcs);
#define KdCheckFillPolygon miFillPolygon
void
KdCheckPolyFillRect (DrawablePtr pDrawable, GCPtr pGC,
int nrect, xRectangle *prect);
void
KdCheckPolyFillArc (DrawablePtr pDrawable, GCPtr pGC,
int narcs, xArc *pArcs);
void
KdCheckImageGlyphBlt (DrawablePtr pDrawable, GCPtr pGC,
int x, int y, unsigned int nglyph,
CharInfoPtr *ppci, pointer pglyphBase);
void
KdCheckPolyGlyphBlt (DrawablePtr pDrawable, GCPtr pGC,
int x, int y, unsigned int nglyph,
CharInfoPtr *ppci, pointer pglyphBase);
void
KdCheckPushPixels (GCPtr pGC, PixmapPtr pBitmap,
DrawablePtr pDrawable,
int w, int h, int x, int y);
void
KdCheckGetImage (DrawablePtr pDrawable,
int x, int y, int w, int h,
unsigned int format, unsigned long planeMask,
char *d);
void
KdCheckGetSpans (DrawablePtr pDrawable,
int wMax,
DDXPointPtr ppt,
int *pwidth,
int nspans,
char *pdstStart);
void
KdCheckCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
void
KdCheckPaintKey(DrawablePtr pDrawable,
RegionPtr pRegion,
CARD32 pixel,
int layer);
void
KdCheckOverlayCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
void
KdScreenInitAsync (ScreenPtr pScreen);
extern const GCOps kdAsyncPixmapGCOps;
/* knoop.c */
extern GCOps kdNoopOps;
@ -921,32 +698,6 @@ KdRandRGetTiming (ScreenPtr pScreen,
RRScreenSizePtr pSize);
#endif
/* kpict.c */
void
KdPictureInitAsync (ScreenPtr pScreen);
#ifdef RENDER
void
KdCheckComposite (CARD8 op,
PicturePtr pSrc,
PicturePtr pMask,
PicturePtr pDst,
INT16 xSrc,
INT16 ySrc,
INT16 xMask,
INT16 yMask,
INT16 xDst,
INT16 yDst,
CARD16 width,
CARD16 height);
void
KdCheckRasterizeTrapezoid(PicturePtr pMask,
xTrapezoid *trap,
int x_off,
int y_off);
#endif
/* kshadow.c */
Bool
KdShadowFbAlloc (KdScreenInfo *screen, int fb, Bool rotate);
@ -960,39 +711,6 @@ KdShadowSet (ScreenPtr pScreen, int randr, ShadowUpdateProc update, ShadowWindow
void
KdShadowUnset (ScreenPtr pScreen);
/* ktest.c */
Bool
KdFrameBufferValid (CARD8 *base, int size);
int
KdFrameBufferSize (CARD8 *base, int max);
/* koffscreen.c */
Bool
KdOffscreenInit (ScreenPtr pScreen);
KdOffscreenArea *
KdOffscreenAlloc (ScreenPtr pScreen, int size, int align,
Bool locked,
KdOffscreenSaveProc save,
pointer privData);
KdOffscreenArea *
KdOffscreenFree (ScreenPtr pScreen, KdOffscreenArea *area);
void
KdOffscreenMarkUsed (PixmapPtr pPixmap);
void
KdOffscreenSwapOut (ScreenPtr pScreen);
void
KdOffscreenSwapIn (ScreenPtr pScreen);
void
KdOffscreenFini (ScreenPtr pScreen);
/* function prototypes to be implemented by the drivers */
void
InitCard (char *name);

View file

@ -2404,6 +2404,7 @@ ChangeDeviceControl(register ClientPtr client, DeviceIntPtr pDev,
return Success;
case DEVICE_CORE:
return BadMatch;
case DEVICE_ENABLE:
return Success;

View file

@ -1,199 +0,0 @@
/*
* Copyright © 1999 Keith Packard
*
* 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, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD 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.
*/
#ifdef HAVE_CONFIG_H
#include <kdrive-config.h>
#endif
#include "kdrive.h"
#ifdef WINDOWS
#define KM_BUF 1024
#define KM_EOF -1
typedef struct _km_file {
HANDLE handle;
char buf[KM_BUF];
char *bufptr;
DWORD remain;
} km_file;
int
km_fill (km_file *kf)
{
BOOL r;
NCD_DEBUG ((DEBUG_INIT, "km_fill"));
r = ReadFile (kf->handle, kf->buf, KM_BUF,
&kf->remain, NULL);
NCD_DEBUG ((DEBUG_INIT, "Got %d", kf->remain));
if (!r || !kf->remain)
return KM_EOF;
kf->bufptr = kf->buf;
--kf->remain;
return *kf->bufptr++;
}
#define km_getchar(kf) ((kf)->remain-- ? *kf->bufptr++ : km_fill (kf))
#else
#define km_getchar(kf) getc(kf)
#endif
BOOL
km_word (km_file *kf, char *buf, int len)
{
int c;
for (;;)
{
switch (c = km_getchar (kf)) {
case KM_EOF:
return FALSE;
case ' ':
case '\t':
case '\n':
case '\r':
continue;
}
break;
}
len--;
while (len--)
{
*buf++ = c;
switch (c = km_getchar (kf)) {
case KM_EOF:
case ' ':
case '\t':
case '\n':
case '\r':
*buf++ = '\0';
return TRUE;
}
}
return FALSE;
}
BOOL
km_int (km_file *kf, int *r)
{
char word[64];
if (km_word (kf, word, sizeof (word)))
{
*r = strtol (word, NULL, 0);
return TRUE;
}
return FALSE;
}
WCHAR *winKbdExtensions[] = {
L".xku",
L".xkb"
};
#define NUM_KBD_EXTENSIONS (sizeof (winKbdExtensions) / sizeof (winKbdExtensions[0]))
BOOL
winLoadKeymap (void)
{
WCHAR file[32 + KL_NAMELENGTH];
WCHAR name[KL_NAMELENGTH];
HKL layout;
km_file kf;
int width;
BOOL ret;
KeySym *m;
int scancode;
int w;
int e;
layout = GetKeyboardLayout (0);
/*
* Pre-build 46 versions of ThinSTAR software return 0
* for all layouts
*/
if (!layout)
return FALSE;
NCD_DEBUG ((DEBUG_INIT, "Keyboard layout 0x%x", layout));
for (e = 0; e < NUM_KBD_EXTENSIONS; e++)
{
wstrcpy (file, L"\\Storage Card\\");
wsprintf (name, TEXT("%08x"), layout);
wstrcat (file, name);
wstrcat (file, winKbdExtensions[e]);
NCD_DEBUG ((DEBUG_INIT, "Loading keymap from %S", file));
kf.handle = CreateFile (file,
GENERIC_READ,
FILE_SHARE_READ|FILE_SHARE_WRITE,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL);
if (kf.handle != INVALID_HANDLE_VALUE)
break;
}
if (kf.handle == INVALID_HANDLE_VALUE)
{
NCD_DEBUG ((DEBUG_INIT, "No such file"));
return FALSE;
}
ret = FALSE;
kf.remain = 0;
/*
* Keymap format:
*
* flags (optional)
* width
* keycode -> keysym array (num_keycodes * width)
*/
if (!km_int (&kf, &width))
goto bail1;
if (width & KEYMAP_FLAGS)
{
CEKeymapFlags = (unsigned long) width;
if (!km_int (&kf, &width))
goto bail1;
}
else
CEKeymapFlags = 0;
if (width > MAX_WIDTH)
goto bail1;
NCD_DEBUG ((DEBUG_INIT, "Keymap width %d flags 0x%x",
width, CEKeymapFlags));
m = CEKeymap;
for (scancode = MIN_SCANCODE; scancode <= MAX_SCANCODE; scancode++)
{
for (w = 0; w < width; w++)
{
if (!km_int (&kf, m))
break;
m++;
}
if (w != width)
break;
}
CEKeySyms.mapWidth = width;
ret = TRUE;
bail1:
CloseHandle (kf.handle);
return ret;
}

View file

@ -1,251 +0,0 @@
/*
* Copyright © 1999 Keith Packard
*
* 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, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD 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.
*/
/*
* GC ops that don't do anything
*/
#ifdef HAVE_CONFIG_H
#include <kdrive-config.h>
#endif
#include "kdrive.h"
#include <gcstruct.h>
typedef void (* typeFillSpans)(
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nInit*/,
DDXPointPtr /*pptInit*/,
int * /*pwidthInit*/,
int /*fSorted*/
);
typedef void (* typeSetSpans)(
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
char * /*psrc*/,
DDXPointPtr /*ppt*/,
int * /*pwidth*/,
int /*nspans*/,
int /*fSorted*/
);
typedef void (* typePutImage)(
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*depth*/,
int /*x*/,
int /*y*/,
int /*w*/,
int /*h*/,
int /*leftPad*/,
int /*format*/,
char * /*pBits*/
);
typedef RegionPtr (* typeCopyArea)(
DrawablePtr /*pSrc*/,
DrawablePtr /*pDst*/,
GCPtr /*pGC*/,
int /*srcx*/,
int /*srcy*/,
int /*w*/,
int /*h*/,
int /*dstx*/,
int /*dsty*/
);
typedef RegionPtr (* typeCopyPlane)(
DrawablePtr /*pSrcDrawable*/,
DrawablePtr /*pDstDrawable*/,
GCPtr /*pGC*/,
int /*srcx*/,
int /*srcy*/,
int /*width*/,
int /*height*/,
int /*dstx*/,
int /*dsty*/,
unsigned long /*bitPlane*/
);
typedef void (* typePolyPoint)(
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*mode*/,
int /*npt*/,
DDXPointPtr /*pptInit*/
);
typedef void (* typePolylines)(
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*mode*/,
int /*npt*/,
DDXPointPtr /*pptInit*/
);
typedef void (* typePolySegment)(
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nseg*/,
xSegment * /*pSegs*/
);
typedef void (* typePolyRectangle)(
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nrects*/,
xRectangle * /*pRects*/
);
typedef void (* typePolyArc)(
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*narcs*/,
xArc * /*parcs*/
);
typedef void (* typeFillPolygon)(
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*shape*/,
int /*mode*/,
int /*count*/,
DDXPointPtr /*pPts*/
);
typedef void (* typePolyFillRect)(
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*nrectFill*/,
xRectangle * /*prectInit*/
);
typedef void (* typePolyFillArc)(
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*narcs*/,
xArc * /*parcs*/
);
typedef int (* typePolyText8)(
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*x*/,
int /*y*/,
int /*count*/,
char * /*chars*/
);
typedef int (* typePolyText16)(
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*x*/,
int /*y*/,
int /*count*/,
unsigned short * /*chars*/
);
typedef void (* typeImageText8)(
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*x*/,
int /*y*/,
int /*count*/,
char * /*chars*/
);
typedef void (* typeImageText16)(
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*x*/,
int /*y*/,
int /*count*/,
unsigned short * /*chars*/
);
typedef void (* typeImageGlyphBlt)(
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*x*/,
int /*y*/,
unsigned int /*nglyph*/,
CharInfoPtr * /*ppci*/,
pointer /*pglyphBase*/
);
typedef void (* typePolyGlyphBlt)(
DrawablePtr /*pDrawable*/,
GCPtr /*pGC*/,
int /*x*/,
int /*y*/,
unsigned int /*nglyph*/,
CharInfoPtr * /*ppci*/,
pointer /*pglyphBase*/
);
typedef void (* typePushPixels)(
GCPtr /*pGC*/,
PixmapPtr /*pBitMap*/,
DrawablePtr /*pDst*/,
int /*w*/,
int /*h*/,
int /*x*/,
int /*y*/
);
static RegionPtr
KdNoopCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC,
int srcx, int srcy, int width, int height, int dstx, int dsty)
{
return NullRegion;
}
static RegionPtr
KdNoopCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC,
int srcx, int srcy, int width, int height,
int dstx, int dsty, unsigned long bitPlane)
{
return NullRegion;
}
GCOps kdNoopOps = {
(typeFillSpans) NoopDDA, /* fill spans */
(typeSetSpans) NoopDDA, /* set spans */
(typePutImage) NoopDDA, /* put image */
KdNoopCopyArea, /* copy area */
KdNoopCopyPlane, /* copy plane */
(typePolyPoint) NoopDDA, /* poly point */
(typePolylines) NoopDDA, /* poly lines */
(typePolySegment) NoopDDA, /* poly segment */
(typePolyRectangle) NoopDDA, /* poly rectangle */
(typePolyArc) NoopDDA, /* poly arc */
(typeFillPolygon) NoopDDA, /* fill polygon */
(typePolyFillRect) NoopDDA, /* poly fillrect */
(typePolyFillArc) NoopDDA, /* poly fillarc */
(typePolyText8) NoopDDA, /* text 8 */
(typePolyText16) NoopDDA, /* text 16 */
(typeImageText8) NoopDDA, /* itext 8 */
(typeImageText16) NoopDDA, /* itext 16 */
(typePolyGlyphBlt) NoopDDA, /* glyph blt */
(typeImageGlyphBlt) NoopDDA, /* iglyph blt */
(typePushPixels) NoopDDA, /* push pixels */
};

View file

@ -1,375 +0,0 @@
/*
* Copyright © 2003 Anders Carlsson
*
* 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, and that the name of Anders Carlsson not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Anders Carlsson makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* ANDERS CARLSSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL ANDERS CARLSSON 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.
*/
#ifdef HAVE_CONFIG_H
#include <kdrive-config.h>
#endif
#include "kdrive.h"
#include "kaa.h"
#define DEBUG_OFFSCREEN 0
#if DEBUG_OFFSCREEN
#define DBG_OFFSCREEN(a) ErrorF a
#else
#define DBG_OFFSCREEN(a)
#endif
#if DEBUG_OFFSCREEN
static void
KdOffscreenValidate (ScreenPtr pScreen)
{
KdScreenPriv (pScreen);
KdOffscreenArea *prev = 0, *area;
assert (pScreenPriv->screen->off_screen_areas->area.offset == 0);
for (area = pScreenPriv->off_screen_areas; area; area = area->next)
{
if (prev)
assert (prev->offset + prev->size == area->offset);
prev = area;
}
assert (prev->offset + prev->size == pScreenPriv->screen->memory_size);
}
#else
#define KdOffscreenValidate(s)
#endif
static KdOffscreenArea *
KdOffscreenKickOut (ScreenPtr pScreen, KdOffscreenArea *area)
{
if (area->save)
(*area->save) (pScreen, area);
return KdOffscreenFree (pScreen, area);
}
KdOffscreenArea *
KdOffscreenAlloc (ScreenPtr pScreen, int size, int align,
Bool locked,
KdOffscreenSaveProc save,
pointer privData)
{
KdOffscreenArea *area, *begin, *best;
KdScreenPriv (pScreen);
int tmp, real_size = 0, best_score;
KdOffscreenValidate (pScreen);
if (!align)
align = 1;
if (!size)
{
DBG_OFFSCREEN (("Alloc 0x%x -> EMPTY\n", size));
return NULL;
}
/* throw out requests that cannot fit */
if (size > (pScreenPriv->screen->memory_size - pScreenPriv->screen->off_screen_base))
{
DBG_OFFSCREEN (("Alloc 0x%x -> TOBIG\n", size));
return NULL;
}
/* Try to find a free space that'll fit. */
for (area = pScreenPriv->off_screen_areas; area; area = area->next)
{
/* skip allocated areas */
if (area->state != KdOffscreenAvail)
continue;
/* adjust size to match alignment requirement */
real_size = size;
tmp = area->offset % align;
if (tmp)
real_size += (align - tmp);
/* does it fit? */
if (real_size <= area->size)
break;
}
if (!area)
{
/*
* Kick out existing users to make space.
*
* First, locate a region which can hold the desired object.
*/
/* prev points at the first object to boot */
best = NULL;
best_score = MAXINT;
for (begin = pScreenPriv->off_screen_areas; begin != NULL;
begin = begin->next)
{
int avail, score;
KdOffscreenArea *scan;
if (begin->state == KdOffscreenLocked)
continue;
/* adjust size to match alignment requirement */
real_size = size;
tmp = begin->offset % align;
if (tmp)
real_size += (align - tmp);
avail = 0;
score = 0;
/* now see if we can make room here, and how "costly" it'll be. */
for (scan = begin; scan != NULL; scan = scan->next)
{
if (scan->state == KdOffscreenLocked) {
/* Can't make room here, start after this locked area. */
begin = scan->next;
break;
}
/* Score should only be non-zero for KdOffscreenRemovable */
score += scan->score;
avail += scan->size;
if (avail >= real_size)
break;
}
/* Is it the best option we've found so far? */
if (avail >= real_size && score < best_score) {
best = begin;
best_score = score;
}
}
area = best;
if (!area)
{
DBG_OFFSCREEN (("Alloc 0x%x -> NOSPACE\n", size));
/* Could not allocate memory */
KdOffscreenValidate (pScreen);
return NULL;
}
/* adjust size to match alignment requirement */
real_size = size;
tmp = begin->offset % align;
if (tmp)
real_size += (align - tmp);
/*
* Kick out first area if in use
*/
if (area->state != KdOffscreenAvail)
area = KdOffscreenKickOut (pScreen, area);
/*
* Now get the system to merge the other needed areas together
*/
while (area->size < real_size)
{
assert (area->next && area->next->state == KdOffscreenRemovable);
(void) KdOffscreenKickOut (pScreen, area->next);
}
}
/* save extra space in new area */
if (real_size < area->size)
{
KdOffscreenArea *new_area = xalloc (sizeof (KdOffscreenArea));
if (!new_area)
return NULL;
new_area->offset = area->offset + real_size;
new_area->size = area->size - real_size;
new_area->state = KdOffscreenAvail;
new_area->save = 0;
new_area->score = 0;
new_area->next = area->next;
area->next = new_area;
area->size = real_size;
}
/*
* Mark this area as in use
*/
if (locked)
area->state = KdOffscreenLocked;
else
area->state = KdOffscreenRemovable;
area->privData = privData;
area->save = save;
area->score = 0;
area->save_offset = area->offset;
{
int tmp = area->offset % align;
if (tmp)
area->offset += (align - tmp);
}
KdOffscreenValidate (pScreen);
DBG_OFFSCREEN (("Alloc 0x%x -> 0x%x\n", size, area->offset));
return area;
}
void
KdOffscreenSwapOut (ScreenPtr pScreen)
{
KdScreenPriv (pScreen);
KdOffscreenValidate (pScreen);
/* loop until a single free area spans the space */
for (;;)
{
KdOffscreenArea *area = pScreenPriv->off_screen_areas;
if (!area)
break;
if (area->state == KdOffscreenAvail)
{
area = area->next;
if (!area)
break;
}
assert (area->state != KdOffscreenAvail);
(void) KdOffscreenKickOut (pScreen, area);
KdOffscreenValidate (pScreen);
}
KdOffscreenValidate (pScreen);
KdOffscreenFini (pScreen);
}
void
KdOffscreenSwapIn (ScreenPtr pScreen)
{
KdOffscreenInit (pScreen);
}
/* merge the next free area into this one */
static void
KdOffscreenMerge (KdOffscreenArea *area)
{
KdOffscreenArea *next = area->next;
/* account for space */
area->size += next->size;
/* frob pointer */
area->next = next->next;
xfree (next);
}
KdOffscreenArea *
KdOffscreenFree (ScreenPtr pScreen, KdOffscreenArea *area)
{
KdScreenPriv(pScreen);
KdOffscreenArea *next = area->next;
KdOffscreenArea *prev;
DBG_OFFSCREEN (("Free 0x%x -> 0x%x\n", area->size, area->offset));
KdOffscreenValidate (pScreen);
area->state = KdOffscreenAvail;
area->save = 0;
area->offset = area->save_offset;
area->score = 0;
/*
* Find previous area
*/
if (area == pScreenPriv->off_screen_areas)
prev = 0;
else
for (prev = pScreenPriv->off_screen_areas; prev; prev = prev->next)
if (prev->next == area)
break;
/* link with next area if free */
if (next && next->state == KdOffscreenAvail)
KdOffscreenMerge (area);
/* link with prev area if free */
if (prev && prev->state == KdOffscreenAvail)
{
area = prev;
KdOffscreenMerge (area);
}
KdOffscreenValidate (pScreen);
return area;
}
void
KdOffscreenMarkUsed (PixmapPtr pPixmap)
{
KaaPixmapPriv (pPixmap);
KdScreenPriv (pPixmap->drawable.pScreen);
static int iter = 0;
if (!pKaaPixmap->area)
return;
/* The numbers here are arbitrary. We may want to tune these. */
pKaaPixmap->area->score += 100;
if (++iter == 10) {
KdOffscreenArea *area;
for (area = pScreenPriv->off_screen_areas; area != NULL;
area = area->next)
{
if (area->state == KdOffscreenRemovable)
area->score = (area->score * 7) / 8;
}
}
}
Bool
KdOffscreenInit (ScreenPtr pScreen)
{
KdScreenPriv (pScreen);
KdOffscreenArea *area;
/* Allocate a big free area */
area = xalloc (sizeof (KdOffscreenArea));
if (!area)
return FALSE;
area->state = KdOffscreenAvail;
area->offset = pScreenPriv->screen->off_screen_base;
area->size = pScreenPriv->screen->memory_size - area->offset;
area->save = 0;
area->next = NULL;
area->score = 0;
/* Add it to the free areas */
pScreenPriv->off_screen_areas = area;
KdOffscreenValidate (pScreen);
return TRUE;
}
void
KdOffscreenFini (ScreenPtr pScreen)
{
KdScreenPriv (pScreen);
KdOffscreenArea *area;
/* just free all of the area records */
while ((area = pScreenPriv->off_screen_areas))
{
pScreenPriv->off_screen_areas = area->next;
xfree (area);
}
}

View file

@ -1,76 +0,0 @@
/*
* Copyright © 1999 Keith Packard
*
* 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, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD 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.
*/
#ifdef HAVE_CONFIG_H
#include <kdrive-config.h>
#endif
#include "kdrive.h"
static CARD8 memoryPatterns[] = { 0xff, 0x00, 0x5a, 0xa5, 0xaa, 0x55 };
#define NUM_PATTERNS (sizeof (memoryPatterns) / sizeof (memoryPatterns[0]))
Bool
KdFrameBufferValid (CARD8 *base, int size)
{
volatile CARD8 *b = (volatile CARD8 *) base;
CARD8 save, test, compare;
int i, j;
b = base + (size - 1);
save = *b;
for (i = 0; i < NUM_PATTERNS; i++)
{
test = memoryPatterns[i];
*b = test;
for (j = 0; j < 1000; j++)
{
compare = *b;
if (compare != test)
return FALSE;
}
}
*b = save;
return TRUE;
}
int
KdFrameBufferSize (CARD8 *base, int max)
{
int min, cur;
min = 0;
while (min + 1 < max)
{
cur = (max + min) / 2;
if (KdFrameBufferValid (base, cur))
min = cur;
else
max = cur;
}
if (KdFrameBufferValid (base, max))
return max;
else
return min;
}

View file

@ -1728,47 +1728,6 @@ KdXVQueryImageAttributes(
}
/**************** Offscreen surface stuff *******************/
typedef struct {
KdOffscreenImagePtr images;
int num;
} OffscreenImageRec;
static OffscreenImageRec OffscreenImages[MAXSCREENS];
static Bool offscreenInited = FALSE;
Bool
KdXVRegisterOffscreenImages(
ScreenPtr pScreen,
KdOffscreenImagePtr images,
int num
){
if(!offscreenInited) {
bzero(OffscreenImages, sizeof(OffscreenImages[MAXSCREENS]));
offscreenInited = TRUE;
}
OffscreenImages[pScreen->myNum].num = num;
OffscreenImages[pScreen->myNum].images = images;
return TRUE;
}
KdOffscreenImagePtr
KdXVQueryOffscreenImages(
ScreenPtr pScreen,
int *num
){
if(!offscreenInited) {
*num = 0;
return NULL;
}
*num = OffscreenImages[pScreen->myNum].num;
return OffscreenImages[pScreen->myNum].images;
}
/**************** Common video manipulation functions *******************/
void

View file

@ -186,30 +186,6 @@ typedef struct {
QueryImageAttributesFuncPtr QueryImageAttributes;
} KdVideoAdaptorRec, *KdVideoAdaptorPtr;
typedef struct {
KdImagePtr image;
int flags;
int (*alloc_surface)(KdScreenInfo * screen,
int id,
unsigned short width,
unsigned short height,
KdSurfacePtr surface);
int (*free_surface)(KdSurfacePtr surface);
int (*display) (KdSurfacePtr surface,
short vid_x, short vid_y,
short drw_x, short drw_y,
short vid_w, short vid_h,
short drw_w, short drw_h,
RegionPtr clipBoxes);
int (*stop) (KdSurfacePtr surface);
int (*getAttribute) (KdScreenInfo * screen, Atom attr, INT32 *value);
int (*setAttribute) (KdScreenInfo * screen, Atom attr, INT32 value);
int max_width;
int max_height;
int num_attributes;
KdAttributePtr attributes;
} KdOffscreenImageRec, *KdOffscreenImagePtr;
Bool
KdXVScreenInit(
ScreenPtr pScreen,
@ -231,19 +207,6 @@ KdXVListGenericAdaptors(
KdVideoAdaptorPtr **Adaptors
);
Bool
KdXVRegisterOffscreenImages(
ScreenPtr pScreen,
KdOffscreenImagePtr images,
int num
);
KdOffscreenImagePtr
KdXVQueryOffscreenImages(
ScreenPtr pScreen,
int *num
);
void
KdXVCopyPackedData(KdScreenInfo *screen, CARD8 *src, CARD8 *dst, int randr,
int srcPitch, int dstPitch, int srcW, int srcH, int top, int left,

View file

@ -27,5 +27,7 @@ Xvesa_DEPENDENCIES = \
libvesa.a \
@KDRIVE_LOCAL_LIBS@
Xvesa_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
relink:
rm -f $(bin_PROGRAMS) && make $(bin_PROGRAMS)

View file

@ -1226,8 +1226,6 @@ vesaRandRSetConfig (ScreenPtr pScreen,
break;
}
KdOffscreenSwapOut (screen->pScreen);
vesaUnmapFramebuffer (screen);
if (!vesaComputeFramebufferMapping (screen))

View file

@ -26,6 +26,7 @@ XVFB_LIBS = \
Xvfb_LDADD = $(XVFB_LIBS) $(XVFB_SYS_LIBS) $(XSERVER_SYS_LIBS)
Xvfb_DEPENDENCIES = $(XVFB_LIBS)
Xvfb_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
# Man page
include $(top_srcdir)/cpprules.in

View file

@ -16,21 +16,17 @@ if XF86UTILS
XF86UTILS_SUBDIR = utils
endif
if MFB
MFB_SUBDIR = xf1bpp xf4bpp
endif
DOC_SUBDIR = doc
SUBDIRS = common ddc dummylib i2c x86emu int10 fbdevhw os-support parser rac \
ramdac shadowfb vbe vgahw xaa $(MFB_SUBDIR) \
SUBDIRS = common ddc dummylib i2c x86emu int10 fbdevhw os-support parser \
ramdac shadowfb vbe vgahw xaa \
xf8_16bpp loader dixmods exa modes \
$(DRI_SUBDIR) $(DRI2_SUBDIR) $(XF86UTILS_SUBDIR) $(DOC_SUBDIR) $(GLUCOSE_DIR)
DIST_SUBDIRS = common ddc dummylib i2c x86emu int10 fbdevhw os-support \
parser rac ramdac shadowfb vbe vgahw xaa xf1bpp xf4bpp \
xf8_16bpp xf8_32bpp loader dixmods dri dri2 exa modes \
utils doc glucose
parser ramdac shadowfb vbe vgahw xaa \
xf8_16bpp loader dixmods dri dri2 exa modes \
utils doc
bin_PROGRAMS = Xorg
@ -56,7 +52,6 @@ XORG_LIBS = \
common/libinit.a \
loader/libloader.a \
libosandcommon.la \
rac/librac.a \
parser/libxf86config.a \
dixmods/libdixmods.la \
modes/libxf86modes.a \

View file

@ -5,16 +5,11 @@ if XORG_BUS_SPARC
SBUS_SOURCES = xf86sbusBus.c
endif
if DEBUG
DEBUGSOURCES = xf86Debug.c
endif
if XV
XVSOURCES = xf86xv.c xf86xvmc.c
XVSDKINCS = xf86xv.h xf86xvmc.h
endif
XKBSOURCES = xf86XKB.c
XISOURCES = xf86Xinput.c xisb.c
XISDKINCS = xf86Xinput.h xisb.h
RANDRSOURCES = xf86RandR.c
@ -34,14 +29,14 @@ libcommon_la_SOURCES = xf86Configure.c xf86Bus.c xf86Config.c \
xf86Cursor.c xf86DGA.c xf86DPMS.c \
xf86DoProbe.c xf86Events.c \
xf86Globals.c xf86AutoConfig.c \
xf86MiscExt.c xf86Option.c \
xf86Option.c \
xf86VidMode.c xf86fbman.c xf86cmap.c \
xf86Helper.c xf86PM.c \
xf86Mode.c xf86Build.h xorgHelper.c xf86Versions.c \
$(XVSOURCES) $(BUSSOURCES) $(XKBSOURCES) \
$(DEBUGSOURCES) $(XISOURCES) $(RANDRSOURCES)
xf86Helper.c xf86PM.c xf86RAC.c xf86Xinput.c xisb.c \
xf86Mode.c xorgHelper.c \
$(XVSOURCES) $(BUSSOURCES) $(RANDRSOURCES)
nodist_libcommon_la_SOURCES = xf86DefModeSet.c
libinit_a_SOURCES = xf86Build.h xf86Init.c
libinit_a_SOURCES = xf86Init.c
nodist_libinit_a_SOURCES = xf86Build.h
INCLUDES = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c \
-I$(srcdir)/../loader -I$(srcdir)/../rac -I$(srcdir)/../parser \
@ -50,7 +45,7 @@ INCLUDES = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c \
sdk_HEADERS = compiler.h fourcc.h xf86.h xf86Module.h xf86Opt.h \
xf86PciInfo.h xf86Priv.h xf86Privstr.h xf86Resources.h \
xf86cmap.h xf86fbman.h xf86str.h $(XISDKINCS) \
xf86cmap.h xf86fbman.h xf86str.h xf86RAC.h xf86Xinput.h xisb.h \
$(XVSDKINCS) atKeynames.h xf86Version.h xorgVersion.h \
xf86sbusBus.h xf86xv.h xf86xvmc.h xf86xvpriv.h
@ -63,7 +58,6 @@ EXTRA_DIST = \
fourcc.h \
scoasm.h \
xf86.h \
xf86Build.h \
xf86Bus.h \
xf86Config.h \
xf86InPriv.h \
@ -82,7 +76,6 @@ EXTRA_DIST = \
xf86xvmc.h \
xf86xvpriv.h \
xisb.h \
xf86Build.h.in \
xf86Version.h \
xorgVersion.h \
xf86Date.h \

View file

@ -498,7 +498,7 @@ extern unsigned int inb(unsigned long port);
extern unsigned int inw(unsigned long port);
extern unsigned int inl(unsigned long port);
# elif defined(linux) && (defined(__amd64__) || defined(__x86_64__))
# elif defined(linux) && defined(__amd64__)
# include <inttypes.h>
@ -564,9 +564,8 @@ inl(unsigned short port)
return ret;
}
# elif (defined(linux) || defined(Lynx) || defined(sun) || defined(__OpenBSD__) || defined(__FreeBSD__)) && defined(__sparc__)
# elif (defined(linux) || defined(sun) || defined(__OpenBSD__) || defined(__FreeBSD__)) && defined(__sparc__)
# if !defined(Lynx)
# ifndef ASI_PL
# define ASI_PL 0x88
# endif
@ -805,7 +804,6 @@ xf86WriteMmio32LeNB(__volatile__ void *base, const unsigned long offset,
: "r" (val), "r" (addr), "i" (ASI_PL));
}
# endif /* !Lynx */
/*
* EGCS 1.1 knows about arbitrary unaligned loads. Define some
@ -1067,7 +1065,7 @@ xf86WriteMmio32Be(__volatile__ void *base, const unsigned long offset,
# define write_mem_barrier() /* NOP */
# endif /* __arm32__ */
# elif (defined(Lynx) || defined(linux) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__)) && defined(__powerpc__)
# elif (defined(linux) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__)) && defined(__powerpc__)
# ifndef MAP_FAILED
# define MAP_FAILED ((void *)-1)

View file

@ -7,18 +7,12 @@
# 832x624 @ 75Hz (74.55Hz) (fix if the official/Apple spec is different) hsync: 49.725kHz
ModeLine "832x624" 57.284 832 864 928 1152 624 625 628 667 -Hsync -Vsync
# 1152x768 @ 54.8Hz (Titanium PowerBook) hsync: 44.2kHz
ModeLine "1152x768" 64.995 1152 1178 1314 1472 768 771 777 806 +hsync +vsync
# 1400x1050 @ 60Hz (VESA GTF) hsync: 65.5kHz
ModeLine "1400x1050" 122.0 1400 1488 1640 1880 1050 1052 1064 1082 +hsync +vsync
# 1400x1050 @ 75Hz (VESA GTF) hsync: 82.2kHz
ModeLine "1400x1050" 155.8 1400 1464 1784 1912 1050 1052 1064 1090 +hsync +vsync
# 1600x1024 @ 60Hz (SGI 1600SW) hsync: 64.0kHz
Modeline "1600x1024" 106.910 1600 1620 1640 1670 1024 1027 1030 1067 -hsync -vsync
# 1920x1440 @ 85Hz (VESA GTF) hsync: 128.5kHz
Modeline "1920x1440" 341.35 1920 2072 2288 2656 1440 1441 1444 1512 -hsync +vsync

View file

@ -340,23 +340,6 @@ Bool xf86IsUnblank(int mode);
_X_DEPRECATED void xf86AddModuleInfo(pointer info, pointer module);
_X_DEPRECATED void xf86DeleteModuleInfo(int idx);
void xf86getsecs(long *, long *);
/* xf86Debug.c */
#ifdef BUILDDEBUG
CARD8 xf86PeekFb8(CARD8 *p);
CARD16 xf86PeekFb16(CARD16 *p);
CARD32 xf86PeekFb32(CARD32 *p);
void xf86PokeFb8(CARD8 *p, CARD8 v);
void xf86PokeFb16(CARD16 *p, CARD16 v);
void xf86PokeFb32(CARD16 *p, CARD32 v);
CARD8 xf86PeekMmio8(pointer Base, unsigned long Offset);
CARD16 xf86PeekMmio16(pointer Base, unsigned long Offset);
CARD32 xf86PeekMmio32(pointer Base, unsigned long Offset);
void xf86PokeMmio8(pointer Base, unsigned long Offset, CARD8 v);
void xf86PokeMmio16(pointer Base, unsigned long Offset, CARD16 v);
void xf86PokeMmio32(pointer Base, unsigned long Offset, CARD32 v);
#endif
/* xf86Init.c */
@ -418,12 +401,6 @@ Bool xf86RandRSetNewVirtualAndDimensions(ScreenPtr pScreen,
Bool VidModeExtensionInit(ScreenPtr pScreen);
/* xf86Versions.c */
CARD32 xf86GetBuiltinInterfaceVersion(BuiltinInterface iface, int flag);
Bool xf86RegisterBuiltinInterfaceVersion(BuiltinInterface iface,
CARD32 version, int flags);
#endif /* _NO_XF86_PROTOTYPES */
#endif /* _XF86_H */

View file

@ -41,6 +41,11 @@
#include "xf86_OSlib.h"
#include "dirent.h"
#ifdef sun
# include <sys/visual_io.h>
# include <ctype.h>
#endif
/* Sections for the default built-in configuration. */
#define BUILTIN_DEVICE_NAME \
@ -79,11 +84,8 @@
static const char **builtinConfig = NULL;
static int builtinLines = 0;
static const char *deviceList[] = {
"fbdev",
"vesa",
NULL
};
static void listPossibleVideoDrivers(char *matches[], int nmatches);
/*
* A built-in config file is stored as an array of strings, with each string
@ -135,87 +137,91 @@ AppendToConfig(const char *s)
AppendToList(s, &builtinConfig, &builtinLines);
}
static const char *
videoPtrToDriverName(struct pci_device *dev)
static int
videoPtrToDriverList(struct pci_device *dev,
char *returnList[], int returnListMax)
{
/*
* things not handled yet:
* cyrix/nsc. should be merged into geode anyway.
* xgi.
*/
int i;
/* Add more entries here if we ever return more than 4 drivers for
any device */
char *driverList[5] = { NULL, NULL, NULL, NULL, NULL };
switch (dev->vendor_id)
{
case 0x1022:
if (dev->device_id == 0x2081)
return "geode";
else
return NULL;
case 0x1142: return "apm";
case 0xedd8: return "ark";
case 0x1a03: return "ast";
case 0x1002: return "ati";
case 0x102c: return "chips";
case 0x1013: return "cirrus";
if (dev->device_id == 0x2081) {
driverList[0] = "geode";
driverList[1] = "amd";
}
break;
case 0x1142: driverList[0] = "apm"; break;
case 0xedd8: driverList[0] = "ark"; break;
case 0x1a03: driverList[0] = "ast"; break;
case 0x1002: driverList[0] = "ati"; break;
case 0x102c: driverList[0] = "chips"; break;
case 0x1013: driverList[0] = "cirrus"; break;
case 0x8086:
if ((dev->device_id == 0x00d1) || (dev->device_id == 0x7800))
return "i740";
else return "intel";
case 0x102b: return "mga";
case 0x10c8: return "neomagic";
case 0x105d: return "i128";
case 0x10de: case 0x12d2: return "nv";
case 0x1163: return "rendition";
if ((dev->device_id == 0x00d1) || (dev->device_id == 0x7800)) {
driverList[0] = "i740";
} else {
driverList[0] = "intel";
driverList[1] = "i810";
}
break;
case 0x102b: driverList[0] = "mga"; break;
case 0x10c8: driverList[0] = "neomagic"; break;
case 0x105d: driverList[0] = "i128"; break;
case 0x10de: case 0x12d2: driverList[0] = "nv"; break;
case 0x1163: driverList[0] = "rendition"; break;
case 0x5333:
switch (dev->device_id)
{
case 0x88d0: case 0x88d1: case 0x88f0: case 0x8811:
case 0x8812: case 0x8814: case 0x8901:
return "s3";
driverList[0] = "s3"; break;
case 0x5631: case 0x883d: case 0x8a01: case 0x8a10:
case 0x8c01: case 0x8c03: case 0x8904: case 0x8a13:
return "s3virge";
driverList[0] = "s3virge"; break;
default:
return "savage";
driverList[0] = "savage"; break;
}
case 0x1039: return "sis";
case 0x126f: return "siliconmotion";
break;
case 0x1039: driverList[0] = "sis"; break;
case 0x126f: driverList[0] = "siliconmotion"; break;
case 0x121a:
if (dev->device_id < 0x0003)
return "voodoo";
driverList[0] = "voodoo";
else
return "tdfx";
case 0x3d3d: return "glint";
case 0x1023: return "trident";
case 0x100c: return "tseng";
case 0x1106: return "openchrome";
case 0x15ad: return "vmware";
driverList[0] = "tdfx";
break;
case 0x3d3d: driverList[0] = "glint"; break;
case 0x1023: driverList[0] = "trident"; break;
case 0x100c: driverList[0] = "tseng"; break;
case 0x1106: driverList[0] = "openchrome"; break;
case 0x15ad: driverList[0] = "vmware"; break;
default: break;
}
return NULL;
for (i = 0; (i < returnListMax) && (driverList[i] != NULL); i++) {
returnList[i] = xnfstrdup(driverList[i]);
}
return i; /* Number of entries added */
}
Bool
xf86AutoConfig(void)
{
const char **p;
char *deviceList[20];
char **p;
const char **cp;
char buf[1024];
const char *driver = NULL;
ConfigStatus ret;
driver = chooseVideoDriver();
if (driver) {
snprintf(buf, sizeof(buf), BUILTIN_DEVICE_SECTION_PRE,
driver, 0, driver);
AppendToConfig(buf);
ErrorF("New driver is \"%s\"\n", driver);
buf[0] = '\t';
AppendToConfig(BUILTIN_DEVICE_SECTION_POST);
snprintf(buf, sizeof(buf), BUILTIN_SCREEN_SECTION,
driver, 0, driver, 0);
AppendToConfig(buf);
}
listPossibleVideoDrivers(deviceList, 20);
for (p = deviceList; *p; p++) {
snprintf(buf, sizeof(buf), BUILTIN_DEVICE_SECTION, *p, 0, *p);
@ -225,23 +231,23 @@ xf86AutoConfig(void)
}
AppendToConfig(BUILTIN_LAYOUT_SECTION_PRE);
if (driver) {
snprintf(buf, sizeof(buf), BUILTIN_LAYOUT_SCREEN_LINE, driver, 0);
AppendToConfig(buf);
}
for (p = deviceList; *p; p++) {
snprintf(buf, sizeof(buf), BUILTIN_LAYOUT_SCREEN_LINE, *p, 0);
AppendToConfig(buf);
}
AppendToConfig(BUILTIN_LAYOUT_SECTION_POST);
for (p = deviceList; *p; p++) {
xfree(*p);
}
xf86MsgVerb(X_DEFAULT, 0,
"Using default built-in configuration (%d lines)\n",
builtinLines);
xf86MsgVerb(X_DEFAULT, 3, "--- Start of built-in configuration ---\n");
for (p = builtinConfig; *p; p++)
xf86ErrorFVerb(3, "\t%s", *p);
for (cp = builtinConfig; *cp; cp++)
xf86ErrorFVerb(3, "\t%s", *cp);
xf86MsgVerb(X_DEFAULT, 3, "--- End of built-in configuration ---\n");
xf86setBuiltinConfig(builtinConfig);
@ -416,17 +422,51 @@ matchDriverFromFiles (char** matches, uint16_t match_vendor, uint16_t match_chip
}
#endif /* __linux__ */
char*
chooseVideoDriver(void)
static void
listPossibleVideoDrivers(char *matches[], int nmatches)
{
struct pci_device * info = NULL;
struct pci_device_iterator *iter;
char *chosen_driver = NULL;
int i;
char *matches[20]; /* If we have more than 20 drivers we're in trouble */
for (i=0 ; i<20 ; i++)
for (i = 0 ; i < nmatches ; i++) {
matches[i] = NULL;
}
i = 0;
#ifdef sun
/* Check for driver type based on /dev/fb type and if valid, use
it instead of PCI bus probe results */
if (xf86Info.consoleFd >= 0) {
struct vis_identifier visid;
const char *cp;
if (ioctl(xf86Info.consoleFd, VIS_GETIDENTIFIER, &visid) >= 0) {
xf86Msg(X_PROBED, "console driver: %s\n", visid.name);
/* Special case from before the general case was set */
if (strcmp(visid.name, "NVDAnvda") == 0) {
matches[i++] = xnfstrdup("nvidia");
}
/* General case - split into vendor name (initial all-caps
prefix) & driver name (rest of the string). */
if (strcmp(visid.name, "SUNWtext") != 0) {
for (cp = visid.name; (*cp != '\0') && isupper(*cp); cp++) {
/* find end of all uppercase vendor section */
}
if ((cp != visid.name) && (*cp != '\0')) {
char *driverName = xnfstrdup(cp);
char *vendorName = xnfstrdup(visid.name);
vendorName[cp - visid.name] = '\0';
matches[i++] = vendorName;
matches[i++] = driverName;
}
}
}
}
#endif
/* Find the primary device, and get some information about it. */
iter = pci_slot_match_iterator_create(NULL);
@ -447,31 +487,52 @@ chooseVideoDriver(void)
}
#endif /* __linux__ */
/* TODO Handle multiple drivers claiming to support the same PCI ID */
if (matches[0]) {
chosen_driver = matches[0];
} else {
if (info != NULL)
chosen_driver = videoPtrToDriverName(info);
if (chosen_driver == NULL) {
#if defined __i386__ || defined __amd64__ || defined __x86_64__ || defined __hurd__
chosen_driver = "vesa";
#elif defined __sparc__
chosen_driver = "sunffb";
#else
chosen_driver = "fbdev";
#endif
}
for (i = 0; (i < nmatches) && (matches[i]); i++) {
/* find end of matches list */
}
xf86Msg(X_DEFAULT, "Matched %s for the autoconfigured driver\n", chosen_driver);
if ((info != NULL) && (i < nmatches)) {
i += videoPtrToDriverList(info, &(matches[i]), nmatches - i);
}
i = 0;
while (matches[i]) {
/* Fallback to platform default hardware */
if (i < (nmatches - 1)) {
#if defined(__i386__) || defined(__amd64__) || defined(__hurd__)
matches[i++] = xnfstrdup("vesa");
#elif defined(__sparc__) && !defined(sun)
matches[i++] = xnfstrdup("sunffb");
#endif
}
/* Fallback to platform default frame buffer driver */
if (i < (nmatches - 1)) {
#if !defined(__linux__) && defined(__sparc__)
matches[i++] = xnfstrdup("wsfb");
#else
matches[i++] = xnfstrdup("fbdev");
#endif
}
}
char*
chooseVideoDriver(void)
{
char *chosen_driver = NULL;
int i;
char *matches[20]; /* If we have more than 20 drivers we're in trouble */
listPossibleVideoDrivers(matches, 20);
/* TODO Handle multiple drivers claiming to support the same PCI ID */
chosen_driver = matches[0];
xf86Msg(X_DEFAULT, "Matched %s for the autoconfigured driver\n",
chosen_driver);
for (i = 0; matches[i] ; i++) {
if (matches[i] != chosen_driver) {
xfree(matches[i]);
}
i++;
}
return chosen_driver;

View file

@ -116,12 +116,13 @@ static ModuleDefault ModuleDefaults[] = {
{.name = "extmod", .toLoad = TRUE, .load_opt=NULL},
{.name = "dbe", .toLoad = TRUE, .load_opt=NULL},
{.name = "glx", .toLoad = TRUE, .load_opt=NULL},
{.name = "freetype", .toLoad = TRUE, .load_opt=NULL},
#ifdef XRECORD
{.name = "record", .toLoad = TRUE, .load_opt=NULL},
#endif
{.name = "dri", .toLoad = TRUE, .load_opt=NULL},
#ifdef DRI2
{.name = "dri2", .toLoad = TRUE, .load_opt=NULL},
#endif
{.name = NULL, .toLoad = FALSE, .load_opt=NULL}
};
@ -305,7 +306,7 @@ xf86ModulelistFromConfig(pointer **optlist)
}
}
if (found == FALSE) {
XF86ConfModulePtr ptr = xf86configptr->conf_modules;
XF86LoadPtr ptr = (XF86LoadPtr)xf86configptr->conf_modules;
ptr = xf86addNewLoadDirective(ptr, ModuleDefaults[i].name, XF86_LOAD_MODULE, ModuleDefaults[i].load_opt);
xf86Msg(X_INFO, "\"%s\" will be loaded by default.\n", ModuleDefaults[i].name);
}
@ -314,7 +315,7 @@ xf86ModulelistFromConfig(pointer **optlist)
xf86configptr->conf_modules = xnfcalloc(1, sizeof(XF86ConfModuleRec));
for (i=0 ; ModuleDefaults[i].name != NULL ; i++) {
if (ModuleDefaults[i].toLoad == TRUE) {
XF86ConfModulePtr ptr = xf86configptr->conf_modules;
XF86LoadPtr ptr = (XF86LoadPtr)xf86configptr->conf_modules;
ptr = xf86addNewLoadDirective(ptr, ModuleDefaults[i].name, XF86_LOAD_MODULE, ModuleDefaults[i].load_opt);
}
}
@ -599,8 +600,9 @@ configFiles(XF86ConfFilesPtr fileconf)
pathFrom = X_CONFIG;
if (*f) {
if (xf86Info.useDefaultFontPath) {
char *g;
xf86Msg(X_DEFAULT, "Including the default font path %s.\n", defaultFontPath);
char *g = xnfalloc(strlen(defaultFontPath) + strlen(f) + 3);
g = xnfalloc(strlen(defaultFontPath) + strlen(f) + 3);
strcpy(g, f);
strcat(g, ",");
defaultFontPath = strcat(g, defaultFontPath);
@ -948,13 +950,6 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
xf86Info.vidModeAllowNonLocal = value;
#endif
#ifdef XF86MISC
if (xf86GetOptValBool(FlagOptions, FLAG_DISABLEMODINDEV, &value))
xf86Info.miscModInDevEnabled = !value;
if (xf86GetOptValBool(FlagOptions, FLAG_MODINDEVALLOWNONLOCAL, &value))
xf86Info.miscModInDevAllowNonLocal = value;
#endif
if (xf86GetOptValBool(FlagOptions, FLAG_ALLOWMOUSEOPENFAIL, &value))
xf86Info.allowMouseOpenFail = value;
@ -1084,9 +1079,9 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
}
#endif
xf86Info.allowEmptyInput = FALSE;
if (xf86GetOptValBool(FlagOptions, FLAG_ALLOW_EMPTY_INPUT, &value))
xf86Info.allowEmptyInput = TRUE;
/* AllowEmptyInput is automatically true if we're hotplugging */
xf86Info.allowEmptyInput = (xf86Info.autoAddDevices && xf86Info.autoEnableDevices);
xf86GetOptValBool(FlagOptions, FLAG_ALLOW_EMPTY_INPUT, &xf86Info.allowEmptyInput);
xf86Info.useDefaultFontPath = TRUE;
xf86Info.useDefaultFontPathFrom = X_DEFAULT;
@ -1233,8 +1228,8 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
* remove the core attribute from the later ones.
*/
for (devs = servlayoutp->inputs; devs && *devs; devs++) {
indp = *devs;
pointer opt1 = NULL, opt2 = NULL;
indp = *devs;
if (indp->commonOptions &&
xf86CheckBoolOption(indp->commonOptions, "CorePointer", FALSE)) {
opt1 = indp->commonOptions;
@ -1605,10 +1600,14 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
count++;
adjp = (XF86ConfAdjacencyPtr)adjp->list.next;
}
#ifdef DEBUG
ErrorF("Found %d screens in the layout section %s",
count, conf_layout->lay_identifier);
#endif
if (!count) /* alloc enough storage even if no screen is specified */
count = 1;
slp = xnfcalloc(1, (count + 1) * sizeof(screenLayoutRec));
slp[count].screen = NULL;
/*
@ -1663,6 +1662,20 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
adjp = (XF86ConfAdjacencyPtr)adjp->list.next;
}
/* No screen was specified in the layout. take the first one from the
* config file, or - if it is NULL - configScreen autogenerates one for
* us */
if (!count)
{
slp[0].screen = xnfcalloc(1, sizeof(confScreenRec));
if (!configScreen(slp[0].screen, xf86configptr->conf_screen_lst,
0, X_CONFIG)) {
xfree(slp[0].screen);
xfree(slp);
return FALSE;
}
}
/* XXX Need to tie down the upper left screen. */
/* Fill in the refscreen and top/bottom/left/right values */
@ -1853,9 +1866,7 @@ configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen)
indp = xnfalloc(sizeof(IDevPtr));
*indp = NULL;
servlayoutp->inputs = indp;
if (!xf86Info.allowEmptyInput && !checkCoreInputDevices(servlayoutp, TRUE))
return FALSE;
return TRUE;
}
@ -2040,6 +2051,7 @@ configMonitor(MonPtr monitorp, XF86ConfMonitorPtr conf_monitor)
XF86ConfModesLinkPtr modeslnk = conf_monitor->mon_modes_sect_lst;
Gamma zeros = {0.0, 0.0, 0.0};
float badgamma = 0.0;
double maxPixClock;
xf86Msg(X_CONFIG, "| |-->Monitor \"%s\"\n",
conf_monitor->mon_identifier);
@ -2174,8 +2186,11 @@ configMonitor(MonPtr monitorp, XF86ConfMonitorPtr conf_monitor)
xf86ProcessOptions(-1, monitorp->options, MonitorOptions);
xf86GetOptValBool(MonitorOptions, MON_REDUCEDBLANKING,
&monitorp->reducedblanking);
xf86GetOptValFreq(MonitorOptions, MON_MAX_PIX_CLOCK, OPTUNITS_KHZ,
&monitorp->maxPixClock);
if (xf86GetOptValFreq(MonitorOptions, MON_MAX_PIX_CLOCK, OPTUNITS_KHZ,
&maxPixClock) == TRUE) {
monitorp->maxPixClock = (int) maxPixClock;
}
return TRUE;
}
@ -2416,14 +2431,14 @@ configInput(IDevPtr inputp, XF86ConfInputPtr conf_input, MessageType from)
}
static Bool
modeIsPresent(char * modename,MonPtr monitorp)
modeIsPresent(DisplayModePtr mode, MonPtr monitorp)
{
DisplayModePtr knownmodes = monitorp->Modes;
/* all I can think of is a linear search... */
while(knownmodes != NULL)
{
if(!strcmp(modename,knownmodes->name) &&
if(!strcmp(mode->name, knownmodes->name) &&
!(knownmodes->type & M_T_DEFAULT))
return TRUE;
knownmodes = knownmodes->next;
@ -2454,6 +2469,12 @@ addDefaultModes(MonPtr monitorp)
return TRUE;
}
static void
checkInput(serverLayoutPtr layout) {
if (!xf86Info.allowEmptyInput)
checkCoreInputDevices(layout, FALSE);
}
/*
* load the config file and fill the global data structure
*/
@ -2574,6 +2595,8 @@ xf86HandleConfigFile(Bool autoconfig)
configDRI(xf86configptr->conf_dri);
#endif
checkInput(&xf86ConfigLayout);
/*
* Handle some command line options that can override some of the
* ServerFlags settings.
@ -2585,13 +2608,6 @@ xf86HandleConfigFile(Bool autoconfig)
xf86Info.vidModeAllowNonLocal = TRUE;
#endif
#ifdef XF86MISC
if (xf86MiscModInDevDisabled)
xf86Info.miscModInDevEnabled = FALSE;
if (xf86MiscModInDevAllowNonLocal)
xf86Info.miscModInDevAllowNonLocal = TRUE;
#endif
if (xf86AllowMouseOpenFail)
xf86Info.allowMouseOpenFail = TRUE;

View file

@ -1,77 +0,0 @@
/*
* Copyright (c) 2000-2003 by The XFree86 Project, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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 copyright holder(s)
* and author(s) 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 copyright holder(s) and author(s).
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include <sys/time.h>
#include <unistd.h>
#include <X11/X.h>
#include "os.h"
#include "xf86.h"
#include "xf86Priv.h"
#include "xf86_OSlib.h"
#include "compiler.h"
CARD8 xf86PeekFb8(CARD8 *p) { return *p; }
CARD16 xf86PeekFb16(CARD16 *p) { return *p; }
CARD32 xf86PeekFb32(CARD32 *p) { return *p; }
void xf86PokeFb8(CARD8 *p, CARD8 v) { *p = v; }
void xf86PokeFb16(CARD16 *p, CARD16 v) { *p = v; }
void xf86PokeFb32(CARD16 *p, CARD32 v) { *p = v; }
CARD8 xf86PeekMmio8(pointer Base, unsigned long Offset)
{
return MMIO_IN8(Base,Offset);
}
CARD16 xf86PeekMmio16(pointer Base, unsigned long Offset)
{
return MMIO_IN16(Base,Offset);
}
CARD32 xf86PeekMmio32(pointer Base, unsigned long Offset)
{
return MMIO_IN32(Base,Offset);
}
void xf86PokeMmio8(pointer Base, unsigned long Offset, CARD8 v)
{
MMIO_OUT8(Base,Offset,v);
}
void xf86PokeMmio16(pointer Base, unsigned long Offset, CARD16 v)
{
MMIO_OUT16(Base,Offset,v);
}
void xf86PokeMmio32(pointer Base, unsigned long Offset, CARD32 v)
{
MMIO_OUT32(Base,Offset,v);
}

View file

@ -196,45 +196,6 @@ void
ProcessInputEvents ()
{
int x, y;
#ifdef INHERIT_LOCK_STATE
static int generation = 0;
#endif
/*
* With INHERIT_LOCK_STATE defined, the initial state of CapsLock, NumLock
* and ScrollLock will be set to match that of the VT the server is
* running on.
*/
#ifdef INHERIT_LOCK_STATE
if (generation != serverGeneration) {
xEvent kevent;
DevicePtr pKeyboard = xf86Info.pKeyboard;
extern unsigned int xf86InitialCaps, xf86InitialNum, xf86InitialScroll;
generation = serverGeneration;
kevent.u.keyButtonPointer.time = GetTimeInMillis();
kevent.u.keyButtonPointer.rootX = 0;
kevent.u.keyButtonPointer.rootY = 0;
kevent.u.u.type = KeyPress;
if (xf86InitialCaps) {
kevent.u.u.detail = xf86InitialCaps;
(* pKeyboard->processInputProc)(&kevent, (DeviceIntPtr)pKeyboard, 1);
xf86InitialCaps = 0;
}
if (xf86InitialNum) {
kevent.u.u.detail = xf86InitialNum;
(* pKeyboard->processInputProc)(&kevent, (DeviceIntPtr)pKeyboard, 1);
xf86InitialNum = 0;
}
if (xf86InitialScroll) {
kevent.u.u.detail = xf86InitialScroll;
(* pKeyboard->processInputProc)(&kevent, (DeviceIntPtr)pKeyboard, 1);
xf86InitialScroll = 0;
}
}
#endif
mieqProcessInputEvents();
@ -355,30 +316,6 @@ xf86ProcessActionEvent(ActionEvent action, void *arg)
}
break;
#endif
case ACTION_MESSAGE:
{
char *retstr, *message = (char *) arg;
ScrnInfoPtr pScr = XF86SCRNINFO(xf86Info.currentScreen);
#ifdef DEBUG
ErrorF("ActionMessage: '%s'\n", message);
#endif
/* Okay the message made it to the ddx. The common layer */
/* can check for relevant messages here and react to any */
/* that have a global effect. For example: */
/* */
/* if (!strcmp(message, "foo") { */
/* do_foo(); break */
/* } */
/* */
/* otherwise fallback to sending a key event message to */
/* the current screen's driver: */
if (*pScr->HandleMessage != NULL) {
(void) (*pScr->HandleMessage)(pScr->scrnIndex,
"KeyEventMessage", message, &retstr);
}
}
break;
default:
break;
}

View file

@ -192,10 +192,6 @@ Bool xf86AllowMouseOpenFail = FALSE;
Bool xf86VidModeDisabled = FALSE;
Bool xf86VidModeAllowNonLocal = FALSE;
#endif
#ifdef XF86MISC
Bool xf86MiscModInDevDisabled = FALSE;
Bool xf86MiscModInDevAllowNonLocal = FALSE;
#endif
RootWinPropPtr *xf86RegisteredPropertiesTable = NULL;
_X_EXPORT Bool xf86inSuspend = FALSE;
Bool xorgHWAccess = FALSE;

View file

@ -308,12 +308,11 @@ xf86AllocateScrnInfoPrivateIndex(void)
return idx;
}
/* Allocate a new InputInfoRec and add it to the head xf86InputDevs. */
/* Allocate a new InputInfoRec and append it to the tail of xf86InputDevs. */
_X_EXPORT InputInfoPtr
xf86AllocateInput(InputDriverPtr drv, int flags)
{
InputInfoPtr new;
InputInfoPtr new, *prev = NULL;
if (!(new = xcalloc(sizeof(InputInfoRec), 1)))
return NULL;
@ -321,8 +320,13 @@ xf86AllocateInput(InputDriverPtr drv, int flags)
new->drv = drv;
drv->refCount++;
new->module = DuplicateModule(drv->module, NULL);
new->next = xf86InputDevs;
xf86InputDevs = new;
for (prev = &xf86InputDevs; *prev; prev = &(*prev)->next)
;
*prev = new;
new->next = NULL;
return new;
}
@ -2937,17 +2941,3 @@ xf86GetMotionEvents(DeviceIntPtr pDev, xTimecoord *buff, unsigned long start,
{
return GetMotionHistory(pDev, buff, start, stop, pScreen, core);
}
_X_EXPORT void
xf86getsecs(long * secs, long * usecs)
{
struct timeval tv;
X_GETTIMEOFDAY(&tv);
if (secs)
*secs = tv.tv_sec;
if (usecs)
*usecs= tv.tv_usec;
return;
}

View file

@ -93,12 +93,6 @@
#include "xf86Bus.h"
/* forward declarations */
static void xf86PrintBanner(void);
static void xf86PrintMarkers(void);
static void xf86PrintDefaultModulePath(void);
static void xf86PrintDefaultLibraryPath(void);
static Bool probe_devices_from_device_sections(DriverPtr drvp);
static Bool add_matching_devices_to_configure_list(DriverPtr drvp);
static Bool check_for_matching_devices(DriverPtr drvp);
@ -127,6 +121,130 @@ static int numFormats = 6;
#endif
static Bool formatsDone = FALSE;
#ifndef OSNAME
#define OSNAME " unknown"
#endif
#ifndef OSVENDOR
#define OSVENDOR ""
#endif
#ifndef PRE_RELEASE
#define PRE_RELEASE XORG_VERSION_SNAP
#endif
static void
xf86PrintBanner()
{
#if PRE_RELEASE
ErrorF("\n"
"This is a pre-release version of the X server from " XVENDORNAME ".\n"
"It is not supported in any way.\n"
"Bugs may be filed in the bugzilla at http://bugs.freedesktop.org/.\n"
"Select the \"xorg\" product for bugs you find in this release.\n"
"Before reporting bugs in pre-release versions please check the\n"
"latest version in the X.Org Foundation git repository.\n"
"See http://wiki.x.org/wiki/GitPage for git access instructions.\n");
#endif
ErrorF("\nX.Org X Server %d.%d.%d",
XORG_VERSION_MAJOR,
XORG_VERSION_MINOR,
XORG_VERSION_PATCH);
#if XORG_VERSION_SNAP > 0
ErrorF(".%d", XORG_VERSION_SNAP);
#endif
#if XORG_VERSION_SNAP >= 900
/* When the minor number is 99, that signifies that the we are making
* a release candidate for a major version. (X.0.0)
* When the patch number is 99, that signifies that the we are making
* a release candidate for a minor version. (X.Y.0)
* When the patch number is < 99, then we are making a release
* candidate for the next point release. (X.Y.Z)
*/
#if XORG_VERSION_MINOR >= 99
ErrorF(" (%d.0.0 RC %d)", XORG_VERSION_MAJOR+1, XORG_VERSION_SNAP - 900);
#elif XORG_VERSION_PATCH == 99
ErrorF(" (%d.%d.0 RC %d)", XORG_VERSION_MAJOR, XORG_VERSION_MINOR + 1,
XORG_VERSION_SNAP - 900);
#else
ErrorF(" (%d.%d.%d RC %d)", XORG_VERSION_MAJOR, XORG_VERSION_MINOR,
XORG_VERSION_PATCH + 1, XORG_VERSION_SNAP - 900);
#endif
#endif
#ifdef XORG_CUSTOM_VERSION
ErrorF(" (%s)", XORG_CUSTOM_VERSION);
#endif
#ifndef XORG_DATE
#define XORG_DATE XF86_DATE
#endif
ErrorF("\nRelease Date: %s\n", XORG_DATE);
ErrorF("X Protocol Version %d, Revision %d\n",
X_PROTOCOL, X_PROTOCOL_REVISION);
ErrorF("Build Operating System: %s %s\n", OSNAME, OSVENDOR);
#ifdef HAS_UTSNAME
{
struct utsname name;
/* Linux & BSD state that 0 is success, SysV (including Solaris, HP-UX,
and Irix) and Single Unix Spec 3 just say that non-negative is success.
All agree that failure is represented by a negative number.
*/
if (uname(&name) >= 0) {
ErrorF("Current Operating System: %s %s %s %s %s\n",
name.sysname, name.nodename, name.release, name.version, name.machine);
}
}
#endif
#if defined(BUILD_DATE) && (BUILD_DATE > 19000000)
{
struct tm t;
char buf[100];
bzero(&t, sizeof(t));
bzero(buf, sizeof(buf));
t.tm_mday = BUILD_DATE % 100;
t.tm_mon = (BUILD_DATE / 100) % 100 - 1;
t.tm_year = BUILD_DATE / 10000 - 1900;
#if defined(BUILD_TIME)
t.tm_sec = BUILD_TIME % 100;
t.tm_min = (BUILD_TIME / 100) % 100;
t.tm_hour = (BUILD_TIME / 10000) % 100;
if (strftime(buf, sizeof(buf), "%d %B %Y %I:%M:%S%p", &t))
ErrorF("Build Date: %s\n", buf);
#else
if (strftime(buf, sizeof(buf), "%d %B %Y", &t))
ErrorF("Build Date: %s\n", buf);
#endif
}
#endif
#if defined(CLOG_DATE) && (CLOG_DATE > 19000000)
{
struct tm t;
char buf[100];
bzero(&t, sizeof(t));
bzero(buf, sizeof(buf));
t.tm_mday = CLOG_DATE % 100;
t.tm_mon = (CLOG_DATE / 100) % 100 - 1;
t.tm_year = CLOG_DATE / 10000 - 1900;
if (strftime(buf, sizeof(buf), "%d %B %Y", &t))
ErrorF("Changelog Date: %s\n", buf);
}
#endif
#if defined(BUILDERSTRING)
ErrorF("%s \n",BUILDERSTRING);
#endif
ErrorF("\tBefore reporting problems, check "__VENDORDWEBSUPPORT__"\n"
"\tto make sure that you have the latest version.\n");
ErrorF("Module Loader present\n");
}
static void
xf86PrintMarkers()
{
LogPrintMarkers();
}
static Bool
xf86CreateRootWindow(WindowPtr pWin)
{
@ -174,10 +292,10 @@ xf86CreateRootWindow(WindowPtr pWin)
pProp->size, pProp->data,
FALSE);
}
/* Look at err */
ret &= (err==Success);
} else {
xf86Msg(X_ERROR, "xf86CreateRootWindow unexpectedly called with "
"non-root window %p (parent %p)\n",
@ -194,7 +312,7 @@ xf86CreateRootWindow(WindowPtr pWin)
static void
PostConfigInit(void)
InstallSignalHandlers(void)
{
/*
* Install signal handler for unexpected signals
@ -220,13 +338,6 @@ PostConfigInit(void)
signal(SIGXFSZ,xf86SigHandler);
#endif
}
#ifdef XF86PM
xf86OSPMClose = xf86OSPMOpen();
#endif
/* Do this after XF86Config is read (it's normally in OsInit()) */
OsInitColors();
}
@ -254,7 +365,7 @@ probe_devices_from_device_sections(DriverPtr drvp)
iter = pci_id_match_iterator_create(NULL);
while ((pPci = pci_device_next(iter)) != NULL) {
if (devList[i]->busID && *devList[i]->busID) {
if (xf86ComparePciBusString(devList[i]->busID,
if (xf86ComparePciBusString(devList[i]->busID,
((pPci->domain << 8)
| pPci->bus),
pPci->dev,
@ -301,7 +412,7 @@ probe_devices_from_device_sections(DriverPtr drvp)
ErrorF("%s: card at %d:%d:%d is claimed by a Device section\n",
drvp->driverName, pPci->bus, pPci->dev, pPci->func);
#endif
/* Allocate an entry in the lists to be returned */
entry = xf86ClaimPciSlot(pPci, drvp, device_id,
devList[i], devList[i]->active);
@ -321,7 +432,7 @@ probe_devices_from_device_sections(DriverPtr drvp)
}
}
}
if (entry != -1) {
if ((*drvp->PciProbe)(drvp, entry, pPci,
devices[j].match_data)) {
@ -334,7 +445,7 @@ probe_devices_from_device_sections(DriverPtr drvp)
}
}
return foundScreen;
}
@ -360,7 +471,7 @@ add_matching_devices_to_configure_list(DriverPtr drvp)
&& ((devices[j].device_class_mask & pPci->device_class)
== devices[j].device_class) ) {
if (xf86CheckPciSlot(pPci)) {
GDevPtr pGDev =
GDevPtr pGDev =
xf86AddDeviceToConfigure(drvp->driverName, pPci, -1);
if (pGDev != NULL) {
/* After configure pass 1, chipID and chipRev are
@ -395,11 +506,11 @@ check_for_matching_devices(DriverPtr drvp)
for (j = 0; ! END_OF_MATCHES(devices[j]); j++) {
struct pci_device_iterator *iter;
struct pci_device *dev;
iter = pci_id_match_iterator_create(& devices[j]);
dev = pci_device_next(iter);
pci_iterator_destroy(iter);
if (dev != NULL) {
return TRUE;
}
@ -418,9 +529,9 @@ check_for_matching_devices(DriverPtr drvp)
* is found, it is called. If \c DriverRec::PciProbe or no devices can be
* successfully probed with it (e.g., only non-PCI devices are available),
* the driver's \c DriverRec::Probe function is called.
*
*
* \param drv Driver to probe
*
*
* \return
* If a device can be successfully probed by the driver, \c TRUE is
* returned. Otherwise, \c FALSE is returned.
@ -448,13 +559,14 @@ xf86CallDriverProbe( DriverPtr drv, Bool detect_only )
if ( ! foundScreen && (drv->Probe != NULL) ) {
xf86Msg( X_WARNING, "Falling back to old probe method for %s\n",
drv->driverName );
foundScreen = (*drv->Probe)( drv, (detect_only) ? PROBE_DETECT
foundScreen = (*drv->Probe)( drv, (detect_only) ? PROBE_DETECT
: PROBE_DEFAULT );
}
return foundScreen;
}
/*
* InitOutput --
* Initialize screenInfo for all actually accessible framebuffers.
@ -472,7 +584,8 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
MessageType pix24From = X_DEFAULT;
Bool pix24Fail = FALSE;
Bool autoconfig = FALSE;
GDevPtr configured_device;
xf86Initialising = TRUE;
if (serverGeneration == 1) {
@ -509,8 +622,7 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
}
}
if (!autoconfig)
PostConfigInit();
InstallSignalHandlers();
/* Initialise the loader */
LoaderInit();
@ -538,9 +650,12 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
xf86Msg(X_ERROR, "Auto configuration failed\n");
return;
}
PostConfigInit();
}
#ifdef XF86PM
xf86OSPMClose = xf86OSPMOpen();
#endif
/* Initialise the resource broker */
xf86ResourceBrokerInit();
@ -555,7 +670,7 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
/* If there aren't any specified in the config file, autoconfig them */
/* FIXME: Does not handle multiple active screen sections, but I'm not
* sure if we really want to handle that case*/
GDevPtr configured_device = xf86ConfigLayout.screens->screen->device;
configured_device = xf86ConfigLayout.screens->screen->device;
if ((!configured_device) || (!configured_device->driver)) {
if (!autoConfigDevice(configured_device)) {
xf86Msg(X_ERROR, "Automatic driver configuration failed\n");
@ -645,7 +760,7 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
|| !xf86DriverList[i]->driverFunc(NULL,
GET_REQUIRED_HW_INTERFACES,
&flags)
|| NEED_IO_ENABLED(flags))
|| NEED_IO_ENABLED(flags))
continue;
}
@ -681,7 +796,7 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
layout++) {
Bool found = FALSE;
for (j = 0; j < xf86Screens[i]->numEntities; j++) {
GDevPtr dev =
xf86GetDevFromEntity(xf86Screens[i]->entityList[j],
xf86Screens[i]->entityInstanceList[j]);
@ -739,7 +854,7 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
* Call the driver's PreInit()'s to complete initialisation for the first
* generation.
*/
for (i = 0; i < xf86NumScreens; i++) {
xf86EnableAccess(xf86Screens[i]);
if (xf86Screens[i]->PreInit &&
@ -749,7 +864,7 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
for (i = 0; i < xf86NumScreens; i++)
if (!xf86Screens[i]->configured)
xf86DeleteScreen(i--, 0);
/*
* If no screens left, return now.
*/
@ -910,12 +1025,12 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
FatalError("Unable to make VT property - out of memory. Exiting...\n");
}
*VT = xf86Info.vtno;
VTAtom = MakeAtom(VT_ATOM_NAME, sizeof(VT_ATOM_NAME) - 1, TRUE);
for (i = 0, ret = Success; i < xf86NumScreens && ret == Success; i++) {
ret = xf86RegisterRootWindowProperty(xf86Screens[i]->scrnIndex,
VTAtom, XA_INTEGER, 32,
VTAtom, XA_INTEGER, 32,
1, VT );
if (ret != Success)
xf86DrvMsg(xf86Screens[i]->scrnIndex, X_WARNING,
@ -932,14 +1047,11 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
}
}
#ifdef XKB
xf86InitXkb();
#endif
/* set up the proper access funcs */
xf86PostPreInit();
AddCallback(&ServerGrabCallback, xf86GrabServerCallback, NULL);
} else {
/*
* serverGeneration != 1; some OSs have to do things here, too.
@ -963,34 +1075,6 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
xf86EnableIO();
}
#if 0
/*
* Install signal handler for unexpected signals
*/
xf86Info.caughtSignal=FALSE;
if (!xf86Info.notrapSignals)
{
signal(SIGSEGV,xf86SigHandler);
signal(SIGILL,xf86SigHandler);
#ifdef SIGEMT
signal(SIGEMT,xf86SigHandler);
#endif
signal(SIGFPE,xf86SigHandler);
#ifdef SIGBUS
signal(SIGBUS,xf86SigHandler);
#endif
#ifdef SIGSYS
signal(SIGSYS,xf86SigHandler);
#endif
#ifdef SIGXCPU
signal(SIGXCPU,xf86SigHandler);
#endif
#ifdef SIGXFSZ
signal(SIGXFSZ,xf86SigHandler);
#endif
}
#endif
/*
* Use the previously collected parts to setup pScreenInfo
*/
@ -1004,7 +1088,7 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
pScreenInfo->formats[i] = formats[i];
/* Make sure the server's VT is active */
if (serverGeneration != 1) {
xf86Resetting = TRUE;
/* All screens are in the same state, so just check the first */
@ -1014,7 +1098,7 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
#endif
xf86AccessEnter();
xf86EnterServerState(SETUP);
}
}
}
#ifdef SCO325
else {
@ -1031,8 +1115,8 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
}
#endif /* SCO325 */
for (i = 0; i < xf86NumScreens; i++) {
xf86EnableAccess(xf86Screens[i]);
for (i = 0; i < xf86NumScreens; i++) {
xf86EnableAccess(xf86Screens[i]);
/*
* Almost everything uses these defaults, and many of those that
* don't, will wrap them.
@ -1040,7 +1124,7 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
xf86Screens[i]->EnableDisableFBAccess = xf86EnableDisableFBAccess;
xf86Screens[i]->SetDGAMode = xf86SetDGAMode;
xf86Screens[i]->DPMSSet = NULL;
xf86Screens[i]->LoadPalette = NULL;
xf86Screens[i]->LoadPalette = NULL;
xf86Screens[i]->SetOverscan = NULL;
xf86Screens[i]->DriverFunc = NULL;
xf86Screens[i]->pScreen = NULL;
@ -1075,7 +1159,7 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
#ifdef RENDER
if (PictureGetSubpixelOrder (xf86Screens[i]->pScreen) == SubPixelUnknown)
{
xf86MonPtr DDC = (xf86MonPtr)(xf86Screens[i]->monitor->DDC);
xf86MonPtr DDC = (xf86MonPtr)(xf86Screens[i]->monitor->DDC);
PictureSetSubpixelOrder (xf86Screens[i]->pScreen,
DDC ?
(DDC->features.input_type ?
@ -1109,8 +1193,8 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
void
InitInput(argc, argv)
int argc;
char **argv;
int argc;
char **argv;
{
IDevPtr* pDev;
InputDriverPtr pDrv;
@ -1160,16 +1244,12 @@ InitInput(argc, argv)
mieqInit();
}
#ifndef SET_STDERR_NONBLOCKING
#define SET_STDERR_NONBLOCKING 1
#endif
/*
* OsVendorInit --
* OS/Vendor-specific initialisations. Called from OsInit(), which
* is called by dix before establishing the well known sockets.
*/
void
OsVendorInit()
{
@ -1178,12 +1258,10 @@ OsVendorInit()
#ifdef SIGCHLD
signal(SIGCHLD, SIG_DFL); /* Need to wait for child processes */
#endif
OsDelayInitColors = TRUE;
if (!beenHere)
xf86LogInit();
#if SET_STDERR_NONBLOCKING
/* Set stderr to non-blocking. */
#ifndef O_NONBLOCK
#if defined(FNDELAY)
@ -1191,7 +1269,6 @@ OsVendorInit()
#elif defined(O_NDELAY)
#define O_NONBLOCK O_NDELAY
#endif
#endif
#ifdef O_NONBLOCK
if (!beenHere) {
@ -1241,9 +1318,6 @@ ddxGiveUp()
xf86Screens[i]->busAccess = NULL;
}
#ifdef USE_XF86_SERVERLOCK
xf86UnlockServer();
#endif
#ifdef XFreeXDGA
DGAShutdown();
#endif
@ -1292,9 +1366,9 @@ AbortDDX()
(xf86Screens[i]->LeaveVT)(i, 0);
}
}
xf86AccessLeave();
/*
* This is needed for an abnormal server exit, since the normal exit stuff
* MUST also be performed (i.e. the vt must be left in a defined state)
@ -1338,6 +1412,18 @@ xf86SetLogVerbosity(int verb)
return save;
}
static void
xf86PrintDefaultModulePath(void)
{
ErrorF("%s\n", DEFAULT_MODULE_PATH);
}
static void
xf86PrintDefaultLibraryPath(void)
{
ErrorF("%s\n", DEFAULT_LIBRARY_PATH);
}
/*
* ddxProcessArgument --
* Process device-dependent command line args. Returns 0 if argument is
@ -1346,8 +1432,6 @@ xf86SetLogVerbosity(int verb)
*
*/
/* ARGSUSED */
int
ddxProcessArgument(int argc, char **argv, int i)
@ -1363,7 +1447,7 @@ ddxProcessArgument(int argc, char **argv, int i)
UseMsg(); \
FatalError("Required argument to %s not specified\n", argv[i]); \
}
/* First the options that are only allowed for root */
if (getuid() == 0 || geteuid() != 0)
{
@ -1433,18 +1517,6 @@ ddxProcessArgument(int argc, char **argv, int i)
xf86VidModeAllowNonLocal = TRUE;
return 1;
}
#endif
#ifdef XF86MISC
if (!strcmp(argv[i],"-disableModInDev"))
{
xf86MiscModInDevDisabled = TRUE;
return 1;
}
if (!strcmp(argv[i],"-allowNonLocalModInDev"))
{
xf86MiscModInDevAllowNonLocal = TRUE;
return 1;
}
#endif
if (!strcmp(argv[i],"-allowMouseOpenFail"))
{
@ -1600,11 +1672,11 @@ ddxProcessArgument(int argc, char **argv, int i)
return 0;
}
}
if (!strcmp(argv[i], "-gamma") || !strcmp(argv[i], "-rgamma") ||
if (!strcmp(argv[i], "-gamma") || !strcmp(argv[i], "-rgamma") ||
!strcmp(argv[i], "-ggamma") || !strcmp(argv[i], "-bgamma"))
{
double gamma;
CHECK_FOR_REQUIRED_ARGUMENT();
CHECK_FOR_REQUIRED_ARGUMENT();
if (sscanf(argv[++i], "%lf", &gamma) == 1) {
if (gamma < GAMMA_MIN || gamma > GAMMA_MAX) {
ErrorF("gamma out of range, only %.2f <= gamma_value <= %.1f"
@ -1639,7 +1711,7 @@ ddxProcessArgument(int argc, char **argv, int i)
}
if (!strcmp(argv[i], "-keyboard"))
{
CHECK_FOR_REQUIRED_ARGUMENT();
CHECK_FOR_REQUIRED_ARGUMENT();
xf86KeyboardName = argv[++i];
return 2;
}
@ -1734,12 +1806,7 @@ ddxUseMsg()
ErrorF("-disableVidMode disable mode adjustments with xvidtune\n");
ErrorF("-allowNonLocalXvidtune allow xvidtune to be run as a non-local client\n");
#endif
#ifdef XF86MISC
ErrorF("-disableModInDev disable dynamic modification of input device settings\n");
ErrorF("-allowNonLocalModInDev allow changes to keyboard and mouse settings\n");
ErrorF(" from non-local clients\n");
ErrorF("-allowMouseOpenFail start server even if the mouse can't be initialized\n");
#endif
ErrorF("-bestRefresh choose modes with the best refresh rate\n");
ErrorF("-ignoreABI make module ABI mismatches non-fatal\n");
ErrorF("-isolateDevice bus_id restrict device resets to bus_id (PCI only)\n");
@ -1752,145 +1819,9 @@ ddxUseMsg()
}
#ifndef OSNAME
#define OSNAME " unknown"
#endif
#ifndef OSVENDOR
#define OSVENDOR ""
#endif
#ifndef PRE_RELEASE
#define PRE_RELEASE XORG_VERSION_SNAP
#endif
static void
xf86PrintBanner()
{
#if PRE_RELEASE
ErrorF("\n"
"This is a pre-release version of the X server from " XVENDORNAME ".\n"
"It is not supported in any way.\n"
"Bugs may be filed in the bugzilla at http://bugs.freedesktop.org/.\n"
"Select the \"xorg\" product for bugs you find in this release.\n"
"Before reporting bugs in pre-release versions please check the\n"
"latest version in the X.Org Foundation git repository.\n"
"See http://wiki.x.org/wiki/GitPage for git access instructions.\n");
#endif
ErrorF("\nX.Org X Server %d.%d.%d",
XORG_VERSION_MAJOR,
XORG_VERSION_MINOR,
XORG_VERSION_PATCH);
#if XORG_VERSION_SNAP > 0
ErrorF(".%d", XORG_VERSION_SNAP);
#endif
#if XORG_VERSION_SNAP >= 900
/* When the minor number is 99, that signifies that the we are making
* a release candidate for a major version. (X.0.0)
* When the patch number is 99, that signifies that the we are making
* a release candidate for a minor version. (X.Y.0)
* When the patch number is < 99, then we are making a release
* candidate for the next point release. (X.Y.Z)
*/
#if XORG_VERSION_MINOR >= 99
ErrorF(" (%d.0.0 RC %d)", XORG_VERSION_MAJOR+1, XORG_VERSION_SNAP - 900);
#elif XORG_VERSION_PATCH == 99
ErrorF(" (%d.%d.0 RC %d)", XORG_VERSION_MAJOR, XORG_VERSION_MINOR + 1,
XORG_VERSION_SNAP - 900);
#else
ErrorF(" (%d.%d.%d RC %d)", XORG_VERSION_MAJOR, XORG_VERSION_MINOR,
XORG_VERSION_PATCH + 1, XORG_VERSION_SNAP - 900);
#endif
#endif
#ifdef XORG_CUSTOM_VERSION
ErrorF(" (%s)", XORG_CUSTOM_VERSION);
#endif
#ifndef XORG_DATE
#define XORG_DATE XF86_DATE
#endif
ErrorF("\nRelease Date: %s\n", XORG_DATE);
ErrorF("X Protocol Version %d, Revision %d\n",
X_PROTOCOL, X_PROTOCOL_REVISION);
ErrorF("Build Operating System: %s %s\n", OSNAME, OSVENDOR);
#ifdef HAS_UTSNAME
{
struct utsname name;
/* Linux & BSD state that 0 is success, SysV (including Solaris, HP-UX,
and Irix) and Single Unix Spec 3 just say that non-negative is success.
All agree that failure is represented by a negative number.
*/
if (uname(&name) >= 0) {
ErrorF("Current Operating System: %s %s %s %s %s\n",
name.sysname, name.nodename, name.release, name.version, name.machine);
}
}
#endif
#if defined(BUILD_DATE) && (BUILD_DATE > 19000000)
{
struct tm t;
char buf[100];
bzero(&t, sizeof(t));
bzero(buf, sizeof(buf));
t.tm_mday = BUILD_DATE % 100;
t.tm_mon = (BUILD_DATE / 100) % 100 - 1;
t.tm_year = BUILD_DATE / 10000 - 1900;
#if defined(BUILD_TIME)
t.tm_sec = BUILD_TIME % 100;
t.tm_min = (BUILD_TIME / 100) % 100;
t.tm_hour = (BUILD_TIME / 10000) % 100;
if (strftime(buf, sizeof(buf), "%d %B %Y %I:%M:%S%p", &t))
ErrorF("Build Date: %s\n", buf);
#else
if (strftime(buf, sizeof(buf), "%d %B %Y", &t))
ErrorF("Build Date: %s\n", buf);
#endif
}
#endif
#if defined(CLOG_DATE) && (CLOG_DATE > 19000000)
{
struct tm t;
char buf[100];
bzero(&t, sizeof(t));
bzero(buf, sizeof(buf));
t.tm_mday = CLOG_DATE % 100;
t.tm_mon = (CLOG_DATE / 100) % 100 - 1;
t.tm_year = CLOG_DATE / 10000 - 1900;
if (strftime(buf, sizeof(buf), "%d %B %Y", &t))
ErrorF("Changelog Date: %s\n", buf);
}
#endif
#if defined(BUILDERSTRING)
ErrorF("%s \n",BUILDERSTRING);
#endif
ErrorF("\tBefore reporting problems, check "__VENDORDWEBSUPPORT__"\n"
"\tto make sure that you have the latest version.\n");
ErrorF("Module Loader present\n");
}
static void
xf86PrintMarkers()
{
LogPrintMarkers();
}
static void
xf86PrintDefaultModulePath(void)
{
ErrorF("%s\n", DEFAULT_MODULE_PATH);
}
static void
xf86PrintDefaultLibraryPath(void)
{
ErrorF("%s\n", DEFAULT_LIBRARY_PATH);
}
/*
* xf86LoadModules iterates over a list that is being passed in.
*/
*/
Bool
xf86LoadModules(char **list, pointer *optlist)
{
@ -1961,7 +1892,7 @@ xf86GetPixFormat(ScrnInfoPtr pScrn, int depth)
return &format;
}
}
for (i = 0; i < numFormats; i++)
if (formats[i].depth == depth)
break;
@ -1983,11 +1914,10 @@ xf86GetBppFromDepth(ScrnInfoPtr pScrn, int depth)
{
PixmapFormatPtr format;
format = xf86GetPixFormat(pScrn, depth);
if (format)
return format->bitsPerPixel;
else
return 0;
}

View file

@ -1,557 +0,0 @@
/*
* Copyright (c) 1999-2003 by The XFree86 Project, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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 copyright holder(s)
* and author(s) 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 copyright holder(s) and author(s).
*/
/*
* This file contains the Pointer/Keyboard functions needed by the
* XFree86-Misc extension.
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include <X11/X.h>
#include "os.h"
#include "xf86.h"
#include "xf86Priv.h"
#ifdef XF86MISC
#define _XF86MISC_SERVER_
#include <X11/extensions/xf86misc.h>
#include "xf86miscproc.h"
#endif
#define XF86_OS_PRIVS
#include "xf86_OSlib.h"
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "xf86Xinput.h"
#include "xf86OSmouse.h"
#ifdef DEBUG
# define DEBUG_P(x) ErrorF(x"\n");
#else
# define DEBUG_P(x) /**/
#endif
#ifdef XF86MISC
typedef struct {
int type;
int baudrate;
int samplerate;
int resolution;
int buttons;
Bool em3buttons;
int em3timeout;
Bool chordmiddle;
int flags;
char* device;
pointer private;
} mseParamsRec, *mseParamsPtr;
typedef struct {
int type;
int rate;
int delay;
int serverNumLock; /* obsolete */
pointer private;
} kbdParamsRec, *kbdParamsPtr;
/*
Sigh...
The extension should probably be changed to use protocol
names instead of ID numbers
*/
static struct mouse_map {
int mtype;
MouseProtocolID proto;
} m_map[] =
{
{ MTYPE_MICROSOFT, PROT_MS },
{ MTYPE_MOUSESYS, PROT_MSC },
{ MTYPE_MMSERIES, PROT_MM },
{ MTYPE_LOGITECH, PROT_LOGI },
{ MTYPE_LOGIMAN, PROT_LOGIMAN },
{ MTYPE_MMHIT, PROT_MMHIT },
{ MTYPE_GLIDEPOINT, PROT_GLIDE },
{ MTYPE_IMSERIAL, PROT_IMSERIAL },
{ MTYPE_THINKING, PROT_THINKING },
{ MTYPE_ACECAD, PROT_ACECAD },
{ MTYPE_PS_2, PROT_PS2 },
{ MTYPE_IMPS2, PROT_IMPS2 },
{ MTYPE_EXPPS2, PROT_EXPPS2 },
{ MTYPE_THINKINGPS2, PROT_THINKPS2 },
{ MTYPE_MMANPLUSPS2, PROT_MMPS2 },
{ MTYPE_GLIDEPOINTPS2, PROT_GLIDEPS2 },
{ MTYPE_NETPS2, PROT_NETPS2 },
{ MTYPE_NETSCROLLPS2, PROT_NETSCPS2 },
{ MTYPE_BUSMOUSE, PROT_BM },
{ MTYPE_AUTOMOUSE, PROT_AUTO },
{ MTYPE_SYSMOUSE, PROT_SYSMOUSE },
{ MTYPE_UNKNOWN, PROT_UNKNOWN }
};
static int
MapMseProtoToMisc(MouseProtocolID proto)
{
int i;
for (i = 0; m_map[i].proto != PROT_UNKNOWN; i++)
if (proto == m_map[i].proto)
return m_map[i].mtype;
return MTYPE_UNKNOWN;
}
static MouseProtocolID
MapMseMiscToProto(int proto)
{
int i;
for (i = 0; m_map[i].mtype != MTYPE_UNKNOWN; i++)
if (proto == m_map[i].mtype)
return m_map[i].proto;
return PROT_UNKNOWN;
}
_X_EXPORT Bool
MiscExtGetMouseSettings(pointer *mouse, char **devname)
{
mseParamsPtr mseptr;
mseptr = MiscExtCreateStruct(MISC_POINTER);
if (!mseptr)
return FALSE;
{
InputInfoPtr pInfo = mseptr->private;
MouseDevPtr pMse;
*devname = xf86FindOptionValue(pInfo->options, "Device");
pMse = pInfo->private;
mseptr->type = MapMseProtoToMisc(pMse->protocolID);
mseptr->baudrate = pMse->baudRate;
mseptr->samplerate = pMse->sampleRate;
mseptr->resolution = pMse->resolution;
mseptr->buttons = pMse->buttons;
mseptr->em3buttons = pMse->emulate3Buttons;
mseptr->em3timeout = pMse->emulate3Timeout;
mseptr->chordmiddle = pMse->chordMiddle;
mseptr->flags = pMse->mouseFlags;
}
*mouse = mseptr;
return TRUE;
}
_X_EXPORT int
MiscExtGetMouseValue(pointer mouse, MiscExtMseValType valtype)
{
mseParamsPtr mse = mouse;
switch (valtype) {
case MISC_MSE_PROTO: return mse->type;
case MISC_MSE_BAUDRATE: return mse->baudrate;
case MISC_MSE_SAMPLERATE: return mse->samplerate;
case MISC_MSE_RESOLUTION: return mse->resolution;
case MISC_MSE_BUTTONS: return mse->buttons;
case MISC_MSE_EM3BUTTONS: return mse->em3buttons;
case MISC_MSE_EM3TIMEOUT: return mse->em3timeout;
case MISC_MSE_CHORDMIDDLE: return mse->chordmiddle;
case MISC_MSE_FLAGS: return mse->flags;
}
return 0;
}
_X_EXPORT Bool
MiscExtSetMouseValue(pointer mouse, MiscExtMseValType valtype, int value)
{
mseParamsPtr mse = mouse;
switch (valtype) {
case MISC_MSE_PROTO:
mse->type = value;
return TRUE;
case MISC_MSE_BAUDRATE:
mse->baudrate = value;
return TRUE;
case MISC_MSE_SAMPLERATE:
mse->samplerate = value;
return TRUE;
case MISC_MSE_RESOLUTION:
mse->resolution = value;
return TRUE;
case MISC_MSE_BUTTONS:
mse->buttons = value;
return TRUE;
case MISC_MSE_EM3BUTTONS:
mse->em3buttons = value;
return TRUE;
case MISC_MSE_EM3TIMEOUT:
mse->em3timeout = value;
return TRUE;
case MISC_MSE_CHORDMIDDLE:
mse->chordmiddle = value;
return TRUE;
case MISC_MSE_FLAGS:
mse->flags = value;
return TRUE;
}
return FALSE;
}
_X_EXPORT Bool
MiscExtSetMouseDevice(pointer mouse, char* device)
{
mseParamsPtr mse = mouse;
mse->device = device;
return TRUE;
}
_X_EXPORT Bool
MiscExtGetKbdSettings(pointer *kbd)
{
return FALSE;
}
_X_EXPORT int
MiscExtGetKbdValue(pointer keyboard, MiscExtKbdValType valtype)
{
return 0;
}
_X_EXPORT Bool
MiscExtSetKbdValue(pointer keyboard, MiscExtKbdValType valtype, int value)
{
return FALSE;
}
static void
MiscExtClientStateCallback(CallbackListPtr *callbacks,
pointer data, pointer args)
{
NewClientInfoRec *clientinfo = (NewClientInfoRec*)args;
if (clientinfo->client == xf86Info.grabInfo.override &&
clientinfo->client->clientState == ClientStateGone) {
xf86Info.grabInfo.override = NULL;
xf86Info.grabInfo.disabled = 0;
DeleteCallback(&ClientStateCallback, MiscExtClientStateCallback, NULL);
}
}
#define MiscExtGrabStateSuccess 0 /* No errors */
#define MiscExtGrabStateLocked 1 /* A client already requested that
* grabs cannot be removed/killed */
#define MiscExtGrabStateAlready 2 /* Request for enabling/disabling
* grab removeal/kill already done */
_X_EXPORT int
MiscExtSetGrabKeysState(ClientPtr client, int state)
{
if (xf86Info.grabInfo.override == NULL ||
xf86Info.grabInfo.override == client) {
if (state == 0 && xf86Info.grabInfo.disabled == 0) {
xf86Info.grabInfo.disabled = 1;
AddCallback(&ClientStateCallback,
MiscExtClientStateCallback, NULL);
xf86Info.grabInfo.override = client;
}
else if (state == 1 && xf86Info.grabInfo.disabled == 1) {
xf86Info.grabInfo.disabled = 0;
DeleteCallback(&ClientStateCallback,
MiscExtClientStateCallback, NULL);
xf86Info.grabInfo.override = NULL;
}
else
return MiscExtGrabStateAlready;
return MiscExtGrabStateSuccess;
}
return MiscExtGrabStateLocked;
}
_X_EXPORT pointer
MiscExtCreateStruct(MiscExtStructType mse_or_kbd)
{
switch (mse_or_kbd) {
case MISC_POINTER:
{
mseParamsPtr mseptr;
InputInfoPtr pInfo = xf86InputDevs;
while (pInfo) {
if (pInfo->dev == inputInfo.pointer)
break;
pInfo = pInfo->next;
}
if (!pInfo)
return NULL;
mseptr = xcalloc(sizeof(mseParamsRec),1);
if (mseptr)
mseptr->private = pInfo;
return mseptr;
}
case MISC_KEYBOARD:
return xcalloc(sizeof(kbdParamsRec),1);
}
return 0;
}
_X_EXPORT void
MiscExtDestroyStruct(pointer structure, MiscExtStructType mse_or_kbd)
{
switch (mse_or_kbd) {
case MISC_POINTER:
case MISC_KEYBOARD:
xfree(structure);
}
}
static Bool
MiscExtAuthorizeDevice(InputInfoPtr pInfo, char *device)
{
Bool authorized = FALSE;
char *elem;
struct stat dev, dev_list;
const char *olddev = xf86FindOptionValue(pInfo->options, "Device");
if (stat(device,&dev))
return FALSE;
if (!S_ISCHR(dev.st_mode))
return FALSE;
if (!stat(olddev,&dev_list)) {
if (dev_list.st_dev == dev.st_dev
&& dev_list.st_ino == dev.st_ino) {
authorized = TRUE;
}
}
if (!authorized) {
char *path;
if (!xf86InputDeviceList
|| (path = strdup(xf86InputDeviceList)) == NULL)
return FALSE;
elem = strtok(path,",");
while (elem) {
if (!stat(elem,&dev_list)) {
if (dev_list.st_dev == dev.st_dev
&& dev_list.st_ino == dev.st_ino) {
authorized = TRUE;
break;
}
}
elem = strtok(NULL,",");
}
xfree(path);
}
#if 0
ErrorF("AUTHORIZED: %s\n",authorized?"Yes":"No");
#endif
return (authorized);
}
_X_EXPORT MiscExtReturn
MiscExtApply(pointer structure, MiscExtStructType mse_or_kbd)
{
if (mse_or_kbd == MISC_POINTER) {
Bool protoChanged = FALSE;
int oldflags;
Bool reopen = FALSE;
MouseProtocolID newProtocol;
mseParamsPtr mse = structure;
InputInfoPtr pInfo;
MouseDevPtr pMse;
pointer xf86MouseProtocolIDToName
= LoaderSymbol("xf86MouseProtocolIDToName");
if (!xf86MouseProtocolIDToName)
return MISC_RET_NOMODULE;
if (mse->type < MTYPE_MICROSOFT
|| (mse->type > MTYPE_EXPPS2
&& (mse->type != MTYPE_OSMOUSE)))
return MISC_RET_BADMSEPROTO;
#ifdef OSMOUSE_ONLY
if (mse->type != MTYPE_OSMOUSE)
return MISC_RET_BADMSEPROTO;
#else
if (mse->type == MTYPE_OSMOUSE)
return MISC_RET_BADMSEPROTO;
#endif /* OSMOUSE_ONLY */
if (mse->em3timeout < 0)
return MISC_RET_BADVAL;
if (mse->type == MTYPE_LOGIMAN
&& !(mse->baudrate == 0
|| mse->baudrate == 1200
|| mse->baudrate == 9600))
return MISC_RET_BADBAUDRATE;
if (mse->type == MTYPE_LOGIMAN && mse->samplerate)
return MISC_RET_BADCOMBO;
if (mse->flags & MF_REOPEN) {
reopen = TRUE;
mse->flags &= ~MF_REOPEN;
}
if (mse->type != MTYPE_OSMOUSE
&& mse->type != MTYPE_PS_2
&& mse->type != MTYPE_BUSMOUSE
&& mse->type != MTYPE_IMPS2
&& mse->type != MTYPE_THINKINGPS2
&& mse->type != MTYPE_MMANPLUSPS2
&& mse->type != MTYPE_GLIDEPOINTPS2
&& mse->type != MTYPE_NETPS2
&& mse->type != MTYPE_NETSCROLLPS2
&& mse->type != MTYPE_SYSMOUSE)
{
if (mse->baudrate % 1200 != 0
|| (mse->baudrate != 0 && mse->baudrate < 1200)
|| mse->baudrate > 9600)
return MISC_RET_BADBAUDRATE;
}
if ((mse->flags & (MF_CLEAR_DTR|MF_CLEAR_RTS))
&& (mse->type != MTYPE_MOUSESYS))
return MISC_RET_BADFLAGS;
if (mse->type != MTYPE_OSMOUSE
&& mse->type != MTYPE_BUSMOUSE)
{
if (mse->samplerate < 0)
return MISC_RET_BADVAL;
}
if (mse->resolution < 0)
return MISC_RET_BADVAL;
if (mse->chordmiddle)
{
if (mse->em3buttons || !(mse->type == MTYPE_MICROSOFT
|| mse->type == MTYPE_LOGIMAN) )
return MISC_RET_BADCOMBO;
}
/* XXX - This still needs work */
pInfo = mse->private;
pMse = pInfo->private;
oldflags = pMse->mouseFlags;
newProtocol = MapMseMiscToProto(mse->type);
protoChanged = pMse->protocolID != newProtocol;
if (protoChanged
|| pMse->baudRate != mse->baudrate
|| pMse->sampleRate != mse->samplerate
|| pMse->resolution != mse->resolution
|| pMse->mouseFlags != mse->flags)
reopen = TRUE;
if (mse->device)
reopen = TRUE;
if (reopen)
(pMse->device->deviceProc)(pMse->device, DEVICE_CLOSE);
pMse->protocolID = newProtocol;
pMse->baudRate = mse->baudrate;
pMse->sampleRate = mse->samplerate;
pMse->resolution = mse->resolution;
pMse->buttons = mse->buttons;
pMse->emulate3Buttons = mse->em3buttons;
pMse->emulate3Timeout = mse->em3timeout;
pMse->chordMiddle = mse->chordmiddle;
pMse->mouseFlags = mse->flags;
pMse->protocol = ((const char *(*)(MouseProtocolID))
xf86MouseProtocolIDToName)(pMse->protocolID);
if (mse->device) {
if (MiscExtAuthorizeDevice(pInfo, mse->device)) {
xf86ReplaceStrOption(pInfo->options, "Device", mse->device);
} else {
return MISC_RET_BADVAL;
}
}
if (reopen) {
/* Only if protocol is changed explicitely disable auto detect */
if (protoChanged)
pMse->autoProbe = FALSE;
(pMse->device->deviceProc)(pMse->device, DEVICE_ON);
}
/* Set pInfo->options too */
if ((oldflags & MF_CLEAR_DTR) != (pMse->mouseFlags & MF_CLEAR_DTR))
xf86ReplaceBoolOption(pInfo->options, "ClearDTR",
pMse->mouseFlags | MF_CLEAR_DTR);
if ((oldflags & MF_CLEAR_RTS) != (pMse->mouseFlags & MF_CLEAR_RTS))
xf86ReplaceBoolOption(pInfo->options, "ClearRTS",
pMse->mouseFlags | MF_CLEAR_RTS);
}
return MISC_RET_BADVAL;
}
_X_EXPORT Bool
MiscExtGetFilePaths(const char **configfile, const char **modulepath,
const char **logfile)
{
*configfile = xf86ConfigFile;
*modulepath = xf86ModulePath;
*logfile = xf86LogFile;
return TRUE;
}
_X_EXPORT int
MiscExtPassMessage(int scrnIndex, const char *msgtype, const char *msgval,
char **retstr)
{
ScrnInfoPtr pScr = xf86Screens[scrnIndex];
/* should check this in the protocol, but xf86NumScreens isn't exported */
if (scrnIndex >= xf86NumScreens)
return BadValue;
if (*pScr->HandleMessage == NULL)
return BadImplementation;
return (*pScr->HandleMessage)(scrnIndex, msgtype, msgval, retstr);
}
#endif /* XF86MISC */

View file

@ -82,11 +82,11 @@ typedef enum {
* changed. The minor revision mask is 0x0000FFFF and the major revision
* mask is 0xFFFF0000.
*/
#define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 3)
#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(4, 0)
#define ABI_XINPUT_VERSION SET_ABI_VERSION(3, 0)
#define ABI_EXTENSION_VERSION SET_ABI_VERSION(1, 0)
#define ABI_FONT_VERSION SET_ABI_VERSION(0, 5)
#define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 4)
#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(4, 1)
#define ABI_XINPUT_VERSION SET_ABI_VERSION(3, 1)
#define ABI_EXTENSION_VERSION SET_ABI_VERSION(1, 1)
#define ABI_FONT_VERSION SET_ABI_VERSION(0, 6)
#define MODINFOSTRING1 0xef23fdc5
#define MODINFOSTRING2 0x10dc023a
@ -194,7 +194,6 @@ pointer LoadSubModuleLocal(pointer, const char *, const char **,
const char **, pointer, const XF86ModReqInfo *,
int *, int *);
void UnloadSubModule(pointer);
void LoadFont(pointer);
void UnloadModule (pointer);
#endif
pointer LoaderSymbol(const char *);
@ -209,6 +208,7 @@ void LoaderReqSymLists(const char **, ...);
void LoaderReqSymbols(const char *, ...);
int LoaderCheckUnresolved(int);
void LoaderGetOS(const char **name, int *major, int *minor, int *teeny);
Bool LoaderShouldIgnoreABI(void);
int LoaderGetABIVersion(const char *abiclass);
typedef pointer (*ModuleSetupProc)(pointer, pointer, int *, int *);

View file

@ -51,10 +51,6 @@ extern Bool xf86AllowMouseOpenFail;
extern Bool xf86VidModeDisabled;
extern Bool xf86VidModeAllowNonLocal;
#endif
#ifdef XF86MISC
extern Bool xf86MiscModInDevDisabled;
extern Bool xf86MiscModInDevAllowNonLocal;
#endif
extern Bool xf86fpFlag;
extern Bool xf86coFlag;
extern Bool xf86sFlag;
@ -163,8 +159,6 @@ void DoConfigure(void);
/* xf86Events.c */
void xf86PostKbdEvent(unsigned key);
void xf86PostMseEvent(DeviceIntPtr device, int buttons, int dx, int dy);
void xf86Wakeup(pointer blockData, int err, pointer pReadmask);
void xf86SigHandler(int signo);
void xf86HandlePMEvents(int fd, pointer data);
@ -182,16 +176,6 @@ int xf86SetVerbosity(int verb);
int xf86SetLogVerbosity(int verb);
Bool xf86CallDriverProbe( struct _DriverRec * drv, Bool detect_only );
/* xf86Lock.c */
#ifdef USE_XF86_SERVERLOCK
void xf86UnlockServer(void);
#endif
/* xf86XKB.c */
void xf86InitXkb(void);
/* xf86Xinput.c */
extern EventList *xf86Events;

Some files were not shown because too many files have changed in this diff Show more