mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2025-12-20 04:40:02 +01:00
Introduce a consistent coding style
This is strictly the application of the script 'x-indent-all.sh' from util/modular. Compared to the patch that Daniel posted in January, I've added a few indent flags: -bap -psl -T PrivatePtr -T pmWait -T _XFUNCPROTOBEGIN -T _XFUNCPROTOEND -T _X_EXPORT The typedefs were needed to make the output of sdksyms.sh match the previous output, otherwise, the code is formatted badly enough that sdksyms.sh generates incorrect output. The generated code was compared with the previous version and found to be essentially identical -- "assert" line numbers and BUILD_TIME were the only differences found. The comparison was done with this script: dir1=$1 dir2=$2 for dir in $dir1 $dir2; do (cd $dir && find . -name '*.o' | while read file; do dir=`dirname $file` base=`basename $file .o` dump=$dir/$base.dump objdump -d $file > $dump done) done find $dir1 -name '*.dump' | while read dump; do otherdump=`echo $dump | sed "s;$dir1;$dir2;"` diff -u $dump $otherdump done Signed-off-by: Keith Packard <keithp@keithp.com> Acked-by: Daniel Stone <daniel@fooishbar.org> Acked-by: Alan Coopersmith <alan.coopersmith@oracle.com>
This commit is contained in:
parent
75199129c6
commit
9838b7032e
1258 changed files with 257574 additions and 252857 deletions
15
Xext/dpms.c
15
Xext/dpms.c
|
|
@ -115,13 +115,11 @@ ProcDPMSSetTimeouts(ClientPtr client)
|
|||
|
||||
REQUEST_SIZE_MATCH(xDPMSSetTimeoutsReq);
|
||||
|
||||
if ((stuff->off != 0)&&(stuff->off < stuff->suspend))
|
||||
{
|
||||
if ((stuff->off != 0) && (stuff->off < stuff->suspend)) {
|
||||
client->errorValue = stuff->off;
|
||||
return BadValue;
|
||||
}
|
||||
if ((stuff->suspend != 0)&&(stuff->suspend < stuff->standby))
|
||||
{
|
||||
if ((stuff->suspend != 0) && (stuff->suspend < stuff->standby)) {
|
||||
client->errorValue = stuff->suspend;
|
||||
return BadValue;
|
||||
}
|
||||
|
|
@ -176,8 +174,7 @@ ProcDPMSForceLevel(ClientPtr client)
|
|||
|
||||
if (stuff->level != DPMSModeOn &&
|
||||
stuff->level != DPMSModeStandby &&
|
||||
stuff->level != DPMSModeSuspend &&
|
||||
stuff->level != DPMSModeOff) {
|
||||
stuff->level != DPMSModeSuspend && stuff->level != DPMSModeOff) {
|
||||
client->errorValue = stuff->level;
|
||||
return BadValue;
|
||||
}
|
||||
|
|
@ -214,8 +211,7 @@ ProcDPMSDispatch (ClientPtr client)
|
|||
{
|
||||
REQUEST(xReq);
|
||||
|
||||
switch (stuff->data)
|
||||
{
|
||||
switch (stuff->data) {
|
||||
case X_DPMSGetVersion:
|
||||
return ProcDPMSGetVersion(client);
|
||||
case X_DPMSCapable:
|
||||
|
|
@ -335,8 +331,7 @@ static int
|
|||
SProcDPMSDispatch(ClientPtr client)
|
||||
{
|
||||
REQUEST(xReq);
|
||||
switch (stuff->data)
|
||||
{
|
||||
switch (stuff->data) {
|
||||
case X_DPMSGetVersion:
|
||||
return SProcDPMSGetVersion(client);
|
||||
case X_DPMSCapable:
|
||||
|
|
|
|||
|
|
@ -34,12 +34,14 @@ Equipment Corporation.
|
|||
|
||||
#define FALSE 0
|
||||
|
||||
Bool DPMSSupported(void)
|
||||
Bool
|
||||
DPMSSupported(void)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int DPMSSet(ClientPtr client, int level)
|
||||
int
|
||||
DPMSSet(ClientPtr client, int level)
|
||||
{
|
||||
return Success;
|
||||
}
|
||||
|
|
|
|||
33
Xext/geext.c
33
Xext/geext.c
|
|
@ -60,6 +60,7 @@ ProcGEQueryVersion(ClientPtr client)
|
|||
{
|
||||
GEClientInfoPtr pGEClient = GEGetClient(client);
|
||||
xGEQueryVersionReply rep;
|
||||
|
||||
REQUEST(xGEQueryVersionReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xGEQueryVersionReq);
|
||||
|
|
@ -77,8 +78,7 @@ ProcGEQueryVersion(ClientPtr client)
|
|||
pGEClient->major_version = stuff->majorVersion;
|
||||
pGEClient->minor_version = stuff->minorVersion;
|
||||
|
||||
if (client->swapped)
|
||||
{
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber);
|
||||
swapl(&rep.length);
|
||||
swaps(&rep.majorVersion);
|
||||
|
|
@ -91,8 +91,7 @@ ProcGEQueryVersion(ClientPtr client)
|
|||
|
||||
int (*ProcGEVector[GENumberRequests]) (ClientPtr) = {
|
||||
/* Version 1.0 */
|
||||
ProcGEQueryVersion
|
||||
};
|
||||
ProcGEQueryVersion};
|
||||
|
||||
/************************************************************/
|
||||
/* swapped request handlers */
|
||||
|
|
@ -111,9 +110,7 @@ SProcGEQueryVersion(ClientPtr client)
|
|||
|
||||
int (*SProcGEVector[GENumberRequests]) (ClientPtr) = {
|
||||
/* Version 1.0 */
|
||||
SProcGEQueryVersion
|
||||
};
|
||||
|
||||
SProcGEQueryVersion};
|
||||
|
||||
/************************************************************/
|
||||
/* callbacks */
|
||||
|
|
@ -124,6 +121,7 @@ static int
|
|||
ProcGEDispatch(ClientPtr client)
|
||||
{
|
||||
GEClientInfoPtr pGEClient = GEGetClient(client);
|
||||
|
||||
REQUEST(xGEReq);
|
||||
|
||||
if (pGEClient->major_version >= NUM_VERSION_REQUESTS)
|
||||
|
|
@ -151,9 +149,7 @@ SProcGEDispatch(ClientPtr client)
|
|||
* used in the furture for versioning support.
|
||||
*/
|
||||
static void
|
||||
GEClientCallback(CallbackListPtr *list,
|
||||
pointer closure,
|
||||
pointer data)
|
||||
GEClientCallback(CallbackListPtr *list, pointer closure, pointer data)
|
||||
{
|
||||
NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
|
||||
ClientPtr pClient = clientinfo->client;
|
||||
|
|
@ -184,8 +180,7 @@ SGEGenericEvent(xEvent* from, xEvent* to)
|
|||
xGenericEvent *gefrom = (xGenericEvent *) from;
|
||||
xGenericEvent *geto = (xGenericEvent *) to;
|
||||
|
||||
if ((gefrom->extension & 0x7f) > MAXEXTENSIONS)
|
||||
{
|
||||
if ((gefrom->extension & 0x7f) > MAXEXTENSIONS) {
|
||||
ErrorF("GE: Invalid extension offset for event.\n");
|
||||
return;
|
||||
}
|
||||
|
|
@ -203,23 +198,23 @@ GEExtensionInit(void)
|
|||
{
|
||||
ExtensionEntry *extEntry;
|
||||
|
||||
if (!dixRegisterPrivateKey(&GEClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(GEClientInfoRec)))
|
||||
if (!dixRegisterPrivateKey
|
||||
(&GEClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(GEClientInfoRec)))
|
||||
FatalError("GEExtensionInit: GE private request failed.\n");
|
||||
|
||||
if(!AddCallback(&ClientStateCallback, GEClientCallback, 0))
|
||||
{
|
||||
if (!AddCallback(&ClientStateCallback, GEClientCallback, 0)) {
|
||||
FatalError("GEExtensionInit: register client callback failed.\n");
|
||||
}
|
||||
|
||||
if ((extEntry = AddExtension(GE_NAME,
|
||||
0, GENumberErrors,
|
||||
ProcGEDispatch, SProcGEDispatch,
|
||||
GEResetProc, StandardMinorOpcode)) != 0)
|
||||
{
|
||||
GEResetProc, StandardMinorOpcode)) != 0) {
|
||||
memset(GEExtensions, 0, sizeof(GEExtensions));
|
||||
|
||||
EventSwapVector[GenericEvent] = (EventSwapPtr) SGEGenericEvent;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
FatalError("GEInit: AddExtensions failed.\n");
|
||||
}
|
||||
|
||||
|
|
@ -247,7 +242,6 @@ GERegisterExtension(int extension,
|
|||
GEExtensions[EXT_MASK(extension)].evswap = ev_swap;
|
||||
}
|
||||
|
||||
|
||||
/* Sets type and extension field for a generic event. This is just an
|
||||
* auxiliary function, extensions could do it manually too.
|
||||
*/
|
||||
|
|
@ -258,4 +252,3 @@ GEInitEvent(xGenericEvent* ev, int extension)
|
|||
ev->extension = extension;
|
||||
ev->length = 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
10
Xext/geext.h
10
Xext/geext.h
|
|
@ -40,7 +40,6 @@ typedef struct _GEExtension {
|
|||
void (*evswap) (xGenericEvent *from, xGenericEvent *to);
|
||||
} GEExtension, *GEExtensionPtr;
|
||||
|
||||
|
||||
/* All registered extensions and their handling functions. */
|
||||
extern _X_EXPORT GEExtension GEExtensions[MAXEXTENSIONS];
|
||||
|
||||
|
|
@ -70,11 +69,12 @@ extern _X_EXPORT GEExtension GEExtensions[MAXEXTENSIONS];
|
|||
GEEXT(ev) == (ext) && \
|
||||
GEV(ev)->evtype == (ev_type))
|
||||
|
||||
|
||||
/* Interface for other extensions */
|
||||
extern _X_EXPORT void GERegisterExtension(
|
||||
int extension,
|
||||
void (*ev_dispatch)(xGenericEvent* from, xGenericEvent* to));
|
||||
extern _X_EXPORT void GERegisterExtension(int extension,
|
||||
void (*ev_dispatch) (xGenericEvent
|
||||
*from,
|
||||
xGenericEvent
|
||||
*to));
|
||||
|
||||
extern _X_EXPORT void GEInitEvent(xGenericEvent *ev, int extension);
|
||||
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@
|
|||
#include <X11/extensions/geproto.h>
|
||||
|
||||
extern _X_EXPORT DevPrivateKeyRec GEClientPrivateKeyRec;
|
||||
|
||||
#define GEClientPrivateKey (&GEClientPrivateKeyRec)
|
||||
|
||||
typedef struct _GEClientInfo {
|
||||
|
|
|
|||
120
Xext/panoramiX.c
120
Xext/panoramiX.c
|
|
@ -64,8 +64,7 @@ Equipment Corporation.
|
|||
|
||||
#ifdef GLXPROXY
|
||||
extern VisualPtr glxMatchVisual(ScreenPtr pScreen,
|
||||
VisualPtr pVisual,
|
||||
ScreenPtr pMatchScreen);
|
||||
VisualPtr pVisual, ScreenPtr pMatchScreen);
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -107,11 +106,14 @@ static void PanoramiXResetProc(ExtensionEntry*);
|
|||
|
||||
#include "panoramiXh.h"
|
||||
|
||||
int (* SavedProcVector[256]) (ClientPtr client) = { NULL, };
|
||||
int (*SavedProcVector[256]) (ClientPtr client) = {
|
||||
NULL,};
|
||||
|
||||
static DevPrivateKeyRec PanoramiXGCKeyRec;
|
||||
|
||||
#define PanoramiXGCKey (&PanoramiXGCKeyRec)
|
||||
static DevPrivateKeyRec PanoramiXScreenKeyRec;
|
||||
|
||||
#define PanoramiXScreenKey (&PanoramiXScreenKeyRec)
|
||||
|
||||
typedef struct {
|
||||
|
|
@ -147,7 +149,6 @@ static GCFuncs XineramaGCFuncs = {
|
|||
pGCPriv->wrapFuncs = (pGC)->funcs;\
|
||||
(pGC)->funcs = &XineramaGCFuncs;
|
||||
|
||||
|
||||
static Bool
|
||||
XineramaCloseScreen(int i, ScreenPtr pScreen)
|
||||
{
|
||||
|
|
@ -192,11 +193,8 @@ XineramaCreateGC(GCPtr pGC)
|
|||
}
|
||||
|
||||
static void
|
||||
XineramaValidateGC(
|
||||
GCPtr pGC,
|
||||
unsigned long changes,
|
||||
DrawablePtr pDraw
|
||||
){
|
||||
XineramaValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDraw)
|
||||
{
|
||||
Xinerama_GC_FUNC_PROLOGUE(pGC);
|
||||
|
||||
if ((pDraw->type == DRAWABLE_WINDOW) && !(((WindowPtr) pDraw)->parent)) {
|
||||
|
|
@ -225,7 +223,8 @@ XineramaValidateGC(
|
|||
pGC->patOrg.y = new_val;
|
||||
changes |= GCTileStipYOrigin;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if (pGC->clipOrg.x != pGCPriv->clipOrg.x) {
|
||||
pGC->clipOrg.x = pGCPriv->clipOrg.x;
|
||||
changes |= GCClipXOrigin;
|
||||
|
|
@ -257,10 +256,8 @@ XineramaDestroyGC(GCPtr pGC)
|
|||
}
|
||||
|
||||
static void
|
||||
XineramaChangeGC (
|
||||
GCPtr pGC,
|
||||
unsigned long mask
|
||||
){
|
||||
XineramaChangeGC(GCPtr pGC, unsigned long mask)
|
||||
{
|
||||
Xinerama_GC_FUNC_PROLOGUE(pGC);
|
||||
|
||||
if (mask & GCTileStipXOrigin)
|
||||
|
|
@ -277,13 +274,11 @@ XineramaChangeGC (
|
|||
}
|
||||
|
||||
static void
|
||||
XineramaCopyGC (
|
||||
GCPtr pGCSrc,
|
||||
unsigned long mask,
|
||||
GCPtr pGCDst
|
||||
){
|
||||
XineramaCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst)
|
||||
{
|
||||
PanoramiXGCPtr pSrcPriv = (PanoramiXGCPtr)
|
||||
dixLookupPrivate(&pGCSrc->devPrivates, PanoramiXGCKey);
|
||||
|
||||
Xinerama_GC_FUNC_PROLOGUE(pGCDst);
|
||||
|
||||
if (mask & GCTileStipXOrigin)
|
||||
|
|
@ -300,12 +295,8 @@ XineramaCopyGC (
|
|||
}
|
||||
|
||||
static void
|
||||
XineramaChangeClip (
|
||||
GCPtr pGC,
|
||||
int type,
|
||||
pointer pvalue,
|
||||
int nrects
|
||||
){
|
||||
XineramaChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects)
|
||||
{
|
||||
Xinerama_GC_FUNC_PROLOGUE(pGC);
|
||||
(*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects);
|
||||
Xinerama_GC_FUNC_EPILOGUE(pGC);
|
||||
|
|
@ -388,7 +379,8 @@ XineramaRegisterConnectionBlockCallback(void (*func)(void))
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static void XineramaInitData(void)
|
||||
static void
|
||||
XineramaInitData(void)
|
||||
{
|
||||
int i, w, h;
|
||||
|
||||
|
|
@ -411,10 +403,12 @@ static void XineramaInitData(void)
|
|||
}
|
||||
|
||||
PanoramiXPixWidth = screenInfo.screens[0]->x + screenInfo.screens[0]->width;
|
||||
PanoramiXPixHeight = screenInfo.screens[0]->y + screenInfo.screens[0]->height;
|
||||
PanoramiXPixHeight =
|
||||
screenInfo.screens[0]->y + screenInfo.screens[0]->height;
|
||||
|
||||
FOR_NSCREENS_FORWARD_SKIP(i) {
|
||||
ScreenPtr pScreen = screenInfo.screens[i];
|
||||
|
||||
w = pScreen->x + pScreen->width;
|
||||
h = pScreen->y + pScreen->height;
|
||||
|
||||
|
|
@ -425,7 +419,8 @@ static void XineramaInitData(void)
|
|||
}
|
||||
}
|
||||
|
||||
void XineramaReinitData(void)
|
||||
void
|
||||
XineramaReinitData(void)
|
||||
{
|
||||
RegionUninit(&PanoramiXScreenRegion);
|
||||
XineramaInitData();
|
||||
|
|
@ -438,7 +433,8 @@ void XineramaReinitData(void)
|
|||
* Initialize global variables.
|
||||
*/
|
||||
|
||||
void PanoramiXExtensionInit(int argc, char *argv[])
|
||||
void
|
||||
PanoramiXExtensionInit(int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
Bool success = FALSE;
|
||||
|
|
@ -454,7 +450,8 @@ void PanoramiXExtensionInit(int argc, char *argv[])
|
|||
return;
|
||||
}
|
||||
|
||||
if (!dixRegisterPrivateKey(&PanoramiXGCKeyRec, PRIVATE_GC, sizeof(PanoramiXGCRec))) {
|
||||
if (!dixRegisterPrivateKey
|
||||
(&PanoramiXGCKeyRec, PRIVATE_GC, sizeof(PanoramiXGCRec))) {
|
||||
noPanoramiXExtension = TRUE;
|
||||
return;
|
||||
}
|
||||
|
|
@ -504,8 +501,7 @@ void PanoramiXExtensionInit(int argc, char *argv[])
|
|||
"XineramaPixmap");
|
||||
if (XRT_PIXMAP)
|
||||
XRT_PIXMAP |= XRC_DRAWABLE;
|
||||
XRT_GC = CreateNewResourceType(XineramaDeleteResource,
|
||||
"XineramaGC");
|
||||
XRT_GC = CreateNewResourceType(XineramaDeleteResource, "XineramaGC");
|
||||
XRT_COLORMAP = CreateNewResourceType(XineramaDeleteResource,
|
||||
"XineramaColormap");
|
||||
|
||||
|
|
@ -598,7 +594,8 @@ void PanoramiXExtensionInit(int argc, char *argv[])
|
|||
|
||||
extern Bool CreateConnectionBlock(void);
|
||||
|
||||
Bool PanoramiXCreateConnectionBlock(void)
|
||||
Bool
|
||||
PanoramiXCreateConnectionBlock(void)
|
||||
{
|
||||
int i, j, length;
|
||||
Bool disableBackingStore = FALSE;
|
||||
|
|
@ -625,7 +622,8 @@ Bool PanoramiXCreateConnectionBlock(void)
|
|||
ErrorF("Xinerama error: Root window depths differ\n");
|
||||
return FALSE;
|
||||
}
|
||||
if(pScreen->backingStoreSupport != screenInfo.screens[0]->backingStoreSupport)
|
||||
if (pScreen->backingStoreSupport !=
|
||||
screenInfo.screens[0]->backingStoreSupport)
|
||||
disableBackingStore = TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -662,9 +660,7 @@ Bool PanoramiXCreateConnectionBlock(void)
|
|||
visual->visualID = PanoramiXDepths[i].vids[j];
|
||||
|
||||
for (pVisual = PanoramiXVisuals;
|
||||
pVisual->vid != visual->visualID;
|
||||
pVisual++)
|
||||
;
|
||||
pVisual->vid != visual->visualID; pVisual++);
|
||||
|
||||
visual->class = pVisual->class;
|
||||
visual->bitsPerRGB = pVisual->bitsPerRGBValue;
|
||||
|
|
@ -838,6 +834,7 @@ PanoramiXConsolidate(void)
|
|||
|
||||
FOR_NSCREENS(i) {
|
||||
ScreenPtr pScreen = screenInfo.screens[i];
|
||||
|
||||
root->info[i].id = pScreen->root->drawable.id;
|
||||
root->u.win.class = InputOutput;
|
||||
root->u.win.root = TRUE;
|
||||
|
|
@ -884,13 +881,13 @@ PanoramiXTranslateVisualID(int screen, VisualID orig)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* PanoramiXResetProc()
|
||||
* Exit, deallocating as needed.
|
||||
*/
|
||||
|
||||
static void PanoramiXResetProc(ExtensionEntry* extEntry)
|
||||
static void
|
||||
PanoramiXResetProc(ExtensionEntry * extEntry)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
@ -903,7 +900,6 @@ static void PanoramiXResetProc(ExtensionEntry* extEntry)
|
|||
ProcVector[i] = SavedProcVector[i];
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ProcPanoramiXQueryVersion(ClientPtr client)
|
||||
{
|
||||
|
|
@ -1017,7 +1013,6 @@ ProcPanoramiXGetScreenSize(ClientPtr client)
|
|||
return Success;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ProcXineramaIsActive(ClientPtr client)
|
||||
{
|
||||
|
|
@ -1047,7 +1042,6 @@ ProcXineramaIsActive(ClientPtr client)
|
|||
return Success;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ProcXineramaQueryScreens(ClientPtr client)
|
||||
{
|
||||
|
|
@ -1090,12 +1084,11 @@ ProcXineramaQueryScreens(ClientPtr client)
|
|||
return Success;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
ProcPanoramiXDispatch(ClientPtr client)
|
||||
{ REQUEST(xReq);
|
||||
switch (stuff->data)
|
||||
{
|
||||
REQUEST(xReq);
|
||||
switch (stuff->data) {
|
||||
case X_PanoramiXQueryVersion:
|
||||
return ProcPanoramiXQueryVersion(client);
|
||||
case X_PanoramiXGetState:
|
||||
|
|
@ -1112,7 +1105,6 @@ ProcPanoramiXDispatch (ClientPtr client)
|
|||
return BadRequest;
|
||||
}
|
||||
|
||||
|
||||
#if X_BYTE_ORDER == X_LITTLE_ENDIAN
|
||||
#define SHIFT_L(v,s) (v) << (s)
|
||||
#define SHIFT_R(v,s) (v) >> (s)
|
||||
|
|
@ -1130,28 +1122,25 @@ CopyBits(char *dst, int shiftL, char *src, int bytes)
|
|||
while (bytes--) {
|
||||
*dst |= SHIFT_L(*src, shiftL);
|
||||
*(dst + 1) |= SHIFT_R(*src, shiftR);
|
||||
dst++; src++;
|
||||
dst++;
|
||||
src++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Caution. This doesn't support 2 and 4 bpp formats. We expect
|
||||
1 bpp and planar data to be already cleared when presented
|
||||
to this function */
|
||||
|
||||
void
|
||||
XineramaGetImageData(
|
||||
DrawablePtr *pDrawables,
|
||||
XineramaGetImageData(DrawablePtr *pDrawables,
|
||||
int left,
|
||||
int top,
|
||||
int width,
|
||||
int height,
|
||||
unsigned int format,
|
||||
unsigned long planemask,
|
||||
char *data,
|
||||
int pitch,
|
||||
Bool isRoot
|
||||
){
|
||||
char *data, int pitch, Bool isRoot)
|
||||
{
|
||||
RegionRec SrcRegion, ScreenRegion, GrabRegion;
|
||||
BoxRec SrcBox, *pbox;
|
||||
int x, y, w, h, i, j, nbox, size, sizeNeeded, ScratchPitch, inOut, depth;
|
||||
|
|
@ -1178,6 +1167,7 @@ XineramaGetImageData(
|
|||
FOR_NSCREENS(i) {
|
||||
BoxRec TheBox;
|
||||
ScreenPtr pScreen;
|
||||
|
||||
pDraw = pDrawables[i];
|
||||
pScreen = pDraw->pScreen;
|
||||
|
||||
|
|
@ -1194,11 +1184,14 @@ XineramaGetImageData(
|
|||
|
||||
if (inOut == rgnIN) {
|
||||
(*pScreen->GetImage) (pDraw,
|
||||
SrcBox.x1 - pDraw->x - screenInfo.screens[i]->x,
|
||||
SrcBox.y1 - pDraw->y - screenInfo.screens[i]->y,
|
||||
width, height, format, planemask, data);
|
||||
SrcBox.x1 - pDraw->x -
|
||||
screenInfo.screens[i]->x,
|
||||
SrcBox.y1 - pDraw->y -
|
||||
screenInfo.screens[i]->y, width, height,
|
||||
format, planemask, data);
|
||||
break;
|
||||
} else if (inOut == rgnOUT)
|
||||
}
|
||||
else if (inOut == rgnOUT)
|
||||
continue;
|
||||
|
||||
nbox = RegionNumRects(&GrabRegion);
|
||||
|
|
@ -1214,6 +1207,7 @@ XineramaGetImageData(
|
|||
|
||||
if (sizeNeeded > size) {
|
||||
char *tmpdata = ScratchMem;
|
||||
|
||||
ScratchMem = realloc(ScratchMem, sizeNeeded);
|
||||
if (ScratchMem)
|
||||
size = sizeNeeded;
|
||||
|
|
@ -1244,13 +1238,13 @@ XineramaGetImageData(
|
|||
/* clean up the edge */
|
||||
if (leftover) {
|
||||
int mask = (1 << leftover) - 1;
|
||||
|
||||
for (j = h, k = w; j--; k += ScratchPitch)
|
||||
ScratchMem[k] &= mask;
|
||||
}
|
||||
|
||||
for (j = 0, index = (pitch * y) + x, index2 = 0; j < h;
|
||||
j++, index += pitch, index2 += ScratchPitch)
|
||||
{
|
||||
j++, index += pitch, index2 += ScratchPitch) {
|
||||
if (w) {
|
||||
if (!shift)
|
||||
memcpy(data + index, ScratchMem + index2, w);
|
||||
|
|
@ -1264,10 +1258,12 @@ XineramaGetImageData(
|
|||
SHIFT_L(ScratchMem[index2 + w], shift);
|
||||
if ((shift + leftover) > 8)
|
||||
data[index + w + 1] |=
|
||||
SHIFT_R(ScratchMem[index2 + w],(8 - shift));
|
||||
SHIFT_R(ScratchMem[index2 + w],
|
||||
(8 - shift));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
j = BitsPerPixel(depth) >> 3;
|
||||
x = (pbox->x1 - SrcBox.x1) * j;
|
||||
y = pbox->y1 - SrcBox.y1;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ Equipment Corporation.
|
|||
|
||||
******************************************************************/
|
||||
|
||||
|
||||
/* THIS IS NOT AN X PROJECT TEAM SPECIFICATION */
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -91,7 +91,6 @@ SProcPanoramiXGetScreenSize(ClientPtr client)
|
|||
return ProcPanoramiXGetScreenSize(client);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
SProcXineramaIsActive(ClientPtr client)
|
||||
{
|
||||
|
|
@ -102,7 +101,6 @@ SProcXineramaIsActive(ClientPtr client)
|
|||
return ProcXineramaIsActive(client);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
SProcXineramaQueryScreens(ClientPtr client)
|
||||
{
|
||||
|
|
@ -113,12 +111,11 @@ SProcXineramaQueryScreens(ClientPtr client)
|
|||
return ProcXineramaQueryScreens(client);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
SProcPanoramiXDispatch(ClientPtr client)
|
||||
{ REQUEST(xReq);
|
||||
switch (stuff->data)
|
||||
{
|
||||
REQUEST(xReq);
|
||||
switch (stuff->data) {
|
||||
case X_PanoramiXQueryVersion:
|
||||
return SProcPanoramiXQueryVersion(client);
|
||||
case X_PanoramiXGetState:
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -16,7 +16,8 @@ extern _X_EXPORT VisualID PanoramiXTranslateVisualID(int screen, VisualID orig);
|
|||
extern _X_EXPORT void PanoramiXConsolidate(void);
|
||||
extern _X_EXPORT Bool PanoramiXCreateConnectionBlock(void);
|
||||
extern _X_EXPORT PanoramiXRes *PanoramiXFindIDByScrnum(RESTYPE, XID, int);
|
||||
extern _X_EXPORT Bool XineramaRegisterConnectionBlockCallback(void (*func)(void));
|
||||
extern _X_EXPORT Bool
|
||||
XineramaRegisterConnectionBlockCallback(void (*func) (void));
|
||||
extern _X_EXPORT int XineramaDeleteResource(pointer, XID);
|
||||
|
||||
extern _X_EXPORT void XineramaReinitData(void);
|
||||
|
|
@ -38,21 +39,17 @@ extern _X_EXPORT RESTYPE XRT_PICTURE;
|
|||
typedef Bool (*XineramaVisualsEqualProcPtr) (VisualPtr, ScreenPtr, VisualPtr);
|
||||
extern _X_EXPORT XineramaVisualsEqualProcPtr XineramaVisualsEqualPtr;
|
||||
|
||||
extern _X_EXPORT void XineramaGetImageData(
|
||||
DrawablePtr *pDrawables,
|
||||
extern _X_EXPORT void XineramaGetImageData(DrawablePtr *pDrawables,
|
||||
int left,
|
||||
int top,
|
||||
int width,
|
||||
int height,
|
||||
unsigned int format,
|
||||
unsigned long planemask,
|
||||
char *data,
|
||||
int pitch,
|
||||
Bool isRoot
|
||||
);
|
||||
char *data, int pitch, Bool isRoot);
|
||||
|
||||
static inline void panoramix_setup_ids(PanoramiXRes *resource,
|
||||
ClientPtr client, XID base_id)
|
||||
static inline void
|
||||
panoramix_setup_ids(PanoramiXRes * resource, ClientPtr client, XID base_id)
|
||||
{
|
||||
int j;
|
||||
|
||||
|
|
|
|||
306
Xext/saver.c
306
Xext/saver.c
|
|
@ -26,7 +26,6 @@ in this Software without prior written authorization from the X Consortium.
|
|||
* Author: Keith Packard, MIT X Consortium
|
||||
*/
|
||||
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
|
@ -62,35 +61,28 @@ in this Software without prior written authorization from the X Consortium.
|
|||
|
||||
static int ScreenSaverEventBase = 0;
|
||||
|
||||
|
||||
static Bool ScreenSaverHandle (
|
||||
ScreenPtr /* pScreen */,
|
||||
static Bool ScreenSaverHandle(ScreenPtr /* pScreen */ ,
|
||||
int /* xstate */ ,
|
||||
Bool /* force */
|
||||
);
|
||||
|
||||
static Bool
|
||||
CreateSaverWindow (
|
||||
ScreenPtr /* pScreen */
|
||||
CreateSaverWindow(ScreenPtr /* pScreen */
|
||||
);
|
||||
|
||||
static Bool
|
||||
DestroySaverWindow (
|
||||
ScreenPtr /* pScreen */
|
||||
DestroySaverWindow(ScreenPtr /* pScreen */
|
||||
);
|
||||
|
||||
static void
|
||||
UninstallSaverColormap (
|
||||
ScreenPtr /* pScreen */
|
||||
UninstallSaverColormap(ScreenPtr /* pScreen */
|
||||
);
|
||||
|
||||
static void
|
||||
CheckScreenPrivate (
|
||||
ScreenPtr /* pScreen */
|
||||
CheckScreenPrivate(ScreenPtr /* pScreen */
|
||||
);
|
||||
|
||||
static void SScreenSaverNotifyEvent (
|
||||
xScreenSaverNotifyEvent * /* from */,
|
||||
static void SScreenSaverNotifyEvent(xScreenSaverNotifyEvent * /* from */ ,
|
||||
xScreenSaverNotifyEvent * /* to */
|
||||
);
|
||||
|
||||
|
|
@ -107,16 +99,14 @@ static ScreenSaverSuspensionPtr suspendingClients = NULL;
|
|||
* the client disconnects. count is the number of times the client has
|
||||
* requested the screensaver be suspended.
|
||||
*/
|
||||
typedef struct _ScreenSaverSuspension
|
||||
{
|
||||
typedef struct _ScreenSaverSuspension {
|
||||
ScreenSaverSuspensionPtr next;
|
||||
ClientPtr pClient;
|
||||
XID clientResource;
|
||||
int count;
|
||||
} ScreenSaverSuspensionRec;
|
||||
|
||||
static int ScreenSaverFreeSuspend(
|
||||
pointer /*value */,
|
||||
static int ScreenSaverFreeSuspend(pointer /*value */ ,
|
||||
XID /* id */
|
||||
);
|
||||
|
||||
|
|
@ -140,19 +130,16 @@ typedef struct _ScreenSaverEvent {
|
|||
CARD32 mask;
|
||||
} ScreenSaverEventRec;
|
||||
|
||||
static int ScreenSaverFreeEvents(
|
||||
pointer /* value */,
|
||||
static int ScreenSaverFreeEvents(pointer /* value */ ,
|
||||
XID /* id */
|
||||
);
|
||||
|
||||
static Bool setEventMask (
|
||||
ScreenPtr /* pScreen */,
|
||||
static Bool setEventMask(ScreenPtr /* pScreen */ ,
|
||||
ClientPtr /* client */ ,
|
||||
unsigned long /* mask */
|
||||
);
|
||||
|
||||
static unsigned long getEventMask (
|
||||
ScreenPtr /* pScreen */,
|
||||
static unsigned long getEventMask(ScreenPtr /* pScreen */ ,
|
||||
ClientPtr /* client */
|
||||
);
|
||||
|
||||
|
|
@ -180,22 +167,18 @@ typedef struct _ScreenSaverAttr {
|
|||
unsigned long *values;
|
||||
} ScreenSaverAttrRec, *ScreenSaverAttrPtr;
|
||||
|
||||
static int ScreenSaverFreeAttr (
|
||||
pointer /* value */,
|
||||
static int ScreenSaverFreeAttr(pointer /* value */ ,
|
||||
XID /* id */
|
||||
);
|
||||
|
||||
static void FreeAttrs (
|
||||
ScreenSaverAttrPtr /* pAttr */
|
||||
static void FreeAttrs(ScreenSaverAttrPtr /* pAttr */
|
||||
);
|
||||
|
||||
static void FreeScreenAttr (
|
||||
ScreenSaverAttrPtr /* pAttr */
|
||||
static void FreeScreenAttr(ScreenSaverAttrPtr /* pAttr */
|
||||
);
|
||||
|
||||
static void
|
||||
SendScreenSaverNotify (
|
||||
ScreenPtr /* pScreen */,
|
||||
SendScreenSaverNotify(ScreenPtr /* pScreen */ ,
|
||||
int /* state */ ,
|
||||
Bool /* forced */
|
||||
);
|
||||
|
|
@ -207,12 +190,11 @@ typedef struct _ScreenSaverScreenPrivate {
|
|||
Colormap installedMap;
|
||||
} ScreenSaverScreenPrivateRec, *ScreenSaverScreenPrivatePtr;
|
||||
|
||||
static ScreenSaverScreenPrivatePtr
|
||||
MakeScreenPrivate (
|
||||
ScreenPtr /* pScreen */
|
||||
static ScreenSaverScreenPrivatePtr MakeScreenPrivate(ScreenPtr /* pScreen */
|
||||
);
|
||||
|
||||
static DevPrivateKeyRec ScreenPrivateKeyRec;
|
||||
|
||||
#define ScreenPrivateKey (&ScreenPrivateKeyRec)
|
||||
|
||||
#define GetScreenPrivate(s) ((ScreenSaverScreenPrivatePtr) \
|
||||
|
|
@ -231,8 +213,7 @@ CheckScreenPrivate (ScreenPtr pScreen)
|
|||
if (!pPriv)
|
||||
return;
|
||||
if (!pPriv->attr && !pPriv->events &&
|
||||
!pPriv->hasWindow && pPriv->installedMap == None)
|
||||
{
|
||||
!pPriv->hasWindow && pPriv->installedMap == None) {
|
||||
free(pPriv);
|
||||
SetScreenPrivate(pScreen, NULL);
|
||||
pScreen->screensaver.ExternalScreenSaver = NULL;
|
||||
|
|
@ -280,8 +261,7 @@ setEventMask (ScreenPtr pScreen, ClientPtr client, unsigned long mask)
|
|||
|
||||
if (getEventMask(pScreen, client) == mask)
|
||||
return TRUE;
|
||||
if (!pPriv)
|
||||
{
|
||||
if (!pPriv) {
|
||||
pPriv = MakeScreenPrivate(pScreen);
|
||||
if (!pPriv)
|
||||
return FALSE;
|
||||
|
|
@ -289,20 +269,16 @@ setEventMask (ScreenPtr pScreen, ClientPtr client, unsigned long mask)
|
|||
for (pPrev = &pPriv->events; (pEv = *pPrev) != 0; pPrev = &pEv->next)
|
||||
if (pEv->client == client)
|
||||
break;
|
||||
if (mask == 0)
|
||||
{
|
||||
if (mask == 0) {
|
||||
FreeResource(pEv->resource, SaverEventType);
|
||||
*pPrev = pEv->next;
|
||||
free(pEv);
|
||||
CheckScreenPrivate(pScreen);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!pEv)
|
||||
{
|
||||
else {
|
||||
if (!pEv) {
|
||||
pEv = New(ScreenSaverEventRec);
|
||||
if (!pEv)
|
||||
{
|
||||
if (!pEv) {
|
||||
CheckScreenPrivate(pScreen);
|
||||
return FALSE;
|
||||
}
|
||||
|
|
@ -346,6 +322,7 @@ ScreenSaverFreeEvents (pointer value, XID id)
|
|||
{
|
||||
ScreenSaverEventPtr pOld = (ScreenSaverEventPtr) value;
|
||||
ScreenPtr pScreen = pOld->screen;
|
||||
|
||||
SetupScreen(pScreen);
|
||||
ScreenSaverEventPtr pEv, *pPrev;
|
||||
|
||||
|
|
@ -367,6 +344,7 @@ ScreenSaverFreeAttr (pointer value, XID id)
|
|||
{
|
||||
ScreenSaverAttrPtr pOldAttr = (ScreenSaverAttrPtr) value;
|
||||
ScreenPtr pScreen = pOldAttr->screen;
|
||||
|
||||
SetupScreen(pScreen);
|
||||
|
||||
if (!pPriv)
|
||||
|
|
@ -375,8 +353,7 @@ ScreenSaverFreeAttr (pointer value, XID id)
|
|||
return TRUE;
|
||||
FreeScreenAttr(pOldAttr);
|
||||
pPriv->attr = NULL;
|
||||
if (pPriv->hasWindow)
|
||||
{
|
||||
if (pPriv->hasWindow) {
|
||||
dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
|
||||
dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverActive);
|
||||
}
|
||||
|
|
@ -391,10 +368,8 @@ ScreenSaverFreeSuspend (pointer value, XID id)
|
|||
ScreenSaverSuspensionPtr *prev, this;
|
||||
|
||||
/* Unlink and free the suspension record for the client */
|
||||
for (prev = &suspendingClients; (this = *prev); prev = &this->next)
|
||||
{
|
||||
if (this == data)
|
||||
{
|
||||
for (prev = &suspendingClients; (this = *prev); prev = &this->next) {
|
||||
if (this == data) {
|
||||
*prev = this->next;
|
||||
free(this);
|
||||
break;
|
||||
|
|
@ -402,8 +377,7 @@ ScreenSaverFreeSuspend (pointer value, XID id)
|
|||
}
|
||||
|
||||
/* Reenable the screensaver if this was the last client suspending it. */
|
||||
if (screenSaverSuspended && suspendingClients == NULL)
|
||||
{
|
||||
if (screenSaverSuspended && suspendingClients == NULL) {
|
||||
screenSaverSuspended = FALSE;
|
||||
|
||||
/* The screensaver could be active, since suspending it (by design)
|
||||
|
|
@ -446,8 +420,7 @@ SendScreenSaverNotify (ScreenPtr pScreen, int state, Bool forced)
|
|||
kind = ScreenSaverBlanked;
|
||||
else
|
||||
kind = ScreenSaverInternal;
|
||||
for (pEv = pPriv->events; pEv; pEv = pEv->next)
|
||||
{
|
||||
for (pEv = pPriv->events; pEv; pEv = pEv->next) {
|
||||
if (!(pEv->mask & mask))
|
||||
continue;
|
||||
ev.type = ScreenSaverNotify + ScreenSaverEventBase;
|
||||
|
|
@ -482,8 +455,7 @@ UninstallSaverColormap (ScreenPtr pScreen)
|
|||
ColormapPtr pCmap;
|
||||
int rc;
|
||||
|
||||
if (pPriv && pPriv->installedMap != None)
|
||||
{
|
||||
if (pPriv && pPriv->installedMap != None) {
|
||||
rc = dixLookupResourceByType((pointer *) &pCmap, pPriv->installedMap,
|
||||
RT_COLORMAP, serverClient,
|
||||
DixUninstallAccess);
|
||||
|
|
@ -510,12 +482,10 @@ CreateSaverWindow (ScreenPtr pScreen)
|
|||
ColormapPtr pCmap;
|
||||
|
||||
pSaver = &pScreen->screensaver;
|
||||
if (pSaver->pWindow)
|
||||
{
|
||||
if (pSaver->pWindow) {
|
||||
pSaver->pWindow = NullWindow;
|
||||
FreeResource(pSaver->wid, RT_NONE);
|
||||
if (pPriv)
|
||||
{
|
||||
if (pPriv) {
|
||||
UninstallSaverColormap(pScreen);
|
||||
pPriv->hasWindow = FALSE;
|
||||
CheckScreenPrivate(pScreen);
|
||||
|
|
@ -534,8 +504,7 @@ CreateSaverWindow (ScreenPtr pScreen)
|
|||
pAttr->x, pAttr->y, pAttr->width, pAttr->height,
|
||||
pAttr->borderWidth, pAttr->class,
|
||||
pAttr->mask, (XID *) pAttr->values,
|
||||
pAttr->depth, serverClient, pAttr->visual,
|
||||
&result);
|
||||
pAttr->depth, serverClient, pAttr->visual, &result);
|
||||
if (!pWin)
|
||||
return FALSE;
|
||||
|
||||
|
|
@ -543,25 +512,21 @@ CreateSaverWindow (ScreenPtr pScreen)
|
|||
return FALSE;
|
||||
|
||||
mask = 0;
|
||||
if (pAttr->pBackgroundPixmap)
|
||||
{
|
||||
if (pAttr->pBackgroundPixmap) {
|
||||
pWin->backgroundState = BackgroundPixmap;
|
||||
pWin->background.pixmap = pAttr->pBackgroundPixmap;
|
||||
pAttr->pBackgroundPixmap->refcnt++;
|
||||
mask |= CWBackPixmap;
|
||||
}
|
||||
if (pAttr->pBorderPixmap)
|
||||
{
|
||||
if (pAttr->pBorderPixmap) {
|
||||
pWin->borderIsPixel = FALSE;
|
||||
pWin->border.pixmap = pAttr->pBorderPixmap;
|
||||
pAttr->pBorderPixmap->refcnt++;
|
||||
mask |= CWBorderPixmap;
|
||||
}
|
||||
if (pAttr->pCursor)
|
||||
{
|
||||
if (pAttr->pCursor) {
|
||||
if (!pWin->optional)
|
||||
if (!MakeWindowOptional (pWin))
|
||||
{
|
||||
if (!MakeWindowOptional(pWin)) {
|
||||
FreeResource(pWin->drawable.id, RT_NONE);
|
||||
return FALSE;
|
||||
}
|
||||
|
|
@ -623,8 +588,7 @@ DestroySaverWindow (ScreenPtr pScreen)
|
|||
return FALSE;
|
||||
|
||||
pSaver = &pScreen->screensaver;
|
||||
if (pSaver->pWindow)
|
||||
{
|
||||
if (pSaver->pWindow) {
|
||||
pSaver->pWindow = NullWindow;
|
||||
FreeResource(pSaver->wid, RT_NONE);
|
||||
}
|
||||
|
|
@ -641,8 +605,7 @@ ScreenSaverHandle (ScreenPtr pScreen, int xstate, Bool force)
|
|||
Bool ret = FALSE;
|
||||
ScreenSaverScreenPrivatePtr pPriv;
|
||||
|
||||
switch (xstate)
|
||||
{
|
||||
switch (xstate) {
|
||||
case SCREEN_SAVER_ON:
|
||||
state = ScreenSaverOn;
|
||||
ret = CreateSaverWindow(pScreen);
|
||||
|
|
@ -669,6 +632,7 @@ static int
|
|||
ProcScreenSaverQueryVersion(ClientPtr client)
|
||||
{
|
||||
xScreenSaverQueryVersionReply rep;
|
||||
|
||||
REQUEST_SIZE_MATCH(xScreenSaverQueryVersionReq);
|
||||
rep.type = X_Reply;
|
||||
rep.length = 0;
|
||||
|
|
@ -714,26 +678,22 @@ ProcScreenSaverQueryInfo (ClientPtr client)
|
|||
rep.length = 0;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.window = pSaver->wid;
|
||||
if (screenIsSaved != SCREEN_SAVER_OFF)
|
||||
{
|
||||
if (screenIsSaved != SCREEN_SAVER_OFF) {
|
||||
rep.state = ScreenSaverOn;
|
||||
if (ScreenSaverTime)
|
||||
rep.tilOrSince = lastInput - ScreenSaverTime;
|
||||
else
|
||||
rep.tilOrSince = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ScreenSaverTime)
|
||||
{
|
||||
else {
|
||||
if (ScreenSaverTime) {
|
||||
rep.state = ScreenSaverOff;
|
||||
if (ScreenSaverTime < lastInput)
|
||||
rep.tilOrSince = 0;
|
||||
else
|
||||
rep.tilOrSince = ScreenSaverTime - lastInput;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
rep.state = ScreenSaverDisabled;
|
||||
rep.tilOrSince = 0;
|
||||
}
|
||||
|
|
@ -746,8 +706,7 @@ ProcScreenSaverQueryInfo (ClientPtr client)
|
|||
rep.kind = ScreenSaverBlanked;
|
||||
else
|
||||
rep.kind = ScreenSaverInternal;
|
||||
if (client->swapped)
|
||||
{
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber);
|
||||
swapl(&rep.length);
|
||||
swapl(&rep.window);
|
||||
|
|
@ -823,13 +782,11 @@ ScreenSaverSetAttributes (ClientPtr client)
|
|||
len = stuff->length - bytes_to_int32(sizeof(xScreenSaverSetAttributesReq));
|
||||
if (Ones(stuff->mask) != len)
|
||||
return BadLength;
|
||||
if (!stuff->width || !stuff->height)
|
||||
{
|
||||
if (!stuff->width || !stuff->height) {
|
||||
client->errorValue = 0;
|
||||
return BadValue;
|
||||
}
|
||||
switch (class = stuff->c_class)
|
||||
{
|
||||
switch (class = stuff->c_class) {
|
||||
case CopyFromParent:
|
||||
case InputOnly:
|
||||
case InputOutput:
|
||||
|
|
@ -847,8 +804,7 @@ ScreenSaverSetAttributes (ClientPtr client)
|
|||
if (class == CopyFromParent)
|
||||
class = pParent->drawable.class;
|
||||
|
||||
if ((class != InputOutput) && (class != InputOnly))
|
||||
{
|
||||
if ((class != InputOutput) && (class != InputOnly)) {
|
||||
client->errorValue = class;
|
||||
return BadValue;
|
||||
}
|
||||
|
|
@ -868,18 +824,13 @@ ScreenSaverSetAttributes (ClientPtr client)
|
|||
visual = ancwopt->visual;
|
||||
|
||||
/* Find out if the depth and visual are acceptable for this Screen */
|
||||
if ((visual != ancwopt->visual) || (depth != pParent->drawable.depth))
|
||||
{
|
||||
if ((visual != ancwopt->visual) || (depth != pParent->drawable.depth)) {
|
||||
fOK = FALSE;
|
||||
for(idepth = 0; idepth < pScreen->numDepths; idepth++)
|
||||
{
|
||||
for (idepth = 0; idepth < pScreen->numDepths; idepth++) {
|
||||
pDepth = (DepthPtr) & pScreen->allowedDepths[idepth];
|
||||
if ((depth == pDepth->depth) || (depth == 0))
|
||||
{
|
||||
for (ivisual = 0; ivisual < pDepth->numVids; ivisual++)
|
||||
{
|
||||
if (visual == pDepth->vids[ivisual])
|
||||
{
|
||||
if ((depth == pDepth->depth) || (depth == 0)) {
|
||||
for (ivisual = 0; ivisual < pDepth->numVids; ivisual++) {
|
||||
if (visual == pDepth->vids[ivisual]) {
|
||||
fOK = TRUE;
|
||||
break;
|
||||
}
|
||||
|
|
@ -891,43 +842,36 @@ ScreenSaverSetAttributes (ClientPtr client)
|
|||
}
|
||||
|
||||
if (((stuff->mask & (CWBorderPixmap | CWBorderPixel)) == 0) &&
|
||||
(class != InputOnly) &&
|
||||
(depth != pParent->drawable.depth))
|
||||
{
|
||||
(class != InputOnly) && (depth != pParent->drawable.depth)) {
|
||||
return BadMatch;
|
||||
}
|
||||
|
||||
if (((stuff->mask & CWColormap) == 0) &&
|
||||
(class != InputOnly) &&
|
||||
((visual != ancwopt->visual) || (ancwopt->colormap == None)))
|
||||
{
|
||||
((visual != ancwopt->visual) || (ancwopt->colormap == None))) {
|
||||
return BadMatch;
|
||||
}
|
||||
|
||||
/* end of errors from CreateWindow */
|
||||
|
||||
pPriv = GetScreenPrivate(pScreen);
|
||||
if (pPriv && pPriv->attr)
|
||||
{
|
||||
if (pPriv && pPriv->attr) {
|
||||
if (pPriv->attr->client != client)
|
||||
return BadAccess;
|
||||
}
|
||||
if (!pPriv)
|
||||
{
|
||||
if (!pPriv) {
|
||||
pPriv = MakeScreenPrivate(pScreen);
|
||||
if (!pPriv)
|
||||
return FALSE;
|
||||
}
|
||||
pAttr = New(ScreenSaverAttrRec);
|
||||
if (!pAttr)
|
||||
{
|
||||
if (!pAttr) {
|
||||
ret = BadAlloc;
|
||||
goto bail;
|
||||
}
|
||||
/* over allocate for override redirect */
|
||||
pAttr->values = values = malloc((len + 1) * sizeof(unsigned long));
|
||||
if (!values)
|
||||
{
|
||||
if (!values) {
|
||||
ret = BadAlloc;
|
||||
goto bail;
|
||||
}
|
||||
|
|
@ -955,32 +899,26 @@ ScreenSaverSetAttributes (ClientPtr client)
|
|||
while (tmask) {
|
||||
imask = lowbit(tmask);
|
||||
tmask &= ~imask;
|
||||
switch (imask)
|
||||
{
|
||||
switch (imask) {
|
||||
case CWBackPixmap:
|
||||
pixID = (Pixmap) * pVlist;
|
||||
if (pixID == None)
|
||||
{
|
||||
if (pixID == None) {
|
||||
*values++ = None;
|
||||
}
|
||||
else if (pixID == ParentRelative)
|
||||
{
|
||||
if (depth != pParent->drawable.depth)
|
||||
{
|
||||
else if (pixID == ParentRelative) {
|
||||
if (depth != pParent->drawable.depth) {
|
||||
ret = BadMatch;
|
||||
goto PatchUp;
|
||||
}
|
||||
*values++ = ParentRelative;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = dixLookupResourceByType((pointer *)&pPixmap, pixID, RT_PIXMAP,
|
||||
client, DixReadAccess);
|
||||
if (ret == Success)
|
||||
{
|
||||
else {
|
||||
ret =
|
||||
dixLookupResourceByType((pointer *) &pPixmap, pixID,
|
||||
RT_PIXMAP, client, DixReadAccess);
|
||||
if (ret == Success) {
|
||||
if ((pPixmap->drawable.depth != depth) ||
|
||||
(pPixmap->drawable.pScreen != pScreen))
|
||||
{
|
||||
(pPixmap->drawable.pScreen != pScreen)) {
|
||||
ret = BadMatch;
|
||||
goto PatchUp;
|
||||
}
|
||||
|
|
@ -988,8 +926,7 @@ ScreenSaverSetAttributes (ClientPtr client)
|
|||
pPixmap->refcnt++;
|
||||
pAttr->mask &= ~CWBackPixmap;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
client->errorValue = pixID;
|
||||
goto PatchUp;
|
||||
}
|
||||
|
|
@ -1000,24 +937,20 @@ ScreenSaverSetAttributes (ClientPtr client)
|
|||
break;
|
||||
case CWBorderPixmap:
|
||||
pixID = (Pixmap) * pVlist;
|
||||
if (pixID == CopyFromParent)
|
||||
{
|
||||
if (depth != pParent->drawable.depth)
|
||||
{
|
||||
if (pixID == CopyFromParent) {
|
||||
if (depth != pParent->drawable.depth) {
|
||||
ret = BadMatch;
|
||||
goto PatchUp;
|
||||
}
|
||||
*values++ = CopyFromParent;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = dixLookupResourceByType((pointer *)&pPixmap, pixID, RT_PIXMAP,
|
||||
client, DixReadAccess);
|
||||
if (ret == Success)
|
||||
{
|
||||
else {
|
||||
ret =
|
||||
dixLookupResourceByType((pointer *) &pPixmap, pixID,
|
||||
RT_PIXMAP, client, DixReadAccess);
|
||||
if (ret == Success) {
|
||||
if ((pPixmap->drawable.depth != depth) ||
|
||||
(pPixmap->drawable.pScreen != pScreen))
|
||||
{
|
||||
(pPixmap->drawable.pScreen != pScreen)) {
|
||||
ret = BadMatch;
|
||||
goto PatchUp;
|
||||
}
|
||||
|
|
@ -1025,8 +958,7 @@ ScreenSaverSetAttributes (ClientPtr client)
|
|||
pPixmap->refcnt++;
|
||||
pAttr->mask &= ~CWBorderPixmap;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
client->errorValue = pixID;
|
||||
goto PatchUp;
|
||||
}
|
||||
|
|
@ -1037,8 +969,7 @@ ScreenSaverSetAttributes (ClientPtr client)
|
|||
break;
|
||||
case CWBitGravity:
|
||||
val = (CARD8) *pVlist;
|
||||
if (val > StaticGravity)
|
||||
{
|
||||
if (val > StaticGravity) {
|
||||
ret = BadValue;
|
||||
client->errorValue = val;
|
||||
goto PatchUp;
|
||||
|
|
@ -1047,8 +978,7 @@ ScreenSaverSetAttributes (ClientPtr client)
|
|||
break;
|
||||
case CWWinGravity:
|
||||
val = (CARD8) *pVlist;
|
||||
if (val > StaticGravity)
|
||||
{
|
||||
if (val > StaticGravity) {
|
||||
ret = BadValue;
|
||||
client->errorValue = val;
|
||||
goto PatchUp;
|
||||
|
|
@ -1057,8 +987,7 @@ ScreenSaverSetAttributes (ClientPtr client)
|
|||
break;
|
||||
case CWBackingStore:
|
||||
val = (CARD8) *pVlist;
|
||||
if ((val != NotUseful) && (val != WhenMapped) && (val != Always))
|
||||
{
|
||||
if ((val != NotUseful) && (val != WhenMapped) && (val != Always)) {
|
||||
ret = BadValue;
|
||||
client->errorValue = val;
|
||||
goto PatchUp;
|
||||
|
|
@ -1073,8 +1002,7 @@ ScreenSaverSetAttributes (ClientPtr client)
|
|||
break;
|
||||
case CWSaveUnder:
|
||||
val = (BOOL) * pVlist;
|
||||
if ((val != xTrue) && (val != xFalse))
|
||||
{
|
||||
if ((val != xTrue) && (val != xFalse)) {
|
||||
ret = BadValue;
|
||||
client->errorValue = val;
|
||||
goto PatchUp;
|
||||
|
|
@ -1090,11 +1018,9 @@ ScreenSaverSetAttributes (ClientPtr client)
|
|||
case CWOverrideRedirect:
|
||||
if (!(stuff->mask & CWOverrideRedirect))
|
||||
pVlist--;
|
||||
else
|
||||
{
|
||||
else {
|
||||
val = (BOOL) * pVlist;
|
||||
if ((val != xTrue) && (val != xFalse))
|
||||
{
|
||||
if ((val != xTrue) && (val != xFalse)) {
|
||||
ret = BadValue;
|
||||
client->errorValue = val;
|
||||
goto PatchUp;
|
||||
|
|
@ -1106,13 +1032,11 @@ ScreenSaverSetAttributes (ClientPtr client)
|
|||
cmap = (Colormap) * pVlist;
|
||||
ret = dixLookupResourceByType((pointer *) &pCmap, cmap, RT_COLORMAP,
|
||||
client, DixUseAccess);
|
||||
if (ret != Success)
|
||||
{
|
||||
if (ret != Success) {
|
||||
client->errorValue = cmap;
|
||||
goto PatchUp;
|
||||
}
|
||||
if (pCmap->pVisual->vid != visual || pCmap->pScreen != pScreen)
|
||||
{
|
||||
if (pCmap->pVisual->vid != visual || pCmap->pScreen != pScreen) {
|
||||
ret = BadMatch;
|
||||
goto PatchUp;
|
||||
}
|
||||
|
|
@ -1121,16 +1045,13 @@ ScreenSaverSetAttributes (ClientPtr client)
|
|||
break;
|
||||
case CWCursor:
|
||||
cursorID = (Cursor) * pVlist;
|
||||
if ( cursorID == None)
|
||||
{
|
||||
if (cursorID == None) {
|
||||
*values++ = None;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
ret = dixLookupResourceByType((pointer *) &pCursor, cursorID,
|
||||
RT_CURSOR, client, DixUseAccess);
|
||||
if (ret != Success)
|
||||
{
|
||||
if (ret != Success) {
|
||||
client->errorValue = cursorID;
|
||||
goto PatchUp;
|
||||
}
|
||||
|
|
@ -1157,7 +1078,8 @@ PatchUp:
|
|||
FreeAttrs(pAttr);
|
||||
bail:
|
||||
CheckScreenPrivate(pScreen);
|
||||
if (pAttr) free(pAttr->values);
|
||||
if (pAttr)
|
||||
free(pAttr->values);
|
||||
free(pAttr);
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -1176,8 +1098,7 @@ ScreenSaverUnsetAttributes (ClientPtr client)
|
|||
if (rc != Success)
|
||||
return rc;
|
||||
pPriv = GetScreenPrivate(pDraw->pScreen);
|
||||
if (pPriv && pPriv->attr && pPriv->attr->client == client)
|
||||
{
|
||||
if (pPriv && pPriv->attr && pPriv->attr->client == client) {
|
||||
FreeResource(pPriv->attr->resource, AttrType);
|
||||
FreeScreenAttr(pPriv->attr);
|
||||
pPriv->attr = NULL;
|
||||
|
|
@ -1207,7 +1128,9 @@ ProcScreenSaverSetAttributes (ClientPtr client)
|
|||
if (status != Success)
|
||||
return (status == BadValue) ? BadDrawable : status;
|
||||
|
||||
len = stuff->length - bytes_to_int32(sizeof(xScreenSaverSetAttributesReq));
|
||||
len =
|
||||
stuff->length -
|
||||
bytes_to_int32(sizeof(xScreenSaverSetAttributesReq));
|
||||
if (Ones(stuff->mask) != len)
|
||||
return BadLength;
|
||||
|
||||
|
|
@ -1310,8 +1233,7 @@ ProcScreenSaverSuspend (ClientPtr client)
|
|||
if (this->pClient == client)
|
||||
break;
|
||||
|
||||
if (this)
|
||||
{
|
||||
if (this) {
|
||||
if (stuff->suspend == TRUE)
|
||||
this->count++;
|
||||
else if (--this->count == 0)
|
||||
|
|
@ -1340,15 +1262,13 @@ ProcScreenSaverSuspend (ClientPtr client)
|
|||
this->count = 1;
|
||||
this->clientResource = FakeClientID(client->index);
|
||||
|
||||
if (!AddResource (this->clientResource, SuspendType, (pointer) this))
|
||||
{
|
||||
if (!AddResource(this->clientResource, SuspendType, (pointer) this)) {
|
||||
free(this);
|
||||
return BadAlloc;
|
||||
}
|
||||
|
||||
*prev = this;
|
||||
if (!screenSaverSuspended)
|
||||
{
|
||||
if (!screenSaverSuspended) {
|
||||
screenSaverSuspended = TRUE;
|
||||
FreeScreenSaverTimer();
|
||||
}
|
||||
|
|
@ -1361,9 +1281,7 @@ static int (*NormalVector[]) (ClientPtr /* client */) = {
|
|||
ProcScreenSaverQueryInfo,
|
||||
ProcScreenSaverSelectInput,
|
||||
ProcScreenSaverSetAttributes,
|
||||
ProcScreenSaverUnsetAttributes,
|
||||
ProcScreenSaverSuspend,
|
||||
};
|
||||
ProcScreenSaverUnsetAttributes, ProcScreenSaverSuspend,};
|
||||
|
||||
#define NUM_REQUESTS ((sizeof NormalVector) / (sizeof NormalVector[0]))
|
||||
|
||||
|
|
@ -1450,9 +1368,7 @@ static int (*SwappedVector[]) (ClientPtr /* client */) = {
|
|||
SProcScreenSaverQueryInfo,
|
||||
SProcScreenSaverSelectInput,
|
||||
SProcScreenSaverSetAttributes,
|
||||
SProcScreenSaverUnsetAttributes,
|
||||
SProcScreenSaverSuspend,
|
||||
};
|
||||
SProcScreenSaverUnsetAttributes, SProcScreenSaverSuspend,};
|
||||
|
||||
static int
|
||||
SProcScreenSaverDispatch(ClientPtr client)
|
||||
|
|
@ -1475,22 +1391,20 @@ ScreenSaverExtensionInit(INITARGS)
|
|||
return;
|
||||
|
||||
AttrType = CreateNewResourceType(ScreenSaverFreeAttr, "SaverAttr");
|
||||
SaverEventType = CreateNewResourceType(ScreenSaverFreeEvents,
|
||||
"SaverEvent");
|
||||
SuspendType = CreateNewResourceType(ScreenSaverFreeSuspend,
|
||||
"SaverSuspend");
|
||||
SaverEventType = CreateNewResourceType(ScreenSaverFreeEvents, "SaverEvent");
|
||||
SuspendType = CreateNewResourceType(ScreenSaverFreeSuspend, "SaverSuspend");
|
||||
|
||||
for (i = 0; i < screenInfo.numScreens; i++)
|
||||
{
|
||||
for (i = 0; i < screenInfo.numScreens; i++) {
|
||||
pScreen = screenInfo.screens[i];
|
||||
SetScreenPrivate(pScreen, NULL);
|
||||
}
|
||||
if (AttrType && SaverEventType && SuspendType &&
|
||||
(extEntry = AddExtension(ScreenSaverName, ScreenSaverNumberEvents, 0,
|
||||
ProcScreenSaverDispatch, SProcScreenSaverDispatch,
|
||||
NULL, StandardMinorOpcode)))
|
||||
{
|
||||
ProcScreenSaverDispatch,
|
||||
SProcScreenSaverDispatch, NULL,
|
||||
StandardMinorOpcode))) {
|
||||
ScreenSaverEventBase = extEntry->eventBase;
|
||||
EventSwapVector[ScreenSaverEventBase] = (EventSwapPtr) SScreenSaverNotifyEvent;
|
||||
EventSwapVector[ScreenSaverEventBase] =
|
||||
(EventSwapPtr) SScreenSaverNotifyEvent;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
180
Xext/security.c
180
Xext/security.c
|
|
@ -52,6 +52,7 @@ static CallbackListPtr SecurityValidateGroupCallback = NULL;
|
|||
|
||||
/* Private state record */
|
||||
static DevPrivateKeyRec stateKeyRec;
|
||||
|
||||
#define stateKey (&stateKeyRec)
|
||||
|
||||
/* This is what we store as client security state */
|
||||
|
|
@ -84,7 +85,6 @@ static const Mask SecurityDeviceMask =
|
|||
static const Mask SecurityServerMask = DixGetAttrAccess | DixGrabAccess;
|
||||
static const Mask SecurityClientMask = DixGetAttrAccess;
|
||||
|
||||
|
||||
/* SecurityAudit
|
||||
*
|
||||
* Arguments:
|
||||
|
|
@ -97,7 +97,8 @@ static const Mask SecurityClientMask = DixGetAttrAccess;
|
|||
* Writes the message to the log file if security logging is on.
|
||||
*/
|
||||
|
||||
static void _X_ATTRIBUTE_PRINTF(1,2)
|
||||
static void
|
||||
_X_ATTRIBUTE_PRINTF(1, 2)
|
||||
SecurityAudit(const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
|
@ -151,7 +152,6 @@ SecurityLookupRequestName(ClientPtr client)
|
|||
return LookupRequestName(client->majorOp, client->minorOp);
|
||||
}
|
||||
|
||||
|
||||
/* SecurityDeleteAuthorization
|
||||
*
|
||||
* Arguments:
|
||||
|
|
@ -165,9 +165,7 @@ SecurityLookupRequestName(ClientPtr client)
|
|||
*/
|
||||
|
||||
static int
|
||||
SecurityDeleteAuthorization(
|
||||
pointer value,
|
||||
XID id)
|
||||
SecurityDeleteAuthorization(pointer value, XID id)
|
||||
{
|
||||
SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr) value;
|
||||
unsigned short name_len, data_len;
|
||||
|
|
@ -179,8 +177,7 @@ SecurityDeleteAuthorization(
|
|||
|
||||
/* Remove the auth using the os layer auth manager */
|
||||
|
||||
status = AuthorizationFromID(pAuth->id, &name_len, &name,
|
||||
&data_len, &data);
|
||||
status = AuthorizationFromID(pAuth->id, &name_len, &name, &data_len, &data);
|
||||
assert(status);
|
||||
status = RemoveAuthorization(name_len, name, data_len, data);
|
||||
assert(status);
|
||||
|
|
@ -188,14 +185,15 @@ SecurityDeleteAuthorization(
|
|||
|
||||
/* free the auth timer if there is one */
|
||||
|
||||
if (pAuth->timer) TimerFree(pAuth->timer);
|
||||
if (pAuth->timer)
|
||||
TimerFree(pAuth->timer);
|
||||
|
||||
/* send revoke events */
|
||||
|
||||
while ((pEventClient = pAuth->eventClients))
|
||||
{
|
||||
while ((pEventClient = pAuth->eventClients)) {
|
||||
/* send revocation event event */
|
||||
xSecurityAuthorizationRevokedEvent are;
|
||||
|
||||
are.type = SecurityEventBase + XSecurityAuthorizationRevoked;
|
||||
are.authId = pAuth->id;
|
||||
WriteEventsToClient(rClient(pEventClient), 1, (xEvent *) &are);
|
||||
|
|
@ -207,6 +205,7 @@ SecurityDeleteAuthorization(
|
|||
for (i = 1; i < currentMaxClients; i++)
|
||||
if (clients[i]) {
|
||||
SecurityStateRec *state;
|
||||
|
||||
state = dixLookupPrivate(&clients[i]->devPrivates, stateKey);
|
||||
if (state->haveState && state->authId == pAuth->id)
|
||||
CloseDownClient(clients[i]);
|
||||
|
|
@ -218,22 +217,16 @@ SecurityDeleteAuthorization(
|
|||
|
||||
} /* SecurityDeleteAuthorization */
|
||||
|
||||
|
||||
/* resource delete function for RTEventClient */
|
||||
static int
|
||||
SecurityDeleteAuthorizationEventClient(
|
||||
pointer value,
|
||||
XID id)
|
||||
SecurityDeleteAuthorizationEventClient(pointer value, XID id)
|
||||
{
|
||||
OtherClientsPtr pEventClient, prev = NULL;
|
||||
SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr) value;
|
||||
|
||||
for (pEventClient = pAuth->eventClients;
|
||||
pEventClient;
|
||||
pEventClient = pEventClient->next)
|
||||
{
|
||||
if (pEventClient->resource == id)
|
||||
{
|
||||
pEventClient; pEventClient = pEventClient->next) {
|
||||
if (pEventClient->resource == id) {
|
||||
if (prev)
|
||||
prev->next = pEventClient->next;
|
||||
else
|
||||
|
|
@ -243,11 +236,9 @@ SecurityDeleteAuthorizationEventClient(
|
|||
}
|
||||
prev = pEventClient;
|
||||
}
|
||||
/*NOTREACHED*/
|
||||
return -1; /* make compiler happy */
|
||||
/*NOTREACHED*/ return -1; /* make compiler happy */
|
||||
} /* SecurityDeleteAuthorizationEventClient */
|
||||
|
||||
|
||||
/* SecurityComputeAuthorizationTimeout
|
||||
*
|
||||
* Arguments:
|
||||
|
|
@ -263,8 +254,7 @@ SecurityDeleteAuthorizationEventClient(
|
|||
*/
|
||||
|
||||
static CARD32
|
||||
SecurityComputeAuthorizationTimeout(
|
||||
SecurityAuthorizationPtr pAuth,
|
||||
SecurityComputeAuthorizationTimeout(SecurityAuthorizationPtr pAuth,
|
||||
unsigned int seconds)
|
||||
{
|
||||
/* maxSecs is the number of full seconds that can be expressed in
|
||||
|
|
@ -272,13 +262,11 @@ SecurityComputeAuthorizationTimeout(
|
|||
*/
|
||||
CARD32 maxSecs = (CARD32) (~0) / (CARD32) MILLI_PER_SECOND;
|
||||
|
||||
if (seconds > maxSecs)
|
||||
{ /* only come here if we want to wait more than 49 days */
|
||||
if (seconds > maxSecs) { /* only come here if we want to wait more than 49 days */
|
||||
pAuth->secondsRemaining = seconds - maxSecs;
|
||||
return maxSecs * MILLI_PER_SECOND;
|
||||
}
|
||||
else
|
||||
{ /* by far the common case */
|
||||
else { /* by far the common case */
|
||||
pAuth->secondsRemaining = 0;
|
||||
return seconds * MILLI_PER_SECOND;
|
||||
}
|
||||
|
|
@ -304,22 +292,17 @@ SecurityComputeAuthorizationTimeout(
|
|||
*/
|
||||
|
||||
static CARD32
|
||||
SecurityAuthorizationExpired(
|
||||
OsTimerPtr timer,
|
||||
CARD32 time,
|
||||
pointer pval)
|
||||
SecurityAuthorizationExpired(OsTimerPtr timer, CARD32 time, pointer pval)
|
||||
{
|
||||
SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr) pval;
|
||||
|
||||
assert(pAuth->timer == timer);
|
||||
|
||||
if (pAuth->secondsRemaining)
|
||||
{
|
||||
if (pAuth->secondsRemaining) {
|
||||
return SecurityComputeAuthorizationTimeout(pAuth,
|
||||
pAuth->secondsRemaining);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
FreeResource(pAuth->id, RT_NONE);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -339,22 +322,20 @@ SecurityAuthorizationExpired(
|
|||
*/
|
||||
|
||||
static void
|
||||
SecurityStartAuthorizationTimer(
|
||||
SecurityAuthorizationPtr pAuth)
|
||||
SecurityStartAuthorizationTimer(SecurityAuthorizationPtr pAuth)
|
||||
{
|
||||
pAuth->timer = TimerSet(pAuth->timer, 0,
|
||||
SecurityComputeAuthorizationTimeout(pAuth, pAuth->timeout),
|
||||
SecurityComputeAuthorizationTimeout(pAuth,
|
||||
pAuth->timeout),
|
||||
SecurityAuthorizationExpired, pAuth);
|
||||
} /* SecurityStartAuthorizationTimer */
|
||||
|
||||
|
||||
/* Proc functions all take a client argument, execute the request in
|
||||
* client->requestBuffer, and return a protocol error status.
|
||||
*/
|
||||
|
||||
static int
|
||||
ProcSecurityQueryVersion(
|
||||
ClientPtr client)
|
||||
ProcSecurityQueryVersion(ClientPtr client)
|
||||
{
|
||||
/* REQUEST(xSecurityQueryVersionReq); */
|
||||
xSecurityQueryVersionReply rep;
|
||||
|
|
@ -365,8 +346,7 @@ ProcSecurityQueryVersion(
|
|||
rep.length = 0;
|
||||
rep.majorVersion = SERVER_SECURITY_MAJOR_VERSION;
|
||||
rep.minorVersion = SERVER_SECURITY_MINOR_VERSION;
|
||||
if(client->swapped)
|
||||
{
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber);
|
||||
swaps(&rep.majorVersion);
|
||||
swaps(&rep.minorVersion);
|
||||
|
|
@ -376,21 +356,15 @@ ProcSecurityQueryVersion(
|
|||
return Success;
|
||||
} /* ProcSecurityQueryVersion */
|
||||
|
||||
|
||||
static int
|
||||
SecurityEventSelectForAuthorization(
|
||||
SecurityAuthorizationPtr pAuth,
|
||||
ClientPtr client,
|
||||
Mask mask)
|
||||
SecurityEventSelectForAuthorization(SecurityAuthorizationPtr pAuth,
|
||||
ClientPtr client, Mask mask)
|
||||
{
|
||||
OtherClients *pEventClient;
|
||||
|
||||
for (pEventClient = pAuth->eventClients;
|
||||
pEventClient;
|
||||
pEventClient = pEventClient->next)
|
||||
{
|
||||
if (SameClient(pEventClient, client))
|
||||
{
|
||||
pEventClient; pEventClient = pEventClient->next) {
|
||||
if (SameClient(pEventClient, client)) {
|
||||
if (mask == 0)
|
||||
FreeResource(pEventClient->resource, RT_NONE);
|
||||
else
|
||||
|
|
@ -405,9 +379,7 @@ SecurityEventSelectForAuthorization(
|
|||
pEventClient->mask = mask;
|
||||
pEventClient->resource = FakeClientID(client->index);
|
||||
pEventClient->next = pAuth->eventClients;
|
||||
if (!AddResource(pEventClient->resource, RTEventClient,
|
||||
(pointer)pAuth))
|
||||
{
|
||||
if (!AddResource(pEventClient->resource, RTEventClient, (pointer) pAuth)) {
|
||||
free(pEventClient);
|
||||
return BadAlloc;
|
||||
}
|
||||
|
|
@ -416,10 +388,8 @@ SecurityEventSelectForAuthorization(
|
|||
return Success;
|
||||
} /* SecurityEventSelectForAuthorization */
|
||||
|
||||
|
||||
static int
|
||||
ProcSecurityGenerateAuthorization(
|
||||
ClientPtr client)
|
||||
ProcSecurityGenerateAuthorization(ClientPtr client)
|
||||
{
|
||||
REQUEST(xSecurityGenerateAuthorizationReq);
|
||||
int len; /* request length in CARD32s */
|
||||
|
|
@ -450,27 +420,23 @@ ProcSecurityGenerateAuthorization(
|
|||
return BadLength;
|
||||
|
||||
/* check valuemask */
|
||||
if (stuff->valueMask & ~XSecurityAllAuthorizationAttributes)
|
||||
{
|
||||
if (stuff->valueMask & ~XSecurityAllAuthorizationAttributes) {
|
||||
client->errorValue = stuff->valueMask;
|
||||
return BadValue;
|
||||
}
|
||||
|
||||
/* check timeout */
|
||||
timeout = 60;
|
||||
if (stuff->valueMask & XSecurityTimeout)
|
||||
{
|
||||
if (stuff->valueMask & XSecurityTimeout) {
|
||||
timeout = *values++;
|
||||
}
|
||||
|
||||
/* check trustLevel */
|
||||
trustLevel = XSecurityClientUntrusted;
|
||||
if (stuff->valueMask & XSecurityTrustLevel)
|
||||
{
|
||||
if (stuff->valueMask & XSecurityTrustLevel) {
|
||||
trustLevel = *values++;
|
||||
if (trustLevel != XSecurityClientTrusted &&
|
||||
trustLevel != XSecurityClientUntrusted)
|
||||
{
|
||||
trustLevel != XSecurityClientUntrusted) {
|
||||
client->errorValue = trustLevel;
|
||||
return BadValue;
|
||||
}
|
||||
|
|
@ -478,20 +444,18 @@ ProcSecurityGenerateAuthorization(
|
|||
|
||||
/* check group */
|
||||
group = None;
|
||||
if (stuff->valueMask & XSecurityGroup)
|
||||
{
|
||||
if (stuff->valueMask & XSecurityGroup) {
|
||||
group = *values++;
|
||||
if (SecurityValidateGroupCallback)
|
||||
{
|
||||
if (SecurityValidateGroupCallback) {
|
||||
SecurityValidateGroupInfoRec vgi;
|
||||
|
||||
vgi.group = group;
|
||||
vgi.valid = FALSE;
|
||||
CallCallbacks(&SecurityValidateGroupCallback, (pointer) &vgi);
|
||||
|
||||
/* if nobody said they recognized it, it's an error */
|
||||
|
||||
if (!vgi.valid)
|
||||
{
|
||||
if (!vgi.valid) {
|
||||
client->errorValue = group;
|
||||
return BadValue;
|
||||
}
|
||||
|
|
@ -500,11 +464,9 @@ ProcSecurityGenerateAuthorization(
|
|||
|
||||
/* check event mask */
|
||||
eventMask = 0;
|
||||
if (stuff->valueMask & XSecurityEventMask)
|
||||
{
|
||||
if (stuff->valueMask & XSecurityEventMask) {
|
||||
eventMask = *values++;
|
||||
if (eventMask & ~XSecurityAllEventMasks)
|
||||
{
|
||||
if (eventMask & ~XSecurityAllEventMasks) {
|
||||
client->errorValue = eventMask;
|
||||
return BadValue;
|
||||
}
|
||||
|
|
@ -518,8 +480,7 @@ ProcSecurityGenerateAuthorization(
|
|||
authId = GenerateAuthorization(stuff->nbytesAuthProto, protoname,
|
||||
stuff->nbytesAuthData, protodata,
|
||||
&authdata_len, &pAuthdata);
|
||||
if ((XID) ~0L == authId)
|
||||
{
|
||||
if ((XID) ~0L == authId) {
|
||||
err = SecurityErrorBase + XSecurityBadAuthorizationProtocol;
|
||||
goto bailout;
|
||||
}
|
||||
|
|
@ -532,8 +493,7 @@ ProcSecurityGenerateAuthorization(
|
|||
/* associate additional information with this auth ID */
|
||||
|
||||
pAuth = malloc(sizeof(SecurityAuthorizationRec));
|
||||
if (!pAuth)
|
||||
{
|
||||
if (!pAuth) {
|
||||
err = BadAlloc;
|
||||
goto bailout;
|
||||
}
|
||||
|
|
@ -550,15 +510,13 @@ ProcSecurityGenerateAuthorization(
|
|||
pAuth->eventClients = NULL;
|
||||
|
||||
/* handle event selection */
|
||||
if (eventMask)
|
||||
{
|
||||
if (eventMask) {
|
||||
err = SecurityEventSelectForAuthorization(pAuth, client, eventMask);
|
||||
if (err != Success)
|
||||
goto bailout;
|
||||
}
|
||||
|
||||
if (!AddResource(authId, SecurityAuthorizationResType, pAuth))
|
||||
{
|
||||
if (!AddResource(authId, SecurityAuthorizationResType, pAuth)) {
|
||||
err = BadAlloc;
|
||||
goto bailout;
|
||||
}
|
||||
|
|
@ -576,8 +534,7 @@ ProcSecurityGenerateAuthorization(
|
|||
rep.authId = authId;
|
||||
rep.dataLength = authdata_len;
|
||||
|
||||
if (client->swapped)
|
||||
{
|
||||
if (client->swapped) {
|
||||
swapl(&rep.length);
|
||||
swaps(&rep.sequenceNumber);
|
||||
swapl(&rep.authId);
|
||||
|
|
@ -588,7 +545,8 @@ ProcSecurityGenerateAuthorization(
|
|||
(char *) &rep);
|
||||
WriteToClient(client, authdata_len, pAuthdata);
|
||||
|
||||
SecurityAudit("client %d generated authorization %d trust %d timeout %d group %d events %d\n",
|
||||
SecurityAudit
|
||||
("client %d generated authorization %d trust %d timeout %d group %d events %d\n",
|
||||
client->index, pAuth->id, pAuth->trustLevel, pAuth->timeout,
|
||||
pAuth->group, eventMask);
|
||||
|
||||
|
|
@ -605,8 +563,7 @@ bailout:
|
|||
} /* ProcSecurityGenerateAuthorization */
|
||||
|
||||
static int
|
||||
ProcSecurityRevokeAuthorization(
|
||||
ClientPtr client)
|
||||
ProcSecurityRevokeAuthorization(ClientPtr client)
|
||||
{
|
||||
REQUEST(xSecurityRevokeAuthorizationReq);
|
||||
SecurityAuthorizationPtr pAuth;
|
||||
|
|
@ -624,15 +581,12 @@ ProcSecurityRevokeAuthorization(
|
|||
return Success;
|
||||
} /* ProcSecurityRevokeAuthorization */
|
||||
|
||||
|
||||
static int
|
||||
ProcSecurityDispatch(
|
||||
ClientPtr client)
|
||||
ProcSecurityDispatch(ClientPtr client)
|
||||
{
|
||||
REQUEST(xReq);
|
||||
|
||||
switch (stuff->data)
|
||||
{
|
||||
switch (stuff->data) {
|
||||
case X_SecurityQueryVersion:
|
||||
return ProcSecurityQueryVersion(client);
|
||||
case X_SecurityGenerateAuthorization:
|
||||
|
|
@ -645,8 +599,7 @@ ProcSecurityDispatch(
|
|||
} /* ProcSecurityDispatch */
|
||||
|
||||
static int
|
||||
SProcSecurityQueryVersion(
|
||||
ClientPtr client)
|
||||
SProcSecurityQueryVersion(ClientPtr client)
|
||||
{
|
||||
REQUEST(xSecurityQueryVersionReq);
|
||||
|
||||
|
|
@ -657,10 +610,8 @@ SProcSecurityQueryVersion(
|
|||
return ProcSecurityQueryVersion(client);
|
||||
} /* SProcSecurityQueryVersion */
|
||||
|
||||
|
||||
static int
|
||||
SProcSecurityGenerateAuthorization(
|
||||
ClientPtr client)
|
||||
SProcSecurityGenerateAuthorization(ClientPtr client)
|
||||
{
|
||||
REQUEST(xSecurityGenerateAuthorizationReq);
|
||||
CARD32 *values;
|
||||
|
|
@ -683,10 +634,8 @@ SProcSecurityGenerateAuthorization(
|
|||
return ProcSecurityGenerateAuthorization(client);
|
||||
} /* SProcSecurityGenerateAuthorization */
|
||||
|
||||
|
||||
static int
|
||||
SProcSecurityRevokeAuthorization(
|
||||
ClientPtr client)
|
||||
SProcSecurityRevokeAuthorization(ClientPtr client)
|
||||
{
|
||||
REQUEST(xSecurityRevokeAuthorizationReq);
|
||||
|
||||
|
|
@ -696,15 +645,12 @@ SProcSecurityRevokeAuthorization(
|
|||
return ProcSecurityRevokeAuthorization(client);
|
||||
} /* SProcSecurityRevokeAuthorization */
|
||||
|
||||
|
||||
static int
|
||||
SProcSecurityDispatch(
|
||||
ClientPtr client)
|
||||
SProcSecurityDispatch(ClientPtr client)
|
||||
{
|
||||
REQUEST(xReq);
|
||||
|
||||
switch (stuff->data)
|
||||
{
|
||||
switch (stuff->data) {
|
||||
case X_SecurityQueryVersion:
|
||||
return SProcSecurityQueryVersion(client);
|
||||
case X_SecurityGenerateAuthorization:
|
||||
|
|
@ -717,8 +663,7 @@ SProcSecurityDispatch(
|
|||
} /* SProcSecurityDispatch */
|
||||
|
||||
static void
|
||||
SwapSecurityAuthorizationRevokedEvent(
|
||||
xSecurityAuthorizationRevokedEvent *from,
|
||||
SwapSecurityAuthorizationRevokedEvent(xSecurityAuthorizationRevokedEvent * from,
|
||||
xSecurityAuthorizationRevokedEvent * to)
|
||||
{
|
||||
to->type = from->type;
|
||||
|
|
@ -835,7 +780,6 @@ SecurityResource(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
|||
rec->status = BadAccess; /* deny access */
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
SecurityExtension(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
||||
{
|
||||
|
|
@ -1054,8 +998,7 @@ SecurityClientState(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
|||
*/
|
||||
|
||||
static void
|
||||
SecurityResetProc(
|
||||
ExtensionEntry *extEntry)
|
||||
SecurityResetProc(ExtensionEntry * extEntry)
|
||||
{
|
||||
/* Unregister callbacks */
|
||||
DeleteCallback(&ClientStateCallback, SecurityClientState, NULL);
|
||||
|
|
@ -1071,7 +1014,6 @@ SecurityResetProc(
|
|||
XaceDeleteCallback(XACE_SERVER_ACCESS, SecurityServer, NULL);
|
||||
}
|
||||
|
||||
|
||||
/* SecurityExtensionInit
|
||||
*
|
||||
* Arguments: none.
|
||||
|
|
@ -1102,7 +1044,8 @@ SecurityExtensionInit(INITARGS)
|
|||
RTEventClient |= RC_NEVERRETAIN;
|
||||
|
||||
/* Allocate the private storage */
|
||||
if (!dixRegisterPrivateKey(stateKey, PRIVATE_CLIENT, sizeof(SecurityStateRec)))
|
||||
if (!dixRegisterPrivateKey
|
||||
(stateKey, PRIVATE_CLIENT, sizeof(SecurityStateRec)))
|
||||
FatalError("SecurityExtensionSetup: Can't allocate client private.\n");
|
||||
|
||||
/* Register callbacks */
|
||||
|
|
@ -1133,7 +1076,8 @@ SecurityExtensionInit(INITARGS)
|
|||
EventSwapVector[SecurityEventBase + XSecurityAuthorizationRevoked] =
|
||||
(EventSwapPtr) SwapSecurityAuthorizationRevokedEvent;
|
||||
|
||||
SetResourceTypeErrorValue(SecurityAuthorizationResType, SecurityErrorBase + XSecurityBadAuthorization);
|
||||
SetResourceTypeErrorValue(SecurityAuthorizationResType,
|
||||
SecurityErrorBase + XSecurityBadAuthorization);
|
||||
|
||||
/* Label objects that were created before we could register ourself */
|
||||
SecurityLabelInitial();
|
||||
|
|
|
|||
|
|
@ -51,7 +51,6 @@ from The Open Group.
|
|||
#undef NEED_UNDEF_Display
|
||||
#endif
|
||||
|
||||
|
||||
#include "input.h" /* for DeviceIntPtr */
|
||||
#include "property.h" /* for PropertyPtr */
|
||||
#include "pixmap.h" /* for DrawablePtr */
|
||||
|
|
|
|||
133
Xext/shape.c
133
Xext/shape.c
|
|
@ -47,20 +47,16 @@ in this Software without prior written authorization from The Open Group.
|
|||
#include "modinit.h"
|
||||
#include "protocol-versions.h"
|
||||
|
||||
typedef RegionPtr (*CreateDftPtr)(
|
||||
WindowPtr /* pWin */
|
||||
typedef RegionPtr (*CreateDftPtr) (WindowPtr /* pWin */
|
||||
);
|
||||
|
||||
static int ShapeFreeClient(
|
||||
pointer /* data */,
|
||||
static int ShapeFreeClient(pointer /* data */ ,
|
||||
XID /* id */
|
||||
);
|
||||
static int ShapeFreeEvents(
|
||||
pointer /* data */,
|
||||
static int ShapeFreeEvents(pointer /* data */ ,
|
||||
XID /* id */
|
||||
);
|
||||
static void SShapeNotifyEvent(
|
||||
xShapeNotifyEvent * /* from */,
|
||||
static void SShapeNotifyEvent(xShapeNotifyEvent * /* from */ ,
|
||||
xShapeNotifyEvent * /* to */
|
||||
);
|
||||
|
||||
|
|
@ -68,7 +64,6 @@ static void SShapeNotifyEvent(
|
|||
* externally by the Xfixes extension and are now defined in window.h
|
||||
*/
|
||||
|
||||
|
||||
#ifdef PANORAMIX
|
||||
#include "panoramiX.h"
|
||||
#include "panoramiXsrv.h"
|
||||
|
|
@ -103,20 +98,15 @@ typedef struct _ShapeEvent {
|
|||
****************/
|
||||
|
||||
static int
|
||||
RegionOperate (
|
||||
ClientPtr client,
|
||||
RegionOperate(ClientPtr client,
|
||||
WindowPtr pWin,
|
||||
int kind,
|
||||
RegionPtr *destRgnp,
|
||||
RegionPtr srcRgn,
|
||||
int op,
|
||||
int xoff, int yoff,
|
||||
CreateDftPtr create)
|
||||
RegionPtr srcRgn, int op, int xoff, int yoff, CreateDftPtr create)
|
||||
{
|
||||
if (srcRgn && (xoff || yoff))
|
||||
RegionTranslate(srcRgn, xoff, yoff);
|
||||
if (!pWin->parent)
|
||||
{
|
||||
if (!pWin->parent) {
|
||||
if (srcRgn)
|
||||
RegionDestroy(srcRgn);
|
||||
return Success;
|
||||
|
|
@ -145,7 +135,8 @@ RegionOperate (
|
|||
return Success;
|
||||
}
|
||||
}
|
||||
else switch (op) {
|
||||
else
|
||||
switch (op) {
|
||||
case ShapeSet:
|
||||
if (*destRgnp)
|
||||
RegionDestroy(*destRgnp);
|
||||
|
|
@ -214,6 +205,7 @@ static int
|
|||
ProcShapeQueryVersion(ClientPtr client)
|
||||
{
|
||||
xShapeQueryVersionReply rep;
|
||||
|
||||
REQUEST_SIZE_MATCH(xShapeQueryVersionReq);
|
||||
memset(&rep, 0, sizeof(xShapeQueryVersionReply));
|
||||
rep.type = X_Reply;
|
||||
|
|
@ -240,6 +232,7 @@ static int
|
|||
ProcShapeRectangles(ClientPtr client)
|
||||
{
|
||||
WindowPtr pWin;
|
||||
|
||||
REQUEST(xShapeRectanglesReq);
|
||||
xRectangle *prects;
|
||||
int nrects, ctype, rc;
|
||||
|
|
@ -267,8 +260,7 @@ ProcShapeRectangles (ClientPtr client)
|
|||
return BadValue;
|
||||
}
|
||||
if ((stuff->ordering != Unsorted) && (stuff->ordering != YSorted) &&
|
||||
(stuff->ordering != YXSorted) && (stuff->ordering != YXBanded))
|
||||
{
|
||||
(stuff->ordering != YXSorted) && (stuff->ordering != YXBanded)) {
|
||||
client->errorValue = stuff->ordering;
|
||||
return BadValue;
|
||||
}
|
||||
|
|
@ -305,8 +297,7 @@ ProcShapeRectangles (ClientPtr client)
|
|||
|
||||
#ifdef PANORAMIX
|
||||
static int
|
||||
ProcPanoramiXShapeRectangles(
|
||||
ClientPtr client)
|
||||
ProcPanoramiXShapeRectangles(ClientPtr client)
|
||||
{
|
||||
REQUEST(xShapeRectanglesReq);
|
||||
PanoramiXRes *win;
|
||||
|
|
@ -322,23 +313,23 @@ ProcPanoramiXShapeRectangles(
|
|||
FOR_NSCREENS(j) {
|
||||
stuff->dest = win->info[j].id;
|
||||
result = ProcShapeRectangles(client);
|
||||
if (result != Success) break;
|
||||
if (result != Success)
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/**************
|
||||
* ProcShapeMask
|
||||
**************/
|
||||
|
||||
|
||||
static int
|
||||
ProcShapeMask(ClientPtr client)
|
||||
{
|
||||
WindowPtr pWin;
|
||||
ScreenPtr pScreen;
|
||||
|
||||
REQUEST(xShapeMaskReq);
|
||||
RegionPtr srcRgn;
|
||||
RegionPtr *destRgn;
|
||||
|
|
@ -369,8 +360,8 @@ ProcShapeMask (ClientPtr client)
|
|||
if (stuff->src == None)
|
||||
srcRgn = 0;
|
||||
else {
|
||||
rc = dixLookupResourceByType((pointer *)&pPixmap, stuff->src, RT_PIXMAP,
|
||||
client, DixReadAccess);
|
||||
rc = dixLookupResourceByType((pointer *) &pPixmap, stuff->src,
|
||||
RT_PIXMAP, client, DixReadAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
if (pPixmap->drawable.pScreen != pScreen ||
|
||||
|
|
@ -404,8 +395,7 @@ ProcShapeMask (ClientPtr client)
|
|||
|
||||
#ifdef PANORAMIX
|
||||
static int
|
||||
ProcPanoramiXShapeMask(
|
||||
ClientPtr client)
|
||||
ProcPanoramiXShapeMask(ClientPtr client)
|
||||
{
|
||||
REQUEST(xShapeMaskReq);
|
||||
PanoramiXRes *win, *pmap;
|
||||
|
|
@ -423,7 +413,8 @@ ProcPanoramiXShapeMask(
|
|||
XRT_PIXMAP, client, DixReadAccess);
|
||||
if (result != Success)
|
||||
return result;
|
||||
} else
|
||||
}
|
||||
else
|
||||
pmap = NULL;
|
||||
|
||||
FOR_NSCREENS(j) {
|
||||
|
|
@ -431,13 +422,13 @@ ProcPanoramiXShapeMask(
|
|||
if (pmap)
|
||||
stuff->src = pmap->info[j].id;
|
||||
result = ProcShapeMask(client);
|
||||
if (result != Success) break;
|
||||
if (result != Success)
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/************
|
||||
* ProcShapeCombine
|
||||
************/
|
||||
|
|
@ -446,6 +437,7 @@ static int
|
|||
ProcShapeCombine(ClientPtr client)
|
||||
{
|
||||
WindowPtr pSrcWin, pDestWin;
|
||||
|
||||
REQUEST(xShapeCombineReq);
|
||||
RegionPtr srcRgn;
|
||||
RegionPtr *destRgn;
|
||||
|
|
@ -496,8 +488,7 @@ ProcShapeCombine (ClientPtr client)
|
|||
client->errorValue = stuff->srcKind;
|
||||
return BadValue;
|
||||
}
|
||||
if (pSrcWin->drawable.pScreen != pDestWin->drawable.pScreen)
|
||||
{
|
||||
if (pSrcWin->drawable.pScreen != pDestWin->drawable.pScreen) {
|
||||
return BadMatch;
|
||||
}
|
||||
|
||||
|
|
@ -505,7 +496,8 @@ ProcShapeCombine (ClientPtr client)
|
|||
tmp = RegionCreate((BoxPtr) 0, 0);
|
||||
RegionCopy(tmp, srcRgn);
|
||||
srcRgn = tmp;
|
||||
} else
|
||||
}
|
||||
else
|
||||
srcRgn = (*createSrc) (pSrcWin);
|
||||
|
||||
if (!pDestWin->optional)
|
||||
|
|
@ -529,11 +521,9 @@ ProcShapeCombine (ClientPtr client)
|
|||
stuff->xOff, stuff->yOff, createDefault);
|
||||
}
|
||||
|
||||
|
||||
#ifdef PANORAMIX
|
||||
static int
|
||||
ProcPanoramiXShapeCombine(
|
||||
ClientPtr client)
|
||||
ProcPanoramiXShapeCombine(ClientPtr client)
|
||||
{
|
||||
REQUEST(xShapeCombineReq);
|
||||
PanoramiXRes *win, *win2;
|
||||
|
|
@ -555,7 +545,8 @@ ProcPanoramiXShapeCombine(
|
|||
stuff->dest = win->info[j].id;
|
||||
stuff->src = win2->info[j].id;
|
||||
result = ProcShapeCombine(client);
|
||||
if (result != Success) break;
|
||||
if (result != Success)
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
@ -569,6 +560,7 @@ static int
|
|||
ProcShapeOffset(ClientPtr client)
|
||||
{
|
||||
WindowPtr pWin;
|
||||
|
||||
REQUEST(xShapeOffsetReq);
|
||||
RegionPtr srcRgn;
|
||||
int rc;
|
||||
|
|
@ -592,8 +584,7 @@ ProcShapeOffset (ClientPtr client)
|
|||
client->errorValue = stuff->destKind;
|
||||
return BadValue;
|
||||
}
|
||||
if (srcRgn)
|
||||
{
|
||||
if (srcRgn) {
|
||||
RegionTranslate(srcRgn, stuff->xOff, stuff->yOff);
|
||||
(*pWin->drawable.pScreen->SetShape) (pWin, stuff->destKind);
|
||||
}
|
||||
|
|
@ -601,11 +592,9 @@ ProcShapeOffset (ClientPtr client)
|
|||
return Success;
|
||||
}
|
||||
|
||||
|
||||
#ifdef PANORAMIX
|
||||
static int
|
||||
ProcPanoramiXShapeOffset(
|
||||
ClientPtr client)
|
||||
ProcPanoramiXShapeOffset(ClientPtr client)
|
||||
{
|
||||
REQUEST(xShapeOffsetReq);
|
||||
PanoramiXRes *win;
|
||||
|
|
@ -621,13 +610,13 @@ ProcPanoramiXShapeOffset(
|
|||
FOR_NSCREENS(j) {
|
||||
stuff->dest = win->info[j].id;
|
||||
result = ProcShapeOffset(client);
|
||||
if(result != Success) break;
|
||||
if (result != Success)
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static int
|
||||
ProcShapeQueryExtents(ClientPtr client)
|
||||
{
|
||||
|
|
@ -652,7 +641,8 @@ ProcShapeQueryExtents (ClientPtr client)
|
|||
/* this is done in two steps because of a compiler bug on SunOS 4.1.3 */
|
||||
pExtents = RegionExtents(region);
|
||||
extents = *pExtents;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
extents.x1 = -wBorderWidth(pWin);
|
||||
extents.y1 = -wBorderWidth(pWin);
|
||||
extents.x2 = pWin->drawable.width + wBorderWidth(pWin);
|
||||
|
|
@ -666,7 +656,8 @@ ProcShapeQueryExtents (ClientPtr client)
|
|||
/* this is done in two steps because of a compiler bug on SunOS 4.1.3 */
|
||||
pExtents = RegionExtents(region);
|
||||
extents = *pExtents;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
extents.x1 = 0;
|
||||
extents.y1 = 0;
|
||||
extents.x2 = pWin->drawable.width;
|
||||
|
|
@ -692,8 +683,7 @@ ProcShapeQueryExtents (ClientPtr client)
|
|||
return Success;
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static int
|
||||
/*ARGSUSED*/ static int
|
||||
ShapeFreeClient(pointer data, XID id)
|
||||
{
|
||||
ShapeEventPtr pShapeEvent;
|
||||
|
|
@ -709,8 +699,7 @@ ShapeFreeClient (pointer data, XID id)
|
|||
pPrev = 0;
|
||||
for (pCur = *pHead; pCur && pCur != pShapeEvent; pCur = pCur->next)
|
||||
pPrev = pCur;
|
||||
if (pCur)
|
||||
{
|
||||
if (pCur) {
|
||||
if (pPrev)
|
||||
pPrev->next = pShapeEvent->next;
|
||||
else
|
||||
|
|
@ -721,8 +710,7 @@ ShapeFreeClient (pointer data, XID id)
|
|||
return 1;
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static int
|
||||
/*ARGSUSED*/ static int
|
||||
ShapeFreeEvents(pointer data, XID id)
|
||||
{
|
||||
ShapeEventPtr *pHead, pCur, pNext;
|
||||
|
|
@ -761,9 +749,7 @@ ProcShapeSelectInput (ClientPtr client)
|
|||
|
||||
/* check for existing entry. */
|
||||
for (pShapeEvent = *pHead;
|
||||
pShapeEvent;
|
||||
pShapeEvent = pShapeEvent->next)
|
||||
{
|
||||
pShapeEvent; pShapeEvent = pShapeEvent->next) {
|
||||
if (pShapeEvent->client == client)
|
||||
return Success;
|
||||
}
|
||||
|
|
@ -790,12 +776,11 @@ ProcShapeSelectInput (ClientPtr client)
|
|||
* the list may be arbitrarily rearranged which cannot be
|
||||
* done through the resource database.
|
||||
*/
|
||||
if (!pHead)
|
||||
{
|
||||
if (!pHead) {
|
||||
pHead = malloc(sizeof(ShapeEventPtr));
|
||||
if (!pHead ||
|
||||
!AddResource (pWin->drawable.id, ShapeEventType, (pointer)pHead))
|
||||
{
|
||||
!AddResource(pWin->drawable.id, ShapeEventType,
|
||||
(pointer) pHead)) {
|
||||
FreeResource(clientResource, RT_NONE);
|
||||
return BadAlloc;
|
||||
}
|
||||
|
|
@ -808,7 +793,8 @@ ProcShapeSelectInput (ClientPtr client)
|
|||
/* delete the interest */
|
||||
if (pHead) {
|
||||
pNewShapeEvent = 0;
|
||||
for (pShapeEvent = *pHead; pShapeEvent; pShapeEvent = pShapeEvent->next) {
|
||||
for (pShapeEvent = *pHead; pShapeEvent;
|
||||
pShapeEvent = pShapeEvent->next) {
|
||||
if (pShapeEvent->client == client)
|
||||
break;
|
||||
pNewShapeEvent = pShapeEvent;
|
||||
|
|
@ -854,7 +840,8 @@ SendShapeNotify (WindowPtr pWin, int which)
|
|||
if (region) {
|
||||
extents = *RegionExtents(region);
|
||||
shaped = xTrue;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
extents.x1 = -wBorderWidth(pWin);
|
||||
extents.y1 = -wBorderWidth(pWin);
|
||||
extents.x2 = pWin->drawable.width + wBorderWidth(pWin);
|
||||
|
|
@ -867,7 +854,8 @@ SendShapeNotify (WindowPtr pWin, int which)
|
|||
if (region) {
|
||||
extents = *RegionExtents(region);
|
||||
shaped = xTrue;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
extents.x1 = 0;
|
||||
extents.y1 = 0;
|
||||
extents.x2 = pWin->drawable.width;
|
||||
|
|
@ -880,7 +868,8 @@ SendShapeNotify (WindowPtr pWin, int which)
|
|||
if (region) {
|
||||
extents = *RegionExtents(region);
|
||||
shaped = xTrue;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
extents.x1 = -wBorderWidth(pWin);
|
||||
extents.y1 = -wBorderWidth(pWin);
|
||||
extents.x2 = pWin->drawable.width + wBorderWidth(pWin);
|
||||
|
|
@ -913,6 +902,7 @@ ProcShapeInputSelected (ClientPtr client)
|
|||
ShapeEventPtr pShapeEvent, *pHead;
|
||||
int enabled, rc;
|
||||
xShapeInputSelectedReply rep;
|
||||
|
||||
REQUEST_SIZE_MATCH(xShapeInputSelectedReq);
|
||||
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
|
||||
if (rc != Success)
|
||||
|
|
@ -923,10 +913,7 @@ ProcShapeInputSelected (ClientPtr client)
|
|||
return rc;
|
||||
enabled = xFalse;
|
||||
if (pHead) {
|
||||
for (pShapeEvent = *pHead;
|
||||
pShapeEvent;
|
||||
pShapeEvent = pShapeEvent->next)
|
||||
{
|
||||
for (pShapeEvent = *pHead; pShapeEvent; pShapeEvent = pShapeEvent->next) {
|
||||
if (pShapeEvent->client == client) {
|
||||
enabled = xTrue;
|
||||
break;
|
||||
|
|
@ -954,6 +941,7 @@ ProcShapeGetRectangles (ClientPtr client)
|
|||
xRectangle *rects;
|
||||
int nrects, i, rc;
|
||||
RegionPtr region;
|
||||
|
||||
REQUEST_SIZE_MATCH(xShapeGetRectanglesReq);
|
||||
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
|
||||
if (rc != Success)
|
||||
|
|
@ -997,8 +985,10 @@ ProcShapeGetRectangles (ClientPtr client)
|
|||
rects->height = pWin->drawable.height + wBorderWidth(pWin);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
BoxPtr box;
|
||||
|
||||
nrects = RegionNumRects(region);
|
||||
box = RegionRects(region);
|
||||
rects = malloc(nrects * sizeof(xRectangle));
|
||||
|
|
@ -1236,8 +1226,7 @@ ShapeExtensionInit(void)
|
|||
if (ClientType && ShapeEventType &&
|
||||
(extEntry = AddExtension(SHAPENAME, ShapeNumberEvents, 0,
|
||||
ProcShapeDispatch, SProcShapeDispatch,
|
||||
NULL, StandardMinorOpcode)))
|
||||
{
|
||||
NULL, StandardMinorOpcode))) {
|
||||
ShapeEventBase = extEntry->eventBase;
|
||||
EventSwapVector[ShapeEventBase] = (EventSwapPtr) SShapeNotifyEvent;
|
||||
}
|
||||
|
|
|
|||
265
Xext/shm.c
265
Xext/shm.c
|
|
@ -26,7 +26,6 @@ in this Software without prior written authorization from The Open Group.
|
|||
|
||||
/* THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION */
|
||||
|
||||
|
||||
#define SHM
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
|
|
@ -106,21 +105,17 @@ typedef struct _ShmScrPrivateRec {
|
|||
} ShmScrPrivateRec;
|
||||
|
||||
static PixmapPtr fbShmCreatePixmap(XSHM_CREATE_PIXMAP_ARGS);
|
||||
static int ShmDetachSegment(
|
||||
pointer /* value */,
|
||||
static int ShmDetachSegment(pointer /* value */ ,
|
||||
XID /* shmseg */
|
||||
);
|
||||
static void ShmResetProc(
|
||||
ExtensionEntry * /* extEntry */
|
||||
static void ShmResetProc(ExtensionEntry * /* extEntry */
|
||||
);
|
||||
static void SShmCompletionEvent(
|
||||
xShmCompletionEvent * /* from */,
|
||||
static void SShmCompletionEvent(xShmCompletionEvent * /* from */ ,
|
||||
xShmCompletionEvent * /* to */
|
||||
);
|
||||
|
||||
static Bool ShmDestroyPixmap(PixmapPtr pPixmap);
|
||||
|
||||
|
||||
static unsigned char ShmReqCode;
|
||||
int ShmCompletionCode;
|
||||
int BadShmSegCode;
|
||||
|
|
@ -128,8 +123,10 @@ RESTYPE ShmSegType;
|
|||
static ShmDescPtr Shmsegs;
|
||||
static Bool sharedPixmaps;
|
||||
static DevPrivateKeyRec shmScrPrivateKeyRec;
|
||||
|
||||
#define shmScrPrivateKey (&shmScrPrivateKeyRec)
|
||||
static DevPrivateKeyRec shmPixmapPrivateKeyRec;
|
||||
|
||||
#define shmPixmapPrivateKey (&shmPixmapPrivateKeyRec)
|
||||
static ShmFuncs miFuncs = { NULL, NULL };
|
||||
static ShmFuncs fbFuncs = { fbShmCreatePixmap, NULL };
|
||||
|
|
@ -165,7 +162,6 @@ static ShmFuncs fbFuncs = {fbShmCreatePixmap, NULL};
|
|||
} \
|
||||
}
|
||||
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__CYGWIN__) || defined(__DragonFly__)
|
||||
#include <sys/signal.h>
|
||||
|
||||
|
|
@ -177,7 +173,8 @@ SigSysHandler(int signo)
|
|||
badSysCall = TRUE;
|
||||
}
|
||||
|
||||
static Bool CheckForShmSyscall(void)
|
||||
static Bool
|
||||
CheckForShmSyscall(void)
|
||||
{
|
||||
void (*oldHandler) (int);
|
||||
int shmid = -1;
|
||||
|
|
@ -188,13 +185,11 @@ static Bool CheckForShmSyscall(void)
|
|||
badSysCall = FALSE;
|
||||
shmid = shmget(IPC_PRIVATE, 4096, IPC_CREAT);
|
||||
|
||||
if (shmid != -1)
|
||||
{
|
||||
if (shmid != -1) {
|
||||
/* Successful allocation - clean up */
|
||||
shmctl(shmid, IPC_RMID, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
/* Allocation failed */
|
||||
badSysCall = TRUE;
|
||||
}
|
||||
|
|
@ -210,6 +205,7 @@ static Bool
|
|||
ShmCloseScreen(int i, ScreenPtr pScreen)
|
||||
{
|
||||
ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen);
|
||||
|
||||
pScreen->CloseScreen = screen_priv->CloseScreen;
|
||||
dixSetPrivate(&pScreen->devPrivates, shmScrPrivateKey, NULL);
|
||||
free(screen_priv);
|
||||
|
|
@ -220,8 +216,8 @@ static ShmScrPrivateRec *
|
|||
ShmInitScreenPriv(ScreenPtr pScreen)
|
||||
{
|
||||
ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen);
|
||||
if (!screen_priv)
|
||||
{
|
||||
|
||||
if (!screen_priv) {
|
||||
screen_priv = calloc(1, sizeof(ShmScrPrivateRec));
|
||||
screen_priv->CloseScreen = pScreen->CloseScreen;
|
||||
dixSetPrivate(&pScreen->devPrivates, shmScrPrivateKey, screen_priv);
|
||||
|
|
@ -240,11 +236,11 @@ ShmRegisterPrivates(void)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
/*ARGSUSED*/ static void
|
||||
ShmResetProc(ExtensionEntry * extEntry)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < screenInfo.numScreens; i++)
|
||||
ShmRegisterFuncs(screenInfo.screens[i], NULL);
|
||||
}
|
||||
|
|
@ -263,9 +259,10 @@ ShmDestroyPixmap (PixmapPtr pPixmap)
|
|||
ScreenPtr pScreen = pPixmap->drawable.pScreen;
|
||||
ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen);
|
||||
Bool ret;
|
||||
if (pPixmap->refcnt == 1)
|
||||
{
|
||||
|
||||
if (pPixmap->refcnt == 1) {
|
||||
ShmDescPtr shmdesc;
|
||||
|
||||
shmdesc = (ShmDescPtr) dixLookupPrivate(&pPixmap->devPrivates,
|
||||
shmPixmapPrivateKey);
|
||||
if (shmdesc)
|
||||
|
|
@ -384,35 +381,29 @@ ProcShmAttach(ClientPtr client)
|
|||
{
|
||||
SHMSTAT_TYPE buf;
|
||||
ShmDescPtr shmdesc;
|
||||
|
||||
REQUEST(xShmAttachReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xShmAttachReq);
|
||||
LEGAL_NEW_RESOURCE(stuff->shmseg, client);
|
||||
if ((stuff->readOnly != xTrue) && (stuff->readOnly != xFalse))
|
||||
{
|
||||
if ((stuff->readOnly != xTrue) && (stuff->readOnly != xFalse)) {
|
||||
client->errorValue = stuff->readOnly;
|
||||
return BadValue;
|
||||
}
|
||||
for (shmdesc = Shmsegs;
|
||||
shmdesc && (shmdesc->shmid != stuff->shmid);
|
||||
shmdesc = shmdesc->next)
|
||||
;
|
||||
if (shmdesc)
|
||||
{
|
||||
shmdesc && (shmdesc->shmid != stuff->shmid); shmdesc = shmdesc->next);
|
||||
if (shmdesc) {
|
||||
if (!stuff->readOnly && !shmdesc->writable)
|
||||
return BadAccess;
|
||||
shmdesc->refcnt++;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
shmdesc = malloc(sizeof(ShmDescRec));
|
||||
if (!shmdesc)
|
||||
return BadAlloc;
|
||||
shmdesc->addr = shmat(stuff->shmid, 0,
|
||||
stuff->readOnly ? SHM_RDONLY : 0);
|
||||
if ((shmdesc->addr == ((char *)-1)) ||
|
||||
SHMSTAT(stuff->shmid, &buf))
|
||||
{
|
||||
if ((shmdesc->addr == ((char *) -1)) || SHMSTAT(stuff->shmid, &buf)) {
|
||||
free(shmdesc);
|
||||
return BadAccess;
|
||||
}
|
||||
|
|
@ -439,8 +430,7 @@ ProcShmAttach(ClientPtr client)
|
|||
return Success;
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static int
|
||||
/*ARGSUSED*/ static int
|
||||
ShmDetachSegment(pointer value, /* must conform to DeleteType */
|
||||
XID shmseg)
|
||||
{
|
||||
|
|
@ -450,8 +440,7 @@ ShmDetachSegment(pointer value, /* must conform to DeleteType */
|
|||
if (--shmdesc->refcnt)
|
||||
return TRUE;
|
||||
shmdt(shmdesc->addr);
|
||||
for (prev = &Shmsegs; *prev != shmdesc; prev = &(*prev)->next)
|
||||
;
|
||||
for (prev = &Shmsegs; *prev != shmdesc; prev = &(*prev)->next);
|
||||
*prev = shmdesc->next;
|
||||
free(shmdesc);
|
||||
return Success;
|
||||
|
|
@ -461,6 +450,7 @@ static int
|
|||
ProcShmDetach(ClientPtr client)
|
||||
{
|
||||
ShmDescPtr shmdesc;
|
||||
|
||||
REQUEST(xShmDetachReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xShmDetachReq);
|
||||
|
|
@ -484,13 +474,14 @@ doShmPutImage(DrawablePtr dst, GCPtr pGC,
|
|||
if (format == ZPixmap || (format == XYPixmap && depth == 1)) {
|
||||
pPixmap = GetScratchPixmapHeader(dst->pScreen, w, h, depth,
|
||||
BitsPerPixel(depth),
|
||||
PixmapBytePad(w, depth),
|
||||
data);
|
||||
PixmapBytePad(w, depth), data);
|
||||
if (!pPixmap)
|
||||
return;
|
||||
pGC->ops->CopyArea((DrawablePtr)pPixmap, dst, pGC, sx, sy, sw, sh, dx, dy);
|
||||
pGC->ops->CopyArea((DrawablePtr) pPixmap, dst, pGC, sx, sy, sw, sh, dx,
|
||||
dy);
|
||||
FreeScratchPixmapHeader(pPixmap);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
GCPtr putGC = GetScratchGC(depth, dst->pScreen);
|
||||
|
||||
if (!putGC)
|
||||
|
|
@ -503,15 +494,17 @@ doShmPutImage(DrawablePtr dst, GCPtr pGC,
|
|||
return;
|
||||
}
|
||||
ValidateGC(&pPixmap->drawable, putGC);
|
||||
(*putGC->ops->PutImage)(&pPixmap->drawable, putGC, depth, -sx, -sy, w, h, 0,
|
||||
(format == XYPixmap) ? XYPixmap : ZPixmap, data);
|
||||
(*putGC->ops->PutImage) (&pPixmap->drawable, putGC, depth, -sx, -sy, w,
|
||||
h, 0,
|
||||
(format == XYPixmap) ? XYPixmap : ZPixmap,
|
||||
data);
|
||||
FreeScratchGC(putGC);
|
||||
if (format == XYBitmap)
|
||||
(void)(*pGC->ops->CopyPlane)(&pPixmap->drawable, dst, pGC, 0, 0, sw, sh,
|
||||
dx, dy, 1L);
|
||||
(void) (*pGC->ops->CopyPlane) (&pPixmap->drawable, dst, pGC, 0, 0,
|
||||
sw, sh, dx, dy, 1L);
|
||||
else
|
||||
(void)(*pGC->ops->CopyArea)(&pPixmap->drawable, dst, pGC, 0, 0, sw, sh,
|
||||
dx, dy);
|
||||
(void) (*pGC->ops->CopyArea) (&pPixmap->drawable, dst, pGC, 0, 0,
|
||||
sw, sh, dx, dy);
|
||||
(*pPixmap->drawable.pScreen->DestroyPixmap) (pPixmap);
|
||||
}
|
||||
}
|
||||
|
|
@ -523,6 +516,7 @@ ProcShmPutImage(ClientPtr client)
|
|||
DrawablePtr pDraw;
|
||||
long length;
|
||||
ShmDescPtr shmdesc;
|
||||
|
||||
REQUEST(xShmPutImageReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xShmPutImageReq);
|
||||
|
|
@ -530,27 +524,23 @@ ProcShmPutImage(ClientPtr client)
|
|||
VERIFY_SHMPTR(stuff->shmseg, stuff->offset, FALSE, shmdesc, client);
|
||||
if ((stuff->sendEvent != xTrue) && (stuff->sendEvent != xFalse))
|
||||
return BadValue;
|
||||
if (stuff->format == XYBitmap)
|
||||
{
|
||||
if (stuff->format == XYBitmap) {
|
||||
if (stuff->depth != 1)
|
||||
return BadMatch;
|
||||
length = PixmapBytePad(stuff->totalWidth, 1);
|
||||
}
|
||||
else if (stuff->format == XYPixmap)
|
||||
{
|
||||
else if (stuff->format == XYPixmap) {
|
||||
if (pDraw->depth != stuff->depth)
|
||||
return BadMatch;
|
||||
length = PixmapBytePad(stuff->totalWidth, 1);
|
||||
length *= stuff->depth;
|
||||
}
|
||||
else if (stuff->format == ZPixmap)
|
||||
{
|
||||
else if (stuff->format == ZPixmap) {
|
||||
if (pDraw->depth != stuff->depth)
|
||||
return BadMatch;
|
||||
length = PixmapBytePad(stuff->totalWidth, stuff->depth);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
client->errorValue = stuff->format;
|
||||
return BadValue;
|
||||
}
|
||||
|
|
@ -566,23 +556,19 @@ ProcShmPutImage(ClientPtr client)
|
|||
client->errorValue = stuff->totalWidth;
|
||||
return BadValue;
|
||||
}
|
||||
if (stuff->srcX > stuff->totalWidth)
|
||||
{
|
||||
if (stuff->srcX > stuff->totalWidth) {
|
||||
client->errorValue = stuff->srcX;
|
||||
return BadValue;
|
||||
}
|
||||
if (stuff->srcY > stuff->totalHeight)
|
||||
{
|
||||
if (stuff->srcY > stuff->totalHeight) {
|
||||
client->errorValue = stuff->srcY;
|
||||
return BadValue;
|
||||
}
|
||||
if ((stuff->srcX + stuff->srcWidth) > stuff->totalWidth)
|
||||
{
|
||||
if ((stuff->srcX + stuff->srcWidth) > stuff->totalWidth) {
|
||||
client->errorValue = stuff->srcWidth;
|
||||
return BadValue;
|
||||
}
|
||||
if ((stuff->srcY + stuff->srcHeight) > stuff->totalHeight)
|
||||
{
|
||||
if ((stuff->srcY + stuff->srcHeight) > stuff->totalHeight) {
|
||||
client->errorValue = stuff->srcHeight;
|
||||
return BadValue;
|
||||
}
|
||||
|
|
@ -605,11 +591,9 @@ ProcShmPutImage(ClientPtr client)
|
|||
stuff->totalWidth, stuff->totalHeight,
|
||||
stuff->srcX, stuff->srcY,
|
||||
stuff->srcWidth, stuff->srcHeight,
|
||||
stuff->dstX, stuff->dstY,
|
||||
shmdesc->addr + stuff->offset);
|
||||
stuff->dstX, stuff->dstY, shmdesc->addr + stuff->offset);
|
||||
|
||||
if (stuff->sendEvent)
|
||||
{
|
||||
if (stuff->sendEvent) {
|
||||
xShmCompletionEvent ev;
|
||||
|
||||
ev.type = ShmCompletionCode;
|
||||
|
|
@ -637,43 +621,37 @@ ProcShmGetImage(ClientPtr client)
|
|||
REQUEST(xShmGetImageReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xShmGetImageReq);
|
||||
if ((stuff->format != XYPixmap) && (stuff->format != ZPixmap))
|
||||
{
|
||||
if ((stuff->format != XYPixmap) && (stuff->format != ZPixmap)) {
|
||||
client->errorValue = stuff->format;
|
||||
return BadValue;
|
||||
}
|
||||
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
|
||||
DixReadAccess);
|
||||
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, DixReadAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client);
|
||||
if (pDraw->type == DRAWABLE_WINDOW)
|
||||
{
|
||||
if (pDraw->type == DRAWABLE_WINDOW) {
|
||||
if ( /* check for being viewable */
|
||||
!((WindowPtr) pDraw)->realized ||
|
||||
/* check for being on screen */
|
||||
pDraw->x + stuff->x < 0 ||
|
||||
pDraw->x + stuff->x + (int)stuff->width > pDraw->pScreen->width ||
|
||||
pDraw->y + stuff->y < 0 ||
|
||||
pDraw->y + stuff->y + (int)stuff->height > pDraw->pScreen->height ||
|
||||
pDraw->x + stuff->x + (int) stuff->width > pDraw->pScreen->width
|
||||
|| pDraw->y + stuff->y < 0 ||
|
||||
pDraw->y + stuff->y + (int) stuff->height >
|
||||
pDraw->pScreen->height ||
|
||||
/* check for being inside of border */
|
||||
stuff->x < -wBorderWidth((WindowPtr) pDraw) ||
|
||||
stuff->x + (int) stuff->width >
|
||||
wBorderWidth((WindowPtr) pDraw) + (int) pDraw->width ||
|
||||
stuff->y < -wBorderWidth((WindowPtr) pDraw) ||
|
||||
stuff->y + (int) stuff->height >
|
||||
wBorderWidth((WindowPtr)pDraw) + (int)pDraw->height
|
||||
)
|
||||
wBorderWidth((WindowPtr) pDraw) + (int) pDraw->height)
|
||||
return BadMatch;
|
||||
xgi.visual = wVisual(((WindowPtr) pDraw));
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
if (stuff->x < 0 ||
|
||||
stuff->x + (int) stuff->width > pDraw->width ||
|
||||
stuff->y < 0 ||
|
||||
stuff->y+(int)stuff->height > pDraw->height
|
||||
)
|
||||
stuff->y < 0 || stuff->y + (int) stuff->height > pDraw->height)
|
||||
return BadMatch;
|
||||
xgi.visual = None;
|
||||
}
|
||||
|
|
@ -681,12 +659,10 @@ ProcShmGetImage(ClientPtr client)
|
|||
xgi.length = 0;
|
||||
xgi.sequenceNumber = client->sequence;
|
||||
xgi.depth = pDraw->depth;
|
||||
if(stuff->format == ZPixmap)
|
||||
{
|
||||
if (stuff->format == ZPixmap) {
|
||||
length = PixmapBytePad(stuff->width, pDraw->depth) * stuff->height;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
lenPer = PixmapBytePad(stuff->width, 1) * stuff->height;
|
||||
plane = ((Mask) 1) << (pDraw->depth - 1);
|
||||
/* only planes asked for */
|
||||
|
|
@ -696,25 +672,20 @@ ProcShmGetImage(ClientPtr client)
|
|||
VERIFY_SHMSIZE(shmdesc, stuff->offset, length, client);
|
||||
xgi.size = length;
|
||||
|
||||
if (length == 0)
|
||||
{
|
||||
if (length == 0) {
|
||||
/* nothing to do */
|
||||
}
|
||||
else if (stuff->format == ZPixmap)
|
||||
{
|
||||
else if (stuff->format == ZPixmap) {
|
||||
(*pDraw->pScreen->GetImage) (pDraw, stuff->x, stuff->y,
|
||||
stuff->width, stuff->height,
|
||||
stuff->format, stuff->planeMask,
|
||||
shmdesc->addr + stuff->offset);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
|
||||
length = stuff->offset;
|
||||
for (; plane; plane >>= 1)
|
||||
{
|
||||
if (stuff->planeMask & plane)
|
||||
{
|
||||
for (; plane; plane >>= 1) {
|
||||
if (stuff->planeMask & plane) {
|
||||
(*pDraw->pScreen->GetImage) (pDraw,
|
||||
stuff->x, stuff->y,
|
||||
stuff->width, stuff->height,
|
||||
|
|
@ -764,7 +735,8 @@ ProcPanoramiXShmPutImage(ClientPtr client)
|
|||
sendEvent = stuff->sendEvent;
|
||||
stuff->sendEvent = 0;
|
||||
FOR_NSCREENS(j) {
|
||||
if(!j) stuff->sendEvent = sendEvent;
|
||||
if (!j)
|
||||
stuff->sendEvent = sendEvent;
|
||||
stuff->drawable = draw->info[j].id;
|
||||
stuff->gc = gc->info[j].id;
|
||||
if (isRoot) {
|
||||
|
|
@ -772,7 +744,8 @@ ProcPanoramiXShmPutImage(ClientPtr client)
|
|||
stuff->dstY = orig_y - screenInfo.screens[j]->y;
|
||||
}
|
||||
result = ProcShmPutImage(client);
|
||||
if(result != Success) break;
|
||||
if (result != Success)
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
@ -807,8 +780,7 @@ ProcPanoramiXShmGetImage(ClientPtr client)
|
|||
if (draw->type == XRT_PIXMAP)
|
||||
return ProcShmGetImage(client);
|
||||
|
||||
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
|
||||
DixReadAccess);
|
||||
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, DixReadAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
|
|
@ -828,12 +800,14 @@ ProcPanoramiXShmGetImage(ClientPtr client)
|
|||
x < 0 || x + w > PanoramiXPixWidth ||
|
||||
y < 0 || y + h > PanoramiXPixHeight)
|
||||
return BadMatch;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if ( /* check for being onscreen */
|
||||
screenInfo.screens[0]->x + pDraw->x + x < 0 ||
|
||||
screenInfo.screens[0]->x + pDraw->x + x + w > PanoramiXPixWidth ||
|
||||
screenInfo.screens[0]->y + pDraw->y + y < 0 ||
|
||||
screenInfo.screens[0]->y + pDraw->y + y + h > PanoramiXPixHeight ||
|
||||
screenInfo.screens[0]->x + pDraw->x + x + w > PanoramiXPixWidth
|
||||
|| screenInfo.screens[0]->y + pDraw->y + y < 0 ||
|
||||
screenInfo.screens[0]->y + pDraw->y + y + h > PanoramiXPixHeight
|
||||
||
|
||||
/* check for being inside of border */
|
||||
x < -wBorderWidth((WindowPtr) pDraw) ||
|
||||
x + w > wBorderWidth((WindowPtr) pDraw) + (int) pDraw->width ||
|
||||
|
|
@ -850,8 +824,7 @@ ProcPanoramiXShmGetImage(ClientPtr client)
|
|||
FOR_NSCREENS_FORWARD_SKIP(i) {
|
||||
rc = dixLookupDrawable(drawables + i, draw->info[i].id, client, 0,
|
||||
DixReadAccess);
|
||||
if (rc != Success)
|
||||
{
|
||||
if (rc != Success) {
|
||||
free(drawables);
|
||||
return rc;
|
||||
}
|
||||
|
|
@ -866,7 +839,8 @@ ProcPanoramiXShmGetImage(ClientPtr client)
|
|||
if (format == ZPixmap) {
|
||||
widthBytesLine = PixmapBytePad(w, pDraw->depth);
|
||||
length = widthBytesLine * h;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
widthBytesLine = PixmapBytePad(w, 1);
|
||||
lenPer = widthBytesLine * h;
|
||||
plane = ((Mask) 1) << (pDraw->depth - 1);
|
||||
|
|
@ -876,12 +850,14 @@ ProcPanoramiXShmGetImage(ClientPtr client)
|
|||
VERIFY_SHMSIZE(shmdesc, stuff->offset, length, client);
|
||||
xgi.size = length;
|
||||
|
||||
if (length == 0) {/* nothing to do */ }
|
||||
if (length == 0) { /* nothing to do */
|
||||
}
|
||||
else if (format == ZPixmap) {
|
||||
XineramaGetImageData(drawables, x, y, w, h, format, planemask,
|
||||
shmdesc->addr + stuff->offset,
|
||||
widthBytesLine, isRoot);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
|
||||
length = stuff->offset;
|
||||
for (; plane; plane >>= 1) {
|
||||
|
|
@ -915,6 +891,7 @@ ProcPanoramiXShmCreatePixmap(ClientPtr client)
|
|||
DepthPtr pDepth;
|
||||
int i, j, result, rc;
|
||||
ShmDescPtr shmdesc;
|
||||
|
||||
REQUEST(xShmCreatePixmapReq);
|
||||
unsigned int width, height, depth;
|
||||
unsigned long size;
|
||||
|
|
@ -935,16 +912,14 @@ ProcPanoramiXShmCreatePixmap(ClientPtr client)
|
|||
width = stuff->width;
|
||||
height = stuff->height;
|
||||
depth = stuff->depth;
|
||||
if (!width || !height || !depth)
|
||||
{
|
||||
if (!width || !height || !depth) {
|
||||
client->errorValue = 0;
|
||||
return BadValue;
|
||||
}
|
||||
if (width > 32767 || height > 32767)
|
||||
return BadAlloc;
|
||||
|
||||
if (stuff->depth != 1)
|
||||
{
|
||||
if (stuff->depth != 1) {
|
||||
pDepth = pDraw->pScreen->allowedDepths;
|
||||
for (i = 0; i < pDraw->pScreen->numDepths; i++, pDepth++)
|
||||
if (pDepth->depth == stuff->depth)
|
||||
|
|
@ -976,12 +951,16 @@ CreatePmap:
|
|||
|
||||
FOR_NSCREENS(j) {
|
||||
ShmScrPrivateRec *screen_priv;
|
||||
|
||||
pScreen = screenInfo.screens[j];
|
||||
|
||||
screen_priv = ShmGetScreenPriv(pScreen);
|
||||
pMap = (*screen_priv->shmFuncs->CreatePixmap) (pScreen,
|
||||
stuff->width, stuff->height, stuff->depth,
|
||||
shmdesc->addr + stuff->offset);
|
||||
stuff->width,
|
||||
stuff->height,
|
||||
stuff->depth,
|
||||
shmdesc->addr +
|
||||
stuff->offset);
|
||||
|
||||
if (pMap) {
|
||||
dixSetPrivate(&pMap->devPrivates, shmPixmapPrivateKey, shmdesc);
|
||||
|
|
@ -992,7 +971,8 @@ CreatePmap:
|
|||
result = BadAlloc;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
result = BadAlloc;
|
||||
break;
|
||||
}
|
||||
|
|
@ -1002,7 +982,8 @@ CreatePmap:
|
|||
while (j--)
|
||||
FreeResource(newPix->info[j].id, RT_NONE);
|
||||
free(newPix);
|
||||
} else
|
||||
}
|
||||
else
|
||||
AddResource(stuff->pid, XRT_PIXMAP, newPix);
|
||||
|
||||
return result;
|
||||
|
|
@ -1020,7 +1001,9 @@ fbShmCreatePixmap (ScreenPtr pScreen,
|
|||
return NullPixmap;
|
||||
|
||||
if (!(*pScreen->ModifyPixmapHeader) (pPixmap, width, height, depth,
|
||||
BitsPerPixel(depth), PixmapBytePad(width, depth), (pointer)addr)) {
|
||||
BitsPerPixel(depth),
|
||||
PixmapBytePad(width, depth),
|
||||
(pointer) addr)) {
|
||||
(*pScreen->DestroyPixmap) (pPixmap);
|
||||
return NullPixmap;
|
||||
}
|
||||
|
|
@ -1036,6 +1019,7 @@ ProcShmCreatePixmap(ClientPtr client)
|
|||
int i, rc;
|
||||
ShmDescPtr shmdesc;
|
||||
ShmScrPrivateRec *screen_priv;
|
||||
|
||||
REQUEST(xShmCreatePixmapReq);
|
||||
unsigned int width, height, depth;
|
||||
unsigned long size;
|
||||
|
|
@ -1055,16 +1039,14 @@ ProcShmCreatePixmap(ClientPtr client)
|
|||
width = stuff->width;
|
||||
height = stuff->height;
|
||||
depth = stuff->depth;
|
||||
if (!width || !height || !depth)
|
||||
{
|
||||
if (!width || !height || !depth) {
|
||||
client->errorValue = 0;
|
||||
return BadValue;
|
||||
}
|
||||
if (width > 32767 || height > 32767)
|
||||
return BadAlloc;
|
||||
|
||||
if (stuff->depth != 1)
|
||||
{
|
||||
if (stuff->depth != 1) {
|
||||
pDepth = pDraw->pScreen->allowedDepths;
|
||||
for (i = 0; i < pDraw->pScreen->numDepths; i++, pDepth++)
|
||||
if (pDepth->depth == stuff->depth)
|
||||
|
|
@ -1085,12 +1067,11 @@ CreatePmap:
|
|||
|
||||
VERIFY_SHMSIZE(shmdesc, stuff->offset, size, client);
|
||||
screen_priv = ShmGetScreenPriv(pDraw->pScreen);
|
||||
pMap = (*screen_priv->shmFuncs->CreatePixmap)(
|
||||
pDraw->pScreen, stuff->width,
|
||||
pMap = (*screen_priv->shmFuncs->CreatePixmap) (pDraw->pScreen, stuff->width,
|
||||
stuff->height, stuff->depth,
|
||||
shmdesc->addr + stuff->offset);
|
||||
if (pMap)
|
||||
{
|
||||
shmdesc->addr +
|
||||
stuff->offset);
|
||||
if (pMap) {
|
||||
rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, RT_PIXMAP,
|
||||
pMap, RT_NONE, NULL, DixCreateAccess);
|
||||
if (rc != Success) {
|
||||
|
|
@ -1101,8 +1082,7 @@ CreatePmap:
|
|||
shmdesc->refcnt++;
|
||||
pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
|
||||
pMap->drawable.id = stuff->pid;
|
||||
if (AddResource(stuff->pid, RT_PIXMAP, (pointer)pMap))
|
||||
{
|
||||
if (AddResource(stuff->pid, RT_PIXMAP, (pointer) pMap)) {
|
||||
return Success;
|
||||
}
|
||||
}
|
||||
|
|
@ -1113,8 +1093,7 @@ static int
|
|||
ProcShmDispatch(ClientPtr client)
|
||||
{
|
||||
REQUEST(xReq);
|
||||
switch (stuff->data)
|
||||
{
|
||||
switch (stuff->data) {
|
||||
case X_ShmQueryVersion:
|
||||
return ProcShmQueryVersion(client);
|
||||
case X_ShmAttach:
|
||||
|
|
@ -1243,8 +1222,7 @@ static int
|
|||
SProcShmDispatch(ClientPtr client)
|
||||
{
|
||||
REQUEST(xReq);
|
||||
switch (stuff->data)
|
||||
{
|
||||
switch (stuff->data) {
|
||||
case X_ShmQueryVersion:
|
||||
return SProcShmQueryVersion(client);
|
||||
case X_ShmAttach:
|
||||
|
|
@ -1269,8 +1247,7 @@ ShmExtensionInit(INITARGS)
|
|||
int i;
|
||||
|
||||
#ifdef MUST_CHECK_FOR_SHM_SYSCALL
|
||||
if (!CheckForShmSyscall())
|
||||
{
|
||||
if (!CheckForShmSyscall()) {
|
||||
ErrorF("MIT-SHM extension disabled due to lack of kernel support\n");
|
||||
return;
|
||||
}
|
||||
|
|
@ -1282,19 +1259,20 @@ ShmExtensionInit(INITARGS)
|
|||
sharedPixmaps = xFalse;
|
||||
{
|
||||
sharedPixmaps = xTrue;
|
||||
for (i = 0; i < screenInfo.numScreens; i++)
|
||||
{
|
||||
ShmScrPrivateRec *screen_priv = ShmInitScreenPriv(screenInfo.screens[i]);
|
||||
for (i = 0; i < screenInfo.numScreens; i++) {
|
||||
ShmScrPrivateRec *screen_priv =
|
||||
ShmInitScreenPriv(screenInfo.screens[i]);
|
||||
if (!screen_priv->shmFuncs)
|
||||
screen_priv->shmFuncs = &miFuncs;
|
||||
if (!screen_priv->shmFuncs->CreatePixmap)
|
||||
sharedPixmaps = xFalse;
|
||||
}
|
||||
if (sharedPixmaps)
|
||||
for (i = 0; i < screenInfo.numScreens; i++)
|
||||
{
|
||||
ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(screenInfo.screens[i]);
|
||||
screen_priv->destroyPixmap = screenInfo.screens[i]->DestroyPixmap;
|
||||
for (i = 0; i < screenInfo.numScreens; i++) {
|
||||
ShmScrPrivateRec *screen_priv =
|
||||
ShmGetScreenPriv(screenInfo.screens[i]);
|
||||
screen_priv->destroyPixmap =
|
||||
screenInfo.screens[i]->DestroyPixmap;
|
||||
screenInfo.screens[i]->DestroyPixmap = ShmDestroyPixmap;
|
||||
}
|
||||
}
|
||||
|
|
@ -1302,8 +1280,7 @@ ShmExtensionInit(INITARGS)
|
|||
if (ShmSegType &&
|
||||
(extEntry = AddExtension(SHMNAME, ShmNumberEvents, ShmNumberErrors,
|
||||
ProcShmDispatch, SProcShmDispatch,
|
||||
ShmResetProc, StandardMinorOpcode)))
|
||||
{
|
||||
ShmResetProc, StandardMinorOpcode))) {
|
||||
ShmReqCode = (unsigned char) extEntry->base;
|
||||
ShmCompletionCode = extEntry->eventBase;
|
||||
BadShmSegCode = extEntry->errorBase;
|
||||
|
|
|
|||
|
|
@ -45,8 +45,7 @@ typedef struct _Sertafied {
|
|||
TimeStamp revive;
|
||||
ClientPtr pClient;
|
||||
XID id;
|
||||
void (*notifyFunc)(
|
||||
ClientPtr /* client */,
|
||||
void (*notifyFunc) (ClientPtr /* client */ ,
|
||||
pointer /* closure */
|
||||
);
|
||||
|
||||
|
|
@ -58,21 +57,17 @@ static RESTYPE SertafiedResType;
|
|||
static Bool BlockHandlerRegistered;
|
||||
static int SertafiedGeneration;
|
||||
|
||||
static void ClientAwaken(
|
||||
ClientPtr /* client */,
|
||||
static void ClientAwaken(ClientPtr /* client */ ,
|
||||
pointer /* closure */
|
||||
);
|
||||
static int SertafiedDelete(
|
||||
pointer /* value */,
|
||||
static int SertafiedDelete(pointer /* value */ ,
|
||||
XID /* id */
|
||||
);
|
||||
static void SertafiedBlockHandler(
|
||||
pointer /* data */,
|
||||
static void SertafiedBlockHandler(pointer /* data */ ,
|
||||
OSTimePtr /* wt */ ,
|
||||
pointer /* LastSelectMask */
|
||||
);
|
||||
static void SertafiedWakeupHandler(
|
||||
pointer /* data */,
|
||||
static void SertafiedWakeupHandler(pointer /* data */ ,
|
||||
int /* i */ ,
|
||||
pointer /* LastSelectMask */
|
||||
);
|
||||
|
|
@ -80,13 +75,11 @@ static void SertafiedWakeupHandler(
|
|||
int
|
||||
ClientSleepUntil(ClientPtr client,
|
||||
TimeStamp *revive,
|
||||
void (*notifyFunc)(ClientPtr, pointer),
|
||||
pointer closure)
|
||||
void (*notifyFunc) (ClientPtr, pointer), pointer closure)
|
||||
{
|
||||
SertafiedPtr pRequest, pReq, pPrev;
|
||||
|
||||
if (SertafiedGeneration != serverGeneration)
|
||||
{
|
||||
if (SertafiedGeneration != serverGeneration) {
|
||||
SertafiedResType = CreateNewResourceType(SertafiedDelete,
|
||||
"ClientSleep");
|
||||
if (!SertafiedResType)
|
||||
|
|
@ -101,12 +94,10 @@ ClientSleepUntil (ClientPtr client,
|
|||
pRequest->revive = *revive;
|
||||
pRequest->id = FakeClientID(client->index);
|
||||
pRequest->closure = closure;
|
||||
if (!BlockHandlerRegistered)
|
||||
{
|
||||
if (!BlockHandlerRegistered) {
|
||||
if (!RegisterBlockAndWakeupHandlers(SertafiedBlockHandler,
|
||||
SertafiedWakeupHandler,
|
||||
(pointer) 0))
|
||||
{
|
||||
(pointer) 0)) {
|
||||
free(pRequest);
|
||||
return FALSE;
|
||||
}
|
||||
|
|
@ -120,8 +111,7 @@ ClientSleepUntil (ClientPtr client,
|
|||
pRequest->notifyFunc = notifyFunc;
|
||||
/* Insert into time-ordered queue, with earliest activation time coming first. */
|
||||
pPrev = 0;
|
||||
for (pReq = pPending; pReq; pReq = pReq->next)
|
||||
{
|
||||
for (pReq = pPending; pReq; pReq = pReq->next) {
|
||||
if (CompareTimeStamps(pReq->revive, *revive) == LATER)
|
||||
break;
|
||||
pPrev = pReq;
|
||||
|
|
@ -142,7 +132,6 @@ ClientAwaken (ClientPtr client, pointer closure)
|
|||
AttendClient(client);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
SertafiedDelete(pointer value, XID id)
|
||||
{
|
||||
|
|
@ -151,8 +140,7 @@ SertafiedDelete (pointer value, XID id)
|
|||
|
||||
pPrev = 0;
|
||||
for (pReq = pPending; pReq; pPrev = pReq, pReq = pReq->next)
|
||||
if (pReq == pRequest)
|
||||
{
|
||||
if (pReq == pRequest) {
|
||||
if (pPrev)
|
||||
pPrev->next = pReq->next;
|
||||
else
|
||||
|
|
@ -178,8 +166,7 @@ SertafiedBlockHandler (pointer data, OSTimePtr wt, pointer LastSelectMask)
|
|||
now.months = currentTime.months;
|
||||
if ((int) (now.milliseconds - currentTime.milliseconds) < 0)
|
||||
now.months++;
|
||||
for (pReq = pPending; pReq; pReq = pNext)
|
||||
{
|
||||
for (pReq = pPending; pReq; pReq = pNext) {
|
||||
pNext = pReq->next;
|
||||
if (CompareTimeStamps(pReq->revive, now) == LATER)
|
||||
break;
|
||||
|
|
@ -208,18 +195,15 @@ SertafiedWakeupHandler (pointer data, int i, pointer LastSelectMask)
|
|||
now.months = currentTime.months;
|
||||
if ((int) (now.milliseconds - currentTime.milliseconds) < 0)
|
||||
now.months++;
|
||||
for (pReq = pPending; pReq; pReq = pNext)
|
||||
{
|
||||
for (pReq = pPending; pReq; pReq = pNext) {
|
||||
pNext = pReq->next;
|
||||
if (CompareTimeStamps(pReq->revive, now) == LATER)
|
||||
break;
|
||||
FreeResource(pReq->id, RT_NONE);
|
||||
}
|
||||
if (!pPending)
|
||||
{
|
||||
if (!pPending) {
|
||||
RemoveBlockAndWakeupHandlers(SertafiedBlockHandler,
|
||||
SertafiedWakeupHandler,
|
||||
(pointer) 0);
|
||||
SertafiedWakeupHandler, (pointer) 0);
|
||||
BlockHandlerRegistered = FALSE;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,14 +33,10 @@
|
|||
|
||||
#include "dix.h"
|
||||
|
||||
extern int ClientSleepUntil(
|
||||
ClientPtr client,
|
||||
extern int ClientSleepUntil(ClientPtr client,
|
||||
TimeStamp *revive,
|
||||
void (*notifyFunc)(
|
||||
ClientPtr /* client */,
|
||||
void (*notifyFunc) (ClientPtr /* client */ ,
|
||||
pointer /* closure */
|
||||
),
|
||||
pointer Closure
|
||||
);
|
||||
), pointer Closure);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
516
Xext/sync.c
516
Xext/sync.c
File diff suppressed because it is too large
Load diff
|
|
@ -44,4 +44,3 @@ SyncVerifyFence(SyncFence **ppFence, XID fid, ClientPtr client, Mask mode);
|
|||
} while (0)
|
||||
|
||||
#endif /* _SYNCSDK_H_ */
|
||||
|
||||
|
|
|
|||
|
|
@ -71,19 +71,15 @@ typedef struct _SysCounterInfo {
|
|||
CARD64 bracket_greater;
|
||||
CARD64 bracket_less;
|
||||
SyncCounterType counterType; /* how can this counter change */
|
||||
void (*QueryValue)(
|
||||
pointer /*pCounter*/,
|
||||
void (*QueryValue) (pointer /*pCounter */ ,
|
||||
CARD64 * /*freshvalue */
|
||||
);
|
||||
void (*BracketValues)(
|
||||
pointer /*pCounter*/,
|
||||
void (*BracketValues) (pointer /*pCounter */ ,
|
||||
CARD64 * /*lessthan */ ,
|
||||
CARD64 * /*greaterthan */
|
||||
);
|
||||
} SysCounterInfo;
|
||||
|
||||
|
||||
|
||||
typedef struct _SyncAlarmClientList {
|
||||
ClientPtr client;
|
||||
XID delete_id;
|
||||
|
|
@ -117,28 +113,33 @@ typedef union {
|
|||
SyncAwait await;
|
||||
} SyncAwaitUnion;
|
||||
|
||||
extern pointer SyncCreateSystemCounter(
|
||||
const char */* name */,
|
||||
extern pointer SyncCreateSystemCounter(const char * /* name */ ,
|
||||
CARD64 /* inital_value */ ,
|
||||
CARD64 /* resolution */ ,
|
||||
SyncCounterType /* change characterization */,
|
||||
SyncCounterType
|
||||
/* change characterization */ ,
|
||||
void (* /*QueryValue */ )(
|
||||
pointer /* pCounter */,
|
||||
pointer
|
||||
/* pCounter */
|
||||
,
|
||||
CARD64 * /* pValue_return */ ), /* XXX prototype */
|
||||
void (* /*BracketValues */ )(
|
||||
pointer /* pCounter */,
|
||||
CARD64 * /* pbracket_less */,
|
||||
CARD64 * /* pbracket_greater */)
|
||||
pointer
|
||||
/* pCounter */
|
||||
,
|
||||
CARD64 *
|
||||
/* pbracket_less */
|
||||
,
|
||||
CARD64 *
|
||||
/* pbracket_greater */
|
||||
)
|
||||
);
|
||||
|
||||
extern void SyncChangeCounter(
|
||||
SyncCounter * /* pCounter*/,
|
||||
extern void SyncChangeCounter(SyncCounter * /* pCounter */ ,
|
||||
CARD64 /* new_value */
|
||||
);
|
||||
|
||||
extern void SyncDestroySystemCounter(
|
||||
pointer pCounter
|
||||
);
|
||||
extern void SyncDestroySystemCounter(pointer pCounter);
|
||||
|
||||
extern void InitServertime(void);
|
||||
|
||||
|
|
|
|||
78
Xext/xace.c
78
Xext/xace.c
|
|
@ -38,7 +38,8 @@ _X_EXPORT CallbackListPtr XaceHooks[XACE_NUM_HOOKS] = {0};
|
|||
|
||||
/* Special-cased hook functions. Called by Xserver.
|
||||
*/
|
||||
int XaceHookDispatch(ClientPtr client, int major)
|
||||
int
|
||||
XaceHookDispatch(ClientPtr client, int major)
|
||||
{
|
||||
/* Call the audit begin callback, there is no return value. */
|
||||
XaceAuditRec rec = { client, 0 };
|
||||
|
|
@ -49,7 +50,8 @@ int XaceHookDispatch(ClientPtr client, int major)
|
|||
XaceCoreDispatchRec rec = { client, Success /* default allow */ };
|
||||
CallCallbacks(&XaceHooks[XACE_CORE_DISPATCH], &rec);
|
||||
return rec.status;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
/* Call the extension dispatch hook */
|
||||
ExtensionEntry *ext = GetExtensionEntry(major);
|
||||
XaceExtAccessRec rec = { client, ext, DixUseAccess, Success };
|
||||
|
|
@ -60,7 +62,8 @@ int XaceHookDispatch(ClientPtr client, int major)
|
|||
}
|
||||
}
|
||||
|
||||
int XaceHookPropertyAccess(ClientPtr client, WindowPtr pWin,
|
||||
int
|
||||
XaceHookPropertyAccess(ClientPtr client, WindowPtr pWin,
|
||||
PropertyPtr *ppProp, Mask access_mode)
|
||||
{
|
||||
XacePropertyAccessRec rec = { client, pWin, ppProp, access_mode, Success };
|
||||
|
|
@ -68,15 +71,16 @@ int XaceHookPropertyAccess(ClientPtr client, WindowPtr pWin,
|
|||
return rec.status;
|
||||
}
|
||||
|
||||
int XaceHookSelectionAccess(ClientPtr client,
|
||||
Selection **ppSel, Mask access_mode)
|
||||
int
|
||||
XaceHookSelectionAccess(ClientPtr client, Selection ** ppSel, Mask access_mode)
|
||||
{
|
||||
XaceSelectionAccessRec rec = { client, ppSel, access_mode, Success };
|
||||
CallCallbacks(&XaceHooks[XACE_SELECTION_ACCESS], &rec);
|
||||
return rec.status;
|
||||
}
|
||||
|
||||
void XaceHookAuditEnd(ClientPtr ptr, int result)
|
||||
void
|
||||
XaceHookAuditEnd(ClientPtr ptr, int result)
|
||||
{
|
||||
XaceAuditRec rec = { ptr, result };
|
||||
/* call callbacks, there is no return value. */
|
||||
|
|
@ -85,7 +89,8 @@ void XaceHookAuditEnd(ClientPtr ptr, int result)
|
|||
|
||||
/* Entry point for hook functions. Called by Xserver.
|
||||
*/
|
||||
int XaceHook(int hook, ...)
|
||||
int
|
||||
XaceHook(int hook, ...)
|
||||
{
|
||||
union {
|
||||
XaceResourceAccessRec res;
|
||||
|
|
@ -112,8 +117,7 @@ int XaceHook(int hook, ...)
|
|||
* the arguments and integer return parameter, or in some cases just
|
||||
* sets calldata directly to a single argument (with no return result)
|
||||
*/
|
||||
switch (hook)
|
||||
{
|
||||
switch (hook) {
|
||||
case XACE_RESOURCE_ACCESS:
|
||||
u.res.client = va_arg(ap, ClientPtr);
|
||||
u.res.id = va_arg(ap, XID);
|
||||
|
|
@ -122,6 +126,7 @@ int XaceHook(int hook, ...)
|
|||
u.res.ptype = va_arg(ap, RESTYPE);
|
||||
u.res.parent = va_arg(ap, pointer);
|
||||
u.res.access_mode = va_arg(ap, Mask);
|
||||
|
||||
u.res.status = Success; /* default allow */
|
||||
prv = &u.res.status;
|
||||
break;
|
||||
|
|
@ -129,6 +134,7 @@ int XaceHook(int hook, ...)
|
|||
u.dev.client = va_arg(ap, ClientPtr);
|
||||
u.dev.dev = va_arg(ap, DeviceIntPtr);
|
||||
u.dev.access_mode = va_arg(ap, Mask);
|
||||
|
||||
u.dev.status = Success; /* default allow */
|
||||
prv = &u.dev.status;
|
||||
break;
|
||||
|
|
@ -136,16 +142,20 @@ int XaceHook(int hook, ...)
|
|||
u.send.client = va_arg(ap, ClientPtr);
|
||||
u.send.dev = va_arg(ap, DeviceIntPtr);
|
||||
u.send.pWin = va_arg(ap, WindowPtr);
|
||||
|
||||
u.send.events = va_arg(ap, xEventPtr);
|
||||
u.send.count = va_arg(ap, int);
|
||||
|
||||
u.send.status = Success; /* default allow */
|
||||
prv = &u.send.status;
|
||||
break;
|
||||
case XACE_RECEIVE_ACCESS:
|
||||
u.recv.client = va_arg(ap, ClientPtr);
|
||||
u.recv.pWin = va_arg(ap, WindowPtr);
|
||||
|
||||
u.recv.events = va_arg(ap, xEventPtr);
|
||||
u.recv.count = va_arg(ap, int);
|
||||
|
||||
u.recv.status = Success; /* default allow */
|
||||
prv = &u.recv.status;
|
||||
break;
|
||||
|
|
@ -153,11 +163,13 @@ int XaceHook(int hook, ...)
|
|||
u.client.client = va_arg(ap, ClientPtr);
|
||||
u.client.target = va_arg(ap, ClientPtr);
|
||||
u.client.access_mode = va_arg(ap, Mask);
|
||||
|
||||
u.client.status = Success; /* default allow */
|
||||
prv = &u.client.status;
|
||||
break;
|
||||
case XACE_EXT_ACCESS:
|
||||
u.ext.client = va_arg(ap, ClientPtr);
|
||||
|
||||
u.ext.ext = va_arg(ap, ExtensionEntry *);
|
||||
u.ext.access_mode = DixGetAttrAccess;
|
||||
u.ext.status = Success; /* default allow */
|
||||
|
|
@ -166,6 +178,7 @@ int XaceHook(int hook, ...)
|
|||
case XACE_SERVER_ACCESS:
|
||||
u.server.client = va_arg(ap, ClientPtr);
|
||||
u.server.access_mode = va_arg(ap, Mask);
|
||||
|
||||
u.server.status = Success; /* default allow */
|
||||
prv = &u.server.status;
|
||||
break;
|
||||
|
|
@ -174,17 +187,20 @@ int XaceHook(int hook, ...)
|
|||
u.screen.client = va_arg(ap, ClientPtr);
|
||||
u.screen.screen = va_arg(ap, ScreenPtr);
|
||||
u.screen.access_mode = va_arg(ap, Mask);
|
||||
|
||||
u.screen.status = Success; /* default allow */
|
||||
prv = &u.screen.status;
|
||||
break;
|
||||
case XACE_AUTH_AVAIL:
|
||||
u.auth.client = va_arg(ap, ClientPtr);
|
||||
u.auth.authId = va_arg(ap, XID);
|
||||
|
||||
break;
|
||||
case XACE_KEY_AVAIL:
|
||||
u.key.event = va_arg(ap, xEventPtr);
|
||||
u.key.keybd = va_arg(ap, DeviceIntPtr);
|
||||
u.key.count = va_arg(ap, int);
|
||||
|
||||
break;
|
||||
default:
|
||||
va_end(ap);
|
||||
|
|
@ -218,14 +234,11 @@ int XaceHook(int hook, ...)
|
|||
* region of the window will be destroyed (overwritten) in pBuf.
|
||||
*/
|
||||
void
|
||||
XaceCensorImage(
|
||||
ClientPtr client,
|
||||
XaceCensorImage(ClientPtr client,
|
||||
RegionPtr pVisibleRegion,
|
||||
long widthBytesLine,
|
||||
DrawablePtr pDraw,
|
||||
int x, int y, int w, int h,
|
||||
unsigned int format,
|
||||
char *pBuf)
|
||||
int x, int y, int w, int h, unsigned int format, char *pBuf)
|
||||
{
|
||||
RegionRec imageRegion; /* region representing x,y,w,h */
|
||||
RegionRec censorRegion; /* region to obliterate */
|
||||
|
|
@ -242,8 +255,7 @@ XaceCensorImage(
|
|||
/* censorRegion = imageRegion - visibleRegion */
|
||||
RegionSubtract(&censorRegion, &imageRegion, pVisibleRegion);
|
||||
nRects = RegionNumRects(&censorRegion);
|
||||
if (nRects > 0)
|
||||
{ /* we have something to censor */
|
||||
if (nRects > 0) { /* we have something to censor */
|
||||
GCPtr pScratchGC = NULL;
|
||||
PixmapPtr pPix = NULL;
|
||||
xRectangle *pRects = NULL;
|
||||
|
|
@ -256,15 +268,11 @@ XaceCensorImage(
|
|||
/* convert region to list-of-rectangles for PolyFillRect */
|
||||
|
||||
pRects = malloc(nRects * sizeof(xRectangle));
|
||||
if (!pRects)
|
||||
{
|
||||
if (!pRects) {
|
||||
failed = TRUE;
|
||||
goto failSafe;
|
||||
}
|
||||
for (pBox = RegionRects(&censorRegion), i = 0;
|
||||
i < nRects;
|
||||
i++, pBox++)
|
||||
{
|
||||
for (pBox = RegionRects(&censorRegion), i = 0; i < nRects; i++, pBox++) {
|
||||
pRects[i].x = pBox->x1;
|
||||
pRects[i].y = pBox->y1 - imageBox.y1;
|
||||
pRects[i].width = pBox->x2 - pBox->x1;
|
||||
|
|
@ -273,8 +281,7 @@ XaceCensorImage(
|
|||
|
||||
/* use pBuf as a fake pixmap */
|
||||
|
||||
if (format == ZPixmap)
|
||||
{
|
||||
if (format == ZPixmap) {
|
||||
depth = pDraw->depth;
|
||||
bitsPerPixel = pDraw->bitsPerPixel;
|
||||
}
|
||||
|
|
@ -282,15 +289,13 @@ XaceCensorImage(
|
|||
pPix = GetScratchPixmapHeader(pDraw->pScreen, w, h,
|
||||
depth, bitsPerPixel,
|
||||
widthBytesLine, (pointer) pBuf);
|
||||
if (!pPix)
|
||||
{
|
||||
if (!pPix) {
|
||||
failed = TRUE;
|
||||
goto failSafe;
|
||||
}
|
||||
|
||||
pScratchGC = GetScratchGC(depth, pPix->drawable.pScreen);
|
||||
if (!pScratchGC)
|
||||
{
|
||||
if (!pScratchGC) {
|
||||
failed = TRUE;
|
||||
goto failSafe;
|
||||
}
|
||||
|
|
@ -300,16 +305,17 @@ XaceCensorImage(
|
|||
pScratchGC, nRects, pRects);
|
||||
|
||||
failSafe:
|
||||
if (failed)
|
||||
{
|
||||
if (failed) {
|
||||
/* Censoring was not completed above. To be safe, wipe out
|
||||
* all the image data so that nothing trusted gets out.
|
||||
*/
|
||||
memset(pBuf, 0, (int) (widthBytesLine * h));
|
||||
}
|
||||
free(pRects);
|
||||
if (pScratchGC) FreeScratchGC(pScratchGC);
|
||||
if (pPix) FreeScratchPixmapHeader(pPix);
|
||||
if (pScratchGC)
|
||||
FreeScratchGC(pScratchGC);
|
||||
if (pPix)
|
||||
FreeScratchPixmapHeader(pPix);
|
||||
}
|
||||
RegionUninit(&imageRegion);
|
||||
RegionUninit(&censorRegion);
|
||||
|
|
@ -318,14 +324,18 @@ XaceCensorImage(
|
|||
/*
|
||||
* Xtrans wrappers for use by modules
|
||||
*/
|
||||
int XaceGetConnectionNumber(ClientPtr client)
|
||||
int
|
||||
XaceGetConnectionNumber(ClientPtr client)
|
||||
{
|
||||
XtransConnInfo ci = ((OsCommPtr) client->osPrivate)->trans_conn;
|
||||
|
||||
return _XSERVTransGetConnectionNumber(ci);
|
||||
}
|
||||
|
||||
int XaceIsLocal(ClientPtr client)
|
||||
int
|
||||
XaceIsLocal(ClientPtr client)
|
||||
{
|
||||
XtransConnInfo ci = ((OsCommPtr) client->osPrivate)->trans_conn;
|
||||
|
||||
return _XSERVTransIsLocal(ci);
|
||||
}
|
||||
|
|
|
|||
17
Xext/xace.h
17
Xext/xace.h
|
|
@ -61,8 +61,7 @@ extern _X_EXPORT CallbackListPtr XaceHooks[XACE_NUM_HOOKS];
|
|||
/* Entry point for hook functions. Called by Xserver.
|
||||
* Required by libdbe and libextmod
|
||||
*/
|
||||
extern _X_EXPORT int XaceHook(
|
||||
int /*hook*/,
|
||||
extern _X_EXPORT int XaceHook(int /*hook */ ,
|
||||
... /*appropriate args for hook */
|
||||
);
|
||||
|
||||
|
|
@ -70,9 +69,10 @@ extern _X_EXPORT int XaceHook(
|
|||
*/
|
||||
extern _X_EXPORT int XaceHookDispatch(ClientPtr ptr, int major);
|
||||
extern _X_EXPORT int XaceHookPropertyAccess(ClientPtr ptr, WindowPtr pWin,
|
||||
PropertyPtr *ppProp, Mask access_mode);
|
||||
extern _X_EXPORT int XaceHookSelectionAccess(ClientPtr ptr,
|
||||
Selection **ppSel, Mask access_mode);
|
||||
PropertyPtr *ppProp,
|
||||
Mask access_mode);
|
||||
extern _X_EXPORT int XaceHookSelectionAccess(ClientPtr ptr, Selection ** ppSel,
|
||||
Mask access_mode);
|
||||
extern _X_EXPORT void XaceHookAuditEnd(ClientPtr ptr, int result);
|
||||
|
||||
/* Register a callback for a given hook.
|
||||
|
|
@ -93,15 +93,12 @@ extern _X_EXPORT int XaceIsLocal(ClientPtr ptr);
|
|||
/* From the original Security extension...
|
||||
*/
|
||||
|
||||
extern _X_EXPORT void XaceCensorImage(
|
||||
ClientPtr client,
|
||||
extern _X_EXPORT void XaceCensorImage(ClientPtr client,
|
||||
RegionPtr pVisibleRegion,
|
||||
long widthBytesLine,
|
||||
DrawablePtr pDraw,
|
||||
int x, int y, int w, int h,
|
||||
unsigned int format,
|
||||
char * pBuf
|
||||
);
|
||||
unsigned int format, char *pBuf);
|
||||
|
||||
#else /* XACE */
|
||||
|
||||
|
|
|
|||
|
|
@ -98,8 +98,7 @@ ProcXCMiscGetXIDList(ClientPtr client)
|
|||
return BadAlloc;
|
||||
|
||||
pids = (XID *) malloc(stuff->count * sizeof(XID));
|
||||
if (!pids)
|
||||
{
|
||||
if (!pids) {
|
||||
return BadAlloc;
|
||||
}
|
||||
count = GetXIDList(client, stuff->count, pids);
|
||||
|
|
@ -113,8 +112,7 @@ ProcXCMiscGetXIDList(ClientPtr client)
|
|||
swapl(&rep.count);
|
||||
}
|
||||
WriteToClient(client, sizeof(xXCMiscGetXIDListReply), (char *) &rep);
|
||||
if (count)
|
||||
{
|
||||
if (count) {
|
||||
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
|
||||
WriteSwappedDataToClient(client, count * sizeof(XID), pids);
|
||||
}
|
||||
|
|
@ -126,8 +124,7 @@ static int
|
|||
ProcXCMiscDispatch(ClientPtr client)
|
||||
{
|
||||
REQUEST(xReq);
|
||||
switch (stuff->data)
|
||||
{
|
||||
switch (stuff->data) {
|
||||
case X_XCMiscGetVersion:
|
||||
return ProcXCMiscGetVersion(client);
|
||||
case X_XCMiscGetXIDRange:
|
||||
|
|
@ -174,8 +171,7 @@ static int
|
|||
SProcXCMiscDispatch(ClientPtr client)
|
||||
{
|
||||
REQUEST(xReq);
|
||||
switch (stuff->data)
|
||||
{
|
||||
switch (stuff->data) {
|
||||
case X_XCMiscGetVersion:
|
||||
return SProcXCMiscGetVersion(client);
|
||||
case X_XCMiscGetXIDRange:
|
||||
|
|
|
|||
|
|
@ -76,11 +76,9 @@
|
|||
#include <X11/extensions/xf86bigfproto.h>
|
||||
#include "xf86bigfontsrv.h"
|
||||
|
||||
static void XF86BigfontResetProc(
|
||||
ExtensionEntry * /* extEntry */
|
||||
static void XF86BigfontResetProc(ExtensionEntry * /* extEntry */
|
||||
);
|
||||
|
||||
|
||||
#ifdef HAS_SHM
|
||||
|
||||
/* A random signature, transmitted to the clients so they can verify that the
|
||||
|
|
@ -100,8 +98,7 @@ static Bool badSysCall = FALSE;
|
|||
#include <sys/signal.h>
|
||||
|
||||
static void
|
||||
SigSysHandler(
|
||||
int signo)
|
||||
SigSysHandler(int signo)
|
||||
{
|
||||
badSysCall = TRUE;
|
||||
}
|
||||
|
|
@ -117,13 +114,11 @@ CheckForShmSyscall(void)
|
|||
|
||||
badSysCall = FALSE;
|
||||
shmid = shmget(IPC_PRIVATE, 4096, IPC_CREAT);
|
||||
if (shmid != -1)
|
||||
{
|
||||
if (shmid != -1) {
|
||||
/* Successful allocation - clean up */
|
||||
shmctl(shmid, IPC_RMID, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
/* Allocation failed */
|
||||
badSysCall = TRUE;
|
||||
}
|
||||
|
|
@ -158,8 +153,7 @@ typedef struct _ShmDesc {
|
|||
static ShmDescPtr ShmList = (ShmDescPtr) NULL;
|
||||
|
||||
static ShmDescPtr
|
||||
shmalloc(
|
||||
unsigned int size)
|
||||
shmalloc(unsigned int size)
|
||||
{
|
||||
ShmDescPtr pDesc;
|
||||
int shmid;
|
||||
|
|
@ -206,7 +200,8 @@ shmalloc(
|
|||
|
||||
pDesc->shmid = shmid;
|
||||
pDesc->attach_addr = addr;
|
||||
if (ShmList) ShmList->prev = &pDesc->next;
|
||||
if (ShmList)
|
||||
ShmList->prev = &pDesc->next;
|
||||
pDesc->next = ShmList;
|
||||
pDesc->prev = &ShmList;
|
||||
ShmList = pDesc;
|
||||
|
|
@ -215,15 +210,15 @@ shmalloc(
|
|||
}
|
||||
|
||||
static void
|
||||
shmdealloc(
|
||||
ShmDescPtr pDesc)
|
||||
shmdealloc(ShmDescPtr pDesc)
|
||||
{
|
||||
#ifndef EARLY_REMOVE
|
||||
shmctl(pDesc->shmid, IPC_RMID, (void *) 0);
|
||||
#endif
|
||||
shmdt(pDesc->attach_addr);
|
||||
|
||||
if (pDesc->next) pDesc->next->prev = pDesc->prev;
|
||||
if (pDesc->next)
|
||||
pDesc->next->prev = pDesc->prev;
|
||||
*pDesc->prev = pDesc->next;
|
||||
free(pDesc);
|
||||
}
|
||||
|
|
@ -232,8 +227,7 @@ shmdealloc(
|
|||
|
||||
/* Called when a font is closed. */
|
||||
void
|
||||
XF86BigfontFreeFontShm(
|
||||
FontPtr pFont)
|
||||
XF86BigfontFreeFontShm(FontPtr pFont)
|
||||
{
|
||||
#ifdef HAS_SHM
|
||||
ShmDescPtr pDesc;
|
||||
|
|
@ -262,8 +256,7 @@ XF86BigfontCleanup(void)
|
|||
|
||||
/* Called when a server generation dies. */
|
||||
static void
|
||||
XF86BigfontResetProc(
|
||||
ExtensionEntry* extEntry)
|
||||
XF86BigfontResetProc(ExtensionEntry * extEntry)
|
||||
{
|
||||
/* This function is normally called from CloseDownExtensions(), called
|
||||
* from main(). It will be followed by a call to FreeAllResources(),
|
||||
|
|
@ -276,12 +269,10 @@ XF86BigfontResetProc(
|
|||
XF86BigfontCleanup();
|
||||
}
|
||||
|
||||
|
||||
/* ========== Handling of extension specific requests ========== */
|
||||
|
||||
static int
|
||||
ProcXF86BigfontQueryVersion(
|
||||
ClientPtr client)
|
||||
ProcXF86BigfontQueryVersion(ClientPtr client)
|
||||
{
|
||||
xXF86BigfontQueryVersionReply reply;
|
||||
|
||||
|
|
@ -307,6 +298,7 @@ ProcXF86BigfontQueryVersion(
|
|||
; /* may add more bits here in future versions */
|
||||
if (client->swapped) {
|
||||
char tmp;
|
||||
|
||||
swaps(&reply.sequenceNumber);
|
||||
swapl(&reply.length);
|
||||
swaps(&reply.majorVersion);
|
||||
|
|
@ -321,8 +313,7 @@ ProcXF86BigfontQueryVersion(
|
|||
}
|
||||
|
||||
static void
|
||||
swapCharInfo(
|
||||
xCharInfo *pCI)
|
||||
swapCharInfo(xCharInfo * pCI)
|
||||
{
|
||||
char tmp;
|
||||
|
||||
|
|
@ -342,16 +333,17 @@ swapCharInfo(
|
|||
(p->ascent << 11) + (p->descent << 6)) ^ p->attributes)
|
||||
|
||||
static int
|
||||
ProcXF86BigfontQueryFont(
|
||||
ClientPtr client)
|
||||
ProcXF86BigfontQueryFont(ClientPtr client)
|
||||
{
|
||||
FontPtr pFont;
|
||||
|
||||
REQUEST(xXF86BigfontQueryFontReq);
|
||||
CARD32 stuff_flags;
|
||||
xCharInfo *pmax;
|
||||
xCharInfo *pmin;
|
||||
int nCharInfos;
|
||||
int shmid;
|
||||
|
||||
#ifdef HAS_SHM
|
||||
ShmDescPtr pDesc = NULL;
|
||||
#else
|
||||
|
|
@ -367,7 +359,8 @@ ProcXF86BigfontQueryFont(
|
|||
#else
|
||||
switch (client->req_len) {
|
||||
case 2: /* client with version 1.0 libX11 */
|
||||
stuff_flags = (LocalClient(client) && !client->swapped ? XF86Bigfont_FLAGS_Shm : 0);
|
||||
stuff_flags = (LocalClient(client) &&
|
||||
!client->swapped ? XF86Bigfont_FLAGS_Shm : 0);
|
||||
break;
|
||||
case 3: /* client with version 1.1 libX11 */
|
||||
stuff_flags = stuff->flags;
|
||||
|
|
@ -376,7 +369,8 @@ ProcXF86BigfontQueryFont(
|
|||
return BadLength;
|
||||
}
|
||||
#endif
|
||||
if (dixLookupFontable(&pFont, stuff->id, client, DixGetAttrAccess) != Success)
|
||||
if (dixLookupFontable(&pFont, stuff->id, client, DixGetAttrAccess) !=
|
||||
Success)
|
||||
return BadFont; /* procotol spec says only error is BadFont */
|
||||
|
||||
pmax = FONTINKMAX(pFont);
|
||||
|
|
@ -402,14 +396,16 @@ ProcXF86BigfontQueryFont(
|
|||
pCI = (xCharInfo *) pDesc->attach_addr;
|
||||
if (stuff_flags & XF86Bigfont_FLAGS_Shm)
|
||||
shmid = pDesc->shmid;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if (stuff_flags & XF86Bigfont_FLAGS_Shm && !badSysCall)
|
||||
pDesc = shmalloc(nCharInfos * sizeof(xCharInfo)
|
||||
+ sizeof(CARD32));
|
||||
if (pDesc) {
|
||||
pCI = (xCharInfo *) pDesc->attach_addr;
|
||||
shmid = pDesc->shmid;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
#endif
|
||||
pCI = malloc(nCharInfos * sizeof(xCharInfo));
|
||||
if (!pCI)
|
||||
|
|
@ -423,18 +419,18 @@ ProcXF86BigfontQueryFont(
|
|||
int ninfos = 0;
|
||||
int ncols = pFont->info.lastCol - pFont->info.firstCol + 1;
|
||||
int row;
|
||||
|
||||
for (row = pFont->info.firstRow;
|
||||
row <= pFont->info.lastRow && ninfos < nCharInfos;
|
||||
row++) {
|
||||
row <= pFont->info.lastRow && ninfos < nCharInfos; row++) {
|
||||
unsigned char chars[512];
|
||||
xCharInfo *tmpCharInfos[256];
|
||||
unsigned long count;
|
||||
int col;
|
||||
unsigned long i;
|
||||
|
||||
i = 0;
|
||||
for (col = pFont->info.firstCol;
|
||||
col <= pFont->info.lastCol;
|
||||
col++) {
|
||||
col <= pFont->info.lastCol; col++) {
|
||||
chars[i++] = row;
|
||||
chars[i++] = col;
|
||||
}
|
||||
|
|
@ -475,7 +471,8 @@ ProcXF86BigfontQueryFont(
|
|||
|
||||
tmp = malloc((4 * nCharInfos + 1) * sizeof(CARD16));
|
||||
if (!tmp) {
|
||||
if (!pDesc) free(pCI);
|
||||
if (!pDesc)
|
||||
free(pCI);
|
||||
return BadAlloc;
|
||||
}
|
||||
pIndex2UniqIndex = tmp;
|
||||
|
|
@ -499,9 +496,9 @@ ProcXF86BigfontQueryFont(
|
|||
for (NextIndex = 0; NextIndex < nCharInfos; NextIndex++) {
|
||||
xCharInfo *p = &pCI[NextIndex];
|
||||
CARD32 hashCode = hashCI(p) % hashModulus;
|
||||
|
||||
for (i = pHash2UniqIndex[hashCode];
|
||||
i != (CARD16)(-1);
|
||||
i = pUniqIndex2NextUniqIndex[i]) {
|
||||
i != (CARD16) (-1); i = pUniqIndex2NextUniqIndex[i]) {
|
||||
j = pUniqIndex2Index[i];
|
||||
if (pCI[j].leftSideBearing == p->leftSideBearing
|
||||
&& pCI[j].rightSideBearing == p->rightSideBearing
|
||||
|
|
@ -514,7 +511,8 @@ ProcXF86BigfontQueryFont(
|
|||
if (i != (CARD16) (-1)) {
|
||||
/* Found *p at Index j, UniqIndex i */
|
||||
pIndex2UniqIndex[NextIndex] = i;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
/* Allocate a new entry in the Uniq table */
|
||||
if (hashModulus <= 2 * NextUniqIndex
|
||||
&& hashModulus < nCharInfos + 1) {
|
||||
|
|
@ -530,7 +528,8 @@ ProcXF86BigfontQueryFont(
|
|||
j = pUniqIndex2Index[i];
|
||||
p = &pCI[j];
|
||||
hashCode = hashCI(p) % hashModulus;
|
||||
pUniqIndex2NextUniqIndex[i] = pHash2UniqIndex[hashCode];
|
||||
pUniqIndex2NextUniqIndex[i] =
|
||||
pHash2UniqIndex[hashCode];
|
||||
pHash2UniqIndex[hashCode] = i;
|
||||
}
|
||||
p = &pCI[NextIndex];
|
||||
|
|
@ -550,8 +549,7 @@ ProcXF86BigfontQueryFont(
|
|||
|
||||
{
|
||||
int nfontprops = pFont->info.nprops;
|
||||
int rlength =
|
||||
sizeof(xXF86BigfontQueryFontReply)
|
||||
int rlength = sizeof(xXF86BigfontQueryFontReply)
|
||||
+ nfontprops * sizeof(xFontProp)
|
||||
+ (nCharInfos > 0 && shmid == -1
|
||||
? nUniqCharInfos * sizeof(xCharInfo)
|
||||
|
|
@ -559,10 +557,13 @@ ProcXF86BigfontQueryFont(
|
|||
: 0);
|
||||
xXF86BigfontQueryFontReply *reply = malloc(rlength);
|
||||
char *p;
|
||||
|
||||
if (!reply) {
|
||||
if (nCharInfos > 0) {
|
||||
if (shmid == -1) free(pIndex2UniqIndex);
|
||||
if (!pDesc) free(pCI);
|
||||
if (shmid == -1)
|
||||
free(pIndex2UniqIndex);
|
||||
if (!pDesc)
|
||||
free(pCI);
|
||||
}
|
||||
return BadAlloc;
|
||||
}
|
||||
|
|
@ -587,6 +588,7 @@ ProcXF86BigfontQueryFont(
|
|||
reply->shmsegoffset = 0;
|
||||
if (client->swapped) {
|
||||
char tmp;
|
||||
|
||||
swaps(&reply->sequenceNumber);
|
||||
swapl(&reply->length);
|
||||
swapCharInfo(&reply->minBounds);
|
||||
|
|
@ -607,13 +609,14 @@ ProcXF86BigfontQueryFont(
|
|||
FontPropPtr pFP;
|
||||
xFontProp *prFP;
|
||||
int i;
|
||||
|
||||
for (i = 0, pFP = pFont->info.props, prFP = (xFontProp *) p;
|
||||
i < nfontprops;
|
||||
i++, pFP++, prFP++) {
|
||||
i < nfontprops; i++, pFP++, prFP++) {
|
||||
prFP->name = pFP->name;
|
||||
prFP->value = pFP->value;
|
||||
if (client->swapped) {
|
||||
char tmp;
|
||||
|
||||
swapl(&prFP->name);
|
||||
swapl(&prFP->value);
|
||||
}
|
||||
|
|
@ -624,6 +627,7 @@ ProcXF86BigfontQueryFont(
|
|||
xCharInfo *pci;
|
||||
CARD16 *ps;
|
||||
int i, j;
|
||||
|
||||
pci = (xCharInfo *) p;
|
||||
for (i = 0; i < nUniqCharInfos; i++, pci++) {
|
||||
*pci = pCI[pUniqIndex2Index[i]];
|
||||
|
|
@ -635,6 +639,7 @@ ProcXF86BigfontQueryFont(
|
|||
*ps = pIndex2UniqIndex[j];
|
||||
if (client->swapped) {
|
||||
char tmp;
|
||||
|
||||
swaps(ps);
|
||||
}
|
||||
}
|
||||
|
|
@ -642,16 +647,17 @@ ProcXF86BigfontQueryFont(
|
|||
WriteToClient(client, rlength, (char *) reply);
|
||||
free(reply);
|
||||
if (nCharInfos > 0) {
|
||||
if (shmid == -1) free(pIndex2UniqIndex);
|
||||
if (!pDesc) free(pCI);
|
||||
if (shmid == -1)
|
||||
free(pIndex2UniqIndex);
|
||||
if (!pDesc)
|
||||
free(pCI);
|
||||
}
|
||||
return Success;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
ProcXF86BigfontDispatch(
|
||||
ClientPtr client)
|
||||
ProcXF86BigfontDispatch(ClientPtr client)
|
||||
{
|
||||
REQUEST(xReq);
|
||||
|
||||
|
|
@ -666,8 +672,7 @@ ProcXF86BigfontDispatch(
|
|||
}
|
||||
|
||||
static int
|
||||
SProcXF86BigfontQueryVersion(
|
||||
ClientPtr client)
|
||||
SProcXF86BigfontQueryVersion(ClientPtr client)
|
||||
{
|
||||
REQUEST(xXF86BigfontQueryVersionReq);
|
||||
char tmp;
|
||||
|
|
@ -677,8 +682,7 @@ SProcXF86BigfontQueryVersion(
|
|||
}
|
||||
|
||||
static int
|
||||
SProcXF86BigfontQueryFont(
|
||||
ClientPtr client)
|
||||
SProcXF86BigfontQueryFont(ClientPtr client)
|
||||
{
|
||||
REQUEST(xXF86BigfontQueryFontReq);
|
||||
char tmp;
|
||||
|
|
@ -690,8 +694,7 @@ SProcXF86BigfontQueryFont(
|
|||
}
|
||||
|
||||
static int
|
||||
SProcXF86BigfontDispatch(
|
||||
ClientPtr client)
|
||||
SProcXF86BigfontDispatch(ClientPtr client)
|
||||
{
|
||||
REQUEST(xReq);
|
||||
|
||||
|
|
@ -713,8 +716,7 @@ XFree86BigfontExtensionInit(void)
|
|||
XF86BigfontNumberErrors,
|
||||
ProcXF86BigfontDispatch,
|
||||
SProcXF86BigfontDispatch,
|
||||
XF86BigfontResetProc,
|
||||
StandardMinorOpcode)) {
|
||||
XF86BigfontResetProc, StandardMinorOpcode)) {
|
||||
#ifdef HAS_SHM
|
||||
#ifdef MUST_CHECK_FOR_SHM_SYSCALL
|
||||
/*
|
||||
|
|
@ -724,7 +726,8 @@ XFree86BigfontExtensionInit(void)
|
|||
* when shared memory support is not functional.
|
||||
*/
|
||||
if (!CheckForShmSyscall()) {
|
||||
ErrorF(XF86BIGFONTNAME " extension local-client optimization disabled due to lack of shared memory support in the kernel\n");
|
||||
ErrorF(XF86BIGFONTNAME
|
||||
" extension local-client optimization disabled due to lack of shared memory support in the kernel\n");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
26
Xext/xres.c
26
Xext/xres.c
|
|
@ -97,7 +97,6 @@ ProcXResQueryClients (ClientPtr client)
|
|||
return Success;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ResFindAllRes(pointer value, XID id, RESTYPE type, pointer cdata)
|
||||
{
|
||||
|
|
@ -130,7 +129,8 @@ ProcXResQueryClientResources (ClientPtr client)
|
|||
num_types = 0;
|
||||
|
||||
for (i = 0; i <= lastResourceType; i++) {
|
||||
if(counts[i]) num_types++;
|
||||
if (counts[i])
|
||||
num_types++;
|
||||
}
|
||||
|
||||
rep.type = X_Reply;
|
||||
|
|
@ -143,20 +143,23 @@ ProcXResQueryClientResources (ClientPtr client)
|
|||
swapl(&rep.num_types);
|
||||
}
|
||||
|
||||
WriteToClient (client,sizeof(xXResQueryClientResourcesReply),(char*)&rep);
|
||||
WriteToClient(client, sizeof(xXResQueryClientResourcesReply),
|
||||
(char *) &rep);
|
||||
|
||||
if (num_types) {
|
||||
xXResType scratch;
|
||||
const char *name;
|
||||
|
||||
for (i = 0; i < lastResourceType; i++) {
|
||||
if(!counts[i]) continue;
|
||||
if (!counts[i])
|
||||
continue;
|
||||
|
||||
name = LookupResourceName(i + 1);
|
||||
if (strcmp(name, XREGISTRY_UNKNOWN))
|
||||
scratch.resource_type = MakeAtom(name, strlen(name), TRUE);
|
||||
else {
|
||||
char buf[40];
|
||||
|
||||
snprintf(buf, sizeof(buf), "Unregistered resource %i", i + 1);
|
||||
scratch.resource_type = MakeAtom(buf, strlen(buf), TRUE);
|
||||
}
|
||||
|
|
@ -252,15 +255,13 @@ ProcXResQueryClientPixmapBytes (ClientPtr client)
|
|||
* Make sure win background pixmaps also held to account.
|
||||
*/
|
||||
FindClientResourcesByType(clients[clientID], RT_WINDOW,
|
||||
ResFindWindowPixmaps,
|
||||
(pointer)(&bytes));
|
||||
ResFindWindowPixmaps, (pointer) (&bytes));
|
||||
|
||||
/*
|
||||
* GC Tile & Stipple pixmaps too.
|
||||
*/
|
||||
FindClientResourcesByType(clients[clientID], RT_GC,
|
||||
ResFindGCPixmaps,
|
||||
(pointer)(&bytes));
|
||||
ResFindGCPixmaps, (pointer) (&bytes));
|
||||
|
||||
#ifdef COMPOSITE
|
||||
/* FIXME: include composite pixmaps too */
|
||||
|
|
@ -281,7 +282,8 @@ ProcXResQueryClientPixmapBytes (ClientPtr client)
|
|||
swapl(&rep.bytes);
|
||||
swapl(&rep.bytes_overflow);
|
||||
}
|
||||
WriteToClient (client,sizeof(xXResQueryClientPixmapBytesReply),(char*)&rep);
|
||||
WriteToClient(client, sizeof(xXResQueryClientPixmapBytesReply),
|
||||
(char *) &rep);
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
|
@ -299,7 +301,8 @@ ProcResDispatch (ClientPtr client)
|
|||
return ProcXResQueryClientResources(client);
|
||||
case X_XResQueryClientPixmapBytes:
|
||||
return ProcXResQueryClientPixmapBytes(client);
|
||||
default: break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return BadRequest;
|
||||
|
|
@ -346,7 +349,8 @@ SProcResDispatch (ClientPtr client)
|
|||
return SProcXResQueryClientResources(client);
|
||||
case X_XResQueryClientPixmapBytes:
|
||||
return SProcXResQueryClientPixmapBytes(client);
|
||||
default: break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return BadRequest;
|
||||
|
|
|
|||
|
|
@ -44,7 +44,6 @@ typedef struct {
|
|||
CARD32 id;
|
||||
} SELinuxListItemRec;
|
||||
|
||||
|
||||
/*
|
||||
* Extension Dispatch
|
||||
*/
|
||||
|
|
@ -53,6 +52,7 @@ static security_context_t
|
|||
SELinuxCopyContext(char *ptr, unsigned len)
|
||||
{
|
||||
security_context_t copy = malloc(len + 1);
|
||||
|
||||
if (!copy)
|
||||
return NULL;
|
||||
strncpy(copy, ptr, len);
|
||||
|
|
@ -326,6 +326,7 @@ static void
|
|||
SELinuxFreeItems(SELinuxListItemRec * items, int count)
|
||||
{
|
||||
int k;
|
||||
|
||||
for (k = 0; k < count; k++) {
|
||||
freecon(items[k].octx);
|
||||
freecon(items[k].dctx);
|
||||
|
|
@ -670,7 +671,6 @@ SProcSELinuxDispatch(ClientPtr client)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Extension Setup / Teardown
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -45,7 +45,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#define _XSELINUX_NEED_FLASK_MAP
|
||||
#include "xselinuxint.h"
|
||||
|
||||
|
||||
/* structure passed to auditing callback */
|
||||
typedef struct {
|
||||
ClientPtr client; /* client */
|
||||
|
|
@ -80,7 +79,6 @@ static void SELinuxScreen(CallbackListPtr *, pointer, pointer);
|
|||
/* "true" pointer value for use as callback data */
|
||||
static pointer truep = (pointer) 1;
|
||||
|
||||
|
||||
/*
|
||||
* Performs an SELinux permission check.
|
||||
*/
|
||||
|
|
@ -133,11 +131,12 @@ SELinuxLabelClient(ClientPtr client)
|
|||
/* Get cached command name if CLIENTIDS is enabled. */
|
||||
const char *cmdname = GetClientCmdName(client);
|
||||
Bool cached = (cmdname != NULL);
|
||||
|
||||
/* If CLIENTIDS is disabled, figure out the command name from
|
||||
* scratch. */
|
||||
if (!cmdname)
|
||||
{
|
||||
if (!cmdname) {
|
||||
pid_t pid = DetermineClientPid(client);
|
||||
|
||||
if (pid != -1)
|
||||
DetermineClientCmd(pid, &cmdname, NULL);
|
||||
}
|
||||
|
|
@ -228,8 +227,10 @@ SELinuxLabelResource(XaceResourceAccessRec *rec, SELinuxSubjectRec *subj,
|
|||
/* Use the SID of the parent object in the labeling operation */
|
||||
PrivateRec **privatePtr = DEVPRIV_AT(rec->parent, offset);
|
||||
SELinuxObjectRec *pobj = dixLookupPrivate(privatePtr, objectKey);
|
||||
|
||||
tsid = pobj->sid;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
/* Use the SID of the subject */
|
||||
tsid = subj->sid;
|
||||
}
|
||||
|
|
@ -243,16 +244,13 @@ SELinuxLabelResource(XaceResourceAccessRec *rec, SELinuxSubjectRec *subj,
|
|||
return Success;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Libselinux Callbacks
|
||||
*/
|
||||
|
||||
static int
|
||||
SELinuxAudit(void *auditdata,
|
||||
security_class_t class,
|
||||
char *msgbuf,
|
||||
size_t msgbufsize)
|
||||
security_class_t class, char *msgbuf, size_t msgbufsize)
|
||||
{
|
||||
SELinuxAuditRec *audit = auditdata;
|
||||
ClientPtr client = audit->client;
|
||||
|
|
@ -343,13 +341,15 @@ SELinuxDevice(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
|||
/* If this is a new object that needs labeling, do it now */
|
||||
if (rec->access_mode & DixCreateAccess) {
|
||||
SELinuxSubjectRec *dsubj;
|
||||
|
||||
dsubj = dixLookupPrivate(&rec->dev->devPrivates, subjectKey);
|
||||
|
||||
if (subj->dev_create_sid) {
|
||||
/* Label the device with the create context */
|
||||
obj->sid = subj->dev_create_sid;
|
||||
dsubj->sid = subj->dev_create_sid;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
/* Label the device directly with the process SID */
|
||||
obj->sid = subj->sid;
|
||||
dsubj->sid = subj->sid;
|
||||
|
|
@ -628,7 +628,8 @@ SELinuxResource(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
|||
class = SECCLASS_X_RESOURCE;
|
||||
privatePtr = &clients[CLIENT_ID(rec->id)]->devPrivates;
|
||||
obj = dixLookupPrivate(privatePtr, objectKey);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
/* Yes: use the SID from the resource object itself */
|
||||
class = SELinuxTypeToClass(rec->rtype);
|
||||
privatePtr = DEVPRIV_AT(rec->res, offset);
|
||||
|
|
@ -733,7 +734,6 @@ SELinuxServer(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
|||
rec->status = rc;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* DIX Callbacks
|
||||
*/
|
||||
|
|
@ -772,6 +772,7 @@ SELinuxResourceState(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
|||
if (subj->sid) {
|
||||
security_context_t ctx;
|
||||
int rc = avc_sid_to_context_raw(subj->sid, &ctx);
|
||||
|
||||
if (rc < 0)
|
||||
FatalError("SELinux: Failed to get security context!\n");
|
||||
rc = dixChangeWindowProperty(serverClient,
|
||||
|
|
@ -780,7 +781,8 @@ SELinuxResourceState(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
|||
if (rc != Success)
|
||||
FatalError("SELinux: Failed to set label property on window!\n");
|
||||
freecon(ctx);
|
||||
} else
|
||||
}
|
||||
else
|
||||
FatalError("SELinux: Unexpected unlabeled client found\n");
|
||||
|
||||
obj = dixLookupPrivate(&pWin->devPrivates, objectKey);
|
||||
|
|
@ -788,6 +790,7 @@ SELinuxResourceState(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
|||
if (obj->sid) {
|
||||
security_context_t ctx;
|
||||
int rc = avc_sid_to_context_raw(obj->sid, &ctx);
|
||||
|
||||
if (rc < 0)
|
||||
FatalError("SELinux: Failed to get security context!\n");
|
||||
rc = dixChangeWindowProperty(serverClient,
|
||||
|
|
@ -796,11 +799,11 @@ SELinuxResourceState(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
|||
if (rc != Success)
|
||||
FatalError("SELinux: Failed to set label property on window!\n");
|
||||
freecon(ctx);
|
||||
} else
|
||||
}
|
||||
else
|
||||
FatalError("SELinux: Unexpected unlabeled window found\n");
|
||||
}
|
||||
|
||||
|
||||
static int netlink_fd;
|
||||
|
||||
static void
|
||||
|
|
@ -868,11 +871,13 @@ SELinuxFlaskInit(void)
|
|||
|
||||
/* Set up SELinux stuff */
|
||||
selinux_set_callback(SELINUX_CB_LOG, (union selinux_callback) SELinuxLog);
|
||||
selinux_set_callback(SELINUX_CB_AUDIT, (union selinux_callback)SELinuxAudit);
|
||||
selinux_set_callback(SELINUX_CB_AUDIT,
|
||||
(union selinux_callback) SELinuxAudit);
|
||||
|
||||
if (selinux_set_mapping(map) < 0) {
|
||||
if (errno == EINVAL) {
|
||||
ErrorF("SELinux: Invalid object class mapping, disabling SELinux support.\n");
|
||||
ErrorF
|
||||
("SELinux: Invalid object class mapping, disabling SELinux support.\n");
|
||||
return;
|
||||
}
|
||||
FatalError("SELinux: Failed to set up security class mapping\n");
|
||||
|
|
@ -893,9 +898,12 @@ SELinuxFlaskInit(void)
|
|||
FatalError("SELinux: Failed to open the system audit log\n");
|
||||
|
||||
/* Allocate private storage */
|
||||
if (!dixRegisterPrivateKey(subjectKey, PRIVATE_XSELINUX, sizeof(SELinuxSubjectRec)) ||
|
||||
!dixRegisterPrivateKey(objectKey, PRIVATE_XSELINUX, sizeof(SELinuxObjectRec)) ||
|
||||
!dixRegisterPrivateKey(dataKey, PRIVATE_XSELINUX, sizeof(SELinuxObjectRec)))
|
||||
if (!dixRegisterPrivateKey
|
||||
(subjectKey, PRIVATE_XSELINUX, sizeof(SELinuxSubjectRec)) ||
|
||||
!dixRegisterPrivateKey(objectKey, PRIVATE_XSELINUX,
|
||||
sizeof(SELinuxObjectRec)) ||
|
||||
!dixRegisterPrivateKey(dataKey, PRIVATE_XSELINUX,
|
||||
sizeof(SELinuxObjectRec)))
|
||||
FatalError("SELinux: Failed to allocate private storage.\n");
|
||||
|
||||
/* Create atoms for doing window labeling */
|
||||
|
|
|
|||
|
|
@ -43,8 +43,10 @@ static struct selabel_handle *label_hnd;
|
|||
|
||||
/* Array of object classes indexed by resource type */
|
||||
SELinuxArrayRec arr_types;
|
||||
|
||||
/* Array of event SIDs indexed by event type */
|
||||
SELinuxArrayRec arr_events;
|
||||
|
||||
/* Array of property and selection SID structures */
|
||||
SELinuxArrayRec arr_atoms;
|
||||
|
||||
|
|
@ -78,6 +80,7 @@ SELinuxArrayFree(SELinuxArrayRec *rec, int free_elements)
|
|||
{
|
||||
if (free_elements) {
|
||||
unsigned i = rec->size;
|
||||
|
||||
while (i)
|
||||
free(rec->array[--i]);
|
||||
}
|
||||
|
|
@ -102,10 +105,12 @@ SELinuxAtomToSIDLookup(Atom atom, SELinuxObjectRec *obj, int map, int polymap)
|
|||
/* Look in the mappings of names to contexts */
|
||||
if (selabel_lookup_raw(label_hnd, &ctx, name, map) == 0) {
|
||||
obj->poly = 0;
|
||||
} else if (errno != ENOENT) {
|
||||
}
|
||||
else if (errno != ENOENT) {
|
||||
ErrorF("SELinux: a property label lookup failed!\n");
|
||||
return BadValue;
|
||||
} else if (selabel_lookup_raw(label_hnd, &ctx, name, polymap) < 0) {
|
||||
}
|
||||
else if (selabel_lookup_raw(label_hnd, &ctx, name, polymap) < 0) {
|
||||
ErrorF("SELinux: a property label lookup failed!\n");
|
||||
return BadValue;
|
||||
}
|
||||
|
|
@ -141,7 +146,8 @@ SELinuxAtomToSID(Atom atom, int prop, SELinuxObjectRec **obj_rtn)
|
|||
obj = &rec->prp;
|
||||
map = SELABEL_X_PROP;
|
||||
polymap = SELABEL_X_POLYPROP;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
obj = &rec->sel;
|
||||
map = SELABEL_X_SELN;
|
||||
polymap = SELABEL_X_POLYSELN;
|
||||
|
|
@ -219,8 +225,7 @@ SELinuxPropertyToSID(Atom property, SELinuxSubjectRec *subj,
|
|||
}
|
||||
|
||||
/* Perform a transition */
|
||||
if (avc_compute_create(subj->sid, obj->sid,
|
||||
SECCLASS_X_PROPERTY, &tsid) < 0) {
|
||||
if (avc_compute_create(subj->sid, obj->sid, SECCLASS_X_PROPERTY, &tsid) < 0) {
|
||||
ErrorF("SELinux: a compute_create call failed!\n");
|
||||
return BadValue;
|
||||
}
|
||||
|
|
@ -251,6 +256,7 @@ SELinuxEventToSID(unsigned type, security_id_t sid_of_window,
|
|||
const char *name = LookupEventName(type);
|
||||
security_id_t sid;
|
||||
security_context_t ctx;
|
||||
|
||||
type &= 127;
|
||||
|
||||
sid = SELinuxArrayGet(&arr_events, type);
|
||||
|
|
@ -327,6 +333,7 @@ SELinuxTypeToClass(RESTYPE type)
|
|||
else {
|
||||
/* Need to do a string lookup */
|
||||
const char *str = LookupResourceName(type);
|
||||
|
||||
if (!strcmp(str, "PICTURE"))
|
||||
class = SECCLASS_X_DRAWABLE;
|
||||
else if (!strcmp(str, "GLYPHSET"))
|
||||
|
|
|
|||
|
|
@ -63,10 +63,13 @@ typedef struct {
|
|||
*/
|
||||
|
||||
extern DevPrivateKeyRec subjectKeyRec;
|
||||
|
||||
#define subjectKey (&subjectKeyRec)
|
||||
extern DevPrivateKeyRec objectKeyRec;
|
||||
|
||||
#define objectKey (&objectKeyRec)
|
||||
extern DevPrivateKeyRec dataKeyRec;
|
||||
|
||||
#define dataKey (&dataKeyRec)
|
||||
|
||||
/*
|
||||
|
|
@ -77,25 +80,26 @@ int
|
|||
SELinuxAtomToSID(Atom atom, int prop, SELinuxObjectRec ** obj_rtn);
|
||||
|
||||
int
|
||||
|
||||
SELinuxSelectionToSID(Atom selection, SELinuxSubjectRec * subj,
|
||||
security_id_t * sid_rtn, int *poly_rtn);
|
||||
|
||||
int
|
||||
|
||||
SELinuxPropertyToSID(Atom property, SELinuxSubjectRec * subj,
|
||||
security_id_t * sid_rtn, int *poly_rtn);
|
||||
|
||||
int
|
||||
|
||||
SELinuxEventToSID(unsigned type, security_id_t sid_of_window,
|
||||
SELinuxObjectRec * sid_return);
|
||||
|
||||
int
|
||||
SELinuxExtensionToSID(const char *name, security_id_t * sid_rtn);
|
||||
|
||||
security_class_t
|
||||
SELinuxTypeToClass(RESTYPE type);
|
||||
security_class_t SELinuxTypeToClass(RESTYPE type);
|
||||
|
||||
security_context_t
|
||||
SELinuxDefaultClientLabel(void);
|
||||
security_context_t SELinuxDefaultClientLabel(void);
|
||||
|
||||
void
|
||||
SELinuxLabelInit(void);
|
||||
|
|
@ -113,7 +117,6 @@ SELinuxFlaskInit(void);
|
|||
void
|
||||
SELinuxFlaskReset(void);
|
||||
|
||||
|
||||
/*
|
||||
* Private Flask definitions
|
||||
*/
|
||||
|
|
|
|||
151
Xext/xtest.c
151
Xext/xtest.c
|
|
@ -81,12 +81,10 @@ DeviceIntPtr xtestpointer, xtestkeyboard;
|
|||
#include "panoramiXsrv.h"
|
||||
#endif
|
||||
|
||||
static int XTestSwapFakeInput(
|
||||
ClientPtr /* client */,
|
||||
static int XTestSwapFakeInput(ClientPtr /* client */ ,
|
||||
xReq * /* req */
|
||||
);
|
||||
|
||||
|
||||
static int
|
||||
ProcXTestGetVersion(ClientPtr client)
|
||||
{
|
||||
|
|
@ -125,10 +123,9 @@ ProcXTestCompareCursor(ClientPtr client)
|
|||
else if (stuff->cursor == XTestCurrentCursor)
|
||||
pCursor = GetSpriteCursor(ptr);
|
||||
else {
|
||||
rc = dixLookupResourceByType((pointer *)&pCursor, stuff->cursor, RT_CURSOR,
|
||||
client, DixReadAccess);
|
||||
if (rc != Success)
|
||||
{
|
||||
rc = dixLookupResourceByType((pointer *) &pCursor, stuff->cursor,
|
||||
RT_CURSOR, client, DixReadAccess);
|
||||
if (rc != Success) {
|
||||
client->errorValue = stuff->cursor;
|
||||
return rc;
|
||||
}
|
||||
|
|
@ -172,15 +169,13 @@ ProcXTestFakeInput(ClientPtr client)
|
|||
ev = (xEvent *) &((xReq *) stuff)[1];
|
||||
type = ev->u.u.type & 0177;
|
||||
|
||||
if (type >= EXTENSION_EVENT_BASE)
|
||||
{
|
||||
if (type >= EXTENSION_EVENT_BASE) {
|
||||
extension = TRUE;
|
||||
|
||||
/* check device */
|
||||
rc = dixLookupDevice(&dev, stuff->deviceid & 0177, client,
|
||||
DixWriteAccess);
|
||||
if (rc != Success)
|
||||
{
|
||||
if (rc != Success) {
|
||||
client->errorValue = stuff->deviceid & 0177;
|
||||
return rc;
|
||||
}
|
||||
|
|
@ -190,31 +185,27 @@ ProcXTestFakeInput(ClientPtr client)
|
|||
switch (type) {
|
||||
case XI_DeviceKeyPress:
|
||||
case XI_DeviceKeyRelease:
|
||||
if (!dev->key)
|
||||
{
|
||||
if (!dev->key) {
|
||||
client->errorValue = ev->u.u.type;
|
||||
return BadValue;
|
||||
}
|
||||
break;
|
||||
case XI_DeviceButtonPress:
|
||||
case XI_DeviceButtonRelease:
|
||||
if (!dev->button)
|
||||
{
|
||||
if (!dev->button) {
|
||||
client->errorValue = ev->u.u.type;
|
||||
return BadValue;
|
||||
}
|
||||
break;
|
||||
case XI_DeviceMotionNotify:
|
||||
if (!dev->valuator)
|
||||
{
|
||||
if (!dev->valuator) {
|
||||
client->errorValue = ev->u.u.type;
|
||||
return BadValue;
|
||||
}
|
||||
break;
|
||||
case XI_ProximityIn:
|
||||
case XI_ProximityOut:
|
||||
if (!dev->proximity)
|
||||
{
|
||||
if (!dev->proximity) {
|
||||
client->errorValue = ev->u.u.type;
|
||||
return BadValue;
|
||||
}
|
||||
|
|
@ -228,53 +219,51 @@ ProcXTestFakeInput(ClientPtr client)
|
|||
if (nev == 1 && type == XI_DeviceMotionNotify)
|
||||
return BadLength; /* DevMotion must be followed by DevValuator */
|
||||
|
||||
if (type == XI_DeviceMotionNotify)
|
||||
{
|
||||
if (type == XI_DeviceMotionNotify) {
|
||||
firstValuator = ((deviceValuator *) (ev + 1))->first_valuator;
|
||||
if (firstValuator > dev->valuator->numAxes)
|
||||
{
|
||||
if (firstValuator > dev->valuator->numAxes) {
|
||||
client->errorValue = ev->u.u.type;
|
||||
return BadValue;
|
||||
}
|
||||
|
||||
if (ev->u.u.detail == xFalse)
|
||||
flags |= POINTER_ABSOLUTE;
|
||||
} else
|
||||
{
|
||||
}
|
||||
else {
|
||||
firstValuator = 0;
|
||||
flags |= POINTER_ABSOLUTE;
|
||||
}
|
||||
|
||||
if (nev > 1 && !dev->valuator)
|
||||
{
|
||||
if (nev > 1 && !dev->valuator) {
|
||||
client->errorValue = dv->first_valuator;
|
||||
return BadValue;
|
||||
}
|
||||
|
||||
|
||||
/* check validity of valuator events */
|
||||
base = firstValuator;
|
||||
for (n = 1; n < nev; n++)
|
||||
{
|
||||
for (n = 1; n < nev; n++) {
|
||||
dv = (deviceValuator *) (ev + n);
|
||||
if (dv->type != DeviceValuator)
|
||||
{
|
||||
if (dv->type != DeviceValuator) {
|
||||
client->errorValue = dv->type;
|
||||
return BadValue;
|
||||
}
|
||||
if (dv->first_valuator != base)
|
||||
{
|
||||
if (dv->first_valuator != base) {
|
||||
client->errorValue = dv->first_valuator;
|
||||
return BadValue;
|
||||
}
|
||||
switch(dv->num_valuators)
|
||||
{
|
||||
case 6: valuators[base + 5] = dv->valuator5;
|
||||
case 5: valuators[base + 4] = dv->valuator4;
|
||||
case 4: valuators[base + 3] = dv->valuator3;
|
||||
case 3: valuators[base + 2] = dv->valuator2;
|
||||
case 2: valuators[base + 1] = dv->valuator1;
|
||||
case 1: valuators[base] = dv->valuator0;
|
||||
switch (dv->num_valuators) {
|
||||
case 6:
|
||||
valuators[base + 5] = dv->valuator5;
|
||||
case 5:
|
||||
valuators[base + 4] = dv->valuator4;
|
||||
case 4:
|
||||
valuators[base + 3] = dv->valuator3;
|
||||
case 3:
|
||||
valuators[base + 2] = dv->valuator2;
|
||||
case 2:
|
||||
valuators[base + 1] = dv->valuator1;
|
||||
case 1:
|
||||
valuators[base] = dv->valuator0;
|
||||
break;
|
||||
default:
|
||||
client->errorValue = dv->num_valuators;
|
||||
|
|
@ -284,20 +273,18 @@ ProcXTestFakeInput(ClientPtr client)
|
|||
base += dv->num_valuators;
|
||||
numValuators += dv->num_valuators;
|
||||
|
||||
if (firstValuator + numValuators > dev->valuator->numAxes)
|
||||
{
|
||||
if (firstValuator + numValuators > dev->valuator->numAxes) {
|
||||
client->errorValue = dv->num_valuators;
|
||||
return BadValue;
|
||||
}
|
||||
}
|
||||
type = type - XI_DeviceKeyPress + KeyPress;
|
||||
|
||||
} else
|
||||
{
|
||||
}
|
||||
else {
|
||||
if (nev != 1)
|
||||
return BadLength;
|
||||
switch (type)
|
||||
{
|
||||
switch (type) {
|
||||
case KeyPress:
|
||||
case KeyRelease:
|
||||
dev = PickKeyboard(client);
|
||||
|
|
@ -324,8 +311,7 @@ ProcXTestFakeInput(ClientPtr client)
|
|||
}
|
||||
|
||||
/* If the event has a time set, wait for it to pass */
|
||||
if (ev->u.keyButtonPointer.time)
|
||||
{
|
||||
if (ev->u.keyButtonPointer.time) {
|
||||
TimeStamp activateTime;
|
||||
CARD32 ms;
|
||||
|
||||
|
|
@ -339,13 +325,11 @@ ProcXTestFakeInput(ClientPtr client)
|
|||
/* see mbuf.c:QueueDisplayRequest (from the deprecated Multibuffer
|
||||
* extension) for code similar to this */
|
||||
|
||||
if (!ClientSleepUntil(client, &activateTime, NULL, NULL))
|
||||
{
|
||||
if (!ClientSleepUntil(client, &activateTime, NULL, NULL)) {
|
||||
return BadAlloc;
|
||||
}
|
||||
/* swap the request back so we can simply re-execute it */
|
||||
if (client->swapped)
|
||||
{
|
||||
if (client->swapped) {
|
||||
(void) XTestSwapFakeInput(client, (xReq *) stuff);
|
||||
swaps(&stuff->length);
|
||||
}
|
||||
|
|
@ -354,16 +338,14 @@ ProcXTestFakeInput(ClientPtr client)
|
|||
return Success;
|
||||
}
|
||||
|
||||
switch (type)
|
||||
{
|
||||
switch (type) {
|
||||
case KeyPress:
|
||||
case KeyRelease:
|
||||
if (!dev->key)
|
||||
return BadDevice;
|
||||
|
||||
if (ev->u.u.detail < dev->key->xkbInfo->desc->min_key_code ||
|
||||
ev->u.u.detail > dev->key->xkbInfo->desc->max_key_code)
|
||||
{
|
||||
ev->u.u.detail > dev->key->xkbInfo->desc->max_key_code) {
|
||||
client->errorValue = ev->u.u.detail;
|
||||
return BadValue;
|
||||
}
|
||||
|
|
@ -374,20 +356,17 @@ ProcXTestFakeInput(ClientPtr client)
|
|||
if (!dev->valuator)
|
||||
return BadDevice;
|
||||
|
||||
if (!(extension || ev->u.keyButtonPointer.root == None))
|
||||
{
|
||||
if (!(extension || ev->u.keyButtonPointer.root == None)) {
|
||||
rc = dixLookupWindow(&root, ev->u.keyButtonPointer.root,
|
||||
client, DixGetAttrAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
if (root->parent)
|
||||
{
|
||||
if (root->parent) {
|
||||
client->errorValue = ev->u.keyButtonPointer.root;
|
||||
return BadValue;
|
||||
}
|
||||
}
|
||||
if (ev->u.u.detail != xTrue && ev->u.u.detail != xFalse)
|
||||
{
|
||||
if (ev->u.u.detail != xTrue && ev->u.u.detail != xFalse) {
|
||||
client->errorValue = ev->u.u.detail;
|
||||
return BadValue;
|
||||
}
|
||||
|
|
@ -400,8 +379,7 @@ ProcXTestFakeInput(ClientPtr client)
|
|||
if (!dev->button)
|
||||
return BadDevice;
|
||||
|
||||
if (!ev->u.u.detail || ev->u.u.detail > dev->button->numButtons)
|
||||
{
|
||||
if (!ev->u.u.detail || ev->u.u.detail > dev->button->numButtons) {
|
||||
client->errorValue = ev->u.u.detail;
|
||||
return BadValue;
|
||||
}
|
||||
|
|
@ -423,7 +401,8 @@ ProcXTestFakeInput(ClientPtr client)
|
|||
break;
|
||||
case KeyPress:
|
||||
case KeyRelease:
|
||||
nevents = GetKeyboardEvents(xtest_evlist, dev, type, ev->u.u.detail, NULL);
|
||||
nevents =
|
||||
GetKeyboardEvents(xtest_evlist, dev, type, ev->u.u.detail, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -441,8 +420,7 @@ ProcXTestGrabControl(ClientPtr client)
|
|||
REQUEST(xXTestGrabControlReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xXTestGrabControlReq);
|
||||
if ((stuff->impervious != xTrue) && (stuff->impervious != xFalse))
|
||||
{
|
||||
if ((stuff->impervious != xTrue) && (stuff->impervious != xFalse)) {
|
||||
client->errorValue = stuff->impervious;
|
||||
return BadValue;
|
||||
}
|
||||
|
|
@ -457,8 +435,7 @@ static int
|
|||
ProcXTestDispatch(ClientPtr client)
|
||||
{
|
||||
REQUEST(xReq);
|
||||
switch (stuff->data)
|
||||
{
|
||||
switch (stuff->data) {
|
||||
case X_XTestGetVersion:
|
||||
return ProcXTestGetVersion(client);
|
||||
case X_XTestCompareCursor:
|
||||
|
|
@ -504,8 +481,7 @@ XTestSwapFakeInput(ClientPtr client, xReq *req)
|
|||
EventSwapPtr proc;
|
||||
|
||||
nev = ((req->length << 2) - sizeof(xReq)) / sizeof(xEvent);
|
||||
for (ev = (xEvent *)&req[1]; --nev >= 0; ev++)
|
||||
{
|
||||
for (ev = (xEvent *) &req[1]; --nev >= 0; ev++) {
|
||||
/* Swap event */
|
||||
proc = EventSwapVector[ev->u.u.type & 0177];
|
||||
/* no swapping proc; invalid event type? */
|
||||
|
|
@ -523,6 +499,7 @@ static int
|
|||
SProcXTestFakeInput(ClientPtr client)
|
||||
{
|
||||
int n;
|
||||
|
||||
REQUEST(xReq);
|
||||
|
||||
swaps(&stuff->length);
|
||||
|
|
@ -546,8 +523,7 @@ static int
|
|||
SProcXTestDispatch(ClientPtr client)
|
||||
{
|
||||
REQUEST(xReq);
|
||||
switch (stuff->data)
|
||||
{
|
||||
switch (stuff->data) {
|
||||
case X_XTestGetVersion:
|
||||
return SProcXTestGetVersion(client);
|
||||
case X_XTestCompareCursor:
|
||||
|
|
@ -565,7 +541,8 @@ SProcXTestDispatch (ClientPtr client)
|
|||
* Allocate an virtual slave device for xtest events, this
|
||||
* is a slave device to inputInfo master devices
|
||||
*/
|
||||
void InitXTestDevices(void)
|
||||
void
|
||||
InitXTestDevices(void)
|
||||
{
|
||||
if (AllocXTestDevice(serverClient, "Virtual core",
|
||||
&xtestpointer, &xtestkeyboard,
|
||||
|
|
@ -575,11 +552,11 @@ void InitXTestDevices(void)
|
|||
if (ActivateDevice(xtestpointer, TRUE) != Success ||
|
||||
ActivateDevice(xtestkeyboard, TRUE) != Success)
|
||||
FatalError("Failed to activate XTest core devices.");
|
||||
if (!EnableDevice(xtestpointer, TRUE) ||
|
||||
!EnableDevice(xtestkeyboard, TRUE))
|
||||
if (!EnableDevice(xtestpointer, TRUE) || !EnableDevice(xtestkeyboard, TRUE))
|
||||
FatalError("Failed to enable XTest core devices.");
|
||||
|
||||
AttachDevice(NULL, xtestpointer, inputInfo.pointer);
|
||||
|
||||
AttachDevice(NULL, xtestkeyboard, inputInfo.keyboard);
|
||||
}
|
||||
|
||||
|
|
@ -603,7 +580,8 @@ DeviceSetXTestProperty(DeviceIntPtr dev, Atom property,
|
|||
* This only creates the pair, Activate/Enable Device
|
||||
* still need to be called.
|
||||
*/
|
||||
int AllocXTestDevice (ClientPtr client, const char* name,
|
||||
int
|
||||
AllocXTestDevice(ClientPtr client, const char *name,
|
||||
DeviceIntPtr *ptr, DeviceIntPtr *keybd,
|
||||
DeviceIntPtr master_ptr, DeviceIntPtr master_keybd)
|
||||
{
|
||||
|
|
@ -614,7 +592,9 @@ int AllocXTestDevice (ClientPtr client, const char* name,
|
|||
if (asprintf(&xtestname, "%s XTEST", name) == -1)
|
||||
return BadAlloc;
|
||||
|
||||
retval = AllocDevicePair( client, xtestname, ptr, keybd, CorePointerProc, CoreKeyboardProc, FALSE);
|
||||
retval =
|
||||
AllocDevicePair(client, xtestname, ptr, keybd, CorePointerProc,
|
||||
CoreKeyboardProc, FALSE);
|
||||
if (retval == Success) {
|
||||
(*ptr)->xtest_master_id = master_ptr->id;
|
||||
(*keybd)->xtest_master_id = master_keybd->id;
|
||||
|
|
@ -622,12 +602,16 @@ int AllocXTestDevice (ClientPtr client, const char* name,
|
|||
XIChangeDeviceProperty(*ptr, XIGetKnownProperty(XI_PROP_XTEST_DEVICE),
|
||||
XA_INTEGER, 8, PropModeReplace, 1, &dummy,
|
||||
FALSE);
|
||||
XISetDevicePropertyDeletable(*ptr, XIGetKnownProperty(XI_PROP_XTEST_DEVICE), FALSE);
|
||||
XISetDevicePropertyDeletable(*ptr,
|
||||
XIGetKnownProperty(XI_PROP_XTEST_DEVICE),
|
||||
FALSE);
|
||||
XIRegisterPropertyHandler(*ptr, DeviceSetXTestProperty, NULL, NULL);
|
||||
XIChangeDeviceProperty(*keybd, XIGetKnownProperty(XI_PROP_XTEST_DEVICE),
|
||||
XA_INTEGER, 8, PropModeReplace, 1, &dummy,
|
||||
FALSE);
|
||||
XISetDevicePropertyDeletable(*keybd, XIGetKnownProperty(XI_PROP_XTEST_DEVICE), FALSE);
|
||||
XISetDevicePropertyDeletable(*keybd,
|
||||
XIGetKnownProperty(XI_PROP_XTEST_DEVICE),
|
||||
FALSE);
|
||||
XIRegisterPropertyHandler(*keybd, DeviceSetXTestProperty, NULL, NULL);
|
||||
}
|
||||
|
||||
|
|
@ -664,8 +648,7 @@ GetXTestDevice(DeviceIntPtr master)
|
|||
{
|
||||
DeviceIntPtr it;
|
||||
|
||||
for (it = inputInfo.devices; it; it = it->next)
|
||||
{
|
||||
for (it = inputInfo.devices; it; it = it->next) {
|
||||
if (IsXTestDevice(it, master))
|
||||
return it;
|
||||
}
|
||||
|
|
|
|||
274
Xext/xvdisp.c
274
Xext/xvdisp.c
|
|
@ -55,10 +55,8 @@ unsigned long XvXRTPort;
|
|||
#endif
|
||||
|
||||
static int
|
||||
SWriteQueryExtensionReply(
|
||||
ClientPtr client,
|
||||
xvQueryExtensionReply *rep
|
||||
){
|
||||
SWriteQueryExtensionReply(ClientPtr client, xvQueryExtensionReply * rep)
|
||||
{
|
||||
swaps(&rep->sequenceNumber);
|
||||
swapl(&rep->length);
|
||||
swaps(&rep->version);
|
||||
|
|
@ -70,10 +68,8 @@ SWriteQueryExtensionReply(
|
|||
}
|
||||
|
||||
static int
|
||||
SWriteQueryAdaptorsReply(
|
||||
ClientPtr client,
|
||||
xvQueryAdaptorsReply *rep
|
||||
){
|
||||
SWriteQueryAdaptorsReply(ClientPtr client, xvQueryAdaptorsReply * rep)
|
||||
{
|
||||
swaps(&rep->sequenceNumber);
|
||||
swapl(&rep->length);
|
||||
swaps(&rep->num_adaptors);
|
||||
|
|
@ -84,10 +80,8 @@ SWriteQueryAdaptorsReply(
|
|||
}
|
||||
|
||||
static int
|
||||
SWriteQueryEncodingsReply(
|
||||
ClientPtr client,
|
||||
xvQueryEncodingsReply *rep
|
||||
){
|
||||
SWriteQueryEncodingsReply(ClientPtr client, xvQueryEncodingsReply * rep)
|
||||
{
|
||||
swaps(&rep->sequenceNumber);
|
||||
swapl(&rep->length);
|
||||
swaps(&rep->num_encodings);
|
||||
|
|
@ -98,10 +92,8 @@ SWriteQueryEncodingsReply(
|
|||
}
|
||||
|
||||
static int
|
||||
SWriteAdaptorInfo(
|
||||
ClientPtr client,
|
||||
xvAdaptorInfo *pAdaptor
|
||||
){
|
||||
SWriteAdaptorInfo(ClientPtr client, xvAdaptorInfo * pAdaptor)
|
||||
{
|
||||
swapl(&pAdaptor->base_id);
|
||||
swaps(&pAdaptor->name_size);
|
||||
swaps(&pAdaptor->num_ports);
|
||||
|
|
@ -113,10 +105,8 @@ SWriteAdaptorInfo(
|
|||
}
|
||||
|
||||
static int
|
||||
SWriteEncodingInfo(
|
||||
ClientPtr client,
|
||||
xvEncodingInfo *pEncoding
|
||||
){
|
||||
SWriteEncodingInfo(ClientPtr client, xvEncodingInfo * pEncoding)
|
||||
{
|
||||
|
||||
swapl(&pEncoding->encoding);
|
||||
swaps(&pEncoding->name_size);
|
||||
|
|
@ -130,10 +120,8 @@ SWriteEncodingInfo(
|
|||
}
|
||||
|
||||
static int
|
||||
SWriteFormat(
|
||||
ClientPtr client,
|
||||
xvFormat *pFormat
|
||||
){
|
||||
SWriteFormat(ClientPtr client, xvFormat * pFormat)
|
||||
{
|
||||
swapl(&pFormat->visual);
|
||||
(void) WriteToClient(client, sz_xvFormat, (char *) pFormat);
|
||||
|
||||
|
|
@ -141,10 +129,8 @@ SWriteFormat(
|
|||
}
|
||||
|
||||
static int
|
||||
SWriteAttributeInfo(
|
||||
ClientPtr client,
|
||||
xvAttributeInfo *pAtt
|
||||
){
|
||||
SWriteAttributeInfo(ClientPtr client, xvAttributeInfo * pAtt)
|
||||
{
|
||||
swapl(&pAtt->flags);
|
||||
swapl(&pAtt->size);
|
||||
swapl(&pAtt->min);
|
||||
|
|
@ -155,10 +141,8 @@ SWriteAttributeInfo(
|
|||
}
|
||||
|
||||
static int
|
||||
SWriteImageFormatInfo(
|
||||
ClientPtr client,
|
||||
xvImageFormatInfo *pImage
|
||||
){
|
||||
SWriteImageFormatInfo(ClientPtr client, xvImageFormatInfo * pImage)
|
||||
{
|
||||
swapl(&pImage->id);
|
||||
swapl(&pImage->red_mask);
|
||||
swapl(&pImage->green_mask);
|
||||
|
|
@ -179,10 +163,8 @@ SWriteImageFormatInfo(
|
|||
}
|
||||
|
||||
static int
|
||||
SWriteGrabPortReply(
|
||||
ClientPtr client,
|
||||
xvGrabPortReply *rep
|
||||
){
|
||||
SWriteGrabPortReply(ClientPtr client, xvGrabPortReply * rep)
|
||||
{
|
||||
swaps(&rep->sequenceNumber);
|
||||
swapl(&rep->length);
|
||||
|
||||
|
|
@ -192,10 +174,8 @@ SWriteGrabPortReply(
|
|||
}
|
||||
|
||||
static int
|
||||
SWriteGetPortAttributeReply(
|
||||
ClientPtr client,
|
||||
xvGetPortAttributeReply *rep
|
||||
){
|
||||
SWriteGetPortAttributeReply(ClientPtr client, xvGetPortAttributeReply * rep)
|
||||
{
|
||||
swaps(&rep->sequenceNumber);
|
||||
swapl(&rep->length);
|
||||
swapl(&rep->value);
|
||||
|
|
@ -206,10 +186,8 @@ SWriteGetPortAttributeReply(
|
|||
}
|
||||
|
||||
static int
|
||||
SWriteQueryBestSizeReply(
|
||||
ClientPtr client,
|
||||
xvQueryBestSizeReply *rep
|
||||
){
|
||||
SWriteQueryBestSizeReply(ClientPtr client, xvQueryBestSizeReply * rep)
|
||||
{
|
||||
swaps(&rep->sequenceNumber);
|
||||
swapl(&rep->length);
|
||||
swaps(&rep->actual_width);
|
||||
|
|
@ -221,10 +199,9 @@ SWriteQueryBestSizeReply(
|
|||
}
|
||||
|
||||
static int
|
||||
SWriteQueryPortAttributesReply(
|
||||
ClientPtr client,
|
||||
xvQueryPortAttributesReply *rep
|
||||
){
|
||||
SWriteQueryPortAttributesReply(ClientPtr client,
|
||||
xvQueryPortAttributesReply * rep)
|
||||
{
|
||||
swaps(&rep->sequenceNumber);
|
||||
swapl(&rep->length);
|
||||
swapl(&rep->num_attributes);
|
||||
|
|
@ -236,10 +213,9 @@ SWriteQueryPortAttributesReply(
|
|||
}
|
||||
|
||||
static int
|
||||
SWriteQueryImageAttributesReply(
|
||||
ClientPtr client,
|
||||
xvQueryImageAttributesReply *rep
|
||||
){
|
||||
SWriteQueryImageAttributesReply(ClientPtr client,
|
||||
xvQueryImageAttributesReply * rep)
|
||||
{
|
||||
swaps(&rep->sequenceNumber);
|
||||
swapl(&rep->length);
|
||||
swapl(&rep->num_planes);
|
||||
|
|
@ -253,10 +229,8 @@ SWriteQueryImageAttributesReply(
|
|||
}
|
||||
|
||||
static int
|
||||
SWriteListImageFormatsReply(
|
||||
ClientPtr client,
|
||||
xvListImageFormatsReply *rep
|
||||
){
|
||||
SWriteListImageFormatsReply(ClientPtr client, xvListImageFormatsReply * rep)
|
||||
{
|
||||
swaps(&rep->sequenceNumber);
|
||||
swapl(&rep->length);
|
||||
swapl(&rep->num_formats);
|
||||
|
|
@ -329,6 +303,7 @@ static int
|
|||
ProcXvQueryExtension(ClientPtr client)
|
||||
{
|
||||
xvQueryExtensionReply rep;
|
||||
|
||||
/* REQUEST(xvQueryExtensionReq); */
|
||||
REQUEST_SIZE_MATCH(xvQueryExtensionReq);
|
||||
|
||||
|
|
@ -367,8 +342,7 @@ ProcXvQueryAdaptors(ClientPtr client)
|
|||
pScreen = pWin->drawable.pScreen;
|
||||
pxvs = (XvScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
|
||||
XvGetScreenKey());
|
||||
if (!pxvs)
|
||||
{
|
||||
if (!pxvs) {
|
||||
rep.type = X_Reply;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.num_adaptors = 0;
|
||||
|
|
@ -393,8 +367,7 @@ ProcXvQueryAdaptors(ClientPtr client)
|
|||
|
||||
na = pxvs->nAdaptors;
|
||||
pa = pxvs->pAdaptors;
|
||||
while (na--)
|
||||
{
|
||||
while (na--) {
|
||||
totalSize += pad_to_int32(strlen(pa->name));
|
||||
totalSize += pa->nFormats * sz_xvFormat;
|
||||
pa++;
|
||||
|
|
@ -406,8 +379,7 @@ ProcXvQueryAdaptors(ClientPtr client)
|
|||
|
||||
na = pxvs->nAdaptors;
|
||||
pa = pxvs->pAdaptors;
|
||||
while (na--)
|
||||
{
|
||||
while (na--) {
|
||||
|
||||
ainfo.base_id = pa->base_id;
|
||||
ainfo.num_ports = pa->nPorts;
|
||||
|
|
@ -421,8 +393,7 @@ ProcXvQueryAdaptors(ClientPtr client)
|
|||
|
||||
nf = pa->nFormats;
|
||||
pf = pa->pFormats;
|
||||
while (nf--)
|
||||
{
|
||||
while (nf--) {
|
||||
format.depth = pf->depth;
|
||||
format.visual = pf->visual;
|
||||
_WriteFormat(client, &format);
|
||||
|
|
@ -453,8 +424,7 @@ ProcXvQueryEncodings(ClientPtr client)
|
|||
|
||||
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
|
||||
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success)
|
||||
{
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
|
||||
client->errorValue = stuff->port;
|
||||
return status;
|
||||
}
|
||||
|
|
@ -468,8 +438,7 @@ ProcXvQueryEncodings(ClientPtr client)
|
|||
ne = pPort->pAdaptor->nEncodings;
|
||||
pe = pPort->pAdaptor->pEncodings;
|
||||
totalSize = ne * sz_xvEncodingInfo;
|
||||
while (ne--)
|
||||
{
|
||||
while (ne--) {
|
||||
totalSize += pad_to_int32(strlen(pe->name));
|
||||
pe++;
|
||||
}
|
||||
|
|
@ -480,8 +449,7 @@ ProcXvQueryEncodings(ClientPtr client)
|
|||
|
||||
ne = pPort->pAdaptor->nEncodings;
|
||||
pe = pPort->pAdaptor->pEncodings;
|
||||
while (ne--)
|
||||
{
|
||||
while (ne--) {
|
||||
einfo.encoding = pe->id;
|
||||
einfo.name_size = nameSize = strlen(pe->name);
|
||||
einfo.width = pe->width;
|
||||
|
|
@ -510,22 +478,19 @@ ProcXvPutVideo(ClientPtr client)
|
|||
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
|
||||
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
|
||||
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success)
|
||||
{
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
|
||||
client->errorValue = stuff->port;
|
||||
return status;
|
||||
}
|
||||
|
||||
if (!(pPort->pAdaptor->type & XvInputMask) ||
|
||||
!(pPort->pAdaptor->type & XvVideoMask))
|
||||
{
|
||||
!(pPort->pAdaptor->type & XvVideoMask)) {
|
||||
client->errorValue = stuff->port;
|
||||
return BadMatch;
|
||||
}
|
||||
|
||||
status = XvdiMatchPort(pPort, pDraw);
|
||||
if (status != Success)
|
||||
{
|
||||
if (status != Success) {
|
||||
return status;
|
||||
}
|
||||
|
||||
|
|
@ -548,22 +513,19 @@ ProcXvPutStill(ClientPtr client)
|
|||
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
|
||||
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
|
||||
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success)
|
||||
{
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
|
||||
client->errorValue = stuff->port;
|
||||
return status;
|
||||
}
|
||||
|
||||
if (!(pPort->pAdaptor->type & XvInputMask) ||
|
||||
!(pPort->pAdaptor->type & XvStillMask))
|
||||
{
|
||||
!(pPort->pAdaptor->type & XvStillMask)) {
|
||||
client->errorValue = stuff->port;
|
||||
return BadMatch;
|
||||
}
|
||||
|
||||
status = XvdiMatchPort(pPort, pDraw);
|
||||
if (status != Success)
|
||||
{
|
||||
if (status != Success) {
|
||||
return status;
|
||||
}
|
||||
|
||||
|
|
@ -586,22 +548,19 @@ ProcXvGetVideo(ClientPtr client)
|
|||
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixReadAccess);
|
||||
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
|
||||
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success)
|
||||
{
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
|
||||
client->errorValue = stuff->port;
|
||||
return status;
|
||||
}
|
||||
|
||||
if (!(pPort->pAdaptor->type & XvOutputMask) ||
|
||||
!(pPort->pAdaptor->type & XvVideoMask))
|
||||
{
|
||||
!(pPort->pAdaptor->type & XvVideoMask)) {
|
||||
client->errorValue = stuff->port;
|
||||
return BadMatch;
|
||||
}
|
||||
|
||||
status = XvdiMatchPort(pPort, pDraw);
|
||||
if (status != Success)
|
||||
{
|
||||
if (status != Success) {
|
||||
return status;
|
||||
}
|
||||
|
||||
|
|
@ -624,22 +583,19 @@ ProcXvGetStill(ClientPtr client)
|
|||
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixReadAccess);
|
||||
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
|
||||
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success)
|
||||
{
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
|
||||
client->errorValue = stuff->port;
|
||||
return status;
|
||||
}
|
||||
|
||||
if (!(pPort->pAdaptor->type & XvOutputMask) ||
|
||||
!(pPort->pAdaptor->type & XvStillMask))
|
||||
{
|
||||
!(pPort->pAdaptor->type & XvStillMask)) {
|
||||
client->errorValue = stuff->port;
|
||||
return BadMatch;
|
||||
}
|
||||
|
||||
status = XvdiMatchPort(pPort, pDraw);
|
||||
if (status != Success)
|
||||
{
|
||||
if (status != Success) {
|
||||
return status;
|
||||
}
|
||||
|
||||
|
|
@ -653,10 +609,12 @@ ProcXvSelectVideoNotify(ClientPtr client)
|
|||
{
|
||||
DrawablePtr pDraw;
|
||||
int rc;
|
||||
|
||||
REQUEST(xvSelectVideoNotifyReq);
|
||||
REQUEST_SIZE_MATCH(xvSelectVideoNotifyReq);
|
||||
|
||||
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, DixReceiveAccess);
|
||||
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
|
||||
DixReceiveAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
|
|
@ -668,13 +626,13 @@ ProcXvSelectPortNotify(ClientPtr client)
|
|||
{
|
||||
int status;
|
||||
XvPortPtr pPort;
|
||||
|
||||
REQUEST(xvSelectPortNotifyReq);
|
||||
REQUEST_SIZE_MATCH(xvSelectPortNotifyReq);
|
||||
|
||||
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
|
||||
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success)
|
||||
{
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
|
||||
client->errorValue = stuff->port;
|
||||
return status;
|
||||
}
|
||||
|
|
@ -688,21 +646,20 @@ ProcXvGrabPort(ClientPtr client)
|
|||
int result, status;
|
||||
XvPortPtr pPort;
|
||||
xvGrabPortReply rep;
|
||||
|
||||
REQUEST(xvGrabPortReq);
|
||||
REQUEST_SIZE_MATCH(xvGrabPortReq);
|
||||
|
||||
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
|
||||
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success)
|
||||
{
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
|
||||
client->errorValue = stuff->port;
|
||||
return status;
|
||||
}
|
||||
|
||||
status = XvdiGrabPort(client, pPort, stuff->time, &result);
|
||||
|
||||
if (status != Success)
|
||||
{
|
||||
if (status != Success) {
|
||||
return status;
|
||||
}
|
||||
|
||||
|
|
@ -721,13 +678,13 @@ ProcXvUngrabPort(ClientPtr client)
|
|||
{
|
||||
int status;
|
||||
XvPortPtr pPort;
|
||||
|
||||
REQUEST(xvGrabPortReq);
|
||||
REQUEST_SIZE_MATCH(xvGrabPortReq);
|
||||
|
||||
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
|
||||
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success)
|
||||
{
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
|
||||
client->errorValue = stuff->port;
|
||||
return status;
|
||||
}
|
||||
|
|
@ -741,13 +698,13 @@ ProcXvStopVideo(ClientPtr client)
|
|||
int status, rc;
|
||||
DrawablePtr pDraw;
|
||||
XvPortPtr pPort;
|
||||
|
||||
REQUEST(xvStopVideoReq);
|
||||
REQUEST_SIZE_MATCH(xvStopVideoReq);
|
||||
|
||||
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
|
||||
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success)
|
||||
{
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
|
||||
client->errorValue = stuff->port;
|
||||
return status;
|
||||
}
|
||||
|
|
@ -764,24 +721,24 @@ ProcXvSetPortAttribute(ClientPtr client)
|
|||
{
|
||||
int status;
|
||||
XvPortPtr pPort;
|
||||
|
||||
REQUEST(xvSetPortAttributeReq);
|
||||
REQUEST_SIZE_MATCH(xvSetPortAttributeReq);
|
||||
|
||||
VALIDATE_XV_PORT(stuff->port, pPort, DixSetAttrAccess);
|
||||
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success)
|
||||
{
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
|
||||
client->errorValue = stuff->port;
|
||||
return status;
|
||||
}
|
||||
|
||||
if (!ValidAtom(stuff->attribute))
|
||||
{
|
||||
if (!ValidAtom(stuff->attribute)) {
|
||||
client->errorValue = stuff->attribute;
|
||||
return BadAtom;
|
||||
}
|
||||
|
||||
status = XvdiSetPortAttribute(client, pPort, stuff->attribute, stuff->value);
|
||||
status =
|
||||
XvdiSetPortAttribute(client, pPort, stuff->attribute, stuff->value);
|
||||
|
||||
if (status == BadMatch)
|
||||
client->errorValue = stuff->attribute;
|
||||
|
|
@ -798,26 +755,24 @@ ProcXvGetPortAttribute(ClientPtr client)
|
|||
int status;
|
||||
XvPortPtr pPort;
|
||||
xvGetPortAttributeReply rep;
|
||||
|
||||
REQUEST(xvGetPortAttributeReq);
|
||||
REQUEST_SIZE_MATCH(xvGetPortAttributeReq);
|
||||
|
||||
VALIDATE_XV_PORT(stuff->port, pPort, DixGetAttrAccess);
|
||||
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success)
|
||||
{
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
|
||||
client->errorValue = stuff->port;
|
||||
return status;
|
||||
}
|
||||
|
||||
if (!ValidAtom(stuff->attribute))
|
||||
{
|
||||
if (!ValidAtom(stuff->attribute)) {
|
||||
client->errorValue = stuff->attribute;
|
||||
return BadAtom;
|
||||
}
|
||||
|
||||
status = XvdiGetPortAttribute(client, pPort, stuff->attribute, &value);
|
||||
if (status != Success)
|
||||
{
|
||||
if (status != Success) {
|
||||
client->errorValue = stuff->attribute;
|
||||
return status;
|
||||
}
|
||||
|
|
@ -839,13 +794,13 @@ ProcXvQueryBestSize(ClientPtr client)
|
|||
unsigned int actual_width, actual_height;
|
||||
XvPortPtr pPort;
|
||||
xvQueryBestSizeReply rep;
|
||||
|
||||
REQUEST(xvQueryBestSizeReq);
|
||||
REQUEST_SIZE_MATCH(xvQueryBestSizeReq);
|
||||
|
||||
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
|
||||
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success)
|
||||
{
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
|
||||
client->errorValue = stuff->port;
|
||||
return status;
|
||||
}
|
||||
|
|
@ -867,7 +822,6 @@ ProcXvQueryBestSize(ClientPtr client)
|
|||
return Success;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
ProcXvQueryPortAttributes(ClientPtr client)
|
||||
{
|
||||
|
|
@ -876,13 +830,13 @@ ProcXvQueryPortAttributes(ClientPtr client)
|
|||
XvAttributePtr pAtt;
|
||||
xvQueryPortAttributesReply rep;
|
||||
xvAttributeInfo Info;
|
||||
|
||||
REQUEST(xvQueryPortAttributesReq);
|
||||
REQUEST_SIZE_MATCH(xvQueryPortAttributesReq);
|
||||
|
||||
VALIDATE_XV_PORT(stuff->port, pPort, DixGetAttrAccess);
|
||||
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success)
|
||||
{
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
|
||||
client->errorValue = stuff->port;
|
||||
return status;
|
||||
}
|
||||
|
|
@ -893,8 +847,7 @@ ProcXvQueryPortAttributes(ClientPtr client)
|
|||
rep.text_size = 0;
|
||||
|
||||
for (i = 0, pAtt = pPort->pAdaptor->pAttributes;
|
||||
i < pPort->pAdaptor->nAttributes; i++, pAtt++)
|
||||
{
|
||||
i < pPort->pAdaptor->nAttributes; i++, pAtt++) {
|
||||
rep.text_size += pad_to_int32(strlen(pAtt->name) + 1);
|
||||
}
|
||||
|
||||
|
|
@ -905,8 +858,7 @@ ProcXvQueryPortAttributes(ClientPtr client)
|
|||
_WriteQueryPortAttributesReply(client, &rep);
|
||||
|
||||
for (i = 0, pAtt = pPort->pAdaptor->pAttributes;
|
||||
i < pPort->pAdaptor->nAttributes; i++, pAtt++)
|
||||
{
|
||||
i < pPort->pAdaptor->nAttributes; i++, pAtt++) {
|
||||
size = strlen(pAtt->name) + 1; /* pass the NULL */
|
||||
Info.flags = pAtt->flags;
|
||||
Info.min = pAtt->min_value;
|
||||
|
|
@ -937,22 +889,19 @@ ProcXvPutImage(ClientPtr client)
|
|||
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
|
||||
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
|
||||
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success)
|
||||
{
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
|
||||
client->errorValue = stuff->port;
|
||||
return status;
|
||||
}
|
||||
|
||||
if (!(pPort->pAdaptor->type & XvImageMask) ||
|
||||
!(pPort->pAdaptor->type & XvInputMask))
|
||||
{
|
||||
!(pPort->pAdaptor->type & XvInputMask)) {
|
||||
client->errorValue = stuff->port;
|
||||
return BadMatch;
|
||||
}
|
||||
|
||||
status = XvdiMatchPort(pPort, pDraw);
|
||||
if (status != Success)
|
||||
{
|
||||
if (status != Success) {
|
||||
return status;
|
||||
}
|
||||
|
||||
|
|
@ -969,7 +918,8 @@ ProcXvPutImage(ClientPtr client)
|
|||
width = stuff->width;
|
||||
height = stuff->height;
|
||||
size = (*pPort->pAdaptor->ddQueryImageAttributes) (client,
|
||||
pPort, pImage, &width, &height, NULL, NULL);
|
||||
pPort, pImage, &width,
|
||||
&height, NULL, NULL);
|
||||
size += sizeof(xvPutImageReq);
|
||||
size = bytes_to_int32(size);
|
||||
|
||||
|
|
@ -1017,22 +967,19 @@ ProcXvShmPutImage(ClientPtr client)
|
|||
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
|
||||
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
|
||||
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success)
|
||||
{
|
||||
if ((status = _AllocatePort(stuff->port, pPort)) != Success) {
|
||||
client->errorValue = stuff->port;
|
||||
return status;
|
||||
}
|
||||
|
||||
if (!(pPort->pAdaptor->type & XvImageMask) ||
|
||||
!(pPort->pAdaptor->type & XvInputMask))
|
||||
{
|
||||
!(pPort->pAdaptor->type & XvInputMask)) {
|
||||
client->errorValue = stuff->port;
|
||||
return BadMatch;
|
||||
}
|
||||
|
||||
status = XvdiMatchPort(pPort, pDraw);
|
||||
if (status != Success)
|
||||
{
|
||||
if (status != Success) {
|
||||
return status;
|
||||
}
|
||||
|
||||
|
|
@ -1054,7 +1001,9 @@ ProcXvShmPutImage(ClientPtr client)
|
|||
width = stuff->width;
|
||||
height = stuff->height;
|
||||
size_needed = (*pPort->pAdaptor->ddQueryImageAttributes) (client,
|
||||
pPort, pImage, &width, &height, NULL, NULL);
|
||||
pPort, pImage,
|
||||
&width, &height,
|
||||
NULL, NULL);
|
||||
if ((size_needed + stuff->offset) > shmdesc->size)
|
||||
return BadAccess;
|
||||
|
||||
|
|
@ -1062,8 +1011,8 @@ ProcXvShmPutImage(ClientPtr client)
|
|||
return BadValue;
|
||||
|
||||
status = XvdiPutImage(client, pDraw, pPort, pGC, stuff->src_x, stuff->src_y,
|
||||
stuff->src_w, stuff->src_h, stuff->drw_x, stuff->drw_y,
|
||||
stuff->drw_w, stuff->drw_h, pImage,
|
||||
stuff->src_w, stuff->src_h, stuff->drw_x,
|
||||
stuff->drw_y, stuff->drw_w, stuff->drw_h, pImage,
|
||||
(unsigned char *) shmdesc->addr + stuff->offset,
|
||||
stuff->send_event, stuff->width, stuff->height);
|
||||
|
||||
|
|
@ -1105,6 +1054,7 @@ ProcXvQueryImageAttributes(ClientPtr client)
|
|||
int *offsets;
|
||||
int *pitches;
|
||||
int planeLength;
|
||||
|
||||
REQUEST(xvQueryImageAttributesReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xvQueryImageAttributesReq);
|
||||
|
|
@ -1136,7 +1086,8 @@ ProcXvQueryImageAttributes(ClientPtr client)
|
|||
height = stuff->height;
|
||||
|
||||
size = (*pPort->pAdaptor->ddQueryImageAttributes) (client, pPort, pImage,
|
||||
&width, &height, offsets, pitches);
|
||||
&width, &height, offsets,
|
||||
pitches);
|
||||
|
||||
rep.type = X_Reply;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
|
|
@ -1164,6 +1115,7 @@ ProcXvListImageFormats(ClientPtr client)
|
|||
int i;
|
||||
xvListImageFormatsReply rep;
|
||||
xvImageFormatInfo info;
|
||||
|
||||
REQUEST(xvListImageFormatsReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xvListImageFormatsReq);
|
||||
|
|
@ -1173,7 +1125,8 @@ ProcXvListImageFormats(ClientPtr client)
|
|||
rep.type = X_Reply;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
rep.num_formats = pPort->pAdaptor->nImages;
|
||||
rep.length = bytes_to_int32(pPort->pAdaptor->nImages * sz_xvImageFormatInfo);
|
||||
rep.length =
|
||||
bytes_to_int32(pPort->pAdaptor->nImages * sz_xvImageFormatInfo);
|
||||
|
||||
_WriteListImageFormatsReply(client, &rep);
|
||||
|
||||
|
|
@ -1226,10 +1179,7 @@ static int (*XvProcVector[xvNumRequests])(ClientPtr) = {
|
|||
ProcXvGetPortAttribute,
|
||||
ProcXvQueryPortAttributes,
|
||||
ProcXvListImageFormats,
|
||||
ProcXvQueryImageAttributes,
|
||||
ProcXvPutImage,
|
||||
ProcXvShmPutImage,
|
||||
};
|
||||
ProcXvQueryImageAttributes, ProcXvPutImage, ProcXvShmPutImage,};
|
||||
|
||||
int
|
||||
ProcXvDispatch(ClientPtr client)
|
||||
|
|
@ -1530,10 +1480,7 @@ static int (*SXvProcVector[xvNumRequests])(ClientPtr) = {
|
|||
SProcXvGetPortAttribute,
|
||||
SProcXvQueryPortAttributes,
|
||||
SProcXvListImageFormats,
|
||||
SProcXvQueryImageAttributes,
|
||||
SProcXvPutImage,
|
||||
SProcXvShmPutImage,
|
||||
};
|
||||
SProcXvQueryImageAttributes, SProcXvPutImage, SProcXvShmPutImage,};
|
||||
|
||||
int
|
||||
SProcXvDispatch(ClientPtr client)
|
||||
|
|
@ -1556,6 +1503,7 @@ XineramaXvStopVideo(ClientPtr client)
|
|||
{
|
||||
int result, i;
|
||||
PanoramiXRes *draw, *port;
|
||||
|
||||
REQUEST(xvStopVideoReq);
|
||||
REQUEST_SIZE_MATCH(xvStopVideoReq);
|
||||
|
||||
|
|
@ -1811,6 +1759,7 @@ static Bool
|
|||
hasOverlay(XvAdaptorPtr pAdapt)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < pAdapt->nAttributes; i++)
|
||||
if (!strcmp(pAdapt->pAttributes[i].name, "XV_COLORKEY"))
|
||||
return TRUE;
|
||||
|
|
@ -1821,7 +1770,8 @@ static XvAdaptorPtr
|
|||
matchAdaptor(ScreenPtr pScreen, XvAdaptorPtr refAdapt, Bool isOverlay)
|
||||
{
|
||||
int i;
|
||||
XvScreenPtr xvsp = dixLookupPrivate(&pScreen->devPrivates, XvGetScreenKey());
|
||||
XvScreenPtr xvsp =
|
||||
dixLookupPrivate(&pScreen->devPrivates, XvGetScreenKey());
|
||||
/* Do not try to go on if xv is not supported on this screen */
|
||||
if (xvsp == NULL)
|
||||
return NULL;
|
||||
|
|
@ -1829,6 +1779,7 @@ matchAdaptor(ScreenPtr pScreen, XvAdaptorPtr refAdapt, Bool isOverlay)
|
|||
/* if the adaptor has the same name it's a perfect match */
|
||||
for (i = 0; i < xvsp->nAdaptors; i++) {
|
||||
XvAdaptorPtr pAdapt = xvsp->pAdaptors + i;
|
||||
|
||||
if (!strcmp(refAdapt->name, pAdapt->name))
|
||||
return pAdapt;
|
||||
}
|
||||
|
|
@ -1840,6 +1791,7 @@ matchAdaptor(ScreenPtr pScreen, XvAdaptorPtr refAdapt, Bool isOverlay)
|
|||
/* prefer overlay/overlay non-overlay/non-overlay pairing */
|
||||
for (i = 0; i < xvsp->nAdaptors; i++) {
|
||||
XvAdaptorPtr pAdapt = xvsp->pAdaptors + i;
|
||||
|
||||
if (isImageAdaptor(pAdapt) && isOverlay == hasOverlay(pAdapt))
|
||||
return pAdapt;
|
||||
}
|
||||
|
|
@ -1847,36 +1799,44 @@ matchAdaptor(ScreenPtr pScreen, XvAdaptorPtr refAdapt, Bool isOverlay)
|
|||
/* but we'll take any XvImage pairing if we can get it */
|
||||
for (i = 0; i < xvsp->nAdaptors; i++) {
|
||||
XvAdaptorPtr pAdapt = xvsp->pAdaptors + i;
|
||||
|
||||
if (isImageAdaptor(pAdapt))
|
||||
return pAdapt;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void XineramifyXv(void)
|
||||
void
|
||||
XineramifyXv(void)
|
||||
{
|
||||
XvScreenPtr xvsp0 = dixLookupPrivate(&screenInfo.screens[0]->devPrivates, XvGetScreenKey());
|
||||
XvScreenPtr xvsp0 =
|
||||
dixLookupPrivate(&screenInfo.screens[0]->devPrivates, XvGetScreenKey());
|
||||
XvAdaptorPtr MatchingAdaptors[MAXSCREENS];
|
||||
int i, j, k;
|
||||
|
||||
XvXRTPort = CreateNewResourceType(XineramaDeleteResource, "XvXRTPort");
|
||||
|
||||
if (!xvsp0 || !XvXRTPort) return;
|
||||
if (!xvsp0 || !XvXRTPort)
|
||||
return;
|
||||
SetResourceTypeErrorValue(XvXRTPort, _XvBadPort);
|
||||
|
||||
for (i = 0; i < xvsp0->nAdaptors; i++) {
|
||||
Bool isOverlay;
|
||||
XvAdaptorPtr refAdapt = xvsp0->pAdaptors + i;
|
||||
if(!(refAdapt->type & XvInputMask)) continue;
|
||||
|
||||
if (!(refAdapt->type & XvInputMask))
|
||||
continue;
|
||||
|
||||
MatchingAdaptors[0] = refAdapt;
|
||||
isOverlay = hasOverlay(refAdapt);
|
||||
FOR_NSCREENS_FORWARD_SKIP(j)
|
||||
MatchingAdaptors[j] = matchAdaptor(screenInfo.screens[j], refAdapt, isOverlay);
|
||||
MatchingAdaptors[j] =
|
||||
matchAdaptor(screenInfo.screens[j], refAdapt, isOverlay);
|
||||
|
||||
/* now create a resource for each port */
|
||||
for (j = 0; j < refAdapt->nPorts; j++) {
|
||||
PanoramiXRes *port = malloc(sizeof(PanoramiXRes));
|
||||
|
||||
if (!port)
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -183,8 +183,7 @@ typedef struct {
|
|||
int (*ddPutImage) (ClientPtr, DrawablePtr, struct _XvPortRec *, GCPtr,
|
||||
INT16, INT16, CARD16, CARD16,
|
||||
INT16, INT16, CARD16, CARD16,
|
||||
XvImagePtr, unsigned char*, Bool,
|
||||
CARD16, CARD16);
|
||||
XvImagePtr, unsigned char *, Bool, CARD16, CARD16);
|
||||
int (*ddQueryImageAttributes) (ClientPtr, struct _XvPortRec *, XvImagePtr,
|
||||
CARD16 *, CARD16 *, int *, int *);
|
||||
DevUnion devPriv;
|
||||
|
|
@ -272,4 +271,3 @@ extern _X_EXPORT int XvdiUngrabPort( ClientPtr, XvPortPtr, Time);
|
|||
#endif /* XorgLoader */
|
||||
|
||||
#endif /* XVDIX_H */
|
||||
|
||||
|
|
|
|||
350
Xext/xvmain.c
350
Xext/xvmain.c
|
|
@ -106,6 +106,7 @@ SOFTWARE.
|
|||
#include "xvdisp.h"
|
||||
|
||||
static DevPrivateKeyRec XvScreenKeyRec;
|
||||
|
||||
#define XvScreenKey (&XvScreenKeyRec)
|
||||
unsigned long XvExtensionGeneration = 0;
|
||||
unsigned long XvScreenGeneration = 0;
|
||||
|
|
@ -140,9 +141,6 @@ static int XvdiDestroyVideoNotifyList(pointer, XID);
|
|||
static int XvdiDestroyPort(pointer, XID);
|
||||
static int XvdiSendVideoNotify(XvPortPtr, DrawablePtr, int);
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
** XvExtensionInit
|
||||
**
|
||||
|
|
@ -159,10 +157,8 @@ XvExtensionInit(void)
|
|||
|
||||
/* LOOK TO SEE IF ANY SCREENS WERE INITIALIZED; IF NOT THEN
|
||||
INIT GLOBAL VARIABLES SO THE EXTENSION CAN FUNCTION */
|
||||
if (XvScreenGeneration != serverGeneration)
|
||||
{
|
||||
if (!CreateResourceTypes())
|
||||
{
|
||||
if (XvScreenGeneration != serverGeneration) {
|
||||
if (!CreateResourceTypes()) {
|
||||
ErrorF("XvExtensionInit: Unable to allocate resource types\n");
|
||||
return;
|
||||
}
|
||||
|
|
@ -172,15 +168,13 @@ XvExtensionInit(void)
|
|||
XvScreenGeneration = serverGeneration;
|
||||
}
|
||||
|
||||
if (XvExtensionGeneration != serverGeneration)
|
||||
{
|
||||
if (XvExtensionGeneration != serverGeneration) {
|
||||
XvExtensionGeneration = serverGeneration;
|
||||
|
||||
extEntry = AddExtension(XvName, XvNumEvents, XvNumErrors,
|
||||
ProcXvDispatch, SProcXvDispatch,
|
||||
XvResetProc, StandardMinorOpcode);
|
||||
if (!extEntry)
|
||||
{
|
||||
if (!extEntry) {
|
||||
FatalError("XvExtensionInit: AddExtensions failed\n");
|
||||
}
|
||||
|
||||
|
|
@ -201,50 +195,49 @@ XvExtensionInit(void)
|
|||
|
||||
static Bool
|
||||
CreateResourceTypes(void)
|
||||
|
||||
{
|
||||
|
||||
if (XvResourceGeneration == serverGeneration) return TRUE;
|
||||
if (XvResourceGeneration == serverGeneration)
|
||||
return TRUE;
|
||||
|
||||
XvResourceGeneration = serverGeneration;
|
||||
|
||||
if (!(XvRTPort = CreateNewResourceType(XvdiDestroyPort, "XvRTPort")))
|
||||
{
|
||||
if (!(XvRTPort = CreateNewResourceType(XvdiDestroyPort, "XvRTPort"))) {
|
||||
ErrorF("CreateResourceTypes: failed to allocate port resource.\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!(XvRTGrab = CreateNewResourceType(XvdiDestroyGrab, "XvRTGrab")))
|
||||
{
|
||||
if (!(XvRTGrab = CreateNewResourceType(XvdiDestroyGrab, "XvRTGrab"))) {
|
||||
ErrorF("CreateResourceTypes: failed to allocate grab resource.\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!(XvRTEncoding = CreateNewResourceType(XvdiDestroyEncoding,
|
||||
"XvRTEncoding")))
|
||||
{
|
||||
"XvRTEncoding"))) {
|
||||
ErrorF("CreateResourceTypes: failed to allocate encoding resource.\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!(XvRTVideoNotify = CreateNewResourceType(XvdiDestroyVideoNotify,
|
||||
"XvRTVideoNotify")))
|
||||
{
|
||||
ErrorF("CreateResourceTypes: failed to allocate video notify resource.\n");
|
||||
"XvRTVideoNotify"))) {
|
||||
ErrorF
|
||||
("CreateResourceTypes: failed to allocate video notify resource.\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!(XvRTVideoNotifyList = CreateNewResourceType(XvdiDestroyVideoNotifyList,
|
||||
"XvRTVideoNotifyList")))
|
||||
{
|
||||
ErrorF("CreateResourceTypes: failed to allocate video notify list resource.\n");
|
||||
if (!
|
||||
(XvRTVideoNotifyList =
|
||||
CreateNewResourceType(XvdiDestroyVideoNotifyList,
|
||||
"XvRTVideoNotifyList"))) {
|
||||
ErrorF
|
||||
("CreateResourceTypes: failed to allocate video notify list resource.\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!(XvRTPortNotify = CreateNewResourceType(XvdiDestroyPortNotify,
|
||||
"XvRTPortNotify")))
|
||||
{
|
||||
ErrorF("CreateResourceTypes: failed to allocate port notify resource.\n");
|
||||
"XvRTPortNotify"))) {
|
||||
ErrorF
|
||||
("CreateResourceTypes: failed to allocate port notify resource.\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
@ -257,10 +250,8 @@ XvScreenInit(ScreenPtr pScreen)
|
|||
{
|
||||
XvScreenPtr pxvs;
|
||||
|
||||
if (XvScreenGeneration != serverGeneration)
|
||||
{
|
||||
if (!CreateResourceTypes())
|
||||
{
|
||||
if (XvScreenGeneration != serverGeneration) {
|
||||
if (!CreateResourceTypes()) {
|
||||
ErrorF("XvScreenInit: Unable to allocate resource types\n");
|
||||
return BadAlloc;
|
||||
}
|
||||
|
|
@ -273,16 +264,14 @@ XvScreenInit(ScreenPtr pScreen)
|
|||
if (!dixRegisterPrivateKey(&XvScreenKeyRec, PRIVATE_SCREEN, 0))
|
||||
return BadAlloc;
|
||||
|
||||
if (dixLookupPrivate(&pScreen->devPrivates, XvScreenKey))
|
||||
{
|
||||
if (dixLookupPrivate(&pScreen->devPrivates, XvScreenKey)) {
|
||||
ErrorF("XvScreenInit: screen devPrivates ptr non-NULL before init\n");
|
||||
}
|
||||
|
||||
/* ALLOCATE SCREEN PRIVATE RECORD */
|
||||
|
||||
pxvs = malloc(sizeof(XvScreenRec));
|
||||
if (!pxvs)
|
||||
{
|
||||
if (!pxvs) {
|
||||
ErrorF("XvScreenInit: Unable to allocate screen private structure\n");
|
||||
return BadAlloc;
|
||||
}
|
||||
|
|
@ -301,10 +290,8 @@ XvScreenInit(ScreenPtr pScreen)
|
|||
}
|
||||
|
||||
static Bool
|
||||
XvCloseScreen(
|
||||
int ii,
|
||||
ScreenPtr pScreen
|
||||
){
|
||||
XvCloseScreen(int ii, ScreenPtr pScreen)
|
||||
{
|
||||
|
||||
XvScreenPtr pxvs;
|
||||
|
||||
|
|
@ -362,15 +349,12 @@ XvDestroyPixmap(PixmapPtr pPix)
|
|||
|
||||
pa = pxvs->pAdaptors;
|
||||
na = pxvs->nAdaptors;
|
||||
while (na--)
|
||||
{
|
||||
while (na--) {
|
||||
np = pa->nPorts;
|
||||
pp = pa->pPorts;
|
||||
|
||||
while (np--)
|
||||
{
|
||||
if (pp->pDraw == (DrawablePtr)pPix)
|
||||
{
|
||||
while (np--) {
|
||||
if (pp->pDraw == (DrawablePtr) pPix) {
|
||||
XvdiSendVideoNotify(pp, pp->pDraw, XvPreempted);
|
||||
|
||||
(void) (*pp->pAdaptor->ddStopVideo) (NULL, pp, pp->pDraw);
|
||||
|
|
@ -413,15 +397,12 @@ XvDestroyWindow(WindowPtr pWin)
|
|||
|
||||
pa = pxvs->pAdaptors;
|
||||
na = pxvs->nAdaptors;
|
||||
while (na--)
|
||||
{
|
||||
while (na--) {
|
||||
np = pa->nPorts;
|
||||
pp = pa->pPorts;
|
||||
|
||||
while (np--)
|
||||
{
|
||||
if (pp->pDraw == (DrawablePtr)pWin)
|
||||
{
|
||||
while (np--) {
|
||||
if (pp->pDraw == (DrawablePtr) pWin) {
|
||||
XvdiSendVideoNotify(pp, pp->pDraw, XvPreempted);
|
||||
|
||||
(void) (*pp->pAdaptor->ddStopVideo) (NULL, pp, pp->pDraw);
|
||||
|
|
@ -435,7 +416,6 @@ XvDestroyWindow(WindowPtr pWin)
|
|||
pa++;
|
||||
}
|
||||
|
||||
|
||||
status = (*pScreen->DestroyWindow) (pWin);
|
||||
|
||||
SCREEN_EPILOGUE(pScreen, DestroyWindow, XvDestroyWindow);
|
||||
|
|
@ -455,7 +435,8 @@ XvdiVideoStopped(XvPortPtr pPort, int reason)
|
|||
|
||||
/* IF PORT ISN'T ACTIVE THEN WE'RE DONE */
|
||||
|
||||
if (!pPort->pDraw) return Success;
|
||||
if (!pPort->pDraw)
|
||||
return Success;
|
||||
|
||||
XvdiSendVideoNotify(pPort, pPort->pDraw, reason);
|
||||
|
||||
|
|
@ -507,10 +488,10 @@ XvdiDestroyVideoNotifyList(pointer pn, XID id)
|
|||
|
||||
cpn = (XvVideoNotifyPtr) pn;
|
||||
|
||||
while (cpn)
|
||||
{
|
||||
while (cpn) {
|
||||
npn = cpn->next;
|
||||
if (cpn->client) FreeResource(cpn->id, XvRTVideoNotify);
|
||||
if (cpn->client)
|
||||
FreeResource(cpn->id, XvRTVideoNotify);
|
||||
free(cpn);
|
||||
cpn = npn;
|
||||
}
|
||||
|
|
@ -532,8 +513,7 @@ XvdiSendVideoNotify(XvPortPtr pPort, DrawablePtr pDraw, int reason)
|
|||
dixLookupResourceByType((pointer *) &pn, pDraw->id, XvRTVideoNotifyList,
|
||||
serverClient, DixReadAccess);
|
||||
|
||||
while (pn)
|
||||
{
|
||||
while (pn) {
|
||||
event.u.u.type = XvEventBase + XvVideoNotify;
|
||||
event.u.videoNotify.time = currentTime.milliseconds;
|
||||
event.u.videoNotify.drawable = pDraw->id;
|
||||
|
|
@ -547,20 +527,15 @@ XvdiSendVideoNotify(XvPortPtr pPort, DrawablePtr pDraw, int reason)
|
|||
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
XvdiSendPortNotify(
|
||||
XvPortPtr pPort,
|
||||
Atom attribute,
|
||||
INT32 value
|
||||
){
|
||||
XvdiSendPortNotify(XvPortPtr pPort, Atom attribute, INT32 value)
|
||||
{
|
||||
xvEvent event;
|
||||
XvPortNotifyPtr pn;
|
||||
|
||||
pn = pPort->pNotify;
|
||||
|
||||
while (pn)
|
||||
{
|
||||
while (pn) {
|
||||
event.u.u.type = XvEventBase + XvPortNotify;
|
||||
event.u.portNotify.time = currentTime.milliseconds;
|
||||
event.u.portNotify.port = pPort->id;
|
||||
|
|
@ -574,7 +549,6 @@ XvdiSendPortNotify(
|
|||
|
||||
}
|
||||
|
||||
|
||||
#define CHECK_SIZE(dw, dh, sw, sh) { \
|
||||
if(!dw || !dh || !sw || !sh) return Success; \
|
||||
/* The region code will break these if they are too large */ \
|
||||
|
|
@ -582,18 +556,15 @@ XvdiSendPortNotify(
|
|||
return BadValue; \
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
XvdiPutVideo(
|
||||
ClientPtr client,
|
||||
XvdiPutVideo(ClientPtr client,
|
||||
DrawablePtr pDraw,
|
||||
XvPortPtr pPort,
|
||||
GCPtr pGC,
|
||||
INT16 vid_x, INT16 vid_y,
|
||||
CARD16 vid_w, CARD16 vid_h,
|
||||
INT16 drw_x, INT16 drw_y,
|
||||
CARD16 drw_w, CARD16 drw_h
|
||||
){
|
||||
INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h)
|
||||
{
|
||||
DrawablePtr pOldDraw;
|
||||
|
||||
CHECK_SIZE(drw_w, drw_h, vid_w, vid_h);
|
||||
|
|
@ -605,8 +576,7 @@ XvdiPutVideo(
|
|||
/* CHECK FOR GRAB; IF THIS CLIENT DOESN'T HAVE THE PORT GRABBED THEN
|
||||
INFORM CLIENT OF ITS FAILURE */
|
||||
|
||||
if (pPort->grab.client && (pPort->grab.client != client))
|
||||
{
|
||||
if (pPort->grab.client && (pPort->grab.client != client)) {
|
||||
XvdiSendVideoNotify(pPort, pDraw, XvBusy);
|
||||
return Success;
|
||||
}
|
||||
|
|
@ -615,8 +585,7 @@ XvdiPutVideo(
|
|||
EVENTS TO ANY CLIENTS WHO WANT THEM */
|
||||
|
||||
pOldDraw = pPort->pDraw;
|
||||
if ((pOldDraw) && (pOldDraw != pDraw))
|
||||
{
|
||||
if ((pOldDraw) && (pOldDraw != pDraw)) {
|
||||
XvdiSendVideoNotify(pPort, pPort->pDraw, XvPreempted);
|
||||
}
|
||||
|
||||
|
|
@ -624,8 +593,7 @@ XvdiPutVideo(
|
|||
vid_x, vid_y, vid_w, vid_h,
|
||||
drw_x, drw_y, drw_w, drw_h);
|
||||
|
||||
if ((pPort->pDraw) && (pOldDraw != pDraw))
|
||||
{
|
||||
if ((pPort->pDraw) && (pOldDraw != pDraw)) {
|
||||
pPort->client = client;
|
||||
XvdiSendVideoNotify(pPort, pPort->pDraw, XvStarted);
|
||||
}
|
||||
|
|
@ -637,16 +605,14 @@ XvdiPutVideo(
|
|||
}
|
||||
|
||||
int
|
||||
XvdiPutStill(
|
||||
ClientPtr client,
|
||||
XvdiPutStill(ClientPtr client,
|
||||
DrawablePtr pDraw,
|
||||
XvPortPtr pPort,
|
||||
GCPtr pGC,
|
||||
INT16 vid_x, INT16 vid_y,
|
||||
CARD16 vid_w, CARD16 vid_h,
|
||||
INT16 drw_x, INT16 drw_y,
|
||||
CARD16 drw_w, CARD16 drw_h
|
||||
){
|
||||
INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h)
|
||||
{
|
||||
int status;
|
||||
|
||||
CHECK_SIZE(drw_w, drw_h, vid_w, vid_h);
|
||||
|
|
@ -658,8 +624,7 @@ XvdiPutStill(
|
|||
/* CHECK FOR GRAB; IF THIS CLIENT DOESN'T HAVE THE PORT GRABBED THEN
|
||||
INFORM CLIENT OF ITS FAILURE */
|
||||
|
||||
if (pPort->grab.client && (pPort->grab.client != client))
|
||||
{
|
||||
if (pPort->grab.client && (pPort->grab.client != client)) {
|
||||
XvdiSendVideoNotify(pPort, pDraw, XvBusy);
|
||||
return Success;
|
||||
}
|
||||
|
|
@ -675,8 +640,7 @@ XvdiPutStill(
|
|||
}
|
||||
|
||||
int
|
||||
XvdiPutImage(
|
||||
ClientPtr client,
|
||||
XvdiPutImage(ClientPtr client,
|
||||
DrawablePtr pDraw,
|
||||
XvPortPtr pPort,
|
||||
GCPtr pGC,
|
||||
|
|
@ -685,10 +649,8 @@ XvdiPutImage(
|
|||
INT16 drw_x, INT16 drw_y,
|
||||
CARD16 drw_w, CARD16 drw_h,
|
||||
XvImagePtr image,
|
||||
unsigned char* data,
|
||||
Bool sync,
|
||||
CARD16 width, CARD16 height
|
||||
){
|
||||
unsigned char *data, Bool sync, CARD16 width, CARD16 height)
|
||||
{
|
||||
CHECK_SIZE(drw_w, drw_h, src_w, src_h);
|
||||
|
||||
/* UPDATE TIME VARIABLES FOR USE IN EVENTS */
|
||||
|
|
@ -698,8 +660,7 @@ XvdiPutImage(
|
|||
/* CHECK FOR GRAB; IF THIS CLIENT DOESN'T HAVE THE PORT GRABBED THEN
|
||||
INFORM CLIENT OF ITS FAILURE */
|
||||
|
||||
if (pPort->grab.client && (pPort->grab.client != client))
|
||||
{
|
||||
if (pPort->grab.client && (pPort->grab.client != client)) {
|
||||
XvdiSendVideoNotify(pPort, pDraw, XvBusy);
|
||||
return Success;
|
||||
}
|
||||
|
|
@ -712,18 +673,15 @@ XvdiPutImage(
|
|||
image, data, sync, width, height);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
XvdiGetVideo(
|
||||
ClientPtr client,
|
||||
XvdiGetVideo(ClientPtr client,
|
||||
DrawablePtr pDraw,
|
||||
XvPortPtr pPort,
|
||||
GCPtr pGC,
|
||||
INT16 vid_x, INT16 vid_y,
|
||||
CARD16 vid_w, CARD16 vid_h,
|
||||
INT16 drw_x, INT16 drw_y,
|
||||
CARD16 drw_w, CARD16 drw_h
|
||||
){
|
||||
INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h)
|
||||
{
|
||||
DrawablePtr pOldDraw;
|
||||
|
||||
CHECK_SIZE(drw_w, drw_h, vid_w, vid_h);
|
||||
|
|
@ -735,8 +693,7 @@ XvdiGetVideo(
|
|||
/* CHECK FOR GRAB; IF THIS CLIENT DOESN'T HAVE THE PORT GRABBED THEN
|
||||
INFORM CLIENT OF ITS FAILURE */
|
||||
|
||||
if (pPort->grab.client && (pPort->grab.client != client))
|
||||
{
|
||||
if (pPort->grab.client && (pPort->grab.client != client)) {
|
||||
XvdiSendVideoNotify(pPort, pDraw, XvBusy);
|
||||
return Success;
|
||||
}
|
||||
|
|
@ -745,8 +702,7 @@ XvdiGetVideo(
|
|||
EVENTS TO ANY CLIENTS WHO WANT THEM */
|
||||
|
||||
pOldDraw = pPort->pDraw;
|
||||
if ((pOldDraw) && (pOldDraw != pDraw))
|
||||
{
|
||||
if ((pOldDraw) && (pOldDraw != pDraw)) {
|
||||
XvdiSendVideoNotify(pPort, pPort->pDraw, XvPreempted);
|
||||
}
|
||||
|
||||
|
|
@ -754,8 +710,7 @@ XvdiGetVideo(
|
|||
vid_x, vid_y, vid_w, vid_h,
|
||||
drw_x, drw_y, drw_w, drw_h);
|
||||
|
||||
if ((pPort->pDraw) && (pOldDraw != pDraw))
|
||||
{
|
||||
if ((pPort->pDraw) && (pOldDraw != pDraw)) {
|
||||
pPort->client = client;
|
||||
XvdiSendVideoNotify(pPort, pPort->pDraw, XvStarted);
|
||||
}
|
||||
|
|
@ -767,16 +722,14 @@ XvdiGetVideo(
|
|||
}
|
||||
|
||||
int
|
||||
XvdiGetStill(
|
||||
ClientPtr client,
|
||||
XvdiGetStill(ClientPtr client,
|
||||
DrawablePtr pDraw,
|
||||
XvPortPtr pPort,
|
||||
GCPtr pGC,
|
||||
INT16 vid_x, INT16 vid_y,
|
||||
CARD16 vid_w, CARD16 vid_h,
|
||||
INT16 drw_x, INT16 drw_y,
|
||||
CARD16 drw_w, CARD16 drw_h
|
||||
){
|
||||
INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h)
|
||||
{
|
||||
int status;
|
||||
|
||||
CHECK_SIZE(drw_w, drw_h, vid_w, vid_h);
|
||||
|
|
@ -788,8 +741,7 @@ XvdiGetStill(
|
|||
/* CHECK FOR GRAB; IF THIS CLIENT DOESN'T HAVE THE PORT GRABBED THEN
|
||||
INFORM CLIENT OF ITS FAILURE */
|
||||
|
||||
if (pPort->grab.client && (pPort->grab.client != client))
|
||||
{
|
||||
if (pPort->grab.client && (pPort->grab.client != client)) {
|
||||
XvdiSendVideoNotify(pPort, pDraw, XvBusy);
|
||||
return Success;
|
||||
}
|
||||
|
|
@ -805,48 +757,39 @@ XvdiGetStill(
|
|||
}
|
||||
|
||||
int
|
||||
XvdiGrabPort(
|
||||
ClientPtr client,
|
||||
XvPortPtr pPort,
|
||||
Time ctime,
|
||||
int *p_result
|
||||
){
|
||||
XvdiGrabPort(ClientPtr client, XvPortPtr pPort, Time ctime, int *p_result)
|
||||
{
|
||||
unsigned long id;
|
||||
TimeStamp time;
|
||||
|
||||
UpdateCurrentTime();
|
||||
time = ClientTimeToServerTime(ctime);
|
||||
|
||||
if (pPort->grab.client && (client != pPort->grab.client))
|
||||
{
|
||||
if (pPort->grab.client && (client != pPort->grab.client)) {
|
||||
*p_result = XvAlreadyGrabbed;
|
||||
return Success;
|
||||
}
|
||||
|
||||
if ((CompareTimeStamps(time, currentTime) == LATER) ||
|
||||
(CompareTimeStamps(time, pPort->time) == EARLIER))
|
||||
{
|
||||
(CompareTimeStamps(time, pPort->time) == EARLIER)) {
|
||||
*p_result = XvInvalidTime;
|
||||
return Success;
|
||||
}
|
||||
|
||||
if (client == pPort->grab.client)
|
||||
{
|
||||
if (client == pPort->grab.client) {
|
||||
*p_result = Success;
|
||||
return Success;
|
||||
}
|
||||
|
||||
id = FakeClientID(client->index);
|
||||
|
||||
if (!AddResource(id, XvRTGrab, &pPort->grab))
|
||||
{
|
||||
if (!AddResource(id, XvRTGrab, &pPort->grab)) {
|
||||
return BadAlloc;
|
||||
}
|
||||
|
||||
/* IF THERE IS ACTIVE VIDEO THEN STOP IT */
|
||||
|
||||
if ((pPort->pDraw) && (client != pPort->client))
|
||||
{
|
||||
if ((pPort->pDraw) && (client != pPort->client)) {
|
||||
XvdiStopVideo(NULL, pPort, pPort->pDraw);
|
||||
}
|
||||
|
||||
|
|
@ -862,24 +805,19 @@ XvdiGrabPort(
|
|||
}
|
||||
|
||||
int
|
||||
XvdiUngrabPort(
|
||||
ClientPtr client,
|
||||
XvPortPtr pPort,
|
||||
Time ctime
|
||||
){
|
||||
XvdiUngrabPort(ClientPtr client, XvPortPtr pPort, Time ctime)
|
||||
{
|
||||
TimeStamp time;
|
||||
|
||||
UpdateCurrentTime();
|
||||
time = ClientTimeToServerTime(ctime);
|
||||
|
||||
if ((!pPort->grab.client) || (client != pPort->grab.client))
|
||||
{
|
||||
if ((!pPort->grab.client) || (client != pPort->grab.client)) {
|
||||
return Success;
|
||||
}
|
||||
|
||||
if ((CompareTimeStamps(time, currentTime) == LATER) ||
|
||||
(CompareTimeStamps(time, pPort->time) == EARLIER))
|
||||
{
|
||||
(CompareTimeStamps(time, pPort->time) == EARLIER)) {
|
||||
return Success;
|
||||
}
|
||||
|
||||
|
|
@ -894,70 +832,63 @@ XvdiUngrabPort(
|
|||
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
XvdiSelectVideoNotify(
|
||||
ClientPtr client,
|
||||
DrawablePtr pDraw,
|
||||
BOOL onoff
|
||||
){
|
||||
XvdiSelectVideoNotify(ClientPtr client, DrawablePtr pDraw, BOOL onoff)
|
||||
{
|
||||
XvVideoNotifyPtr pn, tpn, fpn;
|
||||
int rc;
|
||||
|
||||
/* FIND VideoNotify LIST */
|
||||
|
||||
rc = dixLookupResourceByType((pointer *)&pn, pDraw->id, XvRTVideoNotifyList,
|
||||
client, DixWriteAccess);
|
||||
rc = dixLookupResourceByType((pointer *) &pn, pDraw->id,
|
||||
XvRTVideoNotifyList, client, DixWriteAccess);
|
||||
if (rc != Success && rc != BadValue)
|
||||
return rc;
|
||||
|
||||
/* IF ONE DONES'T EXIST AND NO MASK, THEN JUST RETURN */
|
||||
|
||||
if (!onoff && !pn) return Success;
|
||||
if (!onoff && !pn)
|
||||
return Success;
|
||||
|
||||
/* IF ONE DOESN'T EXIST CREATE IT AND ADD A RESOURCE SO THAT THE LIST
|
||||
WILL BE DELETED WHEN THE DRAWABLE IS DESTROYED */
|
||||
|
||||
if (!pn)
|
||||
{
|
||||
if (!pn) {
|
||||
if (!(tpn = malloc(sizeof(XvVideoNotifyRec))))
|
||||
return BadAlloc;
|
||||
tpn->next = NULL;
|
||||
if (!AddResource(pDraw->id, XvRTVideoNotifyList, tpn))
|
||||
{
|
||||
if (!AddResource(pDraw->id, XvRTVideoNotifyList, tpn)) {
|
||||
free(tpn);
|
||||
return BadAlloc;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
/* LOOK TO SEE IF ENTRY ALREADY EXISTS */
|
||||
|
||||
fpn = NULL;
|
||||
tpn = pn;
|
||||
while (tpn)
|
||||
{
|
||||
if (tpn->client == client)
|
||||
{
|
||||
if (!onoff) tpn->client = NULL;
|
||||
while (tpn) {
|
||||
if (tpn->client == client) {
|
||||
if (!onoff)
|
||||
tpn->client = NULL;
|
||||
return Success;
|
||||
}
|
||||
if (!tpn->client) fpn = tpn; /* TAKE NOTE OF FREE ENTRY */
|
||||
if (!tpn->client)
|
||||
fpn = tpn; /* TAKE NOTE OF FREE ENTRY */
|
||||
tpn = tpn->next;
|
||||
}
|
||||
|
||||
/* IF TUNNING OFF, THEN JUST RETURN */
|
||||
|
||||
if (!onoff) return Success;
|
||||
if (!onoff)
|
||||
return Success;
|
||||
|
||||
/* IF ONE ISN'T FOUND THEN ALLOCATE ONE AND LINK IT INTO THE LIST */
|
||||
|
||||
if (fpn)
|
||||
{
|
||||
if (fpn) {
|
||||
tpn = fpn;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
if (!(tpn = malloc(sizeof(XvVideoNotifyRec))))
|
||||
return BadAlloc;
|
||||
tpn->next = pn->next;
|
||||
|
|
@ -978,32 +909,28 @@ XvdiSelectVideoNotify(
|
|||
}
|
||||
|
||||
int
|
||||
XvdiSelectPortNotify(
|
||||
ClientPtr client,
|
||||
XvPortPtr pPort,
|
||||
BOOL onoff
|
||||
){
|
||||
XvdiSelectPortNotify(ClientPtr client, XvPortPtr pPort, BOOL onoff)
|
||||
{
|
||||
XvPortNotifyPtr pn, tpn;
|
||||
|
||||
/* SEE IF CLIENT IS ALREADY IN LIST */
|
||||
|
||||
tpn = NULL;
|
||||
pn = pPort->pNotify;
|
||||
while (pn)
|
||||
{
|
||||
if (!pn->client) tpn = pn; /* TAKE NOTE OF FREE ENTRY */
|
||||
if (pn->client == client) break;
|
||||
while (pn) {
|
||||
if (!pn->client)
|
||||
tpn = pn; /* TAKE NOTE OF FREE ENTRY */
|
||||
if (pn->client == client)
|
||||
break;
|
||||
pn = pn->next;
|
||||
}
|
||||
|
||||
/* IS THE CLIENT ALREADY ON THE LIST? */
|
||||
|
||||
if (pn)
|
||||
{
|
||||
if (pn) {
|
||||
/* REMOVE IT? */
|
||||
|
||||
if (!onoff)
|
||||
{
|
||||
if (!onoff) {
|
||||
pn->client = NULL;
|
||||
FreeResource(pn->id, XvRTPortNotify);
|
||||
}
|
||||
|
|
@ -1014,8 +941,7 @@ XvdiSelectPortNotify(
|
|||
/* DIDN'T FIND IT; SO REUSE LIST ELEMENT IF ONE IS FREE OTHERWISE
|
||||
CREATE A NEW ONE AND ADD IT TO THE BEGINNING OF THE LIST */
|
||||
|
||||
if (!tpn)
|
||||
{
|
||||
if (!tpn) {
|
||||
if (!(tpn = malloc(sizeof(XvPortNotifyRec))))
|
||||
return BadAlloc;
|
||||
tpn->next = pPort->pNotify;
|
||||
|
|
@ -1031,17 +957,13 @@ XvdiSelectPortNotify(
|
|||
}
|
||||
|
||||
int
|
||||
XvdiStopVideo(
|
||||
ClientPtr client,
|
||||
XvPortPtr pPort,
|
||||
DrawablePtr pDraw
|
||||
){
|
||||
XvdiStopVideo(ClientPtr client, XvPortPtr pPort, DrawablePtr pDraw)
|
||||
{
|
||||
int status;
|
||||
|
||||
/* IF PORT ISN'T ACTIVE THEN WE'RE DONE */
|
||||
|
||||
if (!pPort->pDraw || (pPort->pDraw != pDraw))
|
||||
{
|
||||
if (!pPort->pDraw || (pPort->pDraw != pDraw)) {
|
||||
XvdiSendVideoNotify(pPort, pDraw, XvStopped);
|
||||
return Success;
|
||||
}
|
||||
|
|
@ -1049,8 +971,7 @@ XvdiStopVideo(
|
|||
/* CHECK FOR GRAB; IF THIS CLIENT DOESN'T HAVE THE PORT GRABBED THEN
|
||||
INFORM CLIENT OF ITS FAILURE */
|
||||
|
||||
if ((client) && (pPort->grab.client) && (pPort->grab.client != client))
|
||||
{
|
||||
if ((client) && (pPort->grab.client) && (pPort->grab.client != client)) {
|
||||
XvdiSendVideoNotify(pPort, pDraw, XvBusy);
|
||||
return Success;
|
||||
}
|
||||
|
|
@ -1068,16 +989,14 @@ XvdiStopVideo(
|
|||
}
|
||||
|
||||
int
|
||||
XvdiPreemptVideo(
|
||||
ClientPtr client,
|
||||
XvPortPtr pPort,
|
||||
DrawablePtr pDraw
|
||||
){
|
||||
XvdiPreemptVideo(ClientPtr client, XvPortPtr pPort, DrawablePtr pDraw)
|
||||
{
|
||||
int status;
|
||||
|
||||
/* IF PORT ISN'T ACTIVE THEN WE'RE DONE */
|
||||
|
||||
if (!pPort->pDraw || (pPort->pDraw != pDraw)) return Success;
|
||||
if (!pPort->pDraw || (pPort->pDraw != pDraw))
|
||||
return Success;
|
||||
|
||||
XvdiSendVideoNotify(pPort, pPort->pDraw, XvPreempted);
|
||||
|
||||
|
|
@ -1092,10 +1011,8 @@ XvdiPreemptVideo(
|
|||
}
|
||||
|
||||
int
|
||||
XvdiMatchPort(
|
||||
XvPortPtr pPort,
|
||||
DrawablePtr pDraw
|
||||
){
|
||||
XvdiMatchPort(XvPortPtr pPort, DrawablePtr pDraw)
|
||||
{
|
||||
|
||||
XvAdaptorPtr pa;
|
||||
XvFormatPtr pf;
|
||||
|
|
@ -1103,13 +1020,13 @@ XvdiMatchPort(
|
|||
|
||||
pa = pPort->pAdaptor;
|
||||
|
||||
if (pa->pScreen != pDraw->pScreen) return BadMatch;
|
||||
if (pa->pScreen != pDraw->pScreen)
|
||||
return BadMatch;
|
||||
|
||||
nf = pa->nFormats;
|
||||
pf = pa->pFormats;
|
||||
|
||||
while (nf--)
|
||||
{
|
||||
while (nf--) {
|
||||
if (pf->depth == pDraw->depth)
|
||||
return Success;
|
||||
pf++;
|
||||
|
|
@ -1120,15 +1037,14 @@ XvdiMatchPort(
|
|||
}
|
||||
|
||||
int
|
||||
XvdiSetPortAttribute(
|
||||
ClientPtr client,
|
||||
XvPortPtr pPort,
|
||||
Atom attribute,
|
||||
INT32 value
|
||||
){
|
||||
XvdiSetPortAttribute(ClientPtr client,
|
||||
XvPortPtr pPort, Atom attribute, INT32 value)
|
||||
{
|
||||
int status;
|
||||
|
||||
status = (* pPort->pAdaptor->ddSetPortAttribute)(client, pPort, attribute, value);
|
||||
status =
|
||||
(*pPort->pAdaptor->ddSetPortAttribute) (client, pPort, attribute,
|
||||
value);
|
||||
if (status == Success)
|
||||
XvdiSendPortNotify(pPort, attribute, value);
|
||||
|
||||
|
|
@ -1136,21 +1052,18 @@ XvdiSetPortAttribute(
|
|||
}
|
||||
|
||||
int
|
||||
XvdiGetPortAttribute(
|
||||
ClientPtr client,
|
||||
XvPortPtr pPort,
|
||||
Atom attribute,
|
||||
INT32 *p_value
|
||||
){
|
||||
XvdiGetPortAttribute(ClientPtr client,
|
||||
XvPortPtr pPort, Atom attribute, INT32 *p_value)
|
||||
{
|
||||
|
||||
return
|
||||
(* pPort->pAdaptor->ddGetPortAttribute)(client, pPort, attribute, p_value);
|
||||
(*pPort->pAdaptor->ddGetPortAttribute) (client, pPort, attribute,
|
||||
p_value);
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
WriteSwappedVideoNotifyEvent(xvEvent * from, xvEvent * to)
|
||||
|
||||
{
|
||||
|
||||
to->u.u.type = from->u.u.type;
|
||||
|
|
@ -1165,7 +1078,6 @@ WriteSwappedVideoNotifyEvent(xvEvent *from, xvEvent *to)
|
|||
|
||||
static void
|
||||
WriteSwappedPortNotifyEvent(xvEvent * from, xvEvent * to)
|
||||
|
||||
{
|
||||
|
||||
to->u.u.type = from->u.u.type;
|
||||
|
|
|
|||
99
Xext/xvmc.c
99
Xext/xvmc.c
|
|
@ -28,12 +28,11 @@
|
|||
#include <sys/shm.h>
|
||||
#endif /* HAS_XVMCSHM */
|
||||
|
||||
|
||||
|
||||
#define DR_CLIENT_DRIVER_NAME_SIZE 48
|
||||
#define DR_BUSID_SIZE 48
|
||||
|
||||
static DevPrivateKeyRec XvMCScreenKeyRec;
|
||||
|
||||
#define XvMCScreenKey (&XvMCScreenKeyRec)
|
||||
static Bool XvMCInUse;
|
||||
|
||||
|
|
@ -60,7 +59,6 @@ typedef struct {
|
|||
#define XVMC_GET_PRIVATE(pScreen) \
|
||||
(XvMCScreenPtr)(dixLookupPrivate(&(pScreen)->devPrivates, XvMCScreenKey))
|
||||
|
||||
|
||||
static int
|
||||
XvMCDestroyContextRes(pointer data, XID id)
|
||||
{
|
||||
|
|
@ -70,6 +68,7 @@ XvMCDestroyContextRes(pointer data, XID id)
|
|||
|
||||
if (!pContext->refcnt) {
|
||||
XvMCScreenPtr pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen);
|
||||
|
||||
(*pScreenPriv->adaptors[pContext->adapt_num].DestroyContext) (pContext);
|
||||
free(pContext);
|
||||
}
|
||||
|
|
@ -92,7 +91,6 @@ XvMCDestroySurfaceRes(pointer data, XID id)
|
|||
return Success;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
XvMCDestroySubpictureRes(pointer data, XID id)
|
||||
{
|
||||
|
|
@ -112,6 +110,7 @@ static int
|
|||
ProcXvMCQueryVersion(ClientPtr client)
|
||||
{
|
||||
xvmcQueryVersionReply rep;
|
||||
|
||||
/* REQUEST(xvmcQueryVersionReq); */
|
||||
REQUEST_SIZE_MATCH(xvmcQueryVersionReq);
|
||||
rep.type = X_Reply;
|
||||
|
|
@ -123,7 +122,6 @@ ProcXvMCQueryVersion(ClientPtr client)
|
|||
return Success;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
ProcXvMCListSurfaceTypes(ClientPtr client)
|
||||
{
|
||||
|
|
@ -134,6 +132,7 @@ ProcXvMCListSurfaceTypes(ClientPtr client)
|
|||
xvmcSurfaceInfo info;
|
||||
XvMCAdaptorPtr adaptor = NULL;
|
||||
XvMCSurfaceInfoPtr surface;
|
||||
|
||||
REQUEST(xvmcListSurfaceTypesReq);
|
||||
REQUEST_SIZE_MATCH(xvmcListSurfaceTypesReq);
|
||||
|
||||
|
|
@ -141,6 +140,7 @@ ProcXvMCListSurfaceTypes(ClientPtr client)
|
|||
|
||||
if (XvMCInUse) { /* any adaptors at all */
|
||||
ScreenPtr pScreen = pPort->pAdaptor->pScreen;
|
||||
|
||||
if ((pScreenPriv = XVMC_GET_PRIVATE(pScreen))) { /* any this screen */
|
||||
for (i = 0; i < pScreenPriv->num_adaptors; i++) {
|
||||
if (pPort->pAdaptor == pScreenPriv->adaptors[i].xv_adaptor) {
|
||||
|
|
@ -187,6 +187,7 @@ ProcXvMCCreateContext(ClientPtr client)
|
|||
XvMCAdaptorPtr adaptor = NULL;
|
||||
XvMCSurfaceInfoPtr surface = NULL;
|
||||
xvmcCreateContextReply rep;
|
||||
|
||||
REQUEST(xvmcCreateContextReq);
|
||||
REQUEST_SIZE_MATCH(xvmcCreateContextReq);
|
||||
|
||||
|
|
@ -219,8 +220,8 @@ ProcXvMCCreateContext(ClientPtr client)
|
|||
}
|
||||
|
||||
/* adaptor doesn't support this suface_type_id */
|
||||
if(!surface) return BadMatch;
|
||||
|
||||
if (!surface)
|
||||
return BadMatch;
|
||||
|
||||
if ((stuff->width > surface->max_width) ||
|
||||
(stuff->height > surface->max_height))
|
||||
|
|
@ -230,7 +231,6 @@ ProcXvMCCreateContext(ClientPtr client)
|
|||
return BadAlloc;
|
||||
}
|
||||
|
||||
|
||||
pContext->pScreen = pScreen;
|
||||
pContext->adapt_num = adapt_num;
|
||||
pContext->context_id = stuff->context_id;
|
||||
|
|
@ -269,6 +269,7 @@ ProcXvMCDestroyContext(ClientPtr client)
|
|||
{
|
||||
pointer val;
|
||||
int rc;
|
||||
|
||||
REQUEST(xvmcDestroyContextReq);
|
||||
REQUEST_SIZE_MATCH(xvmcDestroyContextReq);
|
||||
|
||||
|
|
@ -292,6 +293,7 @@ ProcXvMCCreateSurface(ClientPtr client)
|
|||
XvMCSurfacePtr pSurface;
|
||||
XvMCScreenPtr pScreenPriv;
|
||||
xvmcCreateSurfaceReply rep;
|
||||
|
||||
REQUEST(xvmcCreateSurfaceReq);
|
||||
REQUEST_SIZE_MATCH(xvmcCreateSurfaceReq);
|
||||
|
||||
|
|
@ -309,8 +311,10 @@ ProcXvMCCreateSurface(ClientPtr client)
|
|||
pSurface->surface_type_id = pContext->surface_type_id;
|
||||
pSurface->context = pContext;
|
||||
|
||||
result = (*pScreenPriv->adaptors[pContext->adapt_num].CreateSurface)(
|
||||
pSurface, &dwords, &data);
|
||||
result =
|
||||
(*pScreenPriv->adaptors[pContext->adapt_num].CreateSurface) (pSurface,
|
||||
&dwords,
|
||||
&data);
|
||||
|
||||
if (result != Success) {
|
||||
free(pSurface);
|
||||
|
|
@ -338,6 +342,7 @@ ProcXvMCDestroySurface(ClientPtr client)
|
|||
{
|
||||
pointer val;
|
||||
int rc;
|
||||
|
||||
REQUEST(xvmcDestroySurfaceReq);
|
||||
REQUEST_SIZE_MATCH(xvmcDestroySurfaceReq);
|
||||
|
||||
|
|
@ -363,6 +368,7 @@ ProcXvMCCreateSubpicture(ClientPtr client)
|
|||
xvmcCreateSubpictureReply rep;
|
||||
XvMCAdaptorPtr adaptor;
|
||||
XvMCSurfaceInfoPtr surface = NULL;
|
||||
|
||||
REQUEST(xvmcCreateSubpictureReq);
|
||||
REQUEST_SIZE_MATCH(xvmcCreateSubpictureReq);
|
||||
|
||||
|
|
@ -383,19 +389,23 @@ ProcXvMCCreateSubpicture(ClientPtr client)
|
|||
}
|
||||
}
|
||||
|
||||
if(!surface) return BadMatch;
|
||||
if (!surface)
|
||||
return BadMatch;
|
||||
|
||||
/* make sure this surface supports that xvimage format */
|
||||
if(!surface->compatible_subpictures) return BadMatch;
|
||||
if (!surface->compatible_subpictures)
|
||||
return BadMatch;
|
||||
|
||||
for (i = 0; i < surface->compatible_subpictures->num_xvimages; i++) {
|
||||
if(surface->compatible_subpictures->xvimage_ids[i] == stuff->xvimage_id) {
|
||||
if (surface->compatible_subpictures->xvimage_ids[i] ==
|
||||
stuff->xvimage_id) {
|
||||
image_supported = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!image_supported) return BadMatch;
|
||||
if (!image_supported)
|
||||
return BadMatch;
|
||||
|
||||
/* make sure the size is OK */
|
||||
if ((stuff->width > surface->subpicture_max_width) ||
|
||||
|
|
@ -417,8 +427,9 @@ ProcXvMCCreateSubpicture(ClientPtr client)
|
|||
pSubpicture->component_order[3] = 0;
|
||||
pSubpicture->context = pContext;
|
||||
|
||||
result = (*pScreenPriv->adaptors[pContext->adapt_num].CreateSubpicture)(
|
||||
pSubpicture, &dwords, &data);
|
||||
result =
|
||||
(*pScreenPriv->adaptors[pContext->adapt_num].
|
||||
CreateSubpicture) (pSubpicture, &dwords, &data);
|
||||
|
||||
if (result != Success) {
|
||||
free(pSubpicture);
|
||||
|
|
@ -454,6 +465,7 @@ ProcXvMCDestroySubpicture(ClientPtr client)
|
|||
{
|
||||
pointer val;
|
||||
int rc;
|
||||
|
||||
REQUEST(xvmcDestroySubpictureReq);
|
||||
REQUEST_SIZE_MATCH(xvmcDestroySubpictureReq);
|
||||
|
||||
|
|
@ -467,7 +479,6 @@ ProcXvMCDestroySubpicture(ClientPtr client)
|
|||
return Success;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
ProcXvMCListSubpictureTypes(ClientPtr client)
|
||||
{
|
||||
|
|
@ -480,6 +491,7 @@ ProcXvMCListSubpictureTypes(ClientPtr client)
|
|||
xvImageFormatInfo info;
|
||||
XvImagePtr pImage;
|
||||
int i, j;
|
||||
|
||||
REQUEST(xvmcListSubpictureTypesReq);
|
||||
REQUEST_SIZE_MATCH(xvmcListSubpictureTypesReq);
|
||||
|
||||
|
|
@ -500,7 +512,8 @@ ProcXvMCListSubpictureTypes(ClientPtr client)
|
|||
}
|
||||
}
|
||||
|
||||
if(!adaptor) return BadMatch;
|
||||
if (!adaptor)
|
||||
return BadMatch;
|
||||
|
||||
for (i = 0; i < adaptor->num_surfaces; i++) {
|
||||
if (adaptor->surfaces[i]->surface_type_id == stuff->surface_type_id) {
|
||||
|
|
@ -509,7 +522,8 @@ ProcXvMCListSubpictureTypes(ClientPtr client)
|
|||
}
|
||||
}
|
||||
|
||||
if(!surface) return BadMatch;
|
||||
if (!surface)
|
||||
return BadMatch;
|
||||
|
||||
rep.type = X_Reply;
|
||||
rep.sequenceNumber = client->sequence;
|
||||
|
|
@ -525,13 +539,13 @@ ProcXvMCListSubpictureTypes(ClientPtr client)
|
|||
pImage = NULL;
|
||||
for (j = 0; j < adaptor->num_subpictures; j++) {
|
||||
if (surface->compatible_subpictures->xvimage_ids[i] ==
|
||||
adaptor->subpictures[j]->id)
|
||||
{
|
||||
adaptor->subpictures[j]->id) {
|
||||
pImage = adaptor->subpictures[j];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!pImage) return BadImplementation;
|
||||
if (!pImage)
|
||||
return BadImplementation;
|
||||
|
||||
info.id = pImage->id;
|
||||
info.type = pImage->type;
|
||||
|
|
@ -620,18 +634,14 @@ ProcXvMCGetDRInfo(ClientPtr client)
|
|||
}
|
||||
#endif /* HAS_XVMCSHM */
|
||||
|
||||
WriteToClient(client, sizeof(xvmcGetDRInfoReply),
|
||||
(char*)&rep);
|
||||
WriteToClient(client, sizeof(xvmcGetDRInfoReply), (char *) &rep);
|
||||
if (rep.length) {
|
||||
WriteToClient(client, rep.nameLen,
|
||||
pScreenPriv->clientDriverName);
|
||||
WriteToClient(client, rep.busIDLen,
|
||||
pScreenPriv->busID);
|
||||
WriteToClient(client, rep.nameLen, pScreenPriv->clientDriverName);
|
||||
WriteToClient(client, rep.busIDLen, pScreenPriv->busID);
|
||||
}
|
||||
return Success;
|
||||
}
|
||||
|
||||
|
||||
int (*ProcXvMCVector[xvmcNumRequest]) (ClientPtr) = {
|
||||
ProcXvMCQueryVersion,
|
||||
ProcXvMCListSurfaceTypes,
|
||||
|
|
@ -641,9 +651,7 @@ int (*ProcXvMCVector[xvmcNumRequest])(ClientPtr) = {
|
|||
ProcXvMCDestroySurface,
|
||||
ProcXvMCCreateSubpicture,
|
||||
ProcXvMCDestroySubpicture,
|
||||
ProcXvMCListSubpictureTypes,
|
||||
ProcXvMCGetDRInfo
|
||||
};
|
||||
ProcXvMCListSubpictureTypes, ProcXvMCGetDRInfo};
|
||||
|
||||
static int
|
||||
ProcXvMCDispatch(ClientPtr client)
|
||||
|
|
@ -687,13 +695,17 @@ XvMCExtensionInit(void)
|
|||
ProcXvMCDispatch, SProcXvMCDispatch,
|
||||
NULL, StandardMinorOpcode);
|
||||
|
||||
if(!extEntry) return;
|
||||
if (!extEntry)
|
||||
return;
|
||||
|
||||
XvMCReqCode = extEntry->base;
|
||||
XvMCEventBase = extEntry->eventBase;
|
||||
SetResourceTypeErrorValue(XvMCRTContext, extEntry->errorBase + XvMCBadContext);
|
||||
SetResourceTypeErrorValue(XvMCRTSurface, extEntry->errorBase + XvMCBadSurface);
|
||||
SetResourceTypeErrorValue(XvMCRTSubpicture, extEntry->errorBase + XvMCBadSubpicture);
|
||||
SetResourceTypeErrorValue(XvMCRTContext,
|
||||
extEntry->errorBase + XvMCBadContext);
|
||||
SetResourceTypeErrorValue(XvMCRTSurface,
|
||||
extEntry->errorBase + XvMCBadSurface);
|
||||
SetResourceTypeErrorValue(XvMCRTSubpicture,
|
||||
extEntry->errorBase + XvMCBadSubpicture);
|
||||
}
|
||||
|
||||
static Bool
|
||||
|
|
@ -708,7 +720,6 @@ XvMCCloseScreen (int i, ScreenPtr pScreen)
|
|||
return (*pScreen->CloseScreen) (i, pScreen);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
XvMCScreenInit(ScreenPtr pScreen, int num, XvMCAdaptorPtr pAdapt)
|
||||
{
|
||||
|
|
@ -738,7 +749,8 @@ XvMCScreenInit(ScreenPtr pScreen, int num, XvMCAdaptorPtr pAdapt)
|
|||
return Success;
|
||||
}
|
||||
|
||||
XvImagePtr XvMCFindXvImage(XvPortPtr pPort, CARD32 id)
|
||||
XvImagePtr
|
||||
XvMCFindXvImage(XvPortPtr pPort, CARD32 id)
|
||||
{
|
||||
XvImagePtr pImage = NULL;
|
||||
ScreenPtr pScreen = pPort->pAdaptor->pScreen;
|
||||
|
|
@ -759,7 +771,8 @@ XvImagePtr XvMCFindXvImage(XvPortPtr pPort, CARD32 id)
|
|||
}
|
||||
}
|
||||
|
||||
if(!adaptor) return NULL;
|
||||
if (!adaptor)
|
||||
return NULL;
|
||||
|
||||
for (i = 0; i < adaptor->num_subpictures; i++) {
|
||||
if (adaptor->subpictures[i]->id == id) {
|
||||
|
|
@ -773,16 +786,14 @@ XvImagePtr XvMCFindXvImage(XvPortPtr pPort, CARD32 id)
|
|||
|
||||
int
|
||||
xf86XvMCRegisterDRInfo(ScreenPtr pScreen, char *name,
|
||||
char *busID, int major, int minor,
|
||||
int patchLevel)
|
||||
char *busID, int major, int minor, int patchLevel)
|
||||
{
|
||||
XvMCScreenPtr pScreenPriv = XVMC_GET_PRIVATE(pScreen);
|
||||
strlcpy(pScreenPriv->clientDriverName, name,
|
||||
DR_CLIENT_DRIVER_NAME_SIZE);
|
||||
|
||||
strlcpy(pScreenPriv->clientDriverName, name, DR_CLIENT_DRIVER_NAME_SIZE);
|
||||
strlcpy(pScreenPriv->busID, busID, DR_BUSID_SIZE);
|
||||
pScreenPriv->major = major;
|
||||
pScreenPriv->minor = minor;
|
||||
pScreenPriv->patchLevel = patchLevel;
|
||||
return Success;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@ typedef struct {
|
|||
pointer driver_priv;
|
||||
} XvMCSurfaceRec, *XvMCSurfacePtr;
|
||||
|
||||
|
||||
typedef struct {
|
||||
XID subpicture_id;
|
||||
int xvimage_id;
|
||||
|
|
@ -55,37 +54,21 @@ typedef struct {
|
|||
pointer driver_priv;
|
||||
} XvMCSubpictureRec, *XvMCSubpicturePtr;
|
||||
|
||||
typedef int (*XvMCCreateContextProcPtr) (
|
||||
XvPortPtr port,
|
||||
typedef int (*XvMCCreateContextProcPtr) (XvPortPtr port,
|
||||
XvMCContextPtr context,
|
||||
int *num_priv,
|
||||
CARD32 **priv
|
||||
);
|
||||
int *num_priv, CARD32 **priv);
|
||||
|
||||
typedef void (*XvMCDestroyContextProcPtr) (
|
||||
XvMCContextPtr context
|
||||
);
|
||||
typedef void (*XvMCDestroyContextProcPtr) (XvMCContextPtr context);
|
||||
|
||||
typedef int (*XvMCCreateSurfaceProcPtr) (
|
||||
XvMCSurfacePtr surface,
|
||||
int *num_priv,
|
||||
CARD32 **priv
|
||||
);
|
||||
typedef int (*XvMCCreateSurfaceProcPtr) (XvMCSurfacePtr surface,
|
||||
int *num_priv, CARD32 **priv);
|
||||
|
||||
typedef void (*XvMCDestroySurfaceProcPtr) (
|
||||
XvMCSurfacePtr surface
|
||||
);
|
||||
typedef void (*XvMCDestroySurfaceProcPtr) (XvMCSurfacePtr surface);
|
||||
|
||||
typedef int (*XvMCCreateSubpictureProcPtr) (
|
||||
XvMCSubpicturePtr subpicture,
|
||||
int *num_priv,
|
||||
CARD32 **priv
|
||||
);
|
||||
|
||||
typedef void (*XvMCDestroySubpictureProcPtr) (
|
||||
XvMCSubpicturePtr subpicture
|
||||
);
|
||||
typedef int (*XvMCCreateSubpictureProcPtr) (XvMCSubpicturePtr subpicture,
|
||||
int *num_priv, CARD32 **priv);
|
||||
|
||||
typedef void (*XvMCDestroySubpictureProcPtr) (XvMCSubpicturePtr subpicture);
|
||||
|
||||
typedef struct {
|
||||
XvAdaptorPtr xv_adaptor;
|
||||
|
|
@ -105,8 +88,7 @@ typedef struct {
|
|||
extern _X_EXPORT void XvMCExtensionInit(void);
|
||||
|
||||
extern _X_EXPORT int XvMCScreenInit(ScreenPtr pScreen,
|
||||
int num,
|
||||
XvMCAdaptorPtr adapt);
|
||||
int num, XvMCAdaptorPtr adapt);
|
||||
|
||||
extern _X_EXPORT XvImagePtr XvMCFindXvImage(XvPortPtr pPort, CARD32 id);
|
||||
|
||||
|
|
|
|||
15
Xi/chgdctl.c
15
Xi/chgdctl.c
|
|
@ -132,7 +132,8 @@ ProcXChangeDeviceControl(ClientPtr client)
|
|||
case DEVICE_RESOLUTION:
|
||||
r = (xDeviceResolutionCtl *) & stuff[1];
|
||||
if ((len < bytes_to_int32(sizeof(xDeviceResolutionCtl))) ||
|
||||
(len != bytes_to_int32(sizeof(xDeviceResolutionCtl)) + r->num_valuators)) {
|
||||
(len !=
|
||||
bytes_to_int32(sizeof(xDeviceResolutionCtl)) + r->num_valuators)) {
|
||||
ret = BadLength;
|
||||
goto out;
|
||||
}
|
||||
|
|
@ -161,10 +162,12 @@ ProcXChangeDeviceControl(ClientPtr client)
|
|||
(a++)->resolution = *resolution++;
|
||||
|
||||
ret = Success;
|
||||
} else if (status == DeviceBusy) {
|
||||
}
|
||||
else if (status == DeviceBusy) {
|
||||
rep.status = DeviceBusy;
|
||||
ret = Success;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
ret = BadMatch;
|
||||
}
|
||||
break;
|
||||
|
|
@ -190,10 +193,12 @@ ProcXChangeDeviceControl(ClientPtr client)
|
|||
else
|
||||
DisableDevice(dev, TRUE);
|
||||
ret = Success;
|
||||
} else if (status == DeviceBusy) {
|
||||
}
|
||||
else if (status == DeviceBusy) {
|
||||
rep.status = DeviceBusy;
|
||||
ret = Success;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
ret = BadMatch;
|
||||
}
|
||||
|
||||
|
|
|
|||
25
Xi/chgfctl.c
25
Xi/chgfctl.c
|
|
@ -173,12 +173,14 @@ ChangeKbdFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
|
|||
kctrl.autoRepeat = FALSE;
|
||||
else
|
||||
kctrl.autoRepeats[inx] &= ~kmask;
|
||||
} else if (t == AutoRepeatModeOn) {
|
||||
}
|
||||
else if (t == AutoRepeatModeOn) {
|
||||
if (key == DO_ALL)
|
||||
kctrl.autoRepeat = TRUE;
|
||||
else
|
||||
kctrl.autoRepeats[inx] |= kmask;
|
||||
} else if (t == AutoRepeatModeDefault) {
|
||||
}
|
||||
else if (t == AutoRepeatModeDefault) {
|
||||
if (key == DO_ALL)
|
||||
kctrl.autoRepeat = defaultKeyboardControl.autoRepeat;
|
||||
else
|
||||
|
|
@ -186,7 +188,8 @@ ChangeKbdFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
|
|||
kctrl.autoRepeats[inx] =
|
||||
(kctrl.autoRepeats[inx] & ~kmask) |
|
||||
(defaultKeyboardControl.autoRepeats[inx] & kmask);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
client->errorValue = t;
|
||||
return BadValue;
|
||||
}
|
||||
|
|
@ -226,7 +229,8 @@ ChangePtrFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
|
|||
else if (accelNum < 0) {
|
||||
client->errorValue = accelNum;
|
||||
return BadValue;
|
||||
} else
|
||||
}
|
||||
else
|
||||
pctrl.num = accelNum;
|
||||
}
|
||||
|
||||
|
|
@ -239,7 +243,8 @@ ChangePtrFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
|
|||
else if (accelDenom <= 0) {
|
||||
client->errorValue = accelDenom;
|
||||
return BadValue;
|
||||
} else
|
||||
}
|
||||
else
|
||||
pctrl.den = accelDenom;
|
||||
}
|
||||
|
||||
|
|
@ -252,7 +257,8 @@ ChangePtrFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
|
|||
else if (threshold < 0) {
|
||||
client->errorValue = threshold;
|
||||
return BadValue;
|
||||
} else
|
||||
}
|
||||
else
|
||||
pctrl.threshold = threshold;
|
||||
}
|
||||
|
||||
|
|
@ -463,7 +469,8 @@ ProcXChangeFeedbackControl(ClientPtr client)
|
|||
if (client->swapped) {
|
||||
swaps(&f->num_keysyms);
|
||||
}
|
||||
if (len != (bytes_to_int32(sizeof(xStringFeedbackCtl)) + f->num_keysyms))
|
||||
if (len !=
|
||||
(bytes_to_int32(sizeof(xStringFeedbackCtl)) + f->num_keysyms))
|
||||
return BadLength;
|
||||
|
||||
for (s = dev->stringfeed; s; s = s->next)
|
||||
|
|
@ -479,7 +486,8 @@ ProcXChangeFeedbackControl(ClientPtr client)
|
|||
for (i = dev->intfeed; i; i = i->next)
|
||||
if (i->ctrl.id == ((xIntegerFeedbackCtl *) & stuff[1])->id)
|
||||
return ChangeIntegerFeedback(client, dev, stuff->mask, i,
|
||||
(xIntegerFeedbackCtl *)&stuff[1]);
|
||||
(xIntegerFeedbackCtl *) &
|
||||
stuff[1]);
|
||||
break;
|
||||
case LedFeedbackClass:
|
||||
if (len != bytes_to_int32(sizeof(xLedFeedbackCtl)))
|
||||
|
|
@ -505,4 +513,3 @@ ProcXChangeFeedbackControl(ClientPtr client)
|
|||
|
||||
return BadMatch;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -102,7 +102,8 @@ ProcXChangeDeviceDontPropagateList(ClientPtr client)
|
|||
REQUEST(xChangeDeviceDontPropagateListReq);
|
||||
REQUEST_AT_LEAST_SIZE(xChangeDeviceDontPropagateListReq);
|
||||
|
||||
if (stuff->length != bytes_to_int32(sizeof(xChangeDeviceDontPropagateListReq)) +
|
||||
if (stuff->length !=
|
||||
bytes_to_int32(sizeof(xChangeDeviceDontPropagateListReq)) +
|
||||
stuff->count)
|
||||
return BadLength;
|
||||
|
||||
|
|
|
|||
|
|
@ -119,7 +119,8 @@ ProcXDeviceBell(ClientPtr client)
|
|||
proc = k->BellProc;
|
||||
ctrl = (pointer) &(k->ctrl);
|
||||
class = KbdFeedbackClass;
|
||||
} else if (stuff->feedbackclass == BellFeedbackClass) {
|
||||
}
|
||||
else if (stuff->feedbackclass == BellFeedbackClass) {
|
||||
for (b = dev->bell; b; b = b->next)
|
||||
if (b->ctrl.id == stuff->feedbackid)
|
||||
break;
|
||||
|
|
@ -131,7 +132,8 @@ ProcXDeviceBell(ClientPtr client)
|
|||
proc = b->BellProc;
|
||||
ctrl = (pointer) &(b->ctrl);
|
||||
class = BellFeedbackClass;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
client->errorValue = stuff->feedbackclass;
|
||||
return BadValue;
|
||||
}
|
||||
|
|
|
|||
633
Xi/exevents.c
633
Xi/exevents.c
File diff suppressed because it is too large
Load diff
|
|
@ -79,6 +79,7 @@ extern int DevicePropertyNotify;
|
|||
extern RESTYPE RT_INPUTCLIENT;
|
||||
|
||||
extern DevPrivateKeyRec XIClientPrivateKeyRec;
|
||||
|
||||
#define XIClientPrivateKey (&XIClientPrivateKeyRec)
|
||||
|
||||
#endif /* EXGLOBALS_H */
|
||||
|
|
|
|||
105
Xi/extinit.c
105
Xi/extinit.c
|
|
@ -125,7 +125,6 @@ SOFTWARE.
|
|||
#include "xisetclientpointer.h"
|
||||
#include "xiwarppointer.h"
|
||||
|
||||
|
||||
/* Masks for XI events have to be aligned with core event (partially anyway).
|
||||
* If DeviceButtonMotionMask is != ButtonMotionMask, event delivery
|
||||
* breaks down. The device needs the dev->button->motionMask. If DBMM is
|
||||
|
|
@ -159,8 +158,7 @@ const Mask XIAllMasks = (1L << 21) - 1;
|
|||
int ExtEventIndex;
|
||||
Mask ExtExclusiveMasks[EMASKSIZE];
|
||||
|
||||
static struct dev_type
|
||||
{
|
||||
static struct dev_type {
|
||||
Atom type;
|
||||
const char *name;
|
||||
} dev_type[] = {
|
||||
|
|
@ -367,7 +365,6 @@ RESTYPE RT_INPUTCLIENT;
|
|||
|
||||
extern XExtensionVersion XIVersion;
|
||||
|
||||
|
||||
Mask PropagateMask[MAXDEVICES];
|
||||
|
||||
/*****************************************************************
|
||||
|
|
@ -385,9 +382,7 @@ DevPrivateKeyRec XIClientPrivateKeyRec;
|
|||
*/
|
||||
|
||||
static void
|
||||
XIClientCallback(CallbackListPtr *list,
|
||||
pointer closure,
|
||||
pointer data)
|
||||
XIClientCallback(CallbackListPtr *list, pointer closure, pointer data)
|
||||
{
|
||||
NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
|
||||
ClientPtr pClient = clientinfo->client;
|
||||
|
|
@ -496,7 +491,8 @@ SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep)
|
|||
SRepXChangeDeviceControl(client, len,
|
||||
(xChangeDeviceControlReply *) rep);
|
||||
else if (rep->RepType == X_ListDeviceProperties)
|
||||
SRepXListDeviceProperties(client, len, (xListDevicePropertiesReply*)rep);
|
||||
SRepXListDeviceProperties(client, len,
|
||||
(xListDevicePropertiesReply *) rep);
|
||||
else if (rep->RepType == X_GetDeviceProperty)
|
||||
SRepXGetDeviceProperty(client, len, (xGetDevicePropertyReply *) rep);
|
||||
else if (rep->RepType == X_XIQueryPointer)
|
||||
|
|
@ -602,7 +598,8 @@ SDeviceMappingNotifyEvent(deviceMappingNotify * from, deviceMappingNotify * to)
|
|||
}
|
||||
|
||||
static void
|
||||
SDevicePresenceNotifyEvent (devicePresenceNotify *from, devicePresenceNotify *to)
|
||||
SDevicePresenceNotifyEvent(devicePresenceNotify * from,
|
||||
devicePresenceNotify * to)
|
||||
{
|
||||
*to = *from;
|
||||
swaps(&to->sequenceNumber);
|
||||
|
|
@ -611,7 +608,8 @@ SDevicePresenceNotifyEvent (devicePresenceNotify *from, devicePresenceNotify *to
|
|||
}
|
||||
|
||||
static void
|
||||
SDevicePropertyNotifyEvent (devicePropertyNotify *from, devicePropertyNotify *to)
|
||||
SDevicePropertyNotifyEvent(devicePropertyNotify * from,
|
||||
devicePropertyNotify * to)
|
||||
{
|
||||
*to = *from;
|
||||
swaps(&to->sequenceNumber);
|
||||
|
|
@ -652,16 +650,15 @@ SDeviceChangedEvent(xXIDeviceChangedEvent* from, xXIDeviceChangedEvent* to)
|
|||
memcpy(&to[1], &from[1], from->length * 4);
|
||||
|
||||
any = (xXIAnyInfo *) & to[1];
|
||||
for (i = 0; i < to->num_classes; i++)
|
||||
{
|
||||
for (i = 0; i < to->num_classes; i++) {
|
||||
int length = any->length;
|
||||
|
||||
switch(any->type)
|
||||
{
|
||||
switch (any->type) {
|
||||
case KeyClass:
|
||||
{
|
||||
xXIKeyInfo *ki = (xXIKeyInfo *) any;
|
||||
uint32_t *key = (uint32_t *) & ki[1];
|
||||
|
||||
for (j = 0; j < ki->num_keycodes; j++, key++)
|
||||
swapl(key);
|
||||
swaps(&ki->num_keycodes);
|
||||
|
|
@ -671,7 +668,8 @@ SDeviceChangedEvent(xXIDeviceChangedEvent* from, xXIDeviceChangedEvent* to)
|
|||
{
|
||||
xXIButtonInfo *bi = (xXIButtonInfo *) any;
|
||||
Atom *labels = (Atom *) ((char *) bi + sizeof(xXIButtonInfo) +
|
||||
pad_to_int32(bits_to_bytes(bi->num_buttons)));
|
||||
pad_to_int32(bits_to_bytes
|
||||
(bi->num_buttons)));
|
||||
for (j = 0; j < bi->num_buttons; j++)
|
||||
swapl(&labels[j]);
|
||||
swaps(&bi->num_buttons);
|
||||
|
|
@ -680,6 +678,7 @@ SDeviceChangedEvent(xXIDeviceChangedEvent* from, xXIDeviceChangedEvent* to)
|
|||
case ValuatorClass:
|
||||
{
|
||||
xXIValuatorInfo *ai = (xXIValuatorInfo *) any;
|
||||
|
||||
swapl(&ai->label);
|
||||
swapl(&ai->min.integral);
|
||||
swapl(&ai->min.frac);
|
||||
|
|
@ -708,7 +707,8 @@ SDeviceChangedEvent(xXIDeviceChangedEvent* from, xXIDeviceChangedEvent* to)
|
|||
|
||||
}
|
||||
|
||||
static void SDeviceEvent(xXIDeviceEvent *from, xXIDeviceEvent *to)
|
||||
static void
|
||||
SDeviceEvent(xXIDeviceEvent * from, xXIDeviceEvent * to)
|
||||
{
|
||||
int i;
|
||||
char *ptr;
|
||||
|
|
@ -742,10 +742,8 @@ static void SDeviceEvent(xXIDeviceEvent *from, xXIDeviceEvent *to)
|
|||
ptr += from->buttons_len * 4;
|
||||
vmask = ptr; /* valuator mask */
|
||||
ptr += from->valuators_len * 4;
|
||||
for (i = 0; i < from->valuators_len * 32; i++)
|
||||
{
|
||||
if (BitIsOn(vmask, i))
|
||||
{
|
||||
for (i = 0; i < from->valuators_len * 32; i++) {
|
||||
if (BitIsOn(vmask, i)) {
|
||||
swapl(((uint32_t *) ptr));
|
||||
ptr += 4;
|
||||
swapl(((uint32_t *) ptr));
|
||||
|
|
@ -754,8 +752,8 @@ static void SDeviceEvent(xXIDeviceEvent *from, xXIDeviceEvent *to)
|
|||
}
|
||||
}
|
||||
|
||||
static void SDeviceHierarchyEvent(xXIHierarchyEvent *from,
|
||||
xXIHierarchyEvent *to)
|
||||
static void
|
||||
SDeviceHierarchyEvent(xXIHierarchyEvent * from, xXIHierarchyEvent * to)
|
||||
{
|
||||
int i;
|
||||
xXIHierarchyInfo *info;
|
||||
|
|
@ -771,15 +769,15 @@ static void SDeviceHierarchyEvent(xXIHierarchyEvent *from,
|
|||
swaps(&to->num_info);
|
||||
|
||||
info = (xXIHierarchyInfo *) & to[1];
|
||||
for (i = 0; i< from->num_info; i++)
|
||||
{
|
||||
for (i = 0; i < from->num_info; i++) {
|
||||
swaps(&info->deviceid);
|
||||
swaps(&info->attachment);
|
||||
info++;
|
||||
}
|
||||
}
|
||||
|
||||
static void SXIPropertyEvent(xXIPropertyEvent *from, xXIPropertyEvent *to)
|
||||
static void
|
||||
SXIPropertyEvent(xXIPropertyEvent * from, xXIPropertyEvent * to)
|
||||
{
|
||||
*to = *from;
|
||||
swaps(&to->sequenceNumber);
|
||||
|
|
@ -789,7 +787,8 @@ static void SXIPropertyEvent(xXIPropertyEvent *from, xXIPropertyEvent *to)
|
|||
swapl(&to->property);
|
||||
}
|
||||
|
||||
static void SRawEvent(xXIRawEvent *from, xXIRawEvent *to)
|
||||
static void
|
||||
SRawEvent(xXIRawEvent * from, xXIRawEvent * to)
|
||||
{
|
||||
int i;
|
||||
FP3232 *values;
|
||||
|
|
@ -804,14 +803,11 @@ static void SRawEvent(xXIRawEvent *from, xXIRawEvent *to)
|
|||
swapl(&to->time);
|
||||
swapl(&to->detail);
|
||||
|
||||
|
||||
mask = (unsigned char *) &to[1];
|
||||
values = (FP3232 *) (mask + from->valuators_len * 4);
|
||||
|
||||
for (i = 0; i < from->valuators_len * 4 * 8; i++)
|
||||
{
|
||||
if (BitIsOn(mask, i))
|
||||
{
|
||||
for (i = 0; i < from->valuators_len * 4 * 8; i++) {
|
||||
if (BitIsOn(mask, i)) {
|
||||
/* for each bit set there are two FP3232 values on the wire, in
|
||||
* the order abcABC for data and data_raw. Here we swap as if
|
||||
* they were in aAbBcC order because it's easier and really
|
||||
|
|
@ -829,8 +825,8 @@ static void SRawEvent(xXIRawEvent *from, xXIRawEvent *to)
|
|||
swaps(&to->valuators_len);
|
||||
}
|
||||
|
||||
static void STouchOwnershipEvent(xXITouchOwnershipEvent *from,
|
||||
xXITouchOwnershipEvent *to)
|
||||
static void
|
||||
STouchOwnershipEvent(xXITouchOwnershipEvent * from, xXITouchOwnershipEvent * to)
|
||||
{
|
||||
*to = *from;
|
||||
swaps(&to->sequenceNumber);
|
||||
|
|
@ -850,8 +846,7 @@ static void STouchOwnershipEvent(xXITouchOwnershipEvent *from,
|
|||
void
|
||||
XI2EventSwap(xGenericEvent *from, xGenericEvent *to)
|
||||
{
|
||||
switch(from->evtype)
|
||||
{
|
||||
switch (from->evtype) {
|
||||
case XI_Enter:
|
||||
case XI_Leave:
|
||||
case XI_FocusIn:
|
||||
|
|
@ -863,11 +858,11 @@ XI2EventSwap(xGenericEvent *from, xGenericEvent *to)
|
|||
(xXIDeviceChangedEvent *) to);
|
||||
break;
|
||||
case XI_HierarchyChanged:
|
||||
SDeviceHierarchyEvent((xXIHierarchyEvent*)from, (xXIHierarchyEvent*)to);
|
||||
SDeviceHierarchyEvent((xXIHierarchyEvent *) from,
|
||||
(xXIHierarchyEvent *) to);
|
||||
break;
|
||||
case XI_PropertyEvent:
|
||||
SXIPropertyEvent((xXIPropertyEvent*)from,
|
||||
(xXIPropertyEvent*)to);
|
||||
SXIPropertyEvent((xXIPropertyEvent *) from, (xXIPropertyEvent *) to);
|
||||
break;
|
||||
case XI_Motion:
|
||||
case XI_KeyPress:
|
||||
|
|
@ -1078,8 +1073,7 @@ RestoreExtensionEvents(void)
|
|||
IEventBase = 0;
|
||||
|
||||
for (i = 0; i < ExtEventIndex - 1; i++) {
|
||||
if ((EventInfo[i].type >= LASTEvent) && (EventInfo[i].type < 128))
|
||||
{
|
||||
if ((EventInfo[i].type >= LASTEvent) && (EventInfo[i].type < 128)) {
|
||||
for (j = 0; j < MAXDEVICES; j++)
|
||||
SetMaskForEvent(j, 0, EventInfo[i].type);
|
||||
}
|
||||
|
|
@ -1145,7 +1139,6 @@ IResetProc(ExtensionEntry * unused)
|
|||
RestoreExtensionEvents();
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Assign an id and type to an input device.
|
||||
|
|
@ -1193,29 +1186,36 @@ SEventIDispatch(xEvent * from, xEvent * to)
|
|||
else if (type == DeviceKeyPress) {
|
||||
SKeyButtonPtrEvent(from, to);
|
||||
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
|
||||
} else if (type == DeviceKeyRelease) {
|
||||
}
|
||||
else if (type == DeviceKeyRelease) {
|
||||
SKeyButtonPtrEvent(from, to);
|
||||
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
|
||||
} else if (type == DeviceButtonPress) {
|
||||
}
|
||||
else if (type == DeviceButtonPress) {
|
||||
SKeyButtonPtrEvent(from, to);
|
||||
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
|
||||
} else if (type == DeviceButtonRelease) {
|
||||
}
|
||||
else if (type == DeviceButtonRelease) {
|
||||
SKeyButtonPtrEvent(from, to);
|
||||
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
|
||||
} else if (type == DeviceMotionNotify) {
|
||||
}
|
||||
else if (type == DeviceMotionNotify) {
|
||||
SKeyButtonPtrEvent(from, to);
|
||||
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
|
||||
} else if (type == DeviceFocusIn)
|
||||
}
|
||||
else if (type == DeviceFocusIn)
|
||||
DO_SWAP(SEventFocus, deviceFocus);
|
||||
else if (type == DeviceFocusOut)
|
||||
DO_SWAP(SEventFocus, deviceFocus);
|
||||
else if (type == ProximityIn) {
|
||||
SKeyButtonPtrEvent(from, to);
|
||||
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
|
||||
} else if (type == ProximityOut) {
|
||||
}
|
||||
else if (type == ProximityOut) {
|
||||
SKeyButtonPtrEvent(from, to);
|
||||
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
|
||||
} else if (type == DeviceStateNotify)
|
||||
}
|
||||
else if (type == DeviceStateNotify)
|
||||
DO_SWAP(SDeviceStateNotifyEvent, deviceStateNotify);
|
||||
else if (type == DeviceKeyStateNotify)
|
||||
DO_SWAP(SDeviceKeyStateNotifyEvent, deviceKeyStateNotify);
|
||||
|
|
@ -1250,12 +1250,14 @@ void
|
|||
XInputExtensionInit(void)
|
||||
{
|
||||
ExtensionEntry *extEntry;
|
||||
|
||||
XExtensionVersion thisversion = { XI_Present,
|
||||
SERVER_XI_MAJOR_VERSION,
|
||||
SERVER_XI_MINOR_VERSION,
|
||||
};
|
||||
|
||||
if (!dixRegisterPrivateKey(&XIClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(XIClientRec)))
|
||||
if (!dixRegisterPrivateKey
|
||||
(&XIClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(XIClientRec)))
|
||||
FatalError("Cannot request private for XI.\n");
|
||||
|
||||
if (!AddCallback(&ClientStateCallback, XIClientCallback, 0))
|
||||
|
|
@ -1293,7 +1295,6 @@ XInputExtensionInit(void)
|
|||
|
||||
GERegisterExtension(IReqCode, XI2EventSwap);
|
||||
|
||||
|
||||
memset(&xi_all_devices, 0, sizeof(xi_all_devices));
|
||||
memset(&xi_all_master_devices, 0, sizeof(xi_all_master_devices));
|
||||
xi_all_devices.id = XIAllDevices;
|
||||
|
|
@ -1305,8 +1306,8 @@ XInputExtensionInit(void)
|
|||
inputInfo.all_master_devices = &xi_all_master_devices;
|
||||
|
||||
XIResetProperties();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
FatalError("IExtensionInit: AddExtensions failed\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -115,7 +115,8 @@ CopySwapDeviceResolution(ClientPtr client, ValuatorClassPtr v, char *buf,
|
|||
}
|
||||
}
|
||||
|
||||
static void CopySwapDeviceCore (ClientPtr client, DeviceIntPtr dev, char *buf)
|
||||
static void
|
||||
CopySwapDeviceCore(ClientPtr client, DeviceIntPtr dev, char *buf)
|
||||
{
|
||||
xDeviceCoreState *c = (xDeviceCoreState *) buf;
|
||||
|
||||
|
|
@ -130,7 +131,8 @@ static void CopySwapDeviceCore (ClientPtr client, DeviceIntPtr dev, char *buf)
|
|||
}
|
||||
}
|
||||
|
||||
static void CopySwapDeviceEnable (ClientPtr client, DeviceIntPtr dev, char *buf)
|
||||
static void
|
||||
CopySwapDeviceEnable(ClientPtr client, DeviceIntPtr dev, char *buf)
|
||||
{
|
||||
xDeviceEnableState *e = (xDeviceEnableState *) buf;
|
||||
|
||||
|
|
|
|||
|
|
@ -113,8 +113,7 @@ ProcXGetDeviceDontPropagateList(ClientPtr client)
|
|||
|
||||
if ((others = wOtherInputMasks(pWin)) != 0) {
|
||||
for (i = 0; i < EMASKSIZE; i++)
|
||||
ClassFromMask(NULL, others->dontPropagateMask[i], i,
|
||||
&count, COUNT);
|
||||
ClassFromMask(NULL, others->dontPropagateMask[i], i, &count, COUNT);
|
||||
if (count) {
|
||||
rep.count = count;
|
||||
buf = (XEventClass *) malloc(rep.count * sizeof(XEventClass));
|
||||
|
|
|
|||
|
|
@ -82,7 +82,8 @@ SProcXGrabDevice(ClientPtr client)
|
|||
swapl(&stuff->time);
|
||||
swaps(&stuff->event_count);
|
||||
|
||||
if (stuff->length != bytes_to_int32(sizeof(xGrabDeviceReq)) + stuff->event_count)
|
||||
if (stuff->length !=
|
||||
bytes_to_int32(sizeof(xGrabDeviceReq)) + stuff->event_count)
|
||||
return BadLength;
|
||||
|
||||
SwapLongs((CARD32 *) (&stuff[1]), stuff->event_count);
|
||||
|
|
@ -108,7 +109,8 @@ ProcXGrabDevice(ClientPtr client)
|
|||
REQUEST(xGrabDeviceReq);
|
||||
REQUEST_AT_LEAST_SIZE(xGrabDeviceReq);
|
||||
|
||||
if (stuff->length != bytes_to_int32(sizeof(xGrabDeviceReq)) + stuff->event_count)
|
||||
if (stuff->length !=
|
||||
bytes_to_int32(sizeof(xGrabDeviceReq)) + stuff->event_count)
|
||||
return BadLength;
|
||||
|
||||
rep.repType = X_Reply;
|
||||
|
|
@ -130,8 +132,7 @@ ProcXGrabDevice(ClientPtr client)
|
|||
rc = GrabDevice(client, dev, stuff->other_devices_mode,
|
||||
stuff->this_device_mode, stuff->grabWindow,
|
||||
stuff->ownerEvents, stuff->time,
|
||||
&mask, XI, None, None,
|
||||
&rep.status);
|
||||
&mask, XI, None, None, &rep.status);
|
||||
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
|
|
|||
|
|
@ -122,7 +122,8 @@ ProcXGrabDeviceButton(ClientPtr client)
|
|||
return ret;
|
||||
if (mdev->key == NULL)
|
||||
return BadMatch;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
mdev = PickKeyboard(client);
|
||||
ret = XaceHook(XACE_DEVICE_ACCESS, client, mdev, DixUseAccess);
|
||||
if (ret != Success)
|
||||
|
|
@ -145,8 +146,7 @@ ProcXGrabDeviceButton(ClientPtr client)
|
|||
param.modifiers = stuff->modifiers;
|
||||
mask.xi = tmp[stuff->grabbed_device].mask;
|
||||
|
||||
ret = GrabButton(client, dev, mdev, stuff->button, ¶m,
|
||||
XI, &mask);
|
||||
ret = GrabButton(client, dev, mdev, stuff->button, ¶m, XI, &mask);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,7 +105,8 @@ ProcXGrabDeviceKey(ClientPtr client)
|
|||
REQUEST(xGrabDeviceKeyReq);
|
||||
REQUEST_AT_LEAST_SIZE(xGrabDeviceKeyReq);
|
||||
|
||||
if (stuff->length != bytes_to_int32(sizeof(xGrabDeviceKeyReq)) + stuff->event_count)
|
||||
if (stuff->length !=
|
||||
bytes_to_int32(sizeof(xGrabDeviceKeyReq)) + stuff->event_count)
|
||||
return BadLength;
|
||||
|
||||
ret = dixLookupDevice(&dev, stuff->grabbed_device, client, DixGrabAccess);
|
||||
|
|
@ -119,7 +120,8 @@ ProcXGrabDeviceKey(ClientPtr client)
|
|||
return ret;
|
||||
if (mdev->key == NULL)
|
||||
return BadMatch;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
mdev = PickKeyboard(client);
|
||||
ret = XaceHook(XACE_DEVICE_ACCESS, client, mdev, DixUseAccess);
|
||||
if (ret != Success)
|
||||
|
|
@ -133,7 +135,6 @@ ProcXGrabDeviceKey(ClientPtr client)
|
|||
X_GrabDeviceKey)) != Success)
|
||||
return ret;
|
||||
|
||||
|
||||
memset(¶m, 0, sizeof(param));
|
||||
param.grabtype = XI;
|
||||
param.ownerEvents = stuff->ownerEvents;
|
||||
|
|
|
|||
15
Xi/listdev.c
15
Xi/listdev.c
|
|
@ -68,7 +68,6 @@ SOFTWARE.
|
|||
|
||||
#include "listdev.h"
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure lists the input devices available to the server.
|
||||
|
|
@ -128,7 +127,8 @@ CopyDeviceName(char **namebuf, char *name)
|
|||
*nameptr++ = strlen(name);
|
||||
strcpy(nameptr, name);
|
||||
*namebuf += (strlen(name) + 1);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
*nameptr++ = 0;
|
||||
*namebuf += 1;
|
||||
}
|
||||
|
|
@ -162,8 +162,7 @@ CopySwapButtonClass(ClientPtr client, ButtonClassPtr b, char **buf)
|
|||
*/
|
||||
|
||||
static void
|
||||
CopySwapDevice(ClientPtr client, DeviceIntPtr d, int num_classes,
|
||||
char **buf)
|
||||
CopySwapDevice(ClientPtr client, DeviceIntPtr d, int num_classes, char **buf)
|
||||
{
|
||||
xDeviceInfoPtr dev;
|
||||
|
||||
|
|
@ -280,8 +279,7 @@ CopySwapClasses(ClientPtr client, DeviceIntPtr dev, CARD8 *num_classes,
|
|||
(*num_classes)++;
|
||||
}
|
||||
if (dev->valuator != NULL) {
|
||||
(*num_classes) +=
|
||||
CopySwapValuatorClass(client, dev, classbuf);
|
||||
(*num_classes) += CopySwapValuatorClass(client, dev, classbuf);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -310,16 +308,15 @@ static Bool
|
|||
ShouldSkipDevice(ClientPtr client, DeviceIntPtr d)
|
||||
{
|
||||
/* don't send master devices other than VCP/VCK */
|
||||
if (!IsMaster(d) || d == inputInfo.pointer || d == inputInfo.keyboard)
|
||||
{
|
||||
if (!IsMaster(d) || d == inputInfo.pointer ||d == inputInfo.keyboard) {
|
||||
int rc = XaceHook(XACE_DEVICE_ACCESS, client, d, DixGetAttrAccess);
|
||||
|
||||
if (rc == Success)
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure lists the input devices available to the server.
|
||||
|
|
|
|||
|
|
@ -107,7 +107,8 @@ ProcXOpenDevice(ClientPtr client)
|
|||
break;
|
||||
if (dev == NULL)
|
||||
return BadDevice;
|
||||
} else if (status != Success)
|
||||
}
|
||||
else if (status != Success)
|
||||
return status;
|
||||
|
||||
if (IsMaster(dev))
|
||||
|
|
|
|||
|
|
@ -149,7 +149,8 @@ ProcXQueryDeviceState(ClientPtr client)
|
|||
tv->length = sizeof(xValuatorState) + v->numAxes * 4;
|
||||
tv->num_valuators = v->numAxes;
|
||||
tv->mode = valuator_get_mode(dev, 0);
|
||||
tv->mode |= (dev->proximity && !dev->proximity->in_proximity) ? OutOfProximity : 0;
|
||||
tv->mode |= (dev->proximity &&
|
||||
!dev->proximity->in_proximity) ? OutOfProximity : 0;
|
||||
buf += sizeof(xValuatorState);
|
||||
for (i = 0, values = v->axisVal; i < v->numAxes; i++) {
|
||||
if (rc != BadAccess)
|
||||
|
|
|
|||
|
|
@ -50,7 +50,6 @@ SOFTWARE.
|
|||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
|
@ -128,8 +127,7 @@ SProcXSelectExtensionEvent(ClientPtr client)
|
|||
REQUEST_AT_LEAST_SIZE(xSelectExtensionEventReq);
|
||||
swapl(&stuff->window);
|
||||
swaps(&stuff->count);
|
||||
REQUEST_FIXED_SIZE(xSelectExtensionEventReq,
|
||||
stuff->count * sizeof(CARD32));
|
||||
REQUEST_FIXED_SIZE(xSelectExtensionEventReq, stuff->count * sizeof(CARD32));
|
||||
SwapLongs((CARD32 *) (&stuff[1]), stuff->count);
|
||||
|
||||
return (ProcXSelectExtensionEvent(client));
|
||||
|
|
@ -152,7 +150,8 @@ ProcXSelectExtensionEvent(ClientPtr client)
|
|||
REQUEST(xSelectExtensionEventReq);
|
||||
REQUEST_AT_LEAST_SIZE(xSelectExtensionEventReq);
|
||||
|
||||
if (stuff->length != bytes_to_int32(sizeof(xSelectExtensionEventReq)) + stuff->count)
|
||||
if (stuff->length !=
|
||||
bytes_to_int32(sizeof(xSelectExtensionEventReq)) + stuff->count)
|
||||
return BadLength;
|
||||
|
||||
ret = dixLookupWindow(&pWin, stuff->window, client, DixReceiveAccess);
|
||||
|
|
|
|||
|
|
@ -88,7 +88,8 @@ SProcXSendExtensionEvent(ClientPtr client)
|
|||
swapl(&stuff->destination);
|
||||
swaps(&stuff->count);
|
||||
|
||||
if (stuff->length != bytes_to_int32(sizeof(xSendExtensionEventReq)) + stuff->count +
|
||||
if (stuff->length !=
|
||||
bytes_to_int32(sizeof(xSendExtensionEventReq)) + stuff->count +
|
||||
bytes_to_int32(stuff->num_events * sizeof(xEvent)))
|
||||
return BadLength;
|
||||
|
||||
|
|
@ -125,7 +126,8 @@ ProcXSendExtensionEvent(ClientPtr client)
|
|||
REQUEST(xSendExtensionEventReq);
|
||||
REQUEST_AT_LEAST_SIZE(xSendExtensionEventReq);
|
||||
|
||||
if (stuff->length != bytes_to_int32(sizeof(xSendExtensionEventReq)) + stuff->count +
|
||||
if (stuff->length !=
|
||||
bytes_to_int32(sizeof(xSendExtensionEventReq)) + stuff->count +
|
||||
(stuff->num_events * bytes_to_int32(sizeof(xEvent))))
|
||||
return BadLength;
|
||||
|
||||
|
|
|
|||
|
|
@ -106,7 +106,9 @@ ProcXSetDeviceButtonMapping(ClientPtr client)
|
|||
rep.sequenceNumber = client->sequence;
|
||||
rep.status = MappingSuccess;
|
||||
|
||||
ret = ApplyPointerMapping(dev, (CARD8 *) &stuff[1], stuff->map_length, client);
|
||||
ret =
|
||||
ApplyPointerMapping(dev, (CARD8 *) &stuff[1], stuff->map_length,
|
||||
client);
|
||||
if (ret == -1)
|
||||
return BadValue;
|
||||
else if (ret == MappingBusy)
|
||||
|
|
|
|||
|
|
@ -109,8 +109,7 @@ ProcXSetDeviceMode(ClientPtr client)
|
|||
|
||||
if (rep.status == Success)
|
||||
valuator_set_mode(dev, VALUATOR_MODE_ALL_AXES, stuff->mode);
|
||||
else if (rep.status != AlreadyGrabbed)
|
||||
{
|
||||
else if (rep.status != AlreadyGrabbed) {
|
||||
switch (rep.status) {
|
||||
case BadMatch:
|
||||
case BadImplementation:
|
||||
|
|
|
|||
|
|
@ -112,13 +112,11 @@ SetDeviceValuators(ClientPtr client, DeviceIntPtr dev,
|
|||
*/
|
||||
|
||||
int
|
||||
ChangeDeviceControl(ClientPtr client, DeviceIntPtr dev,
|
||||
xDeviceCtl * control)
|
||||
ChangeDeviceControl(ClientPtr client, DeviceIntPtr dev, xDeviceCtl * control)
|
||||
{
|
||||
return BadMatch;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* Caller: configAddDevice (and others)
|
||||
|
|
|
|||
|
|
@ -115,7 +115,8 @@ ProcXUngrabDeviceButton(ClientPtr client)
|
|||
return BadDevice;
|
||||
if (mdev->key == NULL)
|
||||
return BadMatch;
|
||||
} else
|
||||
}
|
||||
else
|
||||
mdev = PickKeyboard(client);
|
||||
|
||||
rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixSetAttrAccess);
|
||||
|
|
|
|||
|
|
@ -117,7 +117,8 @@ ProcXUngrabDeviceKey(ClientPtr client)
|
|||
return BadDevice;
|
||||
if (mdev->key == NULL)
|
||||
return BadMatch;
|
||||
} else
|
||||
}
|
||||
else
|
||||
mdev = PickKeyboard(client);
|
||||
|
||||
rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixSetAttrAccess);
|
||||
|
|
|
|||
|
|
@ -52,9 +52,9 @@ SProcXIAllowEvents(ClientPtr client)
|
|||
swaps(&stuff->length);
|
||||
swaps(&stuff->deviceid);
|
||||
swapl(&stuff->time);
|
||||
if (stuff->length > 3)
|
||||
{
|
||||
if (stuff->length > 3) {
|
||||
xXI2_2AllowEventsReq *req_xi22 = (xXI2_2AllowEventsReq *) stuff;
|
||||
|
||||
swapl(&req_xi22->touchid);
|
||||
swapl(&req_xi22->grab_window);
|
||||
}
|
||||
|
|
@ -70,17 +70,17 @@ ProcXIAllowEvents(ClientPtr client)
|
|||
int ret = Success;
|
||||
XIClientPtr xi_client;
|
||||
Bool have_xi22 = FALSE;
|
||||
|
||||
REQUEST(xXI2_2AllowEventsReq);
|
||||
|
||||
xi_client = dixLookupPrivate(&client->devPrivates, XIClientPrivateKey);
|
||||
|
||||
if (version_compare(xi_client->major_version,
|
||||
xi_client->minor_version, 2, 2) >= 0)
|
||||
{
|
||||
xi_client->minor_version, 2, 2) >= 0) {
|
||||
REQUEST_AT_LEAST_SIZE(xXI2_2AllowEventsReq);
|
||||
have_xi22 = TRUE;
|
||||
} else
|
||||
{
|
||||
}
|
||||
else {
|
||||
REQUEST_SIZE_MATCH(xXIAllowEventsReq);
|
||||
}
|
||||
|
||||
|
|
@ -136,4 +136,3 @@ ProcXIAllowEvents(ClientPtr client)
|
|||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -65,7 +65,8 @@ SProcXIChangeCursor(ClientPtr client)
|
|||
return (ProcXIChangeCursor(client));
|
||||
}
|
||||
|
||||
int ProcXIChangeCursor(ClientPtr client)
|
||||
int
|
||||
ProcXIChangeCursor(ClientPtr client)
|
||||
{
|
||||
int rc;
|
||||
WindowPtr pWin = NULL;
|
||||
|
|
@ -82,22 +83,19 @@ int ProcXIChangeCursor(ClientPtr client)
|
|||
if (!IsMaster(pDev) || !IsPointerDevice(pDev))
|
||||
return BadDevice;
|
||||
|
||||
if (stuff->win != None)
|
||||
{
|
||||
if (stuff->win != None) {
|
||||
rc = dixLookupWindow(&pWin, stuff->win, client, DixSetAttrAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
}
|
||||
|
||||
if (stuff->cursor == None)
|
||||
{
|
||||
if (stuff->cursor == None) {
|
||||
if (pWin == pWin->drawable.pScreen->root)
|
||||
pCursor = rootCursor;
|
||||
else
|
||||
pCursor = (CursorPtr) None;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
rc = dixLookupResourceByType((pointer *) &pCursor, stuff->cursor,
|
||||
RT_CURSOR, client, DixUseAccess);
|
||||
if (rc != Success)
|
||||
|
|
@ -108,4 +106,3 @@ int ProcXIChangeCursor(ClientPtr client)
|
|||
|
||||
return Success;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@
|
|||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
|
@ -57,7 +56,8 @@
|
|||
/**
|
||||
* Send the current state of the device hierarchy to all clients.
|
||||
*/
|
||||
void XISendDeviceHierarchyEvent(int flags[MAXDEVICES])
|
||||
void
|
||||
XISendDeviceHierarchyEvent(int flags[MAXDEVICES])
|
||||
{
|
||||
xXIHierarchyEvent *ev;
|
||||
xXIHierarchyInfo *info;
|
||||
|
|
@ -80,8 +80,7 @@ void XISendDeviceHierarchyEvent(int flags[MAXDEVICES])
|
|||
ev->num_info = inputInfo.numDevices;
|
||||
|
||||
info = (xXIHierarchyInfo *) & ev[1];
|
||||
for (dev = inputInfo.devices; dev; dev = dev->next)
|
||||
{
|
||||
for (dev = inputInfo.devices; dev; dev = dev->next) {
|
||||
info->deviceid = dev->id;
|
||||
info->enabled = dev->enabled;
|
||||
info->use = GetDeviceUse(dev, &info->attachment);
|
||||
|
|
@ -89,8 +88,7 @@ void XISendDeviceHierarchyEvent(int flags[MAXDEVICES])
|
|||
ev->flags |= info->flags;
|
||||
info++;
|
||||
}
|
||||
for (dev = inputInfo.off_devices; dev; dev = dev->next)
|
||||
{
|
||||
for (dev = inputInfo.off_devices; dev; dev = dev->next) {
|
||||
info->deviceid = dev->id;
|
||||
info->enabled = dev->enabled;
|
||||
info->use = GetDeviceUse(dev, &info->attachment);
|
||||
|
|
@ -99,11 +97,8 @@ void XISendDeviceHierarchyEvent(int flags[MAXDEVICES])
|
|||
info++;
|
||||
}
|
||||
|
||||
|
||||
for (i = 0; i < MAXDEVICES; i++)
|
||||
{
|
||||
if (flags[i] & (XIMasterRemoved | XISlaveRemoved))
|
||||
{
|
||||
for (i = 0; i < MAXDEVICES; i++) {
|
||||
if (flags[i] & (XIMasterRemoved | XISlaveRemoved)) {
|
||||
info->deviceid = i;
|
||||
info->enabled = FALSE;
|
||||
info->flags = flags[i];
|
||||
|
|
@ -119,11 +114,11 @@ void XISendDeviceHierarchyEvent(int flags[MAXDEVICES])
|
|||
memset(&dummyDev, 0, sizeof(dummyDev));
|
||||
dummyDev.id = XIAllDevices;
|
||||
dummyDev.type = SLAVE;
|
||||
SendEventToAllWindows(&dummyDev, (XI_HierarchyChangedMask >> 8), (xEvent*)ev, 1);
|
||||
SendEventToAllWindows(&dummyDev, (XI_HierarchyChangedMask >> 8),
|
||||
(xEvent *) ev, 1);
|
||||
free(ev);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* This procedure allows a client to change the device hierarchy through
|
||||
|
|
@ -131,7 +126,8 @@ void XISendDeviceHierarchyEvent(int flags[MAXDEVICES])
|
|||
*
|
||||
*/
|
||||
|
||||
int SProcXIChangeHierarchy(ClientPtr client)
|
||||
int
|
||||
SProcXIChangeHierarchy(ClientPtr client)
|
||||
{
|
||||
REQUEST(xXIChangeHierarchyReq);
|
||||
swaps(&stuff->length);
|
||||
|
|
@ -158,8 +154,7 @@ add_master(ClientPtr client, xXIAddMasterInfo *c, int flags[MAXDEVICES])
|
|||
|
||||
/* Allocate virtual slave devices for xtest events */
|
||||
rc = AllocXTestDevice(client, name, &XTestptr, &XTestkeybd, ptr, keybd);
|
||||
if (rc != Success)
|
||||
{
|
||||
if (rc != Success) {
|
||||
DeleteInputDeviceRequest(ptr);
|
||||
DeleteInputDeviceRequest(keybd);
|
||||
goto unwind;
|
||||
|
|
@ -175,8 +170,7 @@ add_master(ClientPtr client, xXIAddMasterInfo *c, int flags[MAXDEVICES])
|
|||
flags[XTestptr->id] |= XISlaveAdded;
|
||||
flags[XTestkeybd->id] |= XISlaveAdded;
|
||||
|
||||
if (c->enable)
|
||||
{
|
||||
if (c->enable) {
|
||||
EnableDevice(ptr, FALSE);
|
||||
EnableDevice(keybd, FALSE);
|
||||
flags[ptr->id] |= XIDeviceEnabled;
|
||||
|
|
@ -205,44 +199,39 @@ disable_clientpointer(DeviceIntPtr dev)
|
|||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < currentMaxClients; i++)
|
||||
{
|
||||
for (i = 0; i < currentMaxClients; i++) {
|
||||
ClientPtr client = clients[i];
|
||||
|
||||
if (client && client->clientPtr == dev)
|
||||
client->clientPtr = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
remove_master(ClientPtr client, xXIRemoveMasterInfo *r,
|
||||
int flags[MAXDEVICES])
|
||||
remove_master(ClientPtr client, xXIRemoveMasterInfo * r, int flags[MAXDEVICES])
|
||||
{
|
||||
DeviceIntPtr ptr, keybd, XTestptr, XTestkeybd;
|
||||
int rc = Success;
|
||||
|
||||
if (r->return_mode != XIAttachToMaster &&
|
||||
r->return_mode != XIFloating)
|
||||
if (r->return_mode != XIAttachToMaster && r->return_mode != XIFloating)
|
||||
return BadValue;
|
||||
|
||||
rc = dixLookupDevice(&ptr, r->deviceid, client, DixDestroyAccess);
|
||||
if (rc != Success)
|
||||
goto unwind;
|
||||
|
||||
if (!IsMaster(ptr))
|
||||
{
|
||||
if (!IsMaster(ptr)) {
|
||||
client->errorValue = r->deviceid;
|
||||
rc = BadDevice;
|
||||
goto unwind;
|
||||
}
|
||||
|
||||
/* XXX: For now, don't allow removal of VCP, VCK */
|
||||
if (ptr == inputInfo.pointer || ptr == inputInfo.keyboard)
|
||||
{
|
||||
if (ptr == inputInfo.pointer ||ptr == inputInfo.keyboard) {
|
||||
rc = BadDevice;
|
||||
goto unwind;
|
||||
}
|
||||
|
||||
|
||||
ptr = GetMaster(ptr, MASTER_POINTER);
|
||||
rc = dixLookupDevice(&ptr, ptr->id, client, DixDestroyAccess);
|
||||
if (rc != Success)
|
||||
|
|
@ -258,8 +247,7 @@ remove_master(ClientPtr client, xXIRemoveMasterInfo *r,
|
|||
goto unwind;
|
||||
|
||||
XTestkeybd = GetXTestDevice(keybd);
|
||||
rc = dixLookupDevice(&XTestkeybd, XTestkeybd->id, client,
|
||||
DixDestroyAccess);
|
||||
rc = dixLookupDevice(&XTestkeybd, XTestkeybd->id, client, DixDestroyAccess);
|
||||
if (rc != Success)
|
||||
goto unwind;
|
||||
|
||||
|
|
@ -267,18 +255,14 @@ remove_master(ClientPtr client, xXIRemoveMasterInfo *r,
|
|||
|
||||
/* Disabling sends the devices floating, reattach them if
|
||||
* desired. */
|
||||
if (r->return_mode == XIAttachToMaster)
|
||||
{
|
||||
DeviceIntPtr attached,
|
||||
newptr,
|
||||
newkeybd;
|
||||
if (r->return_mode == XIAttachToMaster) {
|
||||
DeviceIntPtr attached, newptr, newkeybd;
|
||||
|
||||
rc = dixLookupDevice(&newptr, r->return_pointer, client, DixAddAccess);
|
||||
if (rc != Success)
|
||||
goto unwind;
|
||||
|
||||
if (!IsMaster(newptr))
|
||||
{
|
||||
if (!IsMaster(newptr)) {
|
||||
client->errorValue = r->return_pointer;
|
||||
rc = BadDevice;
|
||||
goto unwind;
|
||||
|
|
@ -289,23 +273,19 @@ remove_master(ClientPtr client, xXIRemoveMasterInfo *r,
|
|||
if (rc != Success)
|
||||
goto unwind;
|
||||
|
||||
if (!IsMaster(newkeybd))
|
||||
{
|
||||
if (!IsMaster(newkeybd)) {
|
||||
client->errorValue = r->return_keyboard;
|
||||
rc = BadDevice;
|
||||
goto unwind;
|
||||
}
|
||||
|
||||
for (attached = inputInfo.devices; attached; attached = attached->next)
|
||||
{
|
||||
for (attached = inputInfo.devices; attached; attached = attached->next) {
|
||||
if (!IsMaster(attached)) {
|
||||
if (GetMaster(attached, MASTER_ATTACHED) == ptr)
|
||||
{
|
||||
if (GetMaster(attached, MASTER_ATTACHED) == ptr) {
|
||||
AttachDevice(client, attached, newptr);
|
||||
flags[attached->id] |= XISlaveAttached;
|
||||
}
|
||||
if (GetMaster(attached, MASTER_ATTACHED) == keybd)
|
||||
{
|
||||
if (GetMaster(attached, MASTER_ATTACHED) == keybd) {
|
||||
AttachDevice(client, attached, newkeybd);
|
||||
flags[attached->id] |= XISlaveAttached;
|
||||
}
|
||||
|
|
@ -353,16 +333,14 @@ detach_slave(ClientPtr client, xXIDetachSlaveInfo *c, int flags[MAXDEVICES])
|
|||
if (rc != Success)
|
||||
goto unwind;
|
||||
|
||||
if (IsMaster(dev))
|
||||
{
|
||||
if (IsMaster(dev)) {
|
||||
client->errorValue = c->deviceid;
|
||||
rc = BadDevice;
|
||||
goto unwind;
|
||||
}
|
||||
|
||||
/* Don't allow changes to XTest Devices, these are fixed */
|
||||
if (IsXTestDevice(dev, NULL))
|
||||
{
|
||||
if (IsXTestDevice(dev, NULL)) {
|
||||
client->errorValue = c->deviceid;
|
||||
rc = BadDevice;
|
||||
goto unwind;
|
||||
|
|
@ -377,8 +355,7 @@ unwind:
|
|||
}
|
||||
|
||||
static int
|
||||
attach_slave(ClientPtr client, xXIAttachSlaveInfo *c,
|
||||
int flags[MAXDEVICES])
|
||||
attach_slave(ClientPtr client, xXIAttachSlaveInfo * c, int flags[MAXDEVICES])
|
||||
{
|
||||
DeviceIntPtr dev;
|
||||
DeviceIntPtr newmaster;
|
||||
|
|
@ -388,16 +365,14 @@ attach_slave(ClientPtr client, xXIAttachSlaveInfo *c,
|
|||
if (rc != Success)
|
||||
goto unwind;
|
||||
|
||||
if (IsMaster(dev))
|
||||
{
|
||||
if (IsMaster(dev)) {
|
||||
client->errorValue = c->deviceid;
|
||||
rc = BadDevice;
|
||||
goto unwind;
|
||||
}
|
||||
|
||||
/* Don't allow changes to XTest Devices, these are fixed */
|
||||
if (IsXTestDevice(dev, NULL))
|
||||
{
|
||||
if (IsXTestDevice(dev, NULL)) {
|
||||
client->errorValue = c->deviceid;
|
||||
rc = BadDevice;
|
||||
goto unwind;
|
||||
|
|
@ -406,16 +381,14 @@ attach_slave(ClientPtr client, xXIAttachSlaveInfo *c,
|
|||
rc = dixLookupDevice(&newmaster, c->new_master, client, DixAddAccess);
|
||||
if (rc != Success)
|
||||
goto unwind;
|
||||
if (!IsMaster(newmaster))
|
||||
{
|
||||
if (!IsMaster(newmaster)) {
|
||||
client->errorValue = c->new_master;
|
||||
rc = BadDevice;
|
||||
goto unwind;
|
||||
}
|
||||
|
||||
if (!((IsPointerDevice(newmaster) && IsPointerDevice(dev)) ||
|
||||
(IsKeyboardDevice(newmaster) && IsKeyboardDevice(dev))))
|
||||
{
|
||||
(IsKeyboardDevice(newmaster) && IsKeyboardDevice(dev)))) {
|
||||
rc = BadDevice;
|
||||
goto unwind;
|
||||
}
|
||||
|
|
@ -428,8 +401,6 @@ unwind:
|
|||
return rc;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define SWAPIF(cmd) if (client->swapped) { cmd; }
|
||||
|
||||
int
|
||||
|
|
@ -447,8 +418,7 @@ ProcXIChangeHierarchy(ClientPtr client)
|
|||
return rc;
|
||||
|
||||
any = (xXIAnyHierarchyChangeInfo *) & stuff[1];
|
||||
while(stuff->num_changes--)
|
||||
{
|
||||
while (stuff->num_changes--) {
|
||||
SWAPIF(swaps(&any->type));
|
||||
SWAPIF(swaps(&any->length));
|
||||
|
||||
|
|
@ -456,11 +426,11 @@ ProcXIChangeHierarchy(ClientPtr client)
|
|||
if ((stuff->length * 4) < required_len)
|
||||
return BadLength;
|
||||
|
||||
switch(any->type)
|
||||
{
|
||||
switch (any->type) {
|
||||
case XIAddMaster:
|
||||
{
|
||||
xXIAddMasterInfo *c = (xXIAddMasterInfo *) any;
|
||||
|
||||
SWAPIF(swaps(&c->name_len));
|
||||
|
||||
rc = add_master(client, c, flags);
|
||||
|
|
@ -505,4 +475,3 @@ unwind:
|
|||
XISendDeviceHierarchyEvent(flags);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -56,22 +56,23 @@ SProcXIGetClientPointer(ClientPtr client)
|
|||
return ProcXIGetClientPointer(client);
|
||||
}
|
||||
|
||||
int ProcXIGetClientPointer(ClientPtr client)
|
||||
int
|
||||
ProcXIGetClientPointer(ClientPtr client)
|
||||
{
|
||||
int rc;
|
||||
ClientPtr winclient;
|
||||
xXIGetClientPointerReply rep;
|
||||
|
||||
REQUEST(xXIGetClientPointerReq);
|
||||
REQUEST_SIZE_MATCH(xXIGetClientPointerReq);
|
||||
|
||||
if (stuff->win != None)
|
||||
{
|
||||
rc = dixLookupClient(&winclient, stuff->win, client,
|
||||
DixGetAttrAccess);
|
||||
if (stuff->win != None) {
|
||||
rc = dixLookupClient(&winclient, stuff->win, client, DixGetAttrAccess);
|
||||
|
||||
if (rc != Success)
|
||||
return BadWindow;
|
||||
} else
|
||||
}
|
||||
else
|
||||
winclient = client;
|
||||
|
||||
rep.repType = X_Reply;
|
||||
|
|
@ -101,4 +102,3 @@ SRepXIGetClientPointer(ClientPtr client, int size,
|
|||
swaps(&rep->deviceid);
|
||||
WriteToClient(client, size, (char *) rep);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -88,17 +88,15 @@ ProcXIGrabDevice(ClientPtr client)
|
|||
|
||||
mask_len = min(xi2mask_mask_size(mask.xi2mask), stuff->mask_len * 4);
|
||||
/* FIXME: I think the old code was broken here */
|
||||
xi2mask_set_one_mask(mask.xi2mask, dev->id, (unsigned char*)&stuff[1], mask_len);
|
||||
xi2mask_set_one_mask(mask.xi2mask, dev->id, (unsigned char *) &stuff[1],
|
||||
mask_len);
|
||||
|
||||
ret = GrabDevice(client, dev, stuff->grab_mode,
|
||||
stuff->paired_device_mode,
|
||||
stuff->grab_window,
|
||||
stuff->owner_events,
|
||||
stuff->time,
|
||||
&mask,
|
||||
XI2,
|
||||
stuff->cursor,
|
||||
None /* confineTo */,
|
||||
&mask, XI2, stuff->cursor, None /* confineTo */ ,
|
||||
&status);
|
||||
|
||||
xi2mask_free(&mask.xi2mask);
|
||||
|
|
@ -112,7 +110,6 @@ ProcXIGrabDevice(ClientPtr client)
|
|||
rep.sequenceNumber = client->sequence;
|
||||
rep.status = status;
|
||||
|
||||
|
||||
WriteReplyToClient(client, sizeof(rep), &rep);
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -154,7 +151,8 @@ ProcXIUngrabDevice(ClientPtr client)
|
|||
return Success;
|
||||
}
|
||||
|
||||
void SRepXIGrabDevice(ClientPtr client, int size, xXIGrabDeviceReply * rep)
|
||||
void
|
||||
SRepXIGrabDevice(ClientPtr client, int size, xXIGrabDeviceReply * rep)
|
||||
{
|
||||
swaps(&rep->sequenceNumber);
|
||||
swapl(&rep->length);
|
||||
|
|
|
|||
|
|
@ -65,8 +65,7 @@ SProcXIPassiveGrabDevice(ClientPtr client)
|
|||
|
||||
mods = (xXIModifierInfo *) & stuff[1];
|
||||
|
||||
for (i = 0; i < stuff->num_modifiers; i++, mods++)
|
||||
{
|
||||
for (i = 0; i < stuff->num_modifiers; i++, mods++) {
|
||||
swapl(&mods->base_mods);
|
||||
swapl(&mods->latched_mods);
|
||||
swapl(&mods->locked_mods);
|
||||
|
|
@ -95,11 +94,9 @@ ProcXIPassiveGrabDevice(ClientPtr client)
|
|||
dev = inputInfo.all_devices;
|
||||
else if (stuff->deviceid == XIAllMasterDevices)
|
||||
dev = inputInfo.all_master_devices;
|
||||
else
|
||||
{
|
||||
else {
|
||||
ret = dixLookupDevice(&dev, stuff->deviceid, client, DixGrabAccess);
|
||||
if (ret != Success)
|
||||
{
|
||||
if (ret != Success) {
|
||||
client->errorValue = stuff->deviceid;
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -109,24 +106,21 @@ ProcXIPassiveGrabDevice(ClientPtr client)
|
|||
stuff->grab_type != XIGrabtypeKeycode &&
|
||||
stuff->grab_type != XIGrabtypeEnter &&
|
||||
stuff->grab_type != XIGrabtypeFocusIn &&
|
||||
stuff->grab_type != XIGrabtypeTouchBegin)
|
||||
{
|
||||
stuff->grab_type != XIGrabtypeTouchBegin) {
|
||||
client->errorValue = stuff->grab_type;
|
||||
return BadValue;
|
||||
}
|
||||
|
||||
if ((stuff->grab_type == XIGrabtypeEnter ||
|
||||
stuff->grab_type == XIGrabtypeFocusIn ||
|
||||
stuff->grab_type == XIGrabtypeTouchBegin) && stuff->detail != 0)
|
||||
{
|
||||
stuff->grab_type == XIGrabtypeTouchBegin) && stuff->detail != 0) {
|
||||
client->errorValue = stuff->detail;
|
||||
return BadValue;
|
||||
}
|
||||
|
||||
if (stuff->grab_type == XIGrabtypeTouchBegin &&
|
||||
(stuff->grab_mode != XIGrabModeTouch ||
|
||||
stuff->paired_device_mode != GrabModeAsync))
|
||||
{
|
||||
stuff->paired_device_mode != GrabModeAsync)) {
|
||||
client->errorValue = stuff->grab_mode;
|
||||
return BadValue;
|
||||
}
|
||||
|
|
@ -140,7 +134,8 @@ ProcXIPassiveGrabDevice(ClientPtr client)
|
|||
return BadAlloc;
|
||||
|
||||
mask_len = min(xi2mask_mask_size(mask.xi2mask), stuff->mask_len * 4);
|
||||
xi2mask_set_one_mask(mask.xi2mask, stuff->deviceid, (unsigned char*)&stuff[1], mask_len * 4);
|
||||
xi2mask_set_one_mask(mask.xi2mask, stuff->deviceid,
|
||||
(unsigned char *) &stuff[1], mask_len * 4);
|
||||
|
||||
rep.repType = X_Reply;
|
||||
rep.RepType = X_XIPassiveGrabDevice;
|
||||
|
|
@ -157,23 +152,24 @@ ProcXIPassiveGrabDevice(ClientPtr client)
|
|||
if (IsKeyboardDevice(dev)) {
|
||||
param.this_device_mode = stuff->grab_mode;
|
||||
param.other_devices_mode = stuff->paired_device_mode;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
param.this_device_mode = stuff->paired_device_mode;
|
||||
param.other_devices_mode = stuff->grab_mode;
|
||||
}
|
||||
|
||||
if (stuff->cursor != None)
|
||||
{
|
||||
if (stuff->cursor != None) {
|
||||
ret = dixLookupResourceByType(&tmp, stuff->cursor,
|
||||
RT_CURSOR, client, DixUseAccess);
|
||||
if (ret != Success)
|
||||
{
|
||||
if (ret != Success) {
|
||||
client->errorValue = stuff->cursor;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
ret = dixLookupWindow((WindowPtr*)&tmp, stuff->grab_window, client, DixSetAttrAccess);
|
||||
ret =
|
||||
dixLookupWindow((WindowPtr *) &tmp, stuff->grab_window, client,
|
||||
DixSetAttrAccess);
|
||||
if (ret != Success)
|
||||
goto out;
|
||||
|
||||
|
|
@ -182,7 +178,8 @@ ProcXIPassiveGrabDevice(ClientPtr client)
|
|||
goto out;
|
||||
|
||||
modifiers = (uint32_t *) & stuff[1] + stuff->mask_len;
|
||||
modifiers_failed = calloc(stuff->num_modifiers, sizeof(xXIGrabModifierInfo));
|
||||
modifiers_failed =
|
||||
calloc(stuff->num_modifiers, sizeof(xXIGrabModifierInfo));
|
||||
if (!modifiers_failed) {
|
||||
ret = BadAlloc;
|
||||
goto out;
|
||||
|
|
@ -190,13 +187,11 @@ ProcXIPassiveGrabDevice(ClientPtr client)
|
|||
|
||||
mod_dev = (IsFloating(dev)) ? dev : GetMaster(dev, MASTER_KEYBOARD);
|
||||
|
||||
for (i = 0; i < stuff->num_modifiers; i++, modifiers++)
|
||||
{
|
||||
for (i = 0; i < stuff->num_modifiers; i++, modifiers++) {
|
||||
uint8_t status = Success;
|
||||
|
||||
param.modifiers = *modifiers;
|
||||
switch(stuff->grab_type)
|
||||
{
|
||||
switch (stuff->grab_type) {
|
||||
case XIGrabtypeButton:
|
||||
status = GrabButton(client, dev, mod_dev, stuff->detail,
|
||||
¶m, XI2, &mask);
|
||||
|
|
@ -207,16 +202,14 @@ ProcXIPassiveGrabDevice(ClientPtr client)
|
|||
break;
|
||||
case XIGrabtypeEnter:
|
||||
case XIGrabtypeFocusIn:
|
||||
status = GrabWindow(client, dev, stuff->grab_type,
|
||||
¶m, &mask);
|
||||
status = GrabWindow(client, dev, stuff->grab_type, ¶m, &mask);
|
||||
break;
|
||||
case XIGrabtypeTouchBegin:
|
||||
status = GrabTouch(client, dev, mod_dev, ¶m, &mask);
|
||||
break;
|
||||
}
|
||||
|
||||
if (status != GrabSuccess)
|
||||
{
|
||||
if (status != GrabSuccess) {
|
||||
xXIGrabModifierInfo *info = modifiers_failed + rep.num_modifiers;
|
||||
|
||||
info->status = status;
|
||||
|
|
@ -288,8 +281,7 @@ ProcXIPassiveUngrabDevice(ClientPtr client)
|
|||
dev = inputInfo.all_devices;
|
||||
else if (stuff->deviceid == XIAllMasterDevices)
|
||||
dev = inputInfo.all_master_devices;
|
||||
else
|
||||
{
|
||||
else {
|
||||
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGrabAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
|
@ -298,15 +290,13 @@ ProcXIPassiveUngrabDevice(ClientPtr client)
|
|||
if (stuff->grab_type != XIGrabtypeButton &&
|
||||
stuff->grab_type != XIGrabtypeKeycode &&
|
||||
stuff->grab_type != XIGrabtypeEnter &&
|
||||
stuff->grab_type != XIGrabtypeFocusIn)
|
||||
{
|
||||
stuff->grab_type != XIGrabtypeFocusIn) {
|
||||
client->errorValue = stuff->grab_type;
|
||||
return BadValue;
|
||||
}
|
||||
|
||||
if ((stuff->grab_type == XIGrabtypeEnter ||
|
||||
stuff->grab_type == XIGrabtypeFocusIn) && stuff->detail != 0)
|
||||
{
|
||||
stuff->grab_type == XIGrabtypeFocusIn) && stuff->detail != 0) {
|
||||
client->errorValue = stuff->detail;
|
||||
return BadValue;
|
||||
}
|
||||
|
|
@ -317,7 +307,6 @@ ProcXIPassiveUngrabDevice(ClientPtr client)
|
|||
|
||||
mod_dev = (IsFloating(dev)) ? dev : GetMaster(dev, MASTER_KEYBOARD);
|
||||
|
||||
|
||||
tempGrab = AllocGrab();
|
||||
if (!tempGrab)
|
||||
return BadAlloc;
|
||||
|
|
@ -325,12 +314,19 @@ ProcXIPassiveUngrabDevice(ClientPtr client)
|
|||
tempGrab->resource = client->clientAsMask;
|
||||
tempGrab->device = dev;
|
||||
tempGrab->window = win;
|
||||
switch(stuff->grab_type)
|
||||
{
|
||||
case XIGrabtypeButton: tempGrab->type = XI_ButtonPress; break;
|
||||
case XIGrabtypeKeycode: tempGrab->type = XI_KeyPress; break;
|
||||
case XIGrabtypeEnter: tempGrab->type = XI_Enter; break;
|
||||
case XIGrabtypeFocusIn: tempGrab->type = XI_FocusIn; break;
|
||||
switch (stuff->grab_type) {
|
||||
case XIGrabtypeButton:
|
||||
tempGrab->type = XI_ButtonPress;
|
||||
break;
|
||||
case XIGrabtypeKeycode:
|
||||
tempGrab->type = XI_KeyPress;
|
||||
break;
|
||||
case XIGrabtypeEnter:
|
||||
tempGrab->type = XI_Enter;
|
||||
break;
|
||||
case XIGrabtypeFocusIn:
|
||||
tempGrab->type = XI_FocusIn;
|
||||
break;
|
||||
}
|
||||
tempGrab->grabtype = XI2;
|
||||
tempGrab->modifierDevice = mod_dev;
|
||||
|
|
@ -340,8 +336,7 @@ ProcXIPassiveUngrabDevice(ClientPtr client)
|
|||
|
||||
modifiers = (uint32_t *) & stuff[1];
|
||||
|
||||
for (i = 0; i < stuff->num_modifiers; i++, modifiers++)
|
||||
{
|
||||
for (i = 0; i < stuff->num_modifiers; i++, modifiers++) {
|
||||
tempGrab->modifiersDetail.exact = *modifiers;
|
||||
DeletePassiveGrabFromList(tempGrab);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,8 @@
|
|||
|
||||
int SProcXIPassiveUngrabDevice(ClientPtr client);
|
||||
int ProcXIPassiveUngrabDevice(ClientPtr client);
|
||||
void SRepXIPassiveGrabDevice(ClientPtr client, int size, xXIPassiveGrabDeviceReply * rep);
|
||||
void SRepXIPassiveGrabDevice(ClientPtr client, int size,
|
||||
xXIPassiveGrabDeviceReply * rep);
|
||||
int ProcXIPassiveGrabDevice(ClientPtr client);
|
||||
int SProcXIPassiveGrabDevice(ClientPtr client);
|
||||
|
||||
|
|
|
|||
507
Xi/xiproperty.c
507
Xi/xiproperty.c
|
|
@ -45,151 +45,142 @@
|
|||
/**
|
||||
* Properties used or alloced from inside the server.
|
||||
*/
|
||||
static struct dev_properties
|
||||
{
|
||||
static struct dev_properties {
|
||||
Atom type;
|
||||
const char *name;
|
||||
} dev_properties[] = {
|
||||
{0, XI_PROP_ENABLED},
|
||||
{0, XI_PROP_XTEST_DEVICE},
|
||||
|
||||
{0, XATOM_FLOAT},
|
||||
|
||||
{0, ACCEL_PROP_PROFILE_NUMBER},
|
||||
{0, ACCEL_PROP_CONSTANT_DECELERATION},
|
||||
{0, ACCEL_PROP_ADAPTIVE_DECELERATION},
|
||||
{0, ACCEL_PROP_VELOCITY_SCALING},
|
||||
|
||||
{0, AXIS_LABEL_PROP},
|
||||
{0, AXIS_LABEL_PROP_REL_X},
|
||||
{0, AXIS_LABEL_PROP_REL_Y},
|
||||
{0, AXIS_LABEL_PROP_REL_Z},
|
||||
{0, AXIS_LABEL_PROP_REL_RX},
|
||||
{0, AXIS_LABEL_PROP_REL_RY},
|
||||
{0, AXIS_LABEL_PROP_REL_RZ},
|
||||
{0, AXIS_LABEL_PROP_REL_HWHEEL},
|
||||
{0, AXIS_LABEL_PROP_REL_DIAL},
|
||||
{0, AXIS_LABEL_PROP_REL_WHEEL},
|
||||
{0, AXIS_LABEL_PROP_REL_MISC},
|
||||
{0, AXIS_LABEL_PROP_REL_VSCROLL},
|
||||
{0, AXIS_LABEL_PROP_REL_HSCROLL},
|
||||
{0, AXIS_LABEL_PROP_ABS_X},
|
||||
{0, AXIS_LABEL_PROP_ABS_Y},
|
||||
{0, AXIS_LABEL_PROP_ABS_Z},
|
||||
{0, AXIS_LABEL_PROP_ABS_RX},
|
||||
{0, AXIS_LABEL_PROP_ABS_RY},
|
||||
{0, AXIS_LABEL_PROP_ABS_RZ},
|
||||
{0, AXIS_LABEL_PROP_ABS_THROTTLE},
|
||||
{0, AXIS_LABEL_PROP_ABS_RUDDER},
|
||||
{0, AXIS_LABEL_PROP_ABS_WHEEL},
|
||||
{0, AXIS_LABEL_PROP_ABS_GAS},
|
||||
{0, AXIS_LABEL_PROP_ABS_BRAKE},
|
||||
{0, AXIS_LABEL_PROP_ABS_HAT0X},
|
||||
{0, AXIS_LABEL_PROP_ABS_HAT0Y},
|
||||
{0, AXIS_LABEL_PROP_ABS_HAT1X},
|
||||
{0, AXIS_LABEL_PROP_ABS_HAT1Y},
|
||||
{0, AXIS_LABEL_PROP_ABS_HAT2X},
|
||||
{0, AXIS_LABEL_PROP_ABS_HAT2Y},
|
||||
{0, AXIS_LABEL_PROP_ABS_HAT3X},
|
||||
{0, AXIS_LABEL_PROP_ABS_HAT3Y},
|
||||
{0, AXIS_LABEL_PROP_ABS_PRESSURE},
|
||||
{0, AXIS_LABEL_PROP_ABS_DISTANCE},
|
||||
{0, AXIS_LABEL_PROP_ABS_TILT_X},
|
||||
{0, AXIS_LABEL_PROP_ABS_TILT_Y},
|
||||
{0, AXIS_LABEL_PROP_ABS_TOOL_WIDTH},
|
||||
{0, AXIS_LABEL_PROP_ABS_VOLUME},
|
||||
{0, AXIS_LABEL_PROP_ABS_MT_TOUCH_MAJOR},
|
||||
{0, AXIS_LABEL_PROP_ABS_MT_TOUCH_MINOR},
|
||||
{0, AXIS_LABEL_PROP_ABS_MT_WIDTH_MAJOR},
|
||||
{0, AXIS_LABEL_PROP_ABS_MT_WIDTH_MINOR},
|
||||
{0, AXIS_LABEL_PROP_ABS_MT_ORIENTATION},
|
||||
{0, AXIS_LABEL_PROP_ABS_MT_POSITION_X},
|
||||
{0, AXIS_LABEL_PROP_ABS_MT_POSITION_Y},
|
||||
{0, AXIS_LABEL_PROP_ABS_MT_TOOL_TYPE},
|
||||
{0, AXIS_LABEL_PROP_ABS_MT_BLOB_ID},
|
||||
{0, AXIS_LABEL_PROP_ABS_MT_TRACKING_ID},
|
||||
{0, AXIS_LABEL_PROP_ABS_MT_PRESSURE},
|
||||
{0, AXIS_LABEL_PROP_ABS_MISC},
|
||||
|
||||
{0, BTN_LABEL_PROP},
|
||||
{0, BTN_LABEL_PROP_BTN_UNKNOWN},
|
||||
{0, BTN_LABEL_PROP_BTN_WHEEL_UP},
|
||||
{0, BTN_LABEL_PROP_BTN_WHEEL_DOWN},
|
||||
{0, BTN_LABEL_PROP_BTN_HWHEEL_LEFT},
|
||||
{0, BTN_LABEL_PROP_BTN_HWHEEL_RIGHT},
|
||||
{0, BTN_LABEL_PROP_BTN_0},
|
||||
{0, BTN_LABEL_PROP_BTN_1},
|
||||
{0, BTN_LABEL_PROP_BTN_2},
|
||||
{0, BTN_LABEL_PROP_BTN_3},
|
||||
{0, BTN_LABEL_PROP_BTN_4},
|
||||
{0, BTN_LABEL_PROP_BTN_5},
|
||||
{0, BTN_LABEL_PROP_BTN_6},
|
||||
{0, BTN_LABEL_PROP_BTN_7},
|
||||
{0, BTN_LABEL_PROP_BTN_8},
|
||||
{0, BTN_LABEL_PROP_BTN_9},
|
||||
|
||||
{0, BTN_LABEL_PROP_BTN_LEFT},
|
||||
{0, BTN_LABEL_PROP_BTN_RIGHT},
|
||||
{0, BTN_LABEL_PROP_BTN_MIDDLE},
|
||||
{0, BTN_LABEL_PROP_BTN_SIDE},
|
||||
{0, BTN_LABEL_PROP_BTN_EXTRA},
|
||||
{0, BTN_LABEL_PROP_BTN_FORWARD},
|
||||
{0, BTN_LABEL_PROP_BTN_BACK},
|
||||
{0, BTN_LABEL_PROP_BTN_TASK},
|
||||
|
||||
{0, BTN_LABEL_PROP_BTN_TRIGGER},
|
||||
{0, BTN_LABEL_PROP_BTN_THUMB},
|
||||
{0, BTN_LABEL_PROP_BTN_THUMB2},
|
||||
{0, BTN_LABEL_PROP_BTN_TOP},
|
||||
{0, BTN_LABEL_PROP_BTN_TOP2},
|
||||
{0, BTN_LABEL_PROP_BTN_PINKIE},
|
||||
{0, BTN_LABEL_PROP_BTN_BASE},
|
||||
{0, BTN_LABEL_PROP_BTN_BASE2},
|
||||
{0, BTN_LABEL_PROP_BTN_BASE3},
|
||||
{0, BTN_LABEL_PROP_BTN_BASE4},
|
||||
{0, BTN_LABEL_PROP_BTN_BASE5},
|
||||
{0, BTN_LABEL_PROP_BTN_BASE6},
|
||||
{0, BTN_LABEL_PROP_BTN_DEAD},
|
||||
|
||||
{0, BTN_LABEL_PROP_BTN_A},
|
||||
{0, BTN_LABEL_PROP_BTN_B},
|
||||
{0, BTN_LABEL_PROP_BTN_C},
|
||||
{0, BTN_LABEL_PROP_BTN_X},
|
||||
{0, BTN_LABEL_PROP_BTN_Y},
|
||||
{0, BTN_LABEL_PROP_BTN_Z},
|
||||
{0, BTN_LABEL_PROP_BTN_TL},
|
||||
{0, BTN_LABEL_PROP_BTN_TR},
|
||||
{0, BTN_LABEL_PROP_BTN_TL2},
|
||||
{0, BTN_LABEL_PROP_BTN_TR2},
|
||||
{0, BTN_LABEL_PROP_BTN_SELECT},
|
||||
{0, BTN_LABEL_PROP_BTN_START},
|
||||
{0, BTN_LABEL_PROP_BTN_MODE},
|
||||
{0, BTN_LABEL_PROP_BTN_THUMBL},
|
||||
{0, BTN_LABEL_PROP_BTN_THUMBR},
|
||||
|
||||
{0, BTN_LABEL_PROP_BTN_TOOL_PEN},
|
||||
{0, BTN_LABEL_PROP_BTN_TOOL_RUBBER},
|
||||
{0, BTN_LABEL_PROP_BTN_TOOL_BRUSH},
|
||||
{0, BTN_LABEL_PROP_BTN_TOOL_PENCIL},
|
||||
{0, BTN_LABEL_PROP_BTN_TOOL_AIRBRUSH},
|
||||
{0, BTN_LABEL_PROP_BTN_TOOL_FINGER},
|
||||
{0, BTN_LABEL_PROP_BTN_TOOL_MOUSE},
|
||||
{0, BTN_LABEL_PROP_BTN_TOOL_LENS},
|
||||
{0, BTN_LABEL_PROP_BTN_TOUCH},
|
||||
{0, BTN_LABEL_PROP_BTN_STYLUS},
|
||||
{0, BTN_LABEL_PROP_BTN_STYLUS2},
|
||||
{0, BTN_LABEL_PROP_BTN_TOOL_DOUBLETAP},
|
||||
{0, BTN_LABEL_PROP_BTN_TOOL_TRIPLETAP},
|
||||
|
||||
{0, BTN_LABEL_PROP_BTN_GEAR_DOWN},
|
||||
{0, BTN_LABEL_PROP_BTN_GEAR_UP},
|
||||
|
||||
{0, XI_PROP_TRANSFORM}
|
||||
{
|
||||
0, XI_PROP_ENABLED}, {
|
||||
0, XI_PROP_XTEST_DEVICE}, {
|
||||
0, XATOM_FLOAT}, {
|
||||
0, ACCEL_PROP_PROFILE_NUMBER}, {
|
||||
0, ACCEL_PROP_CONSTANT_DECELERATION}, {
|
||||
0, ACCEL_PROP_ADAPTIVE_DECELERATION}, {
|
||||
0, ACCEL_PROP_VELOCITY_SCALING}, {
|
||||
0, AXIS_LABEL_PROP}, {
|
||||
0, AXIS_LABEL_PROP_REL_X}, {
|
||||
0, AXIS_LABEL_PROP_REL_Y}, {
|
||||
0, AXIS_LABEL_PROP_REL_Z}, {
|
||||
0, AXIS_LABEL_PROP_REL_RX}, {
|
||||
0, AXIS_LABEL_PROP_REL_RY}, {
|
||||
0, AXIS_LABEL_PROP_REL_RZ}, {
|
||||
0, AXIS_LABEL_PROP_REL_HWHEEL}, {
|
||||
0, AXIS_LABEL_PROP_REL_DIAL}, {
|
||||
0, AXIS_LABEL_PROP_REL_WHEEL}, {
|
||||
0, AXIS_LABEL_PROP_REL_MISC}, {
|
||||
0, AXIS_LABEL_PROP_REL_VSCROLL}, {
|
||||
0, AXIS_LABEL_PROP_REL_HSCROLL}, {
|
||||
0, AXIS_LABEL_PROP_ABS_X}, {
|
||||
0, AXIS_LABEL_PROP_ABS_Y}, {
|
||||
0, AXIS_LABEL_PROP_ABS_Z}, {
|
||||
0, AXIS_LABEL_PROP_ABS_RX}, {
|
||||
0, AXIS_LABEL_PROP_ABS_RY}, {
|
||||
0, AXIS_LABEL_PROP_ABS_RZ}, {
|
||||
0, AXIS_LABEL_PROP_ABS_THROTTLE}, {
|
||||
0, AXIS_LABEL_PROP_ABS_RUDDER}, {
|
||||
0, AXIS_LABEL_PROP_ABS_WHEEL}, {
|
||||
0, AXIS_LABEL_PROP_ABS_GAS}, {
|
||||
0, AXIS_LABEL_PROP_ABS_BRAKE}, {
|
||||
0, AXIS_LABEL_PROP_ABS_HAT0X}, {
|
||||
0, AXIS_LABEL_PROP_ABS_HAT0Y}, {
|
||||
0, AXIS_LABEL_PROP_ABS_HAT1X}, {
|
||||
0, AXIS_LABEL_PROP_ABS_HAT1Y}, {
|
||||
0, AXIS_LABEL_PROP_ABS_HAT2X}, {
|
||||
0, AXIS_LABEL_PROP_ABS_HAT2Y}, {
|
||||
0, AXIS_LABEL_PROP_ABS_HAT3X}, {
|
||||
0, AXIS_LABEL_PROP_ABS_HAT3Y}, {
|
||||
0, AXIS_LABEL_PROP_ABS_PRESSURE}, {
|
||||
0, AXIS_LABEL_PROP_ABS_DISTANCE}, {
|
||||
0, AXIS_LABEL_PROP_ABS_TILT_X}, {
|
||||
0, AXIS_LABEL_PROP_ABS_TILT_Y}, {
|
||||
0, AXIS_LABEL_PROP_ABS_TOOL_WIDTH}, {
|
||||
0, AXIS_LABEL_PROP_ABS_VOLUME}, {
|
||||
0, AXIS_LABEL_PROP_ABS_MT_TOUCH_MAJOR}, {
|
||||
0, AXIS_LABEL_PROP_ABS_MT_TOUCH_MINOR}, {
|
||||
0, AXIS_LABEL_PROP_ABS_MT_WIDTH_MAJOR}, {
|
||||
0, AXIS_LABEL_PROP_ABS_MT_WIDTH_MINOR}, {
|
||||
0, AXIS_LABEL_PROP_ABS_MT_ORIENTATION}, {
|
||||
0, AXIS_LABEL_PROP_ABS_MT_POSITION_X}, {
|
||||
0, AXIS_LABEL_PROP_ABS_MT_POSITION_Y}, {
|
||||
0, AXIS_LABEL_PROP_ABS_MT_TOOL_TYPE}, {
|
||||
0, AXIS_LABEL_PROP_ABS_MT_BLOB_ID}, {
|
||||
0, AXIS_LABEL_PROP_ABS_MT_TRACKING_ID}, {
|
||||
0, AXIS_LABEL_PROP_ABS_MT_PRESSURE}, {
|
||||
0, AXIS_LABEL_PROP_ABS_MISC}, {
|
||||
0, BTN_LABEL_PROP}, {
|
||||
0, BTN_LABEL_PROP_BTN_UNKNOWN}, {
|
||||
0, BTN_LABEL_PROP_BTN_WHEEL_UP}, {
|
||||
0, BTN_LABEL_PROP_BTN_WHEEL_DOWN}, {
|
||||
0, BTN_LABEL_PROP_BTN_HWHEEL_LEFT}, {
|
||||
0, BTN_LABEL_PROP_BTN_HWHEEL_RIGHT}, {
|
||||
0, BTN_LABEL_PROP_BTN_0}, {
|
||||
0, BTN_LABEL_PROP_BTN_1}, {
|
||||
0, BTN_LABEL_PROP_BTN_2}, {
|
||||
0, BTN_LABEL_PROP_BTN_3}, {
|
||||
0, BTN_LABEL_PROP_BTN_4}, {
|
||||
0, BTN_LABEL_PROP_BTN_5}, {
|
||||
0, BTN_LABEL_PROP_BTN_6}, {
|
||||
0, BTN_LABEL_PROP_BTN_7}, {
|
||||
0, BTN_LABEL_PROP_BTN_8}, {
|
||||
0, BTN_LABEL_PROP_BTN_9}, {
|
||||
0, BTN_LABEL_PROP_BTN_LEFT}, {
|
||||
0, BTN_LABEL_PROP_BTN_RIGHT}, {
|
||||
0, BTN_LABEL_PROP_BTN_MIDDLE}, {
|
||||
0, BTN_LABEL_PROP_BTN_SIDE}, {
|
||||
0, BTN_LABEL_PROP_BTN_EXTRA}, {
|
||||
0, BTN_LABEL_PROP_BTN_FORWARD}, {
|
||||
0, BTN_LABEL_PROP_BTN_BACK}, {
|
||||
0, BTN_LABEL_PROP_BTN_TASK}, {
|
||||
0, BTN_LABEL_PROP_BTN_TRIGGER}, {
|
||||
0, BTN_LABEL_PROP_BTN_THUMB}, {
|
||||
0, BTN_LABEL_PROP_BTN_THUMB2}, {
|
||||
0, BTN_LABEL_PROP_BTN_TOP}, {
|
||||
0, BTN_LABEL_PROP_BTN_TOP2}, {
|
||||
0, BTN_LABEL_PROP_BTN_PINKIE}, {
|
||||
0, BTN_LABEL_PROP_BTN_BASE}, {
|
||||
0, BTN_LABEL_PROP_BTN_BASE2}, {
|
||||
0, BTN_LABEL_PROP_BTN_BASE3}, {
|
||||
0, BTN_LABEL_PROP_BTN_BASE4}, {
|
||||
0, BTN_LABEL_PROP_BTN_BASE5}, {
|
||||
0, BTN_LABEL_PROP_BTN_BASE6}, {
|
||||
0, BTN_LABEL_PROP_BTN_DEAD}, {
|
||||
0, BTN_LABEL_PROP_BTN_A}, {
|
||||
0, BTN_LABEL_PROP_BTN_B}, {
|
||||
0, BTN_LABEL_PROP_BTN_C}, {
|
||||
0, BTN_LABEL_PROP_BTN_X}, {
|
||||
0, BTN_LABEL_PROP_BTN_Y}, {
|
||||
0, BTN_LABEL_PROP_BTN_Z}, {
|
||||
0, BTN_LABEL_PROP_BTN_TL}, {
|
||||
0, BTN_LABEL_PROP_BTN_TR}, {
|
||||
0, BTN_LABEL_PROP_BTN_TL2}, {
|
||||
0, BTN_LABEL_PROP_BTN_TR2}, {
|
||||
0, BTN_LABEL_PROP_BTN_SELECT}, {
|
||||
0, BTN_LABEL_PROP_BTN_START}, {
|
||||
0, BTN_LABEL_PROP_BTN_MODE}, {
|
||||
0, BTN_LABEL_PROP_BTN_THUMBL}, {
|
||||
0, BTN_LABEL_PROP_BTN_THUMBR}, {
|
||||
0, BTN_LABEL_PROP_BTN_TOOL_PEN}, {
|
||||
0, BTN_LABEL_PROP_BTN_TOOL_RUBBER}, {
|
||||
0, BTN_LABEL_PROP_BTN_TOOL_BRUSH}, {
|
||||
0, BTN_LABEL_PROP_BTN_TOOL_PENCIL}, {
|
||||
0, BTN_LABEL_PROP_BTN_TOOL_AIRBRUSH}, {
|
||||
0, BTN_LABEL_PROP_BTN_TOOL_FINGER}, {
|
||||
0, BTN_LABEL_PROP_BTN_TOOL_MOUSE}, {
|
||||
0, BTN_LABEL_PROP_BTN_TOOL_LENS}, {
|
||||
0, BTN_LABEL_PROP_BTN_TOUCH}, {
|
||||
0, BTN_LABEL_PROP_BTN_STYLUS}, {
|
||||
0, BTN_LABEL_PROP_BTN_STYLUS2}, {
|
||||
0, BTN_LABEL_PROP_BTN_TOOL_DOUBLETAP}, {
|
||||
0, BTN_LABEL_PROP_BTN_TOOL_TRIPLETAP}, {
|
||||
0, BTN_LABEL_PROP_BTN_GEAR_DOWN}, {
|
||||
0, BTN_LABEL_PROP_BTN_GEAR_UP}, {
|
||||
0, XI_PROP_TRANSFORM}
|
||||
};
|
||||
|
||||
static long XIPropHandlerID = 1;
|
||||
|
||||
static void send_property_event(DeviceIntPtr dev, Atom property, int what)
|
||||
static void
|
||||
send_property_event(DeviceIntPtr dev, Atom property, int what)
|
||||
{
|
||||
devicePropertyNotify event;
|
||||
xXIPropertyEvent xi2;
|
||||
|
|
@ -205,8 +196,7 @@ static void send_property_event(DeviceIntPtr dev, Atom property, int what)
|
|||
event.state = state;
|
||||
event.atom = property;
|
||||
event.time = currentTime.milliseconds;
|
||||
SendEventToAllWindows(dev, DevicePropertyNotifyMask,
|
||||
(xEvent*)&event, 1);
|
||||
SendEventToAllWindows(dev, DevicePropertyNotifyMask, (xEvent *) &event, 1);
|
||||
|
||||
xi2.type = GenericEvent;
|
||||
xi2.extension = IReqCode;
|
||||
|
|
@ -220,7 +210,8 @@ static void send_property_event(DeviceIntPtr dev, Atom property, int what)
|
|||
(xEvent *) &xi2, 1);
|
||||
}
|
||||
|
||||
static int list_atoms(DeviceIntPtr dev, int *natoms, Atom **atoms_return)
|
||||
static int
|
||||
list_atoms(DeviceIntPtr dev, int *natoms, Atom **atoms_return)
|
||||
{
|
||||
XIPropertyPtr prop;
|
||||
Atom *atoms = NULL;
|
||||
|
|
@ -228,8 +219,7 @@ static int list_atoms(DeviceIntPtr dev, int *natoms, Atom **atoms_return)
|
|||
|
||||
for (prop = dev->properties.properties; prop; prop = prop->next)
|
||||
nprops++;
|
||||
if (nprops)
|
||||
{
|
||||
if (nprops) {
|
||||
Atom *a;
|
||||
|
||||
atoms = malloc(nprops * sizeof(Atom));
|
||||
|
|
@ -256,19 +246,16 @@ get_property(ClientPtr client, DeviceIntPtr dev, Atom property, Atom type,
|
|||
XIPropertyPtr prop;
|
||||
XIPropertyValuePtr prop_value;
|
||||
|
||||
if (!ValidAtom(property))
|
||||
{
|
||||
if (!ValidAtom(property)) {
|
||||
client->errorValue = property;
|
||||
return BadAtom;
|
||||
}
|
||||
if ((delete != xTrue) && (delete != xFalse))
|
||||
{
|
||||
if ((delete != xTrue) && (delete != xFalse)) {
|
||||
client->errorValue = delete;
|
||||
return BadValue;
|
||||
}
|
||||
|
||||
if ((type != AnyPropertyType) && !ValidAtom(type))
|
||||
{
|
||||
if ((type != AnyPropertyType) && !ValidAtom(type)) {
|
||||
client->errorValue = type;
|
||||
return BadAtom;
|
||||
}
|
||||
|
|
@ -277,8 +264,7 @@ get_property(ClientPtr client, DeviceIntPtr dev, Atom property, Atom type,
|
|||
if (prop->propertyName == property)
|
||||
break;
|
||||
|
||||
if (!prop)
|
||||
{
|
||||
if (!prop) {
|
||||
*bytes_after = 0;
|
||||
*type_return = None;
|
||||
*format = 0;
|
||||
|
|
@ -288,8 +274,7 @@ get_property(ClientPtr client, DeviceIntPtr dev, Atom property, Atom type,
|
|||
}
|
||||
|
||||
rc = XIGetDeviceProperty(dev, property, &prop_value);
|
||||
if (rc != Success)
|
||||
{
|
||||
if (rc != Success) {
|
||||
client->errorValue = property;
|
||||
return rc;
|
||||
}
|
||||
|
|
@ -297,8 +282,7 @@ get_property(ClientPtr client, DeviceIntPtr dev, Atom property, Atom type,
|
|||
/* If the request type and actual type don't match. Return the
|
||||
property information, but not the data. */
|
||||
|
||||
if (((type != prop_value->type) && (type != AnyPropertyType)))
|
||||
{
|
||||
if (((type != prop_value->type) && (type != AnyPropertyType))) {
|
||||
*bytes_after = prop_value->size;
|
||||
*format = prop_value->format;
|
||||
*length_return = 0;
|
||||
|
|
@ -314,8 +298,7 @@ get_property(ClientPtr client, DeviceIntPtr dev, Atom property, Atom type,
|
|||
/* If offset is invalid such that it causes "len" to
|
||||
be negative, it's a value error. */
|
||||
|
||||
if (n < ind)
|
||||
{
|
||||
if (n < ind) {
|
||||
client->errorValue = offset;
|
||||
return BadValue;
|
||||
}
|
||||
|
|
@ -341,24 +324,20 @@ check_change_property(ClientPtr client, Atom property, Atom type, int format,
|
|||
int mode, int nitems)
|
||||
{
|
||||
if ((mode != PropModeReplace) && (mode != PropModeAppend) &&
|
||||
(mode != PropModePrepend))
|
||||
{
|
||||
(mode != PropModePrepend)) {
|
||||
client->errorValue = mode;
|
||||
return BadValue;
|
||||
}
|
||||
if ((format != 8) && (format != 16) && (format != 32))
|
||||
{
|
||||
if ((format != 8) && (format != 16) && (format != 32)) {
|
||||
client->errorValue = format;
|
||||
return BadValue;
|
||||
}
|
||||
|
||||
if (!ValidAtom(property))
|
||||
{
|
||||
if (!ValidAtom(property)) {
|
||||
client->errorValue = property;
|
||||
return BadAtom;
|
||||
}
|
||||
if (!ValidAtom(type))
|
||||
{
|
||||
if (!ValidAtom(type)) {
|
||||
client->errorValue = type;
|
||||
return BadAtom;
|
||||
}
|
||||
|
|
@ -372,7 +351,8 @@ change_property(ClientPtr client, DeviceIntPtr dev, Atom property, Atom type,
|
|||
{
|
||||
int rc = Success;
|
||||
|
||||
rc = XIChangeDeviceProperty(dev, property, type, format, mode, len, data, TRUE);
|
||||
rc = XIChangeDeviceProperty(dev, property, type, format, mode, len, data,
|
||||
TRUE);
|
||||
if (rc != Success)
|
||||
client->errorValue = property;
|
||||
|
||||
|
|
@ -393,14 +373,13 @@ XIGetKnownProperty(const char *name)
|
|||
if (!name)
|
||||
return None;
|
||||
|
||||
for (i = 0; i < (sizeof(dev_properties)/sizeof(struct dev_properties)); i++)
|
||||
{
|
||||
for (i = 0; i < (sizeof(dev_properties) / sizeof(struct dev_properties));
|
||||
i++) {
|
||||
if (strcmp(name, dev_properties[i].name) == 0) {
|
||||
if (dev_properties[i].type == None) {
|
||||
dev_properties[i].type =
|
||||
MakeAtom(dev_properties[i].name,
|
||||
strlen(dev_properties[i].name),
|
||||
TRUE);
|
||||
strlen(dev_properties[i].name), TRUE);
|
||||
}
|
||||
|
||||
return dev_properties[i].type;
|
||||
|
|
@ -415,7 +394,8 @@ XIResetProperties(void)
|
|||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < (sizeof(dev_properties)/sizeof(struct dev_properties)); i++)
|
||||
for (i = 0; i < (sizeof(dev_properties) / sizeof(struct dev_properties));
|
||||
i++)
|
||||
dev_properties[i].type = None;
|
||||
}
|
||||
|
||||
|
|
@ -450,8 +430,7 @@ XIPropToInt(XIPropertyValuePtr val, int *nelem_return, int **buf_return)
|
|||
if (!*buf_return && *nelem_return)
|
||||
return BadLength;
|
||||
|
||||
switch(val->format)
|
||||
{
|
||||
switch (val->format) {
|
||||
case 8:
|
||||
case 16:
|
||||
case 32:
|
||||
|
|
@ -462,23 +441,27 @@ XIPropToInt(XIPropertyValuePtr val, int *nelem_return, int **buf_return)
|
|||
|
||||
buf = *buf_return;
|
||||
|
||||
if (!buf && !(*nelem_return))
|
||||
{
|
||||
if (!buf && !(*nelem_return)) {
|
||||
buf = calloc(val->size, sizeof(int));
|
||||
if (!buf)
|
||||
return BadAlloc;
|
||||
*buf_return = buf;
|
||||
*nelem_return = val->size;
|
||||
} else if (val->size < *nelem_return)
|
||||
}
|
||||
else if (val->size < *nelem_return)
|
||||
*nelem_return = val->size;
|
||||
|
||||
for (i = 0; i < val->size && i < *nelem_return; i++)
|
||||
{
|
||||
switch(val->format)
|
||||
{
|
||||
case 8: buf[i] = ((CARD8*)val->data)[i]; break;
|
||||
case 16: buf[i] = ((CARD16*)val->data)[i]; break;
|
||||
case 32: buf[i] = ((CARD32*)val->data)[i]; break;
|
||||
for (i = 0; i < val->size && i < *nelem_return; i++) {
|
||||
switch (val->format) {
|
||||
case 8:
|
||||
buf[i] = ((CARD8 *) val->data)[i];
|
||||
break;
|
||||
case 16:
|
||||
buf[i] = ((CARD16 *) val->data)[i];
|
||||
break;
|
||||
case 32:
|
||||
buf[i] = ((CARD32 *) val->data)[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -522,14 +505,14 @@ XIPropToFloat(XIPropertyValuePtr val, int *nelem_return, float **buf_return)
|
|||
|
||||
buf = *buf_return;
|
||||
|
||||
if (!buf && !(*nelem_return))
|
||||
{
|
||||
if (!buf && !(*nelem_return)) {
|
||||
buf = calloc(val->size, sizeof(float));
|
||||
if (!buf)
|
||||
return BadAlloc;
|
||||
*buf_return = buf;
|
||||
*nelem_return = val->size;
|
||||
} else if (val->size < *nelem_return)
|
||||
}
|
||||
else if (val->size < *nelem_return)
|
||||
*nelem_return = val->size;
|
||||
|
||||
for (i = 0; i < val->size && i < *nelem_return; i++)
|
||||
|
|
@ -576,8 +559,7 @@ XIUnregisterPropertyHandler(DeviceIntPtr dev, long id)
|
|||
XIPropertyHandlerPtr curr, prev = NULL;
|
||||
|
||||
curr = dev->properties.handlers;
|
||||
while(curr && curr->id != id)
|
||||
{
|
||||
while (curr && curr->id != id) {
|
||||
prev = curr;
|
||||
curr = curr->next;
|
||||
}
|
||||
|
|
@ -641,8 +623,7 @@ XIDeleteAllDeviceProperties (DeviceIntPtr device)
|
|||
XIPropertyPtr prop, next;
|
||||
XIPropertyHandlerPtr curr_handler, next_handler;
|
||||
|
||||
for (prop = device->properties.properties; prop; prop = next)
|
||||
{
|
||||
for (prop = device->properties.properties; prop; prop = next) {
|
||||
next = prop->next;
|
||||
send_property_event(device, prop->propertyName, XIPropertyDeleted);
|
||||
XIDestroyDeviceProperty(prop);
|
||||
|
|
@ -652,8 +633,7 @@ XIDeleteAllDeviceProperties (DeviceIntPtr device)
|
|||
|
||||
/* Now free all handlers */
|
||||
curr_handler = device->properties.handlers;
|
||||
while(curr_handler)
|
||||
{
|
||||
while (curr_handler) {
|
||||
next_handler = curr_handler->next;
|
||||
free(curr_handler);
|
||||
curr_handler = next_handler;
|
||||
|
|
@ -662,14 +642,14 @@ XIDeleteAllDeviceProperties (DeviceIntPtr device)
|
|||
device->properties.handlers = NULL;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
XIDeleteDeviceProperty(DeviceIntPtr device, Atom property, Bool fromClient)
|
||||
{
|
||||
XIPropertyPtr prop, *prev;
|
||||
int rc = Success;
|
||||
|
||||
for (prev = &device->properties.properties; (prop = *prev); prev = &(prop->next))
|
||||
for (prev = &device->properties.properties; (prop = *prev);
|
||||
prev = &(prop->next))
|
||||
if (prop->propertyName == property)
|
||||
break;
|
||||
|
||||
|
|
@ -680,11 +660,10 @@ XIDeleteDeviceProperty (DeviceIntPtr device, Atom property, Bool fromClient)
|
|||
return BadAccess;
|
||||
|
||||
/* Ask handlers if we may delete the property */
|
||||
if (device->properties.handlers)
|
||||
{
|
||||
if (device->properties.handlers) {
|
||||
XIPropertyHandlerPtr handler = device->properties.handlers;
|
||||
while(handler)
|
||||
{
|
||||
|
||||
while (handler) {
|
||||
if (handler->DeleteProperty)
|
||||
rc = handler->DeleteProperty(device, prop->propertyName);
|
||||
if (rc != Success)
|
||||
|
|
@ -693,8 +672,7 @@ XIDeleteDeviceProperty (DeviceIntPtr device, Atom property, Bool fromClient)
|
|||
}
|
||||
}
|
||||
|
||||
if (prop)
|
||||
{
|
||||
if (prop) {
|
||||
*prev = prop->next;
|
||||
send_property_event(device, prop->propertyName, XIPropertyDeleted);
|
||||
XIDestroyDeviceProperty(prop);
|
||||
|
|
@ -721,8 +699,7 @@ XIChangeDeviceProperty (DeviceIntPtr dev, Atom property, Atom type,
|
|||
|
||||
/* first see if property already exists */
|
||||
prop = XIFetchDeviceProperty(dev, property);
|
||||
if (!prop) /* just add to list */
|
||||
{
|
||||
if (!prop) { /* just add to list */
|
||||
prop = XICreateDeviceProperty(property);
|
||||
if (!prop)
|
||||
return BadAlloc;
|
||||
|
|
@ -746,14 +723,12 @@ XIChangeDeviceProperty (DeviceIntPtr dev, Atom property, Atom type,
|
|||
else
|
||||
total_len = prop_value->size + len;
|
||||
|
||||
if (mode == PropModeReplace || len > 0)
|
||||
{
|
||||
if (mode == PropModeReplace || len > 0) {
|
||||
pointer new_data = NULL, old_data = NULL;
|
||||
|
||||
total_size = total_len * size_in_bytes;
|
||||
new_value.data = (pointer) malloc(total_size);
|
||||
if (!new_value.data && total_size)
|
||||
{
|
||||
if (!new_value.data && total_size) {
|
||||
if (add)
|
||||
XIDestroyDeviceProperty(prop);
|
||||
return BadAlloc;
|
||||
|
|
@ -784,24 +759,20 @@ XIChangeDeviceProperty (DeviceIntPtr dev, Atom property, Atom type,
|
|||
memcpy((char *) old_data, (char *) prop_value->data,
|
||||
prop_value->size * size_in_bytes);
|
||||
|
||||
if (dev->properties.handlers)
|
||||
{
|
||||
if (dev->properties.handlers) {
|
||||
XIPropertyHandlerPtr handler;
|
||||
BOOL checkonly = TRUE;
|
||||
|
||||
/* run through all handlers with checkonly TRUE, then again with
|
||||
* checkonly FALSE. Handlers MUST return error codes on the
|
||||
* checkonly run, errors on the second run are ignored */
|
||||
do
|
||||
{
|
||||
do {
|
||||
handler = dev->properties.handlers;
|
||||
while(handler)
|
||||
{
|
||||
if (handler->SetProperty)
|
||||
{
|
||||
while (handler) {
|
||||
if (handler->SetProperty) {
|
||||
rc = handler->SetProperty(dev, prop->propertyName,
|
||||
&new_value, checkonly);
|
||||
if (checkonly && rc != Success)
|
||||
{
|
||||
if (checkonly && rc != Success) {
|
||||
free(new_value.data);
|
||||
return rc;
|
||||
}
|
||||
|
|
@ -813,13 +784,12 @@ XIChangeDeviceProperty (DeviceIntPtr dev, Atom property, Atom type,
|
|||
}
|
||||
free(prop_value->data);
|
||||
*prop_value = new_value;
|
||||
} else if (len == 0)
|
||||
{
|
||||
}
|
||||
else if (len == 0) {
|
||||
/* do nothing */
|
||||
}
|
||||
|
||||
if (add)
|
||||
{
|
||||
if (add) {
|
||||
prop->next = dev->properties.properties;
|
||||
dev->properties.properties = prop;
|
||||
}
|
||||
|
|
@ -837,23 +807,19 @@ XIGetDeviceProperty (DeviceIntPtr dev, Atom property, XIPropertyValuePtr *value)
|
|||
XIPropertyPtr prop = XIFetchDeviceProperty(dev, property);
|
||||
int rc;
|
||||
|
||||
if (!prop)
|
||||
{
|
||||
if (!prop) {
|
||||
*value = NULL;
|
||||
return BadAtom;
|
||||
}
|
||||
|
||||
/* If we can, try to update the property value first */
|
||||
if (dev->properties.handlers)
|
||||
{
|
||||
if (dev->properties.handlers) {
|
||||
XIPropertyHandlerPtr handler = dev->properties.handlers;
|
||||
while(handler)
|
||||
{
|
||||
if (handler->GetProperty)
|
||||
{
|
||||
|
||||
while (handler) {
|
||||
if (handler->GetProperty) {
|
||||
rc = handler->GetProperty(dev, prop->propertyName);
|
||||
if (rc != Success)
|
||||
{
|
||||
if (rc != Success) {
|
||||
*value = NULL;
|
||||
return rc;
|
||||
}
|
||||
|
|
@ -905,8 +871,7 @@ ProcXListDeviceProperties (ClientPtr client)
|
|||
rep.nAtoms = natoms;
|
||||
|
||||
WriteReplyToClient(client, sizeof(xListDevicePropertiesReply), &rep);
|
||||
if (natoms)
|
||||
{
|
||||
if (natoms) {
|
||||
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
|
||||
WriteSwappedDataToClient(client, natoms * sizeof(Atom), atoms);
|
||||
free(atoms);
|
||||
|
|
@ -958,8 +923,7 @@ ProcXDeleteDeviceProperty (ClientPtr client)
|
|||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
if (!ValidAtom(stuff->property))
|
||||
{
|
||||
if (!ValidAtom(stuff->property)) {
|
||||
client->errorValue = stuff->property;
|
||||
return BadAtom;
|
||||
}
|
||||
|
|
@ -983,8 +947,7 @@ ProcXGetDeviceProperty (ClientPtr client)
|
|||
if (stuff->delete)
|
||||
UpdateCurrentTime();
|
||||
rc = dixLookupDevice(&dev, stuff->deviceid, client,
|
||||
stuff->delete ? DixSetPropAccess :
|
||||
DixGetPropAccess);
|
||||
stuff->delete ? DixSetPropAccess : DixGetPropAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
|
|
@ -1010,24 +973,28 @@ ProcXGetDeviceProperty (ClientPtr client)
|
|||
|
||||
WriteReplyToClient(client, sizeof(xGenericReply), &reply);
|
||||
|
||||
if (length)
|
||||
{
|
||||
if (length) {
|
||||
switch (reply.format) {
|
||||
case 32: client->pSwapReplyFunc = (ReplySwapPtr)CopySwap32Write; break;
|
||||
case 16: client->pSwapReplyFunc = (ReplySwapPtr)CopySwap16Write; break;
|
||||
default: client->pSwapReplyFunc = (ReplySwapPtr)WriteToClient; break;
|
||||
case 32:
|
||||
client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write;
|
||||
break;
|
||||
case 16:
|
||||
client->pSwapReplyFunc = (ReplySwapPtr) CopySwap16Write;
|
||||
break;
|
||||
default:
|
||||
client->pSwapReplyFunc = (ReplySwapPtr) WriteToClient;
|
||||
break;
|
||||
}
|
||||
WriteSwappedDataToClient(client, length, data);
|
||||
}
|
||||
|
||||
/* delete the Property */
|
||||
if (stuff->delete && (reply.bytesAfter == 0))
|
||||
{
|
||||
if (stuff->delete && (reply.bytesAfter == 0)) {
|
||||
XIPropertyPtr prop, *prev;
|
||||
for (prev = &dev->properties.properties; (prop = *prev); prev = &prop->next)
|
||||
{
|
||||
if (prop->propertyName == stuff->property)
|
||||
{
|
||||
|
||||
for (prev = &dev->properties.properties; (prop = *prev);
|
||||
prev = &prop->next) {
|
||||
if (prop->propertyName == stuff->property) {
|
||||
*prev = prop->next;
|
||||
XIDestroyDeviceProperty(prop);
|
||||
break;
|
||||
|
|
@ -1037,7 +1004,6 @@ ProcXGetDeviceProperty (ClientPtr client)
|
|||
return Success;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
SProcXListDeviceProperties(ClientPtr client)
|
||||
{
|
||||
|
|
@ -1087,7 +1053,6 @@ SProcXGetDeviceProperty (ClientPtr client)
|
|||
return (ProcXGetDeviceProperty(client));
|
||||
}
|
||||
|
||||
|
||||
/* Reply swapping */
|
||||
|
||||
void
|
||||
|
|
@ -1142,8 +1107,7 @@ ProcXIListProperties(ClientPtr client)
|
|||
rep.num_properties = natoms;
|
||||
|
||||
WriteReplyToClient(client, sizeof(xXIListPropertiesReply), &rep);
|
||||
if (natoms)
|
||||
{
|
||||
if (natoms) {
|
||||
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
|
||||
WriteSwappedDataToClient(client, natoms * sizeof(Atom), atoms);
|
||||
free(atoms);
|
||||
|
|
@ -1186,6 +1150,7 @@ ProcXIDeleteProperty(ClientPtr client)
|
|||
{
|
||||
DeviceIntPtr dev;
|
||||
int rc;
|
||||
|
||||
REQUEST(xXIDeletePropertyReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xXIDeletePropertyReq);
|
||||
|
|
@ -1194,8 +1159,7 @@ ProcXIDeleteProperty(ClientPtr client)
|
|||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
if (!ValidAtom(stuff->property))
|
||||
{
|
||||
if (!ValidAtom(stuff->property)) {
|
||||
client->errorValue = stuff->property;
|
||||
return BadAtom;
|
||||
}
|
||||
|
|
@ -1204,7 +1168,6 @@ ProcXIDeleteProperty(ClientPtr client)
|
|||
return rc;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ProcXIGetProperty(ClientPtr client)
|
||||
{
|
||||
|
|
@ -1220,8 +1183,7 @@ ProcXIGetProperty(ClientPtr client)
|
|||
if (stuff->delete)
|
||||
UpdateCurrentTime();
|
||||
rc = dixLookupDevice(&dev, stuff->deviceid, client,
|
||||
stuff->delete ? DixSetPropAccess :
|
||||
DixGetPropAccess);
|
||||
stuff->delete ? DixSetPropAccess : DixGetPropAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
|
|
@ -1246,24 +1208,28 @@ ProcXIGetProperty(ClientPtr client)
|
|||
|
||||
WriteReplyToClient(client, sizeof(xXIGetPropertyReply), &reply);
|
||||
|
||||
if (length)
|
||||
{
|
||||
if (length) {
|
||||
switch (reply.format) {
|
||||
case 32: client->pSwapReplyFunc = (ReplySwapPtr)CopySwap32Write; break;
|
||||
case 16: client->pSwapReplyFunc = (ReplySwapPtr)CopySwap16Write; break;
|
||||
default: client->pSwapReplyFunc = (ReplySwapPtr)WriteToClient; break;
|
||||
case 32:
|
||||
client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write;
|
||||
break;
|
||||
case 16:
|
||||
client->pSwapReplyFunc = (ReplySwapPtr) CopySwap16Write;
|
||||
break;
|
||||
default:
|
||||
client->pSwapReplyFunc = (ReplySwapPtr) WriteToClient;
|
||||
break;
|
||||
}
|
||||
WriteSwappedDataToClient(client, length, data);
|
||||
}
|
||||
|
||||
/* delete the Property */
|
||||
if (stuff->delete && (reply.bytes_after == 0))
|
||||
{
|
||||
if (stuff->delete && (reply.bytes_after == 0)) {
|
||||
XIPropertyPtr prop, *prev;
|
||||
for (prev = &dev->properties.properties; (prop = *prev); prev = &prop->next)
|
||||
{
|
||||
if (prop->propertyName == stuff->property)
|
||||
{
|
||||
|
||||
for (prev = &dev->properties.properties; (prop = *prev);
|
||||
prev = &prop->next) {
|
||||
if (prop->propertyName == stuff->property) {
|
||||
*prev = prop->next;
|
||||
XIDestroyDeviceProperty(prop);
|
||||
break;
|
||||
|
|
@ -1327,10 +1293,8 @@ SProcXIGetProperty(ClientPtr client)
|
|||
return (ProcXIGetProperty(client));
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SRepXIListProperties(ClientPtr client, int size,
|
||||
xXIListPropertiesReply *rep)
|
||||
SRepXIListProperties(ClientPtr client, int size, xXIListPropertiesReply * rep)
|
||||
{
|
||||
swaps(&rep->sequenceNumber);
|
||||
swapl(&rep->length);
|
||||
|
|
@ -1340,8 +1304,7 @@ SRepXIListProperties(ClientPtr client, int size,
|
|||
}
|
||||
|
||||
void
|
||||
SRepXIGetProperty(ClientPtr client, int size,
|
||||
xXIGetPropertyReply *rep)
|
||||
SRepXIGetProperty(ClientPtr client, int size, xXIGetPropertyReply * rep)
|
||||
{
|
||||
swaps(&rep->sequenceNumber);
|
||||
swapl(&rep->length);
|
||||
|
|
|
|||
|
|
@ -60,8 +60,7 @@ int SProcXIGetProperty (ClientPtr client);
|
|||
|
||||
void SRepXIListProperties(ClientPtr client, int size,
|
||||
xXIListPropertiesReply * rep);
|
||||
void SRepXIGetProperty(ClientPtr client, int size,
|
||||
xXIGetPropertyReply *rep);
|
||||
void SRepXIGetProperty(ClientPtr client, int size, xXIGetPropertyReply * rep);
|
||||
|
||||
void XIResetProperties(void);
|
||||
|
||||
|
|
|
|||
|
|
@ -74,31 +74,27 @@ ProcXIQueryDevice(ClientPtr client)
|
|||
REQUEST(xXIQueryDeviceReq);
|
||||
REQUEST_SIZE_MATCH(xXIQueryDeviceReq);
|
||||
|
||||
if (stuff->deviceid != XIAllDevices && stuff->deviceid != XIAllMasterDevices)
|
||||
{
|
||||
if (stuff->deviceid != XIAllDevices &&
|
||||
stuff->deviceid != XIAllMasterDevices) {
|
||||
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess);
|
||||
if (rc != Success)
|
||||
{
|
||||
if (rc != Success) {
|
||||
client->errorValue = stuff->deviceid;
|
||||
return rc;
|
||||
}
|
||||
len += SizeDeviceInfo(dev);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
skip = calloc(sizeof(Bool), inputInfo.numDevices);
|
||||
if (!skip)
|
||||
return BadAlloc;
|
||||
|
||||
for (dev = inputInfo.devices; dev; dev = dev->next, i++)
|
||||
{
|
||||
for (dev = inputInfo.devices; dev; dev = dev->next, i++) {
|
||||
skip[i] = ShouldSkipDevice(client, stuff->deviceid, dev);
|
||||
if (!skip[i])
|
||||
len += SizeDeviceInfo(dev);
|
||||
}
|
||||
|
||||
for (dev = inputInfo.off_devices; dev; dev = dev->next, i++)
|
||||
{
|
||||
for (dev = inputInfo.off_devices; dev; dev = dev->next, i++) {
|
||||
skip[i] = ShouldSkipDevice(client, stuff->deviceid, dev);
|
||||
if (!skip[i])
|
||||
len += SizeDeviceInfo(dev);
|
||||
|
|
@ -119,20 +115,17 @@ ProcXIQueryDevice(ClientPtr client)
|
|||
rep.num_devices = 0;
|
||||
|
||||
ptr = info;
|
||||
if (dev)
|
||||
{
|
||||
if (dev) {
|
||||
len = ListDeviceInfo(client, dev, (xXIDeviceInfo *) info);
|
||||
if (client->swapped)
|
||||
SwapDeviceInfo(dev, (xXIDeviceInfo *) info);
|
||||
info += len;
|
||||
rep.num_devices = 1;
|
||||
} else
|
||||
{
|
||||
}
|
||||
else {
|
||||
i = 0;
|
||||
for (dev = inputInfo.devices; dev; dev = dev->next, i++)
|
||||
{
|
||||
if (!skip[i])
|
||||
{
|
||||
for (dev = inputInfo.devices; dev; dev = dev->next, i++) {
|
||||
if (!skip[i]) {
|
||||
len = ListDeviceInfo(client, dev, (xXIDeviceInfo *) info);
|
||||
if (client->swapped)
|
||||
SwapDeviceInfo(dev, (xXIDeviceInfo *) info);
|
||||
|
|
@ -141,10 +134,8 @@ ProcXIQueryDevice(ClientPtr client)
|
|||
}
|
||||
}
|
||||
|
||||
for (dev = inputInfo.off_devices; dev; dev = dev->next, i++)
|
||||
{
|
||||
if (!skip[i])
|
||||
{
|
||||
for (dev = inputInfo.off_devices; dev; dev = dev->next, i++) {
|
||||
if (!skip[i]) {
|
||||
len = ListDeviceInfo(client, dev, (xXIDeviceInfo *) info);
|
||||
if (client->swapped)
|
||||
SwapDeviceInfo(dev, (xXIDeviceInfo *) info);
|
||||
|
|
@ -174,7 +165,6 @@ SRepXIQueryDevice(ClientPtr client, int size, xXIQueryDeviceReply *rep)
|
|||
WriteToClient(client, size, (char *) rep);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return Whether the device should be included in the returned list.
|
||||
*/
|
||||
|
|
@ -182,9 +172,9 @@ static Bool
|
|||
ShouldSkipDevice(ClientPtr client, int deviceid, DeviceIntPtr dev)
|
||||
{
|
||||
/* if all devices are not being queried, only master devices are */
|
||||
if (deviceid == XIAllDevices || IsMaster(dev))
|
||||
{
|
||||
if (deviceid == XIAllDevices || IsMaster(dev)) {
|
||||
int rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixGetAttrAccess);
|
||||
|
||||
if (rc == Success)
|
||||
return FALSE;
|
||||
}
|
||||
|
|
@ -215,23 +205,22 @@ SizeDeviceClasses(DeviceIntPtr dev)
|
|||
{
|
||||
int len = 0;
|
||||
|
||||
if (dev->button)
|
||||
{
|
||||
if (dev->button) {
|
||||
len += sizeof(xXIButtonInfo);
|
||||
len += dev->button->numButtons * sizeof(Atom);
|
||||
len += pad_to_int32(bits_to_bytes(dev->button->numButtons));
|
||||
}
|
||||
|
||||
if (dev->key)
|
||||
{
|
||||
if (dev->key) {
|
||||
XkbDescPtr xkb = dev->key->xkbInfo->desc;
|
||||
|
||||
len += sizeof(xXIKeyInfo);
|
||||
len += (xkb->max_key_code - xkb->min_key_code + 1) * sizeof(uint32_t);
|
||||
}
|
||||
|
||||
if (dev->valuator)
|
||||
{
|
||||
if (dev->valuator) {
|
||||
int i;
|
||||
|
||||
len += (sizeof(xXIValuatorInfo)) * dev->valuator->numAxes;
|
||||
|
||||
for (i = 0; i < dev->valuator->numAxes; i++) {
|
||||
|
|
@ -246,7 +235,6 @@ SizeDeviceClasses(DeviceIntPtr dev)
|
|||
return len;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Write button information into info.
|
||||
* @return Number of bytes written into info.
|
||||
|
|
@ -288,6 +276,7 @@ SwapButtonInfo(DeviceIntPtr dev, xXIButtonInfo* info)
|
|||
{
|
||||
Atom *btn;
|
||||
int i;
|
||||
|
||||
swaps(&info->type);
|
||||
swaps(&info->length);
|
||||
swaps(&info->sourceid);
|
||||
|
|
@ -326,11 +315,13 @@ SwapKeyInfo(DeviceIntPtr dev, xXIKeyInfo* info)
|
|||
{
|
||||
uint32_t *key;
|
||||
int i;
|
||||
|
||||
swaps(&info->type);
|
||||
swaps(&info->length);
|
||||
swaps(&info->sourceid);
|
||||
|
||||
for (i = 0, key = (uint32_t*)&info[1]; i < info->num_keycodes; i++, key++)
|
||||
for (i = 0, key = (uint32_t *) & info[1]; i < info->num_keycodes;
|
||||
i++, key++)
|
||||
swapl(key);
|
||||
|
||||
swaps(&info->num_keycodes);
|
||||
|
|
@ -392,8 +383,7 @@ ListScrollInfo(DeviceIntPtr dev, xXIScrollInfo *info, int axisnumber)
|
|||
info->type = XIScrollClass;
|
||||
info->length = sizeof(xXIScrollInfo) / 4;
|
||||
info->number = axisnumber;
|
||||
switch(axis->scroll.type)
|
||||
{
|
||||
switch (axis->scroll.type) {
|
||||
case SCROLL_TYPE_VERTICAL:
|
||||
info->scroll_type = XIScrollTypeVertical;
|
||||
break;
|
||||
|
|
@ -401,7 +391,8 @@ ListScrollInfo(DeviceIntPtr dev, xXIScrollInfo *info, int axisnumber)
|
|||
info->scroll_type = XIScrollTypeHorizontal;
|
||||
break;
|
||||
default:
|
||||
ErrorF("[Xi] Unknown scroll type %d. This is a bug.\n", axis->scroll.type);
|
||||
ErrorF("[Xi] Unknown scroll type %d. This is a bug.\n",
|
||||
axis->scroll.type);
|
||||
break;
|
||||
}
|
||||
info->increment = double_to_fp3232(axis->scroll.increment);
|
||||
|
|
@ -454,21 +445,23 @@ SwapTouchInfo(DeviceIntPtr dev, xXITouchInfo* touch)
|
|||
swaps(&touch->sourceid);
|
||||
}
|
||||
|
||||
int GetDeviceUse(DeviceIntPtr dev, uint16_t *attachment)
|
||||
int
|
||||
GetDeviceUse(DeviceIntPtr dev, uint16_t * attachment)
|
||||
{
|
||||
DeviceIntPtr master = GetMaster(dev, MASTER_ATTACHED);
|
||||
int use;
|
||||
|
||||
if (IsMaster(dev))
|
||||
{
|
||||
if (IsMaster(dev)) {
|
||||
DeviceIntPtr paired = GetPairedDevice(dev);
|
||||
|
||||
use = IsPointerDevice(dev) ? XIMasterPointer : XIMasterKeyboard;
|
||||
*attachment = (paired ? paired->id : 0);
|
||||
} else if (!IsFloating(dev))
|
||||
{
|
||||
}
|
||||
else if (!IsFloating(dev)) {
|
||||
use = IsPointerDevice(master) ? XISlavePointer : XISlaveKeyboard;
|
||||
*attachment = master->id;
|
||||
} else
|
||||
}
|
||||
else
|
||||
use = XIFloatingSlave;
|
||||
|
||||
return use;
|
||||
|
|
@ -519,32 +512,28 @@ ListDeviceClasses(ClientPtr client, DeviceIntPtr dev,
|
|||
/* Check if the current device state should be suppressed */
|
||||
rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixReadAccess);
|
||||
|
||||
if (dev->button)
|
||||
{
|
||||
if (dev->button) {
|
||||
(*nclasses)++;
|
||||
len = ListButtonInfo(dev, (xXIButtonInfo *) any, rc == Success);
|
||||
any += len;
|
||||
total_len += len;
|
||||
}
|
||||
|
||||
if (dev->key)
|
||||
{
|
||||
if (dev->key) {
|
||||
(*nclasses)++;
|
||||
len = ListKeyInfo(dev, (xXIKeyInfo *) any);
|
||||
any += len;
|
||||
total_len += len;
|
||||
}
|
||||
|
||||
for (i = 0; dev->valuator && i < dev->valuator->numAxes; i++)
|
||||
{
|
||||
for (i = 0; dev->valuator && i < dev->valuator->numAxes; i++) {
|
||||
(*nclasses)++;
|
||||
len = ListValuatorInfo(dev, (xXIValuatorInfo *) any, i, rc == Success);
|
||||
any += len;
|
||||
total_len += len;
|
||||
}
|
||||
|
||||
for (i = 0; dev->valuator && i < dev->valuator->numAxes; i++)
|
||||
{
|
||||
for (i = 0; dev->valuator && i < dev->valuator->numAxes; i++) {
|
||||
len = ListScrollInfo(dev, (xXIScrollInfo *) any, i);
|
||||
if (len)
|
||||
(*nclasses)++;
|
||||
|
|
@ -552,8 +541,7 @@ ListDeviceClasses(ClientPtr client, DeviceIntPtr dev,
|
|||
total_len += len;
|
||||
}
|
||||
|
||||
if (dev->touch)
|
||||
{
|
||||
if (dev->touch) {
|
||||
(*nclasses)++;
|
||||
len = ListTouchInfo(dev, (xXITouchInfo *) any);
|
||||
any += len;
|
||||
|
|
@ -572,11 +560,10 @@ SwapDeviceInfo(DeviceIntPtr dev, xXIDeviceInfo* info)
|
|||
/* Skip over name */
|
||||
any += pad_to_int32(info->name_len);
|
||||
|
||||
for (i = 0; i < info->num_classes; i++)
|
||||
{
|
||||
for (i = 0; i < info->num_classes; i++) {
|
||||
int len = ((xXIAnyInfo *) any)->length;
|
||||
switch(((xXIAnyInfo*)any)->type)
|
||||
{
|
||||
|
||||
switch (((xXIAnyInfo *) any)->type) {
|
||||
case XIButtonClass:
|
||||
SwapButtonInfo(dev, (xXIButtonInfo *) any);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -84,24 +84,19 @@ ProcXIQueryPointer(ClientPtr client)
|
|||
REQUEST_SIZE_MATCH(xXIQueryPointerReq);
|
||||
|
||||
rc = dixLookupDevice(&pDev, stuff->deviceid, client, DixReadAccess);
|
||||
if (rc != Success)
|
||||
{
|
||||
if (rc != Success) {
|
||||
client->errorValue = stuff->deviceid;
|
||||
return rc;
|
||||
}
|
||||
|
||||
if (pDev->valuator == NULL || IsKeyboardDevice(pDev) ||
|
||||
(!IsMaster(pDev) && !IsFloating(pDev))) /* no attached devices */
|
||||
{
|
||||
if (pDev->valuator == NULL || IsKeyboardDevice(pDev) || (!IsMaster(pDev) && !IsFloating(pDev))) { /* no attached devices */
|
||||
client->errorValue = stuff->deviceid;
|
||||
return BadDevice;
|
||||
}
|
||||
|
||||
rc = dixLookupWindow(&pWin, stuff->win, client, DixGetAttrAccess);
|
||||
if (rc != Success)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_XIQueryPointer,
|
||||
stuff->win, rc);
|
||||
if (rc != Success) {
|
||||
SendErrorToClient(client, IReqCode, X_XIQueryPointer, stuff->win, rc);
|
||||
return Success;
|
||||
}
|
||||
|
||||
|
|
@ -125,8 +120,7 @@ ProcXIQueryPointer(ClientPtr client)
|
|||
rep.root_y = FP1616(pSprite->hot.y, 0);
|
||||
rep.child = None;
|
||||
|
||||
if (kbd)
|
||||
{
|
||||
if (kbd) {
|
||||
state = &kbd->key->xkbInfo->state;
|
||||
rep.mods.base_mods = state->base_mods;
|
||||
rep.mods.latched_mods = state->latched_mods;
|
||||
|
|
@ -137,10 +131,11 @@ ProcXIQueryPointer(ClientPtr client)
|
|||
rep.group.locked_group = state->locked_group;
|
||||
}
|
||||
|
||||
if (pDev->button)
|
||||
{
|
||||
if (pDev->button) {
|
||||
int i, down;
|
||||
rep.buttons_len = bytes_to_int32(bits_to_bytes(pDev->button->numButtons));
|
||||
|
||||
rep.buttons_len =
|
||||
bytes_to_int32(bits_to_bytes(pDev->button->numButtons));
|
||||
rep.length += rep.buttons_len;
|
||||
buttons_size = rep.buttons_len * 4;
|
||||
buttons = calloc(1, buttons_size);
|
||||
|
|
@ -149,30 +144,27 @@ ProcXIQueryPointer(ClientPtr client)
|
|||
|
||||
down = pDev->button->buttonsDown;
|
||||
|
||||
for (i = 0; i < pDev->button->numButtons && down; i++)
|
||||
{
|
||||
if (BitIsOn(pDev->button->down, i))
|
||||
{
|
||||
for (i = 0; i < pDev->button->numButtons && down; i++) {
|
||||
if (BitIsOn(pDev->button->down, i)) {
|
||||
SetBit(buttons, i);
|
||||
down--;
|
||||
}
|
||||
}
|
||||
} else
|
||||
}
|
||||
else
|
||||
rep.buttons_len = 0;
|
||||
|
||||
if (pSprite->hot.pScreen == pWin->drawable.pScreen)
|
||||
{
|
||||
if (pSprite->hot.pScreen == pWin->drawable.pScreen) {
|
||||
rep.same_screen = xTrue;
|
||||
rep.win_x = FP1616(pSprite->hot.x - pWin->drawable.x, 0);
|
||||
rep.win_y = FP1616(pSprite->hot.y - pWin->drawable.y, 0);
|
||||
for (t = pSprite->win; t; t = t->parent)
|
||||
if (t->parent == pWin)
|
||||
{
|
||||
if (t->parent == pWin) {
|
||||
rep.child = t->drawable.id;
|
||||
break;
|
||||
}
|
||||
} else
|
||||
{
|
||||
}
|
||||
else {
|
||||
rep.same_screen = xFalse;
|
||||
rep.win_x = 0;
|
||||
rep.win_y = 0;
|
||||
|
|
@ -182,8 +174,7 @@ ProcXIQueryPointer(ClientPtr client)
|
|||
if (!noPanoramiXExtension) {
|
||||
rep.root_x += FP1616(screenInfo.screens[0]->x, 0);
|
||||
rep.root_y += FP1616(screenInfo.screens[0]->y, 0);
|
||||
if (stuff->win == rep.root)
|
||||
{
|
||||
if (stuff->win == rep.root) {
|
||||
rep.win_x += FP1616(screenInfo.screens[0]->x, 0);
|
||||
rep.win_y += FP1616(screenInfo.screens[0]->y, 0);
|
||||
}
|
||||
|
|
@ -207,8 +198,7 @@ ProcXIQueryPointer(ClientPtr client)
|
|||
*/
|
||||
|
||||
void
|
||||
SRepXIQueryPointer(ClientPtr client, int size,
|
||||
xXIQueryPointerReply * rep)
|
||||
SRepXIQueryPointer(ClientPtr client, int size, xXIQueryPointerReply * rep)
|
||||
{
|
||||
swaps(&rep->sequenceNumber);
|
||||
swapl(&rep->length);
|
||||
|
|
@ -222,4 +212,3 @@ SRepXIQueryPointer(ClientPtr client, int size,
|
|||
|
||||
WriteToClient(client, size, (char *) rep);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@
|
|||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include "inputstr.h"
|
||||
|
||||
#include <X11/Xmd.h>
|
||||
|
|
@ -46,6 +45,7 @@
|
|||
#include "misc.h"
|
||||
|
||||
extern XExtensionVersion XIVersion; /* defined in getvers.c */
|
||||
|
||||
/**
|
||||
* Return the supported XI version.
|
||||
*
|
||||
|
|
@ -63,8 +63,7 @@ ProcXIQueryVersion(ClientPtr client)
|
|||
REQUEST_SIZE_MATCH(xXIQueryVersionReq);
|
||||
|
||||
/* This request only exists after XI2 */
|
||||
if (stuff->major_version < 2)
|
||||
{
|
||||
if (stuff->major_version < 2) {
|
||||
client->errorValue = stuff->major_version;
|
||||
return BadValue;
|
||||
}
|
||||
|
|
@ -72,12 +71,11 @@ ProcXIQueryVersion(ClientPtr client)
|
|||
pXIClient = dixLookupPrivate(&client->devPrivates, XIClientPrivateKey);
|
||||
|
||||
if (version_compare(XIVersion.major_version, XIVersion.minor_version,
|
||||
stuff->major_version, stuff->minor_version) > 0)
|
||||
{
|
||||
stuff->major_version, stuff->minor_version) > 0) {
|
||||
major = stuff->major_version;
|
||||
minor = stuff->minor_version;
|
||||
} else
|
||||
{
|
||||
}
|
||||
else {
|
||||
major = XIVersion.major_version;
|
||||
minor = XIVersion.minor_version;
|
||||
}
|
||||
|
|
|
|||
102
Xi/xiselectev.c
102
Xi/xiselectev.c
|
|
@ -27,7 +27,6 @@
|
|||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include "dixstruct.h"
|
||||
#include "windowstr.h"
|
||||
#include "exglobals.h"
|
||||
|
|
@ -43,15 +42,14 @@
|
|||
*
|
||||
* @return BadValue if at least one invalid bit is set or Success otherwise.
|
||||
*/
|
||||
int XICheckInvalidMaskBits(ClientPtr client, unsigned char *mask, int len)
|
||||
{
|
||||
if (len >= XIMaskLen(XI2LASTEVENT))
|
||||
int
|
||||
XICheckInvalidMaskBits(ClientPtr client, unsigned char *mask, int len)
|
||||
{
|
||||
if (len >= XIMaskLen(XI2LASTEVENT)) {
|
||||
int i;
|
||||
for (i = XI2LASTEVENT + 1; i < len * 8; i++)
|
||||
{
|
||||
if (BitIsOn(mask, i))
|
||||
{
|
||||
|
||||
for (i = XI2LASTEVENT + 1; i < len * 8; i++) {
|
||||
if (BitIsOn(mask, i)) {
|
||||
client->errorValue = i;
|
||||
return BadValue;
|
||||
}
|
||||
|
|
@ -74,11 +72,11 @@ SProcXISelectEvents(ClientPtr client)
|
|||
swaps(&stuff->num_masks);
|
||||
|
||||
evmask = (xXIEventMask *) & stuff[1];
|
||||
for (i = 0; i < stuff->num_masks; i++)
|
||||
{
|
||||
for (i = 0; i < stuff->num_masks; i++) {
|
||||
swaps(&evmask->deviceid);
|
||||
swaps(&evmask->mask_len);
|
||||
evmask = (xXIEventMask*)(((char*)&evmask[1]) + evmask->mask_len * 4);
|
||||
evmask =
|
||||
(xXIEventMask *) (((char *) &evmask[1]) + evmask->mask_len * 4);
|
||||
}
|
||||
|
||||
return (ProcXISelectEvents(client));
|
||||
|
|
@ -110,8 +108,7 @@ ProcXISelectEvents(ClientPtr client)
|
|||
/* check request validity */
|
||||
evmask = (xXIEventMask *) & stuff[1];
|
||||
num_masks = stuff->num_masks;
|
||||
while(num_masks--)
|
||||
{
|
||||
while (num_masks--) {
|
||||
len += sizeof(xXIEventMask) + evmask->mask_len * 4;
|
||||
|
||||
if (bytes_to_int32(len) > stuff->length)
|
||||
|
|
@ -127,20 +124,19 @@ ProcXISelectEvents(ClientPtr client)
|
|||
return rc;
|
||||
|
||||
/* hierarchy event mask is not allowed on devices */
|
||||
if (evmask->deviceid != XIAllDevices && evmask->mask_len >= 1)
|
||||
{
|
||||
if (evmask->deviceid != XIAllDevices && evmask->mask_len >= 1) {
|
||||
unsigned char *bits = (unsigned char *) &evmask[1];
|
||||
if (BitIsOn(bits, XI_HierarchyChanged))
|
||||
{
|
||||
|
||||
if (BitIsOn(bits, XI_HierarchyChanged)) {
|
||||
client->errorValue = XI_HierarchyChanged;
|
||||
return BadValue;
|
||||
}
|
||||
}
|
||||
|
||||
/* Raw events may only be selected on root windows */
|
||||
if (win->parent && evmask->mask_len >= 1)
|
||||
{
|
||||
if (win->parent && evmask->mask_len >= 1) {
|
||||
unsigned char *bits = (unsigned char *) &evmask[1];
|
||||
|
||||
if (BitIsOn(bits, XI_RawKeyPress) ||
|
||||
BitIsOn(bits, XI_RawKeyRelease) ||
|
||||
BitIsOn(bits, XI_RawButtonPress) ||
|
||||
|
|
@ -148,15 +144,13 @@ ProcXISelectEvents(ClientPtr client)
|
|||
BitIsOn(bits, XI_RawMotion) ||
|
||||
BitIsOn(bits, XI_RawTouchBegin) ||
|
||||
BitIsOn(bits, XI_RawTouchUpdate) ||
|
||||
BitIsOn(bits, XI_RawTouchEnd))
|
||||
{
|
||||
BitIsOn(bits, XI_RawTouchEnd)) {
|
||||
client->errorValue = XI_RawKeyPress;
|
||||
return BadValue;
|
||||
}
|
||||
}
|
||||
|
||||
if (evmask->mask_len >= 1)
|
||||
{
|
||||
if (evmask->mask_len >= 1) {
|
||||
unsigned char *bits = (unsigned char *) &evmask[1];
|
||||
|
||||
/* All three touch events must be selected at once */
|
||||
|
|
@ -166,8 +160,7 @@ ProcXISelectEvents(ClientPtr client)
|
|||
BitIsOn(bits, XI_TouchEnd)) &&
|
||||
(!BitIsOn(bits, XI_TouchBegin) ||
|
||||
!BitIsOn(bits, XI_TouchUpdate) ||
|
||||
!BitIsOn(bits, XI_TouchEnd)))
|
||||
{
|
||||
!BitIsOn(bits, XI_TouchEnd))) {
|
||||
client->errorValue = XI_TouchBegin;
|
||||
return BadValue;
|
||||
}
|
||||
|
|
@ -175,20 +168,20 @@ ProcXISelectEvents(ClientPtr client)
|
|||
/* Only one client per window may select for touch events on the
|
||||
* same devices, including master devices.
|
||||
* XXX: This breaks if a device goes from floating to attached. */
|
||||
if (BitIsOn(bits, XI_TouchBegin))
|
||||
{
|
||||
if (BitIsOn(bits, XI_TouchBegin)) {
|
||||
OtherInputMasks *inputMasks = wOtherInputMasks(win);
|
||||
InputClients *iclient = NULL;
|
||||
|
||||
if (inputMasks)
|
||||
iclient = inputMasks->inputClients;
|
||||
for (; iclient; iclient = iclient->next)
|
||||
{
|
||||
for (; iclient; iclient = iclient->next) {
|
||||
DeviceIntPtr dummy;
|
||||
|
||||
if (CLIENT_ID(iclient->resource) == client->index)
|
||||
continue;
|
||||
|
||||
dixLookupDevice(&dummy, evmask->deviceid, serverClient, DixReadAccess);
|
||||
dixLookupDevice(&dummy, evmask->deviceid, serverClient,
|
||||
DixReadAccess);
|
||||
if (!dummy)
|
||||
return BadImplementation; /* this shouldn't happen */
|
||||
|
||||
|
|
@ -202,7 +195,9 @@ ProcXISelectEvents(ClientPtr client)
|
|||
evmask->mask_len * 4) != Success)
|
||||
return BadValue;
|
||||
|
||||
evmask = (xXIEventMask*)(((unsigned char*)evmask) + evmask->mask_len * 4);
|
||||
evmask =
|
||||
(xXIEventMask *) (((unsigned char *) evmask) +
|
||||
evmask->mask_len * 4);
|
||||
evmask++;
|
||||
}
|
||||
|
||||
|
|
@ -212,19 +207,20 @@ ProcXISelectEvents(ClientPtr client)
|
|||
/* Set masks on window */
|
||||
evmask = (xXIEventMask *) & stuff[1];
|
||||
num_masks = stuff->num_masks;
|
||||
while(num_masks--)
|
||||
{
|
||||
while (num_masks--) {
|
||||
if (evmask->deviceid == XIAllDevices ||
|
||||
evmask->deviceid == XIAllMasterDevices)
|
||||
{
|
||||
evmask->deviceid == XIAllMasterDevices) {
|
||||
dummy.id = evmask->deviceid;
|
||||
dev = &dummy;
|
||||
} else
|
||||
}
|
||||
else
|
||||
dixLookupDevice(&dev, evmask->deviceid, client, DixUseAccess);
|
||||
if (XISetEventMask(dev, win, client, evmask->mask_len * 4,
|
||||
(unsigned char *) &evmask[1]) != Success)
|
||||
return BadAlloc;
|
||||
evmask = (xXIEventMask*)(((unsigned char*)evmask) + evmask->mask_len * 4);
|
||||
evmask =
|
||||
(xXIEventMask *) (((unsigned char *) evmask) +
|
||||
evmask->mask_len * 4);
|
||||
evmask++;
|
||||
}
|
||||
|
||||
|
|
@ -234,7 +230,6 @@ ProcXISelectEvents(ClientPtr client)
|
|||
return Success;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
SProcXIGetSelectedEvents(ClientPtr client)
|
||||
{
|
||||
|
|
@ -272,8 +267,7 @@ ProcXIGetSelectedEvents(ClientPtr client)
|
|||
reply.num_masks = 0;
|
||||
|
||||
masks = wOtherInputMasks(win);
|
||||
if (masks)
|
||||
{
|
||||
if (masks) {
|
||||
for (others = wOtherInputMasks(win)->inputClients; others;
|
||||
others = others->next) {
|
||||
if (SameClient(others, client)) {
|
||||
|
|
@ -282,42 +276,37 @@ ProcXIGetSelectedEvents(ClientPtr client)
|
|||
}
|
||||
}
|
||||
|
||||
if (!others)
|
||||
{
|
||||
if (!others) {
|
||||
WriteReplyToClient(client, sizeof(xXIGetSelectedEventsReply), &reply);
|
||||
return Success;
|
||||
}
|
||||
|
||||
buffer = calloc(MAXDEVICES, sizeof(xXIEventMask) + pad_to_int32(XI2MASKSIZE));
|
||||
buffer =
|
||||
calloc(MAXDEVICES, sizeof(xXIEventMask) + pad_to_int32(XI2MASKSIZE));
|
||||
if (!buffer)
|
||||
return BadAlloc;
|
||||
|
||||
evmask = (xXIEventMask *) buffer;
|
||||
for (i = 0; i < MAXDEVICES; i++)
|
||||
{
|
||||
for (i = 0; i < MAXDEVICES; i++) {
|
||||
int j;
|
||||
const unsigned char *devmask = xi2mask_get_one_mask(others->xi2mask, i);
|
||||
|
||||
if (i > 2)
|
||||
{
|
||||
if (i > 2) {
|
||||
rc = dixLookupDevice(&dev, i, client, DixGetAttrAccess);
|
||||
if (rc != Success)
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
for (j = xi2mask_mask_size(others->xi2mask) - 1; j >= 0; j--)
|
||||
{
|
||||
if (devmask[j] != 0)
|
||||
{
|
||||
for (j = xi2mask_mask_size(others->xi2mask) - 1; j >= 0; j--) {
|
||||
if (devmask[j] != 0) {
|
||||
int mask_len = (j + 4) / 4; /* j is an index, hence + 4, not + 3 */
|
||||
|
||||
evmask->deviceid = i;
|
||||
evmask->mask_len = mask_len;
|
||||
reply.num_masks++;
|
||||
reply.length += sizeof(xXIEventMask) / 4 + evmask->mask_len;
|
||||
|
||||
if (client->swapped)
|
||||
{
|
||||
if (client->swapped) {
|
||||
swaps(&evmask->deviceid);
|
||||
swaps(&evmask->mask_len);
|
||||
}
|
||||
|
|
@ -339,7 +328,8 @@ ProcXIGetSelectedEvents(ClientPtr client)
|
|||
return Success;
|
||||
}
|
||||
|
||||
void SRepXIGetSelectedEvents(ClientPtr client,
|
||||
void
|
||||
SRepXIGetSelectedEvents(ClientPtr client,
|
||||
int len, xXIGetSelectedEventsReply * rep)
|
||||
{
|
||||
swaps(&rep->sequenceNumber);
|
||||
|
|
@ -347,5 +337,3 @@ void SRepXIGetSelectedEvents(ClientPtr client,
|
|||
swaps(&rep->num_masks);
|
||||
WriteToClient(client, len, (char *) rep);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@
|
|||
* default value.
|
||||
*/
|
||||
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
|
@ -69,36 +68,32 @@ ProcXISetClientPointer(ClientPtr client)
|
|||
REQUEST(xXISetClientPointerReq);
|
||||
REQUEST_SIZE_MATCH(xXISetClientPointerReq);
|
||||
|
||||
|
||||
rc = dixLookupDevice(&pDev, stuff->deviceid, client, DixManageAccess);
|
||||
if (rc != Success)
|
||||
{
|
||||
if (rc != Success) {
|
||||
client->errorValue = stuff->deviceid;
|
||||
return rc;
|
||||
}
|
||||
|
||||
if (!IsMaster(pDev))
|
||||
{
|
||||
if (!IsMaster(pDev)) {
|
||||
client->errorValue = stuff->deviceid;
|
||||
return BadDevice;
|
||||
}
|
||||
|
||||
pDev = GetMaster(pDev, MASTER_POINTER);
|
||||
|
||||
if (stuff->win != None)
|
||||
{
|
||||
if (stuff->win != None) {
|
||||
rc = dixLookupClient(&targetClient, stuff->win, client,
|
||||
DixManageAccess);
|
||||
|
||||
if (rc != Success)
|
||||
return BadWindow;
|
||||
|
||||
} else
|
||||
}
|
||||
else
|
||||
targetClient = client;
|
||||
|
||||
rc = SetClientPointer(targetClient, pDev);
|
||||
if (rc != Success)
|
||||
{
|
||||
if (rc != Success) {
|
||||
client->errorValue = stuff->deviceid;
|
||||
return rc;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,6 @@
|
|||
#include "exglobals.h"
|
||||
#include "mipointer.h" /* for miPointerUpdateSprite */
|
||||
|
||||
|
||||
#include "xiwarppointer.h"
|
||||
/***********************************************************************
|
||||
*
|
||||
|
|
@ -89,24 +88,20 @@ ProcXIWarpPointer(ClientPtr client)
|
|||
|
||||
rc = dixLookupDevice(&pDev, stuff->deviceid, client, DixWriteAccess);
|
||||
|
||||
if (rc != Success)
|
||||
{
|
||||
if (rc != Success) {
|
||||
client->errorValue = stuff->deviceid;
|
||||
return rc;
|
||||
}
|
||||
|
||||
if ((!IsMaster(pDev) && !IsFloating(pDev)) ||
|
||||
(IsMaster(pDev) && !IsPointerDevice(pDev)))
|
||||
{
|
||||
(IsMaster(pDev) && !IsPointerDevice(pDev))) {
|
||||
client->errorValue = stuff->deviceid;
|
||||
return BadDevice;
|
||||
}
|
||||
|
||||
if (stuff->dst_win != None)
|
||||
{
|
||||
if (stuff->dst_win != None) {
|
||||
rc = dixLookupWindow(&dest, stuff->dst_win, client, DixGetAttrAccess);
|
||||
if (rc != Success)
|
||||
{
|
||||
if (rc != Success) {
|
||||
client->errorValue = stuff->dst_win;
|
||||
return rc;
|
||||
}
|
||||
|
|
@ -121,14 +116,12 @@ ProcXIWarpPointer(ClientPtr client)
|
|||
dst_x = stuff->dst_x / (double) (1 << 16);
|
||||
dst_y = stuff->dst_y / (double) (1 << 16);
|
||||
|
||||
if (stuff->src_win != None)
|
||||
{
|
||||
if (stuff->src_win != None) {
|
||||
int winX, winY;
|
||||
WindowPtr src;
|
||||
|
||||
rc = dixLookupWindow(&src, stuff->src_win, client, DixGetAttrAccess);
|
||||
if (rc != Success)
|
||||
{
|
||||
if (rc != Success) {
|
||||
client->errorValue = stuff->src_win;
|
||||
return rc;
|
||||
}
|
||||
|
|
@ -146,12 +139,12 @@ ProcXIWarpPointer(ClientPtr client)
|
|||
return Success;
|
||||
}
|
||||
|
||||
if (dest)
|
||||
{
|
||||
if (dest) {
|
||||
x = dest->drawable.x;
|
||||
y = dest->drawable.y;
|
||||
newScreen = dest->drawable.pScreen;
|
||||
} else
|
||||
}
|
||||
else
|
||||
newScreen = pSprite->hotPhys.pScreen;
|
||||
|
||||
x += dst_x;
|
||||
|
|
@ -167,8 +160,7 @@ ProcXIWarpPointer(ClientPtr client)
|
|||
else if (y > newScreen->height)
|
||||
y = newScreen->height - 1;
|
||||
|
||||
if (newScreen == pSprite->hotPhys.pScreen)
|
||||
{
|
||||
if (newScreen == pSprite->hotPhys.pScreen) {
|
||||
if (x < pSprite->physLimits.x1)
|
||||
x = pSprite->physLimits.x1;
|
||||
else if (x >= pSprite->physLimits.x2)
|
||||
|
|
@ -182,8 +174,8 @@ ProcXIWarpPointer(ClientPtr client)
|
|||
if (pSprite->hotShape)
|
||||
ConfineToShape(pDev, pSprite->hotShape, &x, &y);
|
||||
(*newScreen->SetCursorPosition) (pDev, newScreen, x, y, TRUE);
|
||||
} else if (!PointerConfinedToScreen(pDev))
|
||||
{
|
||||
}
|
||||
else if (!PointerConfinedToScreen(pDev)) {
|
||||
NewCurrentScreen(pDev, newScreen, x, y);
|
||||
}
|
||||
|
||||
|
|
@ -196,4 +188,3 @@ ProcXIWarpPointer(ClientPtr client)
|
|||
here though. */
|
||||
return Success;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -55,10 +55,7 @@ compScreenUpdate (ScreenPtr pScreen)
|
|||
}
|
||||
|
||||
static void
|
||||
compBlockHandler (int i,
|
||||
pointer blockData,
|
||||
pointer pTimeout,
|
||||
pointer pReadmask)
|
||||
compBlockHandler(int i, pointer blockData, pointer pTimeout, pointer pReadmask)
|
||||
{
|
||||
ScreenPtr pScreen = screenInfo.screens[i];
|
||||
CompScreenPtr cs = GetCompScreen(pScreen);
|
||||
|
|
@ -105,8 +102,7 @@ compDestroyDamage (DamagePtr pDamage, void *closure)
|
|||
}
|
||||
|
||||
static Bool
|
||||
compMarkWindows(WindowPtr pWin,
|
||||
WindowPtr *ppLayerWin)
|
||||
compMarkWindows(WindowPtr pWin, WindowPtr *ppLayerWin)
|
||||
{
|
||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||
WindowPtr pLayerWin = pWin;
|
||||
|
|
@ -173,22 +169,17 @@ compRedirectWindow (ClientPtr pClient, WindowPtr pWin, int update)
|
|||
/*
|
||||
* Now make sure there's a per-window structure to hang this from
|
||||
*/
|
||||
if (!cw)
|
||||
{
|
||||
if (!cw) {
|
||||
cw = malloc(sizeof(CompWindowRec));
|
||||
if (!cw)
|
||||
{
|
||||
if (!cw) {
|
||||
free(ccw);
|
||||
return BadAlloc;
|
||||
}
|
||||
cw->damage = DamageCreate(compReportDamage,
|
||||
compDestroyDamage,
|
||||
DamageReportNonEmpty,
|
||||
FALSE,
|
||||
pWin->drawable.pScreen,
|
||||
pWin);
|
||||
if (!cw->damage)
|
||||
{
|
||||
FALSE, pWin->drawable.pScreen, pWin);
|
||||
if (!cw->damage) {
|
||||
free(ccw);
|
||||
free(cw);
|
||||
return BadAlloc;
|
||||
|
|
@ -210,13 +201,11 @@ compRedirectWindow (ClientPtr pClient, WindowPtr pWin, int update)
|
|||
cw->clients = ccw;
|
||||
if (!AddResource(ccw->id, CompositeClientWindowType, pWin))
|
||||
return BadAlloc;
|
||||
if (ccw->update == CompositeRedirectManual)
|
||||
{
|
||||
if (ccw->update == CompositeRedirectManual) {
|
||||
if (!anyMarked)
|
||||
anyMarked = compMarkWindows(pWin, &pLayerWin);
|
||||
|
||||
if (cw->damageRegistered)
|
||||
{
|
||||
if (cw->damageRegistered) {
|
||||
DamageUnregister(&pWin->drawable, cw->damage);
|
||||
cw->damageRegistered = FALSE;
|
||||
}
|
||||
|
|
@ -227,8 +216,7 @@ compRedirectWindow (ClientPtr pClient, WindowPtr pWin, int update)
|
|||
anyMarked = compMarkWindows(pWin, &pLayerWin);
|
||||
}
|
||||
|
||||
if (!compCheckRedirect (pWin))
|
||||
{
|
||||
if (!compCheckRedirect(pWin)) {
|
||||
FreeResource(ccw->id, RT_NONE);
|
||||
return BadAlloc;
|
||||
}
|
||||
|
|
@ -255,13 +243,12 @@ compRestoreWindow (WindowPtr pWin, PixmapPtr pPixmap)
|
|||
|
||||
if (pGC) {
|
||||
ChangeGCVal val;
|
||||
|
||||
val.val = IncludeInferiors;
|
||||
ChangeGC(NullClient, pGC, GCSubwindowMode, &val);
|
||||
ValidateGC(&pWin->drawable, pGC);
|
||||
(*pGC->ops->CopyArea) (&pPixmap->drawable,
|
||||
&pWin->drawable,
|
||||
pGC,
|
||||
x, y, w, h, 0, 0);
|
||||
&pWin->drawable, pGC, x, y, w, h, 0, 0);
|
||||
FreeScratchGC(pGC);
|
||||
}
|
||||
}
|
||||
|
|
@ -283,10 +270,8 @@ compFreeClientWindow (WindowPtr pWin, XID id)
|
|||
|
||||
if (!cw)
|
||||
return;
|
||||
for (prev = &cw->clients; (ccw = *prev); prev = &ccw->next)
|
||||
{
|
||||
if (ccw->id == id)
|
||||
{
|
||||
for (prev = &cw->clients; (ccw = *prev); prev = &ccw->next) {
|
||||
if (ccw->id == id) {
|
||||
*prev = ccw->next;
|
||||
if (ccw->update == CompositeRedirectManual)
|
||||
cw->update = CompositeRedirectAutomatic;
|
||||
|
|
@ -294,8 +279,7 @@ compFreeClientWindow (WindowPtr pWin, XID id)
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (!cw->clients)
|
||||
{
|
||||
if (!cw->clients) {
|
||||
anyMarked = compMarkWindows(pWin, &pLayerWin);
|
||||
|
||||
if (pWin->redirectDraw != RedirectDrawNone) {
|
||||
|
|
@ -312,8 +296,7 @@ compFreeClientWindow (WindowPtr pWin, XID id)
|
|||
free(cw);
|
||||
}
|
||||
else if (cw->update == CompositeRedirectAutomatic &&
|
||||
!cw->damageRegistered && pWin->redirectDraw != RedirectDrawNone)
|
||||
{
|
||||
!cw->damageRegistered && pWin->redirectDraw != RedirectDrawNone) {
|
||||
anyMarked = compMarkWindows(pWin, &pLayerWin);
|
||||
|
||||
DamageRegister(&pWin->drawable, cw->damage);
|
||||
|
|
@ -345,8 +328,7 @@ compUnredirectWindow (ClientPtr pClient, WindowPtr pWin, int update)
|
|||
return BadValue;
|
||||
|
||||
for (ccw = cw->clients; ccw; ccw = ccw->next)
|
||||
if (ccw->update == update && CLIENT_ID(ccw->id) == pClient->index)
|
||||
{
|
||||
if (ccw->update == update && CLIENT_ID(ccw->id) == pClient->index) {
|
||||
FreeResource(ccw->id, RT_NONE);
|
||||
return Success;
|
||||
}
|
||||
|
|
@ -384,11 +366,9 @@ compRedirectSubwindows (ClientPtr pClient, WindowPtr pWin, int update)
|
|||
/*
|
||||
* Now make sure there's a per-window structure to hang this from
|
||||
*/
|
||||
if (!csw)
|
||||
{
|
||||
if (!csw) {
|
||||
csw = malloc(sizeof(CompSubwindowsRec));
|
||||
if (!csw)
|
||||
{
|
||||
if (!csw) {
|
||||
free(ccw);
|
||||
return BadAlloc;
|
||||
}
|
||||
|
|
@ -399,15 +379,13 @@ compRedirectSubwindows (ClientPtr pClient, WindowPtr pWin, int update)
|
|||
/*
|
||||
* Redirect all existing windows
|
||||
*/
|
||||
for (pChild = pWin->lastChild; pChild; pChild = pChild->prevSib)
|
||||
{
|
||||
for (pChild = pWin->lastChild; pChild; pChild = pChild->prevSib) {
|
||||
int ret = compRedirectWindow(pClient, pChild, update);
|
||||
if (ret != Success)
|
||||
{
|
||||
|
||||
if (ret != Success) {
|
||||
for (pChild = pChild->nextSib; pChild; pChild = pChild->nextSib)
|
||||
(void) compUnredirectWindow(pClient, pChild, update);
|
||||
if (!csw->clients)
|
||||
{
|
||||
if (!csw->clients) {
|
||||
free(csw);
|
||||
dixSetPrivate(&pWin->devPrivates, CompSubwindowsPrivateKey, 0);
|
||||
}
|
||||
|
|
@ -422,8 +400,7 @@ compRedirectSubwindows (ClientPtr pClient, WindowPtr pWin, int update)
|
|||
csw->clients = ccw;
|
||||
if (!AddResource(ccw->id, CompositeClientSubwindowsType, pWin))
|
||||
return BadAlloc;
|
||||
if (ccw->update == CompositeRedirectManual)
|
||||
{
|
||||
if (ccw->update == CompositeRedirectManual) {
|
||||
csw->update = CompositeRedirectManual;
|
||||
/*
|
||||
* tell damage extension that damage events for this client are
|
||||
|
|
@ -448,15 +425,12 @@ compFreeClientSubwindows (WindowPtr pWin, XID id)
|
|||
|
||||
if (!csw)
|
||||
return;
|
||||
for (prev = &csw->clients; (ccw = *prev); prev = &ccw->next)
|
||||
{
|
||||
if (ccw->id == id)
|
||||
{
|
||||
for (prev = &csw->clients; (ccw = *prev); prev = &ccw->next) {
|
||||
if (ccw->id == id) {
|
||||
ClientPtr pClient = clients[CLIENT_ID(id)];
|
||||
|
||||
*prev = ccw->next;
|
||||
if (ccw->update == CompositeRedirectManual)
|
||||
{
|
||||
if (ccw->update == CompositeRedirectManual) {
|
||||
/*
|
||||
* tell damage extension that damage events for this client are
|
||||
* critical output
|
||||
|
|
@ -465,7 +439,8 @@ compFreeClientSubwindows (WindowPtr pWin, XID id)
|
|||
csw->update = CompositeRedirectAutomatic;
|
||||
pWin->inhibitBGPaint = FALSE;
|
||||
if (pWin->mapped)
|
||||
(*pWin->drawable.pScreen->ClearToBackground)(pWin, 0, 0, 0, 0, TRUE);
|
||||
(*pWin->drawable.pScreen->ClearToBackground) (pWin, 0, 0, 0,
|
||||
0, TRUE);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -482,8 +457,7 @@ compFreeClientSubwindows (WindowPtr pWin, XID id)
|
|||
/*
|
||||
* Check if all of the per-client records are gone
|
||||
*/
|
||||
if (!csw->clients)
|
||||
{
|
||||
if (!csw->clients) {
|
||||
dixSetPrivate(&pWin->devPrivates, CompSubwindowsPrivateKey, NULL);
|
||||
free(csw);
|
||||
}
|
||||
|
|
@ -502,8 +476,7 @@ compUnredirectSubwindows (ClientPtr pClient, WindowPtr pWin, int update)
|
|||
if (!csw)
|
||||
return BadValue;
|
||||
for (ccw = csw->clients; ccw; ccw = ccw->next)
|
||||
if (ccw->update == update && CLIENT_ID(ccw->id) == pClient->index)
|
||||
{
|
||||
if (ccw->update == update && CLIENT_ID(ccw->id) == pClient->index) {
|
||||
FreeResource(ccw->id, RT_NONE);
|
||||
return Success;
|
||||
}
|
||||
|
|
@ -522,10 +495,10 @@ compRedirectOneSubwindow (WindowPtr pParent, WindowPtr pWin)
|
|||
|
||||
if (!csw)
|
||||
return Success;
|
||||
for (ccw = csw->clients; ccw; ccw = ccw->next)
|
||||
{
|
||||
for (ccw = csw->clients; ccw; ccw = ccw->next) {
|
||||
int ret = compRedirectWindow(clients[CLIENT_ID(ccw->id)],
|
||||
pWin, ccw->update);
|
||||
|
||||
if (ret != Success)
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -544,10 +517,10 @@ compUnredirectOneSubwindow (WindowPtr pParent, WindowPtr pWin)
|
|||
|
||||
if (!csw)
|
||||
return Success;
|
||||
for (ccw = csw->clients; ccw; ccw = ccw->next)
|
||||
{
|
||||
for (ccw = csw->clients; ccw; ccw = ccw->next) {
|
||||
int ret = compUnredirectWindow(clients[CLIENT_ID(ccw->id)],
|
||||
pWin, ccw->update);
|
||||
|
||||
if (ret != Success)
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -570,13 +543,12 @@ compNewPixmap (WindowPtr pWin, int x, int y, int w, int h)
|
|||
pPixmap->screen_x = x;
|
||||
pPixmap->screen_y = y;
|
||||
|
||||
if (pParent->drawable.depth == pWin->drawable.depth)
|
||||
{
|
||||
if (pParent->drawable.depth == pWin->drawable.depth) {
|
||||
GCPtr pGC = GetScratchGC(pWin->drawable.depth, pScreen);
|
||||
|
||||
if (pGC)
|
||||
{
|
||||
if (pGC) {
|
||||
ChangeGCVal val;
|
||||
|
||||
val.val = IncludeInferiors;
|
||||
ChangeGC(NullClient, pGC, GCSubwindowMode, &val);
|
||||
ValidateGC(&pPixmap->drawable, pGC);
|
||||
|
|
@ -584,13 +556,11 @@ compNewPixmap (WindowPtr pWin, int x, int y, int w, int h)
|
|||
&pPixmap->drawable,
|
||||
pGC,
|
||||
x - pParent->drawable.x,
|
||||
y - pParent->drawable.y,
|
||||
w, h, 0, 0);
|
||||
y - pParent->drawable.y, w, h, 0, 0);
|
||||
FreeScratchGC(pGC);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
PictFormatPtr pSrcFormat = compWindowFormat(pParent);
|
||||
PictFormatPtr pDstFormat = compWindowFormat(pWin);
|
||||
XID inferiors = IncludeInferiors;
|
||||
|
|
@ -609,15 +579,13 @@ compNewPixmap (WindowPtr pWin, int x, int y, int w, int h)
|
|||
0, 0,
|
||||
serverClient, &error);
|
||||
|
||||
if (pSrcPicture && pDstPicture)
|
||||
{
|
||||
if (pSrcPicture && pDstPicture) {
|
||||
CompositePicture(PictOpSrc,
|
||||
pSrcPicture,
|
||||
NULL,
|
||||
pDstPicture,
|
||||
x - pParent->drawable.x,
|
||||
y - pParent->drawable.y,
|
||||
0, 0, 0, 0, w, h);
|
||||
y - pParent->drawable.y, 0, 0, 0, 0, w, h);
|
||||
}
|
||||
if (pSrcPicture)
|
||||
FreePicture(pSrcPicture, 0);
|
||||
|
|
@ -649,8 +617,7 @@ compAllocPixmap (WindowPtr pWin)
|
|||
cw->oldx = COMP_ORIGIN_INVALID;
|
||||
cw->oldy = COMP_ORIGIN_INVALID;
|
||||
cw->damageRegistered = FALSE;
|
||||
if (cw->update == CompositeRedirectAutomatic)
|
||||
{
|
||||
if (cw->update == CompositeRedirectAutomatic) {
|
||||
DamageRegister(&pWin->drawable, cw->damage);
|
||||
cw->damageRegistered = TRUE;
|
||||
}
|
||||
|
|
@ -671,8 +638,7 @@ compSetParentPixmap (WindowPtr pWin)
|
|||
PixmapPtr pParentPixmap;
|
||||
CompWindowPtr cw = GetCompWindow(pWin);
|
||||
|
||||
if (cw->damageRegistered)
|
||||
{
|
||||
if (cw->damageRegistered) {
|
||||
DamageUnregister(&pWin->drawable, cw->damage);
|
||||
cw->damageRegistered = FALSE;
|
||||
DamageEmpty(cw->damage);
|
||||
|
|
@ -712,16 +678,14 @@ compReallocPixmap (WindowPtr pWin, int draw_x, int draw_y,
|
|||
pix_y = draw_y - bw;
|
||||
pix_w = w + (bw << 1);
|
||||
pix_h = h + (bw << 1);
|
||||
if (pix_w != pOld->drawable.width || pix_h != pOld->drawable.height)
|
||||
{
|
||||
if (pix_w != pOld->drawable.width || pix_h != pOld->drawable.height) {
|
||||
pNew = compNewPixmap(pWin, pix_x, pix_y, pix_w, pix_h);
|
||||
if (!pNew)
|
||||
return FALSE;
|
||||
cw->pOldPixmap = pOld;
|
||||
compSetPixmap(pWin, pNew);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
pNew = pOld;
|
||||
cw->pOldPixmap = 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@
|
|||
|
||||
static CARD8 CompositeReqCode;
|
||||
static DevPrivateKeyRec CompositeClientPrivateKeyRec;
|
||||
|
||||
#define CompositeClientPrivateKey (&CompositeClientPrivateKeyRec)
|
||||
RESTYPE CompositeClientWindowType;
|
||||
RESTYPE CompositeClientSubwindowsType;
|
||||
|
|
@ -65,9 +66,7 @@ typedef struct _CompositeClient {
|
|||
dixLookupPrivate(&(pClient)->devPrivates, CompositeClientPrivateKey))
|
||||
|
||||
static void
|
||||
CompositeClientCallback (CallbackListPtr *list,
|
||||
pointer closure,
|
||||
pointer data)
|
||||
CompositeClientCallback(CallbackListPtr *list, pointer closure, pointer data)
|
||||
{
|
||||
NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
|
||||
ClientPtr pClient = clientinfo->client;
|
||||
|
|
@ -109,6 +108,7 @@ ProcCompositeQueryVersion (ClientPtr client)
|
|||
{
|
||||
CompositeClientPtr pCompositeClient = GetCompositeClient(client);
|
||||
xCompositeQueryVersionReply rep;
|
||||
|
||||
REQUEST(xCompositeQueryVersionReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xCompositeQueryVersionReq);
|
||||
|
|
@ -118,7 +118,8 @@ ProcCompositeQueryVersion (ClientPtr client)
|
|||
if (stuff->majorVersion < SERVER_COMPOSITE_MAJOR_VERSION) {
|
||||
rep.majorVersion = stuff->majorVersion;
|
||||
rep.minorVersion = stuff->minorVersion;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
rep.majorVersion = SERVER_COMPOSITE_MAJOR_VERSION;
|
||||
rep.minorVersion = SERVER_COMPOSITE_MINOR_VERSION;
|
||||
}
|
||||
|
|
@ -149,6 +150,7 @@ static int
|
|||
ProcCompositeRedirectWindow(ClientPtr client)
|
||||
{
|
||||
WindowPtr pWin;
|
||||
|
||||
REQUEST(xCompositeRedirectWindowReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xCompositeRedirectWindowReq);
|
||||
|
|
@ -162,6 +164,7 @@ static int
|
|||
ProcCompositeRedirectSubwindows(ClientPtr client)
|
||||
{
|
||||
WindowPtr pWin;
|
||||
|
||||
REQUEST(xCompositeRedirectSubwindowsReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xCompositeRedirectSubwindowsReq);
|
||||
|
|
@ -175,6 +178,7 @@ static int
|
|||
ProcCompositeUnredirectWindow(ClientPtr client)
|
||||
{
|
||||
WindowPtr pWin;
|
||||
|
||||
REQUEST(xCompositeUnredirectWindowReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xCompositeUnredirectWindowReq);
|
||||
|
|
@ -188,6 +192,7 @@ static int
|
|||
ProcCompositeUnredirectSubwindows(ClientPtr client)
|
||||
{
|
||||
WindowPtr pWin;
|
||||
|
||||
REQUEST(xCompositeUnredirectSubwindowsReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xCompositeUnredirectSubwindowsReq);
|
||||
|
|
@ -203,6 +208,7 @@ ProcCompositeCreateRegionFromBorderClip (ClientPtr client)
|
|||
WindowPtr pWin;
|
||||
CompWindowPtr cw;
|
||||
RegionPtr pBorderClip, pRegion;
|
||||
|
||||
REQUEST(xCompositeCreateRegionFromBorderClipReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xCompositeCreateRegionFromBorderClipReq);
|
||||
|
|
@ -232,6 +238,7 @@ ProcCompositeNameWindowPixmap (ClientPtr client)
|
|||
CompWindowPtr cw;
|
||||
PixmapPtr pPixmap;
|
||||
int rc;
|
||||
|
||||
REQUEST(xCompositeNameWindowPixmapReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xCompositeNameWindowPixmapReq);
|
||||
|
|
@ -264,7 +271,6 @@ ProcCompositeNameWindowPixmap (ClientPtr client)
|
|||
return Success;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
ProcCompositeGetOverlayWindow(ClientPtr client)
|
||||
{
|
||||
|
|
@ -293,16 +299,14 @@ ProcCompositeGetOverlayWindow (ClientPtr client)
|
|||
*/
|
||||
cs = GetCompScreen(pScreen);
|
||||
if (cs->pOverlayWin == NULL)
|
||||
if (!compCreateOverlayWindow(pScreen))
|
||||
{
|
||||
if (!compCreateOverlayWindow(pScreen)) {
|
||||
FreeResource(pOc->resource, RT_NONE);
|
||||
return BadAlloc;
|
||||
}
|
||||
|
||||
rc = XaceHook(XACE_RESOURCE_ACCESS, client, cs->pOverlayWin->drawable.id,
|
||||
RT_WINDOW, cs->pOverlayWin, RT_NONE, NULL, DixGetAttrAccess);
|
||||
if (rc != Success)
|
||||
{
|
||||
if (rc != Success) {
|
||||
FreeResource(pOc->resource, RT_NONE);
|
||||
return rc;
|
||||
}
|
||||
|
|
@ -312,13 +316,13 @@ ProcCompositeGetOverlayWindow (ClientPtr client)
|
|||
rep.length = 0;
|
||||
rep.overlayWin = cs->pOverlayWin->drawable.id;
|
||||
|
||||
if (client->swapped)
|
||||
{
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber);
|
||||
swapl(&rep.length);
|
||||
swapl(&rep.overlayWin);
|
||||
}
|
||||
(void) WriteToClient(client, sz_xCompositeGetOverlayWindowReply, (char *)&rep);
|
||||
(void) WriteToClient(client, sz_xCompositeGetOverlayWindowReply,
|
||||
(char *) &rep);
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
|
@ -357,9 +361,7 @@ static int (*ProcCompositeVector[CompositeNumberRequests])(ClientPtr) = {
|
|||
ProcCompositeUnredirectSubwindows,
|
||||
ProcCompositeCreateRegionFromBorderClip,
|
||||
ProcCompositeNameWindowPixmap,
|
||||
ProcCompositeGetOverlayWindow,
|
||||
ProcCompositeReleaseOverlayWindow,
|
||||
};
|
||||
ProcCompositeGetOverlayWindow, ProcCompositeReleaseOverlayWindow,};
|
||||
|
||||
static int
|
||||
ProcCompositeDispatch(ClientPtr client)
|
||||
|
|
@ -482,9 +484,7 @@ static int (*SProcCompositeVector[CompositeNumberRequests])(ClientPtr) = {
|
|||
SProcCompositeUnredirectSubwindows,
|
||||
SProcCompositeCreateRegionFromBorderClip,
|
||||
SProcCompositeNameWindowPixmap,
|
||||
SProcCompositeGetOverlayWindow,
|
||||
SProcCompositeReleaseOverlayWindow,
|
||||
};
|
||||
SProcCompositeGetOverlayWindow, SProcCompositeReleaseOverlayWindow,};
|
||||
|
||||
static int
|
||||
SProcCompositeDispatch(ClientPtr client)
|
||||
|
|
@ -513,8 +513,7 @@ CompositeExtensionInit (void)
|
|||
/* Composite on 8bpp pseudocolor root windows appears to fail, so
|
||||
* just disable it on anything pseudocolor for safety.
|
||||
*/
|
||||
for (vis = pScreen->visuals; vis->vid != pScreen->rootVisual; vis++)
|
||||
;
|
||||
for (vis = pScreen->visuals; vis->vid != pScreen->rootVisual; vis++);
|
||||
if ((vis->class | DynamicClass) == PseudoColor)
|
||||
return;
|
||||
|
||||
|
|
@ -575,6 +574,7 @@ PanoramiXCompositeRedirectWindow (ClientPtr client)
|
|||
{
|
||||
PanoramiXRes *win;
|
||||
int rc = 0, j;
|
||||
|
||||
REQUEST(xCompositeRedirectWindowReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xCompositeRedirectWindowReq);
|
||||
|
|
@ -588,7 +588,8 @@ PanoramiXCompositeRedirectWindow (ClientPtr client)
|
|||
FOR_NSCREENS_FORWARD(j) {
|
||||
stuff->window = win->info[j].id;
|
||||
rc = (*PanoramiXSaveCompositeVector[stuff->compositeReqType]) (client);
|
||||
if (rc != Success) break;
|
||||
if (rc != Success)
|
||||
break;
|
||||
}
|
||||
|
||||
return rc;
|
||||
|
|
@ -599,6 +600,7 @@ PanoramiXCompositeRedirectSubwindows (ClientPtr client)
|
|||
{
|
||||
PanoramiXRes *win;
|
||||
int rc = 0, j;
|
||||
|
||||
REQUEST(xCompositeRedirectSubwindowsReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xCompositeRedirectSubwindowsReq);
|
||||
|
|
@ -612,7 +614,8 @@ PanoramiXCompositeRedirectSubwindows (ClientPtr client)
|
|||
FOR_NSCREENS_FORWARD(j) {
|
||||
stuff->window = win->info[j].id;
|
||||
rc = (*PanoramiXSaveCompositeVector[stuff->compositeReqType]) (client);
|
||||
if (rc != Success) break;
|
||||
if (rc != Success)
|
||||
break;
|
||||
}
|
||||
|
||||
return rc;
|
||||
|
|
@ -623,6 +626,7 @@ PanoramiXCompositeUnredirectWindow (ClientPtr client)
|
|||
{
|
||||
PanoramiXRes *win;
|
||||
int rc = 0, j;
|
||||
|
||||
REQUEST(xCompositeUnredirectWindowReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xCompositeUnredirectWindowReq);
|
||||
|
|
@ -636,7 +640,8 @@ PanoramiXCompositeUnredirectWindow (ClientPtr client)
|
|||
FOR_NSCREENS_FORWARD(j) {
|
||||
stuff->window = win->info[j].id;
|
||||
rc = (*PanoramiXSaveCompositeVector[stuff->compositeReqType]) (client);
|
||||
if (rc != Success) break;
|
||||
if (rc != Success)
|
||||
break;
|
||||
}
|
||||
|
||||
return rc;
|
||||
|
|
@ -647,6 +652,7 @@ PanoramiXCompositeUnredirectSubwindows (ClientPtr client)
|
|||
{
|
||||
PanoramiXRes *win;
|
||||
int rc = 0, j;
|
||||
|
||||
REQUEST(xCompositeUnredirectSubwindowsReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xCompositeUnredirectSubwindowsReq);
|
||||
|
|
@ -660,7 +666,8 @@ PanoramiXCompositeUnredirectSubwindows (ClientPtr client)
|
|||
FOR_NSCREENS_FORWARD(j) {
|
||||
stuff->window = win->info[j].id;
|
||||
rc = (*PanoramiXSaveCompositeVector[stuff->compositeReqType]) (client);
|
||||
if (rc != Success) break;
|
||||
if (rc != Success)
|
||||
break;
|
||||
}
|
||||
|
||||
return rc;
|
||||
|
|
@ -675,6 +682,7 @@ PanoramiXCompositeNameWindowPixmap (ClientPtr client)
|
|||
int rc;
|
||||
PanoramiXRes *win, *newPix;
|
||||
int i;
|
||||
|
||||
REQUEST(xCompositeNameWindowPixmapReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xCompositeNameWindowPixmapReq);
|
||||
|
|
@ -697,35 +705,30 @@ PanoramiXCompositeNameWindowPixmap (ClientPtr client)
|
|||
FOR_NSCREENS(i) {
|
||||
rc = dixLookupResourceByType((void **) &pWin, win->info[i].id,
|
||||
RT_WINDOW, client, DixGetAttrAccess);
|
||||
if (rc != Success)
|
||||
{
|
||||
if (rc != Success) {
|
||||
client->errorValue = stuff->window;
|
||||
free(newPix);
|
||||
return rc;
|
||||
}
|
||||
|
||||
if (!pWin->viewable)
|
||||
{
|
||||
if (!pWin->viewable) {
|
||||
free(newPix);
|
||||
return BadMatch;
|
||||
}
|
||||
|
||||
cw = GetCompWindow(pWin);
|
||||
if (!cw)
|
||||
{
|
||||
if (!cw) {
|
||||
free(newPix);
|
||||
return BadMatch;
|
||||
}
|
||||
|
||||
pPixmap = (*pWin->drawable.pScreen->GetWindowPixmap) (pWin);
|
||||
if (!pPixmap)
|
||||
{
|
||||
if (!pPixmap) {
|
||||
free(newPix);
|
||||
return BadMatch;
|
||||
}
|
||||
|
||||
if (!AddResource (newPix->info[i].id, RT_PIXMAP,
|
||||
(pointer) pPixmap))
|
||||
if (!AddResource(newPix->info[i].id, RT_PIXMAP, (pointer) pPixmap))
|
||||
return BadAlloc;
|
||||
|
||||
++pPixmap->refcnt;
|
||||
|
|
@ -737,7 +740,6 @@ PanoramiXCompositeNameWindowPixmap (ClientPtr client)
|
|||
return Success;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
PanoramiXCompositeGetOverlayWindow(ClientPtr client)
|
||||
{
|
||||
|
|
@ -760,8 +762,7 @@ PanoramiXCompositeGetOverlayWindow (ClientPtr client)
|
|||
}
|
||||
|
||||
cs = GetCompScreen(screenInfo.screens[0]);
|
||||
if (!cs->pOverlayWin)
|
||||
{
|
||||
if (!cs->pOverlayWin) {
|
||||
if (!(overlayWin = malloc(sizeof(PanoramiXRes))))
|
||||
return BadAlloc;
|
||||
|
||||
|
|
@ -772,8 +773,7 @@ PanoramiXCompositeGetOverlayWindow (ClientPtr client)
|
|||
FOR_NSCREENS_BACKWARD(i) {
|
||||
rc = dixLookupResourceByType((pointer *) &pWin, win->info[i].id,
|
||||
RT_WINDOW, client, DixGetAttrAccess);
|
||||
if (rc != Success)
|
||||
{
|
||||
if (rc != Success) {
|
||||
client->errorValue = stuff->window;
|
||||
return rc;
|
||||
}
|
||||
|
|
@ -792,8 +792,7 @@ PanoramiXCompositeGetOverlayWindow (ClientPtr client)
|
|||
*/
|
||||
cs = GetCompScreen(pScreen);
|
||||
if (cs->pOverlayWin == NULL)
|
||||
if (!compCreateOverlayWindow(pScreen))
|
||||
{
|
||||
if (!compCreateOverlayWindow(pScreen)) {
|
||||
FreeResource(pOc->resource, RT_NONE);
|
||||
return BadAlloc;
|
||||
}
|
||||
|
|
@ -802,15 +801,13 @@ PanoramiXCompositeGetOverlayWindow (ClientPtr client)
|
|||
cs->pOverlayWin->drawable.id,
|
||||
RT_WINDOW, cs->pOverlayWin, RT_NONE, NULL,
|
||||
DixGetAttrAccess);
|
||||
if (rc != Success)
|
||||
{
|
||||
if (rc != Success) {
|
||||
FreeResource(pOc->resource, RT_NONE);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
if (overlayWin)
|
||||
{
|
||||
if (overlayWin) {
|
||||
FOR_NSCREENS(i) {
|
||||
cs = GetCompScreen(screenInfo.screens[i]);
|
||||
overlayWin->info[i].id = cs->pOverlayWin->drawable.id;
|
||||
|
|
@ -826,13 +823,13 @@ PanoramiXCompositeGetOverlayWindow (ClientPtr client)
|
|||
rep.length = 0;
|
||||
rep.overlayWin = cs->pOverlayWin->drawable.id;
|
||||
|
||||
if (client->swapped)
|
||||
{
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber);
|
||||
swapl(&rep.length);
|
||||
swapl(&rep.overlayWin);
|
||||
}
|
||||
(void) WriteToClient(client, sz_xCompositeGetOverlayWindowReply, (char *)&rep);
|
||||
(void) WriteToClient(client, sz_xCompositeGetOverlayWindowReply,
|
||||
(char *) &rep);
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -120,7 +120,8 @@ compChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
|
|||
if (pWin->backingStore != NotUseful) {
|
||||
compRedirectWindow(serverClient, pWin, CompositeRedirectAutomatic);
|
||||
pWin->backStorage = (pointer) (intptr_t) 1;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
compUnredirectWindow(serverClient, pWin,
|
||||
CompositeRedirectAutomatic);
|
||||
pWin->backStorage = NULL;
|
||||
|
|
@ -136,9 +137,7 @@ static void
|
|||
compGetImage(DrawablePtr pDrawable,
|
||||
int sx, int sy,
|
||||
int w, int h,
|
||||
unsigned int format,
|
||||
unsigned long planemask,
|
||||
char *pdstLine)
|
||||
unsigned int format, unsigned long planemask, char *pdstLine)
|
||||
{
|
||||
ScreenPtr pScreen = pDrawable->pScreen;
|
||||
CompScreenPtr cs = GetCompScreen(pScreen);
|
||||
|
|
@ -151,10 +150,10 @@ compGetImage (DrawablePtr pDrawable,
|
|||
pScreen->GetImage = compGetImage;
|
||||
}
|
||||
|
||||
static void compSourceValidate(DrawablePtr pDrawable,
|
||||
static void
|
||||
compSourceValidate(DrawablePtr pDrawable,
|
||||
int x, int y,
|
||||
int width, int height,
|
||||
unsigned int subWindowMode)
|
||||
int width, int height, unsigned int subWindowMode)
|
||||
{
|
||||
ScreenPtr pScreen = pDrawable->pScreen;
|
||||
CompScreenPtr cs = GetCompScreen(pScreen);
|
||||
|
|
@ -178,11 +177,10 @@ compFindVisuallessDepth (ScreenPtr pScreen, int d)
|
|||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < pScreen->numDepths; i++)
|
||||
{
|
||||
for (i = 0; i < pScreen->numDepths; i++) {
|
||||
DepthPtr depth = &pScreen->allowedDepths[i];
|
||||
if (depth->depth == d)
|
||||
{
|
||||
|
||||
if (depth->depth == d) {
|
||||
/*
|
||||
* Make sure it doesn't have visuals already
|
||||
*/
|
||||
|
|
@ -222,10 +220,12 @@ compRegisterAlternateVisuals (CompScreenPtr cs, VisualID *vids, int nVisuals)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
Bool CompositeRegisterAlternateVisuals (ScreenPtr pScreen, VisualID *vids,
|
||||
Bool
|
||||
CompositeRegisterAlternateVisuals(ScreenPtr pScreen, VisualID * vids,
|
||||
int nVisuals)
|
||||
{
|
||||
CompScreenPtr cs = GetCompScreen(pScreen);
|
||||
|
||||
return compRegisterAlternateVisuals(cs, vids, nVisuals);
|
||||
}
|
||||
|
||||
|
|
@ -282,11 +282,14 @@ compAddAlternateVisual(ScreenPtr pScreen, CompScreenPtr cs,
|
|||
visual->class = PseudoColor;
|
||||
visual->nplanes = PICT_FORMAT_BPP(alt->format);
|
||||
visual->ColormapEntries = 1 << visual->nplanes;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
DirectFormatRec *direct = &pPictFormat->direct;
|
||||
|
||||
visual->class = TrueColor;
|
||||
visual->redMask = ((unsigned long) direct->redMask) << direct->red;
|
||||
visual->greenMask = ((unsigned long)direct->greenMask) << direct->green;
|
||||
visual->greenMask =
|
||||
((unsigned long) direct->greenMask) << direct->green;
|
||||
visual->blueMask = ((unsigned long) direct->blueMask) << direct->blue;
|
||||
alphaMask = ((unsigned long) direct->alphaMask) << direct->alpha;
|
||||
visual->offsetRed = direct->red;
|
||||
|
|
@ -298,8 +301,7 @@ compAddAlternateVisual(ScreenPtr pScreen, CompScreenPtr cs,
|
|||
*/
|
||||
visual->nplanes = Ones(visual->redMask |
|
||||
visual->greenMask |
|
||||
visual->blueMask |
|
||||
alphaMask);
|
||||
visual->blueMask | alphaMask);
|
||||
/* find widest component */
|
||||
visual->ColormapEntries = (1 << max(Ones(visual->redMask),
|
||||
max(Ones(visual->greenMask),
|
||||
|
|
@ -348,8 +350,7 @@ compScreenInit (ScreenPtr pScreen)
|
|||
cs->numAlternateVisuals = 0;
|
||||
cs->alternateVisuals = NULL;
|
||||
|
||||
if (!compAddAlternateVisuals (pScreen, cs))
|
||||
{
|
||||
if (!compAddAlternateVisuals(pScreen, cs)) {
|
||||
free(cs);
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -164,12 +164,15 @@ typedef struct _CompScreen {
|
|||
} CompScreenRec, *CompScreenPtr;
|
||||
|
||||
extern DevPrivateKeyRec CompScreenPrivateKeyRec;
|
||||
|
||||
#define CompScreenPrivateKey (&CompScreenPrivateKeyRec)
|
||||
|
||||
extern DevPrivateKeyRec CompWindowPrivateKeyRec;
|
||||
|
||||
#define CompWindowPrivateKey (&CompWindowPrivateKeyRec)
|
||||
|
||||
extern DevPrivateKeyRec CompSubwindowsPrivateKeyRec;
|
||||
|
||||
#define CompSubwindowsPrivateKey (&CompSubwindowsPrivateKeyRec)
|
||||
|
||||
#define GetCompScreen(s) ((CompScreenPtr) \
|
||||
|
|
@ -221,6 +224,7 @@ void
|
|||
compRestoreWindow(WindowPtr pWin, PixmapPtr pPixmap);
|
||||
|
||||
Bool
|
||||
|
||||
compReallocPixmap(WindowPtr pWin, int x, int y,
|
||||
unsigned int w, unsigned int h, int bw);
|
||||
|
||||
|
|
@ -268,8 +272,7 @@ compCheckTree (ScreenPtr pScreen);
|
|||
#define compCheckTree(s)
|
||||
#endif
|
||||
|
||||
PictFormatPtr
|
||||
compWindowFormat (WindowPtr pWin);
|
||||
PictFormatPtr compWindowFormat(WindowPtr pWin);
|
||||
|
||||
void
|
||||
compSetPixmap(WindowPtr pWin, PixmapPtr pPixmap);
|
||||
|
|
@ -293,6 +296,7 @@ void
|
|||
compMoveWindow(WindowPtr pWin, int x, int y, WindowPtr pSib, VTKind kind);
|
||||
|
||||
void
|
||||
|
||||
compResizeWindow(WindowPtr pWin, int x, int y,
|
||||
unsigned int w, unsigned int h, WindowPtr pSib);
|
||||
|
||||
|
|
@ -327,6 +331,7 @@ int
|
|||
DeleteWindowNoInputDevices(pointer value, XID wid);
|
||||
|
||||
int
|
||||
|
||||
compConfigNotify(WindowPtr pWin, int x, int y, int w, int h,
|
||||
int bw, WindowPtr pSib);
|
||||
|
||||
|
|
|
|||
|
|
@ -62,8 +62,7 @@ compFreeOverlayClient (CompOverlayClientPtr pOcToDel)
|
|||
CompScreenPtr cs = GetCompScreen(pScreen);
|
||||
CompOverlayClientPtr *pPrev, pOc;
|
||||
|
||||
for (pPrev = &cs->pOverlayClients; (pOc = *pPrev); pPrev = &pOc->pNext)
|
||||
{
|
||||
for (pPrev = &cs->pOverlayClients; (pOc = *pPrev); pPrev = &pOc->pNext) {
|
||||
if (pOc == pOcToDel) {
|
||||
*pPrev = pOc->pNext;
|
||||
free(pOc);
|
||||
|
|
@ -136,8 +135,7 @@ compCreateOverlayWindow (ScreenPtr pScreen)
|
|||
int h = pScreen->height;
|
||||
|
||||
#ifdef PANORAMIX
|
||||
if (!noPanoramiXExtension)
|
||||
{
|
||||
if (!noPanoramiXExtension) {
|
||||
w = PanoramiXPixWidth;
|
||||
h = PanoramiXPixHeight;
|
||||
}
|
||||
|
|
@ -170,4 +168,3 @@ compDestroyOverlayWindow (ScreenPtr pScreen)
|
|||
cs->pOverlayWin = NullWindow;
|
||||
FreeResource(cs->overlayWid, RT_NONE);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -57,21 +57,19 @@ compCheckWindow (WindowPtr pWin, pointer data)
|
|||
{
|
||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||
PixmapPtr pWinPixmap = (*pScreen->GetWindowPixmap) (pWin);
|
||||
PixmapPtr pParentPixmap = pWin->parent ? (*pScreen->GetWindowPixmap) (pWin->parent) : 0;
|
||||
PixmapPtr pParentPixmap =
|
||||
pWin->parent ? (*pScreen->GetWindowPixmap) (pWin->parent) : 0;
|
||||
PixmapPtr pScreenPixmap = (*pScreen->GetScreenPixmap) (pScreen);
|
||||
|
||||
if (!pWin->parent)
|
||||
{
|
||||
if (!pWin->parent) {
|
||||
assert(pWin->redirectDraw == RedirectDrawNone);
|
||||
assert(pWinPixmap == pScreenPixmap);
|
||||
}
|
||||
else if (pWin->redirectDraw != RedirectDrawNone)
|
||||
{
|
||||
else if (pWin->redirectDraw != RedirectDrawNone) {
|
||||
assert(pWinPixmap != pParentPixmap);
|
||||
assert(pWinPixmap != pScreenPixmap);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
assert(pWinPixmap == pParentPixmap);
|
||||
}
|
||||
assert(0 < pWinPixmap->refcnt && pWinPixmap->refcnt < 3);
|
||||
|
|
@ -97,7 +95,9 @@ static Bool
|
|||
compRepaintBorder(ClientPtr pClient, pointer closure)
|
||||
{
|
||||
WindowPtr pWindow;
|
||||
int rc = dixLookupWindow(&pWindow, (XID)(intptr_t)closure, pClient, DixWriteAccess);
|
||||
int rc =
|
||||
dixLookupWindow(&pWindow, (XID) (intptr_t) closure, pClient,
|
||||
DixWriteAccess);
|
||||
|
||||
if (rc == Success) {
|
||||
RegionRec exposed;
|
||||
|
|
@ -160,18 +160,19 @@ compCheckRedirect (WindowPtr pWin)
|
|||
}
|
||||
}
|
||||
|
||||
if (should != (pWin->redirectDraw != RedirectDrawNone))
|
||||
{
|
||||
if (should != (pWin->redirectDraw != RedirectDrawNone)) {
|
||||
if (should)
|
||||
return compAllocPixmap(pWin);
|
||||
else {
|
||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||
PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
|
||||
|
||||
compSetParentPixmap(pWin);
|
||||
compRestoreWindow(pWin, pPixmap);
|
||||
(*pScreen->DestroyPixmap) (pPixmap);
|
||||
}
|
||||
} else if (should) {
|
||||
}
|
||||
else if (should) {
|
||||
if (cw->update == CompositeRedirectAutomatic)
|
||||
pWin->redirectDraw = RedirectDrawAutomatic;
|
||||
else
|
||||
|
|
@ -190,8 +191,7 @@ updateOverlayWindow(ScreenPtr pScreen)
|
|||
int h = pScreen->height;
|
||||
|
||||
#ifdef PANORAMIX
|
||||
if (!noPanoramiXExtension)
|
||||
{
|
||||
if (!noPanoramiXExtension) {
|
||||
w = PanoramiXPixWidth;
|
||||
h = PanoramiXPixHeight;
|
||||
}
|
||||
|
|
@ -199,8 +199,7 @@ updateOverlayWindow(ScreenPtr pScreen)
|
|||
|
||||
cs = GetCompScreen(pScreen);
|
||||
if ((pWin = cs->pOverlayWin) != NULL) {
|
||||
if ((pWin->drawable.width == w) &&
|
||||
(pWin->drawable.height == h))
|
||||
if ((pWin->drawable.width == w) && (pWin->drawable.height == h))
|
||||
return Success;
|
||||
|
||||
/* Let's resize the overlay window. */
|
||||
|
|
@ -231,15 +230,13 @@ compPositionWindow (WindowPtr pWin, int x, int y)
|
|||
(pWin->viewable && (GetCompWindow(pWin) != NULL)))
|
||||
OsAbort();
|
||||
#endif
|
||||
if (pWin->redirectDraw != RedirectDrawNone)
|
||||
{
|
||||
if (pWin->redirectDraw != RedirectDrawNone) {
|
||||
PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
|
||||
int bw = wBorderWidth(pWin);
|
||||
int nx = pWin->drawable.x - bw;
|
||||
int ny = pWin->drawable.y - bw;
|
||||
|
||||
if (pPixmap->screen_x != nx || pPixmap->screen_y != ny)
|
||||
{
|
||||
if (pPixmap->screen_x != nx || pPixmap->screen_y != ny) {
|
||||
pPixmap->screen_x = nx;
|
||||
pPixmap->screen_y = ny;
|
||||
pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
|
||||
|
|
@ -302,11 +299,9 @@ compClipNotify (WindowPtr pWin, int dx, int dy)
|
|||
CompScreenPtr cs = GetCompScreen(pScreen);
|
||||
CompWindowPtr cw = GetCompWindow(pWin);
|
||||
|
||||
if (cw)
|
||||
{
|
||||
if (cw) {
|
||||
if (cw->borderClipX != pWin->drawable.x ||
|
||||
cw->borderClipY != pWin->drawable.y)
|
||||
{
|
||||
cw->borderClipY != pWin->drawable.y) {
|
||||
RegionTranslate(&cw->borderClip,
|
||||
pWin->drawable.x - cw->borderClipX,
|
||||
pWin->drawable.y - cw->borderClipY);
|
||||
|
|
@ -314,8 +309,7 @@ compClipNotify (WindowPtr pWin, int dx, int dy)
|
|||
cw->borderClipY = pWin->drawable.y;
|
||||
}
|
||||
}
|
||||
if (cs->ClipNotify)
|
||||
{
|
||||
if (cs->ClipNotify) {
|
||||
pScreen->ClipNotify = cs->ClipNotify;
|
||||
(*pScreen->ClipNotify) (pWin, dx, dy);
|
||||
cs->ClipNotify = pScreen->ClipNotify;
|
||||
|
|
@ -329,8 +323,7 @@ compClipNotify (WindowPtr pWin, int dx, int dy)
|
|||
*/
|
||||
|
||||
static Bool
|
||||
compIsAlternateVisual (ScreenPtr pScreen,
|
||||
XID visual)
|
||||
compIsAlternateVisual(ScreenPtr pScreen, XID visual)
|
||||
{
|
||||
CompScreenPtr cs = GetCompScreen(pScreen);
|
||||
int i;
|
||||
|
|
@ -344,8 +337,7 @@ compIsAlternateVisual (ScreenPtr pScreen,
|
|||
static Bool
|
||||
compImplicitRedirect(WindowPtr pWin, WindowPtr pParent)
|
||||
{
|
||||
if (pParent)
|
||||
{
|
||||
if (pParent) {
|
||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||
XID winVisual = wVisual(pWin);
|
||||
XID parentVisual = wVisual(pParent);
|
||||
|
|
@ -358,19 +350,21 @@ compImplicitRedirect (WindowPtr pWin, WindowPtr pParent)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
static void compFreeOldPixmap(WindowPtr pWin)
|
||||
static void
|
||||
compFreeOldPixmap(WindowPtr pWin)
|
||||
{
|
||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||
if (pWin->redirectDraw != RedirectDrawNone)
|
||||
{
|
||||
|
||||
if (pWin->redirectDraw != RedirectDrawNone) {
|
||||
CompWindowPtr cw = GetCompWindow(pWin);
|
||||
if (cw->pOldPixmap)
|
||||
{
|
||||
|
||||
if (cw->pOldPixmap) {
|
||||
(*pScreen->DestroyPixmap) (cw->pOldPixmap);
|
||||
cw->pOldPixmap = NullPixmap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
compMoveWindow(WindowPtr pWin, int x, int y, WindowPtr pSib, VTKind kind)
|
||||
{
|
||||
|
|
@ -468,15 +462,13 @@ compCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
|
|||
CompScreenPtr cs = GetCompScreen(pScreen);
|
||||
int dx = 0, dy = 0;
|
||||
|
||||
if (pWin->redirectDraw != RedirectDrawNone)
|
||||
{
|
||||
if (pWin->redirectDraw != RedirectDrawNone) {
|
||||
PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
|
||||
CompWindowPtr cw = GetCompWindow(pWin);
|
||||
|
||||
assert(cw->oldx != COMP_ORIGIN_INVALID);
|
||||
assert(cw->oldy != COMP_ORIGIN_INVALID);
|
||||
if (cw->pOldPixmap)
|
||||
{
|
||||
if (cw->pOldPixmap) {
|
||||
/*
|
||||
* Ok, the old bits are available in pOldPixmap and
|
||||
* need to be copied to pNewPixmap.
|
||||
|
|
@ -491,23 +483,19 @@ compCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
|
|||
|
||||
RegionNull(&rgnDst);
|
||||
|
||||
RegionIntersect(&rgnDst,
|
||||
&pWin->borderClip, prgnSrc);
|
||||
RegionIntersect(&rgnDst, &pWin->borderClip, prgnSrc);
|
||||
|
||||
RegionTranslate(&rgnDst,
|
||||
-pPixmap->screen_x, -pPixmap->screen_y);
|
||||
RegionTranslate(&rgnDst, -pPixmap->screen_x, -pPixmap->screen_y);
|
||||
|
||||
dx = dx + pPixmap->screen_x - cw->oldx;
|
||||
dy = dy + pPixmap->screen_y - cw->oldy;
|
||||
pGC = GetScratchGC(pPixmap->drawable.depth, pScreen);
|
||||
if (pGC)
|
||||
{
|
||||
if (pGC) {
|
||||
BoxPtr pBox = RegionRects(&rgnDst);
|
||||
int nBox = RegionNumRects(&rgnDst);
|
||||
|
||||
ValidateGC(&pPixmap->drawable, pGC);
|
||||
while (nBox--)
|
||||
{
|
||||
while (nBox--) {
|
||||
(void) (*pGC->ops->CopyArea) (&cw->pOldPixmap->drawable,
|
||||
&pPixmap->drawable,
|
||||
pGC,
|
||||
|
|
@ -528,16 +516,14 @@ compCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
|
|||
}
|
||||
|
||||
pScreen->CopyWindow = cs->CopyWindow;
|
||||
if (ptOldOrg.x != pWin->drawable.x || ptOldOrg.y != pWin->drawable.y)
|
||||
{
|
||||
if (ptOldOrg.x != pWin->drawable.x || ptOldOrg.y != pWin->drawable.y) {
|
||||
if (dx || dy)
|
||||
RegionTranslate(prgnSrc, dx, dy);
|
||||
(*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc);
|
||||
if (dx || dy)
|
||||
RegionTranslate(prgnSrc, -dx, -dy);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
ptOldOrg.x -= dx;
|
||||
ptOldOrg.y -= dy;
|
||||
RegionTranslate(prgnSrc,
|
||||
|
|
@ -559,12 +545,13 @@ compCreateWindow (WindowPtr pWin)
|
|||
|
||||
pScreen->CreateWindow = cs->CreateWindow;
|
||||
ret = (*pScreen->CreateWindow) (pWin);
|
||||
if (pWin->parent && ret)
|
||||
{
|
||||
if (pWin->parent && ret) {
|
||||
CompSubwindowsPtr csw = GetCompSubwindows(pWin->parent);
|
||||
CompClientWindowPtr ccw;
|
||||
|
||||
(*pScreen->SetWindowPixmap) (pWin, (*pScreen->GetWindowPixmap) (pWin->parent));
|
||||
(*pScreen->SetWindowPixmap) (pWin,
|
||||
(*pScreen->GetWindowPixmap) (pWin->
|
||||
parent));
|
||||
if (csw)
|
||||
for (ccw = csw->clients; ccw; ccw = ccw->next)
|
||||
compRedirectWindow(clients[CLIENT_ID(ccw->id)],
|
||||
|
|
@ -595,6 +582,7 @@ compDestroyWindow (WindowPtr pWin)
|
|||
|
||||
if (pWin->redirectDraw != RedirectDrawNone) {
|
||||
PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
|
||||
|
||||
compSetParentPixmap(pWin);
|
||||
(*pScreen->DestroyPixmap) (pPixmap);
|
||||
}
|
||||
|
|
@ -692,8 +680,7 @@ compWindowUpdateAutomatic (WindowPtr pWin)
|
|||
/*
|
||||
* First move the region from window to screen coordinates
|
||||
*/
|
||||
RegionTranslate(pRegion,
|
||||
pWin->drawable.x, pWin->drawable.y);
|
||||
RegionTranslate(pRegion, pWin->drawable.x, pWin->drawable.y);
|
||||
|
||||
/*
|
||||
* Clip against the "real" border clip
|
||||
|
|
@ -703,8 +690,7 @@ compWindowUpdateAutomatic (WindowPtr pWin)
|
|||
/*
|
||||
* Now translate from screen to dest coordinates
|
||||
*/
|
||||
RegionTranslate(pRegion,
|
||||
-pParent->drawable.x, -pParent->drawable.y);
|
||||
RegionTranslate(pRegion, -pParent->drawable.x, -pParent->drawable.y);
|
||||
|
||||
/*
|
||||
* Clip the picture
|
||||
|
|
@ -714,16 +700,11 @@ compWindowUpdateAutomatic (WindowPtr pWin)
|
|||
/*
|
||||
* And paint
|
||||
*/
|
||||
CompositePicture (PictOpSrc,
|
||||
pSrcPicture,
|
||||
0,
|
||||
pDstPicture,
|
||||
0, 0, /* src_x, src_y */
|
||||
CompositePicture(PictOpSrc, pSrcPicture, 0, pDstPicture, 0, 0, /* src_x, src_y */
|
||||
0, 0, /* msk_x, msk_y */
|
||||
pSrcPixmap->screen_x - pParent->drawable.x,
|
||||
pSrcPixmap->screen_y - pParent->drawable.y,
|
||||
pSrcPixmap->drawable.width,
|
||||
pSrcPixmap->drawable.height);
|
||||
pSrcPixmap->drawable.width, pSrcPixmap->drawable.height);
|
||||
FreePicture(pSrcPicture, 0);
|
||||
FreePicture(pDstPicture, 0);
|
||||
/*
|
||||
|
|
@ -738,12 +719,10 @@ compPaintWindowToParent (WindowPtr pWin)
|
|||
{
|
||||
compPaintChildrenToWindow(pWin);
|
||||
|
||||
if (pWin->redirectDraw != RedirectDrawNone)
|
||||
{
|
||||
if (pWin->redirectDraw != RedirectDrawNone) {
|
||||
CompWindowPtr cw = GetCompWindow(pWin);
|
||||
|
||||
if (cw->damaged)
|
||||
{
|
||||
if (cw->damaged) {
|
||||
compWindowUpdateAutomatic(pWin);
|
||||
cw->damaged = FALSE;
|
||||
}
|
||||
|
|
@ -778,7 +757,8 @@ CompositeRealChildHead (WindowPtr pWin)
|
|||
pChildBefore = pWin->firstChild;
|
||||
pChild = pChildBefore->nextSib;
|
||||
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
pChildBefore = NullWindow;
|
||||
pChild = pWin->firstChild;
|
||||
}
|
||||
|
|
@ -790,7 +770,8 @@ CompositeRealChildHead (WindowPtr pWin)
|
|||
cs = GetCompScreen(pWin->drawable.pScreen);
|
||||
if (pChild == cs->pOverlayWin) {
|
||||
return pChild;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return pChildBefore;
|
||||
}
|
||||
}
|
||||
|
|
@ -806,8 +787,7 @@ compConfigNotify(WindowPtr pWin, int x, int y, int w, int h,
|
|||
int draw_x, draw_y;
|
||||
Bool alloc_ret;
|
||||
|
||||
if (cs->ConfigNotify)
|
||||
{
|
||||
if (cs->ConfigNotify) {
|
||||
pScreen->ConfigNotify = cs->ConfigNotify;
|
||||
ret = (*pScreen->ConfigNotify) (pWin, x, y, w, h, bw, pSib);
|
||||
cs->ConfigNotify = pScreen->ConfigNotify;
|
||||
|
|
|
|||
|
|
@ -112,18 +112,15 @@ device_is_duplicate(const char *config_info)
|
|||
{
|
||||
DeviceIntPtr dev;
|
||||
|
||||
for (dev = inputInfo.devices; dev; dev = dev->next)
|
||||
{
|
||||
for (dev = inputInfo.devices; dev; dev = dev->next) {
|
||||
if (dev->config_info && (strcmp(dev->config_info, config_info) == 0))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
for (dev = inputInfo.off_devices; dev; dev = dev->next)
|
||||
{
|
||||
for (dev = inputInfo.off_devices; dev; dev = dev->next) {
|
||||
if (dev->config_info && (strcmp(dev->config_info, config_info) == 0))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -57,7 +57,8 @@ wakeup_handler(pointer data, int err, pointer read_mask)
|
|||
dbus_connection_read_write_dispatch(info->connection, 0);
|
||||
} while (info->connection &&
|
||||
dbus_connection_get_is_connected(info->connection) &&
|
||||
dbus_connection_get_dispatch_status(info->connection) == DBUS_DISPATCH_DATA_REMAINS);
|
||||
dbus_connection_get_dispatch_status(info->connection) ==
|
||||
DBUS_DISPATCH_DATA_REMAINS);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -110,8 +111,7 @@ message_filter(DBusConnection *connection, DBusMessage *message, void *data)
|
|||
/* If we get disconnected, then take everything down, and attempt to
|
||||
* reconnect immediately (assuming it's just a restart). The
|
||||
* connection isn't valid at this point, so throw it out immediately. */
|
||||
if (dbus_message_is_signal(message, DBUS_INTERFACE_LOCAL,
|
||||
"Disconnected")) {
|
||||
if (dbus_message_is_signal(message, DBUS_INTERFACE_LOCAL, "Disconnected")) {
|
||||
DebugF("[config/dbus-core] disconnected from bus\n");
|
||||
bus_info.connection = NULL;
|
||||
teardown();
|
||||
|
|
@ -202,8 +202,7 @@ config_dbus_core_add_hook(struct config_dbus_core_hook *hook)
|
|||
{
|
||||
struct config_dbus_core_hook **prev;
|
||||
|
||||
for (prev = &bus_info.hooks; *prev; prev = &(*prev)->next)
|
||||
;
|
||||
for (prev = &bus_info.hooks; *prev; prev = &(*prev)->next);
|
||||
|
||||
hook->next = NULL;
|
||||
*prev = hook;
|
||||
|
|
|
|||
|
|
@ -89,6 +89,7 @@ add_device(DBusMessage *message, DBusMessage *reply, DBusError *error)
|
|||
/* signature should be [ss][ss]... */
|
||||
while (dbus_message_iter_get_arg_type(&iter) == DBUS_TYPE_ARRAY) {
|
||||
char *key, *value;
|
||||
|
||||
dbus_message_iter_recurse(&iter, &subiter);
|
||||
|
||||
if (dbus_message_iter_get_arg_type(&subiter) != DBUS_TYPE_STRING)
|
||||
|
|
@ -336,8 +337,7 @@ connect_hook(DBusConnection *connection, void *data)
|
|||
}
|
||||
|
||||
if (!dbus_connection_register_object_path(info->connection,
|
||||
info->busobject, &vtable,
|
||||
info)) {
|
||||
info->busobject, &vtable, info)) {
|
||||
ErrorF("[config/dbus] couldn't register object path\n");
|
||||
goto err_match;
|
||||
}
|
||||
|
|
@ -372,8 +372,7 @@ pre_disconnect_hook(void)
|
|||
dbus_error_init(&error);
|
||||
dbus_connection_unregister_object_path(connection_data->connection,
|
||||
connection_data->busobject);
|
||||
dbus_bus_remove_match(connection_data->connection, MATCH_RULE,
|
||||
&error);
|
||||
dbus_bus_remove_match(connection_data->connection, MATCH_RULE, &error);
|
||||
dbus_bus_release_name(connection_data->connection,
|
||||
connection_data->busname, &error);
|
||||
dbus_error_free(&error);
|
||||
|
|
@ -381,6 +380,7 @@ pre_disconnect_hook(void)
|
|||
#endif
|
||||
|
||||
static struct connection_info connection_data;
|
||||
|
||||
static struct config_dbus_core_hook core_hook = {
|
||||
.connect = connect_hook,
|
||||
.disconnect = disconnect_hook,
|
||||
|
|
|
|||
165
config/hal.c
165
config/hal.c
|
|
@ -39,11 +39,9 @@
|
|||
#include "config-backends.h"
|
||||
#include "os.h"
|
||||
|
||||
|
||||
#define LIBHAL_PROP_KEY "input.x11_options."
|
||||
#define LIBHAL_XKB_PROP_KEY "input.xkb."
|
||||
|
||||
|
||||
struct config_hal_info {
|
||||
DBusConnection *system_bus;
|
||||
LibHalContext *hal_ctx;
|
||||
|
|
@ -77,7 +75,8 @@ get_prop_string(LibHalContext *hal_ctx, const char *udi, const char *name)
|
|||
char *prop, *ret;
|
||||
|
||||
prop = libhal_device_get_property_string(hal_ctx, udi, name, NULL);
|
||||
LogMessageVerb(X_INFO, 10, "config/hal: getting %s on %s returned %s\n", name, udi, prop ? prop : "(null)");
|
||||
LogMessageVerb(X_INFO, 10, "config/hal: getting %s on %s returned %s\n",
|
||||
name, udi, prop ? prop : "(null)");
|
||||
if (prop) {
|
||||
ret = strdup(prop);
|
||||
libhal_free_string(prop);
|
||||
|
|
@ -90,7 +89,8 @@ get_prop_string(LibHalContext *hal_ctx, const char *udi, const char *name)
|
|||
}
|
||||
|
||||
static char *
|
||||
get_prop_string_array(LibHalContext *hal_ctx, const char *udi, const char *prop)
|
||||
get_prop_string_array(LibHalContext * hal_ctx, const char *udi,
|
||||
const char *prop)
|
||||
{
|
||||
char **props, *ret, *str;
|
||||
int i, len = 0;
|
||||
|
|
@ -139,19 +139,20 @@ device_added(LibHalContext *hal_ctx, const char *udi)
|
|||
LibHalPropertySetIterator set_iter;
|
||||
char *psi_key = NULL, *tmp_val;
|
||||
|
||||
|
||||
dbus_error_init(&error);
|
||||
|
||||
driver = get_prop_string(hal_ctx, udi, "input.x11_driver");
|
||||
if (!driver) {
|
||||
/* verbose, don't tell the user unless they _want_ to see it */
|
||||
LogMessageVerb(X_INFO,7,"config/hal: no driver specified for device %s\n", udi);
|
||||
LogMessageVerb(X_INFO, 7,
|
||||
"config/hal: no driver specified for device %s\n", udi);
|
||||
goto unwind;
|
||||
}
|
||||
|
||||
path = get_prop_string(hal_ctx, udi, "input.device");
|
||||
if (!path) {
|
||||
LogMessage(X_WARNING,"config/hal: no driver or path specified for %s\n", udi);
|
||||
LogMessage(X_WARNING,
|
||||
"config/hal: no driver or path specified for %s\n", udi);
|
||||
goto unwind;
|
||||
}
|
||||
attrs.device = strdup(path);
|
||||
|
|
@ -207,7 +208,8 @@ device_added(LibHalContext *hal_ctx, const char *udi)
|
|||
|
||||
input_options = input_option_new(NULL, "_source", "server/hal");
|
||||
if (!input_options) {
|
||||
LogMessage(X_ERROR, "config/hal: couldn't allocate first key/value pair\n");
|
||||
LogMessage(X_ERROR,
|
||||
"config/hal: couldn't allocate first key/value pair\n");
|
||||
goto unwind;
|
||||
}
|
||||
|
||||
|
|
@ -226,9 +228,9 @@ device_added(LibHalContext *hal_ctx, const char *udi)
|
|||
}
|
||||
|
||||
/* Check for duplicate devices */
|
||||
if (device_is_duplicate(config_info))
|
||||
{
|
||||
LogMessage(X_WARNING, "config/hal: device %s already added. Ignoring.\n", name);
|
||||
if (device_is_duplicate(config_info)) {
|
||||
LogMessage(X_WARNING,
|
||||
"config/hal: device %s already added. Ignoring.\n", name);
|
||||
goto unwind;
|
||||
}
|
||||
|
||||
|
|
@ -237,7 +239,8 @@ device_added(LibHalContext *hal_ctx, const char *udi)
|
|||
set = libhal_device_get_all_properties(hal_ctx, udi, &error);
|
||||
|
||||
if (!set) {
|
||||
LogMessage(X_ERROR, "config/hal: couldn't get property list for %s: %s (%s)\n",
|
||||
LogMessage(X_ERROR,
|
||||
"config/hal: couldn't get property list for %s: %s (%s)\n",
|
||||
udi, error.name, error.message);
|
||||
goto unwind;
|
||||
}
|
||||
|
|
@ -250,7 +253,8 @@ device_added(LibHalContext *hal_ctx, const char *udi)
|
|||
if (psi_key) {
|
||||
|
||||
/* normal options first (input.x11_options.<propname>) */
|
||||
if (!strncasecmp(psi_key, LIBHAL_PROP_KEY, sizeof(LIBHAL_PROP_KEY)-1)){
|
||||
if (!strncasecmp
|
||||
(psi_key, LIBHAL_PROP_KEY, sizeof(LIBHAL_PROP_KEY) - 1)) {
|
||||
char *tmp;
|
||||
|
||||
/* only support strings for all values */
|
||||
|
|
@ -265,48 +269,52 @@ 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.
|
||||
*/
|
||||
if ((tmp = strcasestr(psi_key, "xkb")) && strlen(tmp) >= 4)
|
||||
{
|
||||
if (!strcasecmp(&tmp[3], "layout"))
|
||||
{
|
||||
if ((tmp = strcasestr(psi_key, "xkb")) && strlen(tmp) >= 4) {
|
||||
if (!strcasecmp(&tmp[3], "layout")) {
|
||||
free(xkb_opts.layout);
|
||||
xkb_opts.layout = strdup(tmp_val);
|
||||
} else if (!strcasecmp(&tmp[3], "model"))
|
||||
{
|
||||
}
|
||||
else if (!strcasecmp(&tmp[3], "model")) {
|
||||
free(xkb_opts.model);
|
||||
xkb_opts.model = strdup(tmp_val);
|
||||
} else if (!strcasecmp(&tmp[3], "rules"))
|
||||
{
|
||||
}
|
||||
else if (!strcasecmp(&tmp[3], "rules")) {
|
||||
free(xkb_opts.rules);
|
||||
xkb_opts.rules = strdup(tmp_val);
|
||||
} else if (!strcasecmp(&tmp[3], "variant"))
|
||||
{
|
||||
}
|
||||
else if (!strcasecmp(&tmp[3], "variant")) {
|
||||
free(xkb_opts.variant);
|
||||
xkb_opts.variant = strdup(tmp_val);
|
||||
} else if (!strcasecmp(&tmp[3], "options"))
|
||||
{
|
||||
}
|
||||
else if (!strcasecmp(&tmp[3], "options")) {
|
||||
free(xkb_opts.options);
|
||||
xkb_opts.options = strdup(tmp_val);
|
||||
}
|
||||
} else
|
||||
{
|
||||
}
|
||||
else {
|
||||
/* all others */
|
||||
input_options = input_option_new(input_options, psi_key + sizeof(LIBHAL_PROP_KEY)-1, tmp_val);
|
||||
input_options =
|
||||
input_option_new(input_options,
|
||||
psi_key + sizeof(LIBHAL_PROP_KEY) -
|
||||
1, tmp_val);
|
||||
free(tmp_val);
|
||||
}
|
||||
} else
|
||||
{
|
||||
}
|
||||
else {
|
||||
/* server 1.4 had xkb_options as strlist. */
|
||||
if ((tmp = strcasestr(psi_key, "xkb")) &&
|
||||
(strlen(tmp) >= 4) &&
|
||||
(!strcasecmp(&tmp[3], "options")) &&
|
||||
(tmp_val = get_prop_string_array(hal_ctx, udi, psi_key)))
|
||||
{
|
||||
(tmp_val =
|
||||
get_prop_string_array(hal_ctx, udi, psi_key))) {
|
||||
free(xkb_opts.options);
|
||||
xkb_opts.options = strdup(tmp_val);
|
||||
}
|
||||
}
|
||||
} else if (!strncasecmp(psi_key, LIBHAL_XKB_PROP_KEY, sizeof(LIBHAL_XKB_PROP_KEY)-1)){
|
||||
}
|
||||
else if (!strncasecmp
|
||||
(psi_key, LIBHAL_XKB_PROP_KEY,
|
||||
sizeof(LIBHAL_XKB_PROP_KEY) - 1)) {
|
||||
char *tmp;
|
||||
|
||||
/* only support strings for all values */
|
||||
|
|
@ -316,34 +324,33 @@ device_added(LibHalContext *hal_ctx, const char *udi)
|
|||
|
||||
tmp = &psi_key[sizeof(LIBHAL_XKB_PROP_KEY) - 1];
|
||||
|
||||
if (!strcasecmp(tmp, "layout"))
|
||||
{
|
||||
if (!strcasecmp(tmp, "layout")) {
|
||||
if (!xkb_opts.layout)
|
||||
xkb_opts.layout = strdup(tmp_val);
|
||||
} else if (!strcasecmp(tmp, "rules"))
|
||||
{
|
||||
}
|
||||
else if (!strcasecmp(tmp, "rules")) {
|
||||
if (!xkb_opts.rules)
|
||||
xkb_opts.rules = strdup(tmp_val);
|
||||
} else if (!strcasecmp(tmp, "variant"))
|
||||
{
|
||||
}
|
||||
else if (!strcasecmp(tmp, "variant")) {
|
||||
if (!xkb_opts.variant)
|
||||
xkb_opts.variant = strdup(tmp_val);
|
||||
} else if (!strcasecmp(tmp, "model"))
|
||||
{
|
||||
}
|
||||
else if (!strcasecmp(tmp, "model")) {
|
||||
if (!xkb_opts.model)
|
||||
xkb_opts.model = strdup(tmp_val);
|
||||
} else if (!strcasecmp(tmp, "options"))
|
||||
{
|
||||
}
|
||||
else if (!strcasecmp(tmp, "options")) {
|
||||
if (!xkb_opts.options)
|
||||
xkb_opts.options = strdup(tmp_val);
|
||||
}
|
||||
free(tmp_val);
|
||||
} else
|
||||
{
|
||||
}
|
||||
else {
|
||||
/* server 1.4 had xkb options as strlist */
|
||||
tmp_val = get_prop_string_array(hal_ctx, udi, psi_key);
|
||||
if (tmp_val && strlen(psi_key) >= sizeof(LIBHAL_XKB_PROP_KEY))
|
||||
{
|
||||
if (tmp_val &&
|
||||
strlen(psi_key) >= sizeof(LIBHAL_XKB_PROP_KEY)) {
|
||||
tmp = &psi_key[sizeof(LIBHAL_XKB_PROP_KEY) - 1];
|
||||
if (!strcasecmp(tmp, ".options") && (!xkb_opts.options))
|
||||
xkb_opts.options = strdup(tmp_val);
|
||||
|
|
@ -357,24 +364,29 @@ device_added(LibHalContext *hal_ctx, const char *udi)
|
|||
libhal_psi_next(&set_iter);
|
||||
}
|
||||
|
||||
|
||||
/* Now add xkb options */
|
||||
if (xkb_opts.layout)
|
||||
input_options = input_option_new(input_options, "xkb_layout", xkb_opts.layout);
|
||||
input_options =
|
||||
input_option_new(input_options, "xkb_layout", xkb_opts.layout);
|
||||
if (xkb_opts.rules)
|
||||
input_options = input_option_new(input_options, "xkb_rules", xkb_opts.rules);
|
||||
input_options =
|
||||
input_option_new(input_options, "xkb_rules", xkb_opts.rules);
|
||||
if (xkb_opts.variant)
|
||||
input_options = input_option_new(input_options, "xkb_variant", xkb_opts.variant);
|
||||
input_options =
|
||||
input_option_new(input_options, "xkb_variant", xkb_opts.variant);
|
||||
if (xkb_opts.model)
|
||||
input_options = input_option_new(input_options, "xkb_model", xkb_opts.model);
|
||||
input_options =
|
||||
input_option_new(input_options, "xkb_model", xkb_opts.model);
|
||||
if (xkb_opts.options)
|
||||
input_options = input_option_new(input_options, "xkb_options", xkb_opts.options);
|
||||
input_options =
|
||||
input_option_new(input_options, "xkb_options", xkb_opts.options);
|
||||
input_options = input_option_new(input_options, "config_info", config_info);
|
||||
|
||||
/* this isn't an error, but how else do you output something that the user can see? */
|
||||
LogMessage(X_INFO, "config/hal: Adding input device %s\n", name);
|
||||
if ((rc = NewInputDeviceRequest(input_options, &attrs, &dev)) != Success) {
|
||||
LogMessage(X_ERROR, "config/hal: NewInputDeviceRequest failed (%d)\n", rc);
|
||||
LogMessage(X_ERROR, "config/hal: NewInputDeviceRequest failed (%d)\n",
|
||||
rc);
|
||||
dev = NULL;
|
||||
goto unwind;
|
||||
}
|
||||
|
|
@ -395,6 +407,7 @@ unwind:
|
|||
free(attrs.usb_id);
|
||||
if (attrs.tags) {
|
||||
char **tag = attrs.tags;
|
||||
|
||||
while (*tag) {
|
||||
free(*tag);
|
||||
tag++;
|
||||
|
|
@ -423,7 +436,8 @@ disconnect_hook(void *data)
|
|||
if (dbus_connection_get_is_connected(info->system_bus)) {
|
||||
dbus_error_init(&error);
|
||||
if (!libhal_ctx_shutdown(info->hal_ctx, &error))
|
||||
LogMessage(X_WARNING, "config/hal: disconnect_hook couldn't shut down context: %s (%s)\n",
|
||||
LogMessage(X_WARNING,
|
||||
"config/hal: disconnect_hook couldn't shut down context: %s (%s)\n",
|
||||
error.name, error.message);
|
||||
dbus_error_free(&error);
|
||||
}
|
||||
|
|
@ -455,17 +469,20 @@ connect_and_register(DBusConnection *connection, struct config_hal_info *info)
|
|||
}
|
||||
|
||||
if (!libhal_ctx_set_dbus_connection(info->hal_ctx, info->system_bus)) {
|
||||
LogMessage(X_ERROR, "config/hal: couldn't associate HAL context with bus\n");
|
||||
LogMessage(X_ERROR,
|
||||
"config/hal: couldn't associate HAL context with bus\n");
|
||||
goto out_err;
|
||||
}
|
||||
if (!libhal_ctx_init(info->hal_ctx, &error)) {
|
||||
LogMessage(X_ERROR, "config/hal: couldn't initialise context: %s (%s)\n",
|
||||
LogMessage(X_ERROR,
|
||||
"config/hal: couldn't initialise context: %s (%s)\n",
|
||||
error.name ? error.name : "unknown error",
|
||||
error.message ? error.message : "null");
|
||||
goto out_err;
|
||||
}
|
||||
if (!libhal_device_property_watch_all(info->hal_ctx, &error)) {
|
||||
LogMessage(X_ERROR, "config/hal: couldn't watch all properties: %s (%s)\n",
|
||||
LogMessage(X_ERROR,
|
||||
"config/hal: couldn't watch all properties: %s (%s)\n",
|
||||
error.name ? error.name : "unknown error",
|
||||
error.message ? error.message : "null");
|
||||
goto out_ctx;
|
||||
|
|
@ -494,7 +511,8 @@ out_ctx:
|
|||
dbus_error_free(&error);
|
||||
|
||||
if (!libhal_ctx_shutdown(info->hal_ctx, &error)) {
|
||||
LogMessage(X_WARNING, "config/hal: couldn't shut down context: %s (%s)\n",
|
||||
LogMessage(X_WARNING,
|
||||
"config/hal: couldn't shut down context: %s (%s)\n",
|
||||
error.name ? error.name : "unknown error",
|
||||
error.message ? error.message : "null");
|
||||
dbus_error_free(&error);
|
||||
|
|
@ -513,7 +531,6 @@ out_err:
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Handle NewOwnerChanged signals to deal with HAL startup at X server runtime.
|
||||
*
|
||||
|
|
@ -523,13 +540,13 @@ out_err:
|
|||
* owner.
|
||||
*/
|
||||
static DBusHandlerResult
|
||||
ownerchanged_handler(DBusConnection *connection, DBusMessage *message, void *data)
|
||||
ownerchanged_handler(DBusConnection * connection, DBusMessage * message,
|
||||
void *data)
|
||||
{
|
||||
int ret = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
|
||||
|
||||
if (dbus_message_is_signal(message,
|
||||
"org.freedesktop.DBus",
|
||||
"NameOwnerChanged")) {
|
||||
"org.freedesktop.DBus", "NameOwnerChanged")) {
|
||||
DBusError error;
|
||||
char *name, *old_owner, *new_owner;
|
||||
|
||||
|
|
@ -537,17 +554,19 @@ ownerchanged_handler(DBusConnection *connection, DBusMessage *message, void *dat
|
|||
dbus_message_get_args(message, &error,
|
||||
DBUS_TYPE_STRING, &name,
|
||||
DBUS_TYPE_STRING, &old_owner,
|
||||
DBUS_TYPE_STRING, &new_owner,
|
||||
DBUS_TYPE_INVALID);
|
||||
DBUS_TYPE_STRING, &new_owner, DBUS_TYPE_INVALID);
|
||||
|
||||
if (dbus_error_is_set(&error)) {
|
||||
ErrorF("[config/hal] failed to get NameOwnerChanged args: %s (%s)\n",
|
||||
ErrorF
|
||||
("[config/hal] failed to get NameOwnerChanged args: %s (%s)\n",
|
||||
error.name, error.message);
|
||||
} else if (name && strcmp(name, "org.freedesktop.Hal") == 0) {
|
||||
}
|
||||
else if (name && strcmp(name, "org.freedesktop.Hal") == 0) {
|
||||
|
||||
if (!old_owner || !strlen(old_owner)) {
|
||||
DebugF("[config/hal] HAL startup detected.\n");
|
||||
if (connect_and_register(connection, (struct config_hal_info*)data))
|
||||
if (connect_and_register
|
||||
(connection, (struct config_hal_info *) data))
|
||||
dbus_connection_unregister_object_path(connection,
|
||||
"/org/freedesktop/DBus");
|
||||
else
|
||||
|
|
@ -573,8 +592,7 @@ listen_for_startup(DBusConnection *connection, void *data)
|
|||
const char MATCH_RULE[] = "sender='org.freedesktop.DBus',"
|
||||
"interface='org.freedesktop.DBus',"
|
||||
"type='signal',"
|
||||
"path='/org/freedesktop/DBus',"
|
||||
"member='NameOwnerChanged'";
|
||||
"path='/org/freedesktop/DBus'," "member='NameOwnerChanged'";
|
||||
int rc = FALSE;
|
||||
|
||||
dbus_error_init(&error);
|
||||
|
|
@ -582,12 +600,12 @@ listen_for_startup(DBusConnection *connection, void *data)
|
|||
if (!dbus_error_is_set(&error)) {
|
||||
if (dbus_connection_register_object_path(connection,
|
||||
"/org/freedesktop/DBus",
|
||||
&vtable,
|
||||
data))
|
||||
&vtable, data))
|
||||
rc = TRUE;
|
||||
else
|
||||
ErrorF("[config/hal] cannot register object path.\n");
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
ErrorF("[config/hal] couldn't add match rule: %s (%s)\n", error.name,
|
||||
error.message);
|
||||
ErrorF("[config/hal] cannot detect a HAL startup.\n");
|
||||
|
|
@ -612,6 +630,7 @@ connect_hook(DBusConnection *connection, void *data)
|
|||
}
|
||||
|
||||
static struct config_hal_info hal_info;
|
||||
|
||||
static struct config_dbus_core_hook hook = {
|
||||
.connect = connect_hook,
|
||||
.disconnect = disconnect_hook,
|
||||
|
|
|
|||
|
|
@ -88,8 +88,7 @@ device_added(struct udev_device *udev_device)
|
|||
if (!udev_device_get_property_value(udev_device, "ID_INPUT")) {
|
||||
LogMessageVerb(X_INFO, 10,
|
||||
"config/udev: ignoring device %s without "
|
||||
"property ID_INPUT set\n",
|
||||
path);
|
||||
"property ID_INPUT set\n", path);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -116,7 +115,8 @@ device_added(struct udev_device *udev_device)
|
|||
LOG_SYSATTR(ppath, "id", pnp_id);
|
||||
|
||||
/* construct USB ID in lowercase hex - "0000:ffff" */
|
||||
if (product && sscanf(product, "%*x/%4x/%4x/%*x", &usb_vendor, &usb_model) == 2) {
|
||||
if (product &&
|
||||
sscanf(product, "%*x/%4x/%4x/%*x", &usb_vendor, &usb_model) == 2) {
|
||||
if (asprintf(&attrs.usb_id, "%04x:%04x", usb_vendor, usb_model)
|
||||
== -1)
|
||||
attrs.usb_id = NULL;
|
||||
|
|
@ -155,39 +155,50 @@ device_added(struct udev_device *udev_device)
|
|||
if (!key)
|
||||
continue;
|
||||
value = udev_list_entry_get_value(entry);
|
||||
if (!strncasecmp(key, UDEV_XKB_PROP_KEY,
|
||||
sizeof(UDEV_XKB_PROP_KEY) - 1)) {
|
||||
if (!strncasecmp(key, UDEV_XKB_PROP_KEY, sizeof(UDEV_XKB_PROP_KEY) - 1)) {
|
||||
LOG_PROPERTY(path, key, value);
|
||||
tmp = key + sizeof(UDEV_XKB_PROP_KEY) - 1;
|
||||
if (!strcasecmp(tmp, "rules"))
|
||||
input_options = input_option_new(input_options, "xkb_rules", value);
|
||||
input_options =
|
||||
input_option_new(input_options, "xkb_rules", value);
|
||||
else if (!strcasecmp(tmp, "layout"))
|
||||
input_options = input_option_new(input_options, "xkb_layout", value);
|
||||
input_options =
|
||||
input_option_new(input_options, "xkb_layout", value);
|
||||
else if (!strcasecmp(tmp, "variant"))
|
||||
input_options = input_option_new(input_options, "xkb_variant", value);
|
||||
input_options =
|
||||
input_option_new(input_options, "xkb_variant", value);
|
||||
else if (!strcasecmp(tmp, "model"))
|
||||
input_options = input_option_new(input_options, "xkb_model", value);
|
||||
input_options =
|
||||
input_option_new(input_options, "xkb_model", value);
|
||||
else if (!strcasecmp(tmp, "options"))
|
||||
input_options = input_option_new(input_options, "xkb_options", value);
|
||||
} else if (!strcmp(key, "ID_VENDOR")) {
|
||||
input_options =
|
||||
input_option_new(input_options, "xkb_options", value);
|
||||
}
|
||||
else if (!strcmp(key, "ID_VENDOR")) {
|
||||
LOG_PROPERTY(path, key, value);
|
||||
attrs.vendor = strdup(value);
|
||||
} else if (!strcmp(key, "ID_INPUT_KEY")) {
|
||||
}
|
||||
else if (!strcmp(key, "ID_INPUT_KEY")) {
|
||||
LOG_PROPERTY(path, key, value);
|
||||
attrs.flags |= ATTR_KEYBOARD;
|
||||
} else if (!strcmp(key, "ID_INPUT_MOUSE")) {
|
||||
}
|
||||
else if (!strcmp(key, "ID_INPUT_MOUSE")) {
|
||||
LOG_PROPERTY(path, key, value);
|
||||
attrs.flags |= ATTR_POINTER;
|
||||
} else if (!strcmp(key, "ID_INPUT_JOYSTICK")) {
|
||||
}
|
||||
else if (!strcmp(key, "ID_INPUT_JOYSTICK")) {
|
||||
LOG_PROPERTY(path, key, value);
|
||||
attrs.flags |= ATTR_JOYSTICK;
|
||||
} else if (!strcmp(key, "ID_INPUT_TABLET")) {
|
||||
}
|
||||
else if (!strcmp(key, "ID_INPUT_TABLET")) {
|
||||
LOG_PROPERTY(path, key, value);
|
||||
attrs.flags |= ATTR_TABLET;
|
||||
} else if (!strcmp(key, "ID_INPUT_TOUCHPAD")) {
|
||||
}
|
||||
else if (!strcmp(key, "ID_INPUT_TOUCHPAD")) {
|
||||
LOG_PROPERTY(path, key, value);
|
||||
attrs.flags |= ATTR_TOUCHPAD;
|
||||
} else if (!strcmp(key, "ID_INPUT_TOUCHSCREEN")) {
|
||||
}
|
||||
else if (!strcmp(key, "ID_INPUT_TOUCHSCREEN")) {
|
||||
LOG_PROPERTY(path, key, value);
|
||||
attrs.flags |= ATTR_TOUCHSCREEN;
|
||||
}
|
||||
|
|
@ -212,6 +223,7 @@ device_added(struct udev_device *udev_device)
|
|||
free(attrs.vendor);
|
||||
if (attrs.tags) {
|
||||
char **tag = attrs.tags;
|
||||
|
||||
while (*tag) {
|
||||
free(*tag);
|
||||
tag++;
|
||||
|
|
@ -282,7 +294,8 @@ config_udev_init(void)
|
|||
if (!udev_monitor)
|
||||
return 0;
|
||||
|
||||
udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "input", NULL);
|
||||
udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "input",
|
||||
NULL);
|
||||
udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "tty", NULL); /* For Wacom serial devices */
|
||||
|
||||
#ifdef HAVE_UDEV_MONITOR_FILTER_ADD_MATCH_TAG
|
||||
|
|
@ -311,7 +324,8 @@ config_udev_init(void)
|
|||
devices = udev_enumerate_get_list_entry(enumerate);
|
||||
udev_list_entry_foreach(device, devices) {
|
||||
const char *syspath = udev_list_entry_get_name(device);
|
||||
struct udev_device *udev_device = udev_device_new_from_syspath(udev, syspath);
|
||||
struct udev_device *udev_device =
|
||||
udev_device_new_from_syspath(udev, syspath);
|
||||
|
||||
/* Device might be gone by the time we try to open it */
|
||||
if (!udev_device)
|
||||
|
|
|
|||
|
|
@ -52,7 +52,9 @@
|
|||
struct nameint {
|
||||
int val;
|
||||
char *name;
|
||||
} kbdenc[] = { KB_OVRENC, KB_ENCTAB, { 0 } };
|
||||
} kbdenc[] = {
|
||||
KB_OVRENC, KB_ENCTAB, {
|
||||
0}};
|
||||
|
||||
struct nameint kbdvar[] = {
|
||||
{KB_NODEAD | KB_SG, "de_nodeadkeys"},
|
||||
|
|
@ -108,15 +110,13 @@ wscons_add_keyboard(void)
|
|||
}
|
||||
close(fd);
|
||||
|
||||
input_options = input_option_new(input_options, "_source",
|
||||
"server/wscons");
|
||||
input_options = input_option_new(input_options, "_source", "server/wscons");
|
||||
if (input_options == NULL)
|
||||
return;
|
||||
|
||||
LogMessage(X_INFO, "config/wscons: checking input device %s\n",
|
||||
WSCONS_KBD_DEVICE);
|
||||
input_options = input_option_new(input_options, "name",
|
||||
WSCONS_KBD_DEVICE);
|
||||
input_options = input_option_new(input_options, "name", WSCONS_KBD_DEVICE);
|
||||
input_options = input_option_new(input_options, "driver", "kbd");
|
||||
|
||||
config_info = Xprintf("wscons:%s", WSCONS_KBD_DEVICE);
|
||||
|
|
@ -136,8 +136,7 @@ wscons_add_keyboard(void)
|
|||
break;
|
||||
}
|
||||
for (i = 0; kbdvar[i].val; i++)
|
||||
if (wsenc == kbdvar[i].val ||
|
||||
KB_VARIANT(wsenc) == kbdvar[i].val) {
|
||||
if (wsenc == kbdvar[i].val || KB_VARIANT(wsenc) == kbdvar[i].val) {
|
||||
LogMessageVerb(X_INFO, 3, "wskbd: using variant %s\n",
|
||||
kbdvar[i].name);
|
||||
input_options = input_option_new(input_options,
|
||||
|
|
@ -188,17 +187,13 @@ wscons_add_pointer(const char *path, const char *driver, int flags)
|
|||
if (!config_info)
|
||||
return;
|
||||
|
||||
input_options = input_option_new(input_options, "_source",
|
||||
"server/wscons");
|
||||
input_options = input_option_new(input_options, "_source", "server/wscons");
|
||||
if (input_options == NULL)
|
||||
return;
|
||||
|
||||
input_options = input_option_new(input_options, "name",
|
||||
strdup(path));
|
||||
input_options = input_option_new(input_options, "driver",
|
||||
strdup(driver));
|
||||
input_options = input_option_new(input_options, "device",
|
||||
strdup(path));
|
||||
input_options = input_option_new(input_options, "name", strdup(path));
|
||||
input_options = input_option_new(input_options, "driver", strdup(driver));
|
||||
input_options = input_option_new(input_options, "device", strdup(path));
|
||||
LogMessage(X_INFO, "config/wscons: checking input device %s\n", path);
|
||||
attrs.flags |= flags;
|
||||
rc = NewInputDeviceRequest(input_options, &attrs, &dev);
|
||||
|
|
@ -221,13 +216,11 @@ wscons_add_pointers(void)
|
|||
|
||||
/* Check pointing devices */
|
||||
for (i = 0; i < 4; i++) {
|
||||
snprintf(devname, sizeof(devname), "%s%d",
|
||||
WSCONS_MOUSE_PREFIX, i);
|
||||
snprintf(devname, sizeof(devname), "%s%d", WSCONS_MOUSE_PREFIX, i);
|
||||
LogMessageVerb(X_INFO, 10, "wsmouse: checking %s\n", devname);
|
||||
fd = open_device(devnamem O_RDWR | O_NONBLOCK | O_EXCL);
|
||||
if (fd == -1) {
|
||||
LogMessageVerb(X_WARNING, 10, "%s: %s\n", devname,
|
||||
strerror(errno));
|
||||
LogMessageVerb(X_WARNING, 10, "%s: %s\n", devname, strerror(errno));
|
||||
continue;
|
||||
}
|
||||
if (ioctl(fd, WSMOUSEIO_GTYPE, &wsmouse_type) != 0) {
|
||||
|
|
@ -239,8 +232,7 @@ wscons_add_pointers(void)
|
|||
close(fd);
|
||||
switch (wsmouse_type) {
|
||||
case WSMOUSE_TYPE_SYNAPTICS:
|
||||
wscons_add_pointer(devname, "synaptics",
|
||||
ATTR_TOUCHPAD);
|
||||
wscons_add_pointer(devname, "synaptics", ATTR_TOUCHPAD);
|
||||
break;
|
||||
case WSMOUSE_TYPE_TPANEL:
|
||||
wscons_add_pointer(devname, "ws", ATTR_TOUCHSCREEN);
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ static RESTYPE DamageExtType;
|
|||
static RESTYPE DamageExtWinType;
|
||||
|
||||
static DevPrivateKeyRec DamageClientPrivateKeyRec;
|
||||
|
||||
#define DamageClientPrivateKey (&DamageClientPrivateKeyRec)
|
||||
|
||||
static void
|
||||
|
|
@ -54,10 +55,8 @@ DamageExtNotify (DamageExtPtr pDamageExt, BoxPtr pBoxes, int nBoxes)
|
|||
ev.geometry.y = pDrawable->y;
|
||||
ev.geometry.width = pDrawable->width;
|
||||
ev.geometry.height = pDrawable->height;
|
||||
if (pBoxes)
|
||||
{
|
||||
for (i = 0; i < nBoxes; i++)
|
||||
{
|
||||
if (pBoxes) {
|
||||
for (i = 0; i < nBoxes; i++) {
|
||||
ev.level = pDamageExt->level;
|
||||
if (i < nBoxes - 1)
|
||||
ev.level |= DamageNotifyMore;
|
||||
|
|
@ -68,8 +67,7 @@ DamageExtNotify (DamageExtPtr pDamageExt, BoxPtr pBoxes, int nBoxes)
|
|||
WriteEventsToClient(pClient, 1, (xEvent *) &ev);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
ev.area.x = 0;
|
||||
ev.area.y = 0;
|
||||
ev.area.width = pDrawable->width;
|
||||
|
|
@ -77,8 +75,7 @@ DamageExtNotify (DamageExtPtr pDamageExt, BoxPtr pBoxes, int nBoxes)
|
|||
WriteEventsToClient(pClient, 1, (xEvent *) &ev);
|
||||
}
|
||||
/* Composite extension marks clients with manual Subwindows as critical */
|
||||
if (pDamageClient->critical > 0)
|
||||
{
|
||||
if (pDamageClient->critical > 0) {
|
||||
SetCriticalOutputPending();
|
||||
pClient->smart_priority = SMART_MAX_PRIORITY;
|
||||
}
|
||||
|
|
@ -92,7 +89,8 @@ DamageExtReport (DamagePtr pDamage, RegionPtr pRegion, void *closure)
|
|||
switch (pDamageExt->level) {
|
||||
case DamageReportRawRegion:
|
||||
case DamageReportDeltaRegion:
|
||||
DamageExtNotify (pDamageExt, RegionRects(pRegion), RegionNumRects(pRegion));
|
||||
DamageExtNotify(pDamageExt, RegionRects(pRegion),
|
||||
RegionNumRects(pRegion));
|
||||
break;
|
||||
case DamageReportBoundingBox:
|
||||
DamageExtNotify(pDamageExt, RegionExtents(pRegion), 1);
|
||||
|
|
@ -129,6 +127,7 @@ ProcDamageQueryVersion(ClientPtr client)
|
|||
{
|
||||
DamageClientPtr pDamageClient = GetDamageClient(client);
|
||||
xDamageQueryVersionReply rep;
|
||||
|
||||
REQUEST(xDamageQueryVersionReq);
|
||||
|
||||
REQUEST_SIZE_MATCH(xDamageQueryVersionReq);
|
||||
|
|
@ -138,7 +137,8 @@ ProcDamageQueryVersion(ClientPtr client)
|
|||
if (stuff->majorVersion < SERVER_DAMAGE_MAJOR_VERSION) {
|
||||
rep.majorVersion = stuff->majorVersion;
|
||||
rep.minorVersion = stuff->minorVersion;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
rep.majorVersion = SERVER_DAMAGE_MAJOR_VERSION;
|
||||
if (stuff->majorVersion == SERVER_DAMAGE_MAJOR_VERSION &&
|
||||
stuff->minorVersion < SERVER_DAMAGE_MINOR_VERSION)
|
||||
|
|
@ -205,11 +205,8 @@ ProcDamageCreate (ClientPtr client)
|
|||
pDamageExt->pDamage = DamageCreate(DamageExtReport,
|
||||
DamageExtDestroy,
|
||||
level,
|
||||
FALSE,
|
||||
pDrawable->pScreen,
|
||||
pDamageExt);
|
||||
if (!pDamageExt->pDamage)
|
||||
{
|
||||
FALSE, pDrawable->pScreen, pDamageExt);
|
||||
if (!pDamageExt->pDamage) {
|
||||
free(pDamageExt);
|
||||
return BadAlloc;
|
||||
}
|
||||
|
|
@ -219,8 +216,7 @@ ProcDamageCreate (ClientPtr client)
|
|||
DamageSetReportAfterOp(pDamageExt->pDamage, TRUE);
|
||||
DamageRegister(pDamageExt->pDrawable, pDamageExt->pDamage);
|
||||
|
||||
if (pDrawable->type == DRAWABLE_WINDOW)
|
||||
{
|
||||
if (pDrawable->type == DRAWABLE_WINDOW) {
|
||||
pRegion = &((WindowPtr) pDrawable)->borderClip;
|
||||
DamageReportDamage(pDamageExt->pDamage, pRegion);
|
||||
}
|
||||
|
|
@ -253,18 +249,17 @@ ProcDamageSubtract (ClientPtr client)
|
|||
VERIFY_REGION_OR_NONE(pRepair, stuff->repair, client, DixWriteAccess);
|
||||
VERIFY_REGION_OR_NONE(pParts, stuff->parts, client, DixWriteAccess);
|
||||
|
||||
if (pDamageExt->level != DamageReportRawRegion)
|
||||
{
|
||||
if (pDamageExt->level != DamageReportRawRegion) {
|
||||
DamagePtr pDamage = pDamageExt->pDamage;
|
||||
if (pRepair)
|
||||
{
|
||||
|
||||
if (pRepair) {
|
||||
if (pParts)
|
||||
RegionIntersect(pParts, DamageRegion(pDamage), pRepair);
|
||||
if (DamageSubtract(pDamage, pRepair))
|
||||
DamageExtReport (pDamage, DamageRegion (pDamage), (void *) pDamageExt);
|
||||
DamageExtReport(pDamage, DamageRegion(pDamage),
|
||||
(void *) pDamageExt);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
if (pParts)
|
||||
RegionCopy(pParts, DamageRegion(pDamage));
|
||||
DamageEmpty(pDamage);
|
||||
|
|
@ -309,13 +304,9 @@ static const int version_requests[] = {
|
|||
static int (*ProcDamageVector[XDamageNumberRequests]) (ClientPtr) = {
|
||||
/*************** Version 1 ******************/
|
||||
ProcDamageQueryVersion,
|
||||
ProcDamageCreate,
|
||||
ProcDamageDestroy,
|
||||
ProcDamageSubtract,
|
||||
ProcDamageCreate, ProcDamageDestroy, ProcDamageSubtract,
|
||||
/*************** Version 1.1 ****************/
|
||||
ProcDamageAdd,
|
||||
};
|
||||
|
||||
ProcDamageAdd,};
|
||||
|
||||
static int
|
||||
ProcDamageDispatch(ClientPtr client)
|
||||
|
|
@ -393,12 +384,9 @@ SProcDamageAdd (ClientPtr client)
|
|||
static int (*SProcDamageVector[XDamageNumberRequests]) (ClientPtr) = {
|
||||
/*************** Version 1 ******************/
|
||||
SProcDamageQueryVersion,
|
||||
SProcDamageCreate,
|
||||
SProcDamageDestroy,
|
||||
SProcDamageSubtract,
|
||||
SProcDamageCreate, SProcDamageDestroy, SProcDamageSubtract,
|
||||
/*************** Version 1.1 ****************/
|
||||
SProcDamageAdd,
|
||||
};
|
||||
SProcDamageAdd,};
|
||||
|
||||
static int
|
||||
SProcDamageDispatch(ClientPtr client)
|
||||
|
|
@ -410,9 +398,7 @@ SProcDamageDispatch (ClientPtr client)
|
|||
}
|
||||
|
||||
static void
|
||||
DamageClientCallback (CallbackListPtr *list,
|
||||
pointer closure,
|
||||
pointer data)
|
||||
DamageClientCallback(CallbackListPtr *list, pointer closure, pointer data)
|
||||
{
|
||||
NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
|
||||
ClientPtr pClient = clientinfo->client;
|
||||
|
|
@ -423,8 +409,7 @@ DamageClientCallback (CallbackListPtr *list,
|
|||
pDamageClient->minor_version = 0;
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
/*ARGSUSED*/ static void
|
||||
DamageResetProc(ExtensionEntry * extEntry)
|
||||
{
|
||||
DeleteCallback(&ClientStateCallback, DamageClientCallback, 0);
|
||||
|
|
@ -441,8 +426,7 @@ FreeDamageExt (pointer value, XID did)
|
|||
pDamageExt->id = 0;
|
||||
if (WindowDrawable(pDamageExt->pDrawable->type))
|
||||
FreeResourceByType(pDamageExt->pDrawable->id, DamageExtWinType, TRUE);
|
||||
if (pDamageExt->pDamage)
|
||||
{
|
||||
if (pDamageExt->pDamage) {
|
||||
DamageUnregister(pDamageExt->pDrawable, pDamageExt->pDamage);
|
||||
DamageDestroy(pDamageExt->pDamage);
|
||||
}
|
||||
|
|
@ -461,8 +445,7 @@ FreeDamageExtWin (pointer value, XID wid)
|
|||
}
|
||||
|
||||
static void
|
||||
SDamageNotifyEvent (xDamageNotifyEvent *from,
|
||||
xDamageNotifyEvent *to)
|
||||
SDamageNotifyEvent(xDamageNotifyEvent * from, xDamageNotifyEvent * to)
|
||||
{
|
||||
to->type = from->type;
|
||||
cpswaps(from->sequenceNumber, to->sequenceNumber);
|
||||
|
|
@ -495,7 +478,8 @@ DamageExtensionInit(void)
|
|||
if (!DamageExtWinType)
|
||||
return;
|
||||
|
||||
if (!dixRegisterPrivateKey(&DamageClientPrivateKeyRec, PRIVATE_CLIENT, sizeof (DamageClientRec)))
|
||||
if (!dixRegisterPrivateKey
|
||||
(&DamageClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(DamageClientRec)))
|
||||
return;
|
||||
|
||||
if (!AddCallback(&ClientStateCallback, DamageClientCallback, 0))
|
||||
|
|
@ -504,12 +488,12 @@ DamageExtensionInit(void)
|
|||
if ((extEntry = AddExtension(DAMAGE_NAME, XDamageNumberEvents,
|
||||
XDamageNumberErrors,
|
||||
ProcDamageDispatch, SProcDamageDispatch,
|
||||
DamageResetProc, StandardMinorOpcode)) != 0)
|
||||
{
|
||||
DamageResetProc, StandardMinorOpcode)) != 0) {
|
||||
DamageReqCode = (unsigned char) extEntry->base;
|
||||
DamageEventBase = extEntry->eventBase;
|
||||
EventSwapVector[DamageEventBase + XDamageNotify] =
|
||||
(EventSwapPtr) SDamageNotifyEvent;
|
||||
SetResourceTypeErrorValue(DamageExtType, extEntry->errorBase + BadDamage);
|
||||
SetResourceTypeErrorValue(DamageExtType,
|
||||
extEntry->errorBase + BadDamage);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
282
dbe/dbe.c
282
dbe/dbe.c
|
|
@ -30,7 +30,6 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
/* INCLUDES */
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
|
|
@ -98,8 +97,6 @@ DbeStubScreen(DbeScreenPrivPtr pDbeScreenPriv, int *nStubbedScreens)
|
|||
(*nStubbedScreens)++;
|
||||
|
||||
} /* DbeStubScreen() */
|
||||
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
|
|
@ -131,8 +128,7 @@ ProcDbeGetVersion(ClientPtr client)
|
|||
rep.majorVersion = DBE_MAJOR_VERSION;
|
||||
rep.minorVersion = DBE_MINOR_VERSION;
|
||||
|
||||
if (client->swapped)
|
||||
{
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber);
|
||||
}
|
||||
|
||||
|
|
@ -141,7 +137,6 @@ ProcDbeGetVersion(ClientPtr client)
|
|||
return Success;
|
||||
|
||||
} /* ProcDbeGetVersion() */
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
|
|
@ -181,7 +176,6 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
|
|||
int status;
|
||||
int add_index;
|
||||
|
||||
|
||||
REQUEST_SIZE_MATCH(xDbeAllocateBackBufferNameReq);
|
||||
|
||||
/* The window must be valid. */
|
||||
|
|
@ -190,8 +184,7 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
|
|||
return status;
|
||||
|
||||
/* The window must be InputOutput. */
|
||||
if (pWin->drawable.class != InputOutput)
|
||||
{
|
||||
if (pWin->drawable.class != InputOutput) {
|
||||
return BadMatch;
|
||||
}
|
||||
|
||||
|
|
@ -199,9 +192,7 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
|
|||
swapAction = stuff->swapAction; /* use local var for performance. */
|
||||
if ((swapAction != XdbeUndefined) &&
|
||||
(swapAction != XdbeBackground) &&
|
||||
(swapAction != XdbeUntouched ) &&
|
||||
(swapAction != XdbeCopied ))
|
||||
{
|
||||
(swapAction != XdbeUntouched) && (swapAction != XdbeCopied)) {
|
||||
return BadValue;
|
||||
}
|
||||
|
||||
|
|
@ -215,18 +206,15 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
|
|||
if (!pDbeScreenPriv->GetVisualInfo)
|
||||
return BadMatch; /* screen doesn't support double buffering */
|
||||
|
||||
if (!(*pDbeScreenPriv->GetVisualInfo)(pWin->drawable.pScreen, &scrVisInfo))
|
||||
{
|
||||
if (!(*pDbeScreenPriv->GetVisualInfo) (pWin->drawable.pScreen, &scrVisInfo)) {
|
||||
/* GetVisualInfo() failed to allocate visual info data. */
|
||||
return BadAlloc;
|
||||
}
|
||||
|
||||
/* See if the window's visual is on the list. */
|
||||
visual = wVisual(pWin);
|
||||
for (i = 0; (i < scrVisInfo.count) && !visualMatched; i++)
|
||||
{
|
||||
if (scrVisInfo.visinfo[i].visual == visual)
|
||||
{
|
||||
for (i = 0; (i < scrVisInfo.count) && !visualMatched; i++) {
|
||||
if (scrVisInfo.visinfo[i].visual == visual) {
|
||||
visualMatched = TRUE;
|
||||
}
|
||||
}
|
||||
|
|
@ -234,18 +222,17 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
|
|||
/* Free what was allocated by the GetVisualInfo() call above. */
|
||||
free(scrVisInfo.visinfo);
|
||||
|
||||
if (!visualMatched)
|
||||
{
|
||||
if (!visualMatched) {
|
||||
return BadMatch;
|
||||
}
|
||||
|
||||
if ((pDbeWindowPriv = DBE_WINDOW_PRIV(pWin)) == NULL)
|
||||
{
|
||||
if ((pDbeWindowPriv = DBE_WINDOW_PRIV(pWin)) == NULL) {
|
||||
/* There is no buffer associated with the window.
|
||||
* Allocate a window priv.
|
||||
*/
|
||||
|
||||
pDbeWindowPriv = dixAllocateObjectWithPrivates(DbeWindowPrivRec, PRIVATE_DBE_WINDOW);
|
||||
pDbeWindowPriv =
|
||||
dixAllocateObjectWithPrivates(DbeWindowPrivRec, PRIVATE_DBE_WINDOW);
|
||||
if (!pDbeWindowPriv)
|
||||
return BadAlloc;
|
||||
|
||||
|
|
@ -265,8 +252,7 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
|
|||
pDbeWindowPriv->IDs[0] = stuff->buffer;
|
||||
|
||||
add_index = 0;
|
||||
for (i = 0; i < DBE_INIT_MAX_IDS; i++)
|
||||
{
|
||||
for (i = 0; i < DBE_INIT_MAX_IDS; i++) {
|
||||
pDbeWindowPriv->IDs[i] = DBE_FREE_ID_ELEMENT;
|
||||
}
|
||||
|
||||
|
|
@ -275,53 +261,48 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
|
|||
|
||||
} /* if -- There is no buffer associated with the window. */
|
||||
|
||||
else
|
||||
{
|
||||
else {
|
||||
/* A buffer is already associated with the window.
|
||||
* Add the new buffer ID to the array, reallocating the array memory
|
||||
* if necessary.
|
||||
*/
|
||||
|
||||
/* Determine if there is a free element in the ID array. */
|
||||
for (i = 0; i < pDbeWindowPriv->maxAvailableIDs; i++)
|
||||
{
|
||||
if (pDbeWindowPriv->IDs[i] == DBE_FREE_ID_ELEMENT)
|
||||
{
|
||||
for (i = 0; i < pDbeWindowPriv->maxAvailableIDs; i++) {
|
||||
if (pDbeWindowPriv->IDs[i] == DBE_FREE_ID_ELEMENT) {
|
||||
/* There is still room in the ID array. */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == pDbeWindowPriv->maxAvailableIDs)
|
||||
{
|
||||
if (i == pDbeWindowPriv->maxAvailableIDs) {
|
||||
/* No more room in the ID array -- reallocate another array. */
|
||||
XID *pIDs;
|
||||
|
||||
/* Setup an array pointer for the realloc operation below. */
|
||||
if (pDbeWindowPriv->maxAvailableIDs == DBE_INIT_MAX_IDS)
|
||||
{
|
||||
if (pDbeWindowPriv->maxAvailableIDs == DBE_INIT_MAX_IDS) {
|
||||
/* We will malloc a new array. */
|
||||
pIDs = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
/* We will realloc a new array. */
|
||||
pIDs = pDbeWindowPriv->IDs;
|
||||
}
|
||||
|
||||
/* malloc/realloc a new array and initialize all elements to 0. */
|
||||
pDbeWindowPriv->IDs = (XID *) realloc(pIDs,
|
||||
(pDbeWindowPriv->maxAvailableIDs+DBE_INCR_MAX_IDS)*sizeof(XID));
|
||||
if (!pDbeWindowPriv->IDs)
|
||||
{
|
||||
(pDbeWindowPriv->
|
||||
maxAvailableIDs +
|
||||
DBE_INCR_MAX_IDS) *
|
||||
sizeof(XID));
|
||||
if (!pDbeWindowPriv->IDs) {
|
||||
return BadAlloc;
|
||||
}
|
||||
memset(&pDbeWindowPriv->IDs[pDbeWindowPriv->nBufferIDs], 0,
|
||||
(pDbeWindowPriv->maxAvailableIDs + DBE_INCR_MAX_IDS -
|
||||
pDbeWindowPriv->nBufferIDs) * sizeof(XID));
|
||||
|
||||
if (pDbeWindowPriv->maxAvailableIDs == DBE_INIT_MAX_IDS)
|
||||
{
|
||||
if (pDbeWindowPriv->maxAvailableIDs == DBE_INIT_MAX_IDS) {
|
||||
/* We just went from using the initial (static) array to a
|
||||
* newly allocated array. Copy the IDs from the initial array
|
||||
* to the new array.
|
||||
|
|
@ -337,17 +318,14 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
|
|||
|
||||
} /* else -- A buffer is already associated with the window. */
|
||||
|
||||
|
||||
/* Call the DDX routine to allocate the back buffer. */
|
||||
status = (*pDbeScreenPriv->AllocBackBufferName) (pWin, stuff->buffer,
|
||||
stuff->swapAction);
|
||||
|
||||
if (status == Success)
|
||||
{
|
||||
if (status == Success) {
|
||||
pDbeWindowPriv->IDs[add_index] = stuff->buffer;
|
||||
if (!AddResource(stuff->buffer, dbeWindowPrivResType,
|
||||
(pointer)pDbeWindowPriv))
|
||||
{
|
||||
(pointer) pDbeWindowPriv)) {
|
||||
pDbeWindowPriv->IDs[add_index] = DBE_FREE_ID_ELEMENT;
|
||||
|
||||
if (pDbeWindowPriv->nBufferIDs == 0) {
|
||||
|
|
@ -355,7 +333,8 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
|
|||
goto out_free;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
/* The DDX buffer allocation routine failed for the first buffer of
|
||||
* this window.
|
||||
*/
|
||||
|
|
@ -378,7 +357,6 @@ out_free:
|
|||
return status;
|
||||
|
||||
} /* ProcDbeAllocateBackBufferName() */
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
|
|
@ -405,7 +383,6 @@ ProcDbeDeallocateBackBufferName(ClientPtr client)
|
|||
int rc, i;
|
||||
pointer val;
|
||||
|
||||
|
||||
REQUEST_SIZE_MATCH(xDbeDeallocateBackBufferNameReq);
|
||||
|
||||
/* Buffer name must be valid */
|
||||
|
|
@ -425,17 +402,14 @@ ProcDbeDeallocateBackBufferName(ClientPtr client)
|
|||
* above.
|
||||
*/
|
||||
|
||||
for (i = 0; i < pDbeWindowPriv->nBufferIDs; i++)
|
||||
{
|
||||
for (i = 0; i < pDbeWindowPriv->nBufferIDs; i++) {
|
||||
/* Loop through the ID list to find the ID. */
|
||||
if (pDbeWindowPriv->IDs[i] == stuff->buffer)
|
||||
{
|
||||
if (pDbeWindowPriv->IDs[i] == stuff->buffer) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == pDbeWindowPriv->nBufferIDs)
|
||||
{
|
||||
if (i == pDbeWindowPriv->nBufferIDs) {
|
||||
/* We did not find the ID in the ID list. */
|
||||
client->errorValue = stuff->buffer;
|
||||
return dbeErrorBase + DbeBadBuffer;
|
||||
|
|
@ -446,7 +420,6 @@ ProcDbeDeallocateBackBufferName(ClientPtr client)
|
|||
return Success;
|
||||
|
||||
} /* ProcDbeDeallocateBackBufferName() */
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
|
|
@ -483,12 +456,10 @@ ProcDbeSwapBuffers(ClientPtr client)
|
|||
register int i, j;
|
||||
int nStuff;
|
||||
|
||||
|
||||
REQUEST_AT_LEAST_SIZE(xDbeSwapBuffersReq);
|
||||
nStuff = stuff->n; /* use local variable for performance. */
|
||||
|
||||
if (nStuff == 0)
|
||||
{
|
||||
if (nStuff == 0) {
|
||||
return Success;
|
||||
}
|
||||
|
||||
|
|
@ -500,14 +471,11 @@ ProcDbeSwapBuffers(ClientPtr client)
|
|||
|
||||
/* Allocate array to record swap information. */
|
||||
swapInfo = (DbeSwapInfoPtr) malloc(nStuff * sizeof(DbeSwapInfoRec));
|
||||
if (swapInfo == NULL)
|
||||
{
|
||||
if (swapInfo == NULL) {
|
||||
return BadAlloc;
|
||||
}
|
||||
|
||||
|
||||
for (i = 0; i < nStuff; i++)
|
||||
{
|
||||
for (i = 0; i < nStuff; i++) {
|
||||
/* Check all windows to swap. */
|
||||
|
||||
/* Each window must be a valid window - BadWindow. */
|
||||
|
|
@ -519,17 +487,14 @@ ProcDbeSwapBuffers(ClientPtr client)
|
|||
}
|
||||
|
||||
/* Each window must be double-buffered - BadMatch. */
|
||||
if (DBE_WINDOW_PRIV(pWin) == NULL)
|
||||
{
|
||||
if (DBE_WINDOW_PRIV(pWin) == NULL) {
|
||||
free(swapInfo);
|
||||
return BadMatch;
|
||||
}
|
||||
|
||||
/* Each window must only be specified once - BadMatch. */
|
||||
for (j = i + 1; j < nStuff; j++)
|
||||
{
|
||||
if (dbeSwapInfo[i].window == dbeSwapInfo[j].window)
|
||||
{
|
||||
for (j = i + 1; j < nStuff; j++) {
|
||||
if (dbeSwapInfo[i].window == dbeSwapInfo[j].window) {
|
||||
free(swapInfo);
|
||||
return BadMatch;
|
||||
}
|
||||
|
|
@ -539,8 +504,7 @@ ProcDbeSwapBuffers(ClientPtr client)
|
|||
if ((dbeSwapInfo[i].swapAction != XdbeUndefined) &&
|
||||
(dbeSwapInfo[i].swapAction != XdbeBackground) &&
|
||||
(dbeSwapInfo[i].swapAction != XdbeUntouched) &&
|
||||
(dbeSwapInfo[i].swapAction != XdbeCopied ))
|
||||
{
|
||||
(dbeSwapInfo[i].swapAction != XdbeCopied)) {
|
||||
free(swapInfo);
|
||||
return BadValue;
|
||||
}
|
||||
|
|
@ -551,7 +515,6 @@ ProcDbeSwapBuffers(ClientPtr client)
|
|||
|
||||
} /* for (i = 0; i < nStuff; i++) */
|
||||
|
||||
|
||||
/* Call the DDX routine to perform the swap(s). The DDX routine should
|
||||
* scan the swap list (swap info), swap any buffers that it knows how to
|
||||
* handle, delete them from the list, and update nStuff to indicate how
|
||||
|
|
@ -565,12 +528,10 @@ ProcDbeSwapBuffers(ClientPtr client)
|
|||
* could deal with cross-screen synchronization.
|
||||
*/
|
||||
|
||||
while (nStuff > 0)
|
||||
{
|
||||
while (nStuff > 0) {
|
||||
pDbeScreenPriv = DBE_SCREEN_PRIV_FROM_WINDOW(swapInfo[0].pWindow);
|
||||
error = (*pDbeScreenPriv->SwapBuffers) (client, &nStuff, swapInfo);
|
||||
if (error != Success)
|
||||
{
|
||||
if (error != Success) {
|
||||
free(swapInfo);
|
||||
return error;
|
||||
}
|
||||
|
|
@ -580,7 +541,6 @@ ProcDbeSwapBuffers(ClientPtr client)
|
|||
return Success;
|
||||
|
||||
} /* ProcDbeSwapBuffers() */
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
|
|
@ -605,16 +565,13 @@ ProcDbeBeginIdiom(ClientPtr client)
|
|||
DbeScreenPrivPtr pDbeScreenPriv;
|
||||
register int i;
|
||||
|
||||
|
||||
REQUEST_SIZE_MATCH(xDbeBeginIdiomReq);
|
||||
|
||||
for (i = 0; i < screenInfo.numScreens; i++)
|
||||
{
|
||||
for (i = 0; i < screenInfo.numScreens; i++) {
|
||||
pDbeScreenPriv = DBE_SCREEN_PRIV(screenInfo.screens[i]);
|
||||
|
||||
/* Call the DDX begin idiom procedure if there is one. */
|
||||
if (pDbeScreenPriv->BeginIdiom)
|
||||
{
|
||||
if (pDbeScreenPriv->BeginIdiom) {
|
||||
(*pDbeScreenPriv->BeginIdiom) (client);
|
||||
}
|
||||
}
|
||||
|
|
@ -622,7 +579,6 @@ ProcDbeBeginIdiom(ClientPtr client)
|
|||
return Success;
|
||||
|
||||
} /* ProcDbeBeginIdiom() */
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
|
|
@ -655,24 +611,20 @@ ProcDbeGetVisualInfo(ClientPtr client)
|
|||
ScreenPtr pScreen;
|
||||
XdbeScreenVisualInfo *pScrVisInfo;
|
||||
|
||||
|
||||
REQUEST_AT_LEAST_SIZE(xDbeGetVisualInfoReq);
|
||||
|
||||
if (stuff->n > UINT32_MAX / sizeof(DrawablePtr))
|
||||
return BadAlloc;
|
||||
/* Make sure any specified drawables are valid. */
|
||||
if (stuff->n != 0)
|
||||
{
|
||||
if (stuff->n != 0) {
|
||||
if (!(pDrawables = (DrawablePtr *) malloc(stuff->n *
|
||||
sizeof(DrawablePtr))))
|
||||
{
|
||||
sizeof(DrawablePtr)))) {
|
||||
return BadAlloc;
|
||||
}
|
||||
|
||||
drawables = (Drawable *) &stuff[1];
|
||||
|
||||
for (i = 0; i < stuff->n; i++)
|
||||
{
|
||||
for (i = 0; i < stuff->n; i++) {
|
||||
rc = dixLookupDrawable(pDrawables + i, drawables[i], client, 0,
|
||||
DixGetAttrAccess);
|
||||
if (rc != Success) {
|
||||
|
|
@ -683,8 +635,7 @@ ProcDbeGetVisualInfo(ClientPtr client)
|
|||
}
|
||||
|
||||
count = (stuff->n == 0) ? screenInfo.numScreens : stuff->n;
|
||||
if (!(pScrVisInfo = calloc(count, sizeof(XdbeScreenVisualInfo))))
|
||||
{
|
||||
if (!(pScrVisInfo = calloc(count, sizeof(XdbeScreenVisualInfo)))) {
|
||||
free(pDrawables);
|
||||
|
||||
return BadAlloc;
|
||||
|
|
@ -692,8 +643,7 @@ ProcDbeGetVisualInfo(ClientPtr client)
|
|||
|
||||
length = 0;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
for (i = 0; i < count; i++) {
|
||||
pScreen = (stuff->n == 0) ? screenInfo.screens[i] :
|
||||
pDrawables[i]->pScreen;
|
||||
pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
|
||||
|
|
@ -702,8 +652,7 @@ ProcDbeGetVisualInfo(ClientPtr client)
|
|||
if (rc != Success)
|
||||
goto freeScrVisInfo;
|
||||
|
||||
if (!(*pDbeScreenPriv->GetVisualInfo)(pScreen, &pScrVisInfo[i]))
|
||||
{
|
||||
if (!(*pDbeScreenPriv->GetVisualInfo) (pScreen, &pScrVisInfo[i])) {
|
||||
/* We failed to alloc pScrVisInfo[i].visinfo. */
|
||||
rc = BadAlloc;
|
||||
|
||||
|
|
@ -723,8 +672,7 @@ ProcDbeGetVisualInfo(ClientPtr client)
|
|||
rep.length = bytes_to_int32(length);
|
||||
rep.m = count;
|
||||
|
||||
if (client->swapped)
|
||||
{
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber);
|
||||
swapl(&rep.length);
|
||||
swapl(&rep.m);
|
||||
|
|
@ -733,8 +681,7 @@ ProcDbeGetVisualInfo(ClientPtr client)
|
|||
/* Send off reply. */
|
||||
WriteToClient(client, sizeof(xDbeGetVisualInfoReply), (char *) &rep);
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
for (i = 0; i < count; i++) {
|
||||
CARD32 data32;
|
||||
|
||||
/* For each screen in the reply, send off the visual info */
|
||||
|
|
@ -742,16 +689,14 @@ ProcDbeGetVisualInfo(ClientPtr client)
|
|||
/* Send off number of visuals. */
|
||||
data32 = (CARD32) pScrVisInfo[i].count;
|
||||
|
||||
if (client->swapped)
|
||||
{
|
||||
if (client->swapped) {
|
||||
swapl(&data32);
|
||||
}
|
||||
|
||||
WriteToClient(client, sizeof(CARD32), (char *) &data32);
|
||||
|
||||
/* Now send off visual info items. */
|
||||
for (j = 0; j < pScrVisInfo[i].count; j++)
|
||||
{
|
||||
for (j = 0; j < pScrVisInfo[i].count; j++) {
|
||||
xDbeVisInfo visInfo;
|
||||
|
||||
/* Copy the data in the client data structure to a protocol
|
||||
|
|
@ -763,8 +708,7 @@ ProcDbeGetVisualInfo(ClientPtr client)
|
|||
visInfo.depth = (CARD8) pScrVisInfo[i].visinfo[j].depth;
|
||||
visInfo.perfLevel = (CARD8) pScrVisInfo[i].visinfo[j].perflevel;
|
||||
|
||||
if (client->swapped)
|
||||
{
|
||||
if (client->swapped) {
|
||||
swapl(&visInfo.visualID);
|
||||
|
||||
/* We do not need to swap depth and perfLevel since they are
|
||||
|
|
@ -773,7 +717,8 @@ ProcDbeGetVisualInfo(ClientPtr client)
|
|||
}
|
||||
|
||||
/* Write visualID(32), depth(8), perfLevel(8), and pad(16). */
|
||||
WriteToClient(client, 2*sizeof(CARD32), (char *)&visInfo.visualID);
|
||||
WriteToClient(client, 2 * sizeof(CARD32),
|
||||
(char *) &visInfo.visualID);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -781,8 +726,7 @@ ProcDbeGetVisualInfo(ClientPtr client)
|
|||
|
||||
freeScrVisInfo:
|
||||
/* Clean up memory. */
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
for (i = 0; i < count; i++) {
|
||||
free(pScrVisInfo[i].visinfo);
|
||||
}
|
||||
free(pScrVisInfo);
|
||||
|
|
@ -792,7 +736,6 @@ ProcDbeGetVisualInfo(ClientPtr client)
|
|||
return rc;
|
||||
|
||||
} /* ProcDbeGetVisualInfo() */
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
|
|
@ -817,18 +760,15 @@ ProcDbeGetBackBufferAttributes(ClientPtr client)
|
|||
DbeWindowPrivPtr pDbeWindowPriv;
|
||||
int rc;
|
||||
|
||||
|
||||
REQUEST_SIZE_MATCH(xDbeGetBackBufferAttributesReq);
|
||||
|
||||
rc = dixLookupResourceByType((pointer *) &pDbeWindowPriv, stuff->buffer,
|
||||
dbeWindowPrivResType, client,
|
||||
DixGetAttrAccess);
|
||||
if (rc == Success)
|
||||
{
|
||||
if (rc == Success) {
|
||||
rep.attributes = pDbeWindowPriv->pWindow->drawable.id;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
rep.attributes = None;
|
||||
}
|
||||
|
||||
|
|
@ -836,8 +776,7 @@ ProcDbeGetBackBufferAttributes(ClientPtr client)
|
|||
rep.sequenceNumber = client->sequence;
|
||||
rep.length = 0;
|
||||
|
||||
if (client->swapped)
|
||||
{
|
||||
if (client->swapped) {
|
||||
swaps(&rep.sequenceNumber);
|
||||
swapl(&rep.length);
|
||||
swapl(&rep.attributes);
|
||||
|
|
@ -848,7 +787,6 @@ ProcDbeGetBackBufferAttributes(ClientPtr client)
|
|||
return Success;
|
||||
|
||||
} /* ProcDbeGetbackBufferAttributes() */
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
|
|
@ -865,9 +803,7 @@ ProcDbeDispatch(ClientPtr client)
|
|||
{
|
||||
REQUEST(xReq);
|
||||
|
||||
|
||||
switch (stuff->data)
|
||||
{
|
||||
switch (stuff->data) {
|
||||
case X_DbeGetVersion:
|
||||
return (ProcDbeGetVersion(client));
|
||||
|
||||
|
|
@ -897,7 +833,6 @@ ProcDbeDispatch(ClientPtr client)
|
|||
}
|
||||
|
||||
} /* ProcDbeDispatch() */
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
|
|
@ -924,7 +859,6 @@ SProcDbeGetVersion(ClientPtr client)
|
|||
return (ProcDbeGetVersion(client));
|
||||
|
||||
} /* SProcDbeGetVersion() */
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
|
|
@ -964,7 +898,6 @@ SProcDbeAllocateBackBufferName(ClientPtr client)
|
|||
return (ProcDbeAllocateBackBufferName(client));
|
||||
|
||||
} /* SProcDbeAllocateBackBufferName() */
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
|
|
@ -996,7 +929,6 @@ SProcDbeDeallocateBackBufferName(ClientPtr client)
|
|||
return (ProcDbeDeallocateBackBufferName(client));
|
||||
|
||||
} /* SProcDbeDeallocateBackBufferName() */
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
|
|
@ -1026,22 +958,19 @@ SProcDbeSwapBuffers(ClientPtr client)
|
|||
register int i;
|
||||
xDbeSwapInfo *pSwapInfo;
|
||||
|
||||
|
||||
swaps(&stuff->length);
|
||||
REQUEST_AT_LEAST_SIZE(xDbeSwapBuffersReq);
|
||||
|
||||
swapl(&stuff->n);
|
||||
|
||||
if (stuff->n != 0)
|
||||
{
|
||||
if (stuff->n != 0) {
|
||||
pSwapInfo = (xDbeSwapInfo *) stuff + 1;
|
||||
|
||||
/* The swap info following the fix part of this request is a window(32)
|
||||
* followed by a 1 byte swap action and then 3 pad bytes. We only need
|
||||
* to swap the window information.
|
||||
*/
|
||||
for (i = 0; i < stuff->n; i++)
|
||||
{
|
||||
for (i = 0; i < stuff->n; i++) {
|
||||
swapl(&pSwapInfo->window);
|
||||
}
|
||||
}
|
||||
|
|
@ -1049,7 +978,6 @@ SProcDbeSwapBuffers(ClientPtr client)
|
|||
return (ProcDbeSwapBuffers(client));
|
||||
|
||||
} /* SProcDbeSwapBuffers() */
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
|
|
@ -1076,7 +1004,6 @@ SProcDbeBeginIdiom(ClientPtr client)
|
|||
return (ProcDbeBeginIdiom(client));
|
||||
|
||||
} /* SProcDbeBeginIdiom() */
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
|
|
@ -1109,7 +1036,6 @@ SProcDbeGetVisualInfo(ClientPtr client)
|
|||
return (ProcDbeGetVisualInfo(client));
|
||||
|
||||
} /* SProcDbeGetVisualInfo() */
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
|
|
@ -1140,7 +1066,6 @@ SProcDbeGetBackBufferAttributes(ClientPtr client)
|
|||
return (ProcDbeGetBackBufferAttributes(client));
|
||||
|
||||
} /* SProcDbeGetBackBufferAttributes() */
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
|
|
@ -1157,9 +1082,7 @@ SProcDbeDispatch(ClientPtr client)
|
|||
{
|
||||
REQUEST(xReq);
|
||||
|
||||
|
||||
switch (stuff->data)
|
||||
{
|
||||
switch (stuff->data) {
|
||||
case X_DbeGetVersion:
|
||||
return (SProcDbeGetVersion(client));
|
||||
|
||||
|
|
@ -1189,7 +1112,6 @@ SProcDbeDispatch(ClientPtr client)
|
|||
}
|
||||
|
||||
} /* SProcDbeDispatch() */
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
|
|
@ -1215,15 +1137,13 @@ DbeSetupBackgroundPainter(WindowPtr pWin, GCPtr pGC)
|
|||
int backgroundState;
|
||||
Mask gcmask;
|
||||
|
||||
|
||||
/* First take care of any ParentRelative stuff by altering the
|
||||
* tile/stipple origin to match the coordinates of the upper-left
|
||||
* corner of the first ancestor without a ParentRelative background.
|
||||
* This coordinate is, of course, negative.
|
||||
*/
|
||||
ts_x_origin = ts_y_origin = 0;
|
||||
while (pWin->backgroundState == ParentRelative)
|
||||
{
|
||||
while (pWin->backgroundState == ParentRelative) {
|
||||
ts_x_origin -= pWin->origin.x;
|
||||
ts_y_origin -= pWin->origin.y;
|
||||
|
||||
|
|
@ -1232,8 +1152,7 @@ DbeSetupBackgroundPainter(WindowPtr pWin, GCPtr pGC)
|
|||
backgroundState = pWin->backgroundState;
|
||||
background = pWin->background;
|
||||
|
||||
switch (backgroundState)
|
||||
{
|
||||
switch (backgroundState) {
|
||||
case BackgroundPixel:
|
||||
gcvalues[0].val = background.pixel;
|
||||
gcvalues[1].val = FillSolid;
|
||||
|
|
@ -1255,7 +1174,6 @@ DbeSetupBackgroundPainter(WindowPtr pWin, GCPtr pGC)
|
|||
|
||||
return ChangeGC(NullClient, pGC, gcmask, gcvalues) == 0;
|
||||
} /* DbeSetupBackgroundPainter() */
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
|
|
@ -1279,7 +1197,6 @@ DbeDrawableDelete(pointer pDrawable, XID id)
|
|||
return Success;
|
||||
|
||||
} /* DbeDrawableDelete() */
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
|
|
@ -1299,7 +1216,6 @@ DbeWindowPrivDelete(pointer pDbeWinPriv, XID id)
|
|||
DbeWindowPrivPtr pDbeWindowPriv = (DbeWindowPrivPtr) pDbeWinPriv;
|
||||
int i;
|
||||
|
||||
|
||||
/*
|
||||
**************************************************************************
|
||||
** Remove the buffer ID from the ID array.
|
||||
|
|
@ -1308,27 +1224,23 @@ DbeWindowPrivDelete(pointer pDbeWinPriv, XID id)
|
|||
|
||||
/* Find the ID in the ID array. */
|
||||
i = 0;
|
||||
while ((i < pDbeWindowPriv->nBufferIDs) && (pDbeWindowPriv->IDs[i] != id))
|
||||
{
|
||||
while ((i < pDbeWindowPriv->nBufferIDs) && (pDbeWindowPriv->IDs[i] != id)) {
|
||||
i++;
|
||||
}
|
||||
|
||||
if (i == pDbeWindowPriv->nBufferIDs)
|
||||
{
|
||||
if (i == pDbeWindowPriv->nBufferIDs) {
|
||||
/* We did not find the ID in the array. We should never get here. */
|
||||
return BadValue;
|
||||
}
|
||||
|
||||
/* Remove the ID from the array. */
|
||||
|
||||
if (i < (pDbeWindowPriv->nBufferIDs - 1))
|
||||
{
|
||||
if (i < (pDbeWindowPriv->nBufferIDs - 1)) {
|
||||
/* Compress the buffer ID array, overwriting the ID in the process. */
|
||||
memmove(&pDbeWindowPriv->IDs[i], &pDbeWindowPriv->IDs[i + 1],
|
||||
(pDbeWindowPriv->nBufferIDs - i - 1) * sizeof(XID));
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
/* We are removing the last ID in the array, in which case, the
|
||||
* assignement below is all that we need to do.
|
||||
*/
|
||||
|
|
@ -1342,8 +1254,7 @@ DbeWindowPrivDelete(pointer pDbeWinPriv, XID id)
|
|||
*/
|
||||
|
||||
if ((pDbeWindowPriv->maxAvailableIDs > DBE_INIT_MAX_IDS) &&
|
||||
(pDbeWindowPriv->nBufferIDs == DBE_INIT_MAX_IDS))
|
||||
{
|
||||
(pDbeWindowPriv->nBufferIDs == DBE_INIT_MAX_IDS)) {
|
||||
/* Copy the IDs back into the static array. */
|
||||
memcpy(pDbeWindowPriv->initIDs, pDbeWindowPriv->IDs,
|
||||
DBE_INIT_MAX_IDS * sizeof(XID));
|
||||
|
|
@ -1354,18 +1265,16 @@ DbeWindowPrivDelete(pointer pDbeWinPriv, XID id)
|
|||
pDbeWindowPriv->maxAvailableIDs = DBE_INIT_MAX_IDS;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
**************************************************************************
|
||||
** Perform DDX level tasks.
|
||||
**************************************************************************
|
||||
*/
|
||||
|
||||
pDbeScreenPriv = DBE_SCREEN_PRIV_FROM_WINDOW_PRIV(
|
||||
(DbeWindowPrivPtr)pDbeWindowPriv);
|
||||
pDbeScreenPriv = DBE_SCREEN_PRIV_FROM_WINDOW_PRIV((DbeWindowPrivPtr)
|
||||
pDbeWindowPriv);
|
||||
(*pDbeScreenPriv->WinPrivDelete) ((DbeWindowPrivPtr) pDbeWindowPriv, id);
|
||||
|
||||
|
||||
/*
|
||||
**************************************************************************
|
||||
** Perform miscellaneous tasks if this is the last buffer associated
|
||||
|
|
@ -1373,8 +1282,7 @@ DbeWindowPrivDelete(pointer pDbeWinPriv, XID id)
|
|||
**************************************************************************
|
||||
*/
|
||||
|
||||
if (pDbeWindowPriv->nBufferIDs == 0)
|
||||
{
|
||||
if (pDbeWindowPriv->nBufferIDs == 0) {
|
||||
/* Reset the DBE window priv pointer. */
|
||||
dixSetPrivate(&pDbeWindowPriv->pWindow->devPrivates, dbeWindowPrivKey,
|
||||
NULL);
|
||||
|
|
@ -1386,7 +1294,6 @@ DbeWindowPrivDelete(pointer pDbeWinPriv, XID id)
|
|||
return Success;
|
||||
|
||||
} /* DbeWindowPrivDelete() */
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
|
|
@ -1406,13 +1313,11 @@ DbeResetProc(ExtensionEntry *extEntry)
|
|||
ScreenPtr pScreen;
|
||||
DbeScreenPrivPtr pDbeScreenPriv;
|
||||
|
||||
for (i = 0; i < screenInfo.numScreens; i++)
|
||||
{
|
||||
for (i = 0; i < screenInfo.numScreens; i++) {
|
||||
pScreen = screenInfo.screens[i];
|
||||
pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
|
||||
|
||||
if (pDbeScreenPriv)
|
||||
{
|
||||
if (pDbeScreenPriv) {
|
||||
/* Unwrap DestroyWindow, which was wrapped in DbeExtensionInit(). */
|
||||
pScreen->DestroyWindow = pDbeScreenPriv->DestroyWindow;
|
||||
|
||||
|
|
@ -1423,7 +1328,6 @@ DbeResetProc(ExtensionEntry *extEntry)
|
|||
}
|
||||
}
|
||||
} /* DbeResetProc() */
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
|
|
@ -1445,7 +1349,6 @@ DbeDestroyWindow(WindowPtr pWin)
|
|||
ScreenPtr pScreen;
|
||||
Bool ret;
|
||||
|
||||
|
||||
/*
|
||||
**************************************************************************
|
||||
** 1. Unwrap the member routine.
|
||||
|
|
@ -1465,10 +1368,8 @@ DbeDestroyWindow(WindowPtr pWin)
|
|||
**************************************************************************
|
||||
*/
|
||||
|
||||
if ((pDbeWindowPriv = DBE_WINDOW_PRIV(pWin)))
|
||||
{
|
||||
while (pDbeWindowPriv)
|
||||
{
|
||||
if ((pDbeWindowPriv = DBE_WINDOW_PRIV(pWin))) {
|
||||
while (pDbeWindowPriv) {
|
||||
/* *DbeWinPrivDelete() will free the window private and set it to
|
||||
* NULL if there are no more buffer IDs associated with this
|
||||
* window.
|
||||
|
|
@ -1507,7 +1408,6 @@ DbeDestroyWindow(WindowPtr pWin)
|
|||
return ret;
|
||||
|
||||
} /* DbeDestroyWindow() */
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
|
|
@ -1530,7 +1430,8 @@ DbeExtensionInit(void)
|
|||
Bool ddxInitSuccess;
|
||||
|
||||
#ifdef PANORAMIX
|
||||
if(!noPanoramiXExtension) return;
|
||||
if (!noPanoramiXExtension)
|
||||
return;
|
||||
#endif
|
||||
|
||||
/* Create the resource types. */
|
||||
|
|
@ -1551,22 +1452,19 @@ DbeExtensionInit(void)
|
|||
if (!dixRegisterPrivateKey(&dbeWindowPrivKeyRec, PRIVATE_WINDOW, 0))
|
||||
return;
|
||||
|
||||
for (i = 0; i < screenInfo.numScreens; i++)
|
||||
{
|
||||
for (i = 0; i < screenInfo.numScreens; i++) {
|
||||
/* For each screen, set up DBE screen privates and init DIX and DDX
|
||||
* interface.
|
||||
*/
|
||||
|
||||
pScreen = screenInfo.screens[i];
|
||||
|
||||
if (!(pDbeScreenPriv = malloc (sizeof (DbeScreenPrivRec))))
|
||||
{
|
||||
if (!(pDbeScreenPriv = malloc(sizeof(DbeScreenPrivRec)))) {
|
||||
/* If we can not alloc a window or screen private,
|
||||
* then free any privates that we already alloc'ed and return
|
||||
*/
|
||||
|
||||
for (j = 0; j < i; j++)
|
||||
{
|
||||
for (j = 0; j < i; j++) {
|
||||
free(dixLookupPrivate(&screenInfo.screens[j]->devPrivates,
|
||||
dbeScreenPrivKey));
|
||||
dixSetPrivate(&screenInfo.screens[j]->devPrivates,
|
||||
|
|
@ -1592,8 +1490,7 @@ DbeExtensionInit(void)
|
|||
*/
|
||||
pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
|
||||
|
||||
if (ddxInitSuccess)
|
||||
{
|
||||
if (ddxInitSuccess) {
|
||||
/* Wrap DestroyWindow. The DDX initialization function
|
||||
* already wrapped PositionWindow for us.
|
||||
*/
|
||||
|
|
@ -1601,8 +1498,7 @@ DbeExtensionInit(void)
|
|||
pDbeScreenPriv->DestroyWindow = pScreen->DestroyWindow;
|
||||
pScreen->DestroyWindow = DbeDestroyWindow;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
/* DDX initialization failed. Stub the screen. */
|
||||
DbeStubScreen(pDbeScreenPriv, &nStubbedScreens);
|
||||
}
|
||||
|
|
@ -1614,13 +1510,10 @@ DbeExtensionInit(void)
|
|||
|
||||
} /* for (i = 0; i < screenInfo.numScreens; i++) */
|
||||
|
||||
|
||||
if (nStubbedScreens == screenInfo.numScreens)
|
||||
{
|
||||
if (nStubbedScreens == screenInfo.numScreens) {
|
||||
/* All screens stubbed. Clean up and return. */
|
||||
|
||||
for (i = 0; i < screenInfo.numScreens; i++)
|
||||
{
|
||||
for (i = 0; i < screenInfo.numScreens; i++) {
|
||||
free(dixLookupPrivate(&screenInfo.screens[i]->devPrivates,
|
||||
dbeScreenPrivKey));
|
||||
dixSetPrivate(&pScreen->devPrivates, dbeScreenPrivKey, NULL);
|
||||
|
|
@ -1628,15 +1521,14 @@ DbeExtensionInit(void)
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
/* Now add the extension. */
|
||||
extEntry = AddExtension(DBE_PROTOCOL_NAME, DbeNumberEvents,
|
||||
DbeNumberErrors, ProcDbeDispatch, SProcDbeDispatch,
|
||||
DbeResetProc, StandardMinorOpcode);
|
||||
|
||||
dbeErrorBase = extEntry->errorBase;
|
||||
SetResourceTypeErrorValue(dbeWindowPrivResType, dbeErrorBase + DbeBadBuffer);
|
||||
SetResourceTypeErrorValue(dbeWindowPrivResType,
|
||||
dbeErrorBase + DbeBadBuffer);
|
||||
SetResourceTypeErrorValue(dbeDrawableResType, dbeErrorBase + DbeBadBuffer);
|
||||
|
||||
} /* DbeExtensionInit() */
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@
|
|||
#ifndef DBE_STRUCT_H
|
||||
#define DBE_STRUCT_H
|
||||
|
||||
|
||||
/* INCLUDES */
|
||||
|
||||
#define NEED_DBE_PROTOCOL
|
||||
|
|
@ -41,20 +40,16 @@
|
|||
#include "windowstr.h"
|
||||
#include "privates.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
VisualID visual; /* one visual ID that supports double-buffering */
|
||||
int depth; /* depth of visual in bits */
|
||||
int perflevel; /* performance level of visual */
|
||||
}
|
||||
XdbeVisualInfo;
|
||||
} XdbeVisualInfo;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
int count; /* number of items in visual_depth */
|
||||
XdbeVisualInfo *visinfo; /* list of visuals & depths for scrn */
|
||||
}
|
||||
XdbeScreenVisualInfo;
|
||||
} XdbeScreenVisualInfo;
|
||||
|
||||
/* DEFINES */
|
||||
|
||||
|
|
@ -95,8 +90,7 @@ extern _X_EXPORT void DbeExtensionInit (void);
|
|||
/* Record used to pass swap information between DIX and DDX swapping
|
||||
* procedures.
|
||||
*/
|
||||
typedef struct _DbeSwapInfoRec
|
||||
{
|
||||
typedef struct _DbeSwapInfoRec {
|
||||
WindowPtr pWindow;
|
||||
unsigned char swapAction;
|
||||
|
||||
|
|
@ -108,8 +102,7 @@ typedef struct _DbeSwapInfoRec
|
|||
******************************************************************************
|
||||
*/
|
||||
|
||||
typedef struct _DbeWindowPrivRec
|
||||
{
|
||||
typedef struct _DbeWindowPrivRec {
|
||||
/* A pointer to the window with which the DBE window private (buffer) is
|
||||
* associated.
|
||||
*/
|
||||
|
|
@ -158,15 +151,13 @@ typedef struct _DbeWindowPrivRec
|
|||
|
||||
} DbeWindowPrivRec, *DbeWindowPrivPtr;
|
||||
|
||||
|
||||
/*
|
||||
******************************************************************************
|
||||
** Per-screen data
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
typedef struct _DbeScreenPrivRec
|
||||
{
|
||||
typedef struct _DbeScreenPrivRec {
|
||||
/* Wrapped functions
|
||||
* It is the responsibilty of the DDX layer to wrap PositionWindow().
|
||||
* DbeExtensionInit wraps DestroyWindow().
|
||||
|
|
@ -175,38 +166,30 @@ typedef struct _DbeScreenPrivRec
|
|||
DestroyWindowProcPtr DestroyWindow;
|
||||
|
||||
/* Per-screen DIX routines */
|
||||
Bool (*SetupBackgroundPainter)(
|
||||
WindowPtr /*pWin*/,
|
||||
Bool (*SetupBackgroundPainter) (WindowPtr /*pWin */ ,
|
||||
GCPtr /*pGC */
|
||||
);
|
||||
|
||||
/* Per-screen DDX routines */
|
||||
Bool (*GetVisualInfo)(
|
||||
ScreenPtr /*pScreen*/,
|
||||
Bool (*GetVisualInfo) (ScreenPtr /*pScreen */ ,
|
||||
XdbeScreenVisualInfo * /*pVisInfo */
|
||||
);
|
||||
int (*AllocBackBufferName)(
|
||||
WindowPtr /*pWin*/,
|
||||
int (*AllocBackBufferName) (WindowPtr /*pWin */ ,
|
||||
XID /*bufId */ ,
|
||||
int /*swapAction */
|
||||
);
|
||||
int (*SwapBuffers)(
|
||||
ClientPtr /*client*/,
|
||||
int (*SwapBuffers) (ClientPtr /*client */ ,
|
||||
int * /*pNumWindows */ ,
|
||||
DbeSwapInfoPtr /*swapInfo */
|
||||
);
|
||||
void (*BeginIdiom)(
|
||||
ClientPtr /*client*/
|
||||
void (*BeginIdiom) (ClientPtr /*client */
|
||||
);
|
||||
void (*EndIdiom)(
|
||||
ClientPtr /*client*/
|
||||
void (*EndIdiom) (ClientPtr /*client */
|
||||
);
|
||||
void (*WinPrivDelete)(
|
||||
DbeWindowPrivPtr /*pDbeWindowPriv*/,
|
||||
void (*WinPrivDelete) (DbeWindowPrivPtr /*pDbeWindowPriv */ ,
|
||||
XID /*bufId */
|
||||
);
|
||||
void (*ResetProc)(
|
||||
ScreenPtr /*pScreen*/
|
||||
void (*ResetProc) (ScreenPtr /*pScreen */
|
||||
);
|
||||
|
||||
} DbeScreenPrivRec, *DbeScreenPrivPtr;
|
||||
|
|
|
|||
176
dbe/midbe.c
176
dbe/midbe.c
|
|
@ -30,7 +30,6 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
/* INCLUDES */
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
|
|
@ -59,8 +58,8 @@
|
|||
#include <stdio.h>
|
||||
|
||||
static DevPrivateKeyRec miDbeWindowPrivPrivKeyRec;
|
||||
#define miDbeWindowPrivPrivKey (&miDbeWindowPrivPrivKeyRec)
|
||||
|
||||
#define miDbeWindowPrivPrivKey (&miDbeWindowPrivPrivKeyRec)
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
|
|
@ -86,27 +85,22 @@ miDbeGetVisualInfo(ScreenPtr pScreen, XdbeScreenVisualInfo *pScrVisInfo)
|
|||
DepthPtr pDepth;
|
||||
XdbeVisualInfo *visInfo;
|
||||
|
||||
|
||||
/* Determine number of visuals for this screen. */
|
||||
for (i = 0, count = 0; i < pScreen->numDepths; i++)
|
||||
{
|
||||
for (i = 0, count = 0; i < pScreen->numDepths; i++) {
|
||||
count += pScreen->allowedDepths[i].numVids;
|
||||
}
|
||||
|
||||
/* Allocate an array of XdbeVisualInfo items. */
|
||||
if (!(visInfo = (XdbeVisualInfo *)malloc(count * sizeof(XdbeVisualInfo))))
|
||||
{
|
||||
if (!(visInfo = (XdbeVisualInfo *) malloc(count * sizeof(XdbeVisualInfo)))) {
|
||||
return FALSE; /* memory alloc failure */
|
||||
}
|
||||
|
||||
for (i = 0, k = 0; i < pScreen->numDepths; i++)
|
||||
{
|
||||
for (i = 0, k = 0; i < pScreen->numDepths; i++) {
|
||||
/* For each depth of this screen, get visual information. */
|
||||
|
||||
pDepth = &pScreen->allowedDepths[i];
|
||||
|
||||
for (j = 0; j < pDepth->numVids; j++)
|
||||
{
|
||||
for (j = 0; j < pDepth->numVids; j++) {
|
||||
/* For each visual for this depth of this screen, get visual ID
|
||||
* and visual depth. Since this is MI code, we will always return
|
||||
* the same performance level for all visuals (0). A higher
|
||||
|
|
@ -128,7 +122,6 @@ miDbeGetVisualInfo(ScreenPtr pScreen, XdbeScreenVisualInfo *pScrVisInfo)
|
|||
return TRUE; /* success */
|
||||
|
||||
} /* miDbeGetVisualInfo() */
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
|
|
@ -151,12 +144,10 @@ miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction)
|
|||
xRectangle clearRect;
|
||||
int rc;
|
||||
|
||||
|
||||
pScreen = pWin->drawable.pScreen;
|
||||
pDbeWindowPriv = DBE_WINDOW_PRIV(pWin);
|
||||
|
||||
if (pDbeWindowPriv->nBufferIDs == 0)
|
||||
{
|
||||
if (pDbeWindowPriv->nBufferIDs == 0) {
|
||||
/* There is no buffer associated with the window.
|
||||
* We have to create the window priv priv. Remember, the window
|
||||
* priv was created at the DIX level, so all we need to do is
|
||||
|
|
@ -173,8 +164,7 @@ miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction)
|
|||
if (!(pDbeWindowPrivPriv->pFrontBuffer =
|
||||
(*pScreen->CreatePixmap) (pScreen, pDbeWindowPriv->width,
|
||||
pDbeWindowPriv->height,
|
||||
pWin->drawable.depth, 0)))
|
||||
{
|
||||
pWin->drawable.depth, 0))) {
|
||||
return BadAlloc;
|
||||
}
|
||||
|
||||
|
|
@ -182,8 +172,7 @@ miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction)
|
|||
if (!(pDbeWindowPrivPriv->pBackBuffer =
|
||||
(*pScreen->CreatePixmap) (pScreen, pDbeWindowPriv->width,
|
||||
pDbeWindowPriv->height,
|
||||
pWin->drawable.depth, 0)))
|
||||
{
|
||||
pWin->drawable.depth, 0))) {
|
||||
(*pScreen->DestroyPixmap) (pDbeWindowPrivPriv->pFrontBuffer);
|
||||
return BadAlloc;
|
||||
}
|
||||
|
|
@ -195,8 +184,7 @@ miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction)
|
|||
|
||||
/* Make the back pixmap a DBE drawable resource. */
|
||||
if (rc != Success || !AddResource(bufId, dbeDrawableResType,
|
||||
pDbeWindowPrivPriv->pBackBuffer))
|
||||
{
|
||||
pDbeWindowPrivPriv->pBackBuffer)) {
|
||||
/* free the buffer and the drawable resource */
|
||||
FreeResource(bufId, RT_NONE);
|
||||
return (rc == Success) ? BadAlloc : rc;
|
||||
|
|
@ -204,22 +192,19 @@ miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction)
|
|||
|
||||
/* Clear the back buffer. */
|
||||
pGC = GetScratchGC(pWin->drawable.depth, pWin->drawable.pScreen);
|
||||
if ((*pDbeScreenPriv->SetupBackgroundPainter)(pWin, pGC))
|
||||
{
|
||||
if ((*pDbeScreenPriv->SetupBackgroundPainter) (pWin, pGC)) {
|
||||
ValidateGC((DrawablePtr) pDbeWindowPrivPriv->pBackBuffer, pGC);
|
||||
clearRect.x = clearRect.y = 0;
|
||||
clearRect.width = pDbeWindowPrivPriv->pBackBuffer->drawable.width;
|
||||
clearRect.height = pDbeWindowPrivPriv->pBackBuffer->drawable.height;
|
||||
(*pGC->ops->PolyFillRect)(
|
||||
(DrawablePtr)pDbeWindowPrivPriv->pBackBuffer, pGC, 1,
|
||||
&clearRect);
|
||||
(*pGC->ops->PolyFillRect) ((DrawablePtr) pDbeWindowPrivPriv->
|
||||
pBackBuffer, pGC, 1, &clearRect);
|
||||
}
|
||||
FreeScratchGC(pGC);
|
||||
|
||||
} /* if no buffer associated with the window */
|
||||
|
||||
else
|
||||
{
|
||||
else {
|
||||
/* A buffer is already associated with the window.
|
||||
* Place the new buffer ID information at the head of the ID list.
|
||||
*/
|
||||
|
|
@ -227,8 +212,7 @@ miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction)
|
|||
/* Associate the new ID with an existing pixmap. */
|
||||
pDbeWindowPrivPriv = MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv);
|
||||
if (!AddResource(bufId, dbeDrawableResType,
|
||||
(pointer)pDbeWindowPrivPriv->pBackBuffer))
|
||||
{
|
||||
(pointer) pDbeWindowPrivPriv->pBackBuffer)) {
|
||||
return BadAlloc;
|
||||
}
|
||||
|
||||
|
|
@ -237,7 +221,6 @@ miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction)
|
|||
return Success;
|
||||
|
||||
} /* miDbeAllocBackBufferName() */
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
|
|
@ -257,14 +240,12 @@ miDbeAliasBuffers(DbeWindowPrivPtr pDbeWindowPriv)
|
|||
MiDbeWindowPrivPrivPtr pDbeWindowPrivPriv =
|
||||
MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv);
|
||||
|
||||
for (i = 0; i < pDbeWindowPriv->nBufferIDs; i++)
|
||||
{
|
||||
for (i = 0; i < pDbeWindowPriv->nBufferIDs; i++) {
|
||||
ChangeResourceValue(pDbeWindowPriv->IDs[i], dbeDrawableResType,
|
||||
(pointer) pDbeWindowPrivPriv->pBackBuffer);
|
||||
}
|
||||
|
||||
} /* miDbeAliasBuffers() */
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
|
|
@ -286,7 +267,6 @@ miDbeSwapBuffers(ClientPtr client, int *pNumWindows, DbeSwapInfoPtr swapInfo)
|
|||
PixmapPtr pTmpBuffer;
|
||||
xRectangle clearRect;
|
||||
|
||||
|
||||
pWin = swapInfo[0].pWindow;
|
||||
pDbeScreenPriv = DBE_SCREEN_PRIV_FROM_WINDOW(pWin);
|
||||
pDbeWindowPrivPriv = MI_DBE_WINDOW_PRIV_PRIV_FROM_WINDOW(pWin);
|
||||
|
|
@ -298,8 +278,7 @@ miDbeSwapBuffers(ClientPtr client, int *pNumWindows, DbeSwapInfoPtr swapInfo)
|
|||
**********************************************************************
|
||||
*/
|
||||
|
||||
switch(swapInfo[0].swapAction)
|
||||
{
|
||||
switch (swapInfo[0].swapAction) {
|
||||
case XdbeUndefined:
|
||||
break;
|
||||
|
||||
|
|
@ -328,8 +307,7 @@ miDbeSwapBuffers(ClientPtr client, int *pNumWindows, DbeSwapInfoPtr swapInfo)
|
|||
ValidateGC((DrawablePtr) pWin, pGC);
|
||||
(*pGC->ops->CopyArea) ((DrawablePtr) pDbeWindowPrivPriv->pBackBuffer,
|
||||
(DrawablePtr) pWin, pGC, 0, 0,
|
||||
pWin->drawable.width, pWin->drawable.height,
|
||||
0, 0);
|
||||
pWin->drawable.width, pWin->drawable.height, 0, 0);
|
||||
|
||||
/*
|
||||
**********************************************************************
|
||||
|
|
@ -337,32 +315,26 @@ miDbeSwapBuffers(ClientPtr client, int *pNumWindows, DbeSwapInfoPtr swapInfo)
|
|||
**********************************************************************
|
||||
*/
|
||||
|
||||
switch(swapInfo[0].swapAction)
|
||||
{
|
||||
switch (swapInfo[0].swapAction) {
|
||||
case XdbeUndefined:
|
||||
break;
|
||||
|
||||
case XdbeBackground:
|
||||
if ((*pDbeScreenPriv->SetupBackgroundPainter)(pWin, pGC))
|
||||
{
|
||||
if ((*pDbeScreenPriv->SetupBackgroundPainter) (pWin, pGC)) {
|
||||
ValidateGC((DrawablePtr) pDbeWindowPrivPriv->pBackBuffer, pGC);
|
||||
clearRect.x = 0;
|
||||
clearRect.y = 0;
|
||||
clearRect.width =
|
||||
pDbeWindowPrivPriv->pBackBuffer->drawable.width;
|
||||
clearRect.height =
|
||||
pDbeWindowPrivPriv->pBackBuffer->drawable.height;
|
||||
(*pGC->ops->PolyFillRect)(
|
||||
(DrawablePtr)pDbeWindowPrivPriv->pBackBuffer,
|
||||
pGC, 1, &clearRect);
|
||||
clearRect.width = pDbeWindowPrivPriv->pBackBuffer->drawable.width;
|
||||
clearRect.height = pDbeWindowPrivPriv->pBackBuffer->drawable.height;
|
||||
(*pGC->ops->PolyFillRect) ((DrawablePtr) pDbeWindowPrivPriv->
|
||||
pBackBuffer, pGC, 1, &clearRect);
|
||||
}
|
||||
break;
|
||||
|
||||
case XdbeUntouched:
|
||||
/* Swap pixmap pointers. */
|
||||
pTmpBuffer = pDbeWindowPrivPriv->pBackBuffer;
|
||||
pDbeWindowPrivPriv->pBackBuffer =
|
||||
pDbeWindowPrivPriv->pFrontBuffer;
|
||||
pDbeWindowPrivPriv->pBackBuffer = pDbeWindowPrivPriv->pFrontBuffer;
|
||||
pDbeWindowPrivPriv->pFrontBuffer = pTmpBuffer;
|
||||
|
||||
miDbeAliasBuffers(pDbeWindowPrivPriv->pDbeWindowPriv);
|
||||
|
|
@ -379,8 +351,7 @@ miDbeSwapBuffers(ClientPtr client, int *pNumWindows, DbeSwapInfoPtr swapInfo)
|
|||
* swapped.
|
||||
*/
|
||||
|
||||
if (*pNumWindows > 1)
|
||||
{
|
||||
if (*pNumWindows > 1) {
|
||||
/* We were told to swap more than one window, but we only swapped the
|
||||
* first one. Remove the first window in the list by moving the last
|
||||
* window to the beginning.
|
||||
|
|
@ -392,8 +363,7 @@ miDbeSwapBuffers(ClientPtr client, int *pNumWindows, DbeSwapInfoPtr swapInfo)
|
|||
swapInfo[*pNumWindows - 1].pWindow = (WindowPtr) NULL;
|
||||
swapInfo[*pNumWindows - 1].swapAction = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
/* Clear the window information just to be safe. */
|
||||
swapInfo[0].pWindow = (WindowPtr) NULL;
|
||||
swapInfo[0].swapAction = 0;
|
||||
|
|
@ -406,7 +376,6 @@ miDbeSwapBuffers(ClientPtr client, int *pNumWindows, DbeSwapInfoPtr swapInfo)
|
|||
return Success;
|
||||
|
||||
} /* miSwapBuffers() */
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
|
|
@ -460,16 +429,13 @@ miDbeWinPrivDelete(DbeWindowPrivPtr pDbeWindowPriv, XID bufId)
|
|||
{
|
||||
MiDbeWindowPrivPrivPtr pDbeWindowPrivPriv;
|
||||
|
||||
|
||||
if (pDbeWindowPriv->nBufferIDs != 0)
|
||||
{
|
||||
if (pDbeWindowPriv->nBufferIDs != 0) {
|
||||
/* We still have at least one more buffer ID associated with this
|
||||
* window.
|
||||
*/
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* We have no more buffer IDs associated with this window. We need to
|
||||
* free some stuff.
|
||||
*/
|
||||
|
|
@ -477,19 +443,16 @@ miDbeWinPrivDelete(DbeWindowPrivPtr pDbeWindowPriv, XID bufId)
|
|||
pDbeWindowPrivPriv = MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv);
|
||||
|
||||
/* Destroy the front and back pixmaps. */
|
||||
if (pDbeWindowPrivPriv->pFrontBuffer)
|
||||
{
|
||||
(*pDbeWindowPriv->pWindow->drawable.pScreen->DestroyPixmap)(
|
||||
pDbeWindowPrivPriv->pFrontBuffer);
|
||||
if (pDbeWindowPrivPriv->pFrontBuffer) {
|
||||
(*pDbeWindowPriv->pWindow->drawable.pScreen->
|
||||
DestroyPixmap) (pDbeWindowPrivPriv->pFrontBuffer);
|
||||
}
|
||||
if (pDbeWindowPrivPriv->pBackBuffer)
|
||||
{
|
||||
(*pDbeWindowPriv->pWindow->drawable.pScreen->DestroyPixmap)(
|
||||
pDbeWindowPrivPriv->pBackBuffer);
|
||||
if (pDbeWindowPrivPriv->pBackBuffer) {
|
||||
(*pDbeWindowPriv->pWindow->drawable.pScreen->
|
||||
DestroyPixmap) (pDbeWindowPrivPriv->pBackBuffer);
|
||||
}
|
||||
|
||||
} /* miDbeWinPrivDelete() */
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
|
|
@ -520,7 +483,6 @@ miDbePositionWindow(WindowPtr pWin, int x, int y)
|
|||
xRectangle clearRect;
|
||||
Bool ret;
|
||||
|
||||
|
||||
/*
|
||||
**************************************************************************
|
||||
** 1. Unwrap the member routine.
|
||||
|
|
@ -563,14 +525,12 @@ miDbePositionWindow(WindowPtr pWin, int x, int y)
|
|||
**************************************************************************
|
||||
*/
|
||||
|
||||
if (!(pDbeWindowPriv = DBE_WINDOW_PRIV(pWin)))
|
||||
{
|
||||
if (!(pDbeWindowPriv = DBE_WINDOW_PRIV(pWin))) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (pDbeWindowPriv->width == pWin->drawable.width &&
|
||||
pDbeWindowPriv->height == pWin->drawable.height)
|
||||
{
|
||||
pDbeWindowPriv->height == pWin->drawable.height) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -594,27 +554,23 @@ miDbePositionWindow(WindowPtr pWin, int x, int y)
|
|||
saveheight = pDbeWindowPriv->height;
|
||||
|
||||
/* Clip rectangle to source and destination. */
|
||||
if (destx < 0)
|
||||
{
|
||||
if (destx < 0) {
|
||||
savewidth += destx;
|
||||
sourcex -= destx;
|
||||
destx = 0;
|
||||
}
|
||||
|
||||
if (destx + savewidth > width)
|
||||
{
|
||||
if (destx + savewidth > width) {
|
||||
savewidth = width - destx;
|
||||
}
|
||||
|
||||
if (desty < 0)
|
||||
{
|
||||
if (desty < 0) {
|
||||
saveheight += desty;
|
||||
sourcey -= desty;
|
||||
desty = 0;
|
||||
}
|
||||
|
||||
if (desty + saveheight > height)
|
||||
{
|
||||
if (desty + saveheight > height) {
|
||||
saveheight = height - desty;
|
||||
}
|
||||
|
||||
|
|
@ -625,17 +581,14 @@ miDbePositionWindow(WindowPtr pWin, int x, int y)
|
|||
|
||||
pGC = GetScratchGC(pWin->drawable.depth, pScreen);
|
||||
|
||||
if (clear)
|
||||
{
|
||||
if ((*pDbeScreenPriv->SetupBackgroundPainter)(pWin, pGC))
|
||||
{
|
||||
if (clear) {
|
||||
if ((*pDbeScreenPriv->SetupBackgroundPainter) (pWin, pGC)) {
|
||||
clearRect.x = 0;
|
||||
clearRect.y = 0;
|
||||
clearRect.width = width;
|
||||
clearRect.height = height;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
clear = FALSE;
|
||||
}
|
||||
}
|
||||
|
|
@ -647,23 +600,19 @@ miDbePositionWindow(WindowPtr pWin, int x, int y)
|
|||
pBackBuffer = (*pScreen->CreatePixmap) (pScreen, width, height,
|
||||
pWin->drawable.depth, 0);
|
||||
|
||||
if (!pFrontBuffer || !pBackBuffer)
|
||||
{
|
||||
if (!pFrontBuffer || !pBackBuffer) {
|
||||
/* We failed at creating 1 or 2 of the pixmaps. */
|
||||
|
||||
if (pFrontBuffer)
|
||||
{
|
||||
if (pFrontBuffer) {
|
||||
(*pScreen->DestroyPixmap) (pFrontBuffer);
|
||||
}
|
||||
|
||||
if (pBackBuffer)
|
||||
{
|
||||
if (pBackBuffer) {
|
||||
(*pScreen->DestroyPixmap) (pBackBuffer);
|
||||
}
|
||||
|
||||
/* Destroy all buffers for this window. */
|
||||
while (pDbeWindowPriv)
|
||||
{
|
||||
while (pDbeWindowPriv) {
|
||||
/* DbeWindowPrivDelete() will free the window private if there no
|
||||
* more buffer IDs associated with this window.
|
||||
*/
|
||||
|
|
@ -675,44 +624,40 @@ miDbePositionWindow(WindowPtr pWin, int x, int y)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
else {
|
||||
/* Clear out the new DBE buffer pixmaps. */
|
||||
|
||||
MiDbeWindowPrivPrivPtr pDbeWindowPrivPriv;
|
||||
|
||||
|
||||
pDbeWindowPrivPriv = MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv);
|
||||
|
||||
/* I suppose this could avoid quite a bit of work if
|
||||
* it computed the minimal area required.
|
||||
*/
|
||||
ValidateGC(&pFrontBuffer->drawable, pGC);
|
||||
if (clear)
|
||||
{
|
||||
if (clear) {
|
||||
(*pGC->ops->PolyFillRect) ((DrawablePtr) pFrontBuffer, pGC, 1,
|
||||
&clearRect);
|
||||
}
|
||||
/* Copy the contents of the old front pixmap to the new one. */
|
||||
if (pWin->bitGravity != ForgetGravity)
|
||||
{
|
||||
(*pGC->ops->CopyArea)((DrawablePtr)pDbeWindowPrivPriv->pFrontBuffer,
|
||||
(DrawablePtr)pFrontBuffer, pGC, sourcex,
|
||||
sourcey, savewidth, saveheight, destx, desty);
|
||||
if (pWin->bitGravity != ForgetGravity) {
|
||||
(*pGC->ops->CopyArea) ((DrawablePtr) pDbeWindowPrivPriv->
|
||||
pFrontBuffer, (DrawablePtr) pFrontBuffer,
|
||||
pGC, sourcex, sourcey, savewidth, saveheight,
|
||||
destx, desty);
|
||||
}
|
||||
|
||||
ValidateGC(&pBackBuffer->drawable, pGC);
|
||||
if (clear)
|
||||
{
|
||||
if (clear) {
|
||||
(*pGC->ops->PolyFillRect) ((DrawablePtr) pBackBuffer, pGC, 1,
|
||||
&clearRect);
|
||||
}
|
||||
/* Copy the contents of the old back pixmap to the new one. */
|
||||
if (pWin->bitGravity != ForgetGravity)
|
||||
{
|
||||
(*pGC->ops->CopyArea)((DrawablePtr)pDbeWindowPrivPriv->pBackBuffer,
|
||||
(DrawablePtr)pBackBuffer, pGC, sourcex,
|
||||
sourcey, savewidth, saveheight, destx, desty);
|
||||
if (pWin->bitGravity != ForgetGravity) {
|
||||
(*pGC->ops->CopyArea) ((DrawablePtr) pDbeWindowPrivPriv->
|
||||
pBackBuffer, (DrawablePtr) pBackBuffer, pGC,
|
||||
sourcex, sourcey, savewidth, saveheight,
|
||||
destx, desty);
|
||||
}
|
||||
|
||||
/* Destroy the old pixmaps, and point the DBE window priv to the new
|
||||
|
|
@ -734,7 +679,6 @@ miDbePositionWindow(WindowPtr pWin, int x, int y)
|
|||
return ret;
|
||||
|
||||
} /* miDbePositionWindow() */
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
|
|
@ -753,14 +697,12 @@ miDbeResetProc(ScreenPtr pScreen)
|
|||
{
|
||||
DbeScreenPrivPtr pDbeScreenPriv;
|
||||
|
||||
|
||||
pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
|
||||
|
||||
/* Unwrap wrappers */
|
||||
pScreen->PositionWindow = pDbeScreenPriv->PositionWindow;
|
||||
|
||||
} /* miDbeResetProc() */
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
|
|
|
|||
|
|
@ -40,19 +40,17 @@
|
|||
|
||||
/* EXTERNS */
|
||||
|
||||
extern Bool miDbeInit(
|
||||
ScreenPtr pScreen,
|
||||
DbeScreenPrivPtr pDbeScreenPriv
|
||||
);
|
||||
extern Bool miDbeInit(ScreenPtr pScreen, DbeScreenPrivPtr pDbeScreenPriv);
|
||||
|
||||
extern DevPrivateKeyRec dbeScreenPrivKeyRec;
|
||||
|
||||
#define dbeScreenPrivKey (&dbeScreenPrivKeyRec)
|
||||
|
||||
extern DevPrivateKeyRec dbeWindowPrivKeyRec;
|
||||
|
||||
#define dbeWindowPrivKey (&dbeWindowPrivKeyRec)
|
||||
|
||||
extern RESTYPE dbeDrawableResType;
|
||||
extern RESTYPE dbeWindowPrivResType;
|
||||
|
||||
#endif /* MIDBE_H */
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
|
@ -38,7 +37,6 @@
|
|||
#ifndef MIDBE_STRUCT_H
|
||||
#define MIDBE_STRUCT_H
|
||||
|
||||
|
||||
/* DEFINES */
|
||||
|
||||
#define MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv) \
|
||||
|
|
@ -50,8 +48,7 @@
|
|||
|
||||
/* TYPEDEFS */
|
||||
|
||||
typedef struct _MiDbeWindowPrivPrivRec
|
||||
{
|
||||
typedef struct _MiDbeWindowPrivPrivRec {
|
||||
/* Place machine-specific fields in here.
|
||||
* Since this is mi code, we do not really have machine-specific fields.
|
||||
*/
|
||||
|
|
@ -76,4 +73,3 @@ typedef struct _MiDbeWindowPrivPrivRec
|
|||
} MiDbeWindowPrivPrivRec, *MiDbeWindowPrivPrivPtr;
|
||||
|
||||
#endif /* MIDBE_STRUCT_H */
|
||||
|
||||
|
|
|
|||
27
dix/atom.c
27
dix/atom.c
|
|
@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
|
|||
used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization from The Open Group.
|
||||
|
||||
|
||||
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
|
||||
|
||||
All Rights Reserved
|
||||
|
|
@ -45,7 +44,6 @@ SOFTWARE.
|
|||
|
||||
******************************************************************/
|
||||
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
|
@ -83,19 +81,16 @@ MakeAtom(const char *string, unsigned len, Bool makeit)
|
|||
unsigned int fp = 0;
|
||||
|
||||
np = &atomRoot;
|
||||
for (i = 0; i < (len+1)/2; i++)
|
||||
{
|
||||
for (i = 0; i < (len + 1) / 2; i++) {
|
||||
fp = fp * 27 + string[i];
|
||||
fp = fp * 27 + string[len - 1 - i];
|
||||
}
|
||||
while (*np != NULL)
|
||||
{
|
||||
while (*np != NULL) {
|
||||
if (fp < (*np)->fingerPrint)
|
||||
np = &((*np)->left);
|
||||
else if (fp > (*np)->fingerPrint)
|
||||
np = &((*np)->right);
|
||||
else
|
||||
{ /* now start testing the strings */
|
||||
else { /* now start testing the strings */
|
||||
comp = strncmp(string, (*np)->string, (int) len);
|
||||
if ((comp < 0) || ((comp == 0) && (len < strlen((*np)->string))))
|
||||
np = &((*np)->left);
|
||||
|
|
@ -105,19 +100,16 @@ MakeAtom(const char *string, unsigned len, Bool makeit)
|
|||
return (*np)->a;
|
||||
}
|
||||
}
|
||||
if (makeit)
|
||||
{
|
||||
if (makeit) {
|
||||
NodePtr nd;
|
||||
|
||||
nd = malloc(sizeof(NodeRec));
|
||||
if (!nd)
|
||||
return BAD_RESOURCE;
|
||||
if (lastAtom < XA_LAST_PREDEFINED)
|
||||
{
|
||||
if (lastAtom < XA_LAST_PREDEFINED) {
|
||||
nd->string = string;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
nd->string = strndup(string, len);
|
||||
if (!nd->string) {
|
||||
free(nd);
|
||||
|
|
@ -160,8 +152,11 @@ const char *
|
|||
NameForAtom(Atom atom)
|
||||
{
|
||||
NodePtr node;
|
||||
if (atom > lastAtom) return 0;
|
||||
if ((node = nodeTable[atom]) == NULL) return 0;
|
||||
|
||||
if (atom > lastAtom)
|
||||
return 0;
|
||||
if ((node = nodeTable[atom]) == NULL)
|
||||
return 0;
|
||||
return node->string;
|
||||
}
|
||||
|
||||
|
|
|
|||
745
dix/colormap.c
745
dix/colormap.c
File diff suppressed because it is too large
Load diff
106
dix/cursor.c
106
dix/cursor.c
|
|
@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
|
|||
used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization from The Open Group.
|
||||
|
||||
|
||||
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
|
||||
|
||||
All Rights Reserved
|
||||
|
|
@ -45,8 +44,6 @@ SOFTWARE.
|
|||
|
||||
******************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
|
@ -89,16 +86,12 @@ FreeCursorBits(CursorBitsPtr bits)
|
|||
free(bits->argb);
|
||||
#endif
|
||||
dixFiniPrivates(bits, PRIVATE_CURSOR_BITS);
|
||||
if (bits->refcnt == 0)
|
||||
{
|
||||
if (bits->refcnt == 0) {
|
||||
GlyphSharePtr *prev, this;
|
||||
|
||||
for (prev = &sharedGlyphs;
|
||||
(this = *prev) && (this->bits != bits);
|
||||
prev = &this->next)
|
||||
;
|
||||
if (this)
|
||||
{
|
||||
(this = *prev) && (this->bits != bits); prev = &this->next);
|
||||
if (this) {
|
||||
*prev = this->next;
|
||||
CloseFont(this->font, (Font) 0);
|
||||
free(this);
|
||||
|
|
@ -124,8 +117,7 @@ FreeCursor(pointer value, XID cid)
|
|||
if (--pCurs->refcnt != 0)
|
||||
return Success;
|
||||
|
||||
for (nscr = 0; nscr < screenInfo.numScreens; nscr++)
|
||||
{
|
||||
for (nscr = 0; nscr < screenInfo.numScreens; nscr++) {
|
||||
pscr = screenInfo.screens[nscr];
|
||||
(void) (*pscr->UnrealizeCursor) (pDev, pscr, pCurs);
|
||||
}
|
||||
|
|
@ -135,7 +127,6 @@ FreeCursor(pointer value, XID cid)
|
|||
return Success;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* We check for empty cursors so that we won't have to display them
|
||||
*/
|
||||
|
|
@ -147,14 +138,16 @@ CheckForEmptyMask(CursorBitsPtr bits)
|
|||
|
||||
bits->emptyMask = FALSE;
|
||||
while (n--)
|
||||
if(*(msk++) != 0) return;
|
||||
if (*(msk++) != 0)
|
||||
return;
|
||||
#ifdef ARGB_CURSOR
|
||||
if (bits->argb)
|
||||
{
|
||||
if (bits->argb) {
|
||||
CARD32 *argb = bits->argb;
|
||||
|
||||
n = bits->width * bits->height;
|
||||
while (n--)
|
||||
if (*argb++ & 0xff000000) return;
|
||||
if (*argb++ & 0xff000000)
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
bits->emptyMask = TRUE;
|
||||
|
|
@ -174,15 +167,11 @@ RealizeCursorAllScreens(CursorPtr pCurs)
|
|||
ScreenPtr pscr;
|
||||
int nscr;
|
||||
|
||||
for (nscr = 0; nscr < screenInfo.numScreens; nscr++)
|
||||
{
|
||||
for (nscr = 0; nscr < screenInfo.numScreens; nscr++) {
|
||||
pscr = screenInfo.screens[nscr];
|
||||
for (pDev = inputInfo.devices; pDev; pDev = pDev->next)
|
||||
{
|
||||
if (DevHasCursor(pDev))
|
||||
{
|
||||
if (!( *pscr->RealizeCursor)(pDev, pscr, pCurs))
|
||||
{
|
||||
for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
|
||||
if (DevHasCursor(pDev)) {
|
||||
if (!(*pscr->RealizeCursor) (pDev, pscr, pCurs)) {
|
||||
/* Realize failed for device pDev on screen pscr.
|
||||
* We have to assume that for all devices before, realize
|
||||
* worked. We need to rollback all devices so far on the
|
||||
|
|
@ -190,19 +179,17 @@ RealizeCursorAllScreens(CursorPtr pCurs)
|
|||
* screens.
|
||||
*/
|
||||
DeviceIntPtr pDevIt = inputInfo.devices; /*dev iterator */
|
||||
while(pDevIt && pDevIt != pDev)
|
||||
{
|
||||
|
||||
while (pDevIt && pDevIt != pDev) {
|
||||
if (DevHasCursor(pDevIt))
|
||||
(*pscr->UnrealizeCursor) (pDevIt, pscr, pCurs);
|
||||
pDevIt = pDevIt->next;
|
||||
}
|
||||
while (--nscr >= 0)
|
||||
{
|
||||
while (--nscr >= 0) {
|
||||
pscr = screenInfo.screens[nscr];
|
||||
/* now unrealize all devices on previous screens */
|
||||
pDevIt = inputInfo.devices;
|
||||
while (pDevIt)
|
||||
{
|
||||
while (pDevIt) {
|
||||
if (DevHasCursor(pDevIt))
|
||||
(*pscr->UnrealizeCursor) (pDevIt, pscr, pCurs);
|
||||
pDevIt = pDevIt->next;
|
||||
|
|
@ -218,7 +205,6 @@ RealizeCursorAllScreens(CursorPtr pCurs)
|
|||
return Success;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* does nothing about the resource table, just creates the data structure.
|
||||
* does not copy the src and mask bits
|
||||
|
|
@ -310,34 +296,28 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar,
|
|||
CursorPtr pCurs;
|
||||
GlyphSharePtr pShare;
|
||||
|
||||
rc = dixLookupResourceByType((pointer *)&sourcefont, source, RT_FONT, client,
|
||||
DixUseAccess);
|
||||
if (rc != Success)
|
||||
{
|
||||
rc = dixLookupResourceByType((pointer *) &sourcefont, source, RT_FONT,
|
||||
client, DixUseAccess);
|
||||
if (rc != Success) {
|
||||
client->errorValue = source;
|
||||
return rc;
|
||||
}
|
||||
rc = dixLookupResourceByType((pointer *) &maskfont, mask, RT_FONT, client,
|
||||
DixUseAccess);
|
||||
if (rc != Success && mask != None)
|
||||
{
|
||||
if (rc != Success && mask != None) {
|
||||
client->errorValue = mask;
|
||||
return rc;
|
||||
}
|
||||
if (sourcefont != maskfont)
|
||||
pShare = (GlyphSharePtr) NULL;
|
||||
else
|
||||
{
|
||||
else {
|
||||
for (pShare = sharedGlyphs;
|
||||
pShare &&
|
||||
((pShare->font != sourcefont) ||
|
||||
(pShare->sourceChar != sourceChar) ||
|
||||
(pShare->maskChar != maskChar));
|
||||
pShare = pShare->next)
|
||||
;
|
||||
(pShare->maskChar != maskChar)); pShare = pShare->next);
|
||||
}
|
||||
if (pShare)
|
||||
{
|
||||
if (pShare) {
|
||||
pCurs = (CursorPtr) calloc(CURSOR_REC_SIZE, 1);
|
||||
if (!pCurs)
|
||||
return BadAlloc;
|
||||
|
|
@ -345,15 +325,12 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar,
|
|||
bits = pShare->bits;
|
||||
bits->refcnt++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!CursorMetricsFromGlyph(sourcefont, sourceChar, &cm))
|
||||
{
|
||||
else {
|
||||
if (!CursorMetricsFromGlyph(sourcefont, sourceChar, &cm)) {
|
||||
client->errorValue = sourceChar;
|
||||
return BadValue;
|
||||
}
|
||||
if (!maskfont)
|
||||
{
|
||||
if (!maskfont) {
|
||||
long n;
|
||||
unsigned char *mskptr;
|
||||
|
||||
|
|
@ -364,40 +341,33 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar,
|
|||
while (--n >= 0)
|
||||
*mskptr++ = ~0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!CursorMetricsFromGlyph(maskfont, maskChar, &cm))
|
||||
{
|
||||
else {
|
||||
if (!CursorMetricsFromGlyph(maskfont, maskChar, &cm)) {
|
||||
client->errorValue = maskChar;
|
||||
return BadValue;
|
||||
}
|
||||
if ((rc = ServerBitsFromGlyph(maskfont, maskChar, &cm, &mskbits)))
|
||||
return rc;
|
||||
}
|
||||
if ((rc = ServerBitsFromGlyph(sourcefont, sourceChar, &cm, &srcbits)))
|
||||
{
|
||||
if ((rc = ServerBitsFromGlyph(sourcefont, sourceChar, &cm, &srcbits))) {
|
||||
free(mskbits);
|
||||
return rc;
|
||||
}
|
||||
if (sourcefont != maskfont)
|
||||
{
|
||||
pCurs =
|
||||
(CursorPtr)calloc(CURSOR_REC_SIZE + CURSOR_BITS_SIZE, 1);
|
||||
if (sourcefont != maskfont) {
|
||||
pCurs = (CursorPtr) calloc(CURSOR_REC_SIZE + CURSOR_BITS_SIZE, 1);
|
||||
if (pCurs)
|
||||
bits = (CursorBitsPtr) ((char *) pCurs + CURSOR_REC_SIZE);
|
||||
else
|
||||
bits = (CursorBitsPtr) NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
pCurs = (CursorPtr) calloc(CURSOR_REC_SIZE, 1);
|
||||
if (pCurs)
|
||||
bits = (CursorBitsPtr) calloc(CURSOR_BITS_SIZE, 1);
|
||||
else
|
||||
bits = (CursorBitsPtr) NULL;
|
||||
}
|
||||
if (!bits)
|
||||
{
|
||||
if (!bits) {
|
||||
free(pCurs);
|
||||
free(mskbits);
|
||||
free(srcbits);
|
||||
|
|
@ -416,12 +386,10 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar,
|
|||
bits->yhot = cm.yhot;
|
||||
if (sourcefont != maskfont)
|
||||
bits->refcnt = -1;
|
||||
else
|
||||
{
|
||||
else {
|
||||
bits->refcnt = 1;
|
||||
pShare = malloc(sizeof(GlyphShare));
|
||||
if (!pShare)
|
||||
{
|
||||
if (!pShare) {
|
||||
FreeCursorBits(bits);
|
||||
return BadAlloc;
|
||||
}
|
||||
|
|
|
|||
362
dix/devices.c
362
dix/devices.c
|
|
@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
|
|||
used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization from The Open Group.
|
||||
|
||||
|
||||
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
|
||||
|
||||
All Rights Reserved
|
||||
|
|
@ -45,8 +44,6 @@ SOFTWARE.
|
|||
|
||||
********************************************************/
|
||||
|
||||
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
|
@ -143,25 +140,23 @@ static int
|
|||
DeviceSetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop,
|
||||
BOOL checkonly)
|
||||
{
|
||||
if (property == XIGetKnownProperty(XI_PROP_ENABLED))
|
||||
{
|
||||
if (property == XIGetKnownProperty(XI_PROP_ENABLED)) {
|
||||
if (prop->format != 8 || prop->type != XA_INTEGER || prop->size != 1)
|
||||
return BadValue;
|
||||
|
||||
/* Don't allow disabling of VCP/VCK */
|
||||
if ((dev == inputInfo.pointer || dev == inputInfo.keyboard) &&
|
||||
!(*(CARD8*)prop->data))
|
||||
if ((dev == inputInfo.pointer ||dev ==
|
||||
inputInfo.keyboard) &&!(*(CARD8 *) prop->data))
|
||||
return BadAccess;
|
||||
|
||||
if (!checkonly)
|
||||
{
|
||||
if (!checkonly) {
|
||||
if ((*((CARD8 *) prop->data)) && !dev->enabled)
|
||||
EnableDevice(dev, TRUE);
|
||||
else if (!(*((CARD8 *) prop->data)) && dev->enabled)
|
||||
DisableDevice(dev, TRUE);
|
||||
}
|
||||
} else if (property == XIGetKnownProperty(XI_PROP_TRANSFORM))
|
||||
{
|
||||
}
|
||||
else if (property == XIGetKnownProperty(XI_PROP_TRANSFORM)) {
|
||||
float *f = (float *) prop->data;
|
||||
int i;
|
||||
|
||||
|
|
@ -199,8 +194,7 @@ PairDevices(ClientPtr client, DeviceIntPtr ptr, DeviceIntPtr kbd)
|
|||
if (ptr->spriteInfo->paired)
|
||||
return BadDevice;
|
||||
|
||||
if (kbd->spriteInfo->spriteOwner)
|
||||
{
|
||||
if (kbd->spriteInfo->spriteOwner) {
|
||||
free(kbd->spriteInfo->sprite);
|
||||
kbd->spriteInfo->sprite = NULL;
|
||||
kbd->spriteInfo->spriteOwner = FALSE;
|
||||
|
|
@ -212,7 +206,6 @@ PairDevices(ClientPtr client, DeviceIntPtr ptr, DeviceIntPtr kbd)
|
|||
return Success;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Find and return the next unpaired MD pointer device.
|
||||
*/
|
||||
|
|
@ -220,10 +213,10 @@ static DeviceIntPtr
|
|||
NextFreePointerDevice(void)
|
||||
{
|
||||
DeviceIntPtr dev;
|
||||
|
||||
for (dev = inputInfo.devices; dev; dev = dev->next)
|
||||
if (IsMaster(dev) &&
|
||||
dev->spriteInfo->spriteOwner &&
|
||||
!dev->spriteInfo->paired)
|
||||
dev->spriteInfo->spriteOwner && !dev->spriteInfo->paired)
|
||||
return dev;
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -251,14 +244,17 @@ AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart)
|
|||
devind[devtmp->id]++;
|
||||
for (devtmp = inputInfo.off_devices; devtmp; devtmp = devtmp->next)
|
||||
devind[devtmp->id]++;
|
||||
for (devid = 2; devid < MAXDEVICES && devind[devid]; devid++)
|
||||
;
|
||||
for (devid = 2; devid < MAXDEVICES && devind[devid]; devid++);
|
||||
|
||||
if (devid >= MAXDEVICES)
|
||||
return (DeviceIntPtr) NULL;
|
||||
dev = _dixAllocateObjectWithPrivates(sizeof(DeviceIntRec) + sizeof(SpriteInfoRec),
|
||||
sizeof(DeviceIntRec) + sizeof(SpriteInfoRec),
|
||||
offsetof(DeviceIntRec, devPrivates), PRIVATE_DEVICE);
|
||||
dev =
|
||||
_dixAllocateObjectWithPrivates(sizeof(DeviceIntRec) +
|
||||
sizeof(SpriteInfoRec),
|
||||
sizeof(DeviceIntRec) +
|
||||
sizeof(SpriteInfoRec),
|
||||
offsetof(DeviceIntRec, devPrivates),
|
||||
PRIVATE_DEVICE);
|
||||
if (!dev)
|
||||
return (DeviceIntPtr) NULL;
|
||||
|
||||
|
|
@ -294,16 +290,15 @@ AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart)
|
|||
|
||||
inputInfo.numDevices++;
|
||||
|
||||
for (prev = &inputInfo.off_devices; *prev; prev = &(*prev)->next)
|
||||
;
|
||||
for (prev = &inputInfo.off_devices; *prev; prev = &(*prev)->next);
|
||||
*prev = dev;
|
||||
dev->next = NULL;
|
||||
|
||||
enabled = FALSE;
|
||||
XIChangeDeviceProperty(dev, XIGetKnownProperty(XI_PROP_ENABLED),
|
||||
XA_INTEGER, 8, PropModeReplace, 1, &enabled,
|
||||
XA_INTEGER, 8, PropModeReplace, 1, &enabled, FALSE);
|
||||
XISetDevicePropertyDeletable(dev, XIGetKnownProperty(XI_PROP_ENABLED),
|
||||
FALSE);
|
||||
XISetDevicePropertyDeletable(dev, XIGetKnownProperty(XI_PROP_ENABLED), FALSE);
|
||||
|
||||
/* unity matrix */
|
||||
memset(transform, 0, sizeof(transform));
|
||||
|
|
@ -359,30 +354,25 @@ EnableDevice(DeviceIntPtr dev, BOOL sendevent)
|
|||
int flags[MAXDEVICES] = { 0 };
|
||||
|
||||
for (prev = &inputInfo.off_devices;
|
||||
*prev && (*prev != dev);
|
||||
prev = &(*prev)->next)
|
||||
;
|
||||
*prev && (*prev != dev); prev = &(*prev)->next);
|
||||
|
||||
if (!dev->spriteInfo->sprite)
|
||||
{
|
||||
if (IsMaster(dev))
|
||||
{
|
||||
if (!dev->spriteInfo->sprite) {
|
||||
if (IsMaster(dev)) {
|
||||
/* Sprites appear on first root window, so we can hardcode it */
|
||||
if (dev->spriteInfo->spriteOwner)
|
||||
{
|
||||
if (dev->spriteInfo->spriteOwner) {
|
||||
InitializeSprite(dev, screenInfo.screens[0]->root);
|
||||
/* mode doesn't matter */
|
||||
EnterWindow(dev, screenInfo.screens[0]->root, NotifyAncestor);
|
||||
}
|
||||
else if ((other = NextFreePointerDevice()) == NULL)
|
||||
{
|
||||
else if ((other = NextFreePointerDevice()) == NULL) {
|
||||
ErrorF("[dix] cannot find pointer to pair with. "
|
||||
"This is a bug.\n");
|
||||
return FALSE;
|
||||
} else
|
||||
}
|
||||
else
|
||||
PairDevices(NULL, other, dev);
|
||||
} else
|
||||
{
|
||||
}
|
||||
else {
|
||||
if (dev->coreEvents)
|
||||
other = (IsPointerDevice(dev)) ? inputInfo.pointer :
|
||||
inputInfo.keyboard;
|
||||
|
|
@ -400,19 +390,16 @@ EnableDevice(DeviceIntPtr dev, BOOL sendevent)
|
|||
dev->enabled = TRUE;
|
||||
*prev = dev->next;
|
||||
|
||||
for (prev = &inputInfo.devices; *prev; prev = &(*prev)->next)
|
||||
;
|
||||
for (prev = &inputInfo.devices; *prev; prev = &(*prev)->next);
|
||||
*prev = dev;
|
||||
dev->next = NULL;
|
||||
|
||||
enabled = TRUE;
|
||||
XIChangeDeviceProperty(dev, XIGetKnownProperty(XI_PROP_ENABLED),
|
||||
XA_INTEGER, 8, PropModeReplace, 1, &enabled,
|
||||
TRUE);
|
||||
XA_INTEGER, 8, PropModeReplace, 1, &enabled, TRUE);
|
||||
|
||||
SendDevicePresenceEvent(dev->id, DeviceEnabled);
|
||||
if (sendevent)
|
||||
{
|
||||
if (sendevent) {
|
||||
flags[dev->id] |= XIDeviceEnabled;
|
||||
XISendDeviceHierarchyEvent(flags);
|
||||
}
|
||||
|
|
@ -441,39 +428,29 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent)
|
|||
int flags[MAXDEVICES] = { 0 };
|
||||
|
||||
for (prev = &inputInfo.devices;
|
||||
*prev && (*prev != dev);
|
||||
prev = &(*prev)->next)
|
||||
;
|
||||
*prev && (*prev != dev); prev = &(*prev)->next);
|
||||
if (*prev != dev)
|
||||
return FALSE;
|
||||
|
||||
/* float attached devices */
|
||||
if (IsMaster(dev))
|
||||
{
|
||||
for (other = inputInfo.devices; other; other = other->next)
|
||||
{
|
||||
if (!IsMaster(other) && GetMaster(other, MASTER_ATTACHED) == dev)
|
||||
{
|
||||
if (IsMaster(dev)) {
|
||||
for (other = inputInfo.devices; other; other = other->next) {
|
||||
if (!IsMaster(other) && GetMaster(other, MASTER_ATTACHED) == dev) {
|
||||
AttachDevice(NULL, other, NULL);
|
||||
flags[other->id] |= XISlaveDetached;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (other = inputInfo.devices; other; other = other->next)
|
||||
{
|
||||
else {
|
||||
for (other = inputInfo.devices; other; other = other->next) {
|
||||
if (IsMaster(other) && other->lastSlave == dev)
|
||||
other->lastSlave = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (IsMaster(dev) && dev->spriteInfo->sprite)
|
||||
{
|
||||
for (other = inputInfo.devices; other; other = other->next)
|
||||
{
|
||||
if (other->spriteInfo->paired == dev)
|
||||
{
|
||||
if (IsMaster(dev) && dev->spriteInfo->sprite) {
|
||||
for (other = inputInfo.devices; other; other = other->next) {
|
||||
if (other->spriteInfo->paired == dev) {
|
||||
ErrorF("[dix] cannot disable device, still paired. "
|
||||
"This is a bug. \n");
|
||||
return FALSE;
|
||||
|
|
@ -487,8 +464,7 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent)
|
|||
/* now that the device is disabled, we can reset the signal handler's
|
||||
* last.slave */
|
||||
OsBlockSignals();
|
||||
for (other = inputInfo.devices; other; other = other->next)
|
||||
{
|
||||
for (other = inputInfo.devices; other; other = other->next) {
|
||||
if (other->last.slave == dev)
|
||||
other->last.slave = NULL;
|
||||
}
|
||||
|
|
@ -503,12 +479,10 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent)
|
|||
|
||||
enabled = FALSE;
|
||||
XIChangeDeviceProperty(dev, XIGetKnownProperty(XI_PROP_ENABLED),
|
||||
XA_INTEGER, 8, PropModeReplace, 1, &enabled,
|
||||
TRUE);
|
||||
XA_INTEGER, 8, PropModeReplace, 1, &enabled, TRUE);
|
||||
|
||||
SendDevicePresenceEvent(dev->id, DeviceDisabled);
|
||||
if (sendevent)
|
||||
{
|
||||
if (sendevent) {
|
||||
flags[dev->id] = XIDeviceDisabled;
|
||||
XISendDeviceHierarchyEvent(flags);
|
||||
}
|
||||
|
|
@ -548,8 +522,7 @@ ActivateDevice(DeviceIntPtr dev, BOOL sendevent)
|
|||
ret = BadAlloc;
|
||||
|
||||
SendDevicePresenceEvent(dev->id, DeviceAdded);
|
||||
if (sendevent)
|
||||
{
|
||||
if (sendevent) {
|
||||
int flags[MAXDEVICES] = { 0 };
|
||||
flags[dev->id] = XISlaveAdded;
|
||||
XISendDeviceHierarchyEvent(flags);
|
||||
|
|
@ -585,8 +558,7 @@ CoreKeyboardProc(DeviceIntPtr pDev, int what)
|
|||
switch (what) {
|
||||
case DEVICE_INIT:
|
||||
if (!InitKeyboardDeviceStruct(pDev, NULL, CoreKeyboardBell,
|
||||
CoreKeyboardCtl))
|
||||
{
|
||||
CoreKeyboardCtl)) {
|
||||
ErrorF("Keyboard initialization failed. This could be a missing "
|
||||
"or incorrect setup of xkeyboard-config.\n");
|
||||
return BadValue;
|
||||
|
|
@ -635,10 +607,10 @@ CorePointerProc(DeviceIntPtr pDev, int what)
|
|||
axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X);
|
||||
axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y);
|
||||
|
||||
if (!InitPointerDeviceStruct((DevicePtr)pDev, map, NBUTTONS, btn_labels,
|
||||
(PtrCtrlProcPtr)NoopDDA,
|
||||
GetMotionHistorySize(), NAXES, axes_labels))
|
||||
{
|
||||
if (!InitPointerDeviceStruct
|
||||
((DevicePtr) pDev, map, NBUTTONS, btn_labels,
|
||||
(PtrCtrlProcPtr) NoopDDA, GetMotionHistorySize(), NAXES,
|
||||
axes_labels)) {
|
||||
ErrorF("Could not initialize device '%s'. Out of memory.\n",
|
||||
pDev->name);
|
||||
return BadAlloc; /* IPDS only fails on allocs */
|
||||
|
|
@ -676,8 +648,7 @@ InitCoreDevices(void)
|
|||
{
|
||||
if (AllocDevicePair(serverClient, "Virtual core",
|
||||
&inputInfo.pointer, &inputInfo.keyboard,
|
||||
CorePointerProc, CoreKeyboardProc,
|
||||
TRUE) != Success)
|
||||
CorePointerProc, CoreKeyboardProc, TRUE) != Success)
|
||||
FatalError("Failed to allocate core devices");
|
||||
|
||||
if (ActivateDevice(inputInfo.pointer, TRUE) != Success ||
|
||||
|
|
@ -714,8 +685,7 @@ InitAndStartDevices(void)
|
|||
}
|
||||
|
||||
/* enable real devices */
|
||||
for (dev = inputInfo.off_devices; dev; dev = next)
|
||||
{
|
||||
for (dev = inputInfo.off_devices; dev; dev = next) {
|
||||
DebugF("(dix) enabling device %d\n", dev->id);
|
||||
next = dev->next;
|
||||
if (dev->inited && dev->startup)
|
||||
|
|
@ -734,13 +704,12 @@ FreeDeviceClass(int type, pointer *class)
|
|||
if (!(*class))
|
||||
return;
|
||||
|
||||
switch(type)
|
||||
{
|
||||
switch (type) {
|
||||
case KeyClass:
|
||||
{
|
||||
KeyClassPtr *k = (KeyClassPtr *) class;
|
||||
if ((*k)->xkbInfo)
|
||||
{
|
||||
|
||||
if ((*k)->xkbInfo) {
|
||||
XkbFreeInfo((*k)->xkbInfo);
|
||||
(*k)->xkbInfo = NULL;
|
||||
}
|
||||
|
|
@ -750,6 +719,7 @@ FreeDeviceClass(int type, pointer *class)
|
|||
case ButtonClass:
|
||||
{
|
||||
ButtonClassPtr *b = (ButtonClassPtr *) class;
|
||||
|
||||
free((*b)->xkb_acts);
|
||||
free((*b));
|
||||
break;
|
||||
|
|
@ -767,8 +737,7 @@ FreeDeviceClass(int type, pointer *class)
|
|||
TouchClassPtr *t = (TouchClassPtr *) class;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < (*t)->num_touches; i++)
|
||||
{
|
||||
for (i = 0; i < (*t)->num_touches; i++) {
|
||||
free((*t)->touches[i].sprite.spriteTrace);
|
||||
free((*t)->touches[i].listeners);
|
||||
free((*t)->touches[i].valuators);
|
||||
|
|
@ -780,6 +749,7 @@ FreeDeviceClass(int type, pointer *class)
|
|||
case FocusClass:
|
||||
{
|
||||
FocusClassPtr *f = (FocusClassPtr *) class;
|
||||
|
||||
free((*f)->trace);
|
||||
free((*f));
|
||||
break;
|
||||
|
|
@ -787,6 +757,7 @@ FreeDeviceClass(int type, pointer *class)
|
|||
case ProximityClass:
|
||||
{
|
||||
ProximityClassPtr *p = (ProximityClassPtr *) class;
|
||||
|
||||
free((*p));
|
||||
break;
|
||||
}
|
||||
|
|
@ -800,12 +771,12 @@ FreeFeedbackClass(int type, pointer *class)
|
|||
if (!(*class))
|
||||
return;
|
||||
|
||||
switch(type)
|
||||
{
|
||||
switch (type) {
|
||||
case KbdFeedbackClass:
|
||||
{
|
||||
KbdFeedbackPtr *kbdfeed = (KbdFeedbackPtr *) class;
|
||||
KbdFeedbackPtr k, knext;
|
||||
|
||||
for (k = (*kbdfeed); k; k = knext) {
|
||||
knext = k->next;
|
||||
if (k->xkb_sli)
|
||||
|
|
@ -937,8 +908,7 @@ CloseDevice(DeviceIntPtr dev)
|
|||
classes = (ClassesPtr) & dev->key;
|
||||
FreeAllDeviceClasses(classes);
|
||||
|
||||
if (IsMaster(dev))
|
||||
{
|
||||
if (IsMaster(dev)) {
|
||||
classes = dev->unused_classes;
|
||||
FreeAllDeviceClasses(classes);
|
||||
free(classes);
|
||||
|
|
@ -952,10 +922,8 @@ CloseDevice(DeviceIntPtr dev)
|
|||
}
|
||||
|
||||
/* a client may have the device set as client pointer */
|
||||
for (j = 0; j < currentMaxClients; j++)
|
||||
{
|
||||
if (clients[j] && clients[j]->clientPtr == dev)
|
||||
{
|
||||
for (j = 0; j < currentMaxClients; j++) {
|
||||
if (clients[j] && clients[j]->clientPtr == dev) {
|
||||
clients[j]->clientPtr = NULL;
|
||||
clients[j]->clientPtr = PickPointer(clients[j]);
|
||||
}
|
||||
|
|
@ -991,8 +959,7 @@ CloseDeviceList(DeviceIntPtr *listHead)
|
|||
freedIds[i] = FALSE;
|
||||
|
||||
dev = *listHead;
|
||||
while (dev != NULL)
|
||||
{
|
||||
while (dev != NULL) {
|
||||
freedIds[dev->id] = TRUE;
|
||||
DeleteInputDeviceRequest(dev);
|
||||
|
||||
|
|
@ -1018,8 +985,7 @@ CloseDownDevices(void)
|
|||
* AttachDevice(NULL, dev, NULL). Instead, we have to forcibly set master
|
||||
* to NULL and pretend nothing happened.
|
||||
*/
|
||||
for (dev = inputInfo.devices; dev; dev = dev->next)
|
||||
{
|
||||
for (dev = inputInfo.devices; dev; dev = dev->next) {
|
||||
if (!IsMaster(dev) && !IsFloating(dev))
|
||||
dev->master = NULL;
|
||||
}
|
||||
|
|
@ -1028,12 +994,14 @@ CloseDownDevices(void)
|
|||
CloseDeviceList(&inputInfo.off_devices);
|
||||
|
||||
CloseDevice(inputInfo.pointer);
|
||||
|
||||
CloseDevice(inputInfo.keyboard);
|
||||
|
||||
inputInfo.devices = NULL;
|
||||
inputInfo.off_devices = NULL;
|
||||
inputInfo.keyboard = NULL;
|
||||
inputInfo.pointer = NULL;
|
||||
|
||||
XkbDeleteRulesDflts();
|
||||
|
||||
OsReleaseSignals();
|
||||
|
|
@ -1084,8 +1052,7 @@ RemoveDevice(DeviceIntPtr dev, BOOL sendevent)
|
|||
initialized = dev->inited;
|
||||
deviceid = dev->id;
|
||||
|
||||
if (initialized)
|
||||
{
|
||||
if (initialized) {
|
||||
if (DevHasCursor(dev))
|
||||
screen->DisplayCursor(dev, screen, NullCursor);
|
||||
|
||||
|
|
@ -1148,6 +1115,7 @@ dixLookupDevice(DeviceIntPtr *pDev, int id, ClientPtr client, Mask access_mode)
|
|||
{
|
||||
DeviceIntPtr dev;
|
||||
int rc;
|
||||
|
||||
*pDev = NULL;
|
||||
|
||||
for (dev = inputInfo.devices; dev; dev = dev->next) {
|
||||
|
|
@ -1267,11 +1235,16 @@ ValuatorClassPtr
|
|||
AllocValuatorClass(ValuatorClassPtr src, int numAxes)
|
||||
{
|
||||
ValuatorClassPtr v;
|
||||
|
||||
/* force alignment with double */
|
||||
union align_u { ValuatorClassRec valc; double d; } *align;
|
||||
union align_u {
|
||||
ValuatorClassRec valc;
|
||||
double d;
|
||||
} *align;
|
||||
int size;
|
||||
|
||||
size = sizeof(union align_u) + numAxes * (sizeof(double) + sizeof(AxisInfo));
|
||||
size =
|
||||
sizeof(union align_u) + numAxes * (sizeof(double) + sizeof(AxisInfo));
|
||||
align = (union align_u *) realloc(src, size);
|
||||
|
||||
if (!align)
|
||||
|
|
@ -1298,8 +1271,7 @@ InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes, Atom *labels,
|
|||
if (!dev)
|
||||
return FALSE;
|
||||
|
||||
if (numAxes > MAX_VALUATORS)
|
||||
{
|
||||
if (numAxes > MAX_VALUATORS) {
|
||||
LogMessage(X_WARNING,
|
||||
"Device '%s' has %d axes, only using first %d.\n",
|
||||
dev->name, numAxes, MAX_VALUATORS);
|
||||
|
|
@ -1311,8 +1283,7 @@ InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes, Atom *labels,
|
|||
return FALSE;
|
||||
|
||||
dev->last.scroll = valuator_mask_new(numAxes);
|
||||
if (!dev->last.scroll)
|
||||
{
|
||||
if (!dev->last.scroll) {
|
||||
free(valc);
|
||||
return FALSE;
|
||||
}
|
||||
|
|
@ -1335,8 +1306,8 @@ InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes, Atom *labels,
|
|||
AllocateMotionHistory(dev);
|
||||
|
||||
for (i = 0; i < numAxes; i++) {
|
||||
InitValuatorAxisStruct(dev, i, labels[i], NO_AXIS_LIMITS, NO_AXIS_LIMITS,
|
||||
0, 0, 0, mode);
|
||||
InitValuatorAxisStruct(dev, i, labels[i], NO_AXIS_LIMITS,
|
||||
NO_AXIS_LIMITS, 0, 0, 0, mode);
|
||||
valc->axisVal[i] = 0;
|
||||
}
|
||||
|
||||
|
|
@ -1352,10 +1323,13 @@ InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes, Atom *labels,
|
|||
|
||||
/* global list of acceleration schemes */
|
||||
ValuatorAccelerationRec pointerAccelerationScheme[] = {
|
||||
{PtrAccelNoOp, NULL, NULL, NULL, NULL},
|
||||
{PtrAccelNoOp, NULL, NULL, NULL, NULL}
|
||||
,
|
||||
{PtrAccelPredictable, acceleratePointerPredictable, NULL,
|
||||
InitPredictableAccelerationScheme, AccelerationDefaultCleanup},
|
||||
{PtrAccelLightweight, acceleratePointerLightweight, NULL, NULL, NULL},
|
||||
InitPredictableAccelerationScheme, AccelerationDefaultCleanup}
|
||||
,
|
||||
{PtrAccelLightweight, acceleratePointerLightweight, NULL, NULL, NULL}
|
||||
,
|
||||
{-1, NULL, NULL, NULL, NULL} /* terminator */
|
||||
};
|
||||
|
||||
|
|
@ -1364,8 +1338,7 @@ ValuatorAccelerationRec pointerAccelerationScheme[] = {
|
|||
* change anything if unsuccessful.
|
||||
*/
|
||||
Bool
|
||||
InitPointerAccelerationScheme(DeviceIntPtr dev,
|
||||
int scheme)
|
||||
InitPointerAccelerationScheme(DeviceIntPtr dev, int scheme)
|
||||
{
|
||||
int x, i = -1;
|
||||
ValuatorClassPtr val;
|
||||
|
|
@ -1393,10 +1366,12 @@ InitPointerAccelerationScheme(DeviceIntPtr dev,
|
|||
|
||||
if (pointerAccelerationScheme[i].AccelInitProc) {
|
||||
if (!pointerAccelerationScheme[i].AccelInitProc(dev,
|
||||
&pointerAccelerationScheme[i])) {
|
||||
&pointerAccelerationScheme
|
||||
[i])) {
|
||||
return FALSE;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
val->accelScheme = pointerAccelerationScheme[i];
|
||||
}
|
||||
return TRUE;
|
||||
|
|
@ -1440,25 +1415,29 @@ InitPtrFeedbackClassDeviceStruct(DeviceIntPtr dev, PtrCtrlProcPtr controlProc)
|
|||
}
|
||||
|
||||
static LedCtrl defaultLedControl = {
|
||||
DEFAULT_LEDS, DEFAULT_LEDS_MASK, 0};
|
||||
DEFAULT_LEDS, DEFAULT_LEDS_MASK, 0
|
||||
};
|
||||
|
||||
static BellCtrl defaultBellControl = {
|
||||
DEFAULT_BELL,
|
||||
DEFAULT_BELL_PITCH,
|
||||
DEFAULT_BELL_DURATION,
|
||||
0};
|
||||
0
|
||||
};
|
||||
|
||||
static IntegerCtrl defaultIntegerControl = {
|
||||
DEFAULT_INT_RESOLUTION,
|
||||
DEFAULT_INT_MIN_VALUE,
|
||||
DEFAULT_INT_MAX_VALUE,
|
||||
DEFAULT_INT_DISPLAYED,
|
||||
0};
|
||||
0
|
||||
};
|
||||
|
||||
Bool
|
||||
InitStringFeedbackClassDeviceStruct (
|
||||
DeviceIntPtr dev, StringCtrlProcPtr controlProc,
|
||||
int max_symbols, int num_symbols_supported, KeySym *symbols)
|
||||
InitStringFeedbackClassDeviceStruct(DeviceIntPtr dev,
|
||||
StringCtrlProcPtr controlProc,
|
||||
int max_symbols, int num_symbols_supported,
|
||||
KeySym * symbols)
|
||||
{
|
||||
int i;
|
||||
StringFeedbackPtr feedc;
|
||||
|
|
@ -1470,10 +1449,10 @@ InitStringFeedbackClassDeviceStruct (
|
|||
feedc->ctrl.num_symbols_supported = num_symbols_supported;
|
||||
feedc->ctrl.num_symbols_displayed = 0;
|
||||
feedc->ctrl.max_symbols = max_symbols;
|
||||
feedc->ctrl.symbols_supported = malloc(sizeof (KeySym) * num_symbols_supported);
|
||||
feedc->ctrl.symbols_supported =
|
||||
malloc(sizeof(KeySym) * num_symbols_supported);
|
||||
feedc->ctrl.symbols_displayed = malloc(sizeof(KeySym) * max_symbols);
|
||||
if (!feedc->ctrl.symbols_supported || !feedc->ctrl.symbols_displayed)
|
||||
{
|
||||
if (!feedc->ctrl.symbols_supported || !feedc->ctrl.symbols_displayed) {
|
||||
free(feedc->ctrl.symbols_supported);
|
||||
free(feedc->ctrl.symbols_displayed);
|
||||
free(feedc);
|
||||
|
|
@ -1531,7 +1510,8 @@ InitLedFeedbackClassDeviceStruct (DeviceIntPtr dev, LedCtrlProcPtr controlProc)
|
|||
}
|
||||
|
||||
Bool
|
||||
InitIntegerFeedbackClassDeviceStruct (DeviceIntPtr dev, IntegerCtrlProcPtr controlProc)
|
||||
InitIntegerFeedbackClassDeviceStruct(DeviceIntPtr dev,
|
||||
IntegerCtrlProcPtr controlProc)
|
||||
{
|
||||
IntegerFeedbackPtr feedc;
|
||||
|
||||
|
|
@ -1549,9 +1529,9 @@ InitIntegerFeedbackClassDeviceStruct (DeviceIntPtr dev, IntegerCtrlProcPtr contr
|
|||
}
|
||||
|
||||
Bool
|
||||
InitPointerDeviceStruct(DevicePtr device, CARD8 *map, int numButtons, Atom* btn_labels,
|
||||
PtrCtrlProcPtr controlProc, int numMotionEvents,
|
||||
int numAxes, Atom *axes_labels)
|
||||
InitPointerDeviceStruct(DevicePtr device, CARD8 *map, int numButtons,
|
||||
Atom *btn_labels, PtrCtrlProcPtr controlProc,
|
||||
int numMotionEvents, int numAxes, Atom *axes_labels)
|
||||
{
|
||||
DeviceIntPtr dev = (DeviceIntPtr) device;
|
||||
|
||||
|
|
@ -1584,8 +1564,7 @@ InitTouchClassDeviceStruct(DeviceIntPtr device, unsigned int max_touches,
|
|||
if (num_axes < 2)
|
||||
return FALSE;
|
||||
|
||||
if (num_axes > MAX_VALUATORS)
|
||||
{
|
||||
if (num_axes > MAX_VALUATORS) {
|
||||
LogMessage(X_WARNING,
|
||||
"Device '%s' has %d touch axes, only using first %d.\n",
|
||||
device->name, num_axes, MAX_VALUATORS);
|
||||
|
|
@ -1639,10 +1618,8 @@ BadDeviceMap(BYTE *buff, int length, unsigned low, unsigned high, XID *errval)
|
|||
int i;
|
||||
|
||||
for (i = 0; i < length; i++)
|
||||
if (buff[i]) /* only check non-zero elements */
|
||||
{
|
||||
if ((low > buff[i]) || (high < buff[i]))
|
||||
{
|
||||
if (buff[i]) { /* only check non-zero elements */
|
||||
if ((low > buff[i]) || (high < buff[i])) {
|
||||
*errval = buff[i];
|
||||
return TRUE;
|
||||
}
|
||||
|
|
@ -1655,6 +1632,7 @@ ProcSetModifierMapping(ClientPtr client)
|
|||
{
|
||||
xSetModifierMappingReply rep;
|
||||
int rc;
|
||||
|
||||
REQUEST(xSetModifierMappingReq);
|
||||
REQUEST_AT_LEAST_SIZE(xSetModifierMappingReq);
|
||||
|
||||
|
|
@ -1686,6 +1664,7 @@ ProcGetModifierMapping(ClientPtr client)
|
|||
xGetModifierMappingReply rep;
|
||||
int max_keys_per_mod = 0;
|
||||
KeyCode *modkeymap = NULL;
|
||||
|
||||
REQUEST_SIZE_MATCH(xReq);
|
||||
|
||||
generate_modkeymap(client, PickKeyboard(client), &modkeymap,
|
||||
|
|
@ -1714,6 +1693,7 @@ ProcChangeKeyboardMapping(ClientPtr client)
|
|||
KeySymsRec keysyms;
|
||||
DeviceIntPtr pDev, tmp;
|
||||
int rc;
|
||||
|
||||
REQUEST_AT_LEAST_SIZE(xChangeKeyboardMappingReq);
|
||||
|
||||
len = client->req_len - bytes_to_int32(sizeof(xChangeKeyboardMappingReq));
|
||||
|
|
@ -1772,6 +1752,7 @@ ProcSetPointerMapping(ClientPtr client)
|
|||
int i, j;
|
||||
DeviceIntPtr ptr = PickPointer(client);
|
||||
xSetPointerMappingReply rep;
|
||||
|
||||
REQUEST(xSetPointerMappingReq);
|
||||
REQUEST_AT_LEAST_SIZE(xSetPointerMappingReq);
|
||||
|
||||
|
|
@ -1826,6 +1807,7 @@ ProcGetKeyboardMapping(ClientPtr client)
|
|||
XkbDescPtr xkb;
|
||||
KeySymsPtr syms;
|
||||
int rc;
|
||||
|
||||
REQUEST(xGetKeyboardMappingReq);
|
||||
REQUEST_SIZE_MATCH(xGetKeyboardMappingReq);
|
||||
|
||||
|
|
@ -1871,11 +1853,13 @@ int
|
|||
ProcGetPointerMapping(ClientPtr client)
|
||||
{
|
||||
xGetPointerMappingReply rep;
|
||||
|
||||
/* Apps may get different values each time they call GetPointerMapping as
|
||||
* the ClientPointer could change. */
|
||||
DeviceIntPtr ptr = PickPointer(client);
|
||||
ButtonClassPtr butc = ptr->button;
|
||||
int rc;
|
||||
|
||||
REQUEST_SIZE_MATCH(xReq);
|
||||
|
||||
rc = XaceHook(XACE_DEVICE_ACCESS, client, ptr, DixGetAttrAccess);
|
||||
|
|
@ -1896,6 +1880,7 @@ void
|
|||
NoteLedState(DeviceIntPtr keybd, int led, Bool on)
|
||||
{
|
||||
KeybdCtrl *ctrl = &keybd->kbdfeed->ctrl;
|
||||
|
||||
if (on)
|
||||
ctrl->leds |= ((Leds) 1 << (led - 1));
|
||||
else
|
||||
|
|
@ -1903,8 +1888,8 @@ NoteLedState(DeviceIntPtr keybd, int led, Bool on)
|
|||
}
|
||||
|
||||
int
|
||||
Ones(unsigned long mask) /* HACKMEM 169 */
|
||||
{
|
||||
Ones(unsigned long mask)
|
||||
{ /* HACKMEM 169 */
|
||||
unsigned long y;
|
||||
|
||||
y = (mask >> 1) & 033333333333;
|
||||
|
|
@ -2082,6 +2067,7 @@ ProcChangeKeyboardControl (ClientPtr client)
|
|||
BITS32 vmask;
|
||||
int ret = Success, error = Success;
|
||||
DeviceIntPtr pDev = NULL, keyboard;
|
||||
|
||||
REQUEST(xChangeKeyboardControlReq);
|
||||
|
||||
REQUEST_AT_LEAST_SIZE(xChangeKeyboardControlReq);
|
||||
|
|
@ -2089,7 +2075,8 @@ ProcChangeKeyboardControl (ClientPtr client)
|
|||
vmask = stuff->mask;
|
||||
vlist = (XID *) &stuff[1];
|
||||
|
||||
if (client->req_len != (sizeof(xChangeKeyboardControlReq)>>2)+Ones(vmask))
|
||||
if (client->req_len !=
|
||||
(sizeof(xChangeKeyboardControlReq) >> 2) + Ones(vmask))
|
||||
return BadLength;
|
||||
|
||||
keyboard = PickKeyboard(client);
|
||||
|
|
@ -2124,6 +2111,7 @@ ProcGetKeyboardControl (ClientPtr client)
|
|||
DeviceIntPtr kbd = PickKeyboard(client);
|
||||
KeybdCtrl *ctrl = &kbd->kbdfeed->ctrl;
|
||||
xGetKeyboardControlReply rep;
|
||||
|
||||
REQUEST_SIZE_MATCH(xReq);
|
||||
|
||||
rc = XaceHook(XACE_DEVICE_ACCESS, client, kbd, DixGetAttrAccess);
|
||||
|
|
@ -2152,6 +2140,7 @@ ProcBell(ClientPtr client)
|
|||
int base = keybd->kbdfeed->ctrl.bell;
|
||||
int newpercent;
|
||||
int rc;
|
||||
|
||||
REQUEST(xBellReq);
|
||||
REQUEST_SIZE_MATCH(xBellReq);
|
||||
|
||||
|
|
@ -2188,6 +2177,7 @@ ProcChangePointerControl(ClientPtr client)
|
|||
DeviceIntPtr dev, mouse = PickPointer(client);
|
||||
PtrCtrl ctrl; /* might get BadValue part way through */
|
||||
int rc;
|
||||
|
||||
REQUEST(xChangePointerControlReq);
|
||||
REQUEST_SIZE_MATCH(xChangePointerControlReq);
|
||||
|
||||
|
|
@ -2264,6 +2254,7 @@ ProcGetPointerControl(ClientPtr client)
|
|||
PtrCtrl *ctrl = &ptr->ptrfeed->ctrl;
|
||||
xGetPointerControlReply rep;
|
||||
int rc;
|
||||
|
||||
REQUEST_SIZE_MATCH(xReq);
|
||||
|
||||
rc = XaceHook(XACE_DEVICE_ACCESS, client, ptr, DixGetAttrAccess);
|
||||
|
|
@ -2306,6 +2297,7 @@ ProcGetMotionEvents(ClientPtr client)
|
|||
unsigned long nEvents;
|
||||
DeviceIntPtr mouse = PickPointer(client);
|
||||
TimeStamp start, stop;
|
||||
|
||||
REQUEST(xGetMotionEventsReq);
|
||||
REQUEST_SIZE_MATCH(xGetMotionEventsReq);
|
||||
|
||||
|
|
@ -2325,8 +2317,7 @@ ProcGetMotionEvents(ClientPtr client)
|
|||
stop = ClientTimeToServerTime(stuff->stop);
|
||||
if ((CompareTimeStamps(start, stop) != LATER) &&
|
||||
(CompareTimeStamps(start, currentTime) != LATER) &&
|
||||
mouse->valuator->numMotionEvents)
|
||||
{
|
||||
mouse->valuator->numMotionEvents) {
|
||||
if (CompareTimeStamps(stop, currentTime) == LATER)
|
||||
stop = currentTime;
|
||||
count = GetMotionHistory(mouse, &coords, start.milliseconds,
|
||||
|
|
@ -2340,8 +2331,7 @@ ProcGetMotionEvents(ClientPtr client)
|
|||
wBorderWidth(pWin);
|
||||
for (i = 0; i < count; i++)
|
||||
if ((xmin <= coords[i].x) && (coords[i].x < xmax) &&
|
||||
(ymin <= coords[i].y) && (coords[i].y < ymax))
|
||||
{
|
||||
(ymin <= coords[i].y) && (coords[i].y < ymax)) {
|
||||
coords[nEvents].time = coords[i].time;
|
||||
coords[nEvents].x = coords[i].x - pWin->drawable.x;
|
||||
coords[nEvents].y = coords[i].y - pWin->drawable.y;
|
||||
|
|
@ -2351,8 +2341,7 @@ ProcGetMotionEvents(ClientPtr client)
|
|||
rep.length = nEvents * bytes_to_int32(sizeof(xTimecoord));
|
||||
rep.nEvents = nEvents;
|
||||
WriteReplyToClient(client, sizeof(xGetMotionEventsReply), &rep);
|
||||
if (nEvents)
|
||||
{
|
||||
if (nEvents) {
|
||||
client->pSwapReplyFunc = (ReplySwapPtr) SwapTimeCoordWrite;
|
||||
WriteSwappedDataToClient(client, nEvents * sizeof(xTimecoord),
|
||||
(char *) coords);
|
||||
|
|
@ -2389,7 +2378,6 @@ ProcQueryKeymap(ClientPtr client)
|
|||
return Success;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Recalculate the number of buttons for the master device. The number of
|
||||
* buttons on the master device is equal to the number of buttons on the
|
||||
|
|
@ -2408,18 +2396,15 @@ RecalculateMasterButtons(DeviceIntPtr slave)
|
|||
if (!master)
|
||||
return;
|
||||
|
||||
for (dev = inputInfo.devices; dev; dev = dev->next)
|
||||
{
|
||||
for (dev = inputInfo.devices; dev; dev = dev->next) {
|
||||
if (IsMaster(dev) ||
|
||||
GetMaster(dev, MASTER_ATTACHED) != master ||
|
||||
!dev->button)
|
||||
GetMaster(dev, MASTER_ATTACHED) != master || !dev->button)
|
||||
continue;
|
||||
|
||||
maxbuttons = max(maxbuttons, dev->button->numButtons);
|
||||
}
|
||||
|
||||
if (master->button && master->button->numButtons != maxbuttons)
|
||||
{
|
||||
if (master->button && master->button->numButtons != maxbuttons) {
|
||||
int i;
|
||||
DeviceChangedEvent event;
|
||||
|
||||
|
|
@ -2436,21 +2421,19 @@ RecalculateMasterButtons(DeviceIntPtr slave)
|
|||
memcpy(&event.buttons.names, master->button->labels, maxbuttons *
|
||||
sizeof(Atom));
|
||||
|
||||
if (master->valuator)
|
||||
{
|
||||
if (master->valuator) {
|
||||
event.num_valuators = master->valuator->numAxes;
|
||||
for (i = 0; i < event.num_valuators; i++)
|
||||
{
|
||||
for (i = 0; i < event.num_valuators; i++) {
|
||||
event.valuators[i].min = master->valuator->axes[i].min_value;
|
||||
event.valuators[i].max = master->valuator->axes[i].max_value;
|
||||
event.valuators[i].resolution = master->valuator->axes[i].resolution;
|
||||
event.valuators[i].resolution =
|
||||
master->valuator->axes[i].resolution;
|
||||
event.valuators[i].mode = master->valuator->axes[i].mode;
|
||||
event.valuators[i].name = master->valuator->axes[i].label;
|
||||
}
|
||||
}
|
||||
|
||||
if (master->key)
|
||||
{
|
||||
if (master->key) {
|
||||
event.keys.min_keycode = master->key->xkbInfo->desc->min_key_code;
|
||||
event.keys.max_keycode = master->key->xkbInfo->desc->max_key_code;
|
||||
}
|
||||
|
|
@ -2475,21 +2458,18 @@ ReleaseButtonsAndKeys(DeviceIntPtr dev)
|
|||
return;
|
||||
|
||||
/* Release all buttons */
|
||||
for (i = 0; b && i < b->numButtons; i++)
|
||||
{
|
||||
if (BitIsOn(b->down, i))
|
||||
{
|
||||
nevents = GetPointerEvents(eventlist, dev, ButtonRelease, i, 0, NULL);
|
||||
for (i = 0; b && i < b->numButtons; i++) {
|
||||
if (BitIsOn(b->down, i)) {
|
||||
nevents =
|
||||
GetPointerEvents(eventlist, dev, ButtonRelease, i, 0, NULL);
|
||||
for (j = 0; j < nevents; j++)
|
||||
mieqProcessDeviceEvent(dev, &eventlist[j], NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/* Release all keys */
|
||||
for (i = 0; k && i < MAP_LENGTH; i++)
|
||||
{
|
||||
if (BitIsOn(k->down, i))
|
||||
{
|
||||
for (i = 0; k && i < MAP_LENGTH; i++) {
|
||||
if (BitIsOn(k->down, i)) {
|
||||
nevents = GetKeyboardEvents(eventlist, dev, KeyRelease, i, NULL);
|
||||
for (j = 0; j < nevents; j++)
|
||||
mieqProcessDeviceEvent(dev, &eventlist[j], NULL);
|
||||
|
|
@ -2513,6 +2493,7 @@ int
|
|||
AttachDevice(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr master)
|
||||
{
|
||||
ScreenPtr screen;
|
||||
|
||||
if (!dev || IsMaster(dev))
|
||||
return BadDevice;
|
||||
|
||||
|
|
@ -2524,8 +2505,7 @@ AttachDevice(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr master)
|
|||
return Success;
|
||||
|
||||
/* free the existing sprite. */
|
||||
if (IsFloating(dev) && dev->spriteInfo->paired == dev)
|
||||
{
|
||||
if (IsFloating(dev) && dev->spriteInfo->paired == dev) {
|
||||
screen = miPointerGetScreen(dev);
|
||||
screen->DeviceCursorCleanup(dev, screen);
|
||||
free(dev->spriteInfo->sprite);
|
||||
|
|
@ -2539,8 +2519,7 @@ AttachDevice(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr master)
|
|||
* Sprite has to be forced to NULL first, otherwise InitializeSprite won't
|
||||
* alloc new memory but overwrite the previous one.
|
||||
*/
|
||||
if (!master)
|
||||
{
|
||||
if (!master) {
|
||||
WindowPtr currentRoot;
|
||||
|
||||
if (dev->spriteInfo->sprite)
|
||||
|
|
@ -2555,8 +2534,8 @@ AttachDevice(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr master)
|
|||
InitializeSprite(dev, currentRoot);
|
||||
dev->spriteInfo->spriteOwner = FALSE;
|
||||
dev->spriteInfo->paired = dev;
|
||||
} else
|
||||
{
|
||||
}
|
||||
else {
|
||||
dev->spriteInfo->sprite = master->spriteInfo->sprite;
|
||||
dev->spriteInfo->paired = master;
|
||||
dev->spriteInfo->spriteOwner = FALSE;
|
||||
|
|
@ -2587,7 +2566,6 @@ GetPairedDevice(DeviceIntPtr dev)
|
|||
return dev->spriteInfo->paired;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the requested master for this device.
|
||||
* The return values are:
|
||||
|
|
@ -2615,18 +2593,17 @@ GetMaster(DeviceIntPtr dev, int which)
|
|||
master = dev;
|
||||
else {
|
||||
master = dev->master;
|
||||
if (!master && (which == POINTER_OR_FLOAT || which == KEYBOARD_OR_FLOAT))
|
||||
if (!master &&
|
||||
(which == POINTER_OR_FLOAT || which == KEYBOARD_OR_FLOAT))
|
||||
return dev;
|
||||
}
|
||||
|
||||
if (master && which != MASTER_ATTACHED)
|
||||
{
|
||||
if (which == MASTER_KEYBOARD || which == KEYBOARD_OR_FLOAT)
|
||||
{
|
||||
if (master && which != MASTER_ATTACHED) {
|
||||
if (which == MASTER_KEYBOARD || which == KEYBOARD_OR_FLOAT) {
|
||||
if (master->type != MASTER_KEYBOARD)
|
||||
master = GetPairedDevice(master);
|
||||
} else
|
||||
{
|
||||
}
|
||||
else {
|
||||
if (master->type != MASTER_POINTER)
|
||||
master = GetPairedDevice(master);
|
||||
}
|
||||
|
|
@ -2646,21 +2623,22 @@ int
|
|||
AllocDevicePair(ClientPtr client, const char *name,
|
||||
DeviceIntPtr *ptr,
|
||||
DeviceIntPtr *keybd,
|
||||
DeviceProc ptr_proc,
|
||||
DeviceProc keybd_proc,
|
||||
Bool master)
|
||||
DeviceProc ptr_proc, DeviceProc keybd_proc, Bool master)
|
||||
{
|
||||
DeviceIntPtr pointer;
|
||||
DeviceIntPtr keyboard;
|
||||
|
||||
*ptr = *keybd = NULL;
|
||||
|
||||
pointer = AddInputDevice(client, ptr_proc, TRUE);
|
||||
|
||||
if (!pointer)
|
||||
return BadAlloc;
|
||||
|
||||
if (asprintf(&pointer->name, "%s pointer", name) == -1) {
|
||||
pointer->name = NULL;
|
||||
RemoveDevice(pointer, FALSE);
|
||||
|
||||
return BadAlloc;
|
||||
}
|
||||
|
||||
|
|
@ -2677,9 +2655,9 @@ AllocDevicePair (ClientPtr client, const char* name,
|
|||
pointer->type = (master) ? MASTER_POINTER : SLAVE;
|
||||
|
||||
keyboard = AddInputDevice(client, keybd_proc, TRUE);
|
||||
if (!keyboard)
|
||||
{
|
||||
if (!keyboard) {
|
||||
RemoveDevice(pointer, FALSE);
|
||||
|
||||
return BadAlloc;
|
||||
}
|
||||
|
||||
|
|
@ -2687,6 +2665,7 @@ AllocDevicePair (ClientPtr client, const char* name,
|
|||
keyboard->name = NULL;
|
||||
RemoveDevice(keyboard, FALSE);
|
||||
RemoveDevice(pointer, FALSE);
|
||||
|
||||
return BadAlloc;
|
||||
}
|
||||
|
||||
|
|
@ -2704,9 +2683,11 @@ AllocDevicePair (ClientPtr client, const char* name,
|
|||
|
||||
/* The ClassesRec stores the device classes currently not used. */
|
||||
pointer->unused_classes = calloc(1, sizeof(ClassesRec));
|
||||
|
||||
keyboard->unused_classes = calloc(1, sizeof(ClassesRec));
|
||||
|
||||
*ptr = pointer;
|
||||
|
||||
*keybd = keyboard;
|
||||
|
||||
return Success;
|
||||
|
|
@ -2715,7 +2696,8 @@ AllocDevicePair (ClientPtr client, const char* name,
|
|||
/**
|
||||
* Return Relative or Absolute for the device.
|
||||
*/
|
||||
int valuator_get_mode(DeviceIntPtr dev, int axis)
|
||||
int
|
||||
valuator_get_mode(DeviceIntPtr dev, int axis)
|
||||
{
|
||||
return (dev->valuator->axes[axis].mode & DeviceMode);
|
||||
}
|
||||
|
|
@ -2724,12 +2706,14 @@ int valuator_get_mode(DeviceIntPtr dev, int axis)
|
|||
* Set the given mode for the axis. If axis is VALUATOR_MODE_ALL_AXES, then
|
||||
* set the mode for all axes.
|
||||
*/
|
||||
void valuator_set_mode(DeviceIntPtr dev, int axis, int mode)
|
||||
void
|
||||
valuator_set_mode(DeviceIntPtr dev, int axis, int mode)
|
||||
{
|
||||
if (axis != VALUATOR_MODE_ALL_AXES)
|
||||
dev->valuator->axes[axis].mode = mode;
|
||||
else {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < dev->valuator->numAxes; i++)
|
||||
dev->valuator->axes[i].mode = mode;
|
||||
}
|
||||
|
|
|
|||
837
dix/dispatch.c
837
dix/dispatch.c
File diff suppressed because it is too large
Load diff
401
dix/dixfonts.c
401
dix/dixfonts.c
File diff suppressed because it is too large
Load diff
215
dix/dixutils.c
215
dix/dixutils.c
|
|
@ -22,7 +22,6 @@ Except as contained in this notice, the name of The Open Group shall not be
|
|||
used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization from The Open Group.
|
||||
|
||||
|
||||
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
|
||||
|
||||
All Rights Reserved
|
||||
|
|
@ -81,7 +80,6 @@ Author: Adobe Systems Incorporated
|
|||
|
||||
*/
|
||||
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
|
@ -126,17 +124,16 @@ TimeStamp
|
|||
ClientTimeToServerTime(CARD32 c)
|
||||
{
|
||||
TimeStamp ts;
|
||||
|
||||
if (c == CurrentTime)
|
||||
return currentTime;
|
||||
ts.months = currentTime.months;
|
||||
ts.milliseconds = c;
|
||||
if (c > currentTime.milliseconds)
|
||||
{
|
||||
if (c > currentTime.milliseconds) {
|
||||
if (((unsigned long) c - currentTime.milliseconds) > HALFMONTH)
|
||||
ts.months -= 1;
|
||||
}
|
||||
else if (c < currentTime.milliseconds)
|
||||
{
|
||||
else if (c < currentTime.milliseconds) {
|
||||
if (((unsigned long) currentTime.milliseconds - c) > HALFMONTH)
|
||||
ts.months += 1;
|
||||
}
|
||||
|
|
@ -154,6 +151,7 @@ static unsigned char
|
|||
ISOLatin1ToLower(unsigned char source)
|
||||
{
|
||||
unsigned char dest;
|
||||
|
||||
if ((source >= XK_A) && (source <= XK_Z))
|
||||
dest = source + (XK_a - XK_A);
|
||||
else if ((source >= XK_Agrave) && (source <= XK_Odiaeresis))
|
||||
|
|
@ -165,15 +163,13 @@ ISOLatin1ToLower (unsigned char source)
|
|||
return dest;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
CompareISOLatin1Lowered(const unsigned char *s1, int s1len,
|
||||
const unsigned char *s2, int s2len)
|
||||
{
|
||||
unsigned char c1, c2;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
for (;;) {
|
||||
/* note -- compare against zero so that -1 ignores len */
|
||||
c1 = s1len-- ? *s1++ : '\0';
|
||||
c2 = s2len-- ? *s2++ : '\0';
|
||||
|
|
@ -203,7 +199,8 @@ dixLookupDrawable(DrawablePtr *pDraw, XID id, ClientPtr client,
|
|||
|
||||
*pDraw = NULL;
|
||||
|
||||
rc = dixLookupResourceByClass((pointer *)&pTmp, id, RC_DRAWABLE, client, access);
|
||||
rc = dixLookupResourceByClass((pointer *) &pTmp, id, RC_DRAWABLE, client,
|
||||
access);
|
||||
|
||||
if (rc != Success)
|
||||
client->errorValue = id;
|
||||
|
|
@ -223,6 +220,7 @@ int
|
|||
dixLookupWindow(WindowPtr *pWin, XID id, ClientPtr client, Mask access)
|
||||
{
|
||||
int rc;
|
||||
|
||||
rc = dixLookupDrawable((DrawablePtr *) pWin, id, client, M_WINDOW, access);
|
||||
/* dixLookupDrawable returns BadMatch iff id is a valid Drawable
|
||||
but is not a Window. Users of dixLookupWindow expect a BadWindow
|
||||
|
|
@ -246,8 +244,10 @@ dixLookupFontable(FontPtr *pFont, XID id, ClientPtr client, Mask access)
|
|||
{
|
||||
int rc;
|
||||
GC *pGC;
|
||||
|
||||
client->errorValue = id; /* EITHER font or gc */
|
||||
rc = dixLookupResourceByType((pointer *) pFont, id, RT_FONT, client, access);
|
||||
rc = dixLookupResourceByType((pointer *) pFont, id, RT_FONT, client,
|
||||
access);
|
||||
if (rc != BadFont)
|
||||
return rc;
|
||||
rc = dixLookupResourceByType((pointer *) &pGC, id, RT_GC, client, access);
|
||||
|
|
@ -294,14 +294,12 @@ AlterSaveSetForClient(ClientPtr client, WindowPtr pWin, unsigned mode,
|
|||
|
||||
numnow = client->numSaved;
|
||||
j = 0;
|
||||
if (numnow)
|
||||
{
|
||||
if (numnow) {
|
||||
pTmp = client->saveSet;
|
||||
while ((j < numnow) && (SaveSetWindow(pTmp[j]) != (pointer) pWin))
|
||||
j++;
|
||||
}
|
||||
if (mode == SetModeInsert)
|
||||
{
|
||||
if (mode == SetModeInsert) {
|
||||
if (j < numnow) /* duplicate */
|
||||
return Success;
|
||||
numnow++;
|
||||
|
|
@ -315,22 +313,19 @@ AlterSaveSetForClient(ClientPtr client, WindowPtr pWin, unsigned mode,
|
|||
SaveSetAssignMap(client->saveSet[numnow - 1], map);
|
||||
return Success;
|
||||
}
|
||||
else if ((mode == SetModeDelete) && (j < numnow))
|
||||
{
|
||||
while (j < numnow-1)
|
||||
{
|
||||
else if ((mode == SetModeDelete) && (j < numnow)) {
|
||||
while (j < numnow - 1) {
|
||||
pTmp[j] = pTmp[j + 1];
|
||||
j++;
|
||||
}
|
||||
numnow--;
|
||||
if (numnow)
|
||||
{
|
||||
pTmp = (SaveSetElt *)realloc(client->saveSet, sizeof(*pTmp) * numnow);
|
||||
if (numnow) {
|
||||
pTmp =
|
||||
(SaveSetElt *) realloc(client->saveSet, sizeof(*pTmp) * numnow);
|
||||
if (pTmp)
|
||||
client->saveSet = pTmp;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
free(client->saveSet);
|
||||
client->saveSet = (SaveSetElt *) NULL;
|
||||
}
|
||||
|
|
@ -346,11 +341,11 @@ DeleteWindowFromAnySaveSet(WindowPtr pWin)
|
|||
int i;
|
||||
ClientPtr client;
|
||||
|
||||
for (i = 0; i< currentMaxClients; i++)
|
||||
{
|
||||
for (i = 0; i < currentMaxClients; i++) {
|
||||
client = clients[i];
|
||||
if (client && client->numSaved)
|
||||
(void)AlterSaveSetForClient(client, pWin, SetModeDelete, FALSE, TRUE);
|
||||
(void) AlterSaveSetForClient(client, pWin, SetModeDelete, FALSE,
|
||||
TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -390,17 +385,15 @@ BlockHandler(pointer pTimeout, pointer pReadmask)
|
|||
++inHandler;
|
||||
for (i = 0; i < screenInfo.numScreens; i++)
|
||||
(*screenInfo.screens[i]->BlockHandler) (i,
|
||||
screenInfo.screens[i]->blockData,
|
||||
pTimeout, pReadmask);
|
||||
screenInfo.screens[i]->
|
||||
blockData, pTimeout, pReadmask);
|
||||
for (i = 0; i < numHandlers; i++)
|
||||
if (!handlers[i].deleted)
|
||||
(*handlers[i].BlockHandler) (handlers[i].blockData,
|
||||
pTimeout, pReadmask);
|
||||
if (handlerDeleted)
|
||||
{
|
||||
if (handlerDeleted) {
|
||||
for (i = 0; i < numHandlers;)
|
||||
if (handlers[i].deleted)
|
||||
{
|
||||
if (handlers[i].deleted) {
|
||||
for (j = i; j < numHandlers - 1; j++)
|
||||
handlers[j] = handlers[j + 1];
|
||||
numHandlers--;
|
||||
|
|
@ -429,13 +422,11 @@ WakeupHandler(int result, pointer pReadmask)
|
|||
result, pReadmask);
|
||||
for (i = 0; i < screenInfo.numScreens; i++)
|
||||
(*screenInfo.screens[i]->WakeupHandler) (i,
|
||||
screenInfo.screens[i]->wakeupData,
|
||||
result, pReadmask);
|
||||
if (handlerDeleted)
|
||||
{
|
||||
screenInfo.screens[i]->
|
||||
wakeupData, result, pReadmask);
|
||||
if (handlerDeleted) {
|
||||
for (i = 0; i < numHandlers;)
|
||||
if (handlers[i].deleted)
|
||||
{
|
||||
if (handlers[i].deleted) {
|
||||
for (j = i; j < numHandlers - 1; j++)
|
||||
handlers[j] = handlers[j + 1];
|
||||
numHandlers--;
|
||||
|
|
@ -458,8 +449,7 @@ RegisterBlockAndWakeupHandlers (BlockHandlerProcPtr blockHandler,
|
|||
{
|
||||
BlockHandlerPtr new;
|
||||
|
||||
if (numHandlers >= sizeHandlers)
|
||||
{
|
||||
if (numHandlers >= sizeHandlers) {
|
||||
new = (BlockHandlerPtr) realloc(handlers, (numHandlers + 1) *
|
||||
sizeof(BlockHandlerRec));
|
||||
if (!new)
|
||||
|
|
@ -485,15 +475,12 @@ RemoveBlockAndWakeupHandlers (BlockHandlerProcPtr blockHandler,
|
|||
for (i = 0; i < numHandlers; i++)
|
||||
if (handlers[i].BlockHandler == blockHandler &&
|
||||
handlers[i].WakeupHandler == wakeupHandler &&
|
||||
handlers[i].blockData == blockData)
|
||||
{
|
||||
if (inHandler)
|
||||
{
|
||||
handlers[i].blockData == blockData) {
|
||||
if (inHandler) {
|
||||
handlerDeleted = TRUE;
|
||||
handlers[i].deleted = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
for (; i < numHandlers - 1; i++)
|
||||
handlers[i] = handlers[i + 1];
|
||||
numHandlers--;
|
||||
|
|
@ -531,16 +518,13 @@ ProcessWorkQueue(void)
|
|||
* they will be called again. This must be reentrant with
|
||||
* QueueWorkProc.
|
||||
*/
|
||||
while ((q = *p))
|
||||
{
|
||||
if ((*q->function) (q->client, q->closure))
|
||||
{
|
||||
while ((q = *p)) {
|
||||
if ((*q->function) (q->client, q->closure)) {
|
||||
/* remove q from the list */
|
||||
*p = q->next; /* don't fetch until after func called */
|
||||
free(q);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
p = &q->next; /* don't fetch until after func called */
|
||||
}
|
||||
}
|
||||
|
|
@ -553,17 +537,14 @@ ProcessWorkQueueZombies(void)
|
|||
WorkQueuePtr q, *p;
|
||||
|
||||
p = &workQueue;
|
||||
while ((q = *p))
|
||||
{
|
||||
if (q->client && q->client->clientGone)
|
||||
{
|
||||
while ((q = *p)) {
|
||||
if (q->client && q->client->clientGone) {
|
||||
(void) (*q->function) (q->client, q->closure);
|
||||
/* remove q from the list */
|
||||
*p = q->next; /* don't fetch until after func called */
|
||||
free(q);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
p = &q->next; /* don't fetch until after func called */
|
||||
}
|
||||
}
|
||||
|
|
@ -571,8 +552,8 @@ ProcessWorkQueueZombies(void)
|
|||
}
|
||||
|
||||
Bool
|
||||
QueueWorkProc (
|
||||
Bool (*function)(ClientPtr /* pClient */, pointer /* closure */),
|
||||
QueueWorkProc(Bool (*function)
|
||||
(ClientPtr /* pClient */ , pointer /* closure */ ),
|
||||
ClientPtr client, pointer closure)
|
||||
{
|
||||
WorkQueuePtr q;
|
||||
|
|
@ -630,8 +611,7 @@ ClientSignal (ClientPtr client)
|
|||
SleepQueuePtr q;
|
||||
|
||||
for (q = sleepQueue; q; q = q->next)
|
||||
if (q->client == client)
|
||||
{
|
||||
if (q->client == client) {
|
||||
return QueueWorkProc(q->function, q->client, q->closure);
|
||||
}
|
||||
return FALSE;
|
||||
|
|
@ -643,10 +623,8 @@ ClientWakeup (ClientPtr client)
|
|||
SleepQueuePtr q, *prev;
|
||||
|
||||
prev = &sleepQueue;
|
||||
while ( (q = *prev) )
|
||||
{
|
||||
if (q->client == client)
|
||||
{
|
||||
while ((q = *prev)) {
|
||||
if (q->client == client) {
|
||||
*prev = q->next;
|
||||
free(q);
|
||||
if (client->clientGone)
|
||||
|
|
@ -684,10 +662,7 @@ static int numCallbackListsToCleanup = 0;
|
|||
static CallbackListPtr **listsToCleanup = NULL;
|
||||
|
||||
static Bool
|
||||
_AddCallback(
|
||||
CallbackListPtr *pcbl,
|
||||
CallbackProcPtr callback,
|
||||
pointer data)
|
||||
_AddCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, pointer data)
|
||||
{
|
||||
CallbackPtr cbr;
|
||||
|
||||
|
|
@ -703,30 +678,21 @@ _AddCallback(
|
|||
}
|
||||
|
||||
static Bool
|
||||
_DeleteCallback(
|
||||
CallbackListPtr *pcbl,
|
||||
CallbackProcPtr callback,
|
||||
pointer data)
|
||||
_DeleteCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, pointer data)
|
||||
{
|
||||
CallbackListPtr cbl = *pcbl;
|
||||
CallbackPtr cbr, pcbr;
|
||||
|
||||
for (pcbr = NULL, cbr = cbl->list;
|
||||
cbr != NULL;
|
||||
pcbr = cbr, cbr = cbr->next)
|
||||
{
|
||||
for (pcbr = NULL, cbr = cbl->list; cbr != NULL; pcbr = cbr, cbr = cbr->next) {
|
||||
if ((cbr->proc == callback) && (cbr->data == data))
|
||||
break;
|
||||
}
|
||||
if (cbr != NULL)
|
||||
{
|
||||
if (cbl->inCallback)
|
||||
{
|
||||
if (cbr != NULL) {
|
||||
if (cbl->inCallback) {
|
||||
++(cbl->numDeleted);
|
||||
cbr->deleted = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
if (pcbr == NULL)
|
||||
cbl->list = cbr->next;
|
||||
else
|
||||
|
|
@ -739,26 +705,23 @@ _DeleteCallback(
|
|||
}
|
||||
|
||||
void
|
||||
_CallCallbacks(
|
||||
CallbackListPtr *pcbl,
|
||||
pointer call_data)
|
||||
_CallCallbacks(CallbackListPtr *pcbl, pointer call_data)
|
||||
{
|
||||
CallbackListPtr cbl = *pcbl;
|
||||
CallbackPtr cbr, pcbr;
|
||||
|
||||
++(cbl->inCallback);
|
||||
for (cbr = cbl->list; cbr != NULL; cbr = cbr->next)
|
||||
{
|
||||
for (cbr = cbl->list; cbr != NULL; cbr = cbr->next) {
|
||||
(*(cbr->proc)) (pcbl, cbr->data, call_data);
|
||||
}
|
||||
--(cbl->inCallback);
|
||||
|
||||
if (cbl->inCallback) return;
|
||||
if (cbl->inCallback)
|
||||
return;
|
||||
|
||||
/* Was the entire list marked for deletion? */
|
||||
|
||||
if (cbl->deleted)
|
||||
{
|
||||
if (cbl->deleted) {
|
||||
DeleteCallbackList(pcbl);
|
||||
return;
|
||||
}
|
||||
|
|
@ -767,27 +730,23 @@ _CallCallbacks(
|
|||
* If so, do the deletions.
|
||||
*/
|
||||
|
||||
if (cbl->numDeleted)
|
||||
{
|
||||
for (pcbr = NULL, cbr = cbl->list; (cbr != NULL) && cbl->numDeleted; )
|
||||
{
|
||||
if (cbr->deleted)
|
||||
{
|
||||
if (pcbr)
|
||||
{
|
||||
if (cbl->numDeleted) {
|
||||
for (pcbr = NULL, cbr = cbl->list; (cbr != NULL) && cbl->numDeleted;) {
|
||||
if (cbr->deleted) {
|
||||
if (pcbr) {
|
||||
cbr = cbr->next;
|
||||
free(pcbr->next);
|
||||
pcbr->next = cbr;
|
||||
} else
|
||||
{
|
||||
}
|
||||
else {
|
||||
cbr = cbr->next;
|
||||
free(cbl->list);
|
||||
cbl->list = cbr;
|
||||
}
|
||||
cbl->numDeleted--;
|
||||
}
|
||||
else /* this one wasn't deleted */
|
||||
{
|
||||
else { /* this one wasn't deleted */
|
||||
|
||||
pcbr = cbr;
|
||||
cbr = cbr->next;
|
||||
}
|
||||
|
|
@ -796,30 +755,25 @@ _CallCallbacks(
|
|||
}
|
||||
|
||||
static void
|
||||
_DeleteCallbackList(
|
||||
CallbackListPtr *pcbl)
|
||||
_DeleteCallbackList(CallbackListPtr *pcbl)
|
||||
{
|
||||
CallbackListPtr cbl = *pcbl;
|
||||
CallbackPtr cbr, nextcbr;
|
||||
int i;
|
||||
|
||||
if (cbl->inCallback)
|
||||
{
|
||||
if (cbl->inCallback) {
|
||||
cbl->deleted = TRUE;
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < numCallbackListsToCleanup; i++)
|
||||
{
|
||||
if (listsToCleanup[i] == pcbl)
|
||||
{
|
||||
for (i = 0; i < numCallbackListsToCleanup; i++) {
|
||||
if (listsToCleanup[i] == pcbl) {
|
||||
listsToCleanup[i] = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (cbr = cbl->list; cbr != NULL; cbr = nextcbr)
|
||||
{
|
||||
for (cbr = cbl->list; cbr != NULL; cbr = nextcbr) {
|
||||
nextcbr = cbr->next;
|
||||
free(cbr);
|
||||
}
|
||||
|
|
@ -833,26 +787,28 @@ CreateCallbackList(CallbackListPtr *pcbl)
|
|||
CallbackListPtr cbl;
|
||||
int i;
|
||||
|
||||
if (!pcbl) return FALSE;
|
||||
if (!pcbl)
|
||||
return FALSE;
|
||||
cbl = malloc(sizeof(CallbackListRec));
|
||||
if (!cbl) return FALSE;
|
||||
if (!cbl)
|
||||
return FALSE;
|
||||
cbl->inCallback = 0;
|
||||
cbl->deleted = FALSE;
|
||||
cbl->numDeleted = 0;
|
||||
cbl->list = NULL;
|
||||
*pcbl = cbl;
|
||||
|
||||
for (i = 0; i < numCallbackListsToCleanup; i++)
|
||||
{
|
||||
if (!listsToCleanup[i])
|
||||
{
|
||||
for (i = 0; i < numCallbackListsToCleanup; i++) {
|
||||
if (!listsToCleanup[i]) {
|
||||
listsToCleanup[i] = pcbl;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
listsToCleanup = (CallbackListPtr **) xnfrealloc(listsToCleanup,
|
||||
sizeof(CallbackListPtr *) * (numCallbackListsToCleanup+1));
|
||||
sizeof(CallbackListPtr *) *
|
||||
(numCallbackListsToCleanup
|
||||
+ 1));
|
||||
listsToCleanup[numCallbackListsToCleanup] = pcbl;
|
||||
numCallbackListsToCleanup++;
|
||||
return TRUE;
|
||||
|
|
@ -863,9 +819,9 @@ CreateCallbackList(CallbackListPtr *pcbl)
|
|||
Bool
|
||||
AddCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, pointer data)
|
||||
{
|
||||
if (!pcbl) return FALSE;
|
||||
if (!*pcbl)
|
||||
{ /* list hasn't been created yet; go create it */
|
||||
if (!pcbl)
|
||||
return FALSE;
|
||||
if (!*pcbl) { /* list hasn't been created yet; go create it */
|
||||
if (!CreateCallbackList(pcbl))
|
||||
return FALSE;
|
||||
}
|
||||
|
|
@ -875,14 +831,16 @@ AddCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, pointer data)
|
|||
Bool
|
||||
DeleteCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, pointer data)
|
||||
{
|
||||
if (!pcbl || !*pcbl) return FALSE;
|
||||
if (!pcbl || !*pcbl)
|
||||
return FALSE;
|
||||
return _DeleteCallback(pcbl, callback, data);
|
||||
}
|
||||
|
||||
void
|
||||
DeleteCallbackList(CallbackListPtr *pcbl)
|
||||
{
|
||||
if (!pcbl || !*pcbl) return;
|
||||
if (!pcbl || !*pcbl)
|
||||
return;
|
||||
_DeleteCallbackList(pcbl);
|
||||
}
|
||||
|
||||
|
|
@ -891,8 +849,7 @@ InitCallbackManager(void)
|
|||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < numCallbackListsToCleanup; i++)
|
||||
{
|
||||
for (i = 0; i < numCallbackListsToCleanup; i++) {
|
||||
DeleteCallbackList(listsToCleanup[i]);
|
||||
}
|
||||
free(listsToCleanup);
|
||||
|
|
|
|||
433
dix/enterleave.c
433
dix/enterleave.c
|
|
@ -106,6 +106,7 @@ static BOOL
|
|||
HasFocus(WindowPtr win)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAXDEVICES; i++)
|
||||
if (FocusWindows[i] == win)
|
||||
return TRUE;
|
||||
|
|
@ -133,8 +134,8 @@ static WindowPtr
|
|||
FirstPointerChild(WindowPtr win)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < MAXDEVICES; i++)
|
||||
{
|
||||
|
||||
for (i = 0; i < MAXDEVICES; i++) {
|
||||
if (PointerWindows[i] && IsParent(win, PointerWindows[i]))
|
||||
return PointerWindows[i];
|
||||
}
|
||||
|
|
@ -153,8 +154,8 @@ static WindowPtr
|
|||
FirstFocusChild(WindowPtr win)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < MAXDEVICES; i++)
|
||||
{
|
||||
|
||||
for (i = 0; i < MAXDEVICES; i++) {
|
||||
if (FocusWindows[i] && FocusWindows[i] != PointerRootWin &&
|
||||
IsParent(win, FocusWindows[i]))
|
||||
return FocusWindows[i];
|
||||
|
|
@ -199,9 +200,6 @@ SetFocusOut(DeviceIntPtr dev)
|
|||
FocusWindows[dev->id] = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Return the common ancestor of 'a' and 'b' (if one exists).
|
||||
* @param a A window with the same ancestor as b.
|
||||
|
|
@ -210,16 +208,14 @@ SetFocusOut(DeviceIntPtr dev)
|
|||
* NullWindow if they do not have a common ancestor.
|
||||
*/
|
||||
WindowPtr
|
||||
CommonAncestor(
|
||||
WindowPtr a,
|
||||
WindowPtr b)
|
||||
CommonAncestor(WindowPtr a, WindowPtr b)
|
||||
{
|
||||
for (b = b->parent; b; b = b->parent)
|
||||
if (IsParent(b, a)) return b;
|
||||
if (IsParent(b, a))
|
||||
return b;
|
||||
return NullWindow;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Send enter notifies to all windows between 'ancestor' and 'child' (excluding
|
||||
* both). Events are sent running up the window hierarchy. This function
|
||||
|
|
@ -228,10 +224,7 @@ CommonAncestor(
|
|||
static void
|
||||
DeviceEnterNotifies(DeviceIntPtr dev,
|
||||
int sourceid,
|
||||
WindowPtr ancestor,
|
||||
WindowPtr child,
|
||||
int mode,
|
||||
int detail)
|
||||
WindowPtr ancestor, WindowPtr child, int mode, int detail)
|
||||
{
|
||||
WindowPtr parent = child->parent;
|
||||
|
||||
|
|
@ -249,17 +242,14 @@ DeviceEnterNotifies(DeviceIntPtr dev,
|
|||
*/
|
||||
static void
|
||||
CoreEnterNotifies(DeviceIntPtr dev,
|
||||
WindowPtr ancestor,
|
||||
WindowPtr child,
|
||||
int mode,
|
||||
int detail)
|
||||
WindowPtr ancestor, WindowPtr child, int mode, int detail)
|
||||
{
|
||||
WindowPtr parent = child->parent;
|
||||
|
||||
if (ancestor == parent)
|
||||
return;
|
||||
CoreEnterNotifies(dev, ancestor, parent, mode, detail);
|
||||
|
||||
|
||||
/* Case 3:
|
||||
A is above W, B is a descendant
|
||||
|
||||
|
|
@ -286,18 +276,14 @@ CoreEnterNotifies(DeviceIntPtr dev,
|
|||
|
||||
static void
|
||||
CoreLeaveNotifies(DeviceIntPtr dev,
|
||||
WindowPtr child,
|
||||
WindowPtr ancestor,
|
||||
int mode,
|
||||
int detail)
|
||||
WindowPtr child, WindowPtr ancestor, int mode, int detail)
|
||||
{
|
||||
WindowPtr win;
|
||||
|
||||
if (ancestor == child)
|
||||
return;
|
||||
|
||||
for (win = child->parent; win != ancestor; win = win->parent)
|
||||
{
|
||||
for (win = child->parent; win != ancestor; win = win->parent) {
|
||||
/*Case 7:
|
||||
A is a descendant of W, B is above W
|
||||
|
||||
|
|
@ -321,7 +307,8 @@ CoreLeaveNotifies(DeviceIntPtr dev,
|
|||
if (HasPointer(dev, win) || FirstPointerChild(win))
|
||||
return;
|
||||
|
||||
CoreEnterLeaveEvent(dev, LeaveNotify, mode, detail, win, child->drawable.id);
|
||||
CoreEnterLeaveEvent(dev, LeaveNotify, mode, detail, win,
|
||||
child->drawable.id);
|
||||
|
||||
child = win;
|
||||
}
|
||||
|
|
@ -334,17 +321,13 @@ CoreLeaveNotifies(DeviceIntPtr dev,
|
|||
static void
|
||||
DeviceLeaveNotifies(DeviceIntPtr dev,
|
||||
int sourceid,
|
||||
WindowPtr child,
|
||||
WindowPtr ancestor,
|
||||
int mode,
|
||||
int detail)
|
||||
WindowPtr child, WindowPtr ancestor, int mode, int detail)
|
||||
{
|
||||
WindowPtr win;
|
||||
|
||||
if (ancestor == child)
|
||||
return;
|
||||
for (win = child->parent; win != ancestor; win = win->parent)
|
||||
{
|
||||
for (win = child->parent; win != ancestor; win = win->parent) {
|
||||
DeviceEnterLeaveEvent(dev, sourceid, XI_Leave, mode, detail, win,
|
||||
child->drawable.id);
|
||||
child = win;
|
||||
|
|
@ -356,12 +339,10 @@ DeviceLeaveNotifies(DeviceIntPtr dev,
|
|||
* B a descendant of A.
|
||||
*/
|
||||
static void
|
||||
CoreEnterLeaveNonLinear(DeviceIntPtr dev,
|
||||
WindowPtr A,
|
||||
WindowPtr B,
|
||||
int mode)
|
||||
CoreEnterLeaveNonLinear(DeviceIntPtr dev, WindowPtr A, WindowPtr B, int mode)
|
||||
{
|
||||
WindowPtr X = CommonAncestor(A, B);
|
||||
|
||||
/* Case 4:
|
||||
A is W, B is above W
|
||||
|
||||
|
|
@ -382,15 +363,16 @@ CoreEnterLeaveNonLinear(DeviceIntPtr dev,
|
|||
vice versa depending on the the new P(W)
|
||||
*/
|
||||
|
||||
if (!HasPointer(dev, A))
|
||||
{
|
||||
if (!HasPointer(dev, A)) {
|
||||
WindowPtr child = FirstPointerChild(A);
|
||||
if (child)
|
||||
CoreEnterLeaveEvent(dev, LeaveNotify, mode, NotifyInferior, A, None);
|
||||
else
|
||||
CoreEnterLeaveEvent(dev, LeaveNotify, mode, NotifyNonlinear, A, None);
|
||||
}
|
||||
|
||||
if (child)
|
||||
CoreEnterLeaveEvent(dev, LeaveNotify, mode, NotifyInferior, A,
|
||||
None);
|
||||
else
|
||||
CoreEnterLeaveEvent(dev, LeaveNotify, mode, NotifyNonlinear, A,
|
||||
None);
|
||||
}
|
||||
|
||||
CoreLeaveNotifies(dev, A, X, mode, NotifyNonlinearVirtual);
|
||||
|
||||
|
|
@ -402,7 +384,6 @@ CoreEnterLeaveNonLinear(DeviceIntPtr dev,
|
|||
MPX: The pointer window stays the same or moves to a different
|
||||
descendant of W. No events should be generated on W.
|
||||
|
||||
|
||||
Therefore, no event to X.
|
||||
*/
|
||||
|
||||
|
|
@ -426,13 +407,15 @@ CoreEnterLeaveNonLinear(DeviceIntPtr dev,
|
|||
The detail may need to be changed from Ancestor to Nonlinear
|
||||
or vice-versa depending on the previous P(W). */
|
||||
|
||||
if (!HasPointer(dev, B))
|
||||
{
|
||||
if (!HasPointer(dev, B)) {
|
||||
WindowPtr child = FirstPointerChild(B);
|
||||
|
||||
if (child)
|
||||
CoreEnterLeaveEvent(dev, EnterNotify, mode, NotifyInferior, B, None);
|
||||
CoreEnterLeaveEvent(dev, EnterNotify, mode, NotifyInferior, B,
|
||||
None);
|
||||
else
|
||||
CoreEnterLeaveEvent(dev, EnterNotify, mode, NotifyNonlinear, B, None);
|
||||
CoreEnterLeaveEvent(dev, EnterNotify, mode, NotifyNonlinear, B,
|
||||
None);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -440,10 +423,7 @@ CoreEnterLeaveNonLinear(DeviceIntPtr dev,
|
|||
* Pointer dev moves from A to B and A is a descendant of B.
|
||||
*/
|
||||
static void
|
||||
CoreEnterLeaveToAncestor(DeviceIntPtr dev,
|
||||
WindowPtr A,
|
||||
WindowPtr B,
|
||||
int mode)
|
||||
CoreEnterLeaveToAncestor(DeviceIntPtr dev, WindowPtr A, WindowPtr B, int mode)
|
||||
{
|
||||
/* Case 4:
|
||||
A is W, B is above W
|
||||
|
|
@ -464,13 +444,15 @@ CoreEnterLeaveToAncestor(DeviceIntPtr dev,
|
|||
The detail may need to be changed from Ancestor to Nonlinear or
|
||||
vice versa depending on the the new P(W)
|
||||
*/
|
||||
if (!HasPointer(dev, A))
|
||||
{
|
||||
if (!HasPointer(dev, A)) {
|
||||
WindowPtr child = FirstPointerChild(A);
|
||||
|
||||
if (child)
|
||||
CoreEnterLeaveEvent(dev, LeaveNotify, mode, NotifyInferior, A, None);
|
||||
CoreEnterLeaveEvent(dev, LeaveNotify, mode, NotifyInferior, A,
|
||||
None);
|
||||
else
|
||||
CoreEnterLeaveEvent(dev, LeaveNotify, mode, NotifyAncestor, A, None);
|
||||
CoreEnterLeaveEvent(dev, LeaveNotify, mode, NotifyAncestor, A,
|
||||
None);
|
||||
}
|
||||
|
||||
CoreLeaveNotifies(dev, A, B, mode, NotifyVirtual);
|
||||
|
|
@ -493,15 +475,11 @@ CoreEnterLeaveToAncestor(DeviceIntPtr dev,
|
|||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Pointer dev moves from A to B and B is a descendant of A.
|
||||
*/
|
||||
static void
|
||||
CoreEnterLeaveToDescendant(DeviceIntPtr dev,
|
||||
WindowPtr A,
|
||||
WindowPtr B,
|
||||
int mode)
|
||||
CoreEnterLeaveToDescendant(DeviceIntPtr dev, WindowPtr A, WindowPtr B, int mode)
|
||||
{
|
||||
/* Case 6:
|
||||
A is W, B is a descendant of W
|
||||
|
|
@ -519,7 +497,6 @@ CoreEnterLeaveToDescendant(DeviceIntPtr dev,
|
|||
if (!HasPointer(dev, A))
|
||||
CoreEnterLeaveEvent(dev, LeaveNotify, mode, NotifyInferior, A, None);
|
||||
|
||||
|
||||
CoreEnterNotifies(dev, A, B, mode, NotifyVirtual);
|
||||
|
||||
/* Case 2:
|
||||
|
|
@ -540,21 +517,20 @@ CoreEnterLeaveToDescendant(DeviceIntPtr dev,
|
|||
The detail may need to be changed from Ancestor to Nonlinear
|
||||
or vice-versa depending on the previous P(W). */
|
||||
|
||||
if (!HasPointer(dev, B))
|
||||
{
|
||||
if (!HasPointer(dev, B)) {
|
||||
WindowPtr child = FirstPointerChild(B);
|
||||
|
||||
if (child)
|
||||
CoreEnterLeaveEvent(dev, EnterNotify, mode, NotifyInferior, B, None);
|
||||
CoreEnterLeaveEvent(dev, EnterNotify, mode, NotifyInferior, B,
|
||||
None);
|
||||
else
|
||||
CoreEnterLeaveEvent(dev, EnterNotify, mode, NotifyAncestor, B, None);
|
||||
CoreEnterLeaveEvent(dev, EnterNotify, mode, NotifyAncestor, B,
|
||||
None);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
CoreEnterLeaveEvents(DeviceIntPtr dev,
|
||||
WindowPtr from,
|
||||
WindowPtr to,
|
||||
int mode)
|
||||
CoreEnterLeaveEvents(DeviceIntPtr dev, WindowPtr from, WindowPtr to, int mode)
|
||||
{
|
||||
if (!IsMaster(dev))
|
||||
return;
|
||||
|
|
@ -573,31 +549,34 @@ CoreEnterLeaveEvents(DeviceIntPtr dev,
|
|||
|
||||
static void
|
||||
DeviceEnterLeaveEvents(DeviceIntPtr dev,
|
||||
int sourceid,
|
||||
WindowPtr from,
|
||||
WindowPtr to,
|
||||
int mode)
|
||||
int sourceid, WindowPtr from, WindowPtr to, int mode)
|
||||
{
|
||||
if (IsParent(from, to))
|
||||
{
|
||||
DeviceEnterLeaveEvent(dev, sourceid, XI_Leave, mode, NotifyInferior, from, None);
|
||||
if (IsParent(from, to)) {
|
||||
DeviceEnterLeaveEvent(dev, sourceid, XI_Leave, mode, NotifyInferior,
|
||||
from, None);
|
||||
DeviceEnterNotifies(dev, sourceid, from, to, mode, NotifyVirtual);
|
||||
DeviceEnterLeaveEvent(dev, sourceid, XI_Enter, mode, NotifyAncestor, to, None);
|
||||
DeviceEnterLeaveEvent(dev, sourceid, XI_Enter, mode, NotifyAncestor, to,
|
||||
None);
|
||||
}
|
||||
else if (IsParent(to, from))
|
||||
{
|
||||
DeviceEnterLeaveEvent(dev, sourceid, XI_Leave, mode, NotifyAncestor, from, None);
|
||||
else if (IsParent(to, from)) {
|
||||
DeviceEnterLeaveEvent(dev, sourceid, XI_Leave, mode, NotifyAncestor,
|
||||
from, None);
|
||||
DeviceLeaveNotifies(dev, sourceid, from, to, mode, NotifyVirtual);
|
||||
DeviceEnterLeaveEvent(dev, sourceid, XI_Enter, mode, NotifyInferior, to, None);
|
||||
DeviceEnterLeaveEvent(dev, sourceid, XI_Enter, mode, NotifyInferior, to,
|
||||
None);
|
||||
}
|
||||
else
|
||||
{ /* neither from nor to is descendent of the other */
|
||||
else { /* neither from nor to is descendent of the other */
|
||||
WindowPtr common = CommonAncestor(to, from);
|
||||
|
||||
/* common == NullWindow ==> different screens */
|
||||
DeviceEnterLeaveEvent(dev, sourceid, XI_Leave, mode, NotifyNonlinear, from, None);
|
||||
DeviceLeaveNotifies(dev, sourceid, from, common, mode, NotifyNonlinearVirtual);
|
||||
DeviceEnterNotifies(dev, sourceid, common, to, mode, NotifyNonlinearVirtual);
|
||||
DeviceEnterLeaveEvent(dev, sourceid, XI_Enter, mode, NotifyNonlinear, to, None);
|
||||
DeviceEnterLeaveEvent(dev, sourceid, XI_Leave, mode, NotifyNonlinear,
|
||||
from, None);
|
||||
DeviceLeaveNotifies(dev, sourceid, from, common, mode,
|
||||
NotifyNonlinearVirtual);
|
||||
DeviceEnterNotifies(dev, sourceid, common, to, mode,
|
||||
NotifyNonlinearVirtual);
|
||||
DeviceEnterLeaveEvent(dev, sourceid, XI_Enter, mode, NotifyNonlinear,
|
||||
to, None);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -610,10 +589,7 @@ DeviceEnterLeaveEvents(DeviceIntPtr dev,
|
|||
*/
|
||||
void
|
||||
DoEnterLeaveEvents(DeviceIntPtr pDev,
|
||||
int sourceid,
|
||||
WindowPtr fromWin,
|
||||
WindowPtr toWin,
|
||||
int mode)
|
||||
int sourceid, WindowPtr fromWin, WindowPtr toWin, int mode)
|
||||
{
|
||||
if (!IsPointerDevice(pDev))
|
||||
return;
|
||||
|
|
@ -632,10 +608,7 @@ DoEnterLeaveEvents(DeviceIntPtr pDev,
|
|||
*/
|
||||
static void
|
||||
DeviceFocusOutEvents(DeviceIntPtr dev,
|
||||
WindowPtr child,
|
||||
WindowPtr ancestor,
|
||||
int mode,
|
||||
int detail)
|
||||
WindowPtr child, WindowPtr ancestor, int mode, int detail)
|
||||
{
|
||||
WindowPtr win;
|
||||
|
||||
|
|
@ -645,7 +618,6 @@ DeviceFocusOutEvents(DeviceIntPtr dev,
|
|||
DeviceFocusEvent(dev, XI_FocusOut, mode, detail, win);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Send enter notifies to all windows between 'ancestor' and 'child' (excluding
|
||||
* both). Events are sent running up the window hierarchy. This function
|
||||
|
|
@ -653,10 +625,7 @@ DeviceFocusOutEvents(DeviceIntPtr dev,
|
|||
*/
|
||||
static void
|
||||
DeviceFocusInEvents(DeviceIntPtr dev,
|
||||
WindowPtr ancestor,
|
||||
WindowPtr child,
|
||||
int mode,
|
||||
int detail)
|
||||
WindowPtr ancestor, WindowPtr child, int mode, int detail)
|
||||
{
|
||||
WindowPtr parent = child->parent;
|
||||
|
||||
|
|
@ -673,17 +642,14 @@ DeviceFocusInEvents(DeviceIntPtr dev,
|
|||
*/
|
||||
static void
|
||||
CoreFocusInEvents(DeviceIntPtr dev,
|
||||
WindowPtr ancestor,
|
||||
WindowPtr child,
|
||||
int mode,
|
||||
int detail)
|
||||
WindowPtr ancestor, WindowPtr child, int mode, int detail)
|
||||
{
|
||||
WindowPtr parent = child->parent;
|
||||
|
||||
if (ancestor == parent)
|
||||
return;
|
||||
CoreFocusInEvents(dev, ancestor, parent, mode, detail);
|
||||
|
||||
|
||||
/* Case 3:
|
||||
A is above W, B is a descendant
|
||||
|
||||
|
|
@ -708,18 +674,14 @@ CoreFocusInEvents(DeviceIntPtr dev,
|
|||
|
||||
static void
|
||||
CoreFocusOutEvents(DeviceIntPtr dev,
|
||||
WindowPtr child,
|
||||
WindowPtr ancestor,
|
||||
int mode,
|
||||
int detail)
|
||||
WindowPtr child, WindowPtr ancestor, int mode, int detail)
|
||||
{
|
||||
WindowPtr win;
|
||||
|
||||
if (ancestor == child)
|
||||
return;
|
||||
|
||||
for (win = child->parent; win != ancestor; win = win->parent)
|
||||
{
|
||||
for (win = child->parent; win != ancestor; win = win->parent) {
|
||||
/*Case 7:
|
||||
A is a descendant of W, B is above W
|
||||
|
||||
|
|
@ -760,9 +722,7 @@ CoreFocusOutEvents(DeviceIntPtr dev,
|
|||
static void
|
||||
CoreFocusOutNotifyPointerEvents(DeviceIntPtr dev,
|
||||
WindowPtr pwin_parent,
|
||||
WindowPtr exclude,
|
||||
int mode,
|
||||
int inclusive)
|
||||
WindowPtr exclude, int mode, int inclusive)
|
||||
{
|
||||
WindowPtr P, stopAt;
|
||||
|
||||
|
|
@ -790,10 +750,7 @@ CoreFocusOutNotifyPointerEvents(DeviceIntPtr dev,
|
|||
*/
|
||||
static void
|
||||
CoreFocusInRecurse(DeviceIntPtr dev,
|
||||
WindowPtr win,
|
||||
WindowPtr stopAt,
|
||||
int mode,
|
||||
int inclusive)
|
||||
WindowPtr win, WindowPtr stopAt, int mode, int inclusive)
|
||||
{
|
||||
if ((!inclusive && win == stopAt) || !win)
|
||||
return;
|
||||
|
|
@ -802,7 +759,6 @@ CoreFocusInRecurse(DeviceIntPtr dev,
|
|||
CoreFocusEvent(dev, FocusIn, mode, NotifyPointer, win);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Send FocusIn(NotifyPointer) events from pwin_parent down to
|
||||
* including the current pointer window (which is a descendant of pwin_parent).
|
||||
|
|
@ -815,9 +771,7 @@ CoreFocusInRecurse(DeviceIntPtr dev,
|
|||
static void
|
||||
CoreFocusInNotifyPointerEvents(DeviceIntPtr dev,
|
||||
WindowPtr pwin_parent,
|
||||
WindowPtr exclude,
|
||||
int mode,
|
||||
int inclusive)
|
||||
WindowPtr exclude, int mode, int inclusive)
|
||||
{
|
||||
WindowPtr P;
|
||||
|
||||
|
|
@ -832,16 +786,12 @@ CoreFocusInNotifyPointerEvents(DeviceIntPtr dev,
|
|||
CoreFocusInRecurse(dev, P, pwin_parent, mode, inclusive);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Focus of dev moves from A to B and A neither a descendant of B nor is
|
||||
* B a descendant of A.
|
||||
*/
|
||||
static void
|
||||
CoreFocusNonLinear(DeviceIntPtr dev,
|
||||
WindowPtr A,
|
||||
WindowPtr B,
|
||||
int mode)
|
||||
CoreFocusNonLinear(DeviceIntPtr dev, WindowPtr A, WindowPtr B, int mode)
|
||||
{
|
||||
WindowPtr X = CommonAncestor(A, B);
|
||||
|
||||
|
|
@ -864,23 +814,21 @@ CoreFocusNonLinear(DeviceIntPtr dev,
|
|||
vice versa depending on the the new F(W)
|
||||
*/
|
||||
|
||||
if (!HasFocus(A))
|
||||
{
|
||||
if (!HasFocus(A)) {
|
||||
WindowPtr child = FirstFocusChild(A);
|
||||
if (child)
|
||||
{
|
||||
|
||||
if (child) {
|
||||
/* NotifyPointer P-A unless P is child or below */
|
||||
CoreFocusOutNotifyPointerEvents(dev, A, child, mode, FALSE);
|
||||
CoreFocusEvent(dev, FocusOut, mode, NotifyInferior, A);
|
||||
} else
|
||||
{
|
||||
}
|
||||
else {
|
||||
/* NotifyPointer P-A */
|
||||
CoreFocusOutNotifyPointerEvents(dev, A, None, mode, FALSE);
|
||||
CoreFocusEvent(dev, FocusOut, mode, NotifyNonlinear, A);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CoreFocusOutEvents(dev, A, X, mode, NotifyNonlinearVirtual);
|
||||
|
||||
/*
|
||||
|
|
@ -891,7 +839,6 @@ CoreFocusNonLinear(DeviceIntPtr dev,
|
|||
MPX: The focus window stays the same or moves to a different
|
||||
descendant of W. No events should be generated on W.
|
||||
|
||||
|
||||
Therefore, no event to X.
|
||||
*/
|
||||
|
||||
|
|
@ -914,15 +861,15 @@ CoreFocusNonLinear(DeviceIntPtr dev,
|
|||
The detail may need to be changed from Ancestor to Nonlinear
|
||||
or vice-versa depending on the previous F(W). */
|
||||
|
||||
if (!HasFocus(B))
|
||||
{
|
||||
if (!HasFocus(B)) {
|
||||
WindowPtr child = FirstFocusChild(B);
|
||||
if (child)
|
||||
{
|
||||
|
||||
if (child) {
|
||||
CoreFocusEvent(dev, FocusIn, mode, NotifyInferior, B);
|
||||
/* NotifyPointer B-P unless P is child or below. */
|
||||
CoreFocusInNotifyPointerEvents(dev, B, child, mode, FALSE);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
CoreFocusEvent(dev, FocusIn, mode, NotifyNonlinear, B);
|
||||
/* NotifyPointer B-P unless P is child or below. */
|
||||
CoreFocusInNotifyPointerEvents(dev, B, None, mode, FALSE);
|
||||
|
|
@ -930,15 +877,11 @@ CoreFocusNonLinear(DeviceIntPtr dev,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Focus of dev moves from A to B and A is a descendant of B.
|
||||
*/
|
||||
static void
|
||||
CoreFocusToAncestor(DeviceIntPtr dev,
|
||||
WindowPtr A,
|
||||
WindowPtr B,
|
||||
int mode)
|
||||
CoreFocusToAncestor(DeviceIntPtr dev, WindowPtr A, WindowPtr B, int mode)
|
||||
{
|
||||
/* Case 4:
|
||||
A is W, B is above W
|
||||
|
|
@ -958,15 +901,15 @@ CoreFocusToAncestor(DeviceIntPtr dev,
|
|||
The detail may need to be changed from Ancestor to Nonlinear or
|
||||
vice versa depending on the the new F(W)
|
||||
*/
|
||||
if (!HasFocus(A))
|
||||
{
|
||||
if (!HasFocus(A)) {
|
||||
WindowPtr child = FirstFocusChild(A);
|
||||
if (child)
|
||||
{
|
||||
|
||||
if (child) {
|
||||
/* NotifyPointer P-A unless P is child or below */
|
||||
CoreFocusOutNotifyPointerEvents(dev, A, child, mode, FALSE);
|
||||
CoreFocusEvent(dev, FocusOut, mode, NotifyInferior, A);
|
||||
} else
|
||||
}
|
||||
else
|
||||
CoreFocusEvent(dev, FocusOut, mode, NotifyAncestor, A);
|
||||
}
|
||||
|
||||
|
|
@ -984,8 +927,7 @@ CoreFocusToAncestor(DeviceIntPtr dev,
|
|||
Case 3B: Otherwise:
|
||||
F(W) changes from a descendant to W itself. */
|
||||
|
||||
if (!HasFocus(B))
|
||||
{
|
||||
if (!HasFocus(B)) {
|
||||
CoreFocusEvent(dev, FocusIn, mode, NotifyInferior, B);
|
||||
/* NotifyPointer B-P unless P is A or below. */
|
||||
CoreFocusInNotifyPointerEvents(dev, B, A, mode, FALSE);
|
||||
|
|
@ -996,10 +938,7 @@ CoreFocusToAncestor(DeviceIntPtr dev,
|
|||
* Focus of dev moves from A to B and B is a descendant of A.
|
||||
*/
|
||||
static void
|
||||
CoreFocusToDescendant(DeviceIntPtr dev,
|
||||
WindowPtr A,
|
||||
WindowPtr B,
|
||||
int mode)
|
||||
CoreFocusToDescendant(DeviceIntPtr dev, WindowPtr A, WindowPtr B, int mode)
|
||||
{
|
||||
/* Case 6:
|
||||
A is W, B is a descendant of W
|
||||
|
|
@ -1013,14 +952,12 @@ CoreFocusToDescendant(DeviceIntPtr dev,
|
|||
Case 3B: Otherwise:
|
||||
F(W) changes from W to a descendant of W. */
|
||||
|
||||
if (!HasFocus(A))
|
||||
{
|
||||
if (!HasFocus(A)) {
|
||||
/* NotifyPointer P-A unless P is B or below */
|
||||
CoreFocusOutNotifyPointerEvents(dev, A, B, mode, FALSE);
|
||||
CoreFocusEvent(dev, FocusOut, mode, NotifyInferior, A);
|
||||
}
|
||||
|
||||
|
||||
CoreFocusInEvents(dev, A, B, mode, NotifyVirtual);
|
||||
|
||||
/* Case 2:
|
||||
|
|
@ -1040,15 +977,15 @@ CoreFocusToDescendant(DeviceIntPtr dev,
|
|||
The detail may need to be changed from Ancestor to Nonlinear
|
||||
or vice-versa depending on the previous F(W). */
|
||||
|
||||
if (!HasFocus(B))
|
||||
{
|
||||
if (!HasFocus(B)) {
|
||||
WindowPtr child = FirstFocusChild(B);
|
||||
if (child)
|
||||
{
|
||||
|
||||
if (child) {
|
||||
CoreFocusEvent(dev, FocusIn, mode, NotifyInferior, B);
|
||||
/* NotifyPointer B-P unless P is child or below. */
|
||||
CoreFocusInNotifyPointerEvents(dev, B, child, mode, FALSE);
|
||||
} else
|
||||
}
|
||||
else
|
||||
CoreFocusEvent(dev, FocusIn, mode, NotifyAncestor, B);
|
||||
}
|
||||
}
|
||||
|
|
@ -1070,8 +1007,7 @@ HasOtherPointer(WindowPtr win, DeviceIntPtr exclude)
|
|||
* Assumption: Neither A nor B are valid windows.
|
||||
*/
|
||||
static void
|
||||
CoreFocusPointerRootNoneSwitch(DeviceIntPtr dev,
|
||||
WindowPtr A, /* PointerRootWin or NoneWin */
|
||||
CoreFocusPointerRootNoneSwitch(DeviceIntPtr dev, WindowPtr A, /* PointerRootWin or NoneWin */
|
||||
WindowPtr B, /* NoneWin or PointerRootWin */
|
||||
int mode)
|
||||
{
|
||||
|
|
@ -1084,23 +1020,25 @@ CoreFocusPointerRootNoneSwitch(DeviceIntPtr dev,
|
|||
nscreens = 1;
|
||||
#endif
|
||||
|
||||
for (i = 0; i < nscreens; i++)
|
||||
{
|
||||
for (i = 0; i < nscreens; i++) {
|
||||
root = screenInfo.screens[i]->root;
|
||||
if (!HasOtherPointer(root, GetMaster(dev, POINTER_OR_FLOAT)) && !FirstFocusChild(root))
|
||||
{
|
||||
if (!HasOtherPointer(root, GetMaster(dev, POINTER_OR_FLOAT)) &&
|
||||
!FirstFocusChild(root)) {
|
||||
/* If pointer was on PointerRootWin and changes to NoneWin, and
|
||||
* the pointer paired with dev is below the current root window,
|
||||
* do a NotifyPointer run. */
|
||||
if (dev->focus && dev->focus->win == PointerRootWin &&
|
||||
B != PointerRootWin)
|
||||
{
|
||||
B != PointerRootWin) {
|
||||
WindowPtr ptrwin = PointerWin(GetMaster(dev, POINTER_OR_FLOAT));
|
||||
|
||||
if (ptrwin && IsParent(root, ptrwin))
|
||||
CoreFocusOutNotifyPointerEvents(dev, root, None, mode, TRUE);
|
||||
CoreFocusOutNotifyPointerEvents(dev, root, None, mode,
|
||||
TRUE);
|
||||
}
|
||||
CoreFocusEvent(dev, FocusOut, mode, A ? NotifyPointerRoot : NotifyDetailNone, root);
|
||||
CoreFocusEvent(dev, FocusIn, mode, B ? NotifyPointerRoot : NotifyDetailNone, root);
|
||||
CoreFocusEvent(dev, FocusOut, mode,
|
||||
A ? NotifyPointerRoot : NotifyDetailNone, root);
|
||||
CoreFocusEvent(dev, FocusIn, mode,
|
||||
B ? NotifyPointerRoot : NotifyDetailNone, root);
|
||||
if (B == PointerRootWin)
|
||||
CoreFocusInNotifyPointerEvents(dev, root, None, mode, TRUE);
|
||||
}
|
||||
|
|
@ -1113,9 +1051,7 @@ CoreFocusPointerRootNoneSwitch(DeviceIntPtr dev,
|
|||
* Assumption: A is a valid window and not PointerRoot or None.
|
||||
*/
|
||||
static void
|
||||
CoreFocusToPointerRootOrNone(DeviceIntPtr dev,
|
||||
WindowPtr A,
|
||||
WindowPtr B, /* PointerRootWin or NoneWin */
|
||||
CoreFocusToPointerRootOrNone(DeviceIntPtr dev, WindowPtr A, WindowPtr B, /* PointerRootWin or NoneWin */
|
||||
int mode)
|
||||
{
|
||||
WindowPtr root;
|
||||
|
|
@ -1127,15 +1063,15 @@ CoreFocusToPointerRootOrNone(DeviceIntPtr dev,
|
|||
nscreens = 1;
|
||||
#endif
|
||||
|
||||
if (!HasFocus(A))
|
||||
{
|
||||
if (!HasFocus(A)) {
|
||||
WindowPtr child = FirstFocusChild(A);
|
||||
if (child)
|
||||
{
|
||||
|
||||
if (child) {
|
||||
/* NotifyPointer P-A unless P is B or below */
|
||||
CoreFocusOutNotifyPointerEvents(dev, A, B, mode, FALSE);
|
||||
CoreFocusEvent(dev, FocusOut, mode, NotifyInferior, A);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
/* NotifyPointer P-A */
|
||||
CoreFocusOutNotifyPointerEvents(dev, A, None, mode, FALSE);
|
||||
CoreFocusEvent(dev, FocusOut, mode, NotifyNonlinear, A);
|
||||
|
|
@ -1145,12 +1081,11 @@ CoreFocusToPointerRootOrNone(DeviceIntPtr dev,
|
|||
/* NullWindow means we include the root window */
|
||||
CoreFocusOutEvents(dev, A, NullWindow, mode, NotifyNonlinearVirtual);
|
||||
|
||||
for (i = 0; i < nscreens; i++)
|
||||
{
|
||||
for (i = 0; i < nscreens; i++) {
|
||||
root = screenInfo.screens[i]->root;
|
||||
if (!HasFocus(root) && !FirstFocusChild(root))
|
||||
{
|
||||
CoreFocusEvent(dev, FocusIn, mode, B ? NotifyPointerRoot : NotifyDetailNone, root);
|
||||
if (!HasFocus(root) && !FirstFocusChild(root)) {
|
||||
CoreFocusEvent(dev, FocusIn, mode,
|
||||
B ? NotifyPointerRoot : NotifyDetailNone, root);
|
||||
if (B == PointerRootWin)
|
||||
CoreFocusInNotifyPointerEvents(dev, root, None, mode, TRUE);
|
||||
}
|
||||
|
|
@ -1162,10 +1097,8 @@ CoreFocusToPointerRootOrNone(DeviceIntPtr dev,
|
|||
* Assumption: B is a valid window and not PointerRoot or None.
|
||||
*/
|
||||
static void
|
||||
CoreFocusFromPointerRootOrNone(DeviceIntPtr dev,
|
||||
WindowPtr A, /* PointerRootWin or NoneWin */
|
||||
WindowPtr B,
|
||||
int mode)
|
||||
CoreFocusFromPointerRootOrNone(DeviceIntPtr dev, WindowPtr A, /* PointerRootWin or NoneWin */
|
||||
WindowPtr B, int mode)
|
||||
{
|
||||
WindowPtr root;
|
||||
int i;
|
||||
|
|
@ -1176,22 +1109,22 @@ CoreFocusFromPointerRootOrNone(DeviceIntPtr dev,
|
|||
nscreens = 1;
|
||||
#endif
|
||||
|
||||
for (i = 0; i < nscreens; i++)
|
||||
{
|
||||
for (i = 0; i < nscreens; i++) {
|
||||
root = screenInfo.screens[i]->root;
|
||||
if (!HasFocus(root) && !FirstFocusChild(root))
|
||||
{
|
||||
if (!HasFocus(root) && !FirstFocusChild(root)) {
|
||||
/* If pointer was on PointerRootWin and changes to NoneWin, and
|
||||
* the pointer paired with dev is below the current root window,
|
||||
* do a NotifyPointer run. */
|
||||
if (dev->focus && dev->focus->win == PointerRootWin &&
|
||||
B != PointerRootWin)
|
||||
{
|
||||
B != PointerRootWin) {
|
||||
WindowPtr ptrwin = PointerWin(GetMaster(dev, POINTER_OR_FLOAT));
|
||||
|
||||
if (ptrwin)
|
||||
CoreFocusOutNotifyPointerEvents(dev, root, None, mode, TRUE);
|
||||
CoreFocusOutNotifyPointerEvents(dev, root, None, mode,
|
||||
TRUE);
|
||||
}
|
||||
CoreFocusEvent(dev, FocusOut, mode, A ? NotifyPointerRoot : NotifyDetailNone, root);
|
||||
CoreFocusEvent(dev, FocusOut, mode,
|
||||
A ? NotifyPointerRoot : NotifyDetailNone, root);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1199,22 +1132,20 @@ CoreFocusFromPointerRootOrNone(DeviceIntPtr dev,
|
|||
while (root->parent)
|
||||
root = root->parent;
|
||||
|
||||
if (B != root)
|
||||
{
|
||||
if (B != root) {
|
||||
CoreFocusEvent(dev, FocusIn, mode, NotifyNonlinearVirtual, root);
|
||||
CoreFocusInEvents(dev, root, B, mode, NotifyNonlinearVirtual);
|
||||
}
|
||||
|
||||
|
||||
if (!HasFocus(B))
|
||||
{
|
||||
if (!HasFocus(B)) {
|
||||
WindowPtr child = FirstFocusChild(B);
|
||||
if (child)
|
||||
{
|
||||
|
||||
if (child) {
|
||||
CoreFocusEvent(dev, FocusIn, mode, NotifyInferior, B);
|
||||
/* NotifyPointer B-P unless P is child or below. */
|
||||
CoreFocusInNotifyPointerEvents(dev, B, child, mode, FALSE);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
CoreFocusEvent(dev, FocusIn, mode, NotifyNonlinear, B);
|
||||
/* NotifyPointer B-P unless P is child or below. */
|
||||
CoreFocusInNotifyPointerEvents(dev, B, None, mode, FALSE);
|
||||
|
|
@ -1224,10 +1155,7 @@ CoreFocusFromPointerRootOrNone(DeviceIntPtr dev,
|
|||
}
|
||||
|
||||
static void
|
||||
CoreFocusEvents(DeviceIntPtr dev,
|
||||
WindowPtr from,
|
||||
WindowPtr to,
|
||||
int mode)
|
||||
CoreFocusEvents(DeviceIntPtr dev, WindowPtr from, WindowPtr to, int mode)
|
||||
{
|
||||
if (!IsMaster(dev))
|
||||
return;
|
||||
|
|
@ -1252,10 +1180,7 @@ CoreFocusEvents(DeviceIntPtr dev,
|
|||
}
|
||||
|
||||
static void
|
||||
DeviceFocusEvents(DeviceIntPtr dev,
|
||||
WindowPtr from,
|
||||
WindowPtr to,
|
||||
int mode)
|
||||
DeviceFocusEvents(DeviceIntPtr dev, WindowPtr from, WindowPtr to, int mode)
|
||||
{
|
||||
int out, in; /* for holding details for to/from
|
||||
PointerRoot/None */
|
||||
|
|
@ -1274,19 +1199,18 @@ DeviceFocusEvents(DeviceIntPtr dev,
|
|||
nscreens = 1;
|
||||
#endif
|
||||
|
||||
if ((to == NullWindow) || (to == PointerRootWin))
|
||||
{
|
||||
if ((from == NullWindow) || (from == PointerRootWin))
|
||||
{
|
||||
if ((to == NullWindow) || (to == PointerRootWin)) {
|
||||
if ((from == NullWindow) || (from == PointerRootWin)) {
|
||||
if (from == PointerRootWin)
|
||||
DeviceFocusOutEvents(dev, sprite->win, GetCurrentRootWindow(dev), mode,
|
||||
DeviceFocusOutEvents(dev, sprite->win,
|
||||
GetCurrentRootWindow(dev), mode,
|
||||
NotifyPointer);
|
||||
/* Notify all the roots */
|
||||
for (i = 0; i < nscreens; i++)
|
||||
DeviceFocusEvent(dev, XI_FocusOut, mode, out, screenInfo.screens[i]->root);
|
||||
DeviceFocusEvent(dev, XI_FocusOut, mode, out,
|
||||
screenInfo.screens[i]->root);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
if (IsParent(from, sprite->win))
|
||||
DeviceFocusOutEvents(dev, sprite->win, from, mode,
|
||||
NotifyPointer);
|
||||
|
|
@ -1297,45 +1221,43 @@ DeviceFocusEvents(DeviceIntPtr dev,
|
|||
}
|
||||
/* Notify all the roots */
|
||||
for (i = 0; i < nscreens; i++)
|
||||
DeviceFocusEvent(dev, XI_FocusIn, mode, in, screenInfo.screens[i]->root);
|
||||
if (to == PointerRootWin)
|
||||
{
|
||||
DeviceFocusInEvents(dev, GetCurrentRootWindow(dev), sprite->win, mode, NotifyPointer);
|
||||
DeviceFocusEvent(dev, XI_FocusIn, mode, in,
|
||||
screenInfo.screens[i]->root);
|
||||
if (to == PointerRootWin) {
|
||||
DeviceFocusInEvents(dev, GetCurrentRootWindow(dev), sprite->win,
|
||||
mode, NotifyPointer);
|
||||
DeviceFocusEvent(dev, XI_FocusIn, mode, NotifyPointer, sprite->win);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((from == NullWindow) || (from == PointerRootWin))
|
||||
{
|
||||
else {
|
||||
if ((from == NullWindow) || (from == PointerRootWin)) {
|
||||
if (from == PointerRootWin)
|
||||
DeviceFocusOutEvents(dev, sprite->win, GetCurrentRootWindow(dev), mode,
|
||||
DeviceFocusOutEvents(dev, sprite->win,
|
||||
GetCurrentRootWindow(dev), mode,
|
||||
NotifyPointer);
|
||||
for (i = 0; i < nscreens; i++)
|
||||
DeviceFocusEvent(dev, XI_FocusOut, mode, out, screenInfo.screens[i]->root);
|
||||
DeviceFocusEvent(dev, XI_FocusOut, mode, out,
|
||||
screenInfo.screens[i]->root);
|
||||
if (to->parent != NullWindow)
|
||||
DeviceFocusInEvents(dev, GetCurrentRootWindow(dev), to, mode, NotifyNonlinearVirtual);
|
||||
DeviceFocusInEvents(dev, GetCurrentRootWindow(dev), to, mode,
|
||||
NotifyNonlinearVirtual);
|
||||
DeviceFocusEvent(dev, XI_FocusIn, mode, NotifyNonlinear, to);
|
||||
if (IsParent(to, sprite->win))
|
||||
DeviceFocusInEvents(dev, to, sprite->win, mode, NotifyPointer);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (IsParent(to, from))
|
||||
{
|
||||
else {
|
||||
if (IsParent(to, from)) {
|
||||
DeviceFocusEvent(dev, XI_FocusOut, mode, NotifyAncestor, from);
|
||||
DeviceFocusOutEvents(dev, from, to, mode,
|
||||
NotifyVirtual);
|
||||
DeviceFocusOutEvents(dev, from, to, mode, NotifyVirtual);
|
||||
DeviceFocusEvent(dev, XI_FocusIn, mode, NotifyInferior, to);
|
||||
if ((IsParent(to, sprite->win)) &&
|
||||
(sprite->win != from) &&
|
||||
(!IsParent(from, sprite->win)) &&
|
||||
(!IsParent(sprite->win, from)))
|
||||
DeviceFocusInEvents(dev, to, sprite->win, mode, NotifyPointer);
|
||||
DeviceFocusInEvents(dev, to, sprite->win, mode,
|
||||
NotifyPointer);
|
||||
}
|
||||
else
|
||||
if (IsParent(from, to))
|
||||
{
|
||||
else if (IsParent(from, to)) {
|
||||
if ((IsParent(from, sprite->win)) &&
|
||||
(sprite->win != from) &&
|
||||
(!IsParent(to, sprite->win)) &&
|
||||
|
|
@ -1346,10 +1268,10 @@ DeviceFocusEvents(DeviceIntPtr dev,
|
|||
DeviceFocusInEvents(dev, from, to, mode, NotifyVirtual);
|
||||
DeviceFocusEvent(dev, XI_FocusIn, mode, NotifyAncestor, to);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
/* neither from or to is child of other */
|
||||
WindowPtr common = CommonAncestor(to, from);
|
||||
|
||||
/* common == NullWindow ==> different screens */
|
||||
if (IsParent(from, sprite->win))
|
||||
DeviceFocusOutEvents(dev, sprite->win, from, mode,
|
||||
|
|
@ -1359,10 +1281,12 @@ DeviceFocusEvents(DeviceIntPtr dev,
|
|||
DeviceFocusOutEvents(dev, from, common, mode,
|
||||
NotifyNonlinearVirtual);
|
||||
if (to->parent != NullWindow)
|
||||
DeviceFocusInEvents(dev, common, to, mode, NotifyNonlinearVirtual);
|
||||
DeviceFocusInEvents(dev, common, to, mode,
|
||||
NotifyNonlinearVirtual);
|
||||
DeviceFocusEvent(dev, XI_FocusIn, mode, NotifyNonlinear, to);
|
||||
if (IsParent(to, sprite->win))
|
||||
DeviceFocusInEvents(dev, to, sprite->win, mode, NotifyPointer);
|
||||
DeviceFocusInEvents(dev, to, sprite->win, mode,
|
||||
NotifyPointer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1376,10 +1300,7 @@ DeviceFocusEvents(DeviceIntPtr dev,
|
|||
* @param to Window the focus moved into.
|
||||
*/
|
||||
void
|
||||
DoFocusEvents(DeviceIntPtr pDev,
|
||||
WindowPtr from,
|
||||
WindowPtr to,
|
||||
int mode)
|
||||
DoFocusEvents(DeviceIntPtr pDev, WindowPtr from, WindowPtr to, int mode)
|
||||
{
|
||||
if (!IsKeyboardDevice(pDev))
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -31,67 +31,40 @@
|
|||
#ifndef ENTERLEAVE_H
|
||||
#define ENTERLEAVE_H
|
||||
|
||||
extern void DoEnterLeaveEvents(
|
||||
DeviceIntPtr pDev,
|
||||
extern void DoEnterLeaveEvents(DeviceIntPtr pDev,
|
||||
int sourceid,
|
||||
WindowPtr fromWin,
|
||||
WindowPtr toWin,
|
||||
int mode
|
||||
);
|
||||
WindowPtr fromWin, WindowPtr toWin, int mode);
|
||||
|
||||
extern void DoFocusEvents(
|
||||
DeviceIntPtr pDev,
|
||||
WindowPtr fromWin,
|
||||
WindowPtr toWin,
|
||||
int mode
|
||||
);
|
||||
extern void DoFocusEvents(DeviceIntPtr pDev,
|
||||
WindowPtr fromWin, WindowPtr toWin, int mode);
|
||||
|
||||
extern void EnterLeaveEvent(
|
||||
DeviceIntPtr mouse,
|
||||
extern void EnterLeaveEvent(DeviceIntPtr mouse,
|
||||
int type,
|
||||
int mode,
|
||||
int detail,
|
||||
WindowPtr pWin,
|
||||
Window child);
|
||||
int mode, int detail, WindowPtr pWin, Window child);
|
||||
|
||||
extern WindowPtr CommonAncestor(
|
||||
WindowPtr a,
|
||||
WindowPtr b);
|
||||
extern WindowPtr CommonAncestor(WindowPtr a, WindowPtr b);
|
||||
|
||||
extern void CoreEnterLeaveEvent(DeviceIntPtr mouse,
|
||||
int type,
|
||||
int mode,
|
||||
int detail,
|
||||
WindowPtr pWin,
|
||||
Window child);
|
||||
int detail, WindowPtr pWin, Window child);
|
||||
extern void DeviceEnterLeaveEvent(DeviceIntPtr mouse,
|
||||
int sourceid,
|
||||
int type,
|
||||
int mode,
|
||||
int detail,
|
||||
WindowPtr pWin,
|
||||
Window child);
|
||||
int detail, WindowPtr pWin, Window child);
|
||||
|
||||
extern void EnterWindow(DeviceIntPtr dev,
|
||||
WindowPtr win,
|
||||
int mode);
|
||||
extern void EnterWindow(DeviceIntPtr dev, WindowPtr win, int mode);
|
||||
|
||||
extern void LeaveWindow(DeviceIntPtr dev);
|
||||
|
||||
extern void CoreFocusEvent(DeviceIntPtr kbd,
|
||||
int type,
|
||||
int mode,
|
||||
int detail,
|
||||
WindowPtr pWin);
|
||||
int type, int mode, int detail, WindowPtr pWin);
|
||||
|
||||
extern void DeviceFocusEvent(DeviceIntPtr kbd,
|
||||
int type,
|
||||
int mode,
|
||||
int detail,
|
||||
WindowPtr pWin);
|
||||
int type, int mode, int detail, WindowPtr pWin);
|
||||
|
||||
extern void SetFocusIn(DeviceIntPtr kbd,
|
||||
WindowPtr win);
|
||||
extern void SetFocusIn(DeviceIntPtr kbd, WindowPtr win);
|
||||
|
||||
extern void SetFocusOut(DeviceIntPtr dev);
|
||||
#endif /* _ENTERLEAVE_H_ */
|
||||
|
|
|
|||
|
|
@ -51,7 +51,6 @@
|
|||
#include "xkbsrv.h"
|
||||
#include "inpututils.h"
|
||||
|
||||
|
||||
static int countValuators(DeviceEvent *ev, int *first);
|
||||
static int getValuatorEvents(DeviceEvent *ev, deviceValuator * xv);
|
||||
static int eventToKeyButtonPointer(DeviceEvent *ev, xEvent **xi, int *count);
|
||||
|
|
@ -107,16 +106,14 @@ EventToCore(InternalEvent *event, xEvent **core_out, int *count_out)
|
|||
int count = 0;
|
||||
int ret = BadImplementation;
|
||||
|
||||
switch(event->any.type)
|
||||
{
|
||||
switch (event->any.type) {
|
||||
case ET_Motion:
|
||||
{
|
||||
DeviceEvent *e = &event->device_event;
|
||||
|
||||
/* Don't create core motion event if neither x nor y are
|
||||
* present */
|
||||
if (!BitIsOn(e->valuators.mask, 0) &&
|
||||
!BitIsOn(e->valuators.mask, 1))
|
||||
{
|
||||
if (!BitIsOn(e->valuators.mask, 0) && !BitIsOn(e->valuators.mask, 1)) {
|
||||
ret = BadMatch;
|
||||
goto out;
|
||||
}
|
||||
|
|
@ -129,8 +126,7 @@ EventToCore(InternalEvent *event, xEvent **core_out, int *count_out)
|
|||
{
|
||||
DeviceEvent *e = &event->device_event;
|
||||
|
||||
if (e->detail.key > 0xFF)
|
||||
{
|
||||
if (e->detail.key > 0xFF) {
|
||||
ret = BadMatch;
|
||||
goto out;
|
||||
}
|
||||
|
|
@ -146,9 +142,7 @@ EventToCore(InternalEvent *event, xEvent **core_out, int *count_out)
|
|||
core->u.keyButtonPointer.rootY = e->root_y;
|
||||
core->u.keyButtonPointer.state = e->corestate;
|
||||
core->u.keyButtonPointer.root = e->root;
|
||||
EventSetKeyRepeatFlag(core,
|
||||
(e->type == ET_KeyPress &&
|
||||
e->key_repeat));
|
||||
EventSetKeyRepeatFlag(core, (e->type == ET_KeyPress && e->key_repeat));
|
||||
ret = Success;
|
||||
}
|
||||
break;
|
||||
|
|
@ -200,8 +194,7 @@ out:
|
|||
int
|
||||
EventToXI(InternalEvent *ev, xEvent **xi, int *count)
|
||||
{
|
||||
switch (ev->any.type)
|
||||
{
|
||||
switch (ev->any.type) {
|
||||
case ET_Motion:
|
||||
case ET_ButtonPress:
|
||||
case ET_ButtonRelease:
|
||||
|
|
@ -251,8 +244,7 @@ EventToXI(InternalEvent *ev, xEvent **xi, int *count)
|
|||
int
|
||||
EventToXI2(InternalEvent *ev, xEvent **xi)
|
||||
{
|
||||
switch (ev->any.type)
|
||||
{
|
||||
switch (ev->any.type) {
|
||||
/* Enter/FocusIn are for grabs. We don't need an actual event, since
|
||||
* the real events delivered are triggered elsewhere */
|
||||
case ET_Enter:
|
||||
|
|
@ -301,17 +293,14 @@ eventToKeyButtonPointer(DeviceEvent *ev, xEvent **xi, int *count)
|
|||
deviceKeyButtonPointer *kbp;
|
||||
|
||||
/* Sorry, XI 1.x protocol restrictions. */
|
||||
if (ev->detail.button > 0xFF || ev->deviceid >= 0x80)
|
||||
{
|
||||
if (ev->detail.button > 0xFF || ev->deviceid >= 0x80) {
|
||||
*count = 0;
|
||||
return Success;
|
||||
}
|
||||
|
||||
num_events = (countValuators(ev, &first) + 5) / 6; /* valuator ev */
|
||||
if (num_events <= 0)
|
||||
{
|
||||
switch (ev->type)
|
||||
{
|
||||
if (num_events <= 0) {
|
||||
switch (ev->type) {
|
||||
case ET_KeyPress:
|
||||
case ET_KeyRelease:
|
||||
case ET_ButtonPress:
|
||||
|
|
@ -332,8 +321,7 @@ eventToKeyButtonPointer(DeviceEvent *ev, xEvent **xi, int *count)
|
|||
num_events++; /* the actual event event */
|
||||
|
||||
*xi = calloc(num_events, sizeof(xEvent));
|
||||
if (!(*xi))
|
||||
{
|
||||
if (!(*xi)) {
|
||||
return BadAlloc;
|
||||
}
|
||||
|
||||
|
|
@ -351,21 +339,33 @@ eventToKeyButtonPointer(DeviceEvent *ev, xEvent **xi, int *count)
|
|||
if (num_events > 1)
|
||||
kbp->deviceid |= MORE_EVENTS;
|
||||
|
||||
switch(ev->type)
|
||||
{
|
||||
case ET_Motion: kbp->type = DeviceMotionNotify; break;
|
||||
case ET_ButtonPress: kbp->type = DeviceButtonPress; break;
|
||||
case ET_ButtonRelease: kbp->type = DeviceButtonRelease; break;
|
||||
case ET_KeyPress: kbp->type = DeviceKeyPress; break;
|
||||
case ET_KeyRelease: kbp->type = DeviceKeyRelease; break;
|
||||
case ET_ProximityIn: kbp->type = ProximityIn; break;
|
||||
case ET_ProximityOut: kbp->type = ProximityOut; break;
|
||||
switch (ev->type) {
|
||||
case ET_Motion:
|
||||
kbp->type = DeviceMotionNotify;
|
||||
break;
|
||||
case ET_ButtonPress:
|
||||
kbp->type = DeviceButtonPress;
|
||||
break;
|
||||
case ET_ButtonRelease:
|
||||
kbp->type = DeviceButtonRelease;
|
||||
break;
|
||||
case ET_KeyPress:
|
||||
kbp->type = DeviceKeyPress;
|
||||
break;
|
||||
case ET_KeyRelease:
|
||||
kbp->type = DeviceKeyRelease;
|
||||
break;
|
||||
case ET_ProximityIn:
|
||||
kbp->type = ProximityIn;
|
||||
break;
|
||||
case ET_ProximityOut:
|
||||
kbp->type = ProximityOut;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (num_events > 1)
|
||||
{
|
||||
if (num_events > 1) {
|
||||
getValuatorEvents(ev, (deviceValuator *) (kbp + 1));
|
||||
}
|
||||
|
||||
|
|
@ -373,7 +373,6 @@ eventToKeyButtonPointer(DeviceEvent *ev, xEvent **xi, int *count)
|
|||
return Success;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set first to the first valuator in the event ev and return the number of
|
||||
* valuators from first to the last set valuator.
|
||||
|
|
@ -384,18 +383,15 @@ countValuators(DeviceEvent *ev, int *first)
|
|||
int first_valuator = -1, last_valuator = -1, num_valuators = 0;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < sizeof(ev->valuators.mask) * 8; i++)
|
||||
{
|
||||
if (BitIsOn(ev->valuators.mask, i))
|
||||
{
|
||||
for (i = 0; i < sizeof(ev->valuators.mask) * 8; i++) {
|
||||
if (BitIsOn(ev->valuators.mask, i)) {
|
||||
if (first_valuator == -1)
|
||||
first_valuator = i;
|
||||
last_valuator = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (first_valuator != -1)
|
||||
{
|
||||
if (first_valuator != -1) {
|
||||
num_valuators = last_valuator - first_valuator + 1;
|
||||
*first = first_valuator;
|
||||
}
|
||||
|
|
@ -410,14 +406,15 @@ getValuatorEvents(DeviceEvent *ev, deviceValuator *xv)
|
|||
int state = 0;
|
||||
int first_valuator, num_valuators;
|
||||
|
||||
|
||||
num_valuators = countValuators(ev, &first_valuator);
|
||||
if (num_valuators > 0)
|
||||
{
|
||||
if (num_valuators > 0) {
|
||||
DeviceIntPtr dev = NULL;
|
||||
|
||||
dixLookupDevice(&dev, ev->deviceid, serverClient, DixUseAccess);
|
||||
/* State needs to be assembled BEFORE the device is updated. */
|
||||
state = (dev && dev->key) ? XkbStateFieldFromRec(&dev->key->xkbInfo->state) : 0;
|
||||
state = (dev &&
|
||||
dev->key) ? XkbStateFieldFromRec(&dev->key->xkbInfo->
|
||||
state) : 0;
|
||||
state |= (dev && dev->button) ? (dev->button->state) : 0;
|
||||
}
|
||||
|
||||
|
|
@ -443,7 +440,6 @@ getValuatorEvents(DeviceEvent *ev, deviceValuator *xv)
|
|||
return (num_valuators + 5) / 6;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
appendKeyInfo(DeviceChangedEvent *dce, xXIKeyInfo * info)
|
||||
{
|
||||
|
|
@ -487,7 +483,8 @@ appendButtonInfo(DeviceChangedEvent *dce, xXIButtonInfo *info)
|
|||
}
|
||||
|
||||
static int
|
||||
appendValuatorInfo(DeviceChangedEvent *dce, xXIValuatorInfo *info, int axisnumber)
|
||||
appendValuatorInfo(DeviceChangedEvent *dce, xXIValuatorInfo * info,
|
||||
int axisnumber)
|
||||
{
|
||||
info->type = XIValuatorClass;
|
||||
info->length = sizeof(xXIValuatorInfo) / 4;
|
||||
|
|
@ -516,8 +513,7 @@ appendScrollInfo(DeviceChangedEvent *dce, xXIScrollInfo *info, int axisnumber)
|
|||
info->type = XIScrollClass;
|
||||
info->length = sizeof(xXIScrollInfo) / 4;
|
||||
info->number = axisnumber;
|
||||
switch(dce->valuators[axisnumber].scroll.type)
|
||||
{
|
||||
switch (dce->valuators[axisnumber].scroll.type) {
|
||||
case SCROLL_TYPE_VERTICAL:
|
||||
info->scroll_type = XIScrollTypeVertical;
|
||||
break;
|
||||
|
|
@ -525,10 +521,12 @@ appendScrollInfo(DeviceChangedEvent *dce, xXIScrollInfo *info, int axisnumber)
|
|||
info->scroll_type = XIScrollTypeHorizontal;
|
||||
break;
|
||||
default:
|
||||
ErrorF("[Xi] Unknown scroll type %d. This is a bug.\n", dce->valuators[axisnumber].scroll.type);
|
||||
ErrorF("[Xi] Unknown scroll type %d. This is a bug.\n",
|
||||
dce->valuators[axisnumber].scroll.type);
|
||||
break;
|
||||
}
|
||||
info->increment = double_to_fp3232(dce->valuators[axisnumber].scroll.increment);
|
||||
info->increment =
|
||||
double_to_fp3232(dce->valuators[axisnumber].scroll.increment);
|
||||
info->sourceid = dce->sourceid;
|
||||
|
||||
info->flags = 0;
|
||||
|
|
@ -549,14 +547,12 @@ eventToDeviceChanged(DeviceChangedEvent *dce, xEvent **xi)
|
|||
int nkeys;
|
||||
char *ptr;
|
||||
|
||||
if (dce->buttons.num_buttons)
|
||||
{
|
||||
if (dce->buttons.num_buttons) {
|
||||
len += sizeof(xXIButtonInfo);
|
||||
len += dce->buttons.num_buttons * sizeof(Atom); /* button names */
|
||||
len += pad_to_int32(bits_to_bytes(dce->buttons.num_buttons));
|
||||
}
|
||||
if (dce->num_valuators)
|
||||
{
|
||||
if (dce->num_valuators) {
|
||||
int i;
|
||||
|
||||
len += sizeof(xXIValuatorInfo) * dce->num_valuators;
|
||||
|
|
@ -568,15 +564,13 @@ eventToDeviceChanged(DeviceChangedEvent *dce, xEvent **xi)
|
|||
|
||||
nkeys = (dce->keys.max_keycode > 0) ?
|
||||
dce->keys.max_keycode - dce->keys.min_keycode + 1 : 0;
|
||||
if (nkeys > 0)
|
||||
{
|
||||
if (nkeys > 0) {
|
||||
len += sizeof(xXIKeyInfo);
|
||||
len += sizeof(CARD32) * nkeys; /* keycodes */
|
||||
}
|
||||
|
||||
dcce = calloc(1, len);
|
||||
if (!dcce)
|
||||
{
|
||||
if (!dcce) {
|
||||
ErrorF("[Xi] BadAlloc in SendDeviceChangedEvent.\n");
|
||||
return BadAlloc;
|
||||
}
|
||||
|
|
@ -587,35 +581,31 @@ eventToDeviceChanged(DeviceChangedEvent *dce, xEvent **xi)
|
|||
dcce->time = dce->time;
|
||||
dcce->deviceid = dce->deviceid;
|
||||
dcce->sourceid = dce->sourceid;
|
||||
dcce->reason = (dce->flags & DEVCHANGE_DEVICE_CHANGE) ? XIDeviceChange : XISlaveSwitch;
|
||||
dcce->reason =
|
||||
(dce->flags & DEVCHANGE_DEVICE_CHANGE) ? XIDeviceChange : XISlaveSwitch;
|
||||
dcce->num_classes = 0;
|
||||
dcce->length = bytes_to_int32(len - sizeof(xEvent));
|
||||
|
||||
ptr = (char *) &dcce[1];
|
||||
if (dce->buttons.num_buttons)
|
||||
{
|
||||
if (dce->buttons.num_buttons) {
|
||||
dcce->num_classes++;
|
||||
ptr += appendButtonInfo(dce, (xXIButtonInfo *) ptr);
|
||||
}
|
||||
|
||||
if (nkeys)
|
||||
{
|
||||
if (nkeys) {
|
||||
dcce->num_classes++;
|
||||
ptr += appendKeyInfo(dce, (xXIKeyInfo *) ptr);
|
||||
}
|
||||
|
||||
if (dce->num_valuators)
|
||||
{
|
||||
if (dce->num_valuators) {
|
||||
int i;
|
||||
|
||||
dcce->num_classes += dce->num_valuators;
|
||||
for (i = 0; i < dce->num_valuators; i++)
|
||||
ptr += appendValuatorInfo(dce, (xXIValuatorInfo *) ptr, i);
|
||||
|
||||
for (i = 0; i < dce->num_valuators; i++)
|
||||
{
|
||||
if (dce->valuators[i].scroll.type != SCROLL_TYPE_NONE)
|
||||
{
|
||||
for (i = 0; i < dce->num_valuators; i++) {
|
||||
if (dce->valuators[i].scroll.type != SCROLL_TYPE_NONE) {
|
||||
dcce->num_classes++;
|
||||
ptr += appendScrollInfo(dce, (xXIScrollInfo *) ptr, i);
|
||||
}
|
||||
|
|
@ -627,17 +617,16 @@ eventToDeviceChanged(DeviceChangedEvent *dce, xEvent **xi)
|
|||
return Success;
|
||||
}
|
||||
|
||||
static int count_bits(unsigned char* ptr, int len)
|
||||
static int
|
||||
count_bits(unsigned char *ptr, int len)
|
||||
{
|
||||
int bits = 0;
|
||||
unsigned int i;
|
||||
unsigned char x;
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
for (i = 0; i < len; i++) {
|
||||
x = ptr[i];
|
||||
while(x > 0)
|
||||
{
|
||||
while (x > 0) {
|
||||
bits += (x & 0x1);
|
||||
x >>= 1;
|
||||
}
|
||||
|
|
@ -660,8 +649,9 @@ eventToDeviceEvent(DeviceEvent *ev, xEvent **xi)
|
|||
btlen = bytes_to_int32(bits_to_bytes(MAX_BUTTONS));
|
||||
len += btlen * 4; /* buttonmask len */
|
||||
|
||||
|
||||
vallen = count_bits(ev->valuators.mask, sizeof(ev->valuators.mask)/sizeof(ev->valuators.mask[0]));
|
||||
vallen =
|
||||
count_bits(ev->valuators.mask,
|
||||
sizeof(ev->valuators.mask) / sizeof(ev->valuators.mask[0]));
|
||||
len += vallen * 2 * sizeof(uint32_t); /* axisvalues */
|
||||
vallen = bytes_to_int32(bits_to_bytes(MAX_VALUATORS));
|
||||
len += vallen * 4; /* valuators mask */
|
||||
|
|
@ -709,18 +699,15 @@ eventToDeviceEvent(DeviceEvent *ev, xEvent **xi)
|
|||
xde->group.effective_group = ev->group.effective;
|
||||
|
||||
ptr = (char *) &xde[1];
|
||||
for (i = 0; i < sizeof(ev->buttons) * 8; i++)
|
||||
{
|
||||
for (i = 0; i < sizeof(ev->buttons) * 8; i++) {
|
||||
if (BitIsOn(ev->buttons, i))
|
||||
SetBit(ptr, i);
|
||||
}
|
||||
|
||||
ptr += xde->buttons_len * 4;
|
||||
axisval = (FP3232 *) (ptr + xde->valuators_len * 4);
|
||||
for (i = 0; i < sizeof(ev->valuators.mask) * 8; i++)
|
||||
{
|
||||
if (BitIsOn(ev->valuators.mask, i))
|
||||
{
|
||||
for (i = 0; i < sizeof(ev->valuators.mask) * 8; i++) {
|
||||
if (BitIsOn(ev->valuators.mask, i)) {
|
||||
SetBit(ptr, i);
|
||||
*axisval = double_to_fp3232(ev->valuators.data[i]);
|
||||
axisval++;
|
||||
|
|
@ -782,10 +769,8 @@ eventToRawEvent(RawDeviceEvent *ev, xEvent **xi)
|
|||
ptr = (char *) &raw[1];
|
||||
axisval = (FP3232 *) (ptr + raw->valuators_len * 4);
|
||||
axisval_raw = axisval + nvals;
|
||||
for (i = 0; i < sizeof(ev->valuators.mask) * 8; i++)
|
||||
{
|
||||
if (BitIsOn(ev->valuators.mask, i))
|
||||
{
|
||||
for (i = 0; i < sizeof(ev->valuators.mask) * 8; i++) {
|
||||
if (BitIsOn(ev->valuators.mask, i)) {
|
||||
SetBit(ptr, i);
|
||||
*axisval = double_to_fp3232(ev->valuators.data[i]);
|
||||
*axisval_raw = double_to_fp3232(ev->valuators.data_raw[i]);
|
||||
|
|
@ -805,13 +790,23 @@ int
|
|||
GetCoreType(enum EventType type)
|
||||
{
|
||||
int coretype = 0;
|
||||
switch(type)
|
||||
{
|
||||
case ET_Motion: coretype = MotionNotify; break;
|
||||
case ET_ButtonPress: coretype = ButtonPress; break;
|
||||
case ET_ButtonRelease: coretype = ButtonRelease; break;
|
||||
case ET_KeyPress: coretype = KeyPress; break;
|
||||
case ET_KeyRelease: coretype = KeyRelease; break;
|
||||
|
||||
switch (type) {
|
||||
case ET_Motion:
|
||||
coretype = MotionNotify;
|
||||
break;
|
||||
case ET_ButtonPress:
|
||||
coretype = ButtonPress;
|
||||
break;
|
||||
case ET_ButtonRelease:
|
||||
coretype = ButtonRelease;
|
||||
break;
|
||||
case ET_KeyPress:
|
||||
coretype = KeyPress;
|
||||
break;
|
||||
case ET_KeyRelease:
|
||||
coretype = KeyRelease;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -826,15 +821,29 @@ int
|
|||
GetXIType(enum EventType type)
|
||||
{
|
||||
int xitype = 0;
|
||||
switch(type)
|
||||
{
|
||||
case ET_Motion: xitype = DeviceMotionNotify; break;
|
||||
case ET_ButtonPress: xitype = DeviceButtonPress; break;
|
||||
case ET_ButtonRelease: xitype = DeviceButtonRelease; break;
|
||||
case ET_KeyPress: xitype = DeviceKeyPress; break;
|
||||
case ET_KeyRelease: xitype = DeviceKeyRelease; break;
|
||||
case ET_ProximityIn: xitype = ProximityIn; break;
|
||||
case ET_ProximityOut: xitype = ProximityOut; break;
|
||||
|
||||
switch (type) {
|
||||
case ET_Motion:
|
||||
xitype = DeviceMotionNotify;
|
||||
break;
|
||||
case ET_ButtonPress:
|
||||
xitype = DeviceButtonPress;
|
||||
break;
|
||||
case ET_ButtonRelease:
|
||||
xitype = DeviceButtonRelease;
|
||||
break;
|
||||
case ET_KeyPress:
|
||||
xitype = DeviceKeyPress;
|
||||
break;
|
||||
case ET_KeyRelease:
|
||||
xitype = DeviceKeyRelease;
|
||||
break;
|
||||
case ET_ProximityIn:
|
||||
xitype = ProximityIn;
|
||||
break;
|
||||
case ET_ProximityOut:
|
||||
xitype = ProximityOut;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -850,31 +859,76 @@ GetXI2Type(enum EventType type)
|
|||
{
|
||||
int xi2type = 0;
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case ET_Motion: xi2type = XI_Motion; break;
|
||||
case ET_ButtonPress: xi2type = XI_ButtonPress; break;
|
||||
case ET_ButtonRelease: xi2type = XI_ButtonRelease; break;
|
||||
case ET_KeyPress: xi2type = XI_KeyPress; break;
|
||||
case ET_KeyRelease: xi2type = XI_KeyRelease; break;
|
||||
case ET_Enter: xi2type = XI_Enter; break;
|
||||
case ET_Leave: xi2type = XI_Leave; break;
|
||||
case ET_Hierarchy: xi2type = XI_HierarchyChanged; break;
|
||||
case ET_DeviceChanged: xi2type = XI_DeviceChanged; break;
|
||||
case ET_RawKeyPress: xi2type = XI_RawKeyPress; break;
|
||||
case ET_RawKeyRelease: xi2type = XI_RawKeyRelease; break;
|
||||
case ET_RawButtonPress: xi2type = XI_RawButtonPress; break;
|
||||
case ET_RawButtonRelease: xi2type = XI_RawButtonRelease; break;
|
||||
case ET_RawMotion: xi2type = XI_RawMotion; break;
|
||||
case ET_RawTouchBegin: xi2type = XI_RawTouchBegin; break;
|
||||
case ET_RawTouchUpdate: xi2type = XI_RawTouchUpdate; break;
|
||||
case ET_RawTouchEnd: xi2type = XI_RawTouchEnd; break;
|
||||
case ET_FocusIn: xi2type = XI_FocusIn; break;
|
||||
case ET_FocusOut: xi2type = XI_FocusOut; break;
|
||||
case ET_TouchBegin: xi2type = XI_TouchBegin; break;
|
||||
case ET_TouchEnd: xi2type = XI_TouchEnd; break;
|
||||
case ET_TouchUpdate: xi2type = XI_TouchUpdate; break;
|
||||
case ET_TouchOwnership: xi2type = XI_TouchOwnership; break;
|
||||
switch (type) {
|
||||
case ET_Motion:
|
||||
xi2type = XI_Motion;
|
||||
break;
|
||||
case ET_ButtonPress:
|
||||
xi2type = XI_ButtonPress;
|
||||
break;
|
||||
case ET_ButtonRelease:
|
||||
xi2type = XI_ButtonRelease;
|
||||
break;
|
||||
case ET_KeyPress:
|
||||
xi2type = XI_KeyPress;
|
||||
break;
|
||||
case ET_KeyRelease:
|
||||
xi2type = XI_KeyRelease;
|
||||
break;
|
||||
case ET_Enter:
|
||||
xi2type = XI_Enter;
|
||||
break;
|
||||
case ET_Leave:
|
||||
xi2type = XI_Leave;
|
||||
break;
|
||||
case ET_Hierarchy:
|
||||
xi2type = XI_HierarchyChanged;
|
||||
break;
|
||||
case ET_DeviceChanged:
|
||||
xi2type = XI_DeviceChanged;
|
||||
break;
|
||||
case ET_RawKeyPress:
|
||||
xi2type = XI_RawKeyPress;
|
||||
break;
|
||||
case ET_RawKeyRelease:
|
||||
xi2type = XI_RawKeyRelease;
|
||||
break;
|
||||
case ET_RawButtonPress:
|
||||
xi2type = XI_RawButtonPress;
|
||||
break;
|
||||
case ET_RawButtonRelease:
|
||||
xi2type = XI_RawButtonRelease;
|
||||
break;
|
||||
case ET_RawMotion:
|
||||
xi2type = XI_RawMotion;
|
||||
break;
|
||||
case ET_RawTouchBegin:
|
||||
xi2type = XI_RawTouchBegin;
|
||||
break;
|
||||
case ET_RawTouchUpdate:
|
||||
xi2type = XI_RawTouchUpdate;
|
||||
break;
|
||||
case ET_RawTouchEnd:
|
||||
xi2type = XI_RawTouchEnd;
|
||||
break;
|
||||
case ET_FocusIn:
|
||||
xi2type = XI_FocusIn;
|
||||
break;
|
||||
case ET_FocusOut:
|
||||
xi2type = XI_FocusOut;
|
||||
break;
|
||||
case ET_TouchBegin:
|
||||
xi2type = XI_TouchBegin;
|
||||
break;
|
||||
case ET_TouchEnd:
|
||||
xi2type = XI_TouchEnd;
|
||||
break;
|
||||
case ET_TouchUpdate:
|
||||
xi2type = XI_TouchUpdate;
|
||||
break;
|
||||
case ET_TouchOwnership:
|
||||
xi2type = XI_TouchOwnership;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue