mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2025-12-24 12:30:05 +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);
|
REQUEST_SIZE_MATCH(xDPMSSetTimeoutsReq);
|
||||||
|
|
||||||
if ((stuff->off != 0)&&(stuff->off < stuff->suspend))
|
if ((stuff->off != 0) && (stuff->off < stuff->suspend)) {
|
||||||
{
|
|
||||||
client->errorValue = stuff->off;
|
client->errorValue = stuff->off;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
if ((stuff->suspend != 0)&&(stuff->suspend < stuff->standby))
|
if ((stuff->suspend != 0) && (stuff->suspend < stuff->standby)) {
|
||||||
{
|
|
||||||
client->errorValue = stuff->suspend;
|
client->errorValue = stuff->suspend;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
|
@ -176,8 +174,7 @@ ProcDPMSForceLevel(ClientPtr client)
|
||||||
|
|
||||||
if (stuff->level != DPMSModeOn &&
|
if (stuff->level != DPMSModeOn &&
|
||||||
stuff->level != DPMSModeStandby &&
|
stuff->level != DPMSModeStandby &&
|
||||||
stuff->level != DPMSModeSuspend &&
|
stuff->level != DPMSModeSuspend && stuff->level != DPMSModeOff) {
|
||||||
stuff->level != DPMSModeOff) {
|
|
||||||
client->errorValue = stuff->level;
|
client->errorValue = stuff->level;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
|
@ -214,8 +211,7 @@ ProcDPMSDispatch (ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xReq);
|
REQUEST(xReq);
|
||||||
|
|
||||||
switch (stuff->data)
|
switch (stuff->data) {
|
||||||
{
|
|
||||||
case X_DPMSGetVersion:
|
case X_DPMSGetVersion:
|
||||||
return ProcDPMSGetVersion(client);
|
return ProcDPMSGetVersion(client);
|
||||||
case X_DPMSCapable:
|
case X_DPMSCapable:
|
||||||
|
|
@ -335,8 +331,7 @@ static int
|
||||||
SProcDPMSDispatch(ClientPtr client)
|
SProcDPMSDispatch(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xReq);
|
REQUEST(xReq);
|
||||||
switch (stuff->data)
|
switch (stuff->data) {
|
||||||
{
|
|
||||||
case X_DPMSGetVersion:
|
case X_DPMSGetVersion:
|
||||||
return SProcDPMSGetVersion(client);
|
return SProcDPMSGetVersion(client);
|
||||||
case X_DPMSCapable:
|
case X_DPMSCapable:
|
||||||
|
|
|
||||||
|
|
@ -34,12 +34,14 @@ Equipment Corporation.
|
||||||
|
|
||||||
#define FALSE 0
|
#define FALSE 0
|
||||||
|
|
||||||
Bool DPMSSupported(void)
|
Bool
|
||||||
|
DPMSSupported(void)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int DPMSSet(ClientPtr client, int level)
|
int
|
||||||
|
DPMSSet(ClientPtr client, int level)
|
||||||
{
|
{
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
33
Xext/geext.c
33
Xext/geext.c
|
|
@ -60,6 +60,7 @@ ProcGEQueryVersion(ClientPtr client)
|
||||||
{
|
{
|
||||||
GEClientInfoPtr pGEClient = GEGetClient(client);
|
GEClientInfoPtr pGEClient = GEGetClient(client);
|
||||||
xGEQueryVersionReply rep;
|
xGEQueryVersionReply rep;
|
||||||
|
|
||||||
REQUEST(xGEQueryVersionReq);
|
REQUEST(xGEQueryVersionReq);
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xGEQueryVersionReq);
|
REQUEST_SIZE_MATCH(xGEQueryVersionReq);
|
||||||
|
|
@ -77,8 +78,7 @@ ProcGEQueryVersion(ClientPtr client)
|
||||||
pGEClient->major_version = stuff->majorVersion;
|
pGEClient->major_version = stuff->majorVersion;
|
||||||
pGEClient->minor_version = stuff->minorVersion;
|
pGEClient->minor_version = stuff->minorVersion;
|
||||||
|
|
||||||
if (client->swapped)
|
if (client->swapped) {
|
||||||
{
|
|
||||||
swaps(&rep.sequenceNumber);
|
swaps(&rep.sequenceNumber);
|
||||||
swapl(&rep.length);
|
swapl(&rep.length);
|
||||||
swaps(&rep.majorVersion);
|
swaps(&rep.majorVersion);
|
||||||
|
|
@ -91,8 +91,7 @@ ProcGEQueryVersion(ClientPtr client)
|
||||||
|
|
||||||
int (*ProcGEVector[GENumberRequests]) (ClientPtr) = {
|
int (*ProcGEVector[GENumberRequests]) (ClientPtr) = {
|
||||||
/* Version 1.0 */
|
/* Version 1.0 */
|
||||||
ProcGEQueryVersion
|
ProcGEQueryVersion};
|
||||||
};
|
|
||||||
|
|
||||||
/************************************************************/
|
/************************************************************/
|
||||||
/* swapped request handlers */
|
/* swapped request handlers */
|
||||||
|
|
@ -111,9 +110,7 @@ SProcGEQueryVersion(ClientPtr client)
|
||||||
|
|
||||||
int (*SProcGEVector[GENumberRequests]) (ClientPtr) = {
|
int (*SProcGEVector[GENumberRequests]) (ClientPtr) = {
|
||||||
/* Version 1.0 */
|
/* Version 1.0 */
|
||||||
SProcGEQueryVersion
|
SProcGEQueryVersion};
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************************/
|
/************************************************************/
|
||||||
/* callbacks */
|
/* callbacks */
|
||||||
|
|
@ -124,6 +121,7 @@ static int
|
||||||
ProcGEDispatch(ClientPtr client)
|
ProcGEDispatch(ClientPtr client)
|
||||||
{
|
{
|
||||||
GEClientInfoPtr pGEClient = GEGetClient(client);
|
GEClientInfoPtr pGEClient = GEGetClient(client);
|
||||||
|
|
||||||
REQUEST(xGEReq);
|
REQUEST(xGEReq);
|
||||||
|
|
||||||
if (pGEClient->major_version >= NUM_VERSION_REQUESTS)
|
if (pGEClient->major_version >= NUM_VERSION_REQUESTS)
|
||||||
|
|
@ -151,9 +149,7 @@ SProcGEDispatch(ClientPtr client)
|
||||||
* used in the furture for versioning support.
|
* used in the furture for versioning support.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
GEClientCallback(CallbackListPtr *list,
|
GEClientCallback(CallbackListPtr *list, pointer closure, pointer data)
|
||||||
pointer closure,
|
|
||||||
pointer data)
|
|
||||||
{
|
{
|
||||||
NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
|
NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
|
||||||
ClientPtr pClient = clientinfo->client;
|
ClientPtr pClient = clientinfo->client;
|
||||||
|
|
@ -184,8 +180,7 @@ SGEGenericEvent(xEvent* from, xEvent* to)
|
||||||
xGenericEvent *gefrom = (xGenericEvent *) from;
|
xGenericEvent *gefrom = (xGenericEvent *) from;
|
||||||
xGenericEvent *geto = (xGenericEvent *) to;
|
xGenericEvent *geto = (xGenericEvent *) to;
|
||||||
|
|
||||||
if ((gefrom->extension & 0x7f) > MAXEXTENSIONS)
|
if ((gefrom->extension & 0x7f) > MAXEXTENSIONS) {
|
||||||
{
|
|
||||||
ErrorF("GE: Invalid extension offset for event.\n");
|
ErrorF("GE: Invalid extension offset for event.\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -203,23 +198,23 @@ GEExtensionInit(void)
|
||||||
{
|
{
|
||||||
ExtensionEntry *extEntry;
|
ExtensionEntry *extEntry;
|
||||||
|
|
||||||
if (!dixRegisterPrivateKey(&GEClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(GEClientInfoRec)))
|
if (!dixRegisterPrivateKey
|
||||||
|
(&GEClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(GEClientInfoRec)))
|
||||||
FatalError("GEExtensionInit: GE private request failed.\n");
|
FatalError("GEExtensionInit: GE private request failed.\n");
|
||||||
|
|
||||||
if(!AddCallback(&ClientStateCallback, GEClientCallback, 0))
|
if (!AddCallback(&ClientStateCallback, GEClientCallback, 0)) {
|
||||||
{
|
|
||||||
FatalError("GEExtensionInit: register client callback failed.\n");
|
FatalError("GEExtensionInit: register client callback failed.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((extEntry = AddExtension(GE_NAME,
|
if ((extEntry = AddExtension(GE_NAME,
|
||||||
0, GENumberErrors,
|
0, GENumberErrors,
|
||||||
ProcGEDispatch, SProcGEDispatch,
|
ProcGEDispatch, SProcGEDispatch,
|
||||||
GEResetProc, StandardMinorOpcode)) != 0)
|
GEResetProc, StandardMinorOpcode)) != 0) {
|
||||||
{
|
|
||||||
memset(GEExtensions, 0, sizeof(GEExtensions));
|
memset(GEExtensions, 0, sizeof(GEExtensions));
|
||||||
|
|
||||||
EventSwapVector[GenericEvent] = (EventSwapPtr) SGEGenericEvent;
|
EventSwapVector[GenericEvent] = (EventSwapPtr) SGEGenericEvent;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
FatalError("GEInit: AddExtensions failed.\n");
|
FatalError("GEInit: AddExtensions failed.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -247,7 +242,6 @@ GERegisterExtension(int extension,
|
||||||
GEExtensions[EXT_MASK(extension)].evswap = ev_swap;
|
GEExtensions[EXT_MASK(extension)].evswap = ev_swap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Sets type and extension field for a generic event. This is just an
|
/* Sets type and extension field for a generic event. This is just an
|
||||||
* auxiliary function, extensions could do it manually too.
|
* auxiliary function, extensions could do it manually too.
|
||||||
*/
|
*/
|
||||||
|
|
@ -258,4 +252,3 @@ GEInitEvent(xGenericEvent* ev, int extension)
|
||||||
ev->extension = extension;
|
ev->extension = extension;
|
||||||
ev->length = 0;
|
ev->length = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
10
Xext/geext.h
10
Xext/geext.h
|
|
@ -40,7 +40,6 @@ typedef struct _GEExtension {
|
||||||
void (*evswap) (xGenericEvent *from, xGenericEvent *to);
|
void (*evswap) (xGenericEvent *from, xGenericEvent *to);
|
||||||
} GEExtension, *GEExtensionPtr;
|
} GEExtension, *GEExtensionPtr;
|
||||||
|
|
||||||
|
|
||||||
/* All registered extensions and their handling functions. */
|
/* All registered extensions and their handling functions. */
|
||||||
extern _X_EXPORT GEExtension GEExtensions[MAXEXTENSIONS];
|
extern _X_EXPORT GEExtension GEExtensions[MAXEXTENSIONS];
|
||||||
|
|
||||||
|
|
@ -70,11 +69,12 @@ extern _X_EXPORT GEExtension GEExtensions[MAXEXTENSIONS];
|
||||||
GEEXT(ev) == (ext) && \
|
GEEXT(ev) == (ext) && \
|
||||||
GEV(ev)->evtype == (ev_type))
|
GEV(ev)->evtype == (ev_type))
|
||||||
|
|
||||||
|
|
||||||
/* Interface for other extensions */
|
/* Interface for other extensions */
|
||||||
extern _X_EXPORT void GERegisterExtension(
|
extern _X_EXPORT void GERegisterExtension(int extension,
|
||||||
int extension,
|
void (*ev_dispatch) (xGenericEvent
|
||||||
void (*ev_dispatch)(xGenericEvent* from, xGenericEvent* to));
|
*from,
|
||||||
|
xGenericEvent
|
||||||
|
*to));
|
||||||
|
|
||||||
extern _X_EXPORT void GEInitEvent(xGenericEvent *ev, int extension);
|
extern _X_EXPORT void GEInitEvent(xGenericEvent *ev, int extension);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@
|
||||||
#include <X11/extensions/geproto.h>
|
#include <X11/extensions/geproto.h>
|
||||||
|
|
||||||
extern _X_EXPORT DevPrivateKeyRec GEClientPrivateKeyRec;
|
extern _X_EXPORT DevPrivateKeyRec GEClientPrivateKeyRec;
|
||||||
|
|
||||||
#define GEClientPrivateKey (&GEClientPrivateKeyRec)
|
#define GEClientPrivateKey (&GEClientPrivateKeyRec)
|
||||||
|
|
||||||
typedef struct _GEClientInfo {
|
typedef struct _GEClientInfo {
|
||||||
|
|
|
||||||
120
Xext/panoramiX.c
120
Xext/panoramiX.c
|
|
@ -64,8 +64,7 @@ Equipment Corporation.
|
||||||
|
|
||||||
#ifdef GLXPROXY
|
#ifdef GLXPROXY
|
||||||
extern VisualPtr glxMatchVisual(ScreenPtr pScreen,
|
extern VisualPtr glxMatchVisual(ScreenPtr pScreen,
|
||||||
VisualPtr pVisual,
|
VisualPtr pVisual, ScreenPtr pMatchScreen);
|
||||||
ScreenPtr pMatchScreen);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -107,11 +106,14 @@ static void PanoramiXResetProc(ExtensionEntry*);
|
||||||
|
|
||||||
#include "panoramiXh.h"
|
#include "panoramiXh.h"
|
||||||
|
|
||||||
int (* SavedProcVector[256]) (ClientPtr client) = { NULL, };
|
int (*SavedProcVector[256]) (ClientPtr client) = {
|
||||||
|
NULL,};
|
||||||
|
|
||||||
static DevPrivateKeyRec PanoramiXGCKeyRec;
|
static DevPrivateKeyRec PanoramiXGCKeyRec;
|
||||||
|
|
||||||
#define PanoramiXGCKey (&PanoramiXGCKeyRec)
|
#define PanoramiXGCKey (&PanoramiXGCKeyRec)
|
||||||
static DevPrivateKeyRec PanoramiXScreenKeyRec;
|
static DevPrivateKeyRec PanoramiXScreenKeyRec;
|
||||||
|
|
||||||
#define PanoramiXScreenKey (&PanoramiXScreenKeyRec)
|
#define PanoramiXScreenKey (&PanoramiXScreenKeyRec)
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
@ -147,7 +149,6 @@ static GCFuncs XineramaGCFuncs = {
|
||||||
pGCPriv->wrapFuncs = (pGC)->funcs;\
|
pGCPriv->wrapFuncs = (pGC)->funcs;\
|
||||||
(pGC)->funcs = &XineramaGCFuncs;
|
(pGC)->funcs = &XineramaGCFuncs;
|
||||||
|
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
XineramaCloseScreen(int i, ScreenPtr pScreen)
|
XineramaCloseScreen(int i, ScreenPtr pScreen)
|
||||||
{
|
{
|
||||||
|
|
@ -192,11 +193,8 @@ XineramaCreateGC(GCPtr pGC)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
XineramaValidateGC(
|
XineramaValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDraw)
|
||||||
GCPtr pGC,
|
{
|
||||||
unsigned long changes,
|
|
||||||
DrawablePtr pDraw
|
|
||||||
){
|
|
||||||
Xinerama_GC_FUNC_PROLOGUE(pGC);
|
Xinerama_GC_FUNC_PROLOGUE(pGC);
|
||||||
|
|
||||||
if ((pDraw->type == DRAWABLE_WINDOW) && !(((WindowPtr) pDraw)->parent)) {
|
if ((pDraw->type == DRAWABLE_WINDOW) && !(((WindowPtr) pDraw)->parent)) {
|
||||||
|
|
@ -225,7 +223,8 @@ XineramaValidateGC(
|
||||||
pGC->patOrg.y = new_val;
|
pGC->patOrg.y = new_val;
|
||||||
changes |= GCTileStipYOrigin;
|
changes |= GCTileStipYOrigin;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
if (pGC->clipOrg.x != pGCPriv->clipOrg.x) {
|
if (pGC->clipOrg.x != pGCPriv->clipOrg.x) {
|
||||||
pGC->clipOrg.x = pGCPriv->clipOrg.x;
|
pGC->clipOrg.x = pGCPriv->clipOrg.x;
|
||||||
changes |= GCClipXOrigin;
|
changes |= GCClipXOrigin;
|
||||||
|
|
@ -257,10 +256,8 @@ XineramaDestroyGC(GCPtr pGC)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
XineramaChangeGC (
|
XineramaChangeGC(GCPtr pGC, unsigned long mask)
|
||||||
GCPtr pGC,
|
{
|
||||||
unsigned long mask
|
|
||||||
){
|
|
||||||
Xinerama_GC_FUNC_PROLOGUE(pGC);
|
Xinerama_GC_FUNC_PROLOGUE(pGC);
|
||||||
|
|
||||||
if (mask & GCTileStipXOrigin)
|
if (mask & GCTileStipXOrigin)
|
||||||
|
|
@ -277,13 +274,11 @@ XineramaChangeGC (
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
XineramaCopyGC (
|
XineramaCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst)
|
||||||
GCPtr pGCSrc,
|
{
|
||||||
unsigned long mask,
|
|
||||||
GCPtr pGCDst
|
|
||||||
){
|
|
||||||
PanoramiXGCPtr pSrcPriv = (PanoramiXGCPtr)
|
PanoramiXGCPtr pSrcPriv = (PanoramiXGCPtr)
|
||||||
dixLookupPrivate(&pGCSrc->devPrivates, PanoramiXGCKey);
|
dixLookupPrivate(&pGCSrc->devPrivates, PanoramiXGCKey);
|
||||||
|
|
||||||
Xinerama_GC_FUNC_PROLOGUE(pGCDst);
|
Xinerama_GC_FUNC_PROLOGUE(pGCDst);
|
||||||
|
|
||||||
if (mask & GCTileStipXOrigin)
|
if (mask & GCTileStipXOrigin)
|
||||||
|
|
@ -300,12 +295,8 @@ XineramaCopyGC (
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
XineramaChangeClip (
|
XineramaChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects)
|
||||||
GCPtr pGC,
|
{
|
||||||
int type,
|
|
||||||
pointer pvalue,
|
|
||||||
int nrects
|
|
||||||
){
|
|
||||||
Xinerama_GC_FUNC_PROLOGUE(pGC);
|
Xinerama_GC_FUNC_PROLOGUE(pGC);
|
||||||
(*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects);
|
(*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects);
|
||||||
Xinerama_GC_FUNC_EPILOGUE(pGC);
|
Xinerama_GC_FUNC_EPILOGUE(pGC);
|
||||||
|
|
@ -388,7 +379,8 @@ XineramaRegisterConnectionBlockCallback(void (*func)(void))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void XineramaInitData(void)
|
static void
|
||||||
|
XineramaInitData(void)
|
||||||
{
|
{
|
||||||
int i, w, h;
|
int i, w, h;
|
||||||
|
|
||||||
|
|
@ -411,10 +403,12 @@ static void XineramaInitData(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
PanoramiXPixWidth = screenInfo.screens[0]->x + screenInfo.screens[0]->width;
|
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) {
|
FOR_NSCREENS_FORWARD_SKIP(i) {
|
||||||
ScreenPtr pScreen = screenInfo.screens[i];
|
ScreenPtr pScreen = screenInfo.screens[i];
|
||||||
|
|
||||||
w = pScreen->x + pScreen->width;
|
w = pScreen->x + pScreen->width;
|
||||||
h = pScreen->y + pScreen->height;
|
h = pScreen->y + pScreen->height;
|
||||||
|
|
||||||
|
|
@ -425,7 +419,8 @@ static void XineramaInitData(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void XineramaReinitData(void)
|
void
|
||||||
|
XineramaReinitData(void)
|
||||||
{
|
{
|
||||||
RegionUninit(&PanoramiXScreenRegion);
|
RegionUninit(&PanoramiXScreenRegion);
|
||||||
XineramaInitData();
|
XineramaInitData();
|
||||||
|
|
@ -438,7 +433,8 @@ void XineramaReinitData(void)
|
||||||
* Initialize global variables.
|
* Initialize global variables.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void PanoramiXExtensionInit(int argc, char *argv[])
|
void
|
||||||
|
PanoramiXExtensionInit(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
Bool success = FALSE;
|
Bool success = FALSE;
|
||||||
|
|
@ -454,7 +450,8 @@ void PanoramiXExtensionInit(int argc, char *argv[])
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dixRegisterPrivateKey(&PanoramiXGCKeyRec, PRIVATE_GC, sizeof(PanoramiXGCRec))) {
|
if (!dixRegisterPrivateKey
|
||||||
|
(&PanoramiXGCKeyRec, PRIVATE_GC, sizeof(PanoramiXGCRec))) {
|
||||||
noPanoramiXExtension = TRUE;
|
noPanoramiXExtension = TRUE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -504,8 +501,7 @@ void PanoramiXExtensionInit(int argc, char *argv[])
|
||||||
"XineramaPixmap");
|
"XineramaPixmap");
|
||||||
if (XRT_PIXMAP)
|
if (XRT_PIXMAP)
|
||||||
XRT_PIXMAP |= XRC_DRAWABLE;
|
XRT_PIXMAP |= XRC_DRAWABLE;
|
||||||
XRT_GC = CreateNewResourceType(XineramaDeleteResource,
|
XRT_GC = CreateNewResourceType(XineramaDeleteResource, "XineramaGC");
|
||||||
"XineramaGC");
|
|
||||||
XRT_COLORMAP = CreateNewResourceType(XineramaDeleteResource,
|
XRT_COLORMAP = CreateNewResourceType(XineramaDeleteResource,
|
||||||
"XineramaColormap");
|
"XineramaColormap");
|
||||||
|
|
||||||
|
|
@ -598,7 +594,8 @@ void PanoramiXExtensionInit(int argc, char *argv[])
|
||||||
|
|
||||||
extern Bool CreateConnectionBlock(void);
|
extern Bool CreateConnectionBlock(void);
|
||||||
|
|
||||||
Bool PanoramiXCreateConnectionBlock(void)
|
Bool
|
||||||
|
PanoramiXCreateConnectionBlock(void)
|
||||||
{
|
{
|
||||||
int i, j, length;
|
int i, j, length;
|
||||||
Bool disableBackingStore = FALSE;
|
Bool disableBackingStore = FALSE;
|
||||||
|
|
@ -625,7 +622,8 @@ Bool PanoramiXCreateConnectionBlock(void)
|
||||||
ErrorF("Xinerama error: Root window depths differ\n");
|
ErrorF("Xinerama error: Root window depths differ\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if(pScreen->backingStoreSupport != screenInfo.screens[0]->backingStoreSupport)
|
if (pScreen->backingStoreSupport !=
|
||||||
|
screenInfo.screens[0]->backingStoreSupport)
|
||||||
disableBackingStore = TRUE;
|
disableBackingStore = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -662,9 +660,7 @@ Bool PanoramiXCreateConnectionBlock(void)
|
||||||
visual->visualID = PanoramiXDepths[i].vids[j];
|
visual->visualID = PanoramiXDepths[i].vids[j];
|
||||||
|
|
||||||
for (pVisual = PanoramiXVisuals;
|
for (pVisual = PanoramiXVisuals;
|
||||||
pVisual->vid != visual->visualID;
|
pVisual->vid != visual->visualID; pVisual++);
|
||||||
pVisual++)
|
|
||||||
;
|
|
||||||
|
|
||||||
visual->class = pVisual->class;
|
visual->class = pVisual->class;
|
||||||
visual->bitsPerRGB = pVisual->bitsPerRGBValue;
|
visual->bitsPerRGB = pVisual->bitsPerRGBValue;
|
||||||
|
|
@ -838,6 +834,7 @@ PanoramiXConsolidate(void)
|
||||||
|
|
||||||
FOR_NSCREENS(i) {
|
FOR_NSCREENS(i) {
|
||||||
ScreenPtr pScreen = screenInfo.screens[i];
|
ScreenPtr pScreen = screenInfo.screens[i];
|
||||||
|
|
||||||
root->info[i].id = pScreen->root->drawable.id;
|
root->info[i].id = pScreen->root->drawable.id;
|
||||||
root->u.win.class = InputOutput;
|
root->u.win.class = InputOutput;
|
||||||
root->u.win.root = TRUE;
|
root->u.win.root = TRUE;
|
||||||
|
|
@ -884,13 +881,13 @@ PanoramiXTranslateVisualID(int screen, VisualID orig)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* PanoramiXResetProc()
|
* PanoramiXResetProc()
|
||||||
* Exit, deallocating as needed.
|
* Exit, deallocating as needed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void PanoramiXResetProc(ExtensionEntry* extEntry)
|
static void
|
||||||
|
PanoramiXResetProc(ExtensionEntry * extEntry)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
@ -903,7 +900,6 @@ static void PanoramiXResetProc(ExtensionEntry* extEntry)
|
||||||
ProcVector[i] = SavedProcVector[i];
|
ProcVector[i] = SavedProcVector[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
ProcPanoramiXQueryVersion(ClientPtr client)
|
ProcPanoramiXQueryVersion(ClientPtr client)
|
||||||
{
|
{
|
||||||
|
|
@ -1017,7 +1013,6 @@ ProcPanoramiXGetScreenSize(ClientPtr client)
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
ProcXineramaIsActive(ClientPtr client)
|
ProcXineramaIsActive(ClientPtr client)
|
||||||
{
|
{
|
||||||
|
|
@ -1047,7 +1042,6 @@ ProcXineramaIsActive(ClientPtr client)
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
ProcXineramaQueryScreens(ClientPtr client)
|
ProcXineramaQueryScreens(ClientPtr client)
|
||||||
{
|
{
|
||||||
|
|
@ -1090,12 +1084,11 @@ ProcXineramaQueryScreens(ClientPtr client)
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ProcPanoramiXDispatch(ClientPtr client)
|
ProcPanoramiXDispatch(ClientPtr client)
|
||||||
{ REQUEST(xReq);
|
|
||||||
switch (stuff->data)
|
|
||||||
{
|
{
|
||||||
|
REQUEST(xReq);
|
||||||
|
switch (stuff->data) {
|
||||||
case X_PanoramiXQueryVersion:
|
case X_PanoramiXQueryVersion:
|
||||||
return ProcPanoramiXQueryVersion(client);
|
return ProcPanoramiXQueryVersion(client);
|
||||||
case X_PanoramiXGetState:
|
case X_PanoramiXGetState:
|
||||||
|
|
@ -1112,7 +1105,6 @@ ProcPanoramiXDispatch (ClientPtr client)
|
||||||
return BadRequest;
|
return BadRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if X_BYTE_ORDER == X_LITTLE_ENDIAN
|
#if X_BYTE_ORDER == X_LITTLE_ENDIAN
|
||||||
#define SHIFT_L(v,s) (v) << (s)
|
#define SHIFT_L(v,s) (v) << (s)
|
||||||
#define SHIFT_R(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--) {
|
while (bytes--) {
|
||||||
*dst |= SHIFT_L(*src, shiftL);
|
*dst |= SHIFT_L(*src, shiftL);
|
||||||
*(dst + 1) |= SHIFT_R(*src, shiftR);
|
*(dst + 1) |= SHIFT_R(*src, shiftR);
|
||||||
dst++; src++;
|
dst++;
|
||||||
|
src++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Caution. This doesn't support 2 and 4 bpp formats. We expect
|
/* Caution. This doesn't support 2 and 4 bpp formats. We expect
|
||||||
1 bpp and planar data to be already cleared when presented
|
1 bpp and planar data to be already cleared when presented
|
||||||
to this function */
|
to this function */
|
||||||
|
|
||||||
void
|
void
|
||||||
XineramaGetImageData(
|
XineramaGetImageData(DrawablePtr *pDrawables,
|
||||||
DrawablePtr *pDrawables,
|
|
||||||
int left,
|
int left,
|
||||||
int top,
|
int top,
|
||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
unsigned int format,
|
unsigned int format,
|
||||||
unsigned long planemask,
|
unsigned long planemask,
|
||||||
char *data,
|
char *data, int pitch, Bool isRoot)
|
||||||
int pitch,
|
{
|
||||||
Bool isRoot
|
|
||||||
){
|
|
||||||
RegionRec SrcRegion, ScreenRegion, GrabRegion;
|
RegionRec SrcRegion, ScreenRegion, GrabRegion;
|
||||||
BoxRec SrcBox, *pbox;
|
BoxRec SrcBox, *pbox;
|
||||||
int x, y, w, h, i, j, nbox, size, sizeNeeded, ScratchPitch, inOut, depth;
|
int x, y, w, h, i, j, nbox, size, sizeNeeded, ScratchPitch, inOut, depth;
|
||||||
|
|
@ -1178,6 +1167,7 @@ XineramaGetImageData(
|
||||||
FOR_NSCREENS(i) {
|
FOR_NSCREENS(i) {
|
||||||
BoxRec TheBox;
|
BoxRec TheBox;
|
||||||
ScreenPtr pScreen;
|
ScreenPtr pScreen;
|
||||||
|
|
||||||
pDraw = pDrawables[i];
|
pDraw = pDrawables[i];
|
||||||
pScreen = pDraw->pScreen;
|
pScreen = pDraw->pScreen;
|
||||||
|
|
||||||
|
|
@ -1194,11 +1184,14 @@ XineramaGetImageData(
|
||||||
|
|
||||||
if (inOut == rgnIN) {
|
if (inOut == rgnIN) {
|
||||||
(*pScreen->GetImage) (pDraw,
|
(*pScreen->GetImage) (pDraw,
|
||||||
SrcBox.x1 - pDraw->x - screenInfo.screens[i]->x,
|
SrcBox.x1 - pDraw->x -
|
||||||
SrcBox.y1 - pDraw->y - screenInfo.screens[i]->y,
|
screenInfo.screens[i]->x,
|
||||||
width, height, format, planemask, data);
|
SrcBox.y1 - pDraw->y -
|
||||||
|
screenInfo.screens[i]->y, width, height,
|
||||||
|
format, planemask, data);
|
||||||
break;
|
break;
|
||||||
} else if (inOut == rgnOUT)
|
}
|
||||||
|
else if (inOut == rgnOUT)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
nbox = RegionNumRects(&GrabRegion);
|
nbox = RegionNumRects(&GrabRegion);
|
||||||
|
|
@ -1214,6 +1207,7 @@ XineramaGetImageData(
|
||||||
|
|
||||||
if (sizeNeeded > size) {
|
if (sizeNeeded > size) {
|
||||||
char *tmpdata = ScratchMem;
|
char *tmpdata = ScratchMem;
|
||||||
|
|
||||||
ScratchMem = realloc(ScratchMem, sizeNeeded);
|
ScratchMem = realloc(ScratchMem, sizeNeeded);
|
||||||
if (ScratchMem)
|
if (ScratchMem)
|
||||||
size = sizeNeeded;
|
size = sizeNeeded;
|
||||||
|
|
@ -1244,13 +1238,13 @@ XineramaGetImageData(
|
||||||
/* clean up the edge */
|
/* clean up the edge */
|
||||||
if (leftover) {
|
if (leftover) {
|
||||||
int mask = (1 << leftover) - 1;
|
int mask = (1 << leftover) - 1;
|
||||||
|
|
||||||
for (j = h, k = w; j--; k += ScratchPitch)
|
for (j = h, k = w; j--; k += ScratchPitch)
|
||||||
ScratchMem[k] &= mask;
|
ScratchMem[k] &= mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (j = 0, index = (pitch * y) + x, index2 = 0; j < h;
|
for (j = 0, index = (pitch * y) + x, index2 = 0; j < h;
|
||||||
j++, index += pitch, index2 += ScratchPitch)
|
j++, index += pitch, index2 += ScratchPitch) {
|
||||||
{
|
|
||||||
if (w) {
|
if (w) {
|
||||||
if (!shift)
|
if (!shift)
|
||||||
memcpy(data + index, ScratchMem + index2, w);
|
memcpy(data + index, ScratchMem + index2, w);
|
||||||
|
|
@ -1264,10 +1258,12 @@ XineramaGetImageData(
|
||||||
SHIFT_L(ScratchMem[index2 + w], shift);
|
SHIFT_L(ScratchMem[index2 + w], shift);
|
||||||
if ((shift + leftover) > 8)
|
if ((shift + leftover) > 8)
|
||||||
data[index + w + 1] |=
|
data[index + w + 1] |=
|
||||||
SHIFT_R(ScratchMem[index2 + w],(8 - shift));
|
SHIFT_R(ScratchMem[index2 + w],
|
||||||
|
(8 - shift));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
j = BitsPerPixel(depth) >> 3;
|
j = BitsPerPixel(depth) >> 3;
|
||||||
x = (pbox->x1 - SrcBox.x1) * j;
|
x = (pbox->x1 - SrcBox.x1) * j;
|
||||||
y = pbox->y1 - SrcBox.y1;
|
y = pbox->y1 - SrcBox.y1;
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,6 @@ Equipment Corporation.
|
||||||
|
|
||||||
******************************************************************/
|
******************************************************************/
|
||||||
|
|
||||||
|
|
||||||
/* THIS IS NOT AN X PROJECT TEAM SPECIFICATION */
|
/* THIS IS NOT AN X PROJECT TEAM SPECIFICATION */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,6 @@ SProcPanoramiXGetScreenSize(ClientPtr client)
|
||||||
return ProcPanoramiXGetScreenSize(client);
|
return ProcPanoramiXGetScreenSize(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
SProcXineramaIsActive(ClientPtr client)
|
SProcXineramaIsActive(ClientPtr client)
|
||||||
{
|
{
|
||||||
|
|
@ -102,7 +101,6 @@ SProcXineramaIsActive(ClientPtr client)
|
||||||
return ProcXineramaIsActive(client);
|
return ProcXineramaIsActive(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
SProcXineramaQueryScreens(ClientPtr client)
|
SProcXineramaQueryScreens(ClientPtr client)
|
||||||
{
|
{
|
||||||
|
|
@ -113,12 +111,11 @@ SProcXineramaQueryScreens(ClientPtr client)
|
||||||
return ProcXineramaQueryScreens(client);
|
return ProcXineramaQueryScreens(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
SProcPanoramiXDispatch(ClientPtr client)
|
SProcPanoramiXDispatch(ClientPtr client)
|
||||||
{ REQUEST(xReq);
|
|
||||||
switch (stuff->data)
|
|
||||||
{
|
{
|
||||||
|
REQUEST(xReq);
|
||||||
|
switch (stuff->data) {
|
||||||
case X_PanoramiXQueryVersion:
|
case X_PanoramiXQueryVersion:
|
||||||
return SProcPanoramiXQueryVersion(client);
|
return SProcPanoramiXQueryVersion(client);
|
||||||
case X_PanoramiXGetState:
|
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 void PanoramiXConsolidate(void);
|
||||||
extern _X_EXPORT Bool PanoramiXCreateConnectionBlock(void);
|
extern _X_EXPORT Bool PanoramiXCreateConnectionBlock(void);
|
||||||
extern _X_EXPORT PanoramiXRes *PanoramiXFindIDByScrnum(RESTYPE, XID, int);
|
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 int XineramaDeleteResource(pointer, XID);
|
||||||
|
|
||||||
extern _X_EXPORT void XineramaReinitData(void);
|
extern _X_EXPORT void XineramaReinitData(void);
|
||||||
|
|
@ -38,21 +39,17 @@ extern _X_EXPORT RESTYPE XRT_PICTURE;
|
||||||
typedef Bool (*XineramaVisualsEqualProcPtr) (VisualPtr, ScreenPtr, VisualPtr);
|
typedef Bool (*XineramaVisualsEqualProcPtr) (VisualPtr, ScreenPtr, VisualPtr);
|
||||||
extern _X_EXPORT XineramaVisualsEqualProcPtr XineramaVisualsEqualPtr;
|
extern _X_EXPORT XineramaVisualsEqualProcPtr XineramaVisualsEqualPtr;
|
||||||
|
|
||||||
extern _X_EXPORT void XineramaGetImageData(
|
extern _X_EXPORT void XineramaGetImageData(DrawablePtr *pDrawables,
|
||||||
DrawablePtr *pDrawables,
|
|
||||||
int left,
|
int left,
|
||||||
int top,
|
int top,
|
||||||
int width,
|
int width,
|
||||||
int height,
|
int height,
|
||||||
unsigned int format,
|
unsigned int format,
|
||||||
unsigned long planemask,
|
unsigned long planemask,
|
||||||
char *data,
|
char *data, int pitch, Bool isRoot);
|
||||||
int pitch,
|
|
||||||
Bool isRoot
|
|
||||||
);
|
|
||||||
|
|
||||||
static inline void panoramix_setup_ids(PanoramiXRes *resource,
|
static inline void
|
||||||
ClientPtr client, XID base_id)
|
panoramix_setup_ids(PanoramiXRes * resource, ClientPtr client, XID base_id)
|
||||||
{
|
{
|
||||||
int j;
|
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
|
* Author: Keith Packard, MIT X Consortium
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
#ifdef HAVE_DIX_CONFIG_H
|
||||||
#include <dix-config.h>
|
#include <dix-config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -62,35 +61,28 @@ in this Software without prior written authorization from the X Consortium.
|
||||||
|
|
||||||
static int ScreenSaverEventBase = 0;
|
static int ScreenSaverEventBase = 0;
|
||||||
|
|
||||||
|
static Bool ScreenSaverHandle(ScreenPtr /* pScreen */ ,
|
||||||
static Bool ScreenSaverHandle (
|
|
||||||
ScreenPtr /* pScreen */,
|
|
||||||
int /* xstate */ ,
|
int /* xstate */ ,
|
||||||
Bool /* force */
|
Bool /* force */
|
||||||
);
|
);
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
CreateSaverWindow (
|
CreateSaverWindow(ScreenPtr /* pScreen */
|
||||||
ScreenPtr /* pScreen */
|
|
||||||
);
|
);
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
DestroySaverWindow (
|
DestroySaverWindow(ScreenPtr /* pScreen */
|
||||||
ScreenPtr /* pScreen */
|
|
||||||
);
|
);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
UninstallSaverColormap (
|
UninstallSaverColormap(ScreenPtr /* pScreen */
|
||||||
ScreenPtr /* pScreen */
|
|
||||||
);
|
);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
CheckScreenPrivate (
|
CheckScreenPrivate(ScreenPtr /* pScreen */
|
||||||
ScreenPtr /* pScreen */
|
|
||||||
);
|
);
|
||||||
|
|
||||||
static void SScreenSaverNotifyEvent (
|
static void SScreenSaverNotifyEvent(xScreenSaverNotifyEvent * /* from */ ,
|
||||||
xScreenSaverNotifyEvent * /* from */,
|
|
||||||
xScreenSaverNotifyEvent * /* to */
|
xScreenSaverNotifyEvent * /* to */
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -107,16 +99,14 @@ static ScreenSaverSuspensionPtr suspendingClients = NULL;
|
||||||
* the client disconnects. count is the number of times the client has
|
* the client disconnects. count is the number of times the client has
|
||||||
* requested the screensaver be suspended.
|
* requested the screensaver be suspended.
|
||||||
*/
|
*/
|
||||||
typedef struct _ScreenSaverSuspension
|
typedef struct _ScreenSaverSuspension {
|
||||||
{
|
|
||||||
ScreenSaverSuspensionPtr next;
|
ScreenSaverSuspensionPtr next;
|
||||||
ClientPtr pClient;
|
ClientPtr pClient;
|
||||||
XID clientResource;
|
XID clientResource;
|
||||||
int count;
|
int count;
|
||||||
} ScreenSaverSuspensionRec;
|
} ScreenSaverSuspensionRec;
|
||||||
|
|
||||||
static int ScreenSaverFreeSuspend(
|
static int ScreenSaverFreeSuspend(pointer /*value */ ,
|
||||||
pointer /*value */,
|
|
||||||
XID /* id */
|
XID /* id */
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -140,19 +130,16 @@ typedef struct _ScreenSaverEvent {
|
||||||
CARD32 mask;
|
CARD32 mask;
|
||||||
} ScreenSaverEventRec;
|
} ScreenSaverEventRec;
|
||||||
|
|
||||||
static int ScreenSaverFreeEvents(
|
static int ScreenSaverFreeEvents(pointer /* value */ ,
|
||||||
pointer /* value */,
|
|
||||||
XID /* id */
|
XID /* id */
|
||||||
);
|
);
|
||||||
|
|
||||||
static Bool setEventMask (
|
static Bool setEventMask(ScreenPtr /* pScreen */ ,
|
||||||
ScreenPtr /* pScreen */,
|
|
||||||
ClientPtr /* client */ ,
|
ClientPtr /* client */ ,
|
||||||
unsigned long /* mask */
|
unsigned long /* mask */
|
||||||
);
|
);
|
||||||
|
|
||||||
static unsigned long getEventMask (
|
static unsigned long getEventMask(ScreenPtr /* pScreen */ ,
|
||||||
ScreenPtr /* pScreen */,
|
|
||||||
ClientPtr /* client */
|
ClientPtr /* client */
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -180,22 +167,18 @@ typedef struct _ScreenSaverAttr {
|
||||||
unsigned long *values;
|
unsigned long *values;
|
||||||
} ScreenSaverAttrRec, *ScreenSaverAttrPtr;
|
} ScreenSaverAttrRec, *ScreenSaverAttrPtr;
|
||||||
|
|
||||||
static int ScreenSaverFreeAttr (
|
static int ScreenSaverFreeAttr(pointer /* value */ ,
|
||||||
pointer /* value */,
|
|
||||||
XID /* id */
|
XID /* id */
|
||||||
);
|
);
|
||||||
|
|
||||||
static void FreeAttrs (
|
static void FreeAttrs(ScreenSaverAttrPtr /* pAttr */
|
||||||
ScreenSaverAttrPtr /* pAttr */
|
|
||||||
);
|
);
|
||||||
|
|
||||||
static void FreeScreenAttr (
|
static void FreeScreenAttr(ScreenSaverAttrPtr /* pAttr */
|
||||||
ScreenSaverAttrPtr /* pAttr */
|
|
||||||
);
|
);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
SendScreenSaverNotify (
|
SendScreenSaverNotify(ScreenPtr /* pScreen */ ,
|
||||||
ScreenPtr /* pScreen */,
|
|
||||||
int /* state */ ,
|
int /* state */ ,
|
||||||
Bool /* forced */
|
Bool /* forced */
|
||||||
);
|
);
|
||||||
|
|
@ -207,12 +190,11 @@ typedef struct _ScreenSaverScreenPrivate {
|
||||||
Colormap installedMap;
|
Colormap installedMap;
|
||||||
} ScreenSaverScreenPrivateRec, *ScreenSaverScreenPrivatePtr;
|
} ScreenSaverScreenPrivateRec, *ScreenSaverScreenPrivatePtr;
|
||||||
|
|
||||||
static ScreenSaverScreenPrivatePtr
|
static ScreenSaverScreenPrivatePtr MakeScreenPrivate(ScreenPtr /* pScreen */
|
||||||
MakeScreenPrivate (
|
|
||||||
ScreenPtr /* pScreen */
|
|
||||||
);
|
);
|
||||||
|
|
||||||
static DevPrivateKeyRec ScreenPrivateKeyRec;
|
static DevPrivateKeyRec ScreenPrivateKeyRec;
|
||||||
|
|
||||||
#define ScreenPrivateKey (&ScreenPrivateKeyRec)
|
#define ScreenPrivateKey (&ScreenPrivateKeyRec)
|
||||||
|
|
||||||
#define GetScreenPrivate(s) ((ScreenSaverScreenPrivatePtr) \
|
#define GetScreenPrivate(s) ((ScreenSaverScreenPrivatePtr) \
|
||||||
|
|
@ -231,8 +213,7 @@ CheckScreenPrivate (ScreenPtr pScreen)
|
||||||
if (!pPriv)
|
if (!pPriv)
|
||||||
return;
|
return;
|
||||||
if (!pPriv->attr && !pPriv->events &&
|
if (!pPriv->attr && !pPriv->events &&
|
||||||
!pPriv->hasWindow && pPriv->installedMap == None)
|
!pPriv->hasWindow && pPriv->installedMap == None) {
|
||||||
{
|
|
||||||
free(pPriv);
|
free(pPriv);
|
||||||
SetScreenPrivate(pScreen, NULL);
|
SetScreenPrivate(pScreen, NULL);
|
||||||
pScreen->screensaver.ExternalScreenSaver = NULL;
|
pScreen->screensaver.ExternalScreenSaver = NULL;
|
||||||
|
|
@ -280,8 +261,7 @@ setEventMask (ScreenPtr pScreen, ClientPtr client, unsigned long mask)
|
||||||
|
|
||||||
if (getEventMask(pScreen, client) == mask)
|
if (getEventMask(pScreen, client) == mask)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
if (!pPriv)
|
if (!pPriv) {
|
||||||
{
|
|
||||||
pPriv = MakeScreenPrivate(pScreen);
|
pPriv = MakeScreenPrivate(pScreen);
|
||||||
if (!pPriv)
|
if (!pPriv)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
@ -289,20 +269,16 @@ setEventMask (ScreenPtr pScreen, ClientPtr client, unsigned long mask)
|
||||||
for (pPrev = &pPriv->events; (pEv = *pPrev) != 0; pPrev = &pEv->next)
|
for (pPrev = &pPriv->events; (pEv = *pPrev) != 0; pPrev = &pEv->next)
|
||||||
if (pEv->client == client)
|
if (pEv->client == client)
|
||||||
break;
|
break;
|
||||||
if (mask == 0)
|
if (mask == 0) {
|
||||||
{
|
|
||||||
FreeResource(pEv->resource, SaverEventType);
|
FreeResource(pEv->resource, SaverEventType);
|
||||||
*pPrev = pEv->next;
|
*pPrev = pEv->next;
|
||||||
free(pEv);
|
free(pEv);
|
||||||
CheckScreenPrivate(pScreen);
|
CheckScreenPrivate(pScreen);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
if (!pEv) {
|
||||||
if (!pEv)
|
|
||||||
{
|
|
||||||
pEv = New(ScreenSaverEventRec);
|
pEv = New(ScreenSaverEventRec);
|
||||||
if (!pEv)
|
if (!pEv) {
|
||||||
{
|
|
||||||
CheckScreenPrivate(pScreen);
|
CheckScreenPrivate(pScreen);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
@ -346,6 +322,7 @@ ScreenSaverFreeEvents (pointer value, XID id)
|
||||||
{
|
{
|
||||||
ScreenSaverEventPtr pOld = (ScreenSaverEventPtr) value;
|
ScreenSaverEventPtr pOld = (ScreenSaverEventPtr) value;
|
||||||
ScreenPtr pScreen = pOld->screen;
|
ScreenPtr pScreen = pOld->screen;
|
||||||
|
|
||||||
SetupScreen(pScreen);
|
SetupScreen(pScreen);
|
||||||
ScreenSaverEventPtr pEv, *pPrev;
|
ScreenSaverEventPtr pEv, *pPrev;
|
||||||
|
|
||||||
|
|
@ -367,6 +344,7 @@ ScreenSaverFreeAttr (pointer value, XID id)
|
||||||
{
|
{
|
||||||
ScreenSaverAttrPtr pOldAttr = (ScreenSaverAttrPtr) value;
|
ScreenSaverAttrPtr pOldAttr = (ScreenSaverAttrPtr) value;
|
||||||
ScreenPtr pScreen = pOldAttr->screen;
|
ScreenPtr pScreen = pOldAttr->screen;
|
||||||
|
|
||||||
SetupScreen(pScreen);
|
SetupScreen(pScreen);
|
||||||
|
|
||||||
if (!pPriv)
|
if (!pPriv)
|
||||||
|
|
@ -375,8 +353,7 @@ ScreenSaverFreeAttr (pointer value, XID id)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
FreeScreenAttr(pOldAttr);
|
FreeScreenAttr(pOldAttr);
|
||||||
pPriv->attr = NULL;
|
pPriv->attr = NULL;
|
||||||
if (pPriv->hasWindow)
|
if (pPriv->hasWindow) {
|
||||||
{
|
|
||||||
dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
|
dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
|
||||||
dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverActive);
|
dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverActive);
|
||||||
}
|
}
|
||||||
|
|
@ -391,10 +368,8 @@ ScreenSaverFreeSuspend (pointer value, XID id)
|
||||||
ScreenSaverSuspensionPtr *prev, this;
|
ScreenSaverSuspensionPtr *prev, this;
|
||||||
|
|
||||||
/* Unlink and free the suspension record for the client */
|
/* Unlink and free the suspension record for the client */
|
||||||
for (prev = &suspendingClients; (this = *prev); prev = &this->next)
|
for (prev = &suspendingClients; (this = *prev); prev = &this->next) {
|
||||||
{
|
if (this == data) {
|
||||||
if (this == data)
|
|
||||||
{
|
|
||||||
*prev = this->next;
|
*prev = this->next;
|
||||||
free(this);
|
free(this);
|
||||||
break;
|
break;
|
||||||
|
|
@ -402,8 +377,7 @@ ScreenSaverFreeSuspend (pointer value, XID id)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reenable the screensaver if this was the last client suspending it. */
|
/* Reenable the screensaver if this was the last client suspending it. */
|
||||||
if (screenSaverSuspended && suspendingClients == NULL)
|
if (screenSaverSuspended && suspendingClients == NULL) {
|
||||||
{
|
|
||||||
screenSaverSuspended = FALSE;
|
screenSaverSuspended = FALSE;
|
||||||
|
|
||||||
/* The screensaver could be active, since suspending it (by design)
|
/* The screensaver could be active, since suspending it (by design)
|
||||||
|
|
@ -446,8 +420,7 @@ SendScreenSaverNotify (ScreenPtr pScreen, int state, Bool forced)
|
||||||
kind = ScreenSaverBlanked;
|
kind = ScreenSaverBlanked;
|
||||||
else
|
else
|
||||||
kind = ScreenSaverInternal;
|
kind = ScreenSaverInternal;
|
||||||
for (pEv = pPriv->events; pEv; pEv = pEv->next)
|
for (pEv = pPriv->events; pEv; pEv = pEv->next) {
|
||||||
{
|
|
||||||
if (!(pEv->mask & mask))
|
if (!(pEv->mask & mask))
|
||||||
continue;
|
continue;
|
||||||
ev.type = ScreenSaverNotify + ScreenSaverEventBase;
|
ev.type = ScreenSaverNotify + ScreenSaverEventBase;
|
||||||
|
|
@ -482,8 +455,7 @@ UninstallSaverColormap (ScreenPtr pScreen)
|
||||||
ColormapPtr pCmap;
|
ColormapPtr pCmap;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if (pPriv && pPriv->installedMap != None)
|
if (pPriv && pPriv->installedMap != None) {
|
||||||
{
|
|
||||||
rc = dixLookupResourceByType((pointer *) &pCmap, pPriv->installedMap,
|
rc = dixLookupResourceByType((pointer *) &pCmap, pPriv->installedMap,
|
||||||
RT_COLORMAP, serverClient,
|
RT_COLORMAP, serverClient,
|
||||||
DixUninstallAccess);
|
DixUninstallAccess);
|
||||||
|
|
@ -510,12 +482,10 @@ CreateSaverWindow (ScreenPtr pScreen)
|
||||||
ColormapPtr pCmap;
|
ColormapPtr pCmap;
|
||||||
|
|
||||||
pSaver = &pScreen->screensaver;
|
pSaver = &pScreen->screensaver;
|
||||||
if (pSaver->pWindow)
|
if (pSaver->pWindow) {
|
||||||
{
|
|
||||||
pSaver->pWindow = NullWindow;
|
pSaver->pWindow = NullWindow;
|
||||||
FreeResource(pSaver->wid, RT_NONE);
|
FreeResource(pSaver->wid, RT_NONE);
|
||||||
if (pPriv)
|
if (pPriv) {
|
||||||
{
|
|
||||||
UninstallSaverColormap(pScreen);
|
UninstallSaverColormap(pScreen);
|
||||||
pPriv->hasWindow = FALSE;
|
pPriv->hasWindow = FALSE;
|
||||||
CheckScreenPrivate(pScreen);
|
CheckScreenPrivate(pScreen);
|
||||||
|
|
@ -534,8 +504,7 @@ CreateSaverWindow (ScreenPtr pScreen)
|
||||||
pAttr->x, pAttr->y, pAttr->width, pAttr->height,
|
pAttr->x, pAttr->y, pAttr->width, pAttr->height,
|
||||||
pAttr->borderWidth, pAttr->class,
|
pAttr->borderWidth, pAttr->class,
|
||||||
pAttr->mask, (XID *) pAttr->values,
|
pAttr->mask, (XID *) pAttr->values,
|
||||||
pAttr->depth, serverClient, pAttr->visual,
|
pAttr->depth, serverClient, pAttr->visual, &result);
|
||||||
&result);
|
|
||||||
if (!pWin)
|
if (!pWin)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
|
@ -543,25 +512,21 @@ CreateSaverWindow (ScreenPtr pScreen)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
mask = 0;
|
mask = 0;
|
||||||
if (pAttr->pBackgroundPixmap)
|
if (pAttr->pBackgroundPixmap) {
|
||||||
{
|
|
||||||
pWin->backgroundState = BackgroundPixmap;
|
pWin->backgroundState = BackgroundPixmap;
|
||||||
pWin->background.pixmap = pAttr->pBackgroundPixmap;
|
pWin->background.pixmap = pAttr->pBackgroundPixmap;
|
||||||
pAttr->pBackgroundPixmap->refcnt++;
|
pAttr->pBackgroundPixmap->refcnt++;
|
||||||
mask |= CWBackPixmap;
|
mask |= CWBackPixmap;
|
||||||
}
|
}
|
||||||
if (pAttr->pBorderPixmap)
|
if (pAttr->pBorderPixmap) {
|
||||||
{
|
|
||||||
pWin->borderIsPixel = FALSE;
|
pWin->borderIsPixel = FALSE;
|
||||||
pWin->border.pixmap = pAttr->pBorderPixmap;
|
pWin->border.pixmap = pAttr->pBorderPixmap;
|
||||||
pAttr->pBorderPixmap->refcnt++;
|
pAttr->pBorderPixmap->refcnt++;
|
||||||
mask |= CWBorderPixmap;
|
mask |= CWBorderPixmap;
|
||||||
}
|
}
|
||||||
if (pAttr->pCursor)
|
if (pAttr->pCursor) {
|
||||||
{
|
|
||||||
if (!pWin->optional)
|
if (!pWin->optional)
|
||||||
if (!MakeWindowOptional (pWin))
|
if (!MakeWindowOptional(pWin)) {
|
||||||
{
|
|
||||||
FreeResource(pWin->drawable.id, RT_NONE);
|
FreeResource(pWin->drawable.id, RT_NONE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
@ -623,8 +588,7 @@ DestroySaverWindow (ScreenPtr pScreen)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
pSaver = &pScreen->screensaver;
|
pSaver = &pScreen->screensaver;
|
||||||
if (pSaver->pWindow)
|
if (pSaver->pWindow) {
|
||||||
{
|
|
||||||
pSaver->pWindow = NullWindow;
|
pSaver->pWindow = NullWindow;
|
||||||
FreeResource(pSaver->wid, RT_NONE);
|
FreeResource(pSaver->wid, RT_NONE);
|
||||||
}
|
}
|
||||||
|
|
@ -641,8 +605,7 @@ ScreenSaverHandle (ScreenPtr pScreen, int xstate, Bool force)
|
||||||
Bool ret = FALSE;
|
Bool ret = FALSE;
|
||||||
ScreenSaverScreenPrivatePtr pPriv;
|
ScreenSaverScreenPrivatePtr pPriv;
|
||||||
|
|
||||||
switch (xstate)
|
switch (xstate) {
|
||||||
{
|
|
||||||
case SCREEN_SAVER_ON:
|
case SCREEN_SAVER_ON:
|
||||||
state = ScreenSaverOn;
|
state = ScreenSaverOn;
|
||||||
ret = CreateSaverWindow(pScreen);
|
ret = CreateSaverWindow(pScreen);
|
||||||
|
|
@ -669,6 +632,7 @@ static int
|
||||||
ProcScreenSaverQueryVersion(ClientPtr client)
|
ProcScreenSaverQueryVersion(ClientPtr client)
|
||||||
{
|
{
|
||||||
xScreenSaverQueryVersionReply rep;
|
xScreenSaverQueryVersionReply rep;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xScreenSaverQueryVersionReq);
|
REQUEST_SIZE_MATCH(xScreenSaverQueryVersionReq);
|
||||||
rep.type = X_Reply;
|
rep.type = X_Reply;
|
||||||
rep.length = 0;
|
rep.length = 0;
|
||||||
|
|
@ -714,26 +678,22 @@ ProcScreenSaverQueryInfo (ClientPtr client)
|
||||||
rep.length = 0;
|
rep.length = 0;
|
||||||
rep.sequenceNumber = client->sequence;
|
rep.sequenceNumber = client->sequence;
|
||||||
rep.window = pSaver->wid;
|
rep.window = pSaver->wid;
|
||||||
if (screenIsSaved != SCREEN_SAVER_OFF)
|
if (screenIsSaved != SCREEN_SAVER_OFF) {
|
||||||
{
|
|
||||||
rep.state = ScreenSaverOn;
|
rep.state = ScreenSaverOn;
|
||||||
if (ScreenSaverTime)
|
if (ScreenSaverTime)
|
||||||
rep.tilOrSince = lastInput - ScreenSaverTime;
|
rep.tilOrSince = lastInput - ScreenSaverTime;
|
||||||
else
|
else
|
||||||
rep.tilOrSince = 0;
|
rep.tilOrSince = 0;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
if (ScreenSaverTime) {
|
||||||
if (ScreenSaverTime)
|
|
||||||
{
|
|
||||||
rep.state = ScreenSaverOff;
|
rep.state = ScreenSaverOff;
|
||||||
if (ScreenSaverTime < lastInput)
|
if (ScreenSaverTime < lastInput)
|
||||||
rep.tilOrSince = 0;
|
rep.tilOrSince = 0;
|
||||||
else
|
else
|
||||||
rep.tilOrSince = ScreenSaverTime - lastInput;
|
rep.tilOrSince = ScreenSaverTime - lastInput;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
rep.state = ScreenSaverDisabled;
|
rep.state = ScreenSaverDisabled;
|
||||||
rep.tilOrSince = 0;
|
rep.tilOrSince = 0;
|
||||||
}
|
}
|
||||||
|
|
@ -746,8 +706,7 @@ ProcScreenSaverQueryInfo (ClientPtr client)
|
||||||
rep.kind = ScreenSaverBlanked;
|
rep.kind = ScreenSaverBlanked;
|
||||||
else
|
else
|
||||||
rep.kind = ScreenSaverInternal;
|
rep.kind = ScreenSaverInternal;
|
||||||
if (client->swapped)
|
if (client->swapped) {
|
||||||
{
|
|
||||||
swaps(&rep.sequenceNumber);
|
swaps(&rep.sequenceNumber);
|
||||||
swapl(&rep.length);
|
swapl(&rep.length);
|
||||||
swapl(&rep.window);
|
swapl(&rep.window);
|
||||||
|
|
@ -823,13 +782,11 @@ ScreenSaverSetAttributes (ClientPtr client)
|
||||||
len = stuff->length - bytes_to_int32(sizeof(xScreenSaverSetAttributesReq));
|
len = stuff->length - bytes_to_int32(sizeof(xScreenSaverSetAttributesReq));
|
||||||
if (Ones(stuff->mask) != len)
|
if (Ones(stuff->mask) != len)
|
||||||
return BadLength;
|
return BadLength;
|
||||||
if (!stuff->width || !stuff->height)
|
if (!stuff->width || !stuff->height) {
|
||||||
{
|
|
||||||
client->errorValue = 0;
|
client->errorValue = 0;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
switch (class = stuff->c_class)
|
switch (class = stuff->c_class) {
|
||||||
{
|
|
||||||
case CopyFromParent:
|
case CopyFromParent:
|
||||||
case InputOnly:
|
case InputOnly:
|
||||||
case InputOutput:
|
case InputOutput:
|
||||||
|
|
@ -847,8 +804,7 @@ ScreenSaverSetAttributes (ClientPtr client)
|
||||||
if (class == CopyFromParent)
|
if (class == CopyFromParent)
|
||||||
class = pParent->drawable.class;
|
class = pParent->drawable.class;
|
||||||
|
|
||||||
if ((class != InputOutput) && (class != InputOnly))
|
if ((class != InputOutput) && (class != InputOnly)) {
|
||||||
{
|
|
||||||
client->errorValue = class;
|
client->errorValue = class;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
|
@ -868,18 +824,13 @@ ScreenSaverSetAttributes (ClientPtr client)
|
||||||
visual = ancwopt->visual;
|
visual = ancwopt->visual;
|
||||||
|
|
||||||
/* Find out if the depth and visual are acceptable for this Screen */
|
/* 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;
|
fOK = FALSE;
|
||||||
for(idepth = 0; idepth < pScreen->numDepths; idepth++)
|
for (idepth = 0; idepth < pScreen->numDepths; idepth++) {
|
||||||
{
|
|
||||||
pDepth = (DepthPtr) & pScreen->allowedDepths[idepth];
|
pDepth = (DepthPtr) & pScreen->allowedDepths[idepth];
|
||||||
if ((depth == pDepth->depth) || (depth == 0))
|
if ((depth == pDepth->depth) || (depth == 0)) {
|
||||||
{
|
for (ivisual = 0; ivisual < pDepth->numVids; ivisual++) {
|
||||||
for (ivisual = 0; ivisual < pDepth->numVids; ivisual++)
|
if (visual == pDepth->vids[ivisual]) {
|
||||||
{
|
|
||||||
if (visual == pDepth->vids[ivisual])
|
|
||||||
{
|
|
||||||
fOK = TRUE;
|
fOK = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -891,43 +842,36 @@ ScreenSaverSetAttributes (ClientPtr client)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((stuff->mask & (CWBorderPixmap | CWBorderPixel)) == 0) &&
|
if (((stuff->mask & (CWBorderPixmap | CWBorderPixel)) == 0) &&
|
||||||
(class != InputOnly) &&
|
(class != InputOnly) && (depth != pParent->drawable.depth)) {
|
||||||
(depth != pParent->drawable.depth))
|
|
||||||
{
|
|
||||||
return BadMatch;
|
return BadMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((stuff->mask & CWColormap) == 0) &&
|
if (((stuff->mask & CWColormap) == 0) &&
|
||||||
(class != InputOnly) &&
|
(class != InputOnly) &&
|
||||||
((visual != ancwopt->visual) || (ancwopt->colormap == None)))
|
((visual != ancwopt->visual) || (ancwopt->colormap == None))) {
|
||||||
{
|
|
||||||
return BadMatch;
|
return BadMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* end of errors from CreateWindow */
|
/* end of errors from CreateWindow */
|
||||||
|
|
||||||
pPriv = GetScreenPrivate(pScreen);
|
pPriv = GetScreenPrivate(pScreen);
|
||||||
if (pPriv && pPriv->attr)
|
if (pPriv && pPriv->attr) {
|
||||||
{
|
|
||||||
if (pPriv->attr->client != client)
|
if (pPriv->attr->client != client)
|
||||||
return BadAccess;
|
return BadAccess;
|
||||||
}
|
}
|
||||||
if (!pPriv)
|
if (!pPriv) {
|
||||||
{
|
|
||||||
pPriv = MakeScreenPrivate(pScreen);
|
pPriv = MakeScreenPrivate(pScreen);
|
||||||
if (!pPriv)
|
if (!pPriv)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
pAttr = New(ScreenSaverAttrRec);
|
pAttr = New(ScreenSaverAttrRec);
|
||||||
if (!pAttr)
|
if (!pAttr) {
|
||||||
{
|
|
||||||
ret = BadAlloc;
|
ret = BadAlloc;
|
||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
/* over allocate for override redirect */
|
/* over allocate for override redirect */
|
||||||
pAttr->values = values = malloc((len + 1) * sizeof(unsigned long));
|
pAttr->values = values = malloc((len + 1) * sizeof(unsigned long));
|
||||||
if (!values)
|
if (!values) {
|
||||||
{
|
|
||||||
ret = BadAlloc;
|
ret = BadAlloc;
|
||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
|
|
@ -955,32 +899,26 @@ ScreenSaverSetAttributes (ClientPtr client)
|
||||||
while (tmask) {
|
while (tmask) {
|
||||||
imask = lowbit(tmask);
|
imask = lowbit(tmask);
|
||||||
tmask &= ~imask;
|
tmask &= ~imask;
|
||||||
switch (imask)
|
switch (imask) {
|
||||||
{
|
|
||||||
case CWBackPixmap:
|
case CWBackPixmap:
|
||||||
pixID = (Pixmap) * pVlist;
|
pixID = (Pixmap) * pVlist;
|
||||||
if (pixID == None)
|
if (pixID == None) {
|
||||||
{
|
|
||||||
*values++ = None;
|
*values++ = None;
|
||||||
}
|
}
|
||||||
else if (pixID == ParentRelative)
|
else if (pixID == ParentRelative) {
|
||||||
{
|
if (depth != pParent->drawable.depth) {
|
||||||
if (depth != pParent->drawable.depth)
|
|
||||||
{
|
|
||||||
ret = BadMatch;
|
ret = BadMatch;
|
||||||
goto PatchUp;
|
goto PatchUp;
|
||||||
}
|
}
|
||||||
*values++ = ParentRelative;
|
*values++ = ParentRelative;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
ret =
|
||||||
ret = dixLookupResourceByType((pointer *)&pPixmap, pixID, RT_PIXMAP,
|
dixLookupResourceByType((pointer *) &pPixmap, pixID,
|
||||||
client, DixReadAccess);
|
RT_PIXMAP, client, DixReadAccess);
|
||||||
if (ret == Success)
|
if (ret == Success) {
|
||||||
{
|
|
||||||
if ((pPixmap->drawable.depth != depth) ||
|
if ((pPixmap->drawable.depth != depth) ||
|
||||||
(pPixmap->drawable.pScreen != pScreen))
|
(pPixmap->drawable.pScreen != pScreen)) {
|
||||||
{
|
|
||||||
ret = BadMatch;
|
ret = BadMatch;
|
||||||
goto PatchUp;
|
goto PatchUp;
|
||||||
}
|
}
|
||||||
|
|
@ -988,8 +926,7 @@ ScreenSaverSetAttributes (ClientPtr client)
|
||||||
pPixmap->refcnt++;
|
pPixmap->refcnt++;
|
||||||
pAttr->mask &= ~CWBackPixmap;
|
pAttr->mask &= ~CWBackPixmap;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
client->errorValue = pixID;
|
client->errorValue = pixID;
|
||||||
goto PatchUp;
|
goto PatchUp;
|
||||||
}
|
}
|
||||||
|
|
@ -1000,24 +937,20 @@ ScreenSaverSetAttributes (ClientPtr client)
|
||||||
break;
|
break;
|
||||||
case CWBorderPixmap:
|
case CWBorderPixmap:
|
||||||
pixID = (Pixmap) * pVlist;
|
pixID = (Pixmap) * pVlist;
|
||||||
if (pixID == CopyFromParent)
|
if (pixID == CopyFromParent) {
|
||||||
{
|
if (depth != pParent->drawable.depth) {
|
||||||
if (depth != pParent->drawable.depth)
|
|
||||||
{
|
|
||||||
ret = BadMatch;
|
ret = BadMatch;
|
||||||
goto PatchUp;
|
goto PatchUp;
|
||||||
}
|
}
|
||||||
*values++ = CopyFromParent;
|
*values++ = CopyFromParent;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
ret =
|
||||||
ret = dixLookupResourceByType((pointer *)&pPixmap, pixID, RT_PIXMAP,
|
dixLookupResourceByType((pointer *) &pPixmap, pixID,
|
||||||
client, DixReadAccess);
|
RT_PIXMAP, client, DixReadAccess);
|
||||||
if (ret == Success)
|
if (ret == Success) {
|
||||||
{
|
|
||||||
if ((pPixmap->drawable.depth != depth) ||
|
if ((pPixmap->drawable.depth != depth) ||
|
||||||
(pPixmap->drawable.pScreen != pScreen))
|
(pPixmap->drawable.pScreen != pScreen)) {
|
||||||
{
|
|
||||||
ret = BadMatch;
|
ret = BadMatch;
|
||||||
goto PatchUp;
|
goto PatchUp;
|
||||||
}
|
}
|
||||||
|
|
@ -1025,8 +958,7 @@ ScreenSaverSetAttributes (ClientPtr client)
|
||||||
pPixmap->refcnt++;
|
pPixmap->refcnt++;
|
||||||
pAttr->mask &= ~CWBorderPixmap;
|
pAttr->mask &= ~CWBorderPixmap;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
client->errorValue = pixID;
|
client->errorValue = pixID;
|
||||||
goto PatchUp;
|
goto PatchUp;
|
||||||
}
|
}
|
||||||
|
|
@ -1037,8 +969,7 @@ ScreenSaverSetAttributes (ClientPtr client)
|
||||||
break;
|
break;
|
||||||
case CWBitGravity:
|
case CWBitGravity:
|
||||||
val = (CARD8) *pVlist;
|
val = (CARD8) *pVlist;
|
||||||
if (val > StaticGravity)
|
if (val > StaticGravity) {
|
||||||
{
|
|
||||||
ret = BadValue;
|
ret = BadValue;
|
||||||
client->errorValue = val;
|
client->errorValue = val;
|
||||||
goto PatchUp;
|
goto PatchUp;
|
||||||
|
|
@ -1047,8 +978,7 @@ ScreenSaverSetAttributes (ClientPtr client)
|
||||||
break;
|
break;
|
||||||
case CWWinGravity:
|
case CWWinGravity:
|
||||||
val = (CARD8) *pVlist;
|
val = (CARD8) *pVlist;
|
||||||
if (val > StaticGravity)
|
if (val > StaticGravity) {
|
||||||
{
|
|
||||||
ret = BadValue;
|
ret = BadValue;
|
||||||
client->errorValue = val;
|
client->errorValue = val;
|
||||||
goto PatchUp;
|
goto PatchUp;
|
||||||
|
|
@ -1057,8 +987,7 @@ ScreenSaverSetAttributes (ClientPtr client)
|
||||||
break;
|
break;
|
||||||
case CWBackingStore:
|
case CWBackingStore:
|
||||||
val = (CARD8) *pVlist;
|
val = (CARD8) *pVlist;
|
||||||
if ((val != NotUseful) && (val != WhenMapped) && (val != Always))
|
if ((val != NotUseful) && (val != WhenMapped) && (val != Always)) {
|
||||||
{
|
|
||||||
ret = BadValue;
|
ret = BadValue;
|
||||||
client->errorValue = val;
|
client->errorValue = val;
|
||||||
goto PatchUp;
|
goto PatchUp;
|
||||||
|
|
@ -1073,8 +1002,7 @@ ScreenSaverSetAttributes (ClientPtr client)
|
||||||
break;
|
break;
|
||||||
case CWSaveUnder:
|
case CWSaveUnder:
|
||||||
val = (BOOL) * pVlist;
|
val = (BOOL) * pVlist;
|
||||||
if ((val != xTrue) && (val != xFalse))
|
if ((val != xTrue) && (val != xFalse)) {
|
||||||
{
|
|
||||||
ret = BadValue;
|
ret = BadValue;
|
||||||
client->errorValue = val;
|
client->errorValue = val;
|
||||||
goto PatchUp;
|
goto PatchUp;
|
||||||
|
|
@ -1090,11 +1018,9 @@ ScreenSaverSetAttributes (ClientPtr client)
|
||||||
case CWOverrideRedirect:
|
case CWOverrideRedirect:
|
||||||
if (!(stuff->mask & CWOverrideRedirect))
|
if (!(stuff->mask & CWOverrideRedirect))
|
||||||
pVlist--;
|
pVlist--;
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
val = (BOOL) * pVlist;
|
val = (BOOL) * pVlist;
|
||||||
if ((val != xTrue) && (val != xFalse))
|
if ((val != xTrue) && (val != xFalse)) {
|
||||||
{
|
|
||||||
ret = BadValue;
|
ret = BadValue;
|
||||||
client->errorValue = val;
|
client->errorValue = val;
|
||||||
goto PatchUp;
|
goto PatchUp;
|
||||||
|
|
@ -1106,13 +1032,11 @@ ScreenSaverSetAttributes (ClientPtr client)
|
||||||
cmap = (Colormap) * pVlist;
|
cmap = (Colormap) * pVlist;
|
||||||
ret = dixLookupResourceByType((pointer *) &pCmap, cmap, RT_COLORMAP,
|
ret = dixLookupResourceByType((pointer *) &pCmap, cmap, RT_COLORMAP,
|
||||||
client, DixUseAccess);
|
client, DixUseAccess);
|
||||||
if (ret != Success)
|
if (ret != Success) {
|
||||||
{
|
|
||||||
client->errorValue = cmap;
|
client->errorValue = cmap;
|
||||||
goto PatchUp;
|
goto PatchUp;
|
||||||
}
|
}
|
||||||
if (pCmap->pVisual->vid != visual || pCmap->pScreen != pScreen)
|
if (pCmap->pVisual->vid != visual || pCmap->pScreen != pScreen) {
|
||||||
{
|
|
||||||
ret = BadMatch;
|
ret = BadMatch;
|
||||||
goto PatchUp;
|
goto PatchUp;
|
||||||
}
|
}
|
||||||
|
|
@ -1121,16 +1045,13 @@ ScreenSaverSetAttributes (ClientPtr client)
|
||||||
break;
|
break;
|
||||||
case CWCursor:
|
case CWCursor:
|
||||||
cursorID = (Cursor) * pVlist;
|
cursorID = (Cursor) * pVlist;
|
||||||
if ( cursorID == None)
|
if (cursorID == None) {
|
||||||
{
|
|
||||||
*values++ = None;
|
*values++ = None;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
ret = dixLookupResourceByType((pointer *) &pCursor, cursorID,
|
ret = dixLookupResourceByType((pointer *) &pCursor, cursorID,
|
||||||
RT_CURSOR, client, DixUseAccess);
|
RT_CURSOR, client, DixUseAccess);
|
||||||
if (ret != Success)
|
if (ret != Success) {
|
||||||
{
|
|
||||||
client->errorValue = cursorID;
|
client->errorValue = cursorID;
|
||||||
goto PatchUp;
|
goto PatchUp;
|
||||||
}
|
}
|
||||||
|
|
@ -1157,7 +1078,8 @@ PatchUp:
|
||||||
FreeAttrs(pAttr);
|
FreeAttrs(pAttr);
|
||||||
bail:
|
bail:
|
||||||
CheckScreenPrivate(pScreen);
|
CheckScreenPrivate(pScreen);
|
||||||
if (pAttr) free(pAttr->values);
|
if (pAttr)
|
||||||
|
free(pAttr->values);
|
||||||
free(pAttr);
|
free(pAttr);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
@ -1176,8 +1098,7 @@ ScreenSaverUnsetAttributes (ClientPtr client)
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
pPriv = GetScreenPrivate(pDraw->pScreen);
|
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);
|
FreeResource(pPriv->attr->resource, AttrType);
|
||||||
FreeScreenAttr(pPriv->attr);
|
FreeScreenAttr(pPriv->attr);
|
||||||
pPriv->attr = NULL;
|
pPriv->attr = NULL;
|
||||||
|
|
@ -1207,7 +1128,9 @@ ProcScreenSaverSetAttributes (ClientPtr client)
|
||||||
if (status != Success)
|
if (status != Success)
|
||||||
return (status == BadValue) ? BadDrawable : status;
|
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)
|
if (Ones(stuff->mask) != len)
|
||||||
return BadLength;
|
return BadLength;
|
||||||
|
|
||||||
|
|
@ -1310,8 +1233,7 @@ ProcScreenSaverSuspend (ClientPtr client)
|
||||||
if (this->pClient == client)
|
if (this->pClient == client)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (this)
|
if (this) {
|
||||||
{
|
|
||||||
if (stuff->suspend == TRUE)
|
if (stuff->suspend == TRUE)
|
||||||
this->count++;
|
this->count++;
|
||||||
else if (--this->count == 0)
|
else if (--this->count == 0)
|
||||||
|
|
@ -1340,15 +1262,13 @@ ProcScreenSaverSuspend (ClientPtr client)
|
||||||
this->count = 1;
|
this->count = 1;
|
||||||
this->clientResource = FakeClientID(client->index);
|
this->clientResource = FakeClientID(client->index);
|
||||||
|
|
||||||
if (!AddResource (this->clientResource, SuspendType, (pointer) this))
|
if (!AddResource(this->clientResource, SuspendType, (pointer) this)) {
|
||||||
{
|
|
||||||
free(this);
|
free(this);
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
|
|
||||||
*prev = this;
|
*prev = this;
|
||||||
if (!screenSaverSuspended)
|
if (!screenSaverSuspended) {
|
||||||
{
|
|
||||||
screenSaverSuspended = TRUE;
|
screenSaverSuspended = TRUE;
|
||||||
FreeScreenSaverTimer();
|
FreeScreenSaverTimer();
|
||||||
}
|
}
|
||||||
|
|
@ -1361,9 +1281,7 @@ static int (*NormalVector[]) (ClientPtr /* client */) = {
|
||||||
ProcScreenSaverQueryInfo,
|
ProcScreenSaverQueryInfo,
|
||||||
ProcScreenSaverSelectInput,
|
ProcScreenSaverSelectInput,
|
||||||
ProcScreenSaverSetAttributes,
|
ProcScreenSaverSetAttributes,
|
||||||
ProcScreenSaverUnsetAttributes,
|
ProcScreenSaverUnsetAttributes, ProcScreenSaverSuspend,};
|
||||||
ProcScreenSaverSuspend,
|
|
||||||
};
|
|
||||||
|
|
||||||
#define NUM_REQUESTS ((sizeof NormalVector) / (sizeof NormalVector[0]))
|
#define NUM_REQUESTS ((sizeof NormalVector) / (sizeof NormalVector[0]))
|
||||||
|
|
||||||
|
|
@ -1450,9 +1368,7 @@ static int (*SwappedVector[]) (ClientPtr /* client */) = {
|
||||||
SProcScreenSaverQueryInfo,
|
SProcScreenSaverQueryInfo,
|
||||||
SProcScreenSaverSelectInput,
|
SProcScreenSaverSelectInput,
|
||||||
SProcScreenSaverSetAttributes,
|
SProcScreenSaverSetAttributes,
|
||||||
SProcScreenSaverUnsetAttributes,
|
SProcScreenSaverUnsetAttributes, SProcScreenSaverSuspend,};
|
||||||
SProcScreenSaverSuspend,
|
|
||||||
};
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
SProcScreenSaverDispatch(ClientPtr client)
|
SProcScreenSaverDispatch(ClientPtr client)
|
||||||
|
|
@ -1475,22 +1391,20 @@ ScreenSaverExtensionInit(INITARGS)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
AttrType = CreateNewResourceType(ScreenSaverFreeAttr, "SaverAttr");
|
AttrType = CreateNewResourceType(ScreenSaverFreeAttr, "SaverAttr");
|
||||||
SaverEventType = CreateNewResourceType(ScreenSaverFreeEvents,
|
SaverEventType = CreateNewResourceType(ScreenSaverFreeEvents, "SaverEvent");
|
||||||
"SaverEvent");
|
SuspendType = CreateNewResourceType(ScreenSaverFreeSuspend, "SaverSuspend");
|
||||||
SuspendType = CreateNewResourceType(ScreenSaverFreeSuspend,
|
|
||||||
"SaverSuspend");
|
|
||||||
|
|
||||||
for (i = 0; i < screenInfo.numScreens; i++)
|
for (i = 0; i < screenInfo.numScreens; i++) {
|
||||||
{
|
|
||||||
pScreen = screenInfo.screens[i];
|
pScreen = screenInfo.screens[i];
|
||||||
SetScreenPrivate(pScreen, NULL);
|
SetScreenPrivate(pScreen, NULL);
|
||||||
}
|
}
|
||||||
if (AttrType && SaverEventType && SuspendType &&
|
if (AttrType && SaverEventType && SuspendType &&
|
||||||
(extEntry = AddExtension(ScreenSaverName, ScreenSaverNumberEvents, 0,
|
(extEntry = AddExtension(ScreenSaverName, ScreenSaverNumberEvents, 0,
|
||||||
ProcScreenSaverDispatch, SProcScreenSaverDispatch,
|
ProcScreenSaverDispatch,
|
||||||
NULL, StandardMinorOpcode)))
|
SProcScreenSaverDispatch, NULL,
|
||||||
{
|
StandardMinorOpcode))) {
|
||||||
ScreenSaverEventBase = extEntry->eventBase;
|
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 */
|
/* Private state record */
|
||||||
static DevPrivateKeyRec stateKeyRec;
|
static DevPrivateKeyRec stateKeyRec;
|
||||||
|
|
||||||
#define stateKey (&stateKeyRec)
|
#define stateKey (&stateKeyRec)
|
||||||
|
|
||||||
/* This is what we store as client security state */
|
/* 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 SecurityServerMask = DixGetAttrAccess | DixGrabAccess;
|
||||||
static const Mask SecurityClientMask = DixGetAttrAccess;
|
static const Mask SecurityClientMask = DixGetAttrAccess;
|
||||||
|
|
||||||
|
|
||||||
/* SecurityAudit
|
/* SecurityAudit
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
|
|
@ -97,7 +97,8 @@ static const Mask SecurityClientMask = DixGetAttrAccess;
|
||||||
* Writes the message to the log file if security logging is on.
|
* 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, ...)
|
SecurityAudit(const char *format, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
@ -151,7 +152,6 @@ SecurityLookupRequestName(ClientPtr client)
|
||||||
return LookupRequestName(client->majorOp, client->minorOp);
|
return LookupRequestName(client->majorOp, client->minorOp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* SecurityDeleteAuthorization
|
/* SecurityDeleteAuthorization
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
|
|
@ -165,9 +165,7 @@ SecurityLookupRequestName(ClientPtr client)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int
|
static int
|
||||||
SecurityDeleteAuthorization(
|
SecurityDeleteAuthorization(pointer value, XID id)
|
||||||
pointer value,
|
|
||||||
XID id)
|
|
||||||
{
|
{
|
||||||
SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr) value;
|
SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr) value;
|
||||||
unsigned short name_len, data_len;
|
unsigned short name_len, data_len;
|
||||||
|
|
@ -179,8 +177,7 @@ SecurityDeleteAuthorization(
|
||||||
|
|
||||||
/* Remove the auth using the os layer auth manager */
|
/* Remove the auth using the os layer auth manager */
|
||||||
|
|
||||||
status = AuthorizationFromID(pAuth->id, &name_len, &name,
|
status = AuthorizationFromID(pAuth->id, &name_len, &name, &data_len, &data);
|
||||||
&data_len, &data);
|
|
||||||
assert(status);
|
assert(status);
|
||||||
status = RemoveAuthorization(name_len, name, data_len, data);
|
status = RemoveAuthorization(name_len, name, data_len, data);
|
||||||
assert(status);
|
assert(status);
|
||||||
|
|
@ -188,14 +185,15 @@ SecurityDeleteAuthorization(
|
||||||
|
|
||||||
/* free the auth timer if there is one */
|
/* free the auth timer if there is one */
|
||||||
|
|
||||||
if (pAuth->timer) TimerFree(pAuth->timer);
|
if (pAuth->timer)
|
||||||
|
TimerFree(pAuth->timer);
|
||||||
|
|
||||||
/* send revoke events */
|
/* send revoke events */
|
||||||
|
|
||||||
while ((pEventClient = pAuth->eventClients))
|
while ((pEventClient = pAuth->eventClients)) {
|
||||||
{
|
|
||||||
/* send revocation event event */
|
/* send revocation event event */
|
||||||
xSecurityAuthorizationRevokedEvent are;
|
xSecurityAuthorizationRevokedEvent are;
|
||||||
|
|
||||||
are.type = SecurityEventBase + XSecurityAuthorizationRevoked;
|
are.type = SecurityEventBase + XSecurityAuthorizationRevoked;
|
||||||
are.authId = pAuth->id;
|
are.authId = pAuth->id;
|
||||||
WriteEventsToClient(rClient(pEventClient), 1, (xEvent *) &are);
|
WriteEventsToClient(rClient(pEventClient), 1, (xEvent *) &are);
|
||||||
|
|
@ -207,6 +205,7 @@ SecurityDeleteAuthorization(
|
||||||
for (i = 1; i < currentMaxClients; i++)
|
for (i = 1; i < currentMaxClients; i++)
|
||||||
if (clients[i]) {
|
if (clients[i]) {
|
||||||
SecurityStateRec *state;
|
SecurityStateRec *state;
|
||||||
|
|
||||||
state = dixLookupPrivate(&clients[i]->devPrivates, stateKey);
|
state = dixLookupPrivate(&clients[i]->devPrivates, stateKey);
|
||||||
if (state->haveState && state->authId == pAuth->id)
|
if (state->haveState && state->authId == pAuth->id)
|
||||||
CloseDownClient(clients[i]);
|
CloseDownClient(clients[i]);
|
||||||
|
|
@ -218,22 +217,16 @@ SecurityDeleteAuthorization(
|
||||||
|
|
||||||
} /* SecurityDeleteAuthorization */
|
} /* SecurityDeleteAuthorization */
|
||||||
|
|
||||||
|
|
||||||
/* resource delete function for RTEventClient */
|
/* resource delete function for RTEventClient */
|
||||||
static int
|
static int
|
||||||
SecurityDeleteAuthorizationEventClient(
|
SecurityDeleteAuthorizationEventClient(pointer value, XID id)
|
||||||
pointer value,
|
|
||||||
XID id)
|
|
||||||
{
|
{
|
||||||
OtherClientsPtr pEventClient, prev = NULL;
|
OtherClientsPtr pEventClient, prev = NULL;
|
||||||
SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr) value;
|
SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr) value;
|
||||||
|
|
||||||
for (pEventClient = pAuth->eventClients;
|
for (pEventClient = pAuth->eventClients;
|
||||||
pEventClient;
|
pEventClient; pEventClient = pEventClient->next) {
|
||||||
pEventClient = pEventClient->next)
|
if (pEventClient->resource == id) {
|
||||||
{
|
|
||||||
if (pEventClient->resource == id)
|
|
||||||
{
|
|
||||||
if (prev)
|
if (prev)
|
||||||
prev->next = pEventClient->next;
|
prev->next = pEventClient->next;
|
||||||
else
|
else
|
||||||
|
|
@ -243,11 +236,9 @@ SecurityDeleteAuthorizationEventClient(
|
||||||
}
|
}
|
||||||
prev = pEventClient;
|
prev = pEventClient;
|
||||||
}
|
}
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/ return -1; /* make compiler happy */
|
||||||
return -1; /* make compiler happy */
|
|
||||||
} /* SecurityDeleteAuthorizationEventClient */
|
} /* SecurityDeleteAuthorizationEventClient */
|
||||||
|
|
||||||
|
|
||||||
/* SecurityComputeAuthorizationTimeout
|
/* SecurityComputeAuthorizationTimeout
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
|
|
@ -263,8 +254,7 @@ SecurityDeleteAuthorizationEventClient(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static CARD32
|
static CARD32
|
||||||
SecurityComputeAuthorizationTimeout(
|
SecurityComputeAuthorizationTimeout(SecurityAuthorizationPtr pAuth,
|
||||||
SecurityAuthorizationPtr pAuth,
|
|
||||||
unsigned int seconds)
|
unsigned int seconds)
|
||||||
{
|
{
|
||||||
/* maxSecs is the number of full seconds that can be expressed in
|
/* 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;
|
CARD32 maxSecs = (CARD32) (~0) / (CARD32) MILLI_PER_SECOND;
|
||||||
|
|
||||||
if (seconds > maxSecs)
|
if (seconds > maxSecs) { /* only come here if we want to wait more than 49 days */
|
||||||
{ /* only come here if we want to wait more than 49 days */
|
|
||||||
pAuth->secondsRemaining = seconds - maxSecs;
|
pAuth->secondsRemaining = seconds - maxSecs;
|
||||||
return maxSecs * MILLI_PER_SECOND;
|
return maxSecs * MILLI_PER_SECOND;
|
||||||
}
|
}
|
||||||
else
|
else { /* by far the common case */
|
||||||
{ /* by far the common case */
|
|
||||||
pAuth->secondsRemaining = 0;
|
pAuth->secondsRemaining = 0;
|
||||||
return seconds * MILLI_PER_SECOND;
|
return seconds * MILLI_PER_SECOND;
|
||||||
}
|
}
|
||||||
|
|
@ -304,22 +292,17 @@ SecurityComputeAuthorizationTimeout(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static CARD32
|
static CARD32
|
||||||
SecurityAuthorizationExpired(
|
SecurityAuthorizationExpired(OsTimerPtr timer, CARD32 time, pointer pval)
|
||||||
OsTimerPtr timer,
|
|
||||||
CARD32 time,
|
|
||||||
pointer pval)
|
|
||||||
{
|
{
|
||||||
SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr) pval;
|
SecurityAuthorizationPtr pAuth = (SecurityAuthorizationPtr) pval;
|
||||||
|
|
||||||
assert(pAuth->timer == timer);
|
assert(pAuth->timer == timer);
|
||||||
|
|
||||||
if (pAuth->secondsRemaining)
|
if (pAuth->secondsRemaining) {
|
||||||
{
|
|
||||||
return SecurityComputeAuthorizationTimeout(pAuth,
|
return SecurityComputeAuthorizationTimeout(pAuth,
|
||||||
pAuth->secondsRemaining);
|
pAuth->secondsRemaining);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
FreeResource(pAuth->id, RT_NONE);
|
FreeResource(pAuth->id, RT_NONE);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -339,22 +322,20 @@ SecurityAuthorizationExpired(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
SecurityStartAuthorizationTimer(
|
SecurityStartAuthorizationTimer(SecurityAuthorizationPtr pAuth)
|
||||||
SecurityAuthorizationPtr pAuth)
|
|
||||||
{
|
{
|
||||||
pAuth->timer = TimerSet(pAuth->timer, 0,
|
pAuth->timer = TimerSet(pAuth->timer, 0,
|
||||||
SecurityComputeAuthorizationTimeout(pAuth, pAuth->timeout),
|
SecurityComputeAuthorizationTimeout(pAuth,
|
||||||
|
pAuth->timeout),
|
||||||
SecurityAuthorizationExpired, pAuth);
|
SecurityAuthorizationExpired, pAuth);
|
||||||
} /* SecurityStartAuthorizationTimer */
|
} /* SecurityStartAuthorizationTimer */
|
||||||
|
|
||||||
|
|
||||||
/* Proc functions all take a client argument, execute the request in
|
/* Proc functions all take a client argument, execute the request in
|
||||||
* client->requestBuffer, and return a protocol error status.
|
* client->requestBuffer, and return a protocol error status.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ProcSecurityQueryVersion(
|
ProcSecurityQueryVersion(ClientPtr client)
|
||||||
ClientPtr client)
|
|
||||||
{
|
{
|
||||||
/* REQUEST(xSecurityQueryVersionReq); */
|
/* REQUEST(xSecurityQueryVersionReq); */
|
||||||
xSecurityQueryVersionReply rep;
|
xSecurityQueryVersionReply rep;
|
||||||
|
|
@ -365,8 +346,7 @@ ProcSecurityQueryVersion(
|
||||||
rep.length = 0;
|
rep.length = 0;
|
||||||
rep.majorVersion = SERVER_SECURITY_MAJOR_VERSION;
|
rep.majorVersion = SERVER_SECURITY_MAJOR_VERSION;
|
||||||
rep.minorVersion = SERVER_SECURITY_MINOR_VERSION;
|
rep.minorVersion = SERVER_SECURITY_MINOR_VERSION;
|
||||||
if(client->swapped)
|
if (client->swapped) {
|
||||||
{
|
|
||||||
swaps(&rep.sequenceNumber);
|
swaps(&rep.sequenceNumber);
|
||||||
swaps(&rep.majorVersion);
|
swaps(&rep.majorVersion);
|
||||||
swaps(&rep.minorVersion);
|
swaps(&rep.minorVersion);
|
||||||
|
|
@ -376,21 +356,15 @@ ProcSecurityQueryVersion(
|
||||||
return Success;
|
return Success;
|
||||||
} /* ProcSecurityQueryVersion */
|
} /* ProcSecurityQueryVersion */
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
SecurityEventSelectForAuthorization(
|
SecurityEventSelectForAuthorization(SecurityAuthorizationPtr pAuth,
|
||||||
SecurityAuthorizationPtr pAuth,
|
ClientPtr client, Mask mask)
|
||||||
ClientPtr client,
|
|
||||||
Mask mask)
|
|
||||||
{
|
{
|
||||||
OtherClients *pEventClient;
|
OtherClients *pEventClient;
|
||||||
|
|
||||||
for (pEventClient = pAuth->eventClients;
|
for (pEventClient = pAuth->eventClients;
|
||||||
pEventClient;
|
pEventClient; pEventClient = pEventClient->next) {
|
||||||
pEventClient = pEventClient->next)
|
if (SameClient(pEventClient, client)) {
|
||||||
{
|
|
||||||
if (SameClient(pEventClient, client))
|
|
||||||
{
|
|
||||||
if (mask == 0)
|
if (mask == 0)
|
||||||
FreeResource(pEventClient->resource, RT_NONE);
|
FreeResource(pEventClient->resource, RT_NONE);
|
||||||
else
|
else
|
||||||
|
|
@ -405,9 +379,7 @@ SecurityEventSelectForAuthorization(
|
||||||
pEventClient->mask = mask;
|
pEventClient->mask = mask;
|
||||||
pEventClient->resource = FakeClientID(client->index);
|
pEventClient->resource = FakeClientID(client->index);
|
||||||
pEventClient->next = pAuth->eventClients;
|
pEventClient->next = pAuth->eventClients;
|
||||||
if (!AddResource(pEventClient->resource, RTEventClient,
|
if (!AddResource(pEventClient->resource, RTEventClient, (pointer) pAuth)) {
|
||||||
(pointer)pAuth))
|
|
||||||
{
|
|
||||||
free(pEventClient);
|
free(pEventClient);
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
|
|
@ -416,10 +388,8 @@ SecurityEventSelectForAuthorization(
|
||||||
return Success;
|
return Success;
|
||||||
} /* SecurityEventSelectForAuthorization */
|
} /* SecurityEventSelectForAuthorization */
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ProcSecurityGenerateAuthorization(
|
ProcSecurityGenerateAuthorization(ClientPtr client)
|
||||||
ClientPtr client)
|
|
||||||
{
|
{
|
||||||
REQUEST(xSecurityGenerateAuthorizationReq);
|
REQUEST(xSecurityGenerateAuthorizationReq);
|
||||||
int len; /* request length in CARD32s */
|
int len; /* request length in CARD32s */
|
||||||
|
|
@ -450,27 +420,23 @@ ProcSecurityGenerateAuthorization(
|
||||||
return BadLength;
|
return BadLength;
|
||||||
|
|
||||||
/* check valuemask */
|
/* check valuemask */
|
||||||
if (stuff->valueMask & ~XSecurityAllAuthorizationAttributes)
|
if (stuff->valueMask & ~XSecurityAllAuthorizationAttributes) {
|
||||||
{
|
|
||||||
client->errorValue = stuff->valueMask;
|
client->errorValue = stuff->valueMask;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check timeout */
|
/* check timeout */
|
||||||
timeout = 60;
|
timeout = 60;
|
||||||
if (stuff->valueMask & XSecurityTimeout)
|
if (stuff->valueMask & XSecurityTimeout) {
|
||||||
{
|
|
||||||
timeout = *values++;
|
timeout = *values++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check trustLevel */
|
/* check trustLevel */
|
||||||
trustLevel = XSecurityClientUntrusted;
|
trustLevel = XSecurityClientUntrusted;
|
||||||
if (stuff->valueMask & XSecurityTrustLevel)
|
if (stuff->valueMask & XSecurityTrustLevel) {
|
||||||
{
|
|
||||||
trustLevel = *values++;
|
trustLevel = *values++;
|
||||||
if (trustLevel != XSecurityClientTrusted &&
|
if (trustLevel != XSecurityClientTrusted &&
|
||||||
trustLevel != XSecurityClientUntrusted)
|
trustLevel != XSecurityClientUntrusted) {
|
||||||
{
|
|
||||||
client->errorValue = trustLevel;
|
client->errorValue = trustLevel;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
|
@ -478,20 +444,18 @@ ProcSecurityGenerateAuthorization(
|
||||||
|
|
||||||
/* check group */
|
/* check group */
|
||||||
group = None;
|
group = None;
|
||||||
if (stuff->valueMask & XSecurityGroup)
|
if (stuff->valueMask & XSecurityGroup) {
|
||||||
{
|
|
||||||
group = *values++;
|
group = *values++;
|
||||||
if (SecurityValidateGroupCallback)
|
if (SecurityValidateGroupCallback) {
|
||||||
{
|
|
||||||
SecurityValidateGroupInfoRec vgi;
|
SecurityValidateGroupInfoRec vgi;
|
||||||
|
|
||||||
vgi.group = group;
|
vgi.group = group;
|
||||||
vgi.valid = FALSE;
|
vgi.valid = FALSE;
|
||||||
CallCallbacks(&SecurityValidateGroupCallback, (pointer) &vgi);
|
CallCallbacks(&SecurityValidateGroupCallback, (pointer) &vgi);
|
||||||
|
|
||||||
/* if nobody said they recognized it, it's an error */
|
/* if nobody said they recognized it, it's an error */
|
||||||
|
|
||||||
if (!vgi.valid)
|
if (!vgi.valid) {
|
||||||
{
|
|
||||||
client->errorValue = group;
|
client->errorValue = group;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
|
@ -500,11 +464,9 @@ ProcSecurityGenerateAuthorization(
|
||||||
|
|
||||||
/* check event mask */
|
/* check event mask */
|
||||||
eventMask = 0;
|
eventMask = 0;
|
||||||
if (stuff->valueMask & XSecurityEventMask)
|
if (stuff->valueMask & XSecurityEventMask) {
|
||||||
{
|
|
||||||
eventMask = *values++;
|
eventMask = *values++;
|
||||||
if (eventMask & ~XSecurityAllEventMasks)
|
if (eventMask & ~XSecurityAllEventMasks) {
|
||||||
{
|
|
||||||
client->errorValue = eventMask;
|
client->errorValue = eventMask;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
|
@ -518,8 +480,7 @@ ProcSecurityGenerateAuthorization(
|
||||||
authId = GenerateAuthorization(stuff->nbytesAuthProto, protoname,
|
authId = GenerateAuthorization(stuff->nbytesAuthProto, protoname,
|
||||||
stuff->nbytesAuthData, protodata,
|
stuff->nbytesAuthData, protodata,
|
||||||
&authdata_len, &pAuthdata);
|
&authdata_len, &pAuthdata);
|
||||||
if ((XID) ~0L == authId)
|
if ((XID) ~0L == authId) {
|
||||||
{
|
|
||||||
err = SecurityErrorBase + XSecurityBadAuthorizationProtocol;
|
err = SecurityErrorBase + XSecurityBadAuthorizationProtocol;
|
||||||
goto bailout;
|
goto bailout;
|
||||||
}
|
}
|
||||||
|
|
@ -532,8 +493,7 @@ ProcSecurityGenerateAuthorization(
|
||||||
/* associate additional information with this auth ID */
|
/* associate additional information with this auth ID */
|
||||||
|
|
||||||
pAuth = malloc(sizeof(SecurityAuthorizationRec));
|
pAuth = malloc(sizeof(SecurityAuthorizationRec));
|
||||||
if (!pAuth)
|
if (!pAuth) {
|
||||||
{
|
|
||||||
err = BadAlloc;
|
err = BadAlloc;
|
||||||
goto bailout;
|
goto bailout;
|
||||||
}
|
}
|
||||||
|
|
@ -550,15 +510,13 @@ ProcSecurityGenerateAuthorization(
|
||||||
pAuth->eventClients = NULL;
|
pAuth->eventClients = NULL;
|
||||||
|
|
||||||
/* handle event selection */
|
/* handle event selection */
|
||||||
if (eventMask)
|
if (eventMask) {
|
||||||
{
|
|
||||||
err = SecurityEventSelectForAuthorization(pAuth, client, eventMask);
|
err = SecurityEventSelectForAuthorization(pAuth, client, eventMask);
|
||||||
if (err != Success)
|
if (err != Success)
|
||||||
goto bailout;
|
goto bailout;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!AddResource(authId, SecurityAuthorizationResType, pAuth))
|
if (!AddResource(authId, SecurityAuthorizationResType, pAuth)) {
|
||||||
{
|
|
||||||
err = BadAlloc;
|
err = BadAlloc;
|
||||||
goto bailout;
|
goto bailout;
|
||||||
}
|
}
|
||||||
|
|
@ -576,8 +534,7 @@ ProcSecurityGenerateAuthorization(
|
||||||
rep.authId = authId;
|
rep.authId = authId;
|
||||||
rep.dataLength = authdata_len;
|
rep.dataLength = authdata_len;
|
||||||
|
|
||||||
if (client->swapped)
|
if (client->swapped) {
|
||||||
{
|
|
||||||
swapl(&rep.length);
|
swapl(&rep.length);
|
||||||
swaps(&rep.sequenceNumber);
|
swaps(&rep.sequenceNumber);
|
||||||
swapl(&rep.authId);
|
swapl(&rep.authId);
|
||||||
|
|
@ -588,7 +545,8 @@ ProcSecurityGenerateAuthorization(
|
||||||
(char *) &rep);
|
(char *) &rep);
|
||||||
WriteToClient(client, authdata_len, pAuthdata);
|
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,
|
client->index, pAuth->id, pAuth->trustLevel, pAuth->timeout,
|
||||||
pAuth->group, eventMask);
|
pAuth->group, eventMask);
|
||||||
|
|
||||||
|
|
@ -605,8 +563,7 @@ bailout:
|
||||||
} /* ProcSecurityGenerateAuthorization */
|
} /* ProcSecurityGenerateAuthorization */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ProcSecurityRevokeAuthorization(
|
ProcSecurityRevokeAuthorization(ClientPtr client)
|
||||||
ClientPtr client)
|
|
||||||
{
|
{
|
||||||
REQUEST(xSecurityRevokeAuthorizationReq);
|
REQUEST(xSecurityRevokeAuthorizationReq);
|
||||||
SecurityAuthorizationPtr pAuth;
|
SecurityAuthorizationPtr pAuth;
|
||||||
|
|
@ -624,15 +581,12 @@ ProcSecurityRevokeAuthorization(
|
||||||
return Success;
|
return Success;
|
||||||
} /* ProcSecurityRevokeAuthorization */
|
} /* ProcSecurityRevokeAuthorization */
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ProcSecurityDispatch(
|
ProcSecurityDispatch(ClientPtr client)
|
||||||
ClientPtr client)
|
|
||||||
{
|
{
|
||||||
REQUEST(xReq);
|
REQUEST(xReq);
|
||||||
|
|
||||||
switch (stuff->data)
|
switch (stuff->data) {
|
||||||
{
|
|
||||||
case X_SecurityQueryVersion:
|
case X_SecurityQueryVersion:
|
||||||
return ProcSecurityQueryVersion(client);
|
return ProcSecurityQueryVersion(client);
|
||||||
case X_SecurityGenerateAuthorization:
|
case X_SecurityGenerateAuthorization:
|
||||||
|
|
@ -645,8 +599,7 @@ ProcSecurityDispatch(
|
||||||
} /* ProcSecurityDispatch */
|
} /* ProcSecurityDispatch */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
SProcSecurityQueryVersion(
|
SProcSecurityQueryVersion(ClientPtr client)
|
||||||
ClientPtr client)
|
|
||||||
{
|
{
|
||||||
REQUEST(xSecurityQueryVersionReq);
|
REQUEST(xSecurityQueryVersionReq);
|
||||||
|
|
||||||
|
|
@ -657,10 +610,8 @@ SProcSecurityQueryVersion(
|
||||||
return ProcSecurityQueryVersion(client);
|
return ProcSecurityQueryVersion(client);
|
||||||
} /* SProcSecurityQueryVersion */
|
} /* SProcSecurityQueryVersion */
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
SProcSecurityGenerateAuthorization(
|
SProcSecurityGenerateAuthorization(ClientPtr client)
|
||||||
ClientPtr client)
|
|
||||||
{
|
{
|
||||||
REQUEST(xSecurityGenerateAuthorizationReq);
|
REQUEST(xSecurityGenerateAuthorizationReq);
|
||||||
CARD32 *values;
|
CARD32 *values;
|
||||||
|
|
@ -683,10 +634,8 @@ SProcSecurityGenerateAuthorization(
|
||||||
return ProcSecurityGenerateAuthorization(client);
|
return ProcSecurityGenerateAuthorization(client);
|
||||||
} /* SProcSecurityGenerateAuthorization */
|
} /* SProcSecurityGenerateAuthorization */
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
SProcSecurityRevokeAuthorization(
|
SProcSecurityRevokeAuthorization(ClientPtr client)
|
||||||
ClientPtr client)
|
|
||||||
{
|
{
|
||||||
REQUEST(xSecurityRevokeAuthorizationReq);
|
REQUEST(xSecurityRevokeAuthorizationReq);
|
||||||
|
|
||||||
|
|
@ -696,15 +645,12 @@ SProcSecurityRevokeAuthorization(
|
||||||
return ProcSecurityRevokeAuthorization(client);
|
return ProcSecurityRevokeAuthorization(client);
|
||||||
} /* SProcSecurityRevokeAuthorization */
|
} /* SProcSecurityRevokeAuthorization */
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
SProcSecurityDispatch(
|
SProcSecurityDispatch(ClientPtr client)
|
||||||
ClientPtr client)
|
|
||||||
{
|
{
|
||||||
REQUEST(xReq);
|
REQUEST(xReq);
|
||||||
|
|
||||||
switch (stuff->data)
|
switch (stuff->data) {
|
||||||
{
|
|
||||||
case X_SecurityQueryVersion:
|
case X_SecurityQueryVersion:
|
||||||
return SProcSecurityQueryVersion(client);
|
return SProcSecurityQueryVersion(client);
|
||||||
case X_SecurityGenerateAuthorization:
|
case X_SecurityGenerateAuthorization:
|
||||||
|
|
@ -717,8 +663,7 @@ SProcSecurityDispatch(
|
||||||
} /* SProcSecurityDispatch */
|
} /* SProcSecurityDispatch */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
SwapSecurityAuthorizationRevokedEvent(
|
SwapSecurityAuthorizationRevokedEvent(xSecurityAuthorizationRevokedEvent * from,
|
||||||
xSecurityAuthorizationRevokedEvent *from,
|
|
||||||
xSecurityAuthorizationRevokedEvent * to)
|
xSecurityAuthorizationRevokedEvent * to)
|
||||||
{
|
{
|
||||||
to->type = from->type;
|
to->type = from->type;
|
||||||
|
|
@ -835,7 +780,6 @@ SecurityResource(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
||||||
rec->status = BadAccess; /* deny access */
|
rec->status = BadAccess; /* deny access */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
SecurityExtension(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
SecurityExtension(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
||||||
{
|
{
|
||||||
|
|
@ -1054,8 +998,7 @@ SecurityClientState(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
SecurityResetProc(
|
SecurityResetProc(ExtensionEntry * extEntry)
|
||||||
ExtensionEntry *extEntry)
|
|
||||||
{
|
{
|
||||||
/* Unregister callbacks */
|
/* Unregister callbacks */
|
||||||
DeleteCallback(&ClientStateCallback, SecurityClientState, NULL);
|
DeleteCallback(&ClientStateCallback, SecurityClientState, NULL);
|
||||||
|
|
@ -1071,7 +1014,6 @@ SecurityResetProc(
|
||||||
XaceDeleteCallback(XACE_SERVER_ACCESS, SecurityServer, NULL);
|
XaceDeleteCallback(XACE_SERVER_ACCESS, SecurityServer, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* SecurityExtensionInit
|
/* SecurityExtensionInit
|
||||||
*
|
*
|
||||||
* Arguments: none.
|
* Arguments: none.
|
||||||
|
|
@ -1102,7 +1044,8 @@ SecurityExtensionInit(INITARGS)
|
||||||
RTEventClient |= RC_NEVERRETAIN;
|
RTEventClient |= RC_NEVERRETAIN;
|
||||||
|
|
||||||
/* Allocate the private storage */
|
/* 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");
|
FatalError("SecurityExtensionSetup: Can't allocate client private.\n");
|
||||||
|
|
||||||
/* Register callbacks */
|
/* Register callbacks */
|
||||||
|
|
@ -1133,7 +1076,8 @@ SecurityExtensionInit(INITARGS)
|
||||||
EventSwapVector[SecurityEventBase + XSecurityAuthorizationRevoked] =
|
EventSwapVector[SecurityEventBase + XSecurityAuthorizationRevoked] =
|
||||||
(EventSwapPtr) SwapSecurityAuthorizationRevokedEvent;
|
(EventSwapPtr) SwapSecurityAuthorizationRevokedEvent;
|
||||||
|
|
||||||
SetResourceTypeErrorValue(SecurityAuthorizationResType, SecurityErrorBase + XSecurityBadAuthorization);
|
SetResourceTypeErrorValue(SecurityAuthorizationResType,
|
||||||
|
SecurityErrorBase + XSecurityBadAuthorization);
|
||||||
|
|
||||||
/* Label objects that were created before we could register ourself */
|
/* Label objects that were created before we could register ourself */
|
||||||
SecurityLabelInitial();
|
SecurityLabelInitial();
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,6 @@ from The Open Group.
|
||||||
#undef NEED_UNDEF_Display
|
#undef NEED_UNDEF_Display
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#include "input.h" /* for DeviceIntPtr */
|
#include "input.h" /* for DeviceIntPtr */
|
||||||
#include "property.h" /* for PropertyPtr */
|
#include "property.h" /* for PropertyPtr */
|
||||||
#include "pixmap.h" /* for DrawablePtr */
|
#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 "modinit.h"
|
||||||
#include "protocol-versions.h"
|
#include "protocol-versions.h"
|
||||||
|
|
||||||
typedef RegionPtr (*CreateDftPtr)(
|
typedef RegionPtr (*CreateDftPtr) (WindowPtr /* pWin */
|
||||||
WindowPtr /* pWin */
|
|
||||||
);
|
);
|
||||||
|
|
||||||
static int ShapeFreeClient(
|
static int ShapeFreeClient(pointer /* data */ ,
|
||||||
pointer /* data */,
|
|
||||||
XID /* id */
|
XID /* id */
|
||||||
);
|
);
|
||||||
static int ShapeFreeEvents(
|
static int ShapeFreeEvents(pointer /* data */ ,
|
||||||
pointer /* data */,
|
|
||||||
XID /* id */
|
XID /* id */
|
||||||
);
|
);
|
||||||
static void SShapeNotifyEvent(
|
static void SShapeNotifyEvent(xShapeNotifyEvent * /* from */ ,
|
||||||
xShapeNotifyEvent * /* from */,
|
|
||||||
xShapeNotifyEvent * /* to */
|
xShapeNotifyEvent * /* to */
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -68,7 +64,6 @@ static void SShapeNotifyEvent(
|
||||||
* externally by the Xfixes extension and are now defined in window.h
|
* externally by the Xfixes extension and are now defined in window.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifdef PANORAMIX
|
#ifdef PANORAMIX
|
||||||
#include "panoramiX.h"
|
#include "panoramiX.h"
|
||||||
#include "panoramiXsrv.h"
|
#include "panoramiXsrv.h"
|
||||||
|
|
@ -103,20 +98,15 @@ typedef struct _ShapeEvent {
|
||||||
****************/
|
****************/
|
||||||
|
|
||||||
static int
|
static int
|
||||||
RegionOperate (
|
RegionOperate(ClientPtr client,
|
||||||
ClientPtr client,
|
|
||||||
WindowPtr pWin,
|
WindowPtr pWin,
|
||||||
int kind,
|
int kind,
|
||||||
RegionPtr *destRgnp,
|
RegionPtr *destRgnp,
|
||||||
RegionPtr srcRgn,
|
RegionPtr srcRgn, int op, int xoff, int yoff, CreateDftPtr create)
|
||||||
int op,
|
|
||||||
int xoff, int yoff,
|
|
||||||
CreateDftPtr create)
|
|
||||||
{
|
{
|
||||||
if (srcRgn && (xoff || yoff))
|
if (srcRgn && (xoff || yoff))
|
||||||
RegionTranslate(srcRgn, xoff, yoff);
|
RegionTranslate(srcRgn, xoff, yoff);
|
||||||
if (!pWin->parent)
|
if (!pWin->parent) {
|
||||||
{
|
|
||||||
if (srcRgn)
|
if (srcRgn)
|
||||||
RegionDestroy(srcRgn);
|
RegionDestroy(srcRgn);
|
||||||
return Success;
|
return Success;
|
||||||
|
|
@ -145,7 +135,8 @@ RegionOperate (
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else switch (op) {
|
else
|
||||||
|
switch (op) {
|
||||||
case ShapeSet:
|
case ShapeSet:
|
||||||
if (*destRgnp)
|
if (*destRgnp)
|
||||||
RegionDestroy(*destRgnp);
|
RegionDestroy(*destRgnp);
|
||||||
|
|
@ -214,6 +205,7 @@ static int
|
||||||
ProcShapeQueryVersion(ClientPtr client)
|
ProcShapeQueryVersion(ClientPtr client)
|
||||||
{
|
{
|
||||||
xShapeQueryVersionReply rep;
|
xShapeQueryVersionReply rep;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xShapeQueryVersionReq);
|
REQUEST_SIZE_MATCH(xShapeQueryVersionReq);
|
||||||
memset(&rep, 0, sizeof(xShapeQueryVersionReply));
|
memset(&rep, 0, sizeof(xShapeQueryVersionReply));
|
||||||
rep.type = X_Reply;
|
rep.type = X_Reply;
|
||||||
|
|
@ -240,6 +232,7 @@ static int
|
||||||
ProcShapeRectangles(ClientPtr client)
|
ProcShapeRectangles(ClientPtr client)
|
||||||
{
|
{
|
||||||
WindowPtr pWin;
|
WindowPtr pWin;
|
||||||
|
|
||||||
REQUEST(xShapeRectanglesReq);
|
REQUEST(xShapeRectanglesReq);
|
||||||
xRectangle *prects;
|
xRectangle *prects;
|
||||||
int nrects, ctype, rc;
|
int nrects, ctype, rc;
|
||||||
|
|
@ -267,8 +260,7 @@ ProcShapeRectangles (ClientPtr client)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
if ((stuff->ordering != Unsorted) && (stuff->ordering != YSorted) &&
|
if ((stuff->ordering != Unsorted) && (stuff->ordering != YSorted) &&
|
||||||
(stuff->ordering != YXSorted) && (stuff->ordering != YXBanded))
|
(stuff->ordering != YXSorted) && (stuff->ordering != YXBanded)) {
|
||||||
{
|
|
||||||
client->errorValue = stuff->ordering;
|
client->errorValue = stuff->ordering;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
|
@ -305,8 +297,7 @@ ProcShapeRectangles (ClientPtr client)
|
||||||
|
|
||||||
#ifdef PANORAMIX
|
#ifdef PANORAMIX
|
||||||
static int
|
static int
|
||||||
ProcPanoramiXShapeRectangles(
|
ProcPanoramiXShapeRectangles(ClientPtr client)
|
||||||
ClientPtr client)
|
|
||||||
{
|
{
|
||||||
REQUEST(xShapeRectanglesReq);
|
REQUEST(xShapeRectanglesReq);
|
||||||
PanoramiXRes *win;
|
PanoramiXRes *win;
|
||||||
|
|
@ -322,23 +313,23 @@ ProcPanoramiXShapeRectangles(
|
||||||
FOR_NSCREENS(j) {
|
FOR_NSCREENS(j) {
|
||||||
stuff->dest = win->info[j].id;
|
stuff->dest = win->info[j].id;
|
||||||
result = ProcShapeRectangles(client);
|
result = ProcShapeRectangles(client);
|
||||||
if (result != Success) break;
|
if (result != Success)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/**************
|
/**************
|
||||||
* ProcShapeMask
|
* ProcShapeMask
|
||||||
**************/
|
**************/
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ProcShapeMask(ClientPtr client)
|
ProcShapeMask(ClientPtr client)
|
||||||
{
|
{
|
||||||
WindowPtr pWin;
|
WindowPtr pWin;
|
||||||
ScreenPtr pScreen;
|
ScreenPtr pScreen;
|
||||||
|
|
||||||
REQUEST(xShapeMaskReq);
|
REQUEST(xShapeMaskReq);
|
||||||
RegionPtr srcRgn;
|
RegionPtr srcRgn;
|
||||||
RegionPtr *destRgn;
|
RegionPtr *destRgn;
|
||||||
|
|
@ -369,8 +360,8 @@ ProcShapeMask (ClientPtr client)
|
||||||
if (stuff->src == None)
|
if (stuff->src == None)
|
||||||
srcRgn = 0;
|
srcRgn = 0;
|
||||||
else {
|
else {
|
||||||
rc = dixLookupResourceByType((pointer *)&pPixmap, stuff->src, RT_PIXMAP,
|
rc = dixLookupResourceByType((pointer *) &pPixmap, stuff->src,
|
||||||
client, DixReadAccess);
|
RT_PIXMAP, client, DixReadAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
if (pPixmap->drawable.pScreen != pScreen ||
|
if (pPixmap->drawable.pScreen != pScreen ||
|
||||||
|
|
@ -404,8 +395,7 @@ ProcShapeMask (ClientPtr client)
|
||||||
|
|
||||||
#ifdef PANORAMIX
|
#ifdef PANORAMIX
|
||||||
static int
|
static int
|
||||||
ProcPanoramiXShapeMask(
|
ProcPanoramiXShapeMask(ClientPtr client)
|
||||||
ClientPtr client)
|
|
||||||
{
|
{
|
||||||
REQUEST(xShapeMaskReq);
|
REQUEST(xShapeMaskReq);
|
||||||
PanoramiXRes *win, *pmap;
|
PanoramiXRes *win, *pmap;
|
||||||
|
|
@ -423,7 +413,8 @@ ProcPanoramiXShapeMask(
|
||||||
XRT_PIXMAP, client, DixReadAccess);
|
XRT_PIXMAP, client, DixReadAccess);
|
||||||
if (result != Success)
|
if (result != Success)
|
||||||
return result;
|
return result;
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
pmap = NULL;
|
pmap = NULL;
|
||||||
|
|
||||||
FOR_NSCREENS(j) {
|
FOR_NSCREENS(j) {
|
||||||
|
|
@ -431,13 +422,13 @@ ProcPanoramiXShapeMask(
|
||||||
if (pmap)
|
if (pmap)
|
||||||
stuff->src = pmap->info[j].id;
|
stuff->src = pmap->info[j].id;
|
||||||
result = ProcShapeMask(client);
|
result = ProcShapeMask(client);
|
||||||
if (result != Success) break;
|
if (result != Success)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/************
|
/************
|
||||||
* ProcShapeCombine
|
* ProcShapeCombine
|
||||||
************/
|
************/
|
||||||
|
|
@ -446,6 +437,7 @@ static int
|
||||||
ProcShapeCombine(ClientPtr client)
|
ProcShapeCombine(ClientPtr client)
|
||||||
{
|
{
|
||||||
WindowPtr pSrcWin, pDestWin;
|
WindowPtr pSrcWin, pDestWin;
|
||||||
|
|
||||||
REQUEST(xShapeCombineReq);
|
REQUEST(xShapeCombineReq);
|
||||||
RegionPtr srcRgn;
|
RegionPtr srcRgn;
|
||||||
RegionPtr *destRgn;
|
RegionPtr *destRgn;
|
||||||
|
|
@ -496,8 +488,7 @@ ProcShapeCombine (ClientPtr client)
|
||||||
client->errorValue = stuff->srcKind;
|
client->errorValue = stuff->srcKind;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
if (pSrcWin->drawable.pScreen != pDestWin->drawable.pScreen)
|
if (pSrcWin->drawable.pScreen != pDestWin->drawable.pScreen) {
|
||||||
{
|
|
||||||
return BadMatch;
|
return BadMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -505,7 +496,8 @@ ProcShapeCombine (ClientPtr client)
|
||||||
tmp = RegionCreate((BoxPtr) 0, 0);
|
tmp = RegionCreate((BoxPtr) 0, 0);
|
||||||
RegionCopy(tmp, srcRgn);
|
RegionCopy(tmp, srcRgn);
|
||||||
srcRgn = tmp;
|
srcRgn = tmp;
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
srcRgn = (*createSrc) (pSrcWin);
|
srcRgn = (*createSrc) (pSrcWin);
|
||||||
|
|
||||||
if (!pDestWin->optional)
|
if (!pDestWin->optional)
|
||||||
|
|
@ -529,11 +521,9 @@ ProcShapeCombine (ClientPtr client)
|
||||||
stuff->xOff, stuff->yOff, createDefault);
|
stuff->xOff, stuff->yOff, createDefault);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef PANORAMIX
|
#ifdef PANORAMIX
|
||||||
static int
|
static int
|
||||||
ProcPanoramiXShapeCombine(
|
ProcPanoramiXShapeCombine(ClientPtr client)
|
||||||
ClientPtr client)
|
|
||||||
{
|
{
|
||||||
REQUEST(xShapeCombineReq);
|
REQUEST(xShapeCombineReq);
|
||||||
PanoramiXRes *win, *win2;
|
PanoramiXRes *win, *win2;
|
||||||
|
|
@ -555,7 +545,8 @@ ProcPanoramiXShapeCombine(
|
||||||
stuff->dest = win->info[j].id;
|
stuff->dest = win->info[j].id;
|
||||||
stuff->src = win2->info[j].id;
|
stuff->src = win2->info[j].id;
|
||||||
result = ProcShapeCombine(client);
|
result = ProcShapeCombine(client);
|
||||||
if (result != Success) break;
|
if (result != Success)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
@ -569,6 +560,7 @@ static int
|
||||||
ProcShapeOffset(ClientPtr client)
|
ProcShapeOffset(ClientPtr client)
|
||||||
{
|
{
|
||||||
WindowPtr pWin;
|
WindowPtr pWin;
|
||||||
|
|
||||||
REQUEST(xShapeOffsetReq);
|
REQUEST(xShapeOffsetReq);
|
||||||
RegionPtr srcRgn;
|
RegionPtr srcRgn;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
@ -592,8 +584,7 @@ ProcShapeOffset (ClientPtr client)
|
||||||
client->errorValue = stuff->destKind;
|
client->errorValue = stuff->destKind;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
if (srcRgn)
|
if (srcRgn) {
|
||||||
{
|
|
||||||
RegionTranslate(srcRgn, stuff->xOff, stuff->yOff);
|
RegionTranslate(srcRgn, stuff->xOff, stuff->yOff);
|
||||||
(*pWin->drawable.pScreen->SetShape) (pWin, stuff->destKind);
|
(*pWin->drawable.pScreen->SetShape) (pWin, stuff->destKind);
|
||||||
}
|
}
|
||||||
|
|
@ -601,11 +592,9 @@ ProcShapeOffset (ClientPtr client)
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef PANORAMIX
|
#ifdef PANORAMIX
|
||||||
static int
|
static int
|
||||||
ProcPanoramiXShapeOffset(
|
ProcPanoramiXShapeOffset(ClientPtr client)
|
||||||
ClientPtr client)
|
|
||||||
{
|
{
|
||||||
REQUEST(xShapeOffsetReq);
|
REQUEST(xShapeOffsetReq);
|
||||||
PanoramiXRes *win;
|
PanoramiXRes *win;
|
||||||
|
|
@ -621,13 +610,13 @@ ProcPanoramiXShapeOffset(
|
||||||
FOR_NSCREENS(j) {
|
FOR_NSCREENS(j) {
|
||||||
stuff->dest = win->info[j].id;
|
stuff->dest = win->info[j].id;
|
||||||
result = ProcShapeOffset(client);
|
result = ProcShapeOffset(client);
|
||||||
if(result != Success) break;
|
if (result != Success)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ProcShapeQueryExtents(ClientPtr client)
|
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 */
|
/* this is done in two steps because of a compiler bug on SunOS 4.1.3 */
|
||||||
pExtents = RegionExtents(region);
|
pExtents = RegionExtents(region);
|
||||||
extents = *pExtents;
|
extents = *pExtents;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
extents.x1 = -wBorderWidth(pWin);
|
extents.x1 = -wBorderWidth(pWin);
|
||||||
extents.y1 = -wBorderWidth(pWin);
|
extents.y1 = -wBorderWidth(pWin);
|
||||||
extents.x2 = pWin->drawable.width + 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 */
|
/* this is done in two steps because of a compiler bug on SunOS 4.1.3 */
|
||||||
pExtents = RegionExtents(region);
|
pExtents = RegionExtents(region);
|
||||||
extents = *pExtents;
|
extents = *pExtents;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
extents.x1 = 0;
|
extents.x1 = 0;
|
||||||
extents.y1 = 0;
|
extents.y1 = 0;
|
||||||
extents.x2 = pWin->drawable.width;
|
extents.x2 = pWin->drawable.width;
|
||||||
|
|
@ -692,8 +683,7 @@ ProcShapeQueryExtents (ClientPtr client)
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*ARGSUSED*/
|
/*ARGSUSED*/ static int
|
||||||
static int
|
|
||||||
ShapeFreeClient(pointer data, XID id)
|
ShapeFreeClient(pointer data, XID id)
|
||||||
{
|
{
|
||||||
ShapeEventPtr pShapeEvent;
|
ShapeEventPtr pShapeEvent;
|
||||||
|
|
@ -709,8 +699,7 @@ ShapeFreeClient (pointer data, XID id)
|
||||||
pPrev = 0;
|
pPrev = 0;
|
||||||
for (pCur = *pHead; pCur && pCur != pShapeEvent; pCur = pCur->next)
|
for (pCur = *pHead; pCur && pCur != pShapeEvent; pCur = pCur->next)
|
||||||
pPrev = pCur;
|
pPrev = pCur;
|
||||||
if (pCur)
|
if (pCur) {
|
||||||
{
|
|
||||||
if (pPrev)
|
if (pPrev)
|
||||||
pPrev->next = pShapeEvent->next;
|
pPrev->next = pShapeEvent->next;
|
||||||
else
|
else
|
||||||
|
|
@ -721,8 +710,7 @@ ShapeFreeClient (pointer data, XID id)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*ARGSUSED*/
|
/*ARGSUSED*/ static int
|
||||||
static int
|
|
||||||
ShapeFreeEvents(pointer data, XID id)
|
ShapeFreeEvents(pointer data, XID id)
|
||||||
{
|
{
|
||||||
ShapeEventPtr *pHead, pCur, pNext;
|
ShapeEventPtr *pHead, pCur, pNext;
|
||||||
|
|
@ -761,9 +749,7 @@ ProcShapeSelectInput (ClientPtr client)
|
||||||
|
|
||||||
/* check for existing entry. */
|
/* check for existing entry. */
|
||||||
for (pShapeEvent = *pHead;
|
for (pShapeEvent = *pHead;
|
||||||
pShapeEvent;
|
pShapeEvent; pShapeEvent = pShapeEvent->next) {
|
||||||
pShapeEvent = pShapeEvent->next)
|
|
||||||
{
|
|
||||||
if (pShapeEvent->client == client)
|
if (pShapeEvent->client == client)
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
@ -790,12 +776,11 @@ ProcShapeSelectInput (ClientPtr client)
|
||||||
* the list may be arbitrarily rearranged which cannot be
|
* the list may be arbitrarily rearranged which cannot be
|
||||||
* done through the resource database.
|
* done through the resource database.
|
||||||
*/
|
*/
|
||||||
if (!pHead)
|
if (!pHead) {
|
||||||
{
|
|
||||||
pHead = malloc(sizeof(ShapeEventPtr));
|
pHead = malloc(sizeof(ShapeEventPtr));
|
||||||
if (!pHead ||
|
if (!pHead ||
|
||||||
!AddResource (pWin->drawable.id, ShapeEventType, (pointer)pHead))
|
!AddResource(pWin->drawable.id, ShapeEventType,
|
||||||
{
|
(pointer) pHead)) {
|
||||||
FreeResource(clientResource, RT_NONE);
|
FreeResource(clientResource, RT_NONE);
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
|
|
@ -808,7 +793,8 @@ ProcShapeSelectInput (ClientPtr client)
|
||||||
/* delete the interest */
|
/* delete the interest */
|
||||||
if (pHead) {
|
if (pHead) {
|
||||||
pNewShapeEvent = 0;
|
pNewShapeEvent = 0;
|
||||||
for (pShapeEvent = *pHead; pShapeEvent; pShapeEvent = pShapeEvent->next) {
|
for (pShapeEvent = *pHead; pShapeEvent;
|
||||||
|
pShapeEvent = pShapeEvent->next) {
|
||||||
if (pShapeEvent->client == client)
|
if (pShapeEvent->client == client)
|
||||||
break;
|
break;
|
||||||
pNewShapeEvent = pShapeEvent;
|
pNewShapeEvent = pShapeEvent;
|
||||||
|
|
@ -854,7 +840,8 @@ SendShapeNotify (WindowPtr pWin, int which)
|
||||||
if (region) {
|
if (region) {
|
||||||
extents = *RegionExtents(region);
|
extents = *RegionExtents(region);
|
||||||
shaped = xTrue;
|
shaped = xTrue;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
extents.x1 = -wBorderWidth(pWin);
|
extents.x1 = -wBorderWidth(pWin);
|
||||||
extents.y1 = -wBorderWidth(pWin);
|
extents.y1 = -wBorderWidth(pWin);
|
||||||
extents.x2 = pWin->drawable.width + wBorderWidth(pWin);
|
extents.x2 = pWin->drawable.width + wBorderWidth(pWin);
|
||||||
|
|
@ -867,7 +854,8 @@ SendShapeNotify (WindowPtr pWin, int which)
|
||||||
if (region) {
|
if (region) {
|
||||||
extents = *RegionExtents(region);
|
extents = *RegionExtents(region);
|
||||||
shaped = xTrue;
|
shaped = xTrue;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
extents.x1 = 0;
|
extents.x1 = 0;
|
||||||
extents.y1 = 0;
|
extents.y1 = 0;
|
||||||
extents.x2 = pWin->drawable.width;
|
extents.x2 = pWin->drawable.width;
|
||||||
|
|
@ -880,7 +868,8 @@ SendShapeNotify (WindowPtr pWin, int which)
|
||||||
if (region) {
|
if (region) {
|
||||||
extents = *RegionExtents(region);
|
extents = *RegionExtents(region);
|
||||||
shaped = xTrue;
|
shaped = xTrue;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
extents.x1 = -wBorderWidth(pWin);
|
extents.x1 = -wBorderWidth(pWin);
|
||||||
extents.y1 = -wBorderWidth(pWin);
|
extents.y1 = -wBorderWidth(pWin);
|
||||||
extents.x2 = pWin->drawable.width + wBorderWidth(pWin);
|
extents.x2 = pWin->drawable.width + wBorderWidth(pWin);
|
||||||
|
|
@ -913,6 +902,7 @@ ProcShapeInputSelected (ClientPtr client)
|
||||||
ShapeEventPtr pShapeEvent, *pHead;
|
ShapeEventPtr pShapeEvent, *pHead;
|
||||||
int enabled, rc;
|
int enabled, rc;
|
||||||
xShapeInputSelectedReply rep;
|
xShapeInputSelectedReply rep;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xShapeInputSelectedReq);
|
REQUEST_SIZE_MATCH(xShapeInputSelectedReq);
|
||||||
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
|
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
|
|
@ -923,10 +913,7 @@ ProcShapeInputSelected (ClientPtr client)
|
||||||
return rc;
|
return rc;
|
||||||
enabled = xFalse;
|
enabled = xFalse;
|
||||||
if (pHead) {
|
if (pHead) {
|
||||||
for (pShapeEvent = *pHead;
|
for (pShapeEvent = *pHead; pShapeEvent; pShapeEvent = pShapeEvent->next) {
|
||||||
pShapeEvent;
|
|
||||||
pShapeEvent = pShapeEvent->next)
|
|
||||||
{
|
|
||||||
if (pShapeEvent->client == client) {
|
if (pShapeEvent->client == client) {
|
||||||
enabled = xTrue;
|
enabled = xTrue;
|
||||||
break;
|
break;
|
||||||
|
|
@ -954,6 +941,7 @@ ProcShapeGetRectangles (ClientPtr client)
|
||||||
xRectangle *rects;
|
xRectangle *rects;
|
||||||
int nrects, i, rc;
|
int nrects, i, rc;
|
||||||
RegionPtr region;
|
RegionPtr region;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xShapeGetRectanglesReq);
|
REQUEST_SIZE_MATCH(xShapeGetRectanglesReq);
|
||||||
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
|
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
|
|
@ -997,8 +985,10 @@ ProcShapeGetRectangles (ClientPtr client)
|
||||||
rects->height = pWin->drawable.height + wBorderWidth(pWin);
|
rects->height = pWin->drawable.height + wBorderWidth(pWin);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
BoxPtr box;
|
BoxPtr box;
|
||||||
|
|
||||||
nrects = RegionNumRects(region);
|
nrects = RegionNumRects(region);
|
||||||
box = RegionRects(region);
|
box = RegionRects(region);
|
||||||
rects = malloc(nrects * sizeof(xRectangle));
|
rects = malloc(nrects * sizeof(xRectangle));
|
||||||
|
|
@ -1236,8 +1226,7 @@ ShapeExtensionInit(void)
|
||||||
if (ClientType && ShapeEventType &&
|
if (ClientType && ShapeEventType &&
|
||||||
(extEntry = AddExtension(SHAPENAME, ShapeNumberEvents, 0,
|
(extEntry = AddExtension(SHAPENAME, ShapeNumberEvents, 0,
|
||||||
ProcShapeDispatch, SProcShapeDispatch,
|
ProcShapeDispatch, SProcShapeDispatch,
|
||||||
NULL, StandardMinorOpcode)))
|
NULL, StandardMinorOpcode))) {
|
||||||
{
|
|
||||||
ShapeEventBase = extEntry->eventBase;
|
ShapeEventBase = extEntry->eventBase;
|
||||||
EventSwapVector[ShapeEventBase] = (EventSwapPtr) SShapeNotifyEvent;
|
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 */
|
/* THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION */
|
||||||
|
|
||||||
|
|
||||||
#define SHM
|
#define SHM
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
#ifdef HAVE_DIX_CONFIG_H
|
||||||
|
|
@ -106,21 +105,17 @@ typedef struct _ShmScrPrivateRec {
|
||||||
} ShmScrPrivateRec;
|
} ShmScrPrivateRec;
|
||||||
|
|
||||||
static PixmapPtr fbShmCreatePixmap(XSHM_CREATE_PIXMAP_ARGS);
|
static PixmapPtr fbShmCreatePixmap(XSHM_CREATE_PIXMAP_ARGS);
|
||||||
static int ShmDetachSegment(
|
static int ShmDetachSegment(pointer /* value */ ,
|
||||||
pointer /* value */,
|
|
||||||
XID /* shmseg */
|
XID /* shmseg */
|
||||||
);
|
);
|
||||||
static void ShmResetProc(
|
static void ShmResetProc(ExtensionEntry * /* extEntry */
|
||||||
ExtensionEntry * /* extEntry */
|
|
||||||
);
|
);
|
||||||
static void SShmCompletionEvent(
|
static void SShmCompletionEvent(xShmCompletionEvent * /* from */ ,
|
||||||
xShmCompletionEvent * /* from */,
|
|
||||||
xShmCompletionEvent * /* to */
|
xShmCompletionEvent * /* to */
|
||||||
);
|
);
|
||||||
|
|
||||||
static Bool ShmDestroyPixmap(PixmapPtr pPixmap);
|
static Bool ShmDestroyPixmap(PixmapPtr pPixmap);
|
||||||
|
|
||||||
|
|
||||||
static unsigned char ShmReqCode;
|
static unsigned char ShmReqCode;
|
||||||
int ShmCompletionCode;
|
int ShmCompletionCode;
|
||||||
int BadShmSegCode;
|
int BadShmSegCode;
|
||||||
|
|
@ -128,8 +123,10 @@ RESTYPE ShmSegType;
|
||||||
static ShmDescPtr Shmsegs;
|
static ShmDescPtr Shmsegs;
|
||||||
static Bool sharedPixmaps;
|
static Bool sharedPixmaps;
|
||||||
static DevPrivateKeyRec shmScrPrivateKeyRec;
|
static DevPrivateKeyRec shmScrPrivateKeyRec;
|
||||||
|
|
||||||
#define shmScrPrivateKey (&shmScrPrivateKeyRec)
|
#define shmScrPrivateKey (&shmScrPrivateKeyRec)
|
||||||
static DevPrivateKeyRec shmPixmapPrivateKeyRec;
|
static DevPrivateKeyRec shmPixmapPrivateKeyRec;
|
||||||
|
|
||||||
#define shmPixmapPrivateKey (&shmPixmapPrivateKeyRec)
|
#define shmPixmapPrivateKey (&shmPixmapPrivateKeyRec)
|
||||||
static ShmFuncs miFuncs = { NULL, NULL };
|
static ShmFuncs miFuncs = { NULL, NULL };
|
||||||
static ShmFuncs fbFuncs = { fbShmCreatePixmap, 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__)
|
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__CYGWIN__) || defined(__DragonFly__)
|
||||||
#include <sys/signal.h>
|
#include <sys/signal.h>
|
||||||
|
|
||||||
|
|
@ -177,7 +173,8 @@ SigSysHandler(int signo)
|
||||||
badSysCall = TRUE;
|
badSysCall = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Bool CheckForShmSyscall(void)
|
static Bool
|
||||||
|
CheckForShmSyscall(void)
|
||||||
{
|
{
|
||||||
void (*oldHandler) (int);
|
void (*oldHandler) (int);
|
||||||
int shmid = -1;
|
int shmid = -1;
|
||||||
|
|
@ -188,13 +185,11 @@ static Bool CheckForShmSyscall(void)
|
||||||
badSysCall = FALSE;
|
badSysCall = FALSE;
|
||||||
shmid = shmget(IPC_PRIVATE, 4096, IPC_CREAT);
|
shmid = shmget(IPC_PRIVATE, 4096, IPC_CREAT);
|
||||||
|
|
||||||
if (shmid != -1)
|
if (shmid != -1) {
|
||||||
{
|
|
||||||
/* Successful allocation - clean up */
|
/* Successful allocation - clean up */
|
||||||
shmctl(shmid, IPC_RMID, NULL);
|
shmctl(shmid, IPC_RMID, NULL);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
/* Allocation failed */
|
/* Allocation failed */
|
||||||
badSysCall = TRUE;
|
badSysCall = TRUE;
|
||||||
}
|
}
|
||||||
|
|
@ -210,6 +205,7 @@ static Bool
|
||||||
ShmCloseScreen(int i, ScreenPtr pScreen)
|
ShmCloseScreen(int i, ScreenPtr pScreen)
|
||||||
{
|
{
|
||||||
ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen);
|
ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen);
|
||||||
|
|
||||||
pScreen->CloseScreen = screen_priv->CloseScreen;
|
pScreen->CloseScreen = screen_priv->CloseScreen;
|
||||||
dixSetPrivate(&pScreen->devPrivates, shmScrPrivateKey, NULL);
|
dixSetPrivate(&pScreen->devPrivates, shmScrPrivateKey, NULL);
|
||||||
free(screen_priv);
|
free(screen_priv);
|
||||||
|
|
@ -220,8 +216,8 @@ static ShmScrPrivateRec *
|
||||||
ShmInitScreenPriv(ScreenPtr pScreen)
|
ShmInitScreenPriv(ScreenPtr pScreen)
|
||||||
{
|
{
|
||||||
ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen);
|
ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen);
|
||||||
if (!screen_priv)
|
|
||||||
{
|
if (!screen_priv) {
|
||||||
screen_priv = calloc(1, sizeof(ShmScrPrivateRec));
|
screen_priv = calloc(1, sizeof(ShmScrPrivateRec));
|
||||||
screen_priv->CloseScreen = pScreen->CloseScreen;
|
screen_priv->CloseScreen = pScreen->CloseScreen;
|
||||||
dixSetPrivate(&pScreen->devPrivates, shmScrPrivateKey, screen_priv);
|
dixSetPrivate(&pScreen->devPrivates, shmScrPrivateKey, screen_priv);
|
||||||
|
|
@ -240,11 +236,11 @@ ShmRegisterPrivates(void)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*ARGSUSED*/
|
/*ARGSUSED*/ static void
|
||||||
static void
|
|
||||||
ShmResetProc(ExtensionEntry * extEntry)
|
ShmResetProc(ExtensionEntry * extEntry)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < screenInfo.numScreens; i++)
|
for (i = 0; i < screenInfo.numScreens; i++)
|
||||||
ShmRegisterFuncs(screenInfo.screens[i], NULL);
|
ShmRegisterFuncs(screenInfo.screens[i], NULL);
|
||||||
}
|
}
|
||||||
|
|
@ -263,9 +259,10 @@ ShmDestroyPixmap (PixmapPtr pPixmap)
|
||||||
ScreenPtr pScreen = pPixmap->drawable.pScreen;
|
ScreenPtr pScreen = pPixmap->drawable.pScreen;
|
||||||
ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen);
|
ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen);
|
||||||
Bool ret;
|
Bool ret;
|
||||||
if (pPixmap->refcnt == 1)
|
|
||||||
{
|
if (pPixmap->refcnt == 1) {
|
||||||
ShmDescPtr shmdesc;
|
ShmDescPtr shmdesc;
|
||||||
|
|
||||||
shmdesc = (ShmDescPtr) dixLookupPrivate(&pPixmap->devPrivates,
|
shmdesc = (ShmDescPtr) dixLookupPrivate(&pPixmap->devPrivates,
|
||||||
shmPixmapPrivateKey);
|
shmPixmapPrivateKey);
|
||||||
if (shmdesc)
|
if (shmdesc)
|
||||||
|
|
@ -384,35 +381,29 @@ ProcShmAttach(ClientPtr client)
|
||||||
{
|
{
|
||||||
SHMSTAT_TYPE buf;
|
SHMSTAT_TYPE buf;
|
||||||
ShmDescPtr shmdesc;
|
ShmDescPtr shmdesc;
|
||||||
|
|
||||||
REQUEST(xShmAttachReq);
|
REQUEST(xShmAttachReq);
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xShmAttachReq);
|
REQUEST_SIZE_MATCH(xShmAttachReq);
|
||||||
LEGAL_NEW_RESOURCE(stuff->shmseg, client);
|
LEGAL_NEW_RESOURCE(stuff->shmseg, client);
|
||||||
if ((stuff->readOnly != xTrue) && (stuff->readOnly != xFalse))
|
if ((stuff->readOnly != xTrue) && (stuff->readOnly != xFalse)) {
|
||||||
{
|
|
||||||
client->errorValue = stuff->readOnly;
|
client->errorValue = stuff->readOnly;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
for (shmdesc = Shmsegs;
|
for (shmdesc = Shmsegs;
|
||||||
shmdesc && (shmdesc->shmid != stuff->shmid);
|
shmdesc && (shmdesc->shmid != stuff->shmid); shmdesc = shmdesc->next);
|
||||||
shmdesc = shmdesc->next)
|
if (shmdesc) {
|
||||||
;
|
|
||||||
if (shmdesc)
|
|
||||||
{
|
|
||||||
if (!stuff->readOnly && !shmdesc->writable)
|
if (!stuff->readOnly && !shmdesc->writable)
|
||||||
return BadAccess;
|
return BadAccess;
|
||||||
shmdesc->refcnt++;
|
shmdesc->refcnt++;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
shmdesc = malloc(sizeof(ShmDescRec));
|
shmdesc = malloc(sizeof(ShmDescRec));
|
||||||
if (!shmdesc)
|
if (!shmdesc)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
shmdesc->addr = shmat(stuff->shmid, 0,
|
shmdesc->addr = shmat(stuff->shmid, 0,
|
||||||
stuff->readOnly ? SHM_RDONLY : 0);
|
stuff->readOnly ? SHM_RDONLY : 0);
|
||||||
if ((shmdesc->addr == ((char *)-1)) ||
|
if ((shmdesc->addr == ((char *) -1)) || SHMSTAT(stuff->shmid, &buf)) {
|
||||||
SHMSTAT(stuff->shmid, &buf))
|
|
||||||
{
|
|
||||||
free(shmdesc);
|
free(shmdesc);
|
||||||
return BadAccess;
|
return BadAccess;
|
||||||
}
|
}
|
||||||
|
|
@ -439,8 +430,7 @@ ProcShmAttach(ClientPtr client)
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*ARGSUSED*/
|
/*ARGSUSED*/ static int
|
||||||
static int
|
|
||||||
ShmDetachSegment(pointer value, /* must conform to DeleteType */
|
ShmDetachSegment(pointer value, /* must conform to DeleteType */
|
||||||
XID shmseg)
|
XID shmseg)
|
||||||
{
|
{
|
||||||
|
|
@ -450,8 +440,7 @@ ShmDetachSegment(pointer value, /* must conform to DeleteType */
|
||||||
if (--shmdesc->refcnt)
|
if (--shmdesc->refcnt)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
shmdt(shmdesc->addr);
|
shmdt(shmdesc->addr);
|
||||||
for (prev = &Shmsegs; *prev != shmdesc; prev = &(*prev)->next)
|
for (prev = &Shmsegs; *prev != shmdesc; prev = &(*prev)->next);
|
||||||
;
|
|
||||||
*prev = shmdesc->next;
|
*prev = shmdesc->next;
|
||||||
free(shmdesc);
|
free(shmdesc);
|
||||||
return Success;
|
return Success;
|
||||||
|
|
@ -461,6 +450,7 @@ static int
|
||||||
ProcShmDetach(ClientPtr client)
|
ProcShmDetach(ClientPtr client)
|
||||||
{
|
{
|
||||||
ShmDescPtr shmdesc;
|
ShmDescPtr shmdesc;
|
||||||
|
|
||||||
REQUEST(xShmDetachReq);
|
REQUEST(xShmDetachReq);
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xShmDetachReq);
|
REQUEST_SIZE_MATCH(xShmDetachReq);
|
||||||
|
|
@ -484,13 +474,14 @@ doShmPutImage(DrawablePtr dst, GCPtr pGC,
|
||||||
if (format == ZPixmap || (format == XYPixmap && depth == 1)) {
|
if (format == ZPixmap || (format == XYPixmap && depth == 1)) {
|
||||||
pPixmap = GetScratchPixmapHeader(dst->pScreen, w, h, depth,
|
pPixmap = GetScratchPixmapHeader(dst->pScreen, w, h, depth,
|
||||||
BitsPerPixel(depth),
|
BitsPerPixel(depth),
|
||||||
PixmapBytePad(w, depth),
|
PixmapBytePad(w, depth), data);
|
||||||
data);
|
|
||||||
if (!pPixmap)
|
if (!pPixmap)
|
||||||
return;
|
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);
|
FreeScratchPixmapHeader(pPixmap);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
GCPtr putGC = GetScratchGC(depth, dst->pScreen);
|
GCPtr putGC = GetScratchGC(depth, dst->pScreen);
|
||||||
|
|
||||||
if (!putGC)
|
if (!putGC)
|
||||||
|
|
@ -503,15 +494,17 @@ doShmPutImage(DrawablePtr dst, GCPtr pGC,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ValidateGC(&pPixmap->drawable, putGC);
|
ValidateGC(&pPixmap->drawable, putGC);
|
||||||
(*putGC->ops->PutImage)(&pPixmap->drawable, putGC, depth, -sx, -sy, w, h, 0,
|
(*putGC->ops->PutImage) (&pPixmap->drawable, putGC, depth, -sx, -sy, w,
|
||||||
(format == XYPixmap) ? XYPixmap : ZPixmap, data);
|
h, 0,
|
||||||
|
(format == XYPixmap) ? XYPixmap : ZPixmap,
|
||||||
|
data);
|
||||||
FreeScratchGC(putGC);
|
FreeScratchGC(putGC);
|
||||||
if (format == XYBitmap)
|
if (format == XYBitmap)
|
||||||
(void)(*pGC->ops->CopyPlane)(&pPixmap->drawable, dst, pGC, 0, 0, sw, sh,
|
(void) (*pGC->ops->CopyPlane) (&pPixmap->drawable, dst, pGC, 0, 0,
|
||||||
dx, dy, 1L);
|
sw, sh, dx, dy, 1L);
|
||||||
else
|
else
|
||||||
(void)(*pGC->ops->CopyArea)(&pPixmap->drawable, dst, pGC, 0, 0, sw, sh,
|
(void) (*pGC->ops->CopyArea) (&pPixmap->drawable, dst, pGC, 0, 0,
|
||||||
dx, dy);
|
sw, sh, dx, dy);
|
||||||
(*pPixmap->drawable.pScreen->DestroyPixmap) (pPixmap);
|
(*pPixmap->drawable.pScreen->DestroyPixmap) (pPixmap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -523,6 +516,7 @@ ProcShmPutImage(ClientPtr client)
|
||||||
DrawablePtr pDraw;
|
DrawablePtr pDraw;
|
||||||
long length;
|
long length;
|
||||||
ShmDescPtr shmdesc;
|
ShmDescPtr shmdesc;
|
||||||
|
|
||||||
REQUEST(xShmPutImageReq);
|
REQUEST(xShmPutImageReq);
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xShmPutImageReq);
|
REQUEST_SIZE_MATCH(xShmPutImageReq);
|
||||||
|
|
@ -530,27 +524,23 @@ ProcShmPutImage(ClientPtr client)
|
||||||
VERIFY_SHMPTR(stuff->shmseg, stuff->offset, FALSE, shmdesc, client);
|
VERIFY_SHMPTR(stuff->shmseg, stuff->offset, FALSE, shmdesc, client);
|
||||||
if ((stuff->sendEvent != xTrue) && (stuff->sendEvent != xFalse))
|
if ((stuff->sendEvent != xTrue) && (stuff->sendEvent != xFalse))
|
||||||
return BadValue;
|
return BadValue;
|
||||||
if (stuff->format == XYBitmap)
|
if (stuff->format == XYBitmap) {
|
||||||
{
|
|
||||||
if (stuff->depth != 1)
|
if (stuff->depth != 1)
|
||||||
return BadMatch;
|
return BadMatch;
|
||||||
length = PixmapBytePad(stuff->totalWidth, 1);
|
length = PixmapBytePad(stuff->totalWidth, 1);
|
||||||
}
|
}
|
||||||
else if (stuff->format == XYPixmap)
|
else if (stuff->format == XYPixmap) {
|
||||||
{
|
|
||||||
if (pDraw->depth != stuff->depth)
|
if (pDraw->depth != stuff->depth)
|
||||||
return BadMatch;
|
return BadMatch;
|
||||||
length = PixmapBytePad(stuff->totalWidth, 1);
|
length = PixmapBytePad(stuff->totalWidth, 1);
|
||||||
length *= stuff->depth;
|
length *= stuff->depth;
|
||||||
}
|
}
|
||||||
else if (stuff->format == ZPixmap)
|
else if (stuff->format == ZPixmap) {
|
||||||
{
|
|
||||||
if (pDraw->depth != stuff->depth)
|
if (pDraw->depth != stuff->depth)
|
||||||
return BadMatch;
|
return BadMatch;
|
||||||
length = PixmapBytePad(stuff->totalWidth, stuff->depth);
|
length = PixmapBytePad(stuff->totalWidth, stuff->depth);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
client->errorValue = stuff->format;
|
client->errorValue = stuff->format;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
|
@ -566,23 +556,19 @@ ProcShmPutImage(ClientPtr client)
|
||||||
client->errorValue = stuff->totalWidth;
|
client->errorValue = stuff->totalWidth;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
if (stuff->srcX > stuff->totalWidth)
|
if (stuff->srcX > stuff->totalWidth) {
|
||||||
{
|
|
||||||
client->errorValue = stuff->srcX;
|
client->errorValue = stuff->srcX;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
if (stuff->srcY > stuff->totalHeight)
|
if (stuff->srcY > stuff->totalHeight) {
|
||||||
{
|
|
||||||
client->errorValue = stuff->srcY;
|
client->errorValue = stuff->srcY;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
if ((stuff->srcX + stuff->srcWidth) > stuff->totalWidth)
|
if ((stuff->srcX + stuff->srcWidth) > stuff->totalWidth) {
|
||||||
{
|
|
||||||
client->errorValue = stuff->srcWidth;
|
client->errorValue = stuff->srcWidth;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
if ((stuff->srcY + stuff->srcHeight) > stuff->totalHeight)
|
if ((stuff->srcY + stuff->srcHeight) > stuff->totalHeight) {
|
||||||
{
|
|
||||||
client->errorValue = stuff->srcHeight;
|
client->errorValue = stuff->srcHeight;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
|
@ -605,11 +591,9 @@ ProcShmPutImage(ClientPtr client)
|
||||||
stuff->totalWidth, stuff->totalHeight,
|
stuff->totalWidth, stuff->totalHeight,
|
||||||
stuff->srcX, stuff->srcY,
|
stuff->srcX, stuff->srcY,
|
||||||
stuff->srcWidth, stuff->srcHeight,
|
stuff->srcWidth, stuff->srcHeight,
|
||||||
stuff->dstX, stuff->dstY,
|
stuff->dstX, stuff->dstY, shmdesc->addr + stuff->offset);
|
||||||
shmdesc->addr + stuff->offset);
|
|
||||||
|
|
||||||
if (stuff->sendEvent)
|
if (stuff->sendEvent) {
|
||||||
{
|
|
||||||
xShmCompletionEvent ev;
|
xShmCompletionEvent ev;
|
||||||
|
|
||||||
ev.type = ShmCompletionCode;
|
ev.type = ShmCompletionCode;
|
||||||
|
|
@ -637,43 +621,37 @@ ProcShmGetImage(ClientPtr client)
|
||||||
REQUEST(xShmGetImageReq);
|
REQUEST(xShmGetImageReq);
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xShmGetImageReq);
|
REQUEST_SIZE_MATCH(xShmGetImageReq);
|
||||||
if ((stuff->format != XYPixmap) && (stuff->format != ZPixmap))
|
if ((stuff->format != XYPixmap) && (stuff->format != ZPixmap)) {
|
||||||
{
|
|
||||||
client->errorValue = stuff->format;
|
client->errorValue = stuff->format;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
|
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, DixReadAccess);
|
||||||
DixReadAccess);
|
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client);
|
VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client);
|
||||||
if (pDraw->type == DRAWABLE_WINDOW)
|
if (pDraw->type == DRAWABLE_WINDOW) {
|
||||||
{
|
|
||||||
if ( /* check for being viewable */
|
if ( /* check for being viewable */
|
||||||
!((WindowPtr) pDraw)->realized ||
|
!((WindowPtr) pDraw)->realized ||
|
||||||
/* check for being on screen */
|
/* check for being on screen */
|
||||||
pDraw->x + stuff->x < 0 ||
|
pDraw->x + stuff->x < 0 ||
|
||||||
pDraw->x + stuff->x + (int)stuff->width > pDraw->pScreen->width ||
|
pDraw->x + stuff->x + (int) stuff->width > pDraw->pScreen->width
|
||||||
pDraw->y + stuff->y < 0 ||
|
|| pDraw->y + stuff->y < 0 ||
|
||||||
pDraw->y + stuff->y + (int)stuff->height > pDraw->pScreen->height ||
|
pDraw->y + stuff->y + (int) stuff->height >
|
||||||
|
pDraw->pScreen->height ||
|
||||||
/* check for being inside of border */
|
/* check for being inside of border */
|
||||||
stuff->x < -wBorderWidth((WindowPtr) pDraw) ||
|
stuff->x < -wBorderWidth((WindowPtr) pDraw) ||
|
||||||
stuff->x + (int) stuff->width >
|
stuff->x + (int) stuff->width >
|
||||||
wBorderWidth((WindowPtr) pDraw) + (int) pDraw->width ||
|
wBorderWidth((WindowPtr) pDraw) + (int) pDraw->width ||
|
||||||
stuff->y < -wBorderWidth((WindowPtr) pDraw) ||
|
stuff->y < -wBorderWidth((WindowPtr) pDraw) ||
|
||||||
stuff->y + (int) stuff->height >
|
stuff->y + (int) stuff->height >
|
||||||
wBorderWidth((WindowPtr)pDraw) + (int)pDraw->height
|
wBorderWidth((WindowPtr) pDraw) + (int) pDraw->height)
|
||||||
)
|
|
||||||
return BadMatch;
|
return BadMatch;
|
||||||
xgi.visual = wVisual(((WindowPtr) pDraw));
|
xgi.visual = wVisual(((WindowPtr) pDraw));
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
if (stuff->x < 0 ||
|
if (stuff->x < 0 ||
|
||||||
stuff->x + (int) stuff->width > pDraw->width ||
|
stuff->x + (int) stuff->width > pDraw->width ||
|
||||||
stuff->y < 0 ||
|
stuff->y < 0 || stuff->y + (int) stuff->height > pDraw->height)
|
||||||
stuff->y+(int)stuff->height > pDraw->height
|
|
||||||
)
|
|
||||||
return BadMatch;
|
return BadMatch;
|
||||||
xgi.visual = None;
|
xgi.visual = None;
|
||||||
}
|
}
|
||||||
|
|
@ -681,12 +659,10 @@ ProcShmGetImage(ClientPtr client)
|
||||||
xgi.length = 0;
|
xgi.length = 0;
|
||||||
xgi.sequenceNumber = client->sequence;
|
xgi.sequenceNumber = client->sequence;
|
||||||
xgi.depth = pDraw->depth;
|
xgi.depth = pDraw->depth;
|
||||||
if(stuff->format == ZPixmap)
|
if (stuff->format == ZPixmap) {
|
||||||
{
|
|
||||||
length = PixmapBytePad(stuff->width, pDraw->depth) * stuff->height;
|
length = PixmapBytePad(stuff->width, pDraw->depth) * stuff->height;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
lenPer = PixmapBytePad(stuff->width, 1) * stuff->height;
|
lenPer = PixmapBytePad(stuff->width, 1) * stuff->height;
|
||||||
plane = ((Mask) 1) << (pDraw->depth - 1);
|
plane = ((Mask) 1) << (pDraw->depth - 1);
|
||||||
/* only planes asked for */
|
/* only planes asked for */
|
||||||
|
|
@ -696,25 +672,20 @@ ProcShmGetImage(ClientPtr client)
|
||||||
VERIFY_SHMSIZE(shmdesc, stuff->offset, length, client);
|
VERIFY_SHMSIZE(shmdesc, stuff->offset, length, client);
|
||||||
xgi.size = length;
|
xgi.size = length;
|
||||||
|
|
||||||
if (length == 0)
|
if (length == 0) {
|
||||||
{
|
|
||||||
/* nothing to do */
|
/* nothing to do */
|
||||||
}
|
}
|
||||||
else if (stuff->format == ZPixmap)
|
else if (stuff->format == ZPixmap) {
|
||||||
{
|
|
||||||
(*pDraw->pScreen->GetImage) (pDraw, stuff->x, stuff->y,
|
(*pDraw->pScreen->GetImage) (pDraw, stuff->x, stuff->y,
|
||||||
stuff->width, stuff->height,
|
stuff->width, stuff->height,
|
||||||
stuff->format, stuff->planeMask,
|
stuff->format, stuff->planeMask,
|
||||||
shmdesc->addr + stuff->offset);
|
shmdesc->addr + stuff->offset);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
|
|
||||||
length = stuff->offset;
|
length = stuff->offset;
|
||||||
for (; plane; plane >>= 1)
|
for (; plane; plane >>= 1) {
|
||||||
{
|
if (stuff->planeMask & plane) {
|
||||||
if (stuff->planeMask & plane)
|
|
||||||
{
|
|
||||||
(*pDraw->pScreen->GetImage) (pDraw,
|
(*pDraw->pScreen->GetImage) (pDraw,
|
||||||
stuff->x, stuff->y,
|
stuff->x, stuff->y,
|
||||||
stuff->width, stuff->height,
|
stuff->width, stuff->height,
|
||||||
|
|
@ -764,7 +735,8 @@ ProcPanoramiXShmPutImage(ClientPtr client)
|
||||||
sendEvent = stuff->sendEvent;
|
sendEvent = stuff->sendEvent;
|
||||||
stuff->sendEvent = 0;
|
stuff->sendEvent = 0;
|
||||||
FOR_NSCREENS(j) {
|
FOR_NSCREENS(j) {
|
||||||
if(!j) stuff->sendEvent = sendEvent;
|
if (!j)
|
||||||
|
stuff->sendEvent = sendEvent;
|
||||||
stuff->drawable = draw->info[j].id;
|
stuff->drawable = draw->info[j].id;
|
||||||
stuff->gc = gc->info[j].id;
|
stuff->gc = gc->info[j].id;
|
||||||
if (isRoot) {
|
if (isRoot) {
|
||||||
|
|
@ -772,7 +744,8 @@ ProcPanoramiXShmPutImage(ClientPtr client)
|
||||||
stuff->dstY = orig_y - screenInfo.screens[j]->y;
|
stuff->dstY = orig_y - screenInfo.screens[j]->y;
|
||||||
}
|
}
|
||||||
result = ProcShmPutImage(client);
|
result = ProcShmPutImage(client);
|
||||||
if(result != Success) break;
|
if (result != Success)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
@ -807,8 +780,7 @@ ProcPanoramiXShmGetImage(ClientPtr client)
|
||||||
if (draw->type == XRT_PIXMAP)
|
if (draw->type == XRT_PIXMAP)
|
||||||
return ProcShmGetImage(client);
|
return ProcShmGetImage(client);
|
||||||
|
|
||||||
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
|
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, DixReadAccess);
|
||||||
DixReadAccess);
|
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
|
|
@ -828,12 +800,14 @@ ProcPanoramiXShmGetImage(ClientPtr client)
|
||||||
x < 0 || x + w > PanoramiXPixWidth ||
|
x < 0 || x + w > PanoramiXPixWidth ||
|
||||||
y < 0 || y + h > PanoramiXPixHeight)
|
y < 0 || y + h > PanoramiXPixHeight)
|
||||||
return BadMatch;
|
return BadMatch;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
if ( /* check for being onscreen */
|
if ( /* check for being onscreen */
|
||||||
screenInfo.screens[0]->x + pDraw->x + x < 0 ||
|
screenInfo.screens[0]->x + pDraw->x + x < 0 ||
|
||||||
screenInfo.screens[0]->x + pDraw->x + x + w > PanoramiXPixWidth ||
|
screenInfo.screens[0]->x + pDraw->x + x + w > PanoramiXPixWidth
|
||||||
screenInfo.screens[0]->y + pDraw->y + y < 0 ||
|
|| screenInfo.screens[0]->y + pDraw->y + y < 0 ||
|
||||||
screenInfo.screens[0]->y + pDraw->y + y + h > PanoramiXPixHeight ||
|
screenInfo.screens[0]->y + pDraw->y + y + h > PanoramiXPixHeight
|
||||||
|
||
|
||||||
/* check for being inside of border */
|
/* check for being inside of border */
|
||||||
x < -wBorderWidth((WindowPtr) pDraw) ||
|
x < -wBorderWidth((WindowPtr) pDraw) ||
|
||||||
x + w > wBorderWidth((WindowPtr) pDraw) + (int) pDraw->width ||
|
x + w > wBorderWidth((WindowPtr) pDraw) + (int) pDraw->width ||
|
||||||
|
|
@ -850,8 +824,7 @@ ProcPanoramiXShmGetImage(ClientPtr client)
|
||||||
FOR_NSCREENS_FORWARD_SKIP(i) {
|
FOR_NSCREENS_FORWARD_SKIP(i) {
|
||||||
rc = dixLookupDrawable(drawables + i, draw->info[i].id, client, 0,
|
rc = dixLookupDrawable(drawables + i, draw->info[i].id, client, 0,
|
||||||
DixReadAccess);
|
DixReadAccess);
|
||||||
if (rc != Success)
|
if (rc != Success) {
|
||||||
{
|
|
||||||
free(drawables);
|
free(drawables);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
@ -866,7 +839,8 @@ ProcPanoramiXShmGetImage(ClientPtr client)
|
||||||
if (format == ZPixmap) {
|
if (format == ZPixmap) {
|
||||||
widthBytesLine = PixmapBytePad(w, pDraw->depth);
|
widthBytesLine = PixmapBytePad(w, pDraw->depth);
|
||||||
length = widthBytesLine * h;
|
length = widthBytesLine * h;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
widthBytesLine = PixmapBytePad(w, 1);
|
widthBytesLine = PixmapBytePad(w, 1);
|
||||||
lenPer = widthBytesLine * h;
|
lenPer = widthBytesLine * h;
|
||||||
plane = ((Mask) 1) << (pDraw->depth - 1);
|
plane = ((Mask) 1) << (pDraw->depth - 1);
|
||||||
|
|
@ -876,12 +850,14 @@ ProcPanoramiXShmGetImage(ClientPtr client)
|
||||||
VERIFY_SHMSIZE(shmdesc, stuff->offset, length, client);
|
VERIFY_SHMSIZE(shmdesc, stuff->offset, length, client);
|
||||||
xgi.size = length;
|
xgi.size = length;
|
||||||
|
|
||||||
if (length == 0) {/* nothing to do */ }
|
if (length == 0) { /* nothing to do */
|
||||||
|
}
|
||||||
else if (format == ZPixmap) {
|
else if (format == ZPixmap) {
|
||||||
XineramaGetImageData(drawables, x, y, w, h, format, planemask,
|
XineramaGetImageData(drawables, x, y, w, h, format, planemask,
|
||||||
shmdesc->addr + stuff->offset,
|
shmdesc->addr + stuff->offset,
|
||||||
widthBytesLine, isRoot);
|
widthBytesLine, isRoot);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
length = stuff->offset;
|
length = stuff->offset;
|
||||||
for (; plane; plane >>= 1) {
|
for (; plane; plane >>= 1) {
|
||||||
|
|
@ -915,6 +891,7 @@ ProcPanoramiXShmCreatePixmap(ClientPtr client)
|
||||||
DepthPtr pDepth;
|
DepthPtr pDepth;
|
||||||
int i, j, result, rc;
|
int i, j, result, rc;
|
||||||
ShmDescPtr shmdesc;
|
ShmDescPtr shmdesc;
|
||||||
|
|
||||||
REQUEST(xShmCreatePixmapReq);
|
REQUEST(xShmCreatePixmapReq);
|
||||||
unsigned int width, height, depth;
|
unsigned int width, height, depth;
|
||||||
unsigned long size;
|
unsigned long size;
|
||||||
|
|
@ -935,16 +912,14 @@ ProcPanoramiXShmCreatePixmap(ClientPtr client)
|
||||||
width = stuff->width;
|
width = stuff->width;
|
||||||
height = stuff->height;
|
height = stuff->height;
|
||||||
depth = stuff->depth;
|
depth = stuff->depth;
|
||||||
if (!width || !height || !depth)
|
if (!width || !height || !depth) {
|
||||||
{
|
|
||||||
client->errorValue = 0;
|
client->errorValue = 0;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
if (width > 32767 || height > 32767)
|
if (width > 32767 || height > 32767)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
|
||||||
if (stuff->depth != 1)
|
if (stuff->depth != 1) {
|
||||||
{
|
|
||||||
pDepth = pDraw->pScreen->allowedDepths;
|
pDepth = pDraw->pScreen->allowedDepths;
|
||||||
for (i = 0; i < pDraw->pScreen->numDepths; i++, pDepth++)
|
for (i = 0; i < pDraw->pScreen->numDepths; i++, pDepth++)
|
||||||
if (pDepth->depth == stuff->depth)
|
if (pDepth->depth == stuff->depth)
|
||||||
|
|
@ -976,12 +951,16 @@ CreatePmap:
|
||||||
|
|
||||||
FOR_NSCREENS(j) {
|
FOR_NSCREENS(j) {
|
||||||
ShmScrPrivateRec *screen_priv;
|
ShmScrPrivateRec *screen_priv;
|
||||||
|
|
||||||
pScreen = screenInfo.screens[j];
|
pScreen = screenInfo.screens[j];
|
||||||
|
|
||||||
screen_priv = ShmGetScreenPriv(pScreen);
|
screen_priv = ShmGetScreenPriv(pScreen);
|
||||||
pMap = (*screen_priv->shmFuncs->CreatePixmap) (pScreen,
|
pMap = (*screen_priv->shmFuncs->CreatePixmap) (pScreen,
|
||||||
stuff->width, stuff->height, stuff->depth,
|
stuff->width,
|
||||||
shmdesc->addr + stuff->offset);
|
stuff->height,
|
||||||
|
stuff->depth,
|
||||||
|
shmdesc->addr +
|
||||||
|
stuff->offset);
|
||||||
|
|
||||||
if (pMap) {
|
if (pMap) {
|
||||||
dixSetPrivate(&pMap->devPrivates, shmPixmapPrivateKey, shmdesc);
|
dixSetPrivate(&pMap->devPrivates, shmPixmapPrivateKey, shmdesc);
|
||||||
|
|
@ -992,7 +971,8 @@ CreatePmap:
|
||||||
result = BadAlloc;
|
result = BadAlloc;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
result = BadAlloc;
|
result = BadAlloc;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -1002,7 +982,8 @@ CreatePmap:
|
||||||
while (j--)
|
while (j--)
|
||||||
FreeResource(newPix->info[j].id, RT_NONE);
|
FreeResource(newPix->info[j].id, RT_NONE);
|
||||||
free(newPix);
|
free(newPix);
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
AddResource(stuff->pid, XRT_PIXMAP, newPix);
|
AddResource(stuff->pid, XRT_PIXMAP, newPix);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
@ -1020,7 +1001,9 @@ fbShmCreatePixmap (ScreenPtr pScreen,
|
||||||
return NullPixmap;
|
return NullPixmap;
|
||||||
|
|
||||||
if (!(*pScreen->ModifyPixmapHeader) (pPixmap, width, height, depth,
|
if (!(*pScreen->ModifyPixmapHeader) (pPixmap, width, height, depth,
|
||||||
BitsPerPixel(depth), PixmapBytePad(width, depth), (pointer)addr)) {
|
BitsPerPixel(depth),
|
||||||
|
PixmapBytePad(width, depth),
|
||||||
|
(pointer) addr)) {
|
||||||
(*pScreen->DestroyPixmap) (pPixmap);
|
(*pScreen->DestroyPixmap) (pPixmap);
|
||||||
return NullPixmap;
|
return NullPixmap;
|
||||||
}
|
}
|
||||||
|
|
@ -1036,6 +1019,7 @@ ProcShmCreatePixmap(ClientPtr client)
|
||||||
int i, rc;
|
int i, rc;
|
||||||
ShmDescPtr shmdesc;
|
ShmDescPtr shmdesc;
|
||||||
ShmScrPrivateRec *screen_priv;
|
ShmScrPrivateRec *screen_priv;
|
||||||
|
|
||||||
REQUEST(xShmCreatePixmapReq);
|
REQUEST(xShmCreatePixmapReq);
|
||||||
unsigned int width, height, depth;
|
unsigned int width, height, depth;
|
||||||
unsigned long size;
|
unsigned long size;
|
||||||
|
|
@ -1055,16 +1039,14 @@ ProcShmCreatePixmap(ClientPtr client)
|
||||||
width = stuff->width;
|
width = stuff->width;
|
||||||
height = stuff->height;
|
height = stuff->height;
|
||||||
depth = stuff->depth;
|
depth = stuff->depth;
|
||||||
if (!width || !height || !depth)
|
if (!width || !height || !depth) {
|
||||||
{
|
|
||||||
client->errorValue = 0;
|
client->errorValue = 0;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
if (width > 32767 || height > 32767)
|
if (width > 32767 || height > 32767)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
|
||||||
if (stuff->depth != 1)
|
if (stuff->depth != 1) {
|
||||||
{
|
|
||||||
pDepth = pDraw->pScreen->allowedDepths;
|
pDepth = pDraw->pScreen->allowedDepths;
|
||||||
for (i = 0; i < pDraw->pScreen->numDepths; i++, pDepth++)
|
for (i = 0; i < pDraw->pScreen->numDepths; i++, pDepth++)
|
||||||
if (pDepth->depth == stuff->depth)
|
if (pDepth->depth == stuff->depth)
|
||||||
|
|
@ -1085,12 +1067,11 @@ CreatePmap:
|
||||||
|
|
||||||
VERIFY_SHMSIZE(shmdesc, stuff->offset, size, client);
|
VERIFY_SHMSIZE(shmdesc, stuff->offset, size, client);
|
||||||
screen_priv = ShmGetScreenPriv(pDraw->pScreen);
|
screen_priv = ShmGetScreenPriv(pDraw->pScreen);
|
||||||
pMap = (*screen_priv->shmFuncs->CreatePixmap)(
|
pMap = (*screen_priv->shmFuncs->CreatePixmap) (pDraw->pScreen, stuff->width,
|
||||||
pDraw->pScreen, stuff->width,
|
|
||||||
stuff->height, stuff->depth,
|
stuff->height, stuff->depth,
|
||||||
shmdesc->addr + stuff->offset);
|
shmdesc->addr +
|
||||||
if (pMap)
|
stuff->offset);
|
||||||
{
|
if (pMap) {
|
||||||
rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, RT_PIXMAP,
|
rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, RT_PIXMAP,
|
||||||
pMap, RT_NONE, NULL, DixCreateAccess);
|
pMap, RT_NONE, NULL, DixCreateAccess);
|
||||||
if (rc != Success) {
|
if (rc != Success) {
|
||||||
|
|
@ -1101,8 +1082,7 @@ CreatePmap:
|
||||||
shmdesc->refcnt++;
|
shmdesc->refcnt++;
|
||||||
pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
|
pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
|
||||||
pMap->drawable.id = stuff->pid;
|
pMap->drawable.id = stuff->pid;
|
||||||
if (AddResource(stuff->pid, RT_PIXMAP, (pointer)pMap))
|
if (AddResource(stuff->pid, RT_PIXMAP, (pointer) pMap)) {
|
||||||
{
|
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1113,8 +1093,7 @@ static int
|
||||||
ProcShmDispatch(ClientPtr client)
|
ProcShmDispatch(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xReq);
|
REQUEST(xReq);
|
||||||
switch (stuff->data)
|
switch (stuff->data) {
|
||||||
{
|
|
||||||
case X_ShmQueryVersion:
|
case X_ShmQueryVersion:
|
||||||
return ProcShmQueryVersion(client);
|
return ProcShmQueryVersion(client);
|
||||||
case X_ShmAttach:
|
case X_ShmAttach:
|
||||||
|
|
@ -1243,8 +1222,7 @@ static int
|
||||||
SProcShmDispatch(ClientPtr client)
|
SProcShmDispatch(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xReq);
|
REQUEST(xReq);
|
||||||
switch (stuff->data)
|
switch (stuff->data) {
|
||||||
{
|
|
||||||
case X_ShmQueryVersion:
|
case X_ShmQueryVersion:
|
||||||
return SProcShmQueryVersion(client);
|
return SProcShmQueryVersion(client);
|
||||||
case X_ShmAttach:
|
case X_ShmAttach:
|
||||||
|
|
@ -1269,8 +1247,7 @@ ShmExtensionInit(INITARGS)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
#ifdef MUST_CHECK_FOR_SHM_SYSCALL
|
#ifdef MUST_CHECK_FOR_SHM_SYSCALL
|
||||||
if (!CheckForShmSyscall())
|
if (!CheckForShmSyscall()) {
|
||||||
{
|
|
||||||
ErrorF("MIT-SHM extension disabled due to lack of kernel support\n");
|
ErrorF("MIT-SHM extension disabled due to lack of kernel support\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1282,19 +1259,20 @@ ShmExtensionInit(INITARGS)
|
||||||
sharedPixmaps = xFalse;
|
sharedPixmaps = xFalse;
|
||||||
{
|
{
|
||||||
sharedPixmaps = xTrue;
|
sharedPixmaps = xTrue;
|
||||||
for (i = 0; i < screenInfo.numScreens; i++)
|
for (i = 0; i < screenInfo.numScreens; i++) {
|
||||||
{
|
ShmScrPrivateRec *screen_priv =
|
||||||
ShmScrPrivateRec *screen_priv = ShmInitScreenPriv(screenInfo.screens[i]);
|
ShmInitScreenPriv(screenInfo.screens[i]);
|
||||||
if (!screen_priv->shmFuncs)
|
if (!screen_priv->shmFuncs)
|
||||||
screen_priv->shmFuncs = &miFuncs;
|
screen_priv->shmFuncs = &miFuncs;
|
||||||
if (!screen_priv->shmFuncs->CreatePixmap)
|
if (!screen_priv->shmFuncs->CreatePixmap)
|
||||||
sharedPixmaps = xFalse;
|
sharedPixmaps = xFalse;
|
||||||
}
|
}
|
||||||
if (sharedPixmaps)
|
if (sharedPixmaps)
|
||||||
for (i = 0; i < screenInfo.numScreens; i++)
|
for (i = 0; i < screenInfo.numScreens; i++) {
|
||||||
{
|
ShmScrPrivateRec *screen_priv =
|
||||||
ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(screenInfo.screens[i]);
|
ShmGetScreenPriv(screenInfo.screens[i]);
|
||||||
screen_priv->destroyPixmap = screenInfo.screens[i]->DestroyPixmap;
|
screen_priv->destroyPixmap =
|
||||||
|
screenInfo.screens[i]->DestroyPixmap;
|
||||||
screenInfo.screens[i]->DestroyPixmap = ShmDestroyPixmap;
|
screenInfo.screens[i]->DestroyPixmap = ShmDestroyPixmap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1302,8 +1280,7 @@ ShmExtensionInit(INITARGS)
|
||||||
if (ShmSegType &&
|
if (ShmSegType &&
|
||||||
(extEntry = AddExtension(SHMNAME, ShmNumberEvents, ShmNumberErrors,
|
(extEntry = AddExtension(SHMNAME, ShmNumberEvents, ShmNumberErrors,
|
||||||
ProcShmDispatch, SProcShmDispatch,
|
ProcShmDispatch, SProcShmDispatch,
|
||||||
ShmResetProc, StandardMinorOpcode)))
|
ShmResetProc, StandardMinorOpcode))) {
|
||||||
{
|
|
||||||
ShmReqCode = (unsigned char) extEntry->base;
|
ShmReqCode = (unsigned char) extEntry->base;
|
||||||
ShmCompletionCode = extEntry->eventBase;
|
ShmCompletionCode = extEntry->eventBase;
|
||||||
BadShmSegCode = extEntry->errorBase;
|
BadShmSegCode = extEntry->errorBase;
|
||||||
|
|
|
||||||
|
|
@ -45,8 +45,7 @@ typedef struct _Sertafied {
|
||||||
TimeStamp revive;
|
TimeStamp revive;
|
||||||
ClientPtr pClient;
|
ClientPtr pClient;
|
||||||
XID id;
|
XID id;
|
||||||
void (*notifyFunc)(
|
void (*notifyFunc) (ClientPtr /* client */ ,
|
||||||
ClientPtr /* client */,
|
|
||||||
pointer /* closure */
|
pointer /* closure */
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -58,21 +57,17 @@ static RESTYPE SertafiedResType;
|
||||||
static Bool BlockHandlerRegistered;
|
static Bool BlockHandlerRegistered;
|
||||||
static int SertafiedGeneration;
|
static int SertafiedGeneration;
|
||||||
|
|
||||||
static void ClientAwaken(
|
static void ClientAwaken(ClientPtr /* client */ ,
|
||||||
ClientPtr /* client */,
|
|
||||||
pointer /* closure */
|
pointer /* closure */
|
||||||
);
|
);
|
||||||
static int SertafiedDelete(
|
static int SertafiedDelete(pointer /* value */ ,
|
||||||
pointer /* value */,
|
|
||||||
XID /* id */
|
XID /* id */
|
||||||
);
|
);
|
||||||
static void SertafiedBlockHandler(
|
static void SertafiedBlockHandler(pointer /* data */ ,
|
||||||
pointer /* data */,
|
|
||||||
OSTimePtr /* wt */ ,
|
OSTimePtr /* wt */ ,
|
||||||
pointer /* LastSelectMask */
|
pointer /* LastSelectMask */
|
||||||
);
|
);
|
||||||
static void SertafiedWakeupHandler(
|
static void SertafiedWakeupHandler(pointer /* data */ ,
|
||||||
pointer /* data */,
|
|
||||||
int /* i */ ,
|
int /* i */ ,
|
||||||
pointer /* LastSelectMask */
|
pointer /* LastSelectMask */
|
||||||
);
|
);
|
||||||
|
|
@ -80,13 +75,11 @@ static void SertafiedWakeupHandler(
|
||||||
int
|
int
|
||||||
ClientSleepUntil(ClientPtr client,
|
ClientSleepUntil(ClientPtr client,
|
||||||
TimeStamp *revive,
|
TimeStamp *revive,
|
||||||
void (*notifyFunc)(ClientPtr, pointer),
|
void (*notifyFunc) (ClientPtr, pointer), pointer closure)
|
||||||
pointer closure)
|
|
||||||
{
|
{
|
||||||
SertafiedPtr pRequest, pReq, pPrev;
|
SertafiedPtr pRequest, pReq, pPrev;
|
||||||
|
|
||||||
if (SertafiedGeneration != serverGeneration)
|
if (SertafiedGeneration != serverGeneration) {
|
||||||
{
|
|
||||||
SertafiedResType = CreateNewResourceType(SertafiedDelete,
|
SertafiedResType = CreateNewResourceType(SertafiedDelete,
|
||||||
"ClientSleep");
|
"ClientSleep");
|
||||||
if (!SertafiedResType)
|
if (!SertafiedResType)
|
||||||
|
|
@ -101,12 +94,10 @@ ClientSleepUntil (ClientPtr client,
|
||||||
pRequest->revive = *revive;
|
pRequest->revive = *revive;
|
||||||
pRequest->id = FakeClientID(client->index);
|
pRequest->id = FakeClientID(client->index);
|
||||||
pRequest->closure = closure;
|
pRequest->closure = closure;
|
||||||
if (!BlockHandlerRegistered)
|
if (!BlockHandlerRegistered) {
|
||||||
{
|
|
||||||
if (!RegisterBlockAndWakeupHandlers(SertafiedBlockHandler,
|
if (!RegisterBlockAndWakeupHandlers(SertafiedBlockHandler,
|
||||||
SertafiedWakeupHandler,
|
SertafiedWakeupHandler,
|
||||||
(pointer) 0))
|
(pointer) 0)) {
|
||||||
{
|
|
||||||
free(pRequest);
|
free(pRequest);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
@ -120,8 +111,7 @@ ClientSleepUntil (ClientPtr client,
|
||||||
pRequest->notifyFunc = notifyFunc;
|
pRequest->notifyFunc = notifyFunc;
|
||||||
/* Insert into time-ordered queue, with earliest activation time coming first. */
|
/* Insert into time-ordered queue, with earliest activation time coming first. */
|
||||||
pPrev = 0;
|
pPrev = 0;
|
||||||
for (pReq = pPending; pReq; pReq = pReq->next)
|
for (pReq = pPending; pReq; pReq = pReq->next) {
|
||||||
{
|
|
||||||
if (CompareTimeStamps(pReq->revive, *revive) == LATER)
|
if (CompareTimeStamps(pReq->revive, *revive) == LATER)
|
||||||
break;
|
break;
|
||||||
pPrev = pReq;
|
pPrev = pReq;
|
||||||
|
|
@ -142,7 +132,6 @@ ClientAwaken (ClientPtr client, pointer closure)
|
||||||
AttendClient(client);
|
AttendClient(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
SertafiedDelete(pointer value, XID id)
|
SertafiedDelete(pointer value, XID id)
|
||||||
{
|
{
|
||||||
|
|
@ -151,8 +140,7 @@ SertafiedDelete (pointer value, XID id)
|
||||||
|
|
||||||
pPrev = 0;
|
pPrev = 0;
|
||||||
for (pReq = pPending; pReq; pPrev = pReq, pReq = pReq->next)
|
for (pReq = pPending; pReq; pPrev = pReq, pReq = pReq->next)
|
||||||
if (pReq == pRequest)
|
if (pReq == pRequest) {
|
||||||
{
|
|
||||||
if (pPrev)
|
if (pPrev)
|
||||||
pPrev->next = pReq->next;
|
pPrev->next = pReq->next;
|
||||||
else
|
else
|
||||||
|
|
@ -178,8 +166,7 @@ SertafiedBlockHandler (pointer data, OSTimePtr wt, pointer LastSelectMask)
|
||||||
now.months = currentTime.months;
|
now.months = currentTime.months;
|
||||||
if ((int) (now.milliseconds - currentTime.milliseconds) < 0)
|
if ((int) (now.milliseconds - currentTime.milliseconds) < 0)
|
||||||
now.months++;
|
now.months++;
|
||||||
for (pReq = pPending; pReq; pReq = pNext)
|
for (pReq = pPending; pReq; pReq = pNext) {
|
||||||
{
|
|
||||||
pNext = pReq->next;
|
pNext = pReq->next;
|
||||||
if (CompareTimeStamps(pReq->revive, now) == LATER)
|
if (CompareTimeStamps(pReq->revive, now) == LATER)
|
||||||
break;
|
break;
|
||||||
|
|
@ -208,18 +195,15 @@ SertafiedWakeupHandler (pointer data, int i, pointer LastSelectMask)
|
||||||
now.months = currentTime.months;
|
now.months = currentTime.months;
|
||||||
if ((int) (now.milliseconds - currentTime.milliseconds) < 0)
|
if ((int) (now.milliseconds - currentTime.milliseconds) < 0)
|
||||||
now.months++;
|
now.months++;
|
||||||
for (pReq = pPending; pReq; pReq = pNext)
|
for (pReq = pPending; pReq; pReq = pNext) {
|
||||||
{
|
|
||||||
pNext = pReq->next;
|
pNext = pReq->next;
|
||||||
if (CompareTimeStamps(pReq->revive, now) == LATER)
|
if (CompareTimeStamps(pReq->revive, now) == LATER)
|
||||||
break;
|
break;
|
||||||
FreeResource(pReq->id, RT_NONE);
|
FreeResource(pReq->id, RT_NONE);
|
||||||
}
|
}
|
||||||
if (!pPending)
|
if (!pPending) {
|
||||||
{
|
|
||||||
RemoveBlockAndWakeupHandlers(SertafiedBlockHandler,
|
RemoveBlockAndWakeupHandlers(SertafiedBlockHandler,
|
||||||
SertafiedWakeupHandler,
|
SertafiedWakeupHandler, (pointer) 0);
|
||||||
(pointer) 0);
|
|
||||||
BlockHandlerRegistered = FALSE;
|
BlockHandlerRegistered = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,14 +33,10 @@
|
||||||
|
|
||||||
#include "dix.h"
|
#include "dix.h"
|
||||||
|
|
||||||
extern int ClientSleepUntil(
|
extern int ClientSleepUntil(ClientPtr client,
|
||||||
ClientPtr client,
|
|
||||||
TimeStamp *revive,
|
TimeStamp *revive,
|
||||||
void (*notifyFunc)(
|
void (*notifyFunc) (ClientPtr /* client */ ,
|
||||||
ClientPtr /* client */,
|
|
||||||
pointer /* closure */
|
pointer /* closure */
|
||||||
),
|
), pointer Closure);
|
||||||
pointer Closure
|
|
||||||
);
|
|
||||||
|
|
||||||
#endif
|
#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)
|
} while (0)
|
||||||
|
|
||||||
#endif /* _SYNCSDK_H_ */
|
#endif /* _SYNCSDK_H_ */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -71,19 +71,15 @@ typedef struct _SysCounterInfo {
|
||||||
CARD64 bracket_greater;
|
CARD64 bracket_greater;
|
||||||
CARD64 bracket_less;
|
CARD64 bracket_less;
|
||||||
SyncCounterType counterType; /* how can this counter change */
|
SyncCounterType counterType; /* how can this counter change */
|
||||||
void (*QueryValue)(
|
void (*QueryValue) (pointer /*pCounter */ ,
|
||||||
pointer /*pCounter*/,
|
|
||||||
CARD64 * /*freshvalue */
|
CARD64 * /*freshvalue */
|
||||||
);
|
);
|
||||||
void (*BracketValues)(
|
void (*BracketValues) (pointer /*pCounter */ ,
|
||||||
pointer /*pCounter*/,
|
|
||||||
CARD64 * /*lessthan */ ,
|
CARD64 * /*lessthan */ ,
|
||||||
CARD64 * /*greaterthan */
|
CARD64 * /*greaterthan */
|
||||||
);
|
);
|
||||||
} SysCounterInfo;
|
} SysCounterInfo;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct _SyncAlarmClientList {
|
typedef struct _SyncAlarmClientList {
|
||||||
ClientPtr client;
|
ClientPtr client;
|
||||||
XID delete_id;
|
XID delete_id;
|
||||||
|
|
@ -117,28 +113,33 @@ typedef union {
|
||||||
SyncAwait await;
|
SyncAwait await;
|
||||||
} SyncAwaitUnion;
|
} SyncAwaitUnion;
|
||||||
|
|
||||||
extern pointer SyncCreateSystemCounter(
|
extern pointer SyncCreateSystemCounter(const char * /* name */ ,
|
||||||
const char */* name */,
|
|
||||||
CARD64 /* inital_value */ ,
|
CARD64 /* inital_value */ ,
|
||||||
CARD64 /* resolution */ ,
|
CARD64 /* resolution */ ,
|
||||||
SyncCounterType /* change characterization */,
|
SyncCounterType
|
||||||
|
/* change characterization */ ,
|
||||||
void (* /*QueryValue */ )(
|
void (* /*QueryValue */ )(
|
||||||
pointer /* pCounter */,
|
pointer
|
||||||
|
/* pCounter */
|
||||||
|
,
|
||||||
CARD64 * /* pValue_return */ ), /* XXX prototype */
|
CARD64 * /* pValue_return */ ), /* XXX prototype */
|
||||||
void (* /*BracketValues */ )(
|
void (* /*BracketValues */ )(
|
||||||
pointer /* pCounter */,
|
pointer
|
||||||
CARD64 * /* pbracket_less */,
|
/* pCounter */
|
||||||
CARD64 * /* pbracket_greater */)
|
,
|
||||||
|
CARD64 *
|
||||||
|
/* pbracket_less */
|
||||||
|
,
|
||||||
|
CARD64 *
|
||||||
|
/* pbracket_greater */
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
extern void SyncChangeCounter(
|
extern void SyncChangeCounter(SyncCounter * /* pCounter */ ,
|
||||||
SyncCounter * /* pCounter*/,
|
|
||||||
CARD64 /* new_value */
|
CARD64 /* new_value */
|
||||||
);
|
);
|
||||||
|
|
||||||
extern void SyncDestroySystemCounter(
|
extern void SyncDestroySystemCounter(pointer pCounter);
|
||||||
pointer pCounter
|
|
||||||
);
|
|
||||||
|
|
||||||
extern void InitServertime(void);
|
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.
|
/* 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. */
|
/* Call the audit begin callback, there is no return value. */
|
||||||
XaceAuditRec rec = { client, 0 };
|
XaceAuditRec rec = { client, 0 };
|
||||||
|
|
@ -49,7 +50,8 @@ int XaceHookDispatch(ClientPtr client, int major)
|
||||||
XaceCoreDispatchRec rec = { client, Success /* default allow */ };
|
XaceCoreDispatchRec rec = { client, Success /* default allow */ };
|
||||||
CallCallbacks(&XaceHooks[XACE_CORE_DISPATCH], &rec);
|
CallCallbacks(&XaceHooks[XACE_CORE_DISPATCH], &rec);
|
||||||
return rec.status;
|
return rec.status;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
/* Call the extension dispatch hook */
|
/* Call the extension dispatch hook */
|
||||||
ExtensionEntry *ext = GetExtensionEntry(major);
|
ExtensionEntry *ext = GetExtensionEntry(major);
|
||||||
XaceExtAccessRec rec = { client, ext, DixUseAccess, Success };
|
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)
|
PropertyPtr *ppProp, Mask access_mode)
|
||||||
{
|
{
|
||||||
XacePropertyAccessRec rec = { client, pWin, ppProp, access_mode, Success };
|
XacePropertyAccessRec rec = { client, pWin, ppProp, access_mode, Success };
|
||||||
|
|
@ -68,15 +71,16 @@ int XaceHookPropertyAccess(ClientPtr client, WindowPtr pWin,
|
||||||
return rec.status;
|
return rec.status;
|
||||||
}
|
}
|
||||||
|
|
||||||
int XaceHookSelectionAccess(ClientPtr client,
|
int
|
||||||
Selection **ppSel, Mask access_mode)
|
XaceHookSelectionAccess(ClientPtr client, Selection ** ppSel, Mask access_mode)
|
||||||
{
|
{
|
||||||
XaceSelectionAccessRec rec = { client, ppSel, access_mode, Success };
|
XaceSelectionAccessRec rec = { client, ppSel, access_mode, Success };
|
||||||
CallCallbacks(&XaceHooks[XACE_SELECTION_ACCESS], &rec);
|
CallCallbacks(&XaceHooks[XACE_SELECTION_ACCESS], &rec);
|
||||||
return rec.status;
|
return rec.status;
|
||||||
}
|
}
|
||||||
|
|
||||||
void XaceHookAuditEnd(ClientPtr ptr, int result)
|
void
|
||||||
|
XaceHookAuditEnd(ClientPtr ptr, int result)
|
||||||
{
|
{
|
||||||
XaceAuditRec rec = { ptr, result };
|
XaceAuditRec rec = { ptr, result };
|
||||||
/* call callbacks, there is no return value. */
|
/* 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.
|
/* Entry point for hook functions. Called by Xserver.
|
||||||
*/
|
*/
|
||||||
int XaceHook(int hook, ...)
|
int
|
||||||
|
XaceHook(int hook, ...)
|
||||||
{
|
{
|
||||||
union {
|
union {
|
||||||
XaceResourceAccessRec res;
|
XaceResourceAccessRec res;
|
||||||
|
|
@ -112,8 +117,7 @@ int XaceHook(int hook, ...)
|
||||||
* the arguments and integer return parameter, or in some cases just
|
* the arguments and integer return parameter, or in some cases just
|
||||||
* sets calldata directly to a single argument (with no return result)
|
* sets calldata directly to a single argument (with no return result)
|
||||||
*/
|
*/
|
||||||
switch (hook)
|
switch (hook) {
|
||||||
{
|
|
||||||
case XACE_RESOURCE_ACCESS:
|
case XACE_RESOURCE_ACCESS:
|
||||||
u.res.client = va_arg(ap, ClientPtr);
|
u.res.client = va_arg(ap, ClientPtr);
|
||||||
u.res.id = va_arg(ap, XID);
|
u.res.id = va_arg(ap, XID);
|
||||||
|
|
@ -122,6 +126,7 @@ int XaceHook(int hook, ...)
|
||||||
u.res.ptype = va_arg(ap, RESTYPE);
|
u.res.ptype = va_arg(ap, RESTYPE);
|
||||||
u.res.parent = va_arg(ap, pointer);
|
u.res.parent = va_arg(ap, pointer);
|
||||||
u.res.access_mode = va_arg(ap, Mask);
|
u.res.access_mode = va_arg(ap, Mask);
|
||||||
|
|
||||||
u.res.status = Success; /* default allow */
|
u.res.status = Success; /* default allow */
|
||||||
prv = &u.res.status;
|
prv = &u.res.status;
|
||||||
break;
|
break;
|
||||||
|
|
@ -129,6 +134,7 @@ int XaceHook(int hook, ...)
|
||||||
u.dev.client = va_arg(ap, ClientPtr);
|
u.dev.client = va_arg(ap, ClientPtr);
|
||||||
u.dev.dev = va_arg(ap, DeviceIntPtr);
|
u.dev.dev = va_arg(ap, DeviceIntPtr);
|
||||||
u.dev.access_mode = va_arg(ap, Mask);
|
u.dev.access_mode = va_arg(ap, Mask);
|
||||||
|
|
||||||
u.dev.status = Success; /* default allow */
|
u.dev.status = Success; /* default allow */
|
||||||
prv = &u.dev.status;
|
prv = &u.dev.status;
|
||||||
break;
|
break;
|
||||||
|
|
@ -136,16 +142,20 @@ int XaceHook(int hook, ...)
|
||||||
u.send.client = va_arg(ap, ClientPtr);
|
u.send.client = va_arg(ap, ClientPtr);
|
||||||
u.send.dev = va_arg(ap, DeviceIntPtr);
|
u.send.dev = va_arg(ap, DeviceIntPtr);
|
||||||
u.send.pWin = va_arg(ap, WindowPtr);
|
u.send.pWin = va_arg(ap, WindowPtr);
|
||||||
|
|
||||||
u.send.events = va_arg(ap, xEventPtr);
|
u.send.events = va_arg(ap, xEventPtr);
|
||||||
u.send.count = va_arg(ap, int);
|
u.send.count = va_arg(ap, int);
|
||||||
|
|
||||||
u.send.status = Success; /* default allow */
|
u.send.status = Success; /* default allow */
|
||||||
prv = &u.send.status;
|
prv = &u.send.status;
|
||||||
break;
|
break;
|
||||||
case XACE_RECEIVE_ACCESS:
|
case XACE_RECEIVE_ACCESS:
|
||||||
u.recv.client = va_arg(ap, ClientPtr);
|
u.recv.client = va_arg(ap, ClientPtr);
|
||||||
u.recv.pWin = va_arg(ap, WindowPtr);
|
u.recv.pWin = va_arg(ap, WindowPtr);
|
||||||
|
|
||||||
u.recv.events = va_arg(ap, xEventPtr);
|
u.recv.events = va_arg(ap, xEventPtr);
|
||||||
u.recv.count = va_arg(ap, int);
|
u.recv.count = va_arg(ap, int);
|
||||||
|
|
||||||
u.recv.status = Success; /* default allow */
|
u.recv.status = Success; /* default allow */
|
||||||
prv = &u.recv.status;
|
prv = &u.recv.status;
|
||||||
break;
|
break;
|
||||||
|
|
@ -153,11 +163,13 @@ int XaceHook(int hook, ...)
|
||||||
u.client.client = va_arg(ap, ClientPtr);
|
u.client.client = va_arg(ap, ClientPtr);
|
||||||
u.client.target = va_arg(ap, ClientPtr);
|
u.client.target = va_arg(ap, ClientPtr);
|
||||||
u.client.access_mode = va_arg(ap, Mask);
|
u.client.access_mode = va_arg(ap, Mask);
|
||||||
|
|
||||||
u.client.status = Success; /* default allow */
|
u.client.status = Success; /* default allow */
|
||||||
prv = &u.client.status;
|
prv = &u.client.status;
|
||||||
break;
|
break;
|
||||||
case XACE_EXT_ACCESS:
|
case XACE_EXT_ACCESS:
|
||||||
u.ext.client = va_arg(ap, ClientPtr);
|
u.ext.client = va_arg(ap, ClientPtr);
|
||||||
|
|
||||||
u.ext.ext = va_arg(ap, ExtensionEntry *);
|
u.ext.ext = va_arg(ap, ExtensionEntry *);
|
||||||
u.ext.access_mode = DixGetAttrAccess;
|
u.ext.access_mode = DixGetAttrAccess;
|
||||||
u.ext.status = Success; /* default allow */
|
u.ext.status = Success; /* default allow */
|
||||||
|
|
@ -166,6 +178,7 @@ int XaceHook(int hook, ...)
|
||||||
case XACE_SERVER_ACCESS:
|
case XACE_SERVER_ACCESS:
|
||||||
u.server.client = va_arg(ap, ClientPtr);
|
u.server.client = va_arg(ap, ClientPtr);
|
||||||
u.server.access_mode = va_arg(ap, Mask);
|
u.server.access_mode = va_arg(ap, Mask);
|
||||||
|
|
||||||
u.server.status = Success; /* default allow */
|
u.server.status = Success; /* default allow */
|
||||||
prv = &u.server.status;
|
prv = &u.server.status;
|
||||||
break;
|
break;
|
||||||
|
|
@ -174,17 +187,20 @@ int XaceHook(int hook, ...)
|
||||||
u.screen.client = va_arg(ap, ClientPtr);
|
u.screen.client = va_arg(ap, ClientPtr);
|
||||||
u.screen.screen = va_arg(ap, ScreenPtr);
|
u.screen.screen = va_arg(ap, ScreenPtr);
|
||||||
u.screen.access_mode = va_arg(ap, Mask);
|
u.screen.access_mode = va_arg(ap, Mask);
|
||||||
|
|
||||||
u.screen.status = Success; /* default allow */
|
u.screen.status = Success; /* default allow */
|
||||||
prv = &u.screen.status;
|
prv = &u.screen.status;
|
||||||
break;
|
break;
|
||||||
case XACE_AUTH_AVAIL:
|
case XACE_AUTH_AVAIL:
|
||||||
u.auth.client = va_arg(ap, ClientPtr);
|
u.auth.client = va_arg(ap, ClientPtr);
|
||||||
u.auth.authId = va_arg(ap, XID);
|
u.auth.authId = va_arg(ap, XID);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case XACE_KEY_AVAIL:
|
case XACE_KEY_AVAIL:
|
||||||
u.key.event = va_arg(ap, xEventPtr);
|
u.key.event = va_arg(ap, xEventPtr);
|
||||||
u.key.keybd = va_arg(ap, DeviceIntPtr);
|
u.key.keybd = va_arg(ap, DeviceIntPtr);
|
||||||
u.key.count = va_arg(ap, int);
|
u.key.count = va_arg(ap, int);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
@ -218,14 +234,11 @@ int XaceHook(int hook, ...)
|
||||||
* region of the window will be destroyed (overwritten) in pBuf.
|
* region of the window will be destroyed (overwritten) in pBuf.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
XaceCensorImage(
|
XaceCensorImage(ClientPtr client,
|
||||||
ClientPtr client,
|
|
||||||
RegionPtr pVisibleRegion,
|
RegionPtr pVisibleRegion,
|
||||||
long widthBytesLine,
|
long widthBytesLine,
|
||||||
DrawablePtr pDraw,
|
DrawablePtr pDraw,
|
||||||
int x, int y, int w, int h,
|
int x, int y, int w, int h, unsigned int format, char *pBuf)
|
||||||
unsigned int format,
|
|
||||||
char *pBuf)
|
|
||||||
{
|
{
|
||||||
RegionRec imageRegion; /* region representing x,y,w,h */
|
RegionRec imageRegion; /* region representing x,y,w,h */
|
||||||
RegionRec censorRegion; /* region to obliterate */
|
RegionRec censorRegion; /* region to obliterate */
|
||||||
|
|
@ -242,8 +255,7 @@ XaceCensorImage(
|
||||||
/* censorRegion = imageRegion - visibleRegion */
|
/* censorRegion = imageRegion - visibleRegion */
|
||||||
RegionSubtract(&censorRegion, &imageRegion, pVisibleRegion);
|
RegionSubtract(&censorRegion, &imageRegion, pVisibleRegion);
|
||||||
nRects = RegionNumRects(&censorRegion);
|
nRects = RegionNumRects(&censorRegion);
|
||||||
if (nRects > 0)
|
if (nRects > 0) { /* we have something to censor */
|
||||||
{ /* we have something to censor */
|
|
||||||
GCPtr pScratchGC = NULL;
|
GCPtr pScratchGC = NULL;
|
||||||
PixmapPtr pPix = NULL;
|
PixmapPtr pPix = NULL;
|
||||||
xRectangle *pRects = NULL;
|
xRectangle *pRects = NULL;
|
||||||
|
|
@ -256,15 +268,11 @@ XaceCensorImage(
|
||||||
/* convert region to list-of-rectangles for PolyFillRect */
|
/* convert region to list-of-rectangles for PolyFillRect */
|
||||||
|
|
||||||
pRects = malloc(nRects * sizeof(xRectangle));
|
pRects = malloc(nRects * sizeof(xRectangle));
|
||||||
if (!pRects)
|
if (!pRects) {
|
||||||
{
|
|
||||||
failed = TRUE;
|
failed = TRUE;
|
||||||
goto failSafe;
|
goto failSafe;
|
||||||
}
|
}
|
||||||
for (pBox = RegionRects(&censorRegion), i = 0;
|
for (pBox = RegionRects(&censorRegion), i = 0; i < nRects; i++, pBox++) {
|
||||||
i < nRects;
|
|
||||||
i++, pBox++)
|
|
||||||
{
|
|
||||||
pRects[i].x = pBox->x1;
|
pRects[i].x = pBox->x1;
|
||||||
pRects[i].y = pBox->y1 - imageBox.y1;
|
pRects[i].y = pBox->y1 - imageBox.y1;
|
||||||
pRects[i].width = pBox->x2 - pBox->x1;
|
pRects[i].width = pBox->x2 - pBox->x1;
|
||||||
|
|
@ -273,8 +281,7 @@ XaceCensorImage(
|
||||||
|
|
||||||
/* use pBuf as a fake pixmap */
|
/* use pBuf as a fake pixmap */
|
||||||
|
|
||||||
if (format == ZPixmap)
|
if (format == ZPixmap) {
|
||||||
{
|
|
||||||
depth = pDraw->depth;
|
depth = pDraw->depth;
|
||||||
bitsPerPixel = pDraw->bitsPerPixel;
|
bitsPerPixel = pDraw->bitsPerPixel;
|
||||||
}
|
}
|
||||||
|
|
@ -282,15 +289,13 @@ XaceCensorImage(
|
||||||
pPix = GetScratchPixmapHeader(pDraw->pScreen, w, h,
|
pPix = GetScratchPixmapHeader(pDraw->pScreen, w, h,
|
||||||
depth, bitsPerPixel,
|
depth, bitsPerPixel,
|
||||||
widthBytesLine, (pointer) pBuf);
|
widthBytesLine, (pointer) pBuf);
|
||||||
if (!pPix)
|
if (!pPix) {
|
||||||
{
|
|
||||||
failed = TRUE;
|
failed = TRUE;
|
||||||
goto failSafe;
|
goto failSafe;
|
||||||
}
|
}
|
||||||
|
|
||||||
pScratchGC = GetScratchGC(depth, pPix->drawable.pScreen);
|
pScratchGC = GetScratchGC(depth, pPix->drawable.pScreen);
|
||||||
if (!pScratchGC)
|
if (!pScratchGC) {
|
||||||
{
|
|
||||||
failed = TRUE;
|
failed = TRUE;
|
||||||
goto failSafe;
|
goto failSafe;
|
||||||
}
|
}
|
||||||
|
|
@ -300,16 +305,17 @@ XaceCensorImage(
|
||||||
pScratchGC, nRects, pRects);
|
pScratchGC, nRects, pRects);
|
||||||
|
|
||||||
failSafe:
|
failSafe:
|
||||||
if (failed)
|
if (failed) {
|
||||||
{
|
|
||||||
/* Censoring was not completed above. To be safe, wipe out
|
/* Censoring was not completed above. To be safe, wipe out
|
||||||
* all the image data so that nothing trusted gets out.
|
* all the image data so that nothing trusted gets out.
|
||||||
*/
|
*/
|
||||||
memset(pBuf, 0, (int) (widthBytesLine * h));
|
memset(pBuf, 0, (int) (widthBytesLine * h));
|
||||||
}
|
}
|
||||||
free(pRects);
|
free(pRects);
|
||||||
if (pScratchGC) FreeScratchGC(pScratchGC);
|
if (pScratchGC)
|
||||||
if (pPix) FreeScratchPixmapHeader(pPix);
|
FreeScratchGC(pScratchGC);
|
||||||
|
if (pPix)
|
||||||
|
FreeScratchPixmapHeader(pPix);
|
||||||
}
|
}
|
||||||
RegionUninit(&imageRegion);
|
RegionUninit(&imageRegion);
|
||||||
RegionUninit(&censorRegion);
|
RegionUninit(&censorRegion);
|
||||||
|
|
@ -318,14 +324,18 @@ XaceCensorImage(
|
||||||
/*
|
/*
|
||||||
* Xtrans wrappers for use by modules
|
* Xtrans wrappers for use by modules
|
||||||
*/
|
*/
|
||||||
int XaceGetConnectionNumber(ClientPtr client)
|
int
|
||||||
|
XaceGetConnectionNumber(ClientPtr client)
|
||||||
{
|
{
|
||||||
XtransConnInfo ci = ((OsCommPtr) client->osPrivate)->trans_conn;
|
XtransConnInfo ci = ((OsCommPtr) client->osPrivate)->trans_conn;
|
||||||
|
|
||||||
return _XSERVTransGetConnectionNumber(ci);
|
return _XSERVTransGetConnectionNumber(ci);
|
||||||
}
|
}
|
||||||
|
|
||||||
int XaceIsLocal(ClientPtr client)
|
int
|
||||||
|
XaceIsLocal(ClientPtr client)
|
||||||
{
|
{
|
||||||
XtransConnInfo ci = ((OsCommPtr) client->osPrivate)->trans_conn;
|
XtransConnInfo ci = ((OsCommPtr) client->osPrivate)->trans_conn;
|
||||||
|
|
||||||
return _XSERVTransIsLocal(ci);
|
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.
|
/* Entry point for hook functions. Called by Xserver.
|
||||||
* Required by libdbe and libextmod
|
* Required by libdbe and libextmod
|
||||||
*/
|
*/
|
||||||
extern _X_EXPORT int XaceHook(
|
extern _X_EXPORT int XaceHook(int /*hook */ ,
|
||||||
int /*hook*/,
|
|
||||||
... /*appropriate args for 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 XaceHookDispatch(ClientPtr ptr, int major);
|
||||||
extern _X_EXPORT int XaceHookPropertyAccess(ClientPtr ptr, WindowPtr pWin,
|
extern _X_EXPORT int XaceHookPropertyAccess(ClientPtr ptr, WindowPtr pWin,
|
||||||
PropertyPtr *ppProp, Mask access_mode);
|
PropertyPtr *ppProp,
|
||||||
extern _X_EXPORT int XaceHookSelectionAccess(ClientPtr ptr,
|
Mask access_mode);
|
||||||
Selection **ppSel, Mask access_mode);
|
extern _X_EXPORT int XaceHookSelectionAccess(ClientPtr ptr, Selection ** ppSel,
|
||||||
|
Mask access_mode);
|
||||||
extern _X_EXPORT void XaceHookAuditEnd(ClientPtr ptr, int result);
|
extern _X_EXPORT void XaceHookAuditEnd(ClientPtr ptr, int result);
|
||||||
|
|
||||||
/* Register a callback for a given hook.
|
/* Register a callback for a given hook.
|
||||||
|
|
@ -93,15 +93,12 @@ extern _X_EXPORT int XaceIsLocal(ClientPtr ptr);
|
||||||
/* From the original Security extension...
|
/* From the original Security extension...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern _X_EXPORT void XaceCensorImage(
|
extern _X_EXPORT void XaceCensorImage(ClientPtr client,
|
||||||
ClientPtr client,
|
|
||||||
RegionPtr pVisibleRegion,
|
RegionPtr pVisibleRegion,
|
||||||
long widthBytesLine,
|
long widthBytesLine,
|
||||||
DrawablePtr pDraw,
|
DrawablePtr pDraw,
|
||||||
int x, int y, int w, int h,
|
int x, int y, int w, int h,
|
||||||
unsigned int format,
|
unsigned int format, char *pBuf);
|
||||||
char * pBuf
|
|
||||||
);
|
|
||||||
|
|
||||||
#else /* XACE */
|
#else /* XACE */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -98,8 +98,7 @@ ProcXCMiscGetXIDList(ClientPtr client)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
|
||||||
pids = (XID *) malloc(stuff->count * sizeof(XID));
|
pids = (XID *) malloc(stuff->count * sizeof(XID));
|
||||||
if (!pids)
|
if (!pids) {
|
||||||
{
|
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
count = GetXIDList(client, stuff->count, pids);
|
count = GetXIDList(client, stuff->count, pids);
|
||||||
|
|
@ -113,8 +112,7 @@ ProcXCMiscGetXIDList(ClientPtr client)
|
||||||
swapl(&rep.count);
|
swapl(&rep.count);
|
||||||
}
|
}
|
||||||
WriteToClient(client, sizeof(xXCMiscGetXIDListReply), (char *) &rep);
|
WriteToClient(client, sizeof(xXCMiscGetXIDListReply), (char *) &rep);
|
||||||
if (count)
|
if (count) {
|
||||||
{
|
|
||||||
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
|
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
|
||||||
WriteSwappedDataToClient(client, count * sizeof(XID), pids);
|
WriteSwappedDataToClient(client, count * sizeof(XID), pids);
|
||||||
}
|
}
|
||||||
|
|
@ -126,8 +124,7 @@ static int
|
||||||
ProcXCMiscDispatch(ClientPtr client)
|
ProcXCMiscDispatch(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xReq);
|
REQUEST(xReq);
|
||||||
switch (stuff->data)
|
switch (stuff->data) {
|
||||||
{
|
|
||||||
case X_XCMiscGetVersion:
|
case X_XCMiscGetVersion:
|
||||||
return ProcXCMiscGetVersion(client);
|
return ProcXCMiscGetVersion(client);
|
||||||
case X_XCMiscGetXIDRange:
|
case X_XCMiscGetXIDRange:
|
||||||
|
|
@ -174,8 +171,7 @@ static int
|
||||||
SProcXCMiscDispatch(ClientPtr client)
|
SProcXCMiscDispatch(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xReq);
|
REQUEST(xReq);
|
||||||
switch (stuff->data)
|
switch (stuff->data) {
|
||||||
{
|
|
||||||
case X_XCMiscGetVersion:
|
case X_XCMiscGetVersion:
|
||||||
return SProcXCMiscGetVersion(client);
|
return SProcXCMiscGetVersion(client);
|
||||||
case X_XCMiscGetXIDRange:
|
case X_XCMiscGetXIDRange:
|
||||||
|
|
|
||||||
|
|
@ -76,11 +76,9 @@
|
||||||
#include <X11/extensions/xf86bigfproto.h>
|
#include <X11/extensions/xf86bigfproto.h>
|
||||||
#include "xf86bigfontsrv.h"
|
#include "xf86bigfontsrv.h"
|
||||||
|
|
||||||
static void XF86BigfontResetProc(
|
static void XF86BigfontResetProc(ExtensionEntry * /* extEntry */
|
||||||
ExtensionEntry * /* extEntry */
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAS_SHM
|
#ifdef HAS_SHM
|
||||||
|
|
||||||
/* A random signature, transmitted to the clients so they can verify that the
|
/* 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>
|
#include <sys/signal.h>
|
||||||
|
|
||||||
static void
|
static void
|
||||||
SigSysHandler(
|
SigSysHandler(int signo)
|
||||||
int signo)
|
|
||||||
{
|
{
|
||||||
badSysCall = TRUE;
|
badSysCall = TRUE;
|
||||||
}
|
}
|
||||||
|
|
@ -117,13 +114,11 @@ CheckForShmSyscall(void)
|
||||||
|
|
||||||
badSysCall = FALSE;
|
badSysCall = FALSE;
|
||||||
shmid = shmget(IPC_PRIVATE, 4096, IPC_CREAT);
|
shmid = shmget(IPC_PRIVATE, 4096, IPC_CREAT);
|
||||||
if (shmid != -1)
|
if (shmid != -1) {
|
||||||
{
|
|
||||||
/* Successful allocation - clean up */
|
/* Successful allocation - clean up */
|
||||||
shmctl(shmid, IPC_RMID, NULL);
|
shmctl(shmid, IPC_RMID, NULL);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
/* Allocation failed */
|
/* Allocation failed */
|
||||||
badSysCall = TRUE;
|
badSysCall = TRUE;
|
||||||
}
|
}
|
||||||
|
|
@ -158,8 +153,7 @@ typedef struct _ShmDesc {
|
||||||
static ShmDescPtr ShmList = (ShmDescPtr) NULL;
|
static ShmDescPtr ShmList = (ShmDescPtr) NULL;
|
||||||
|
|
||||||
static ShmDescPtr
|
static ShmDescPtr
|
||||||
shmalloc(
|
shmalloc(unsigned int size)
|
||||||
unsigned int size)
|
|
||||||
{
|
{
|
||||||
ShmDescPtr pDesc;
|
ShmDescPtr pDesc;
|
||||||
int shmid;
|
int shmid;
|
||||||
|
|
@ -206,7 +200,8 @@ shmalloc(
|
||||||
|
|
||||||
pDesc->shmid = shmid;
|
pDesc->shmid = shmid;
|
||||||
pDesc->attach_addr = addr;
|
pDesc->attach_addr = addr;
|
||||||
if (ShmList) ShmList->prev = &pDesc->next;
|
if (ShmList)
|
||||||
|
ShmList->prev = &pDesc->next;
|
||||||
pDesc->next = ShmList;
|
pDesc->next = ShmList;
|
||||||
pDesc->prev = &ShmList;
|
pDesc->prev = &ShmList;
|
||||||
ShmList = pDesc;
|
ShmList = pDesc;
|
||||||
|
|
@ -215,15 +210,15 @@ shmalloc(
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
shmdealloc(
|
shmdealloc(ShmDescPtr pDesc)
|
||||||
ShmDescPtr pDesc)
|
|
||||||
{
|
{
|
||||||
#ifndef EARLY_REMOVE
|
#ifndef EARLY_REMOVE
|
||||||
shmctl(pDesc->shmid, IPC_RMID, (void *) 0);
|
shmctl(pDesc->shmid, IPC_RMID, (void *) 0);
|
||||||
#endif
|
#endif
|
||||||
shmdt(pDesc->attach_addr);
|
shmdt(pDesc->attach_addr);
|
||||||
|
|
||||||
if (pDesc->next) pDesc->next->prev = pDesc->prev;
|
if (pDesc->next)
|
||||||
|
pDesc->next->prev = pDesc->prev;
|
||||||
*pDesc->prev = pDesc->next;
|
*pDesc->prev = pDesc->next;
|
||||||
free(pDesc);
|
free(pDesc);
|
||||||
}
|
}
|
||||||
|
|
@ -232,8 +227,7 @@ shmdealloc(
|
||||||
|
|
||||||
/* Called when a font is closed. */
|
/* Called when a font is closed. */
|
||||||
void
|
void
|
||||||
XF86BigfontFreeFontShm(
|
XF86BigfontFreeFontShm(FontPtr pFont)
|
||||||
FontPtr pFont)
|
|
||||||
{
|
{
|
||||||
#ifdef HAS_SHM
|
#ifdef HAS_SHM
|
||||||
ShmDescPtr pDesc;
|
ShmDescPtr pDesc;
|
||||||
|
|
@ -262,8 +256,7 @@ XF86BigfontCleanup(void)
|
||||||
|
|
||||||
/* Called when a server generation dies. */
|
/* Called when a server generation dies. */
|
||||||
static void
|
static void
|
||||||
XF86BigfontResetProc(
|
XF86BigfontResetProc(ExtensionEntry * extEntry)
|
||||||
ExtensionEntry* extEntry)
|
|
||||||
{
|
{
|
||||||
/* This function is normally called from CloseDownExtensions(), called
|
/* This function is normally called from CloseDownExtensions(), called
|
||||||
* from main(). It will be followed by a call to FreeAllResources(),
|
* from main(). It will be followed by a call to FreeAllResources(),
|
||||||
|
|
@ -276,12 +269,10 @@ XF86BigfontResetProc(
|
||||||
XF86BigfontCleanup();
|
XF86BigfontCleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ========== Handling of extension specific requests ========== */
|
/* ========== Handling of extension specific requests ========== */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ProcXF86BigfontQueryVersion(
|
ProcXF86BigfontQueryVersion(ClientPtr client)
|
||||||
ClientPtr client)
|
|
||||||
{
|
{
|
||||||
xXF86BigfontQueryVersionReply reply;
|
xXF86BigfontQueryVersionReply reply;
|
||||||
|
|
||||||
|
|
@ -307,6 +298,7 @@ ProcXF86BigfontQueryVersion(
|
||||||
; /* may add more bits here in future versions */
|
; /* may add more bits here in future versions */
|
||||||
if (client->swapped) {
|
if (client->swapped) {
|
||||||
char tmp;
|
char tmp;
|
||||||
|
|
||||||
swaps(&reply.sequenceNumber);
|
swaps(&reply.sequenceNumber);
|
||||||
swapl(&reply.length);
|
swapl(&reply.length);
|
||||||
swaps(&reply.majorVersion);
|
swaps(&reply.majorVersion);
|
||||||
|
|
@ -321,8 +313,7 @@ ProcXF86BigfontQueryVersion(
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
swapCharInfo(
|
swapCharInfo(xCharInfo * pCI)
|
||||||
xCharInfo *pCI)
|
|
||||||
{
|
{
|
||||||
char tmp;
|
char tmp;
|
||||||
|
|
||||||
|
|
@ -342,16 +333,17 @@ swapCharInfo(
|
||||||
(p->ascent << 11) + (p->descent << 6)) ^ p->attributes)
|
(p->ascent << 11) + (p->descent << 6)) ^ p->attributes)
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ProcXF86BigfontQueryFont(
|
ProcXF86BigfontQueryFont(ClientPtr client)
|
||||||
ClientPtr client)
|
|
||||||
{
|
{
|
||||||
FontPtr pFont;
|
FontPtr pFont;
|
||||||
|
|
||||||
REQUEST(xXF86BigfontQueryFontReq);
|
REQUEST(xXF86BigfontQueryFontReq);
|
||||||
CARD32 stuff_flags;
|
CARD32 stuff_flags;
|
||||||
xCharInfo *pmax;
|
xCharInfo *pmax;
|
||||||
xCharInfo *pmin;
|
xCharInfo *pmin;
|
||||||
int nCharInfos;
|
int nCharInfos;
|
||||||
int shmid;
|
int shmid;
|
||||||
|
|
||||||
#ifdef HAS_SHM
|
#ifdef HAS_SHM
|
||||||
ShmDescPtr pDesc = NULL;
|
ShmDescPtr pDesc = NULL;
|
||||||
#else
|
#else
|
||||||
|
|
@ -367,7 +359,8 @@ ProcXF86BigfontQueryFont(
|
||||||
#else
|
#else
|
||||||
switch (client->req_len) {
|
switch (client->req_len) {
|
||||||
case 2: /* client with version 1.0 libX11 */
|
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;
|
break;
|
||||||
case 3: /* client with version 1.1 libX11 */
|
case 3: /* client with version 1.1 libX11 */
|
||||||
stuff_flags = stuff->flags;
|
stuff_flags = stuff->flags;
|
||||||
|
|
@ -376,7 +369,8 @@ ProcXF86BigfontQueryFont(
|
||||||
return BadLength;
|
return BadLength;
|
||||||
}
|
}
|
||||||
#endif
|
#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 */
|
return BadFont; /* procotol spec says only error is BadFont */
|
||||||
|
|
||||||
pmax = FONTINKMAX(pFont);
|
pmax = FONTINKMAX(pFont);
|
||||||
|
|
@ -402,14 +396,16 @@ ProcXF86BigfontQueryFont(
|
||||||
pCI = (xCharInfo *) pDesc->attach_addr;
|
pCI = (xCharInfo *) pDesc->attach_addr;
|
||||||
if (stuff_flags & XF86Bigfont_FLAGS_Shm)
|
if (stuff_flags & XF86Bigfont_FLAGS_Shm)
|
||||||
shmid = pDesc->shmid;
|
shmid = pDesc->shmid;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
if (stuff_flags & XF86Bigfont_FLAGS_Shm && !badSysCall)
|
if (stuff_flags & XF86Bigfont_FLAGS_Shm && !badSysCall)
|
||||||
pDesc = shmalloc(nCharInfos * sizeof(xCharInfo)
|
pDesc = shmalloc(nCharInfos * sizeof(xCharInfo)
|
||||||
+ sizeof(CARD32));
|
+ sizeof(CARD32));
|
||||||
if (pDesc) {
|
if (pDesc) {
|
||||||
pCI = (xCharInfo *) pDesc->attach_addr;
|
pCI = (xCharInfo *) pDesc->attach_addr;
|
||||||
shmid = pDesc->shmid;
|
shmid = pDesc->shmid;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
#endif
|
#endif
|
||||||
pCI = malloc(nCharInfos * sizeof(xCharInfo));
|
pCI = malloc(nCharInfos * sizeof(xCharInfo));
|
||||||
if (!pCI)
|
if (!pCI)
|
||||||
|
|
@ -423,18 +419,18 @@ ProcXF86BigfontQueryFont(
|
||||||
int ninfos = 0;
|
int ninfos = 0;
|
||||||
int ncols = pFont->info.lastCol - pFont->info.firstCol + 1;
|
int ncols = pFont->info.lastCol - pFont->info.firstCol + 1;
|
||||||
int row;
|
int row;
|
||||||
|
|
||||||
for (row = pFont->info.firstRow;
|
for (row = pFont->info.firstRow;
|
||||||
row <= pFont->info.lastRow && ninfos < nCharInfos;
|
row <= pFont->info.lastRow && ninfos < nCharInfos; row++) {
|
||||||
row++) {
|
|
||||||
unsigned char chars[512];
|
unsigned char chars[512];
|
||||||
xCharInfo *tmpCharInfos[256];
|
xCharInfo *tmpCharInfos[256];
|
||||||
unsigned long count;
|
unsigned long count;
|
||||||
int col;
|
int col;
|
||||||
unsigned long i;
|
unsigned long i;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
for (col = pFont->info.firstCol;
|
for (col = pFont->info.firstCol;
|
||||||
col <= pFont->info.lastCol;
|
col <= pFont->info.lastCol; col++) {
|
||||||
col++) {
|
|
||||||
chars[i++] = row;
|
chars[i++] = row;
|
||||||
chars[i++] = col;
|
chars[i++] = col;
|
||||||
}
|
}
|
||||||
|
|
@ -475,7 +471,8 @@ ProcXF86BigfontQueryFont(
|
||||||
|
|
||||||
tmp = malloc((4 * nCharInfos + 1) * sizeof(CARD16));
|
tmp = malloc((4 * nCharInfos + 1) * sizeof(CARD16));
|
||||||
if (!tmp) {
|
if (!tmp) {
|
||||||
if (!pDesc) free(pCI);
|
if (!pDesc)
|
||||||
|
free(pCI);
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
pIndex2UniqIndex = tmp;
|
pIndex2UniqIndex = tmp;
|
||||||
|
|
@ -499,9 +496,9 @@ ProcXF86BigfontQueryFont(
|
||||||
for (NextIndex = 0; NextIndex < nCharInfos; NextIndex++) {
|
for (NextIndex = 0; NextIndex < nCharInfos; NextIndex++) {
|
||||||
xCharInfo *p = &pCI[NextIndex];
|
xCharInfo *p = &pCI[NextIndex];
|
||||||
CARD32 hashCode = hashCI(p) % hashModulus;
|
CARD32 hashCode = hashCI(p) % hashModulus;
|
||||||
|
|
||||||
for (i = pHash2UniqIndex[hashCode];
|
for (i = pHash2UniqIndex[hashCode];
|
||||||
i != (CARD16)(-1);
|
i != (CARD16) (-1); i = pUniqIndex2NextUniqIndex[i]) {
|
||||||
i = pUniqIndex2NextUniqIndex[i]) {
|
|
||||||
j = pUniqIndex2Index[i];
|
j = pUniqIndex2Index[i];
|
||||||
if (pCI[j].leftSideBearing == p->leftSideBearing
|
if (pCI[j].leftSideBearing == p->leftSideBearing
|
||||||
&& pCI[j].rightSideBearing == p->rightSideBearing
|
&& pCI[j].rightSideBearing == p->rightSideBearing
|
||||||
|
|
@ -514,7 +511,8 @@ ProcXF86BigfontQueryFont(
|
||||||
if (i != (CARD16) (-1)) {
|
if (i != (CARD16) (-1)) {
|
||||||
/* Found *p at Index j, UniqIndex i */
|
/* Found *p at Index j, UniqIndex i */
|
||||||
pIndex2UniqIndex[NextIndex] = i;
|
pIndex2UniqIndex[NextIndex] = i;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
/* Allocate a new entry in the Uniq table */
|
/* Allocate a new entry in the Uniq table */
|
||||||
if (hashModulus <= 2 * NextUniqIndex
|
if (hashModulus <= 2 * NextUniqIndex
|
||||||
&& hashModulus < nCharInfos + 1) {
|
&& hashModulus < nCharInfos + 1) {
|
||||||
|
|
@ -530,7 +528,8 @@ ProcXF86BigfontQueryFont(
|
||||||
j = pUniqIndex2Index[i];
|
j = pUniqIndex2Index[i];
|
||||||
p = &pCI[j];
|
p = &pCI[j];
|
||||||
hashCode = hashCI(p) % hashModulus;
|
hashCode = hashCI(p) % hashModulus;
|
||||||
pUniqIndex2NextUniqIndex[i] = pHash2UniqIndex[hashCode];
|
pUniqIndex2NextUniqIndex[i] =
|
||||||
|
pHash2UniqIndex[hashCode];
|
||||||
pHash2UniqIndex[hashCode] = i;
|
pHash2UniqIndex[hashCode] = i;
|
||||||
}
|
}
|
||||||
p = &pCI[NextIndex];
|
p = &pCI[NextIndex];
|
||||||
|
|
@ -550,8 +549,7 @@ ProcXF86BigfontQueryFont(
|
||||||
|
|
||||||
{
|
{
|
||||||
int nfontprops = pFont->info.nprops;
|
int nfontprops = pFont->info.nprops;
|
||||||
int rlength =
|
int rlength = sizeof(xXF86BigfontQueryFontReply)
|
||||||
sizeof(xXF86BigfontQueryFontReply)
|
|
||||||
+ nfontprops * sizeof(xFontProp)
|
+ nfontprops * sizeof(xFontProp)
|
||||||
+ (nCharInfos > 0 && shmid == -1
|
+ (nCharInfos > 0 && shmid == -1
|
||||||
? nUniqCharInfos * sizeof(xCharInfo)
|
? nUniqCharInfos * sizeof(xCharInfo)
|
||||||
|
|
@ -559,10 +557,13 @@ ProcXF86BigfontQueryFont(
|
||||||
: 0);
|
: 0);
|
||||||
xXF86BigfontQueryFontReply *reply = malloc(rlength);
|
xXF86BigfontQueryFontReply *reply = malloc(rlength);
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
if (!reply) {
|
if (!reply) {
|
||||||
if (nCharInfos > 0) {
|
if (nCharInfos > 0) {
|
||||||
if (shmid == -1) free(pIndex2UniqIndex);
|
if (shmid == -1)
|
||||||
if (!pDesc) free(pCI);
|
free(pIndex2UniqIndex);
|
||||||
|
if (!pDesc)
|
||||||
|
free(pCI);
|
||||||
}
|
}
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
|
|
@ -587,6 +588,7 @@ ProcXF86BigfontQueryFont(
|
||||||
reply->shmsegoffset = 0;
|
reply->shmsegoffset = 0;
|
||||||
if (client->swapped) {
|
if (client->swapped) {
|
||||||
char tmp;
|
char tmp;
|
||||||
|
|
||||||
swaps(&reply->sequenceNumber);
|
swaps(&reply->sequenceNumber);
|
||||||
swapl(&reply->length);
|
swapl(&reply->length);
|
||||||
swapCharInfo(&reply->minBounds);
|
swapCharInfo(&reply->minBounds);
|
||||||
|
|
@ -607,13 +609,14 @@ ProcXF86BigfontQueryFont(
|
||||||
FontPropPtr pFP;
|
FontPropPtr pFP;
|
||||||
xFontProp *prFP;
|
xFontProp *prFP;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0, pFP = pFont->info.props, prFP = (xFontProp *) p;
|
for (i = 0, pFP = pFont->info.props, prFP = (xFontProp *) p;
|
||||||
i < nfontprops;
|
i < nfontprops; i++, pFP++, prFP++) {
|
||||||
i++, pFP++, prFP++) {
|
|
||||||
prFP->name = pFP->name;
|
prFP->name = pFP->name;
|
||||||
prFP->value = pFP->value;
|
prFP->value = pFP->value;
|
||||||
if (client->swapped) {
|
if (client->swapped) {
|
||||||
char tmp;
|
char tmp;
|
||||||
|
|
||||||
swapl(&prFP->name);
|
swapl(&prFP->name);
|
||||||
swapl(&prFP->value);
|
swapl(&prFP->value);
|
||||||
}
|
}
|
||||||
|
|
@ -624,6 +627,7 @@ ProcXF86BigfontQueryFont(
|
||||||
xCharInfo *pci;
|
xCharInfo *pci;
|
||||||
CARD16 *ps;
|
CARD16 *ps;
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
pci = (xCharInfo *) p;
|
pci = (xCharInfo *) p;
|
||||||
for (i = 0; i < nUniqCharInfos; i++, pci++) {
|
for (i = 0; i < nUniqCharInfos; i++, pci++) {
|
||||||
*pci = pCI[pUniqIndex2Index[i]];
|
*pci = pCI[pUniqIndex2Index[i]];
|
||||||
|
|
@ -635,6 +639,7 @@ ProcXF86BigfontQueryFont(
|
||||||
*ps = pIndex2UniqIndex[j];
|
*ps = pIndex2UniqIndex[j];
|
||||||
if (client->swapped) {
|
if (client->swapped) {
|
||||||
char tmp;
|
char tmp;
|
||||||
|
|
||||||
swaps(ps);
|
swaps(ps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -642,16 +647,17 @@ ProcXF86BigfontQueryFont(
|
||||||
WriteToClient(client, rlength, (char *) reply);
|
WriteToClient(client, rlength, (char *) reply);
|
||||||
free(reply);
|
free(reply);
|
||||||
if (nCharInfos > 0) {
|
if (nCharInfos > 0) {
|
||||||
if (shmid == -1) free(pIndex2UniqIndex);
|
if (shmid == -1)
|
||||||
if (!pDesc) free(pCI);
|
free(pIndex2UniqIndex);
|
||||||
|
if (!pDesc)
|
||||||
|
free(pCI);
|
||||||
}
|
}
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ProcXF86BigfontDispatch(
|
ProcXF86BigfontDispatch(ClientPtr client)
|
||||||
ClientPtr client)
|
|
||||||
{
|
{
|
||||||
REQUEST(xReq);
|
REQUEST(xReq);
|
||||||
|
|
||||||
|
|
@ -666,8 +672,7 @@ ProcXF86BigfontDispatch(
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
SProcXF86BigfontQueryVersion(
|
SProcXF86BigfontQueryVersion(ClientPtr client)
|
||||||
ClientPtr client)
|
|
||||||
{
|
{
|
||||||
REQUEST(xXF86BigfontQueryVersionReq);
|
REQUEST(xXF86BigfontQueryVersionReq);
|
||||||
char tmp;
|
char tmp;
|
||||||
|
|
@ -677,8 +682,7 @@ SProcXF86BigfontQueryVersion(
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
SProcXF86BigfontQueryFont(
|
SProcXF86BigfontQueryFont(ClientPtr client)
|
||||||
ClientPtr client)
|
|
||||||
{
|
{
|
||||||
REQUEST(xXF86BigfontQueryFontReq);
|
REQUEST(xXF86BigfontQueryFontReq);
|
||||||
char tmp;
|
char tmp;
|
||||||
|
|
@ -690,8 +694,7 @@ SProcXF86BigfontQueryFont(
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
SProcXF86BigfontDispatch(
|
SProcXF86BigfontDispatch(ClientPtr client)
|
||||||
ClientPtr client)
|
|
||||||
{
|
{
|
||||||
REQUEST(xReq);
|
REQUEST(xReq);
|
||||||
|
|
||||||
|
|
@ -713,8 +716,7 @@ XFree86BigfontExtensionInit(void)
|
||||||
XF86BigfontNumberErrors,
|
XF86BigfontNumberErrors,
|
||||||
ProcXF86BigfontDispatch,
|
ProcXF86BigfontDispatch,
|
||||||
SProcXF86BigfontDispatch,
|
SProcXF86BigfontDispatch,
|
||||||
XF86BigfontResetProc,
|
XF86BigfontResetProc, StandardMinorOpcode)) {
|
||||||
StandardMinorOpcode)) {
|
|
||||||
#ifdef HAS_SHM
|
#ifdef HAS_SHM
|
||||||
#ifdef MUST_CHECK_FOR_SHM_SYSCALL
|
#ifdef MUST_CHECK_FOR_SHM_SYSCALL
|
||||||
/*
|
/*
|
||||||
|
|
@ -724,7 +726,8 @@ XFree86BigfontExtensionInit(void)
|
||||||
* when shared memory support is not functional.
|
* when shared memory support is not functional.
|
||||||
*/
|
*/
|
||||||
if (!CheckForShmSyscall()) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
26
Xext/xres.c
26
Xext/xres.c
|
|
@ -97,7 +97,6 @@ ProcXResQueryClients (ClientPtr client)
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ResFindAllRes(pointer value, XID id, RESTYPE type, pointer cdata)
|
ResFindAllRes(pointer value, XID id, RESTYPE type, pointer cdata)
|
||||||
{
|
{
|
||||||
|
|
@ -130,7 +129,8 @@ ProcXResQueryClientResources (ClientPtr client)
|
||||||
num_types = 0;
|
num_types = 0;
|
||||||
|
|
||||||
for (i = 0; i <= lastResourceType; i++) {
|
for (i = 0; i <= lastResourceType; i++) {
|
||||||
if(counts[i]) num_types++;
|
if (counts[i])
|
||||||
|
num_types++;
|
||||||
}
|
}
|
||||||
|
|
||||||
rep.type = X_Reply;
|
rep.type = X_Reply;
|
||||||
|
|
@ -143,20 +143,23 @@ ProcXResQueryClientResources (ClientPtr client)
|
||||||
swapl(&rep.num_types);
|
swapl(&rep.num_types);
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteToClient (client,sizeof(xXResQueryClientResourcesReply),(char*)&rep);
|
WriteToClient(client, sizeof(xXResQueryClientResourcesReply),
|
||||||
|
(char *) &rep);
|
||||||
|
|
||||||
if (num_types) {
|
if (num_types) {
|
||||||
xXResType scratch;
|
xXResType scratch;
|
||||||
const char *name;
|
const char *name;
|
||||||
|
|
||||||
for (i = 0; i < lastResourceType; i++) {
|
for (i = 0; i < lastResourceType; i++) {
|
||||||
if(!counts[i]) continue;
|
if (!counts[i])
|
||||||
|
continue;
|
||||||
|
|
||||||
name = LookupResourceName(i + 1);
|
name = LookupResourceName(i + 1);
|
||||||
if (strcmp(name, XREGISTRY_UNKNOWN))
|
if (strcmp(name, XREGISTRY_UNKNOWN))
|
||||||
scratch.resource_type = MakeAtom(name, strlen(name), TRUE);
|
scratch.resource_type = MakeAtom(name, strlen(name), TRUE);
|
||||||
else {
|
else {
|
||||||
char buf[40];
|
char buf[40];
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "Unregistered resource %i", i + 1);
|
snprintf(buf, sizeof(buf), "Unregistered resource %i", i + 1);
|
||||||
scratch.resource_type = MakeAtom(buf, strlen(buf), TRUE);
|
scratch.resource_type = MakeAtom(buf, strlen(buf), TRUE);
|
||||||
}
|
}
|
||||||
|
|
@ -252,15 +255,13 @@ ProcXResQueryClientPixmapBytes (ClientPtr client)
|
||||||
* Make sure win background pixmaps also held to account.
|
* Make sure win background pixmaps also held to account.
|
||||||
*/
|
*/
|
||||||
FindClientResourcesByType(clients[clientID], RT_WINDOW,
|
FindClientResourcesByType(clients[clientID], RT_WINDOW,
|
||||||
ResFindWindowPixmaps,
|
ResFindWindowPixmaps, (pointer) (&bytes));
|
||||||
(pointer)(&bytes));
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GC Tile & Stipple pixmaps too.
|
* GC Tile & Stipple pixmaps too.
|
||||||
*/
|
*/
|
||||||
FindClientResourcesByType(clients[clientID], RT_GC,
|
FindClientResourcesByType(clients[clientID], RT_GC,
|
||||||
ResFindGCPixmaps,
|
ResFindGCPixmaps, (pointer) (&bytes));
|
||||||
(pointer)(&bytes));
|
|
||||||
|
|
||||||
#ifdef COMPOSITE
|
#ifdef COMPOSITE
|
||||||
/* FIXME: include composite pixmaps too */
|
/* FIXME: include composite pixmaps too */
|
||||||
|
|
@ -281,7 +282,8 @@ ProcXResQueryClientPixmapBytes (ClientPtr client)
|
||||||
swapl(&rep.bytes);
|
swapl(&rep.bytes);
|
||||||
swapl(&rep.bytes_overflow);
|
swapl(&rep.bytes_overflow);
|
||||||
}
|
}
|
||||||
WriteToClient (client,sizeof(xXResQueryClientPixmapBytesReply),(char*)&rep);
|
WriteToClient(client, sizeof(xXResQueryClientPixmapBytesReply),
|
||||||
|
(char *) &rep);
|
||||||
|
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
@ -299,7 +301,8 @@ ProcResDispatch (ClientPtr client)
|
||||||
return ProcXResQueryClientResources(client);
|
return ProcXResQueryClientResources(client);
|
||||||
case X_XResQueryClientPixmapBytes:
|
case X_XResQueryClientPixmapBytes:
|
||||||
return ProcXResQueryClientPixmapBytes(client);
|
return ProcXResQueryClientPixmapBytes(client);
|
||||||
default: break;
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return BadRequest;
|
return BadRequest;
|
||||||
|
|
@ -346,7 +349,8 @@ SProcResDispatch (ClientPtr client)
|
||||||
return SProcXResQueryClientResources(client);
|
return SProcXResQueryClientResources(client);
|
||||||
case X_XResQueryClientPixmapBytes:
|
case X_XResQueryClientPixmapBytes:
|
||||||
return SProcXResQueryClientPixmapBytes(client);
|
return SProcXResQueryClientPixmapBytes(client);
|
||||||
default: break;
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return BadRequest;
|
return BadRequest;
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,6 @@ typedef struct {
|
||||||
CARD32 id;
|
CARD32 id;
|
||||||
} SELinuxListItemRec;
|
} SELinuxListItemRec;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Extension Dispatch
|
* Extension Dispatch
|
||||||
*/
|
*/
|
||||||
|
|
@ -53,6 +52,7 @@ static security_context_t
|
||||||
SELinuxCopyContext(char *ptr, unsigned len)
|
SELinuxCopyContext(char *ptr, unsigned len)
|
||||||
{
|
{
|
||||||
security_context_t copy = malloc(len + 1);
|
security_context_t copy = malloc(len + 1);
|
||||||
|
|
||||||
if (!copy)
|
if (!copy)
|
||||||
return NULL;
|
return NULL;
|
||||||
strncpy(copy, ptr, len);
|
strncpy(copy, ptr, len);
|
||||||
|
|
@ -326,6 +326,7 @@ static void
|
||||||
SELinuxFreeItems(SELinuxListItemRec * items, int count)
|
SELinuxFreeItems(SELinuxListItemRec * items, int count)
|
||||||
{
|
{
|
||||||
int k;
|
int k;
|
||||||
|
|
||||||
for (k = 0; k < count; k++) {
|
for (k = 0; k < count; k++) {
|
||||||
freecon(items[k].octx);
|
freecon(items[k].octx);
|
||||||
freecon(items[k].dctx);
|
freecon(items[k].dctx);
|
||||||
|
|
@ -670,7 +671,6 @@ SProcSELinuxDispatch(ClientPtr client)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Extension Setup / Teardown
|
* 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
|
#define _XSELINUX_NEED_FLASK_MAP
|
||||||
#include "xselinuxint.h"
|
#include "xselinuxint.h"
|
||||||
|
|
||||||
|
|
||||||
/* structure passed to auditing callback */
|
/* structure passed to auditing callback */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
ClientPtr client; /* client */
|
ClientPtr client; /* client */
|
||||||
|
|
@ -80,7 +79,6 @@ static void SELinuxScreen(CallbackListPtr *, pointer, pointer);
|
||||||
/* "true" pointer value for use as callback data */
|
/* "true" pointer value for use as callback data */
|
||||||
static pointer truep = (pointer) 1;
|
static pointer truep = (pointer) 1;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Performs an SELinux permission check.
|
* Performs an SELinux permission check.
|
||||||
*/
|
*/
|
||||||
|
|
@ -133,11 +131,12 @@ SELinuxLabelClient(ClientPtr client)
|
||||||
/* Get cached command name if CLIENTIDS is enabled. */
|
/* Get cached command name if CLIENTIDS is enabled. */
|
||||||
const char *cmdname = GetClientCmdName(client);
|
const char *cmdname = GetClientCmdName(client);
|
||||||
Bool cached = (cmdname != NULL);
|
Bool cached = (cmdname != NULL);
|
||||||
|
|
||||||
/* If CLIENTIDS is disabled, figure out the command name from
|
/* If CLIENTIDS is disabled, figure out the command name from
|
||||||
* scratch. */
|
* scratch. */
|
||||||
if (!cmdname)
|
if (!cmdname) {
|
||||||
{
|
|
||||||
pid_t pid = DetermineClientPid(client);
|
pid_t pid = DetermineClientPid(client);
|
||||||
|
|
||||||
if (pid != -1)
|
if (pid != -1)
|
||||||
DetermineClientCmd(pid, &cmdname, NULL);
|
DetermineClientCmd(pid, &cmdname, NULL);
|
||||||
}
|
}
|
||||||
|
|
@ -228,8 +227,10 @@ SELinuxLabelResource(XaceResourceAccessRec *rec, SELinuxSubjectRec *subj,
|
||||||
/* Use the SID of the parent object in the labeling operation */
|
/* Use the SID of the parent object in the labeling operation */
|
||||||
PrivateRec **privatePtr = DEVPRIV_AT(rec->parent, offset);
|
PrivateRec **privatePtr = DEVPRIV_AT(rec->parent, offset);
|
||||||
SELinuxObjectRec *pobj = dixLookupPrivate(privatePtr, objectKey);
|
SELinuxObjectRec *pobj = dixLookupPrivate(privatePtr, objectKey);
|
||||||
|
|
||||||
tsid = pobj->sid;
|
tsid = pobj->sid;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
/* Use the SID of the subject */
|
/* Use the SID of the subject */
|
||||||
tsid = subj->sid;
|
tsid = subj->sid;
|
||||||
}
|
}
|
||||||
|
|
@ -243,16 +244,13 @@ SELinuxLabelResource(XaceResourceAccessRec *rec, SELinuxSubjectRec *subj,
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Libselinux Callbacks
|
* Libselinux Callbacks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int
|
static int
|
||||||
SELinuxAudit(void *auditdata,
|
SELinuxAudit(void *auditdata,
|
||||||
security_class_t class,
|
security_class_t class, char *msgbuf, size_t msgbufsize)
|
||||||
char *msgbuf,
|
|
||||||
size_t msgbufsize)
|
|
||||||
{
|
{
|
||||||
SELinuxAuditRec *audit = auditdata;
|
SELinuxAuditRec *audit = auditdata;
|
||||||
ClientPtr client = audit->client;
|
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 this is a new object that needs labeling, do it now */
|
||||||
if (rec->access_mode & DixCreateAccess) {
|
if (rec->access_mode & DixCreateAccess) {
|
||||||
SELinuxSubjectRec *dsubj;
|
SELinuxSubjectRec *dsubj;
|
||||||
|
|
||||||
dsubj = dixLookupPrivate(&rec->dev->devPrivates, subjectKey);
|
dsubj = dixLookupPrivate(&rec->dev->devPrivates, subjectKey);
|
||||||
|
|
||||||
if (subj->dev_create_sid) {
|
if (subj->dev_create_sid) {
|
||||||
/* Label the device with the create context */
|
/* Label the device with the create context */
|
||||||
obj->sid = subj->dev_create_sid;
|
obj->sid = subj->dev_create_sid;
|
||||||
dsubj->sid = subj->dev_create_sid;
|
dsubj->sid = subj->dev_create_sid;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
/* Label the device directly with the process SID */
|
/* Label the device directly with the process SID */
|
||||||
obj->sid = subj->sid;
|
obj->sid = subj->sid;
|
||||||
dsubj->sid = subj->sid;
|
dsubj->sid = subj->sid;
|
||||||
|
|
@ -628,7 +628,8 @@ SELinuxResource(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
||||||
class = SECCLASS_X_RESOURCE;
|
class = SECCLASS_X_RESOURCE;
|
||||||
privatePtr = &clients[CLIENT_ID(rec->id)]->devPrivates;
|
privatePtr = &clients[CLIENT_ID(rec->id)]->devPrivates;
|
||||||
obj = dixLookupPrivate(privatePtr, objectKey);
|
obj = dixLookupPrivate(privatePtr, objectKey);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
/* Yes: use the SID from the resource object itself */
|
/* Yes: use the SID from the resource object itself */
|
||||||
class = SELinuxTypeToClass(rec->rtype);
|
class = SELinuxTypeToClass(rec->rtype);
|
||||||
privatePtr = DEVPRIV_AT(rec->res, offset);
|
privatePtr = DEVPRIV_AT(rec->res, offset);
|
||||||
|
|
@ -733,7 +734,6 @@ SELinuxServer(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
||||||
rec->status = rc;
|
rec->status = rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* DIX Callbacks
|
* DIX Callbacks
|
||||||
*/
|
*/
|
||||||
|
|
@ -772,6 +772,7 @@ SELinuxResourceState(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
||||||
if (subj->sid) {
|
if (subj->sid) {
|
||||||
security_context_t ctx;
|
security_context_t ctx;
|
||||||
int rc = avc_sid_to_context_raw(subj->sid, &ctx);
|
int rc = avc_sid_to_context_raw(subj->sid, &ctx);
|
||||||
|
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
FatalError("SELinux: Failed to get security context!\n");
|
FatalError("SELinux: Failed to get security context!\n");
|
||||||
rc = dixChangeWindowProperty(serverClient,
|
rc = dixChangeWindowProperty(serverClient,
|
||||||
|
|
@ -780,7 +781,8 @@ SELinuxResourceState(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
FatalError("SELinux: Failed to set label property on window!\n");
|
FatalError("SELinux: Failed to set label property on window!\n");
|
||||||
freecon(ctx);
|
freecon(ctx);
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
FatalError("SELinux: Unexpected unlabeled client found\n");
|
FatalError("SELinux: Unexpected unlabeled client found\n");
|
||||||
|
|
||||||
obj = dixLookupPrivate(&pWin->devPrivates, objectKey);
|
obj = dixLookupPrivate(&pWin->devPrivates, objectKey);
|
||||||
|
|
@ -788,6 +790,7 @@ SELinuxResourceState(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
||||||
if (obj->sid) {
|
if (obj->sid) {
|
||||||
security_context_t ctx;
|
security_context_t ctx;
|
||||||
int rc = avc_sid_to_context_raw(obj->sid, &ctx);
|
int rc = avc_sid_to_context_raw(obj->sid, &ctx);
|
||||||
|
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
FatalError("SELinux: Failed to get security context!\n");
|
FatalError("SELinux: Failed to get security context!\n");
|
||||||
rc = dixChangeWindowProperty(serverClient,
|
rc = dixChangeWindowProperty(serverClient,
|
||||||
|
|
@ -796,11 +799,11 @@ SELinuxResourceState(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
FatalError("SELinux: Failed to set label property on window!\n");
|
FatalError("SELinux: Failed to set label property on window!\n");
|
||||||
freecon(ctx);
|
freecon(ctx);
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
FatalError("SELinux: Unexpected unlabeled window found\n");
|
FatalError("SELinux: Unexpected unlabeled window found\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int netlink_fd;
|
static int netlink_fd;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -868,11 +871,13 @@ SELinuxFlaskInit(void)
|
||||||
|
|
||||||
/* Set up SELinux stuff */
|
/* Set up SELinux stuff */
|
||||||
selinux_set_callback(SELINUX_CB_LOG, (union selinux_callback) SELinuxLog);
|
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 (selinux_set_mapping(map) < 0) {
|
||||||
if (errno == EINVAL) {
|
if (errno == EINVAL) {
|
||||||
ErrorF("SELinux: Invalid object class mapping, disabling SELinux support.\n");
|
ErrorF
|
||||||
|
("SELinux: Invalid object class mapping, disabling SELinux support.\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FatalError("SELinux: Failed to set up security class mapping\n");
|
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");
|
FatalError("SELinux: Failed to open the system audit log\n");
|
||||||
|
|
||||||
/* Allocate private storage */
|
/* Allocate private storage */
|
||||||
if (!dixRegisterPrivateKey(subjectKey, PRIVATE_XSELINUX, sizeof(SELinuxSubjectRec)) ||
|
if (!dixRegisterPrivateKey
|
||||||
!dixRegisterPrivateKey(objectKey, PRIVATE_XSELINUX, sizeof(SELinuxObjectRec)) ||
|
(subjectKey, PRIVATE_XSELINUX, sizeof(SELinuxSubjectRec)) ||
|
||||||
!dixRegisterPrivateKey(dataKey, PRIVATE_XSELINUX, sizeof(SELinuxObjectRec)))
|
!dixRegisterPrivateKey(objectKey, PRIVATE_XSELINUX,
|
||||||
|
sizeof(SELinuxObjectRec)) ||
|
||||||
|
!dixRegisterPrivateKey(dataKey, PRIVATE_XSELINUX,
|
||||||
|
sizeof(SELinuxObjectRec)))
|
||||||
FatalError("SELinux: Failed to allocate private storage.\n");
|
FatalError("SELinux: Failed to allocate private storage.\n");
|
||||||
|
|
||||||
/* Create atoms for doing window labeling */
|
/* Create atoms for doing window labeling */
|
||||||
|
|
|
||||||
|
|
@ -43,8 +43,10 @@ static struct selabel_handle *label_hnd;
|
||||||
|
|
||||||
/* Array of object classes indexed by resource type */
|
/* Array of object classes indexed by resource type */
|
||||||
SELinuxArrayRec arr_types;
|
SELinuxArrayRec arr_types;
|
||||||
|
|
||||||
/* Array of event SIDs indexed by event type */
|
/* Array of event SIDs indexed by event type */
|
||||||
SELinuxArrayRec arr_events;
|
SELinuxArrayRec arr_events;
|
||||||
|
|
||||||
/* Array of property and selection SID structures */
|
/* Array of property and selection SID structures */
|
||||||
SELinuxArrayRec arr_atoms;
|
SELinuxArrayRec arr_atoms;
|
||||||
|
|
||||||
|
|
@ -78,6 +80,7 @@ SELinuxArrayFree(SELinuxArrayRec *rec, int free_elements)
|
||||||
{
|
{
|
||||||
if (free_elements) {
|
if (free_elements) {
|
||||||
unsigned i = rec->size;
|
unsigned i = rec->size;
|
||||||
|
|
||||||
while (i)
|
while (i)
|
||||||
free(rec->array[--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 */
|
/* Look in the mappings of names to contexts */
|
||||||
if (selabel_lookup_raw(label_hnd, &ctx, name, map) == 0) {
|
if (selabel_lookup_raw(label_hnd, &ctx, name, map) == 0) {
|
||||||
obj->poly = 0;
|
obj->poly = 0;
|
||||||
} else if (errno != ENOENT) {
|
}
|
||||||
|
else if (errno != ENOENT) {
|
||||||
ErrorF("SELinux: a property label lookup failed!\n");
|
ErrorF("SELinux: a property label lookup failed!\n");
|
||||||
return BadValue;
|
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");
|
ErrorF("SELinux: a property label lookup failed!\n");
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
|
@ -141,7 +146,8 @@ SELinuxAtomToSID(Atom atom, int prop, SELinuxObjectRec **obj_rtn)
|
||||||
obj = &rec->prp;
|
obj = &rec->prp;
|
||||||
map = SELABEL_X_PROP;
|
map = SELABEL_X_PROP;
|
||||||
polymap = SELABEL_X_POLYPROP;
|
polymap = SELABEL_X_POLYPROP;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
obj = &rec->sel;
|
obj = &rec->sel;
|
||||||
map = SELABEL_X_SELN;
|
map = SELABEL_X_SELN;
|
||||||
polymap = SELABEL_X_POLYSELN;
|
polymap = SELABEL_X_POLYSELN;
|
||||||
|
|
@ -219,8 +225,7 @@ SELinuxPropertyToSID(Atom property, SELinuxSubjectRec *subj,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Perform a transition */
|
/* Perform a transition */
|
||||||
if (avc_compute_create(subj->sid, obj->sid,
|
if (avc_compute_create(subj->sid, obj->sid, SECCLASS_X_PROPERTY, &tsid) < 0) {
|
||||||
SECCLASS_X_PROPERTY, &tsid) < 0) {
|
|
||||||
ErrorF("SELinux: a compute_create call failed!\n");
|
ErrorF("SELinux: a compute_create call failed!\n");
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
|
@ -251,6 +256,7 @@ SELinuxEventToSID(unsigned type, security_id_t sid_of_window,
|
||||||
const char *name = LookupEventName(type);
|
const char *name = LookupEventName(type);
|
||||||
security_id_t sid;
|
security_id_t sid;
|
||||||
security_context_t ctx;
|
security_context_t ctx;
|
||||||
|
|
||||||
type &= 127;
|
type &= 127;
|
||||||
|
|
||||||
sid = SELinuxArrayGet(&arr_events, type);
|
sid = SELinuxArrayGet(&arr_events, type);
|
||||||
|
|
@ -327,6 +333,7 @@ SELinuxTypeToClass(RESTYPE type)
|
||||||
else {
|
else {
|
||||||
/* Need to do a string lookup */
|
/* Need to do a string lookup */
|
||||||
const char *str = LookupResourceName(type);
|
const char *str = LookupResourceName(type);
|
||||||
|
|
||||||
if (!strcmp(str, "PICTURE"))
|
if (!strcmp(str, "PICTURE"))
|
||||||
class = SECCLASS_X_DRAWABLE;
|
class = SECCLASS_X_DRAWABLE;
|
||||||
else if (!strcmp(str, "GLYPHSET"))
|
else if (!strcmp(str, "GLYPHSET"))
|
||||||
|
|
|
||||||
|
|
@ -63,10 +63,13 @@ typedef struct {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern DevPrivateKeyRec subjectKeyRec;
|
extern DevPrivateKeyRec subjectKeyRec;
|
||||||
|
|
||||||
#define subjectKey (&subjectKeyRec)
|
#define subjectKey (&subjectKeyRec)
|
||||||
extern DevPrivateKeyRec objectKeyRec;
|
extern DevPrivateKeyRec objectKeyRec;
|
||||||
|
|
||||||
#define objectKey (&objectKeyRec)
|
#define objectKey (&objectKeyRec)
|
||||||
extern DevPrivateKeyRec dataKeyRec;
|
extern DevPrivateKeyRec dataKeyRec;
|
||||||
|
|
||||||
#define dataKey (&dataKeyRec)
|
#define dataKey (&dataKeyRec)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -77,25 +80,26 @@ int
|
||||||
SELinuxAtomToSID(Atom atom, int prop, SELinuxObjectRec ** obj_rtn);
|
SELinuxAtomToSID(Atom atom, int prop, SELinuxObjectRec ** obj_rtn);
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
||||||
SELinuxSelectionToSID(Atom selection, SELinuxSubjectRec * subj,
|
SELinuxSelectionToSID(Atom selection, SELinuxSubjectRec * subj,
|
||||||
security_id_t * sid_rtn, int *poly_rtn);
|
security_id_t * sid_rtn, int *poly_rtn);
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
||||||
SELinuxPropertyToSID(Atom property, SELinuxSubjectRec * subj,
|
SELinuxPropertyToSID(Atom property, SELinuxSubjectRec * subj,
|
||||||
security_id_t * sid_rtn, int *poly_rtn);
|
security_id_t * sid_rtn, int *poly_rtn);
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
||||||
SELinuxEventToSID(unsigned type, security_id_t sid_of_window,
|
SELinuxEventToSID(unsigned type, security_id_t sid_of_window,
|
||||||
SELinuxObjectRec * sid_return);
|
SELinuxObjectRec * sid_return);
|
||||||
|
|
||||||
int
|
int
|
||||||
SELinuxExtensionToSID(const char *name, security_id_t * sid_rtn);
|
SELinuxExtensionToSID(const char *name, security_id_t * sid_rtn);
|
||||||
|
|
||||||
security_class_t
|
security_class_t SELinuxTypeToClass(RESTYPE type);
|
||||||
SELinuxTypeToClass(RESTYPE type);
|
|
||||||
|
|
||||||
security_context_t
|
security_context_t SELinuxDefaultClientLabel(void);
|
||||||
SELinuxDefaultClientLabel(void);
|
|
||||||
|
|
||||||
void
|
void
|
||||||
SELinuxLabelInit(void);
|
SELinuxLabelInit(void);
|
||||||
|
|
@ -113,7 +117,6 @@ SELinuxFlaskInit(void);
|
||||||
void
|
void
|
||||||
SELinuxFlaskReset(void);
|
SELinuxFlaskReset(void);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Private Flask definitions
|
* Private Flask definitions
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
151
Xext/xtest.c
151
Xext/xtest.c
|
|
@ -81,12 +81,10 @@ DeviceIntPtr xtestpointer, xtestkeyboard;
|
||||||
#include "panoramiXsrv.h"
|
#include "panoramiXsrv.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int XTestSwapFakeInput(
|
static int XTestSwapFakeInput(ClientPtr /* client */ ,
|
||||||
ClientPtr /* client */,
|
|
||||||
xReq * /* req */
|
xReq * /* req */
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ProcXTestGetVersion(ClientPtr client)
|
ProcXTestGetVersion(ClientPtr client)
|
||||||
{
|
{
|
||||||
|
|
@ -125,10 +123,9 @@ ProcXTestCompareCursor(ClientPtr client)
|
||||||
else if (stuff->cursor == XTestCurrentCursor)
|
else if (stuff->cursor == XTestCurrentCursor)
|
||||||
pCursor = GetSpriteCursor(ptr);
|
pCursor = GetSpriteCursor(ptr);
|
||||||
else {
|
else {
|
||||||
rc = dixLookupResourceByType((pointer *)&pCursor, stuff->cursor, RT_CURSOR,
|
rc = dixLookupResourceByType((pointer *) &pCursor, stuff->cursor,
|
||||||
client, DixReadAccess);
|
RT_CURSOR, client, DixReadAccess);
|
||||||
if (rc != Success)
|
if (rc != Success) {
|
||||||
{
|
|
||||||
client->errorValue = stuff->cursor;
|
client->errorValue = stuff->cursor;
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
@ -172,15 +169,13 @@ ProcXTestFakeInput(ClientPtr client)
|
||||||
ev = (xEvent *) &((xReq *) stuff)[1];
|
ev = (xEvent *) &((xReq *) stuff)[1];
|
||||||
type = ev->u.u.type & 0177;
|
type = ev->u.u.type & 0177;
|
||||||
|
|
||||||
if (type >= EXTENSION_EVENT_BASE)
|
if (type >= EXTENSION_EVENT_BASE) {
|
||||||
{
|
|
||||||
extension = TRUE;
|
extension = TRUE;
|
||||||
|
|
||||||
/* check device */
|
/* check device */
|
||||||
rc = dixLookupDevice(&dev, stuff->deviceid & 0177, client,
|
rc = dixLookupDevice(&dev, stuff->deviceid & 0177, client,
|
||||||
DixWriteAccess);
|
DixWriteAccess);
|
||||||
if (rc != Success)
|
if (rc != Success) {
|
||||||
{
|
|
||||||
client->errorValue = stuff->deviceid & 0177;
|
client->errorValue = stuff->deviceid & 0177;
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
@ -190,31 +185,27 @@ ProcXTestFakeInput(ClientPtr client)
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case XI_DeviceKeyPress:
|
case XI_DeviceKeyPress:
|
||||||
case XI_DeviceKeyRelease:
|
case XI_DeviceKeyRelease:
|
||||||
if (!dev->key)
|
if (!dev->key) {
|
||||||
{
|
|
||||||
client->errorValue = ev->u.u.type;
|
client->errorValue = ev->u.u.type;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case XI_DeviceButtonPress:
|
case XI_DeviceButtonPress:
|
||||||
case XI_DeviceButtonRelease:
|
case XI_DeviceButtonRelease:
|
||||||
if (!dev->button)
|
if (!dev->button) {
|
||||||
{
|
|
||||||
client->errorValue = ev->u.u.type;
|
client->errorValue = ev->u.u.type;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case XI_DeviceMotionNotify:
|
case XI_DeviceMotionNotify:
|
||||||
if (!dev->valuator)
|
if (!dev->valuator) {
|
||||||
{
|
|
||||||
client->errorValue = ev->u.u.type;
|
client->errorValue = ev->u.u.type;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case XI_ProximityIn:
|
case XI_ProximityIn:
|
||||||
case XI_ProximityOut:
|
case XI_ProximityOut:
|
||||||
if (!dev->proximity)
|
if (!dev->proximity) {
|
||||||
{
|
|
||||||
client->errorValue = ev->u.u.type;
|
client->errorValue = ev->u.u.type;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
|
@ -228,53 +219,51 @@ ProcXTestFakeInput(ClientPtr client)
|
||||||
if (nev == 1 && type == XI_DeviceMotionNotify)
|
if (nev == 1 && type == XI_DeviceMotionNotify)
|
||||||
return BadLength; /* DevMotion must be followed by DevValuator */
|
return BadLength; /* DevMotion must be followed by DevValuator */
|
||||||
|
|
||||||
if (type == XI_DeviceMotionNotify)
|
if (type == XI_DeviceMotionNotify) {
|
||||||
{
|
|
||||||
firstValuator = ((deviceValuator *) (ev + 1))->first_valuator;
|
firstValuator = ((deviceValuator *) (ev + 1))->first_valuator;
|
||||||
if (firstValuator > dev->valuator->numAxes)
|
if (firstValuator > dev->valuator->numAxes) {
|
||||||
{
|
|
||||||
client->errorValue = ev->u.u.type;
|
client->errorValue = ev->u.u.type;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ev->u.u.detail == xFalse)
|
if (ev->u.u.detail == xFalse)
|
||||||
flags |= POINTER_ABSOLUTE;
|
flags |= POINTER_ABSOLUTE;
|
||||||
} else
|
}
|
||||||
{
|
else {
|
||||||
firstValuator = 0;
|
firstValuator = 0;
|
||||||
flags |= POINTER_ABSOLUTE;
|
flags |= POINTER_ABSOLUTE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nev > 1 && !dev->valuator)
|
if (nev > 1 && !dev->valuator) {
|
||||||
{
|
|
||||||
client->errorValue = dv->first_valuator;
|
client->errorValue = dv->first_valuator;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* check validity of valuator events */
|
/* check validity of valuator events */
|
||||||
base = firstValuator;
|
base = firstValuator;
|
||||||
for (n = 1; n < nev; n++)
|
for (n = 1; n < nev; n++) {
|
||||||
{
|
|
||||||
dv = (deviceValuator *) (ev + n);
|
dv = (deviceValuator *) (ev + n);
|
||||||
if (dv->type != DeviceValuator)
|
if (dv->type != DeviceValuator) {
|
||||||
{
|
|
||||||
client->errorValue = dv->type;
|
client->errorValue = dv->type;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
if (dv->first_valuator != base)
|
if (dv->first_valuator != base) {
|
||||||
{
|
|
||||||
client->errorValue = dv->first_valuator;
|
client->errorValue = dv->first_valuator;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
switch(dv->num_valuators)
|
switch (dv->num_valuators) {
|
||||||
{
|
case 6:
|
||||||
case 6: valuators[base + 5] = dv->valuator5;
|
valuators[base + 5] = dv->valuator5;
|
||||||
case 5: valuators[base + 4] = dv->valuator4;
|
case 5:
|
||||||
case 4: valuators[base + 3] = dv->valuator3;
|
valuators[base + 4] = dv->valuator4;
|
||||||
case 3: valuators[base + 2] = dv->valuator2;
|
case 4:
|
||||||
case 2: valuators[base + 1] = dv->valuator1;
|
valuators[base + 3] = dv->valuator3;
|
||||||
case 1: valuators[base] = dv->valuator0;
|
case 3:
|
||||||
|
valuators[base + 2] = dv->valuator2;
|
||||||
|
case 2:
|
||||||
|
valuators[base + 1] = dv->valuator1;
|
||||||
|
case 1:
|
||||||
|
valuators[base] = dv->valuator0;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
client->errorValue = dv->num_valuators;
|
client->errorValue = dv->num_valuators;
|
||||||
|
|
@ -284,20 +273,18 @@ ProcXTestFakeInput(ClientPtr client)
|
||||||
base += dv->num_valuators;
|
base += dv->num_valuators;
|
||||||
numValuators += dv->num_valuators;
|
numValuators += dv->num_valuators;
|
||||||
|
|
||||||
if (firstValuator + numValuators > dev->valuator->numAxes)
|
if (firstValuator + numValuators > dev->valuator->numAxes) {
|
||||||
{
|
|
||||||
client->errorValue = dv->num_valuators;
|
client->errorValue = dv->num_valuators;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
type = type - XI_DeviceKeyPress + KeyPress;
|
type = type - XI_DeviceKeyPress + KeyPress;
|
||||||
|
|
||||||
} else
|
}
|
||||||
{
|
else {
|
||||||
if (nev != 1)
|
if (nev != 1)
|
||||||
return BadLength;
|
return BadLength;
|
||||||
switch (type)
|
switch (type) {
|
||||||
{
|
|
||||||
case KeyPress:
|
case KeyPress:
|
||||||
case KeyRelease:
|
case KeyRelease:
|
||||||
dev = PickKeyboard(client);
|
dev = PickKeyboard(client);
|
||||||
|
|
@ -324,8 +311,7 @@ ProcXTestFakeInput(ClientPtr client)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the event has a time set, wait for it to pass */
|
/* If the event has a time set, wait for it to pass */
|
||||||
if (ev->u.keyButtonPointer.time)
|
if (ev->u.keyButtonPointer.time) {
|
||||||
{
|
|
||||||
TimeStamp activateTime;
|
TimeStamp activateTime;
|
||||||
CARD32 ms;
|
CARD32 ms;
|
||||||
|
|
||||||
|
|
@ -339,13 +325,11 @@ ProcXTestFakeInput(ClientPtr client)
|
||||||
/* see mbuf.c:QueueDisplayRequest (from the deprecated Multibuffer
|
/* see mbuf.c:QueueDisplayRequest (from the deprecated Multibuffer
|
||||||
* extension) for code similar to this */
|
* extension) for code similar to this */
|
||||||
|
|
||||||
if (!ClientSleepUntil(client, &activateTime, NULL, NULL))
|
if (!ClientSleepUntil(client, &activateTime, NULL, NULL)) {
|
||||||
{
|
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
/* swap the request back so we can simply re-execute it */
|
/* swap the request back so we can simply re-execute it */
|
||||||
if (client->swapped)
|
if (client->swapped) {
|
||||||
{
|
|
||||||
(void) XTestSwapFakeInput(client, (xReq *) stuff);
|
(void) XTestSwapFakeInput(client, (xReq *) stuff);
|
||||||
swaps(&stuff->length);
|
swaps(&stuff->length);
|
||||||
}
|
}
|
||||||
|
|
@ -354,16 +338,14 @@ ProcXTestFakeInput(ClientPtr client)
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (type)
|
switch (type) {
|
||||||
{
|
|
||||||
case KeyPress:
|
case KeyPress:
|
||||||
case KeyRelease:
|
case KeyRelease:
|
||||||
if (!dev->key)
|
if (!dev->key)
|
||||||
return BadDevice;
|
return BadDevice;
|
||||||
|
|
||||||
if (ev->u.u.detail < dev->key->xkbInfo->desc->min_key_code ||
|
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;
|
client->errorValue = ev->u.u.detail;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
|
@ -374,20 +356,17 @@ ProcXTestFakeInput(ClientPtr client)
|
||||||
if (!dev->valuator)
|
if (!dev->valuator)
|
||||||
return BadDevice;
|
return BadDevice;
|
||||||
|
|
||||||
if (!(extension || ev->u.keyButtonPointer.root == None))
|
if (!(extension || ev->u.keyButtonPointer.root == None)) {
|
||||||
{
|
|
||||||
rc = dixLookupWindow(&root, ev->u.keyButtonPointer.root,
|
rc = dixLookupWindow(&root, ev->u.keyButtonPointer.root,
|
||||||
client, DixGetAttrAccess);
|
client, DixGetAttrAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
if (root->parent)
|
if (root->parent) {
|
||||||
{
|
|
||||||
client->errorValue = ev->u.keyButtonPointer.root;
|
client->errorValue = ev->u.keyButtonPointer.root;
|
||||||
return BadValue;
|
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;
|
client->errorValue = ev->u.u.detail;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
|
@ -400,8 +379,7 @@ ProcXTestFakeInput(ClientPtr client)
|
||||||
if (!dev->button)
|
if (!dev->button)
|
||||||
return BadDevice;
|
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;
|
client->errorValue = ev->u.u.detail;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
|
@ -423,7 +401,8 @@ ProcXTestFakeInput(ClientPtr client)
|
||||||
break;
|
break;
|
||||||
case KeyPress:
|
case KeyPress:
|
||||||
case KeyRelease:
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -441,8 +420,7 @@ ProcXTestGrabControl(ClientPtr client)
|
||||||
REQUEST(xXTestGrabControlReq);
|
REQUEST(xXTestGrabControlReq);
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xXTestGrabControlReq);
|
REQUEST_SIZE_MATCH(xXTestGrabControlReq);
|
||||||
if ((stuff->impervious != xTrue) && (stuff->impervious != xFalse))
|
if ((stuff->impervious != xTrue) && (stuff->impervious != xFalse)) {
|
||||||
{
|
|
||||||
client->errorValue = stuff->impervious;
|
client->errorValue = stuff->impervious;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
|
@ -457,8 +435,7 @@ static int
|
||||||
ProcXTestDispatch(ClientPtr client)
|
ProcXTestDispatch(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xReq);
|
REQUEST(xReq);
|
||||||
switch (stuff->data)
|
switch (stuff->data) {
|
||||||
{
|
|
||||||
case X_XTestGetVersion:
|
case X_XTestGetVersion:
|
||||||
return ProcXTestGetVersion(client);
|
return ProcXTestGetVersion(client);
|
||||||
case X_XTestCompareCursor:
|
case X_XTestCompareCursor:
|
||||||
|
|
@ -504,8 +481,7 @@ XTestSwapFakeInput(ClientPtr client, xReq *req)
|
||||||
EventSwapPtr proc;
|
EventSwapPtr proc;
|
||||||
|
|
||||||
nev = ((req->length << 2) - sizeof(xReq)) / sizeof(xEvent);
|
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 */
|
/* Swap event */
|
||||||
proc = EventSwapVector[ev->u.u.type & 0177];
|
proc = EventSwapVector[ev->u.u.type & 0177];
|
||||||
/* no swapping proc; invalid event type? */
|
/* no swapping proc; invalid event type? */
|
||||||
|
|
@ -523,6 +499,7 @@ static int
|
||||||
SProcXTestFakeInput(ClientPtr client)
|
SProcXTestFakeInput(ClientPtr client)
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
REQUEST(xReq);
|
REQUEST(xReq);
|
||||||
|
|
||||||
swaps(&stuff->length);
|
swaps(&stuff->length);
|
||||||
|
|
@ -546,8 +523,7 @@ static int
|
||||||
SProcXTestDispatch(ClientPtr client)
|
SProcXTestDispatch(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xReq);
|
REQUEST(xReq);
|
||||||
switch (stuff->data)
|
switch (stuff->data) {
|
||||||
{
|
|
||||||
case X_XTestGetVersion:
|
case X_XTestGetVersion:
|
||||||
return SProcXTestGetVersion(client);
|
return SProcXTestGetVersion(client);
|
||||||
case X_XTestCompareCursor:
|
case X_XTestCompareCursor:
|
||||||
|
|
@ -565,7 +541,8 @@ SProcXTestDispatch (ClientPtr client)
|
||||||
* Allocate an virtual slave device for xtest events, this
|
* Allocate an virtual slave device for xtest events, this
|
||||||
* is a slave device to inputInfo master devices
|
* is a slave device to inputInfo master devices
|
||||||
*/
|
*/
|
||||||
void InitXTestDevices(void)
|
void
|
||||||
|
InitXTestDevices(void)
|
||||||
{
|
{
|
||||||
if (AllocXTestDevice(serverClient, "Virtual core",
|
if (AllocXTestDevice(serverClient, "Virtual core",
|
||||||
&xtestpointer, &xtestkeyboard,
|
&xtestpointer, &xtestkeyboard,
|
||||||
|
|
@ -575,11 +552,11 @@ void InitXTestDevices(void)
|
||||||
if (ActivateDevice(xtestpointer, TRUE) != Success ||
|
if (ActivateDevice(xtestpointer, TRUE) != Success ||
|
||||||
ActivateDevice(xtestkeyboard, TRUE) != Success)
|
ActivateDevice(xtestkeyboard, TRUE) != Success)
|
||||||
FatalError("Failed to activate XTest core devices.");
|
FatalError("Failed to activate XTest core devices.");
|
||||||
if (!EnableDevice(xtestpointer, TRUE) ||
|
if (!EnableDevice(xtestpointer, TRUE) || !EnableDevice(xtestkeyboard, TRUE))
|
||||||
!EnableDevice(xtestkeyboard, TRUE))
|
|
||||||
FatalError("Failed to enable XTest core devices.");
|
FatalError("Failed to enable XTest core devices.");
|
||||||
|
|
||||||
AttachDevice(NULL, xtestpointer, inputInfo.pointer);
|
AttachDevice(NULL, xtestpointer, inputInfo.pointer);
|
||||||
|
|
||||||
AttachDevice(NULL, xtestkeyboard, inputInfo.keyboard);
|
AttachDevice(NULL, xtestkeyboard, inputInfo.keyboard);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -603,7 +580,8 @@ DeviceSetXTestProperty(DeviceIntPtr dev, Atom property,
|
||||||
* This only creates the pair, Activate/Enable Device
|
* This only creates the pair, Activate/Enable Device
|
||||||
* still need to be called.
|
* still need to be called.
|
||||||
*/
|
*/
|
||||||
int AllocXTestDevice (ClientPtr client, const char* name,
|
int
|
||||||
|
AllocXTestDevice(ClientPtr client, const char *name,
|
||||||
DeviceIntPtr *ptr, DeviceIntPtr *keybd,
|
DeviceIntPtr *ptr, DeviceIntPtr *keybd,
|
||||||
DeviceIntPtr master_ptr, DeviceIntPtr master_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)
|
if (asprintf(&xtestname, "%s XTEST", name) == -1)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
|
||||||
retval = AllocDevicePair( client, xtestname, ptr, keybd, CorePointerProc, CoreKeyboardProc, FALSE);
|
retval =
|
||||||
|
AllocDevicePair(client, xtestname, ptr, keybd, CorePointerProc,
|
||||||
|
CoreKeyboardProc, FALSE);
|
||||||
if (retval == Success) {
|
if (retval == Success) {
|
||||||
(*ptr)->xtest_master_id = master_ptr->id;
|
(*ptr)->xtest_master_id = master_ptr->id;
|
||||||
(*keybd)->xtest_master_id = master_keybd->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),
|
XIChangeDeviceProperty(*ptr, XIGetKnownProperty(XI_PROP_XTEST_DEVICE),
|
||||||
XA_INTEGER, 8, PropModeReplace, 1, &dummy,
|
XA_INTEGER, 8, PropModeReplace, 1, &dummy,
|
||||||
FALSE);
|
FALSE);
|
||||||
XISetDevicePropertyDeletable(*ptr, XIGetKnownProperty(XI_PROP_XTEST_DEVICE), FALSE);
|
XISetDevicePropertyDeletable(*ptr,
|
||||||
|
XIGetKnownProperty(XI_PROP_XTEST_DEVICE),
|
||||||
|
FALSE);
|
||||||
XIRegisterPropertyHandler(*ptr, DeviceSetXTestProperty, NULL, NULL);
|
XIRegisterPropertyHandler(*ptr, DeviceSetXTestProperty, NULL, NULL);
|
||||||
XIChangeDeviceProperty(*keybd, XIGetKnownProperty(XI_PROP_XTEST_DEVICE),
|
XIChangeDeviceProperty(*keybd, XIGetKnownProperty(XI_PROP_XTEST_DEVICE),
|
||||||
XA_INTEGER, 8, PropModeReplace, 1, &dummy,
|
XA_INTEGER, 8, PropModeReplace, 1, &dummy,
|
||||||
FALSE);
|
FALSE);
|
||||||
XISetDevicePropertyDeletable(*keybd, XIGetKnownProperty(XI_PROP_XTEST_DEVICE), FALSE);
|
XISetDevicePropertyDeletable(*keybd,
|
||||||
|
XIGetKnownProperty(XI_PROP_XTEST_DEVICE),
|
||||||
|
FALSE);
|
||||||
XIRegisterPropertyHandler(*keybd, DeviceSetXTestProperty, NULL, NULL);
|
XIRegisterPropertyHandler(*keybd, DeviceSetXTestProperty, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -664,8 +648,7 @@ GetXTestDevice(DeviceIntPtr master)
|
||||||
{
|
{
|
||||||
DeviceIntPtr it;
|
DeviceIntPtr it;
|
||||||
|
|
||||||
for (it = inputInfo.devices; it; it = it->next)
|
for (it = inputInfo.devices; it; it = it->next) {
|
||||||
{
|
|
||||||
if (IsXTestDevice(it, master))
|
if (IsXTestDevice(it, master))
|
||||||
return it;
|
return it;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
274
Xext/xvdisp.c
274
Xext/xvdisp.c
|
|
@ -55,10 +55,8 @@ unsigned long XvXRTPort;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int
|
static int
|
||||||
SWriteQueryExtensionReply(
|
SWriteQueryExtensionReply(ClientPtr client, xvQueryExtensionReply * rep)
|
||||||
ClientPtr client,
|
{
|
||||||
xvQueryExtensionReply *rep
|
|
||||||
){
|
|
||||||
swaps(&rep->sequenceNumber);
|
swaps(&rep->sequenceNumber);
|
||||||
swapl(&rep->length);
|
swapl(&rep->length);
|
||||||
swaps(&rep->version);
|
swaps(&rep->version);
|
||||||
|
|
@ -70,10 +68,8 @@ SWriteQueryExtensionReply(
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
SWriteQueryAdaptorsReply(
|
SWriteQueryAdaptorsReply(ClientPtr client, xvQueryAdaptorsReply * rep)
|
||||||
ClientPtr client,
|
{
|
||||||
xvQueryAdaptorsReply *rep
|
|
||||||
){
|
|
||||||
swaps(&rep->sequenceNumber);
|
swaps(&rep->sequenceNumber);
|
||||||
swapl(&rep->length);
|
swapl(&rep->length);
|
||||||
swaps(&rep->num_adaptors);
|
swaps(&rep->num_adaptors);
|
||||||
|
|
@ -84,10 +80,8 @@ SWriteQueryAdaptorsReply(
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
SWriteQueryEncodingsReply(
|
SWriteQueryEncodingsReply(ClientPtr client, xvQueryEncodingsReply * rep)
|
||||||
ClientPtr client,
|
{
|
||||||
xvQueryEncodingsReply *rep
|
|
||||||
){
|
|
||||||
swaps(&rep->sequenceNumber);
|
swaps(&rep->sequenceNumber);
|
||||||
swapl(&rep->length);
|
swapl(&rep->length);
|
||||||
swaps(&rep->num_encodings);
|
swaps(&rep->num_encodings);
|
||||||
|
|
@ -98,10 +92,8 @@ SWriteQueryEncodingsReply(
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
SWriteAdaptorInfo(
|
SWriteAdaptorInfo(ClientPtr client, xvAdaptorInfo * pAdaptor)
|
||||||
ClientPtr client,
|
{
|
||||||
xvAdaptorInfo *pAdaptor
|
|
||||||
){
|
|
||||||
swapl(&pAdaptor->base_id);
|
swapl(&pAdaptor->base_id);
|
||||||
swaps(&pAdaptor->name_size);
|
swaps(&pAdaptor->name_size);
|
||||||
swaps(&pAdaptor->num_ports);
|
swaps(&pAdaptor->num_ports);
|
||||||
|
|
@ -113,10 +105,8 @@ SWriteAdaptorInfo(
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
SWriteEncodingInfo(
|
SWriteEncodingInfo(ClientPtr client, xvEncodingInfo * pEncoding)
|
||||||
ClientPtr client,
|
{
|
||||||
xvEncodingInfo *pEncoding
|
|
||||||
){
|
|
||||||
|
|
||||||
swapl(&pEncoding->encoding);
|
swapl(&pEncoding->encoding);
|
||||||
swaps(&pEncoding->name_size);
|
swaps(&pEncoding->name_size);
|
||||||
|
|
@ -130,10 +120,8 @@ SWriteEncodingInfo(
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
SWriteFormat(
|
SWriteFormat(ClientPtr client, xvFormat * pFormat)
|
||||||
ClientPtr client,
|
{
|
||||||
xvFormat *pFormat
|
|
||||||
){
|
|
||||||
swapl(&pFormat->visual);
|
swapl(&pFormat->visual);
|
||||||
(void) WriteToClient(client, sz_xvFormat, (char *) pFormat);
|
(void) WriteToClient(client, sz_xvFormat, (char *) pFormat);
|
||||||
|
|
||||||
|
|
@ -141,10 +129,8 @@ SWriteFormat(
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
SWriteAttributeInfo(
|
SWriteAttributeInfo(ClientPtr client, xvAttributeInfo * pAtt)
|
||||||
ClientPtr client,
|
{
|
||||||
xvAttributeInfo *pAtt
|
|
||||||
){
|
|
||||||
swapl(&pAtt->flags);
|
swapl(&pAtt->flags);
|
||||||
swapl(&pAtt->size);
|
swapl(&pAtt->size);
|
||||||
swapl(&pAtt->min);
|
swapl(&pAtt->min);
|
||||||
|
|
@ -155,10 +141,8 @@ SWriteAttributeInfo(
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
SWriteImageFormatInfo(
|
SWriteImageFormatInfo(ClientPtr client, xvImageFormatInfo * pImage)
|
||||||
ClientPtr client,
|
{
|
||||||
xvImageFormatInfo *pImage
|
|
||||||
){
|
|
||||||
swapl(&pImage->id);
|
swapl(&pImage->id);
|
||||||
swapl(&pImage->red_mask);
|
swapl(&pImage->red_mask);
|
||||||
swapl(&pImage->green_mask);
|
swapl(&pImage->green_mask);
|
||||||
|
|
@ -179,10 +163,8 @@ SWriteImageFormatInfo(
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
SWriteGrabPortReply(
|
SWriteGrabPortReply(ClientPtr client, xvGrabPortReply * rep)
|
||||||
ClientPtr client,
|
{
|
||||||
xvGrabPortReply *rep
|
|
||||||
){
|
|
||||||
swaps(&rep->sequenceNumber);
|
swaps(&rep->sequenceNumber);
|
||||||
swapl(&rep->length);
|
swapl(&rep->length);
|
||||||
|
|
||||||
|
|
@ -192,10 +174,8 @@ SWriteGrabPortReply(
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
SWriteGetPortAttributeReply(
|
SWriteGetPortAttributeReply(ClientPtr client, xvGetPortAttributeReply * rep)
|
||||||
ClientPtr client,
|
{
|
||||||
xvGetPortAttributeReply *rep
|
|
||||||
){
|
|
||||||
swaps(&rep->sequenceNumber);
|
swaps(&rep->sequenceNumber);
|
||||||
swapl(&rep->length);
|
swapl(&rep->length);
|
||||||
swapl(&rep->value);
|
swapl(&rep->value);
|
||||||
|
|
@ -206,10 +186,8 @@ SWriteGetPortAttributeReply(
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
SWriteQueryBestSizeReply(
|
SWriteQueryBestSizeReply(ClientPtr client, xvQueryBestSizeReply * rep)
|
||||||
ClientPtr client,
|
{
|
||||||
xvQueryBestSizeReply *rep
|
|
||||||
){
|
|
||||||
swaps(&rep->sequenceNumber);
|
swaps(&rep->sequenceNumber);
|
||||||
swapl(&rep->length);
|
swapl(&rep->length);
|
||||||
swaps(&rep->actual_width);
|
swaps(&rep->actual_width);
|
||||||
|
|
@ -221,10 +199,9 @@ SWriteQueryBestSizeReply(
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
SWriteQueryPortAttributesReply(
|
SWriteQueryPortAttributesReply(ClientPtr client,
|
||||||
ClientPtr client,
|
xvQueryPortAttributesReply * rep)
|
||||||
xvQueryPortAttributesReply *rep
|
{
|
||||||
){
|
|
||||||
swaps(&rep->sequenceNumber);
|
swaps(&rep->sequenceNumber);
|
||||||
swapl(&rep->length);
|
swapl(&rep->length);
|
||||||
swapl(&rep->num_attributes);
|
swapl(&rep->num_attributes);
|
||||||
|
|
@ -236,10 +213,9 @@ SWriteQueryPortAttributesReply(
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
SWriteQueryImageAttributesReply(
|
SWriteQueryImageAttributesReply(ClientPtr client,
|
||||||
ClientPtr client,
|
xvQueryImageAttributesReply * rep)
|
||||||
xvQueryImageAttributesReply *rep
|
{
|
||||||
){
|
|
||||||
swaps(&rep->sequenceNumber);
|
swaps(&rep->sequenceNumber);
|
||||||
swapl(&rep->length);
|
swapl(&rep->length);
|
||||||
swapl(&rep->num_planes);
|
swapl(&rep->num_planes);
|
||||||
|
|
@ -253,10 +229,8 @@ SWriteQueryImageAttributesReply(
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
SWriteListImageFormatsReply(
|
SWriteListImageFormatsReply(ClientPtr client, xvListImageFormatsReply * rep)
|
||||||
ClientPtr client,
|
{
|
||||||
xvListImageFormatsReply *rep
|
|
||||||
){
|
|
||||||
swaps(&rep->sequenceNumber);
|
swaps(&rep->sequenceNumber);
|
||||||
swapl(&rep->length);
|
swapl(&rep->length);
|
||||||
swapl(&rep->num_formats);
|
swapl(&rep->num_formats);
|
||||||
|
|
@ -329,6 +303,7 @@ static int
|
||||||
ProcXvQueryExtension(ClientPtr client)
|
ProcXvQueryExtension(ClientPtr client)
|
||||||
{
|
{
|
||||||
xvQueryExtensionReply rep;
|
xvQueryExtensionReply rep;
|
||||||
|
|
||||||
/* REQUEST(xvQueryExtensionReq); */
|
/* REQUEST(xvQueryExtensionReq); */
|
||||||
REQUEST_SIZE_MATCH(xvQueryExtensionReq);
|
REQUEST_SIZE_MATCH(xvQueryExtensionReq);
|
||||||
|
|
||||||
|
|
@ -367,8 +342,7 @@ ProcXvQueryAdaptors(ClientPtr client)
|
||||||
pScreen = pWin->drawable.pScreen;
|
pScreen = pWin->drawable.pScreen;
|
||||||
pxvs = (XvScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
|
pxvs = (XvScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
|
||||||
XvGetScreenKey());
|
XvGetScreenKey());
|
||||||
if (!pxvs)
|
if (!pxvs) {
|
||||||
{
|
|
||||||
rep.type = X_Reply;
|
rep.type = X_Reply;
|
||||||
rep.sequenceNumber = client->sequence;
|
rep.sequenceNumber = client->sequence;
|
||||||
rep.num_adaptors = 0;
|
rep.num_adaptors = 0;
|
||||||
|
|
@ -393,8 +367,7 @@ ProcXvQueryAdaptors(ClientPtr client)
|
||||||
|
|
||||||
na = pxvs->nAdaptors;
|
na = pxvs->nAdaptors;
|
||||||
pa = pxvs->pAdaptors;
|
pa = pxvs->pAdaptors;
|
||||||
while (na--)
|
while (na--) {
|
||||||
{
|
|
||||||
totalSize += pad_to_int32(strlen(pa->name));
|
totalSize += pad_to_int32(strlen(pa->name));
|
||||||
totalSize += pa->nFormats * sz_xvFormat;
|
totalSize += pa->nFormats * sz_xvFormat;
|
||||||
pa++;
|
pa++;
|
||||||
|
|
@ -406,8 +379,7 @@ ProcXvQueryAdaptors(ClientPtr client)
|
||||||
|
|
||||||
na = pxvs->nAdaptors;
|
na = pxvs->nAdaptors;
|
||||||
pa = pxvs->pAdaptors;
|
pa = pxvs->pAdaptors;
|
||||||
while (na--)
|
while (na--) {
|
||||||
{
|
|
||||||
|
|
||||||
ainfo.base_id = pa->base_id;
|
ainfo.base_id = pa->base_id;
|
||||||
ainfo.num_ports = pa->nPorts;
|
ainfo.num_ports = pa->nPorts;
|
||||||
|
|
@ -421,8 +393,7 @@ ProcXvQueryAdaptors(ClientPtr client)
|
||||||
|
|
||||||
nf = pa->nFormats;
|
nf = pa->nFormats;
|
||||||
pf = pa->pFormats;
|
pf = pa->pFormats;
|
||||||
while (nf--)
|
while (nf--) {
|
||||||
{
|
|
||||||
format.depth = pf->depth;
|
format.depth = pf->depth;
|
||||||
format.visual = pf->visual;
|
format.visual = pf->visual;
|
||||||
_WriteFormat(client, &format);
|
_WriteFormat(client, &format);
|
||||||
|
|
@ -453,8 +424,7 @@ ProcXvQueryEncodings(ClientPtr client)
|
||||||
|
|
||||||
VALIDATE_XV_PORT(stuff->port, pPort, 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;
|
client->errorValue = stuff->port;
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
@ -468,8 +438,7 @@ ProcXvQueryEncodings(ClientPtr client)
|
||||||
ne = pPort->pAdaptor->nEncodings;
|
ne = pPort->pAdaptor->nEncodings;
|
||||||
pe = pPort->pAdaptor->pEncodings;
|
pe = pPort->pAdaptor->pEncodings;
|
||||||
totalSize = ne * sz_xvEncodingInfo;
|
totalSize = ne * sz_xvEncodingInfo;
|
||||||
while (ne--)
|
while (ne--) {
|
||||||
{
|
|
||||||
totalSize += pad_to_int32(strlen(pe->name));
|
totalSize += pad_to_int32(strlen(pe->name));
|
||||||
pe++;
|
pe++;
|
||||||
}
|
}
|
||||||
|
|
@ -480,8 +449,7 @@ ProcXvQueryEncodings(ClientPtr client)
|
||||||
|
|
||||||
ne = pPort->pAdaptor->nEncodings;
|
ne = pPort->pAdaptor->nEncodings;
|
||||||
pe = pPort->pAdaptor->pEncodings;
|
pe = pPort->pAdaptor->pEncodings;
|
||||||
while (ne--)
|
while (ne--) {
|
||||||
{
|
|
||||||
einfo.encoding = pe->id;
|
einfo.encoding = pe->id;
|
||||||
einfo.name_size = nameSize = strlen(pe->name);
|
einfo.name_size = nameSize = strlen(pe->name);
|
||||||
einfo.width = pe->width;
|
einfo.width = pe->width;
|
||||||
|
|
@ -510,22 +478,19 @@ ProcXvPutVideo(ClientPtr client)
|
||||||
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
|
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
|
||||||
VALIDATE_XV_PORT(stuff->port, pPort, 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;
|
client->errorValue = stuff->port;
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(pPort->pAdaptor->type & XvInputMask) ||
|
if (!(pPort->pAdaptor->type & XvInputMask) ||
|
||||||
!(pPort->pAdaptor->type & XvVideoMask))
|
!(pPort->pAdaptor->type & XvVideoMask)) {
|
||||||
{
|
|
||||||
client->errorValue = stuff->port;
|
client->errorValue = stuff->port;
|
||||||
return BadMatch;
|
return BadMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = XvdiMatchPort(pPort, pDraw);
|
status = XvdiMatchPort(pPort, pDraw);
|
||||||
if (status != Success)
|
if (status != Success) {
|
||||||
{
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -548,22 +513,19 @@ ProcXvPutStill(ClientPtr client)
|
||||||
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
|
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
|
||||||
VALIDATE_XV_PORT(stuff->port, pPort, 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;
|
client->errorValue = stuff->port;
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(pPort->pAdaptor->type & XvInputMask) ||
|
if (!(pPort->pAdaptor->type & XvInputMask) ||
|
||||||
!(pPort->pAdaptor->type & XvStillMask))
|
!(pPort->pAdaptor->type & XvStillMask)) {
|
||||||
{
|
|
||||||
client->errorValue = stuff->port;
|
client->errorValue = stuff->port;
|
||||||
return BadMatch;
|
return BadMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = XvdiMatchPort(pPort, pDraw);
|
status = XvdiMatchPort(pPort, pDraw);
|
||||||
if (status != Success)
|
if (status != Success) {
|
||||||
{
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -586,22 +548,19 @@ ProcXvGetVideo(ClientPtr client)
|
||||||
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixReadAccess);
|
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixReadAccess);
|
||||||
VALIDATE_XV_PORT(stuff->port, pPort, 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;
|
client->errorValue = stuff->port;
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(pPort->pAdaptor->type & XvOutputMask) ||
|
if (!(pPort->pAdaptor->type & XvOutputMask) ||
|
||||||
!(pPort->pAdaptor->type & XvVideoMask))
|
!(pPort->pAdaptor->type & XvVideoMask)) {
|
||||||
{
|
|
||||||
client->errorValue = stuff->port;
|
client->errorValue = stuff->port;
|
||||||
return BadMatch;
|
return BadMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = XvdiMatchPort(pPort, pDraw);
|
status = XvdiMatchPort(pPort, pDraw);
|
||||||
if (status != Success)
|
if (status != Success) {
|
||||||
{
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -624,22 +583,19 @@ ProcXvGetStill(ClientPtr client)
|
||||||
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixReadAccess);
|
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixReadAccess);
|
||||||
VALIDATE_XV_PORT(stuff->port, pPort, 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;
|
client->errorValue = stuff->port;
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(pPort->pAdaptor->type & XvOutputMask) ||
|
if (!(pPort->pAdaptor->type & XvOutputMask) ||
|
||||||
!(pPort->pAdaptor->type & XvStillMask))
|
!(pPort->pAdaptor->type & XvStillMask)) {
|
||||||
{
|
|
||||||
client->errorValue = stuff->port;
|
client->errorValue = stuff->port;
|
||||||
return BadMatch;
|
return BadMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = XvdiMatchPort(pPort, pDraw);
|
status = XvdiMatchPort(pPort, pDraw);
|
||||||
if (status != Success)
|
if (status != Success) {
|
||||||
{
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -653,10 +609,12 @@ ProcXvSelectVideoNotify(ClientPtr client)
|
||||||
{
|
{
|
||||||
DrawablePtr pDraw;
|
DrawablePtr pDraw;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
REQUEST(xvSelectVideoNotifyReq);
|
REQUEST(xvSelectVideoNotifyReq);
|
||||||
REQUEST_SIZE_MATCH(xvSelectVideoNotifyReq);
|
REQUEST_SIZE_MATCH(xvSelectVideoNotifyReq);
|
||||||
|
|
||||||
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, DixReceiveAccess);
|
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
|
||||||
|
DixReceiveAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
|
|
@ -668,13 +626,13 @@ ProcXvSelectPortNotify(ClientPtr client)
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
XvPortPtr pPort;
|
XvPortPtr pPort;
|
||||||
|
|
||||||
REQUEST(xvSelectPortNotifyReq);
|
REQUEST(xvSelectPortNotifyReq);
|
||||||
REQUEST_SIZE_MATCH(xvSelectPortNotifyReq);
|
REQUEST_SIZE_MATCH(xvSelectPortNotifyReq);
|
||||||
|
|
||||||
VALIDATE_XV_PORT(stuff->port, pPort, 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;
|
client->errorValue = stuff->port;
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
@ -688,21 +646,20 @@ ProcXvGrabPort(ClientPtr client)
|
||||||
int result, status;
|
int result, status;
|
||||||
XvPortPtr pPort;
|
XvPortPtr pPort;
|
||||||
xvGrabPortReply rep;
|
xvGrabPortReply rep;
|
||||||
|
|
||||||
REQUEST(xvGrabPortReq);
|
REQUEST(xvGrabPortReq);
|
||||||
REQUEST_SIZE_MATCH(xvGrabPortReq);
|
REQUEST_SIZE_MATCH(xvGrabPortReq);
|
||||||
|
|
||||||
VALIDATE_XV_PORT(stuff->port, pPort, 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;
|
client->errorValue = stuff->port;
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = XvdiGrabPort(client, pPort, stuff->time, &result);
|
status = XvdiGrabPort(client, pPort, stuff->time, &result);
|
||||||
|
|
||||||
if (status != Success)
|
if (status != Success) {
|
||||||
{
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -721,13 +678,13 @@ ProcXvUngrabPort(ClientPtr client)
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
XvPortPtr pPort;
|
XvPortPtr pPort;
|
||||||
|
|
||||||
REQUEST(xvGrabPortReq);
|
REQUEST(xvGrabPortReq);
|
||||||
REQUEST_SIZE_MATCH(xvGrabPortReq);
|
REQUEST_SIZE_MATCH(xvGrabPortReq);
|
||||||
|
|
||||||
VALIDATE_XV_PORT(stuff->port, pPort, 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;
|
client->errorValue = stuff->port;
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
@ -741,13 +698,13 @@ ProcXvStopVideo(ClientPtr client)
|
||||||
int status, rc;
|
int status, rc;
|
||||||
DrawablePtr pDraw;
|
DrawablePtr pDraw;
|
||||||
XvPortPtr pPort;
|
XvPortPtr pPort;
|
||||||
|
|
||||||
REQUEST(xvStopVideoReq);
|
REQUEST(xvStopVideoReq);
|
||||||
REQUEST_SIZE_MATCH(xvStopVideoReq);
|
REQUEST_SIZE_MATCH(xvStopVideoReq);
|
||||||
|
|
||||||
VALIDATE_XV_PORT(stuff->port, pPort, 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;
|
client->errorValue = stuff->port;
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
@ -764,24 +721,24 @@ ProcXvSetPortAttribute(ClientPtr client)
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
XvPortPtr pPort;
|
XvPortPtr pPort;
|
||||||
|
|
||||||
REQUEST(xvSetPortAttributeReq);
|
REQUEST(xvSetPortAttributeReq);
|
||||||
REQUEST_SIZE_MATCH(xvSetPortAttributeReq);
|
REQUEST_SIZE_MATCH(xvSetPortAttributeReq);
|
||||||
|
|
||||||
VALIDATE_XV_PORT(stuff->port, pPort, DixSetAttrAccess);
|
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;
|
client->errorValue = stuff->port;
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ValidAtom(stuff->attribute))
|
if (!ValidAtom(stuff->attribute)) {
|
||||||
{
|
|
||||||
client->errorValue = stuff->attribute;
|
client->errorValue = stuff->attribute;
|
||||||
return BadAtom;
|
return BadAtom;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = XvdiSetPortAttribute(client, pPort, stuff->attribute, stuff->value);
|
status =
|
||||||
|
XvdiSetPortAttribute(client, pPort, stuff->attribute, stuff->value);
|
||||||
|
|
||||||
if (status == BadMatch)
|
if (status == BadMatch)
|
||||||
client->errorValue = stuff->attribute;
|
client->errorValue = stuff->attribute;
|
||||||
|
|
@ -798,26 +755,24 @@ ProcXvGetPortAttribute(ClientPtr client)
|
||||||
int status;
|
int status;
|
||||||
XvPortPtr pPort;
|
XvPortPtr pPort;
|
||||||
xvGetPortAttributeReply rep;
|
xvGetPortAttributeReply rep;
|
||||||
|
|
||||||
REQUEST(xvGetPortAttributeReq);
|
REQUEST(xvGetPortAttributeReq);
|
||||||
REQUEST_SIZE_MATCH(xvGetPortAttributeReq);
|
REQUEST_SIZE_MATCH(xvGetPortAttributeReq);
|
||||||
|
|
||||||
VALIDATE_XV_PORT(stuff->port, pPort, DixGetAttrAccess);
|
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;
|
client->errorValue = stuff->port;
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ValidAtom(stuff->attribute))
|
if (!ValidAtom(stuff->attribute)) {
|
||||||
{
|
|
||||||
client->errorValue = stuff->attribute;
|
client->errorValue = stuff->attribute;
|
||||||
return BadAtom;
|
return BadAtom;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = XvdiGetPortAttribute(client, pPort, stuff->attribute, &value);
|
status = XvdiGetPortAttribute(client, pPort, stuff->attribute, &value);
|
||||||
if (status != Success)
|
if (status != Success) {
|
||||||
{
|
|
||||||
client->errorValue = stuff->attribute;
|
client->errorValue = stuff->attribute;
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
@ -839,13 +794,13 @@ ProcXvQueryBestSize(ClientPtr client)
|
||||||
unsigned int actual_width, actual_height;
|
unsigned int actual_width, actual_height;
|
||||||
XvPortPtr pPort;
|
XvPortPtr pPort;
|
||||||
xvQueryBestSizeReply rep;
|
xvQueryBestSizeReply rep;
|
||||||
|
|
||||||
REQUEST(xvQueryBestSizeReq);
|
REQUEST(xvQueryBestSizeReq);
|
||||||
REQUEST_SIZE_MATCH(xvQueryBestSizeReq);
|
REQUEST_SIZE_MATCH(xvQueryBestSizeReq);
|
||||||
|
|
||||||
VALIDATE_XV_PORT(stuff->port, pPort, 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;
|
client->errorValue = stuff->port;
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
@ -867,7 +822,6 @@ ProcXvQueryBestSize(ClientPtr client)
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ProcXvQueryPortAttributes(ClientPtr client)
|
ProcXvQueryPortAttributes(ClientPtr client)
|
||||||
{
|
{
|
||||||
|
|
@ -876,13 +830,13 @@ ProcXvQueryPortAttributes(ClientPtr client)
|
||||||
XvAttributePtr pAtt;
|
XvAttributePtr pAtt;
|
||||||
xvQueryPortAttributesReply rep;
|
xvQueryPortAttributesReply rep;
|
||||||
xvAttributeInfo Info;
|
xvAttributeInfo Info;
|
||||||
|
|
||||||
REQUEST(xvQueryPortAttributesReq);
|
REQUEST(xvQueryPortAttributesReq);
|
||||||
REQUEST_SIZE_MATCH(xvQueryPortAttributesReq);
|
REQUEST_SIZE_MATCH(xvQueryPortAttributesReq);
|
||||||
|
|
||||||
VALIDATE_XV_PORT(stuff->port, pPort, DixGetAttrAccess);
|
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;
|
client->errorValue = stuff->port;
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
@ -893,8 +847,7 @@ ProcXvQueryPortAttributes(ClientPtr client)
|
||||||
rep.text_size = 0;
|
rep.text_size = 0;
|
||||||
|
|
||||||
for (i = 0, pAtt = pPort->pAdaptor->pAttributes;
|
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);
|
rep.text_size += pad_to_int32(strlen(pAtt->name) + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -905,8 +858,7 @@ ProcXvQueryPortAttributes(ClientPtr client)
|
||||||
_WriteQueryPortAttributesReply(client, &rep);
|
_WriteQueryPortAttributesReply(client, &rep);
|
||||||
|
|
||||||
for (i = 0, pAtt = pPort->pAdaptor->pAttributes;
|
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 */
|
size = strlen(pAtt->name) + 1; /* pass the NULL */
|
||||||
Info.flags = pAtt->flags;
|
Info.flags = pAtt->flags;
|
||||||
Info.min = pAtt->min_value;
|
Info.min = pAtt->min_value;
|
||||||
|
|
@ -937,22 +889,19 @@ ProcXvPutImage(ClientPtr client)
|
||||||
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
|
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
|
||||||
VALIDATE_XV_PORT(stuff->port, pPort, 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;
|
client->errorValue = stuff->port;
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(pPort->pAdaptor->type & XvImageMask) ||
|
if (!(pPort->pAdaptor->type & XvImageMask) ||
|
||||||
!(pPort->pAdaptor->type & XvInputMask))
|
!(pPort->pAdaptor->type & XvInputMask)) {
|
||||||
{
|
|
||||||
client->errorValue = stuff->port;
|
client->errorValue = stuff->port;
|
||||||
return BadMatch;
|
return BadMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = XvdiMatchPort(pPort, pDraw);
|
status = XvdiMatchPort(pPort, pDraw);
|
||||||
if (status != Success)
|
if (status != Success) {
|
||||||
{
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -969,7 +918,8 @@ ProcXvPutImage(ClientPtr client)
|
||||||
width = stuff->width;
|
width = stuff->width;
|
||||||
height = stuff->height;
|
height = stuff->height;
|
||||||
size = (*pPort->pAdaptor->ddQueryImageAttributes) (client,
|
size = (*pPort->pAdaptor->ddQueryImageAttributes) (client,
|
||||||
pPort, pImage, &width, &height, NULL, NULL);
|
pPort, pImage, &width,
|
||||||
|
&height, NULL, NULL);
|
||||||
size += sizeof(xvPutImageReq);
|
size += sizeof(xvPutImageReq);
|
||||||
size = bytes_to_int32(size);
|
size = bytes_to_int32(size);
|
||||||
|
|
||||||
|
|
@ -1017,22 +967,19 @@ ProcXvShmPutImage(ClientPtr client)
|
||||||
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
|
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
|
||||||
VALIDATE_XV_PORT(stuff->port, pPort, 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;
|
client->errorValue = stuff->port;
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(pPort->pAdaptor->type & XvImageMask) ||
|
if (!(pPort->pAdaptor->type & XvImageMask) ||
|
||||||
!(pPort->pAdaptor->type & XvInputMask))
|
!(pPort->pAdaptor->type & XvInputMask)) {
|
||||||
{
|
|
||||||
client->errorValue = stuff->port;
|
client->errorValue = stuff->port;
|
||||||
return BadMatch;
|
return BadMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = XvdiMatchPort(pPort, pDraw);
|
status = XvdiMatchPort(pPort, pDraw);
|
||||||
if (status != Success)
|
if (status != Success) {
|
||||||
{
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1054,7 +1001,9 @@ ProcXvShmPutImage(ClientPtr client)
|
||||||
width = stuff->width;
|
width = stuff->width;
|
||||||
height = stuff->height;
|
height = stuff->height;
|
||||||
size_needed = (*pPort->pAdaptor->ddQueryImageAttributes) (client,
|
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)
|
if ((size_needed + stuff->offset) > shmdesc->size)
|
||||||
return BadAccess;
|
return BadAccess;
|
||||||
|
|
||||||
|
|
@ -1062,8 +1011,8 @@ ProcXvShmPutImage(ClientPtr client)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
|
|
||||||
status = XvdiPutImage(client, pDraw, pPort, pGC, stuff->src_x, stuff->src_y,
|
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->src_w, stuff->src_h, stuff->drw_x,
|
||||||
stuff->drw_w, stuff->drw_h, pImage,
|
stuff->drw_y, stuff->drw_w, stuff->drw_h, pImage,
|
||||||
(unsigned char *) shmdesc->addr + stuff->offset,
|
(unsigned char *) shmdesc->addr + stuff->offset,
|
||||||
stuff->send_event, stuff->width, stuff->height);
|
stuff->send_event, stuff->width, stuff->height);
|
||||||
|
|
||||||
|
|
@ -1105,6 +1054,7 @@ ProcXvQueryImageAttributes(ClientPtr client)
|
||||||
int *offsets;
|
int *offsets;
|
||||||
int *pitches;
|
int *pitches;
|
||||||
int planeLength;
|
int planeLength;
|
||||||
|
|
||||||
REQUEST(xvQueryImageAttributesReq);
|
REQUEST(xvQueryImageAttributesReq);
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xvQueryImageAttributesReq);
|
REQUEST_SIZE_MATCH(xvQueryImageAttributesReq);
|
||||||
|
|
@ -1136,7 +1086,8 @@ ProcXvQueryImageAttributes(ClientPtr client)
|
||||||
height = stuff->height;
|
height = stuff->height;
|
||||||
|
|
||||||
size = (*pPort->pAdaptor->ddQueryImageAttributes) (client, pPort, pImage,
|
size = (*pPort->pAdaptor->ddQueryImageAttributes) (client, pPort, pImage,
|
||||||
&width, &height, offsets, pitches);
|
&width, &height, offsets,
|
||||||
|
pitches);
|
||||||
|
|
||||||
rep.type = X_Reply;
|
rep.type = X_Reply;
|
||||||
rep.sequenceNumber = client->sequence;
|
rep.sequenceNumber = client->sequence;
|
||||||
|
|
@ -1164,6 +1115,7 @@ ProcXvListImageFormats(ClientPtr client)
|
||||||
int i;
|
int i;
|
||||||
xvListImageFormatsReply rep;
|
xvListImageFormatsReply rep;
|
||||||
xvImageFormatInfo info;
|
xvImageFormatInfo info;
|
||||||
|
|
||||||
REQUEST(xvListImageFormatsReq);
|
REQUEST(xvListImageFormatsReq);
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xvListImageFormatsReq);
|
REQUEST_SIZE_MATCH(xvListImageFormatsReq);
|
||||||
|
|
@ -1173,7 +1125,8 @@ ProcXvListImageFormats(ClientPtr client)
|
||||||
rep.type = X_Reply;
|
rep.type = X_Reply;
|
||||||
rep.sequenceNumber = client->sequence;
|
rep.sequenceNumber = client->sequence;
|
||||||
rep.num_formats = pPort->pAdaptor->nImages;
|
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);
|
_WriteListImageFormatsReply(client, &rep);
|
||||||
|
|
||||||
|
|
@ -1226,10 +1179,7 @@ static int (*XvProcVector[xvNumRequests])(ClientPtr) = {
|
||||||
ProcXvGetPortAttribute,
|
ProcXvGetPortAttribute,
|
||||||
ProcXvQueryPortAttributes,
|
ProcXvQueryPortAttributes,
|
||||||
ProcXvListImageFormats,
|
ProcXvListImageFormats,
|
||||||
ProcXvQueryImageAttributes,
|
ProcXvQueryImageAttributes, ProcXvPutImage, ProcXvShmPutImage,};
|
||||||
ProcXvPutImage,
|
|
||||||
ProcXvShmPutImage,
|
|
||||||
};
|
|
||||||
|
|
||||||
int
|
int
|
||||||
ProcXvDispatch(ClientPtr client)
|
ProcXvDispatch(ClientPtr client)
|
||||||
|
|
@ -1530,10 +1480,7 @@ static int (*SXvProcVector[xvNumRequests])(ClientPtr) = {
|
||||||
SProcXvGetPortAttribute,
|
SProcXvGetPortAttribute,
|
||||||
SProcXvQueryPortAttributes,
|
SProcXvQueryPortAttributes,
|
||||||
SProcXvListImageFormats,
|
SProcXvListImageFormats,
|
||||||
SProcXvQueryImageAttributes,
|
SProcXvQueryImageAttributes, SProcXvPutImage, SProcXvShmPutImage,};
|
||||||
SProcXvPutImage,
|
|
||||||
SProcXvShmPutImage,
|
|
||||||
};
|
|
||||||
|
|
||||||
int
|
int
|
||||||
SProcXvDispatch(ClientPtr client)
|
SProcXvDispatch(ClientPtr client)
|
||||||
|
|
@ -1556,6 +1503,7 @@ XineramaXvStopVideo(ClientPtr client)
|
||||||
{
|
{
|
||||||
int result, i;
|
int result, i;
|
||||||
PanoramiXRes *draw, *port;
|
PanoramiXRes *draw, *port;
|
||||||
|
|
||||||
REQUEST(xvStopVideoReq);
|
REQUEST(xvStopVideoReq);
|
||||||
REQUEST_SIZE_MATCH(xvStopVideoReq);
|
REQUEST_SIZE_MATCH(xvStopVideoReq);
|
||||||
|
|
||||||
|
|
@ -1811,6 +1759,7 @@ static Bool
|
||||||
hasOverlay(XvAdaptorPtr pAdapt)
|
hasOverlay(XvAdaptorPtr pAdapt)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < pAdapt->nAttributes; i++)
|
for (i = 0; i < pAdapt->nAttributes; i++)
|
||||||
if (!strcmp(pAdapt->pAttributes[i].name, "XV_COLORKEY"))
|
if (!strcmp(pAdapt->pAttributes[i].name, "XV_COLORKEY"))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
@ -1821,7 +1770,8 @@ static XvAdaptorPtr
|
||||||
matchAdaptor(ScreenPtr pScreen, XvAdaptorPtr refAdapt, Bool isOverlay)
|
matchAdaptor(ScreenPtr pScreen, XvAdaptorPtr refAdapt, Bool isOverlay)
|
||||||
{
|
{
|
||||||
int i;
|
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 */
|
/* Do not try to go on if xv is not supported on this screen */
|
||||||
if (xvsp == NULL)
|
if (xvsp == NULL)
|
||||||
return 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 */
|
/* if the adaptor has the same name it's a perfect match */
|
||||||
for (i = 0; i < xvsp->nAdaptors; i++) {
|
for (i = 0; i < xvsp->nAdaptors; i++) {
|
||||||
XvAdaptorPtr pAdapt = xvsp->pAdaptors + i;
|
XvAdaptorPtr pAdapt = xvsp->pAdaptors + i;
|
||||||
|
|
||||||
if (!strcmp(refAdapt->name, pAdapt->name))
|
if (!strcmp(refAdapt->name, pAdapt->name))
|
||||||
return pAdapt;
|
return pAdapt;
|
||||||
}
|
}
|
||||||
|
|
@ -1840,6 +1791,7 @@ matchAdaptor(ScreenPtr pScreen, XvAdaptorPtr refAdapt, Bool isOverlay)
|
||||||
/* prefer overlay/overlay non-overlay/non-overlay pairing */
|
/* prefer overlay/overlay non-overlay/non-overlay pairing */
|
||||||
for (i = 0; i < xvsp->nAdaptors; i++) {
|
for (i = 0; i < xvsp->nAdaptors; i++) {
|
||||||
XvAdaptorPtr pAdapt = xvsp->pAdaptors + i;
|
XvAdaptorPtr pAdapt = xvsp->pAdaptors + i;
|
||||||
|
|
||||||
if (isImageAdaptor(pAdapt) && isOverlay == hasOverlay(pAdapt))
|
if (isImageAdaptor(pAdapt) && isOverlay == hasOverlay(pAdapt))
|
||||||
return 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 */
|
/* but we'll take any XvImage pairing if we can get it */
|
||||||
for (i = 0; i < xvsp->nAdaptors; i++) {
|
for (i = 0; i < xvsp->nAdaptors; i++) {
|
||||||
XvAdaptorPtr pAdapt = xvsp->pAdaptors + i;
|
XvAdaptorPtr pAdapt = xvsp->pAdaptors + i;
|
||||||
|
|
||||||
if (isImageAdaptor(pAdapt))
|
if (isImageAdaptor(pAdapt))
|
||||||
return pAdapt;
|
return pAdapt;
|
||||||
}
|
}
|
||||||
return NULL;
|
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];
|
XvAdaptorPtr MatchingAdaptors[MAXSCREENS];
|
||||||
int i, j, k;
|
int i, j, k;
|
||||||
|
|
||||||
XvXRTPort = CreateNewResourceType(XineramaDeleteResource, "XvXRTPort");
|
XvXRTPort = CreateNewResourceType(XineramaDeleteResource, "XvXRTPort");
|
||||||
|
|
||||||
if (!xvsp0 || !XvXRTPort) return;
|
if (!xvsp0 || !XvXRTPort)
|
||||||
|
return;
|
||||||
SetResourceTypeErrorValue(XvXRTPort, _XvBadPort);
|
SetResourceTypeErrorValue(XvXRTPort, _XvBadPort);
|
||||||
|
|
||||||
for (i = 0; i < xvsp0->nAdaptors; i++) {
|
for (i = 0; i < xvsp0->nAdaptors; i++) {
|
||||||
Bool isOverlay;
|
Bool isOverlay;
|
||||||
XvAdaptorPtr refAdapt = xvsp0->pAdaptors + i;
|
XvAdaptorPtr refAdapt = xvsp0->pAdaptors + i;
|
||||||
if(!(refAdapt->type & XvInputMask)) continue;
|
|
||||||
|
if (!(refAdapt->type & XvInputMask))
|
||||||
|
continue;
|
||||||
|
|
||||||
MatchingAdaptors[0] = refAdapt;
|
MatchingAdaptors[0] = refAdapt;
|
||||||
isOverlay = hasOverlay(refAdapt);
|
isOverlay = hasOverlay(refAdapt);
|
||||||
FOR_NSCREENS_FORWARD_SKIP(j)
|
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 */
|
/* now create a resource for each port */
|
||||||
for (j = 0; j < refAdapt->nPorts; j++) {
|
for (j = 0; j < refAdapt->nPorts; j++) {
|
||||||
PanoramiXRes *port = malloc(sizeof(PanoramiXRes));
|
PanoramiXRes *port = malloc(sizeof(PanoramiXRes));
|
||||||
|
|
||||||
if (!port)
|
if (!port)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -183,8 +183,7 @@ typedef struct {
|
||||||
int (*ddPutImage) (ClientPtr, DrawablePtr, struct _XvPortRec *, GCPtr,
|
int (*ddPutImage) (ClientPtr, DrawablePtr, struct _XvPortRec *, GCPtr,
|
||||||
INT16, INT16, CARD16, CARD16,
|
INT16, INT16, CARD16, CARD16,
|
||||||
INT16, INT16, CARD16, CARD16,
|
INT16, INT16, CARD16, CARD16,
|
||||||
XvImagePtr, unsigned char*, Bool,
|
XvImagePtr, unsigned char *, Bool, CARD16, CARD16);
|
||||||
CARD16, CARD16);
|
|
||||||
int (*ddQueryImageAttributes) (ClientPtr, struct _XvPortRec *, XvImagePtr,
|
int (*ddQueryImageAttributes) (ClientPtr, struct _XvPortRec *, XvImagePtr,
|
||||||
CARD16 *, CARD16 *, int *, int *);
|
CARD16 *, CARD16 *, int *, int *);
|
||||||
DevUnion devPriv;
|
DevUnion devPriv;
|
||||||
|
|
@ -272,4 +271,3 @@ extern _X_EXPORT int XvdiUngrabPort( ClientPtr, XvPortPtr, Time);
|
||||||
#endif /* XorgLoader */
|
#endif /* XorgLoader */
|
||||||
|
|
||||||
#endif /* XVDIX_H */
|
#endif /* XVDIX_H */
|
||||||
|
|
||||||
|
|
|
||||||
350
Xext/xvmain.c
350
Xext/xvmain.c
|
|
@ -106,6 +106,7 @@ SOFTWARE.
|
||||||
#include "xvdisp.h"
|
#include "xvdisp.h"
|
||||||
|
|
||||||
static DevPrivateKeyRec XvScreenKeyRec;
|
static DevPrivateKeyRec XvScreenKeyRec;
|
||||||
|
|
||||||
#define XvScreenKey (&XvScreenKeyRec)
|
#define XvScreenKey (&XvScreenKeyRec)
|
||||||
unsigned long XvExtensionGeneration = 0;
|
unsigned long XvExtensionGeneration = 0;
|
||||||
unsigned long XvScreenGeneration = 0;
|
unsigned long XvScreenGeneration = 0;
|
||||||
|
|
@ -140,9 +141,6 @@ static int XvdiDestroyVideoNotifyList(pointer, XID);
|
||||||
static int XvdiDestroyPort(pointer, XID);
|
static int XvdiDestroyPort(pointer, XID);
|
||||||
static int XvdiSendVideoNotify(XvPortPtr, DrawablePtr, int);
|
static int XvdiSendVideoNotify(XvPortPtr, DrawablePtr, int);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** XvExtensionInit
|
** XvExtensionInit
|
||||||
**
|
**
|
||||||
|
|
@ -159,10 +157,8 @@ XvExtensionInit(void)
|
||||||
|
|
||||||
/* LOOK TO SEE IF ANY SCREENS WERE INITIALIZED; IF NOT THEN
|
/* LOOK TO SEE IF ANY SCREENS WERE INITIALIZED; IF NOT THEN
|
||||||
INIT GLOBAL VARIABLES SO THE EXTENSION CAN FUNCTION */
|
INIT GLOBAL VARIABLES SO THE EXTENSION CAN FUNCTION */
|
||||||
if (XvScreenGeneration != serverGeneration)
|
if (XvScreenGeneration != serverGeneration) {
|
||||||
{
|
if (!CreateResourceTypes()) {
|
||||||
if (!CreateResourceTypes())
|
|
||||||
{
|
|
||||||
ErrorF("XvExtensionInit: Unable to allocate resource types\n");
|
ErrorF("XvExtensionInit: Unable to allocate resource types\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -172,15 +168,13 @@ XvExtensionInit(void)
|
||||||
XvScreenGeneration = serverGeneration;
|
XvScreenGeneration = serverGeneration;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (XvExtensionGeneration != serverGeneration)
|
if (XvExtensionGeneration != serverGeneration) {
|
||||||
{
|
|
||||||
XvExtensionGeneration = serverGeneration;
|
XvExtensionGeneration = serverGeneration;
|
||||||
|
|
||||||
extEntry = AddExtension(XvName, XvNumEvents, XvNumErrors,
|
extEntry = AddExtension(XvName, XvNumEvents, XvNumErrors,
|
||||||
ProcXvDispatch, SProcXvDispatch,
|
ProcXvDispatch, SProcXvDispatch,
|
||||||
XvResetProc, StandardMinorOpcode);
|
XvResetProc, StandardMinorOpcode);
|
||||||
if (!extEntry)
|
if (!extEntry) {
|
||||||
{
|
|
||||||
FatalError("XvExtensionInit: AddExtensions failed\n");
|
FatalError("XvExtensionInit: AddExtensions failed\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -201,50 +195,49 @@ XvExtensionInit(void)
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
CreateResourceTypes(void)
|
CreateResourceTypes(void)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
if (XvResourceGeneration == serverGeneration) return TRUE;
|
if (XvResourceGeneration == serverGeneration)
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
XvResourceGeneration = serverGeneration;
|
XvResourceGeneration = serverGeneration;
|
||||||
|
|
||||||
if (!(XvRTPort = CreateNewResourceType(XvdiDestroyPort, "XvRTPort")))
|
if (!(XvRTPort = CreateNewResourceType(XvdiDestroyPort, "XvRTPort"))) {
|
||||||
{
|
|
||||||
ErrorF("CreateResourceTypes: failed to allocate port resource.\n");
|
ErrorF("CreateResourceTypes: failed to allocate port resource.\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(XvRTGrab = CreateNewResourceType(XvdiDestroyGrab, "XvRTGrab")))
|
if (!(XvRTGrab = CreateNewResourceType(XvdiDestroyGrab, "XvRTGrab"))) {
|
||||||
{
|
|
||||||
ErrorF("CreateResourceTypes: failed to allocate grab resource.\n");
|
ErrorF("CreateResourceTypes: failed to allocate grab resource.\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(XvRTEncoding = CreateNewResourceType(XvdiDestroyEncoding,
|
if (!(XvRTEncoding = CreateNewResourceType(XvdiDestroyEncoding,
|
||||||
"XvRTEncoding")))
|
"XvRTEncoding"))) {
|
||||||
{
|
|
||||||
ErrorF("CreateResourceTypes: failed to allocate encoding resource.\n");
|
ErrorF("CreateResourceTypes: failed to allocate encoding resource.\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(XvRTVideoNotify = CreateNewResourceType(XvdiDestroyVideoNotify,
|
if (!(XvRTVideoNotify = CreateNewResourceType(XvdiDestroyVideoNotify,
|
||||||
"XvRTVideoNotify")))
|
"XvRTVideoNotify"))) {
|
||||||
{
|
ErrorF
|
||||||
ErrorF("CreateResourceTypes: failed to allocate video notify resource.\n");
|
("CreateResourceTypes: failed to allocate video notify resource.\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(XvRTVideoNotifyList = CreateNewResourceType(XvdiDestroyVideoNotifyList,
|
if (!
|
||||||
"XvRTVideoNotifyList")))
|
(XvRTVideoNotifyList =
|
||||||
{
|
CreateNewResourceType(XvdiDestroyVideoNotifyList,
|
||||||
ErrorF("CreateResourceTypes: failed to allocate video notify list resource.\n");
|
"XvRTVideoNotifyList"))) {
|
||||||
|
ErrorF
|
||||||
|
("CreateResourceTypes: failed to allocate video notify list resource.\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(XvRTPortNotify = CreateNewResourceType(XvdiDestroyPortNotify,
|
if (!(XvRTPortNotify = CreateNewResourceType(XvdiDestroyPortNotify,
|
||||||
"XvRTPortNotify")))
|
"XvRTPortNotify"))) {
|
||||||
{
|
ErrorF
|
||||||
ErrorF("CreateResourceTypes: failed to allocate port notify resource.\n");
|
("CreateResourceTypes: failed to allocate port notify resource.\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -257,10 +250,8 @@ XvScreenInit(ScreenPtr pScreen)
|
||||||
{
|
{
|
||||||
XvScreenPtr pxvs;
|
XvScreenPtr pxvs;
|
||||||
|
|
||||||
if (XvScreenGeneration != serverGeneration)
|
if (XvScreenGeneration != serverGeneration) {
|
||||||
{
|
if (!CreateResourceTypes()) {
|
||||||
if (!CreateResourceTypes())
|
|
||||||
{
|
|
||||||
ErrorF("XvScreenInit: Unable to allocate resource types\n");
|
ErrorF("XvScreenInit: Unable to allocate resource types\n");
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
|
|
@ -273,16 +264,14 @@ XvScreenInit(ScreenPtr pScreen)
|
||||||
if (!dixRegisterPrivateKey(&XvScreenKeyRec, PRIVATE_SCREEN, 0))
|
if (!dixRegisterPrivateKey(&XvScreenKeyRec, PRIVATE_SCREEN, 0))
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
|
||||||
if (dixLookupPrivate(&pScreen->devPrivates, XvScreenKey))
|
if (dixLookupPrivate(&pScreen->devPrivates, XvScreenKey)) {
|
||||||
{
|
|
||||||
ErrorF("XvScreenInit: screen devPrivates ptr non-NULL before init\n");
|
ErrorF("XvScreenInit: screen devPrivates ptr non-NULL before init\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ALLOCATE SCREEN PRIVATE RECORD */
|
/* ALLOCATE SCREEN PRIVATE RECORD */
|
||||||
|
|
||||||
pxvs = malloc(sizeof(XvScreenRec));
|
pxvs = malloc(sizeof(XvScreenRec));
|
||||||
if (!pxvs)
|
if (!pxvs) {
|
||||||
{
|
|
||||||
ErrorF("XvScreenInit: Unable to allocate screen private structure\n");
|
ErrorF("XvScreenInit: Unable to allocate screen private structure\n");
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
|
|
@ -301,10 +290,8 @@ XvScreenInit(ScreenPtr pScreen)
|
||||||
}
|
}
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
XvCloseScreen(
|
XvCloseScreen(int ii, ScreenPtr pScreen)
|
||||||
int ii,
|
{
|
||||||
ScreenPtr pScreen
|
|
||||||
){
|
|
||||||
|
|
||||||
XvScreenPtr pxvs;
|
XvScreenPtr pxvs;
|
||||||
|
|
||||||
|
|
@ -362,15 +349,12 @@ XvDestroyPixmap(PixmapPtr pPix)
|
||||||
|
|
||||||
pa = pxvs->pAdaptors;
|
pa = pxvs->pAdaptors;
|
||||||
na = pxvs->nAdaptors;
|
na = pxvs->nAdaptors;
|
||||||
while (na--)
|
while (na--) {
|
||||||
{
|
|
||||||
np = pa->nPorts;
|
np = pa->nPorts;
|
||||||
pp = pa->pPorts;
|
pp = pa->pPorts;
|
||||||
|
|
||||||
while (np--)
|
while (np--) {
|
||||||
{
|
if (pp->pDraw == (DrawablePtr) pPix) {
|
||||||
if (pp->pDraw == (DrawablePtr)pPix)
|
|
||||||
{
|
|
||||||
XvdiSendVideoNotify(pp, pp->pDraw, XvPreempted);
|
XvdiSendVideoNotify(pp, pp->pDraw, XvPreempted);
|
||||||
|
|
||||||
(void) (*pp->pAdaptor->ddStopVideo) (NULL, pp, pp->pDraw);
|
(void) (*pp->pAdaptor->ddStopVideo) (NULL, pp, pp->pDraw);
|
||||||
|
|
@ -413,15 +397,12 @@ XvDestroyWindow(WindowPtr pWin)
|
||||||
|
|
||||||
pa = pxvs->pAdaptors;
|
pa = pxvs->pAdaptors;
|
||||||
na = pxvs->nAdaptors;
|
na = pxvs->nAdaptors;
|
||||||
while (na--)
|
while (na--) {
|
||||||
{
|
|
||||||
np = pa->nPorts;
|
np = pa->nPorts;
|
||||||
pp = pa->pPorts;
|
pp = pa->pPorts;
|
||||||
|
|
||||||
while (np--)
|
while (np--) {
|
||||||
{
|
if (pp->pDraw == (DrawablePtr) pWin) {
|
||||||
if (pp->pDraw == (DrawablePtr)pWin)
|
|
||||||
{
|
|
||||||
XvdiSendVideoNotify(pp, pp->pDraw, XvPreempted);
|
XvdiSendVideoNotify(pp, pp->pDraw, XvPreempted);
|
||||||
|
|
||||||
(void) (*pp->pAdaptor->ddStopVideo) (NULL, pp, pp->pDraw);
|
(void) (*pp->pAdaptor->ddStopVideo) (NULL, pp, pp->pDraw);
|
||||||
|
|
@ -435,7 +416,6 @@ XvDestroyWindow(WindowPtr pWin)
|
||||||
pa++;
|
pa++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status = (*pScreen->DestroyWindow) (pWin);
|
status = (*pScreen->DestroyWindow) (pWin);
|
||||||
|
|
||||||
SCREEN_EPILOGUE(pScreen, DestroyWindow, XvDestroyWindow);
|
SCREEN_EPILOGUE(pScreen, DestroyWindow, XvDestroyWindow);
|
||||||
|
|
@ -455,7 +435,8 @@ XvdiVideoStopped(XvPortPtr pPort, int reason)
|
||||||
|
|
||||||
/* IF PORT ISN'T ACTIVE THEN WE'RE DONE */
|
/* IF PORT ISN'T ACTIVE THEN WE'RE DONE */
|
||||||
|
|
||||||
if (!pPort->pDraw) return Success;
|
if (!pPort->pDraw)
|
||||||
|
return Success;
|
||||||
|
|
||||||
XvdiSendVideoNotify(pPort, pPort->pDraw, reason);
|
XvdiSendVideoNotify(pPort, pPort->pDraw, reason);
|
||||||
|
|
||||||
|
|
@ -507,10 +488,10 @@ XvdiDestroyVideoNotifyList(pointer pn, XID id)
|
||||||
|
|
||||||
cpn = (XvVideoNotifyPtr) pn;
|
cpn = (XvVideoNotifyPtr) pn;
|
||||||
|
|
||||||
while (cpn)
|
while (cpn) {
|
||||||
{
|
|
||||||
npn = cpn->next;
|
npn = cpn->next;
|
||||||
if (cpn->client) FreeResource(cpn->id, XvRTVideoNotify);
|
if (cpn->client)
|
||||||
|
FreeResource(cpn->id, XvRTVideoNotify);
|
||||||
free(cpn);
|
free(cpn);
|
||||||
cpn = npn;
|
cpn = npn;
|
||||||
}
|
}
|
||||||
|
|
@ -532,8 +513,7 @@ XvdiSendVideoNotify(XvPortPtr pPort, DrawablePtr pDraw, int reason)
|
||||||
dixLookupResourceByType((pointer *) &pn, pDraw->id, XvRTVideoNotifyList,
|
dixLookupResourceByType((pointer *) &pn, pDraw->id, XvRTVideoNotifyList,
|
||||||
serverClient, DixReadAccess);
|
serverClient, DixReadAccess);
|
||||||
|
|
||||||
while (pn)
|
while (pn) {
|
||||||
{
|
|
||||||
event.u.u.type = XvEventBase + XvVideoNotify;
|
event.u.u.type = XvEventBase + XvVideoNotify;
|
||||||
event.u.videoNotify.time = currentTime.milliseconds;
|
event.u.videoNotify.time = currentTime.milliseconds;
|
||||||
event.u.videoNotify.drawable = pDraw->id;
|
event.u.videoNotify.drawable = pDraw->id;
|
||||||
|
|
@ -547,20 +527,15 @@ XvdiSendVideoNotify(XvPortPtr pPort, DrawablePtr pDraw, int reason)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
XvdiSendPortNotify(
|
XvdiSendPortNotify(XvPortPtr pPort, Atom attribute, INT32 value)
|
||||||
XvPortPtr pPort,
|
{
|
||||||
Atom attribute,
|
|
||||||
INT32 value
|
|
||||||
){
|
|
||||||
xvEvent event;
|
xvEvent event;
|
||||||
XvPortNotifyPtr pn;
|
XvPortNotifyPtr pn;
|
||||||
|
|
||||||
pn = pPort->pNotify;
|
pn = pPort->pNotify;
|
||||||
|
|
||||||
while (pn)
|
while (pn) {
|
||||||
{
|
|
||||||
event.u.u.type = XvEventBase + XvPortNotify;
|
event.u.u.type = XvEventBase + XvPortNotify;
|
||||||
event.u.portNotify.time = currentTime.milliseconds;
|
event.u.portNotify.time = currentTime.milliseconds;
|
||||||
event.u.portNotify.port = pPort->id;
|
event.u.portNotify.port = pPort->id;
|
||||||
|
|
@ -574,7 +549,6 @@ XvdiSendPortNotify(
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define CHECK_SIZE(dw, dh, sw, sh) { \
|
#define CHECK_SIZE(dw, dh, sw, sh) { \
|
||||||
if(!dw || !dh || !sw || !sh) return Success; \
|
if(!dw || !dh || !sw || !sh) return Success; \
|
||||||
/* The region code will break these if they are too large */ \
|
/* The region code will break these if they are too large */ \
|
||||||
|
|
@ -582,18 +556,15 @@ XvdiSendPortNotify(
|
||||||
return BadValue; \
|
return BadValue; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
XvdiPutVideo(
|
XvdiPutVideo(ClientPtr client,
|
||||||
ClientPtr client,
|
|
||||||
DrawablePtr pDraw,
|
DrawablePtr pDraw,
|
||||||
XvPortPtr pPort,
|
XvPortPtr pPort,
|
||||||
GCPtr pGC,
|
GCPtr pGC,
|
||||||
INT16 vid_x, INT16 vid_y,
|
INT16 vid_x, INT16 vid_y,
|
||||||
CARD16 vid_w, CARD16 vid_h,
|
CARD16 vid_w, CARD16 vid_h,
|
||||||
INT16 drw_x, INT16 drw_y,
|
INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h)
|
||||||
CARD16 drw_w, CARD16 drw_h
|
{
|
||||||
){
|
|
||||||
DrawablePtr pOldDraw;
|
DrawablePtr pOldDraw;
|
||||||
|
|
||||||
CHECK_SIZE(drw_w, drw_h, vid_w, vid_h);
|
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
|
/* CHECK FOR GRAB; IF THIS CLIENT DOESN'T HAVE THE PORT GRABBED THEN
|
||||||
INFORM CLIENT OF ITS FAILURE */
|
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);
|
XvdiSendVideoNotify(pPort, pDraw, XvBusy);
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
@ -615,8 +585,7 @@ XvdiPutVideo(
|
||||||
EVENTS TO ANY CLIENTS WHO WANT THEM */
|
EVENTS TO ANY CLIENTS WHO WANT THEM */
|
||||||
|
|
||||||
pOldDraw = pPort->pDraw;
|
pOldDraw = pPort->pDraw;
|
||||||
if ((pOldDraw) && (pOldDraw != pDraw))
|
if ((pOldDraw) && (pOldDraw != pDraw)) {
|
||||||
{
|
|
||||||
XvdiSendVideoNotify(pPort, pPort->pDraw, XvPreempted);
|
XvdiSendVideoNotify(pPort, pPort->pDraw, XvPreempted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -624,8 +593,7 @@ XvdiPutVideo(
|
||||||
vid_x, vid_y, vid_w, vid_h,
|
vid_x, vid_y, vid_w, vid_h,
|
||||||
drw_x, drw_y, drw_w, drw_h);
|
drw_x, drw_y, drw_w, drw_h);
|
||||||
|
|
||||||
if ((pPort->pDraw) && (pOldDraw != pDraw))
|
if ((pPort->pDraw) && (pOldDraw != pDraw)) {
|
||||||
{
|
|
||||||
pPort->client = client;
|
pPort->client = client;
|
||||||
XvdiSendVideoNotify(pPort, pPort->pDraw, XvStarted);
|
XvdiSendVideoNotify(pPort, pPort->pDraw, XvStarted);
|
||||||
}
|
}
|
||||||
|
|
@ -637,16 +605,14 @@ XvdiPutVideo(
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
XvdiPutStill(
|
XvdiPutStill(ClientPtr client,
|
||||||
ClientPtr client,
|
|
||||||
DrawablePtr pDraw,
|
DrawablePtr pDraw,
|
||||||
XvPortPtr pPort,
|
XvPortPtr pPort,
|
||||||
GCPtr pGC,
|
GCPtr pGC,
|
||||||
INT16 vid_x, INT16 vid_y,
|
INT16 vid_x, INT16 vid_y,
|
||||||
CARD16 vid_w, CARD16 vid_h,
|
CARD16 vid_w, CARD16 vid_h,
|
||||||
INT16 drw_x, INT16 drw_y,
|
INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h)
|
||||||
CARD16 drw_w, CARD16 drw_h
|
{
|
||||||
){
|
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
CHECK_SIZE(drw_w, drw_h, vid_w, vid_h);
|
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
|
/* CHECK FOR GRAB; IF THIS CLIENT DOESN'T HAVE THE PORT GRABBED THEN
|
||||||
INFORM CLIENT OF ITS FAILURE */
|
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);
|
XvdiSendVideoNotify(pPort, pDraw, XvBusy);
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
@ -675,8 +640,7 @@ XvdiPutStill(
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
XvdiPutImage(
|
XvdiPutImage(ClientPtr client,
|
||||||
ClientPtr client,
|
|
||||||
DrawablePtr pDraw,
|
DrawablePtr pDraw,
|
||||||
XvPortPtr pPort,
|
XvPortPtr pPort,
|
||||||
GCPtr pGC,
|
GCPtr pGC,
|
||||||
|
|
@ -685,10 +649,8 @@ XvdiPutImage(
|
||||||
INT16 drw_x, INT16 drw_y,
|
INT16 drw_x, INT16 drw_y,
|
||||||
CARD16 drw_w, CARD16 drw_h,
|
CARD16 drw_w, CARD16 drw_h,
|
||||||
XvImagePtr image,
|
XvImagePtr image,
|
||||||
unsigned char* data,
|
unsigned char *data, Bool sync, CARD16 width, CARD16 height)
|
||||||
Bool sync,
|
{
|
||||||
CARD16 width, CARD16 height
|
|
||||||
){
|
|
||||||
CHECK_SIZE(drw_w, drw_h, src_w, src_h);
|
CHECK_SIZE(drw_w, drw_h, src_w, src_h);
|
||||||
|
|
||||||
/* UPDATE TIME VARIABLES FOR USE IN EVENTS */
|
/* 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
|
/* CHECK FOR GRAB; IF THIS CLIENT DOESN'T HAVE THE PORT GRABBED THEN
|
||||||
INFORM CLIENT OF ITS FAILURE */
|
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);
|
XvdiSendVideoNotify(pPort, pDraw, XvBusy);
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
@ -712,18 +673,15 @@ XvdiPutImage(
|
||||||
image, data, sync, width, height);
|
image, data, sync, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
XvdiGetVideo(
|
XvdiGetVideo(ClientPtr client,
|
||||||
ClientPtr client,
|
|
||||||
DrawablePtr pDraw,
|
DrawablePtr pDraw,
|
||||||
XvPortPtr pPort,
|
XvPortPtr pPort,
|
||||||
GCPtr pGC,
|
GCPtr pGC,
|
||||||
INT16 vid_x, INT16 vid_y,
|
INT16 vid_x, INT16 vid_y,
|
||||||
CARD16 vid_w, CARD16 vid_h,
|
CARD16 vid_w, CARD16 vid_h,
|
||||||
INT16 drw_x, INT16 drw_y,
|
INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h)
|
||||||
CARD16 drw_w, CARD16 drw_h
|
{
|
||||||
){
|
|
||||||
DrawablePtr pOldDraw;
|
DrawablePtr pOldDraw;
|
||||||
|
|
||||||
CHECK_SIZE(drw_w, drw_h, vid_w, vid_h);
|
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
|
/* CHECK FOR GRAB; IF THIS CLIENT DOESN'T HAVE THE PORT GRABBED THEN
|
||||||
INFORM CLIENT OF ITS FAILURE */
|
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);
|
XvdiSendVideoNotify(pPort, pDraw, XvBusy);
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
@ -745,8 +702,7 @@ XvdiGetVideo(
|
||||||
EVENTS TO ANY CLIENTS WHO WANT THEM */
|
EVENTS TO ANY CLIENTS WHO WANT THEM */
|
||||||
|
|
||||||
pOldDraw = pPort->pDraw;
|
pOldDraw = pPort->pDraw;
|
||||||
if ((pOldDraw) && (pOldDraw != pDraw))
|
if ((pOldDraw) && (pOldDraw != pDraw)) {
|
||||||
{
|
|
||||||
XvdiSendVideoNotify(pPort, pPort->pDraw, XvPreempted);
|
XvdiSendVideoNotify(pPort, pPort->pDraw, XvPreempted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -754,8 +710,7 @@ XvdiGetVideo(
|
||||||
vid_x, vid_y, vid_w, vid_h,
|
vid_x, vid_y, vid_w, vid_h,
|
||||||
drw_x, drw_y, drw_w, drw_h);
|
drw_x, drw_y, drw_w, drw_h);
|
||||||
|
|
||||||
if ((pPort->pDraw) && (pOldDraw != pDraw))
|
if ((pPort->pDraw) && (pOldDraw != pDraw)) {
|
||||||
{
|
|
||||||
pPort->client = client;
|
pPort->client = client;
|
||||||
XvdiSendVideoNotify(pPort, pPort->pDraw, XvStarted);
|
XvdiSendVideoNotify(pPort, pPort->pDraw, XvStarted);
|
||||||
}
|
}
|
||||||
|
|
@ -767,16 +722,14 @@ XvdiGetVideo(
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
XvdiGetStill(
|
XvdiGetStill(ClientPtr client,
|
||||||
ClientPtr client,
|
|
||||||
DrawablePtr pDraw,
|
DrawablePtr pDraw,
|
||||||
XvPortPtr pPort,
|
XvPortPtr pPort,
|
||||||
GCPtr pGC,
|
GCPtr pGC,
|
||||||
INT16 vid_x, INT16 vid_y,
|
INT16 vid_x, INT16 vid_y,
|
||||||
CARD16 vid_w, CARD16 vid_h,
|
CARD16 vid_w, CARD16 vid_h,
|
||||||
INT16 drw_x, INT16 drw_y,
|
INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h)
|
||||||
CARD16 drw_w, CARD16 drw_h
|
{
|
||||||
){
|
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
CHECK_SIZE(drw_w, drw_h, vid_w, vid_h);
|
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
|
/* CHECK FOR GRAB; IF THIS CLIENT DOESN'T HAVE THE PORT GRABBED THEN
|
||||||
INFORM CLIENT OF ITS FAILURE */
|
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);
|
XvdiSendVideoNotify(pPort, pDraw, XvBusy);
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
@ -805,48 +757,39 @@ XvdiGetStill(
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
XvdiGrabPort(
|
XvdiGrabPort(ClientPtr client, XvPortPtr pPort, Time ctime, int *p_result)
|
||||||
ClientPtr client,
|
{
|
||||||
XvPortPtr pPort,
|
|
||||||
Time ctime,
|
|
||||||
int *p_result
|
|
||||||
){
|
|
||||||
unsigned long id;
|
unsigned long id;
|
||||||
TimeStamp time;
|
TimeStamp time;
|
||||||
|
|
||||||
UpdateCurrentTime();
|
UpdateCurrentTime();
|
||||||
time = ClientTimeToServerTime(ctime);
|
time = ClientTimeToServerTime(ctime);
|
||||||
|
|
||||||
if (pPort->grab.client && (client != pPort->grab.client))
|
if (pPort->grab.client && (client != pPort->grab.client)) {
|
||||||
{
|
|
||||||
*p_result = XvAlreadyGrabbed;
|
*p_result = XvAlreadyGrabbed;
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((CompareTimeStamps(time, currentTime) == LATER) ||
|
if ((CompareTimeStamps(time, currentTime) == LATER) ||
|
||||||
(CompareTimeStamps(time, pPort->time) == EARLIER))
|
(CompareTimeStamps(time, pPort->time) == EARLIER)) {
|
||||||
{
|
|
||||||
*p_result = XvInvalidTime;
|
*p_result = XvInvalidTime;
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (client == pPort->grab.client)
|
if (client == pPort->grab.client) {
|
||||||
{
|
|
||||||
*p_result = Success;
|
*p_result = Success;
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
id = FakeClientID(client->index);
|
id = FakeClientID(client->index);
|
||||||
|
|
||||||
if (!AddResource(id, XvRTGrab, &pPort->grab))
|
if (!AddResource(id, XvRTGrab, &pPort->grab)) {
|
||||||
{
|
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* IF THERE IS ACTIVE VIDEO THEN STOP IT */
|
/* 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);
|
XvdiStopVideo(NULL, pPort, pPort->pDraw);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -862,24 +805,19 @@ XvdiGrabPort(
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
XvdiUngrabPort(
|
XvdiUngrabPort(ClientPtr client, XvPortPtr pPort, Time ctime)
|
||||||
ClientPtr client,
|
{
|
||||||
XvPortPtr pPort,
|
|
||||||
Time ctime
|
|
||||||
){
|
|
||||||
TimeStamp time;
|
TimeStamp time;
|
||||||
|
|
||||||
UpdateCurrentTime();
|
UpdateCurrentTime();
|
||||||
time = ClientTimeToServerTime(ctime);
|
time = ClientTimeToServerTime(ctime);
|
||||||
|
|
||||||
if ((!pPort->grab.client) || (client != pPort->grab.client))
|
if ((!pPort->grab.client) || (client != pPort->grab.client)) {
|
||||||
{
|
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((CompareTimeStamps(time, currentTime) == LATER) ||
|
if ((CompareTimeStamps(time, currentTime) == LATER) ||
|
||||||
(CompareTimeStamps(time, pPort->time) == EARLIER))
|
(CompareTimeStamps(time, pPort->time) == EARLIER)) {
|
||||||
{
|
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -894,70 +832,63 @@ XvdiUngrabPort(
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
XvdiSelectVideoNotify(
|
XvdiSelectVideoNotify(ClientPtr client, DrawablePtr pDraw, BOOL onoff)
|
||||||
ClientPtr client,
|
{
|
||||||
DrawablePtr pDraw,
|
|
||||||
BOOL onoff
|
|
||||||
){
|
|
||||||
XvVideoNotifyPtr pn, tpn, fpn;
|
XvVideoNotifyPtr pn, tpn, fpn;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
/* FIND VideoNotify LIST */
|
/* FIND VideoNotify LIST */
|
||||||
|
|
||||||
rc = dixLookupResourceByType((pointer *)&pn, pDraw->id, XvRTVideoNotifyList,
|
rc = dixLookupResourceByType((pointer *) &pn, pDraw->id,
|
||||||
client, DixWriteAccess);
|
XvRTVideoNotifyList, client, DixWriteAccess);
|
||||||
if (rc != Success && rc != BadValue)
|
if (rc != Success && rc != BadValue)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
/* IF ONE DONES'T EXIST AND NO MASK, THEN JUST RETURN */
|
/* 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
|
/* IF ONE DOESN'T EXIST CREATE IT AND ADD A RESOURCE SO THAT THE LIST
|
||||||
WILL BE DELETED WHEN THE DRAWABLE IS DESTROYED */
|
WILL BE DELETED WHEN THE DRAWABLE IS DESTROYED */
|
||||||
|
|
||||||
if (!pn)
|
if (!pn) {
|
||||||
{
|
|
||||||
if (!(tpn = malloc(sizeof(XvVideoNotifyRec))))
|
if (!(tpn = malloc(sizeof(XvVideoNotifyRec))))
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
tpn->next = NULL;
|
tpn->next = NULL;
|
||||||
if (!AddResource(pDraw->id, XvRTVideoNotifyList, tpn))
|
if (!AddResource(pDraw->id, XvRTVideoNotifyList, tpn)) {
|
||||||
{
|
|
||||||
free(tpn);
|
free(tpn);
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
/* LOOK TO SEE IF ENTRY ALREADY EXISTS */
|
/* LOOK TO SEE IF ENTRY ALREADY EXISTS */
|
||||||
|
|
||||||
fpn = NULL;
|
fpn = NULL;
|
||||||
tpn = pn;
|
tpn = pn;
|
||||||
while (tpn)
|
while (tpn) {
|
||||||
{
|
if (tpn->client == client) {
|
||||||
if (tpn->client == client)
|
if (!onoff)
|
||||||
{
|
tpn->client = NULL;
|
||||||
if (!onoff) tpn->client = NULL;
|
|
||||||
return Success;
|
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;
|
tpn = tpn->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* IF TUNNING OFF, THEN JUST RETURN */
|
/* 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 ONE ISN'T FOUND THEN ALLOCATE ONE AND LINK IT INTO THE LIST */
|
||||||
|
|
||||||
if (fpn)
|
if (fpn) {
|
||||||
{
|
|
||||||
tpn = fpn;
|
tpn = fpn;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
if (!(tpn = malloc(sizeof(XvVideoNotifyRec))))
|
if (!(tpn = malloc(sizeof(XvVideoNotifyRec))))
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
tpn->next = pn->next;
|
tpn->next = pn->next;
|
||||||
|
|
@ -978,32 +909,28 @@ XvdiSelectVideoNotify(
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
XvdiSelectPortNotify(
|
XvdiSelectPortNotify(ClientPtr client, XvPortPtr pPort, BOOL onoff)
|
||||||
ClientPtr client,
|
{
|
||||||
XvPortPtr pPort,
|
|
||||||
BOOL onoff
|
|
||||||
){
|
|
||||||
XvPortNotifyPtr pn, tpn;
|
XvPortNotifyPtr pn, tpn;
|
||||||
|
|
||||||
/* SEE IF CLIENT IS ALREADY IN LIST */
|
/* SEE IF CLIENT IS ALREADY IN LIST */
|
||||||
|
|
||||||
tpn = NULL;
|
tpn = NULL;
|
||||||
pn = pPort->pNotify;
|
pn = pPort->pNotify;
|
||||||
while (pn)
|
while (pn) {
|
||||||
{
|
if (!pn->client)
|
||||||
if (!pn->client) tpn = pn; /* TAKE NOTE OF FREE ENTRY */
|
tpn = pn; /* TAKE NOTE OF FREE ENTRY */
|
||||||
if (pn->client == client) break;
|
if (pn->client == client)
|
||||||
|
break;
|
||||||
pn = pn->next;
|
pn = pn->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* IS THE CLIENT ALREADY ON THE LIST? */
|
/* IS THE CLIENT ALREADY ON THE LIST? */
|
||||||
|
|
||||||
if (pn)
|
if (pn) {
|
||||||
{
|
|
||||||
/* REMOVE IT? */
|
/* REMOVE IT? */
|
||||||
|
|
||||||
if (!onoff)
|
if (!onoff) {
|
||||||
{
|
|
||||||
pn->client = NULL;
|
pn->client = NULL;
|
||||||
FreeResource(pn->id, XvRTPortNotify);
|
FreeResource(pn->id, XvRTPortNotify);
|
||||||
}
|
}
|
||||||
|
|
@ -1014,8 +941,7 @@ XvdiSelectPortNotify(
|
||||||
/* DIDN'T FIND IT; SO REUSE LIST ELEMENT IF ONE IS FREE OTHERWISE
|
/* 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 */
|
CREATE A NEW ONE AND ADD IT TO THE BEGINNING OF THE LIST */
|
||||||
|
|
||||||
if (!tpn)
|
if (!tpn) {
|
||||||
{
|
|
||||||
if (!(tpn = malloc(sizeof(XvPortNotifyRec))))
|
if (!(tpn = malloc(sizeof(XvPortNotifyRec))))
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
tpn->next = pPort->pNotify;
|
tpn->next = pPort->pNotify;
|
||||||
|
|
@ -1031,17 +957,13 @@ XvdiSelectPortNotify(
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
XvdiStopVideo(
|
XvdiStopVideo(ClientPtr client, XvPortPtr pPort, DrawablePtr pDraw)
|
||||||
ClientPtr client,
|
{
|
||||||
XvPortPtr pPort,
|
|
||||||
DrawablePtr pDraw
|
|
||||||
){
|
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
/* IF PORT ISN'T ACTIVE THEN WE'RE DONE */
|
/* 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);
|
XvdiSendVideoNotify(pPort, pDraw, XvStopped);
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
@ -1049,8 +971,7 @@ XvdiStopVideo(
|
||||||
/* CHECK FOR GRAB; IF THIS CLIENT DOESN'T HAVE THE PORT GRABBED THEN
|
/* CHECK FOR GRAB; IF THIS CLIENT DOESN'T HAVE THE PORT GRABBED THEN
|
||||||
INFORM CLIENT OF ITS FAILURE */
|
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);
|
XvdiSendVideoNotify(pPort, pDraw, XvBusy);
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
@ -1068,16 +989,14 @@ XvdiStopVideo(
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
XvdiPreemptVideo(
|
XvdiPreemptVideo(ClientPtr client, XvPortPtr pPort, DrawablePtr pDraw)
|
||||||
ClientPtr client,
|
{
|
||||||
XvPortPtr pPort,
|
|
||||||
DrawablePtr pDraw
|
|
||||||
){
|
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
/* IF PORT ISN'T ACTIVE THEN WE'RE DONE */
|
/* 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);
|
XvdiSendVideoNotify(pPort, pPort->pDraw, XvPreempted);
|
||||||
|
|
||||||
|
|
@ -1092,10 +1011,8 @@ XvdiPreemptVideo(
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
XvdiMatchPort(
|
XvdiMatchPort(XvPortPtr pPort, DrawablePtr pDraw)
|
||||||
XvPortPtr pPort,
|
{
|
||||||
DrawablePtr pDraw
|
|
||||||
){
|
|
||||||
|
|
||||||
XvAdaptorPtr pa;
|
XvAdaptorPtr pa;
|
||||||
XvFormatPtr pf;
|
XvFormatPtr pf;
|
||||||
|
|
@ -1103,13 +1020,13 @@ XvdiMatchPort(
|
||||||
|
|
||||||
pa = pPort->pAdaptor;
|
pa = pPort->pAdaptor;
|
||||||
|
|
||||||
if (pa->pScreen != pDraw->pScreen) return BadMatch;
|
if (pa->pScreen != pDraw->pScreen)
|
||||||
|
return BadMatch;
|
||||||
|
|
||||||
nf = pa->nFormats;
|
nf = pa->nFormats;
|
||||||
pf = pa->pFormats;
|
pf = pa->pFormats;
|
||||||
|
|
||||||
while (nf--)
|
while (nf--) {
|
||||||
{
|
|
||||||
if (pf->depth == pDraw->depth)
|
if (pf->depth == pDraw->depth)
|
||||||
return Success;
|
return Success;
|
||||||
pf++;
|
pf++;
|
||||||
|
|
@ -1120,15 +1037,14 @@ XvdiMatchPort(
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
XvdiSetPortAttribute(
|
XvdiSetPortAttribute(ClientPtr client,
|
||||||
ClientPtr client,
|
XvPortPtr pPort, Atom attribute, INT32 value)
|
||||||
XvPortPtr pPort,
|
{
|
||||||
Atom attribute,
|
|
||||||
INT32 value
|
|
||||||
){
|
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
status = (* pPort->pAdaptor->ddSetPortAttribute)(client, pPort, attribute, value);
|
status =
|
||||||
|
(*pPort->pAdaptor->ddSetPortAttribute) (client, pPort, attribute,
|
||||||
|
value);
|
||||||
if (status == Success)
|
if (status == Success)
|
||||||
XvdiSendPortNotify(pPort, attribute, value);
|
XvdiSendPortNotify(pPort, attribute, value);
|
||||||
|
|
||||||
|
|
@ -1136,21 +1052,18 @@ XvdiSetPortAttribute(
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
XvdiGetPortAttribute(
|
XvdiGetPortAttribute(ClientPtr client,
|
||||||
ClientPtr client,
|
XvPortPtr pPort, Atom attribute, INT32 *p_value)
|
||||||
XvPortPtr pPort,
|
{
|
||||||
Atom attribute,
|
|
||||||
INT32 *p_value
|
|
||||||
){
|
|
||||||
|
|
||||||
return
|
return
|
||||||
(* pPort->pAdaptor->ddGetPortAttribute)(client, pPort, attribute, p_value);
|
(*pPort->pAdaptor->ddGetPortAttribute) (client, pPort, attribute,
|
||||||
|
p_value);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
WriteSwappedVideoNotifyEvent(xvEvent * from, xvEvent * to)
|
WriteSwappedVideoNotifyEvent(xvEvent * from, xvEvent * to)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
to->u.u.type = from->u.u.type;
|
to->u.u.type = from->u.u.type;
|
||||||
|
|
@ -1165,7 +1078,6 @@ WriteSwappedVideoNotifyEvent(xvEvent *from, xvEvent *to)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
WriteSwappedPortNotifyEvent(xvEvent * from, xvEvent * to)
|
WriteSwappedPortNotifyEvent(xvEvent * from, xvEvent * to)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
to->u.u.type = from->u.u.type;
|
to->u.u.type = from->u.u.type;
|
||||||
|
|
|
||||||
99
Xext/xvmc.c
99
Xext/xvmc.c
|
|
@ -28,12 +28,11 @@
|
||||||
#include <sys/shm.h>
|
#include <sys/shm.h>
|
||||||
#endif /* HAS_XVMCSHM */
|
#endif /* HAS_XVMCSHM */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define DR_CLIENT_DRIVER_NAME_SIZE 48
|
#define DR_CLIENT_DRIVER_NAME_SIZE 48
|
||||||
#define DR_BUSID_SIZE 48
|
#define DR_BUSID_SIZE 48
|
||||||
|
|
||||||
static DevPrivateKeyRec XvMCScreenKeyRec;
|
static DevPrivateKeyRec XvMCScreenKeyRec;
|
||||||
|
|
||||||
#define XvMCScreenKey (&XvMCScreenKeyRec)
|
#define XvMCScreenKey (&XvMCScreenKeyRec)
|
||||||
static Bool XvMCInUse;
|
static Bool XvMCInUse;
|
||||||
|
|
||||||
|
|
@ -60,7 +59,6 @@ typedef struct {
|
||||||
#define XVMC_GET_PRIVATE(pScreen) \
|
#define XVMC_GET_PRIVATE(pScreen) \
|
||||||
(XvMCScreenPtr)(dixLookupPrivate(&(pScreen)->devPrivates, XvMCScreenKey))
|
(XvMCScreenPtr)(dixLookupPrivate(&(pScreen)->devPrivates, XvMCScreenKey))
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
XvMCDestroyContextRes(pointer data, XID id)
|
XvMCDestroyContextRes(pointer data, XID id)
|
||||||
{
|
{
|
||||||
|
|
@ -70,6 +68,7 @@ XvMCDestroyContextRes(pointer data, XID id)
|
||||||
|
|
||||||
if (!pContext->refcnt) {
|
if (!pContext->refcnt) {
|
||||||
XvMCScreenPtr pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen);
|
XvMCScreenPtr pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen);
|
||||||
|
|
||||||
(*pScreenPriv->adaptors[pContext->adapt_num].DestroyContext) (pContext);
|
(*pScreenPriv->adaptors[pContext->adapt_num].DestroyContext) (pContext);
|
||||||
free(pContext);
|
free(pContext);
|
||||||
}
|
}
|
||||||
|
|
@ -92,7 +91,6 @@ XvMCDestroySurfaceRes(pointer data, XID id)
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
XvMCDestroySubpictureRes(pointer data, XID id)
|
XvMCDestroySubpictureRes(pointer data, XID id)
|
||||||
{
|
{
|
||||||
|
|
@ -112,6 +110,7 @@ static int
|
||||||
ProcXvMCQueryVersion(ClientPtr client)
|
ProcXvMCQueryVersion(ClientPtr client)
|
||||||
{
|
{
|
||||||
xvmcQueryVersionReply rep;
|
xvmcQueryVersionReply rep;
|
||||||
|
|
||||||
/* REQUEST(xvmcQueryVersionReq); */
|
/* REQUEST(xvmcQueryVersionReq); */
|
||||||
REQUEST_SIZE_MATCH(xvmcQueryVersionReq);
|
REQUEST_SIZE_MATCH(xvmcQueryVersionReq);
|
||||||
rep.type = X_Reply;
|
rep.type = X_Reply;
|
||||||
|
|
@ -123,7 +122,6 @@ ProcXvMCQueryVersion(ClientPtr client)
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ProcXvMCListSurfaceTypes(ClientPtr client)
|
ProcXvMCListSurfaceTypes(ClientPtr client)
|
||||||
{
|
{
|
||||||
|
|
@ -134,6 +132,7 @@ ProcXvMCListSurfaceTypes(ClientPtr client)
|
||||||
xvmcSurfaceInfo info;
|
xvmcSurfaceInfo info;
|
||||||
XvMCAdaptorPtr adaptor = NULL;
|
XvMCAdaptorPtr adaptor = NULL;
|
||||||
XvMCSurfaceInfoPtr surface;
|
XvMCSurfaceInfoPtr surface;
|
||||||
|
|
||||||
REQUEST(xvmcListSurfaceTypesReq);
|
REQUEST(xvmcListSurfaceTypesReq);
|
||||||
REQUEST_SIZE_MATCH(xvmcListSurfaceTypesReq);
|
REQUEST_SIZE_MATCH(xvmcListSurfaceTypesReq);
|
||||||
|
|
||||||
|
|
@ -141,6 +140,7 @@ ProcXvMCListSurfaceTypes(ClientPtr client)
|
||||||
|
|
||||||
if (XvMCInUse) { /* any adaptors at all */
|
if (XvMCInUse) { /* any adaptors at all */
|
||||||
ScreenPtr pScreen = pPort->pAdaptor->pScreen;
|
ScreenPtr pScreen = pPort->pAdaptor->pScreen;
|
||||||
|
|
||||||
if ((pScreenPriv = XVMC_GET_PRIVATE(pScreen))) { /* any this screen */
|
if ((pScreenPriv = XVMC_GET_PRIVATE(pScreen))) { /* any this screen */
|
||||||
for (i = 0; i < pScreenPriv->num_adaptors; i++) {
|
for (i = 0; i < pScreenPriv->num_adaptors; i++) {
|
||||||
if (pPort->pAdaptor == pScreenPriv->adaptors[i].xv_adaptor) {
|
if (pPort->pAdaptor == pScreenPriv->adaptors[i].xv_adaptor) {
|
||||||
|
|
@ -187,6 +187,7 @@ ProcXvMCCreateContext(ClientPtr client)
|
||||||
XvMCAdaptorPtr adaptor = NULL;
|
XvMCAdaptorPtr adaptor = NULL;
|
||||||
XvMCSurfaceInfoPtr surface = NULL;
|
XvMCSurfaceInfoPtr surface = NULL;
|
||||||
xvmcCreateContextReply rep;
|
xvmcCreateContextReply rep;
|
||||||
|
|
||||||
REQUEST(xvmcCreateContextReq);
|
REQUEST(xvmcCreateContextReq);
|
||||||
REQUEST_SIZE_MATCH(xvmcCreateContextReq);
|
REQUEST_SIZE_MATCH(xvmcCreateContextReq);
|
||||||
|
|
||||||
|
|
@ -219,8 +220,8 @@ ProcXvMCCreateContext(ClientPtr client)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* adaptor doesn't support this suface_type_id */
|
/* adaptor doesn't support this suface_type_id */
|
||||||
if(!surface) return BadMatch;
|
if (!surface)
|
||||||
|
return BadMatch;
|
||||||
|
|
||||||
if ((stuff->width > surface->max_width) ||
|
if ((stuff->width > surface->max_width) ||
|
||||||
(stuff->height > surface->max_height))
|
(stuff->height > surface->max_height))
|
||||||
|
|
@ -230,7 +231,6 @@ ProcXvMCCreateContext(ClientPtr client)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pContext->pScreen = pScreen;
|
pContext->pScreen = pScreen;
|
||||||
pContext->adapt_num = adapt_num;
|
pContext->adapt_num = adapt_num;
|
||||||
pContext->context_id = stuff->context_id;
|
pContext->context_id = stuff->context_id;
|
||||||
|
|
@ -269,6 +269,7 @@ ProcXvMCDestroyContext(ClientPtr client)
|
||||||
{
|
{
|
||||||
pointer val;
|
pointer val;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
REQUEST(xvmcDestroyContextReq);
|
REQUEST(xvmcDestroyContextReq);
|
||||||
REQUEST_SIZE_MATCH(xvmcDestroyContextReq);
|
REQUEST_SIZE_MATCH(xvmcDestroyContextReq);
|
||||||
|
|
||||||
|
|
@ -292,6 +293,7 @@ ProcXvMCCreateSurface(ClientPtr client)
|
||||||
XvMCSurfacePtr pSurface;
|
XvMCSurfacePtr pSurface;
|
||||||
XvMCScreenPtr pScreenPriv;
|
XvMCScreenPtr pScreenPriv;
|
||||||
xvmcCreateSurfaceReply rep;
|
xvmcCreateSurfaceReply rep;
|
||||||
|
|
||||||
REQUEST(xvmcCreateSurfaceReq);
|
REQUEST(xvmcCreateSurfaceReq);
|
||||||
REQUEST_SIZE_MATCH(xvmcCreateSurfaceReq);
|
REQUEST_SIZE_MATCH(xvmcCreateSurfaceReq);
|
||||||
|
|
||||||
|
|
@ -309,8 +311,10 @@ ProcXvMCCreateSurface(ClientPtr client)
|
||||||
pSurface->surface_type_id = pContext->surface_type_id;
|
pSurface->surface_type_id = pContext->surface_type_id;
|
||||||
pSurface->context = pContext;
|
pSurface->context = pContext;
|
||||||
|
|
||||||
result = (*pScreenPriv->adaptors[pContext->adapt_num].CreateSurface)(
|
result =
|
||||||
pSurface, &dwords, &data);
|
(*pScreenPriv->adaptors[pContext->adapt_num].CreateSurface) (pSurface,
|
||||||
|
&dwords,
|
||||||
|
&data);
|
||||||
|
|
||||||
if (result != Success) {
|
if (result != Success) {
|
||||||
free(pSurface);
|
free(pSurface);
|
||||||
|
|
@ -338,6 +342,7 @@ ProcXvMCDestroySurface(ClientPtr client)
|
||||||
{
|
{
|
||||||
pointer val;
|
pointer val;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
REQUEST(xvmcDestroySurfaceReq);
|
REQUEST(xvmcDestroySurfaceReq);
|
||||||
REQUEST_SIZE_MATCH(xvmcDestroySurfaceReq);
|
REQUEST_SIZE_MATCH(xvmcDestroySurfaceReq);
|
||||||
|
|
||||||
|
|
@ -363,6 +368,7 @@ ProcXvMCCreateSubpicture(ClientPtr client)
|
||||||
xvmcCreateSubpictureReply rep;
|
xvmcCreateSubpictureReply rep;
|
||||||
XvMCAdaptorPtr adaptor;
|
XvMCAdaptorPtr adaptor;
|
||||||
XvMCSurfaceInfoPtr surface = NULL;
|
XvMCSurfaceInfoPtr surface = NULL;
|
||||||
|
|
||||||
REQUEST(xvmcCreateSubpictureReq);
|
REQUEST(xvmcCreateSubpictureReq);
|
||||||
REQUEST_SIZE_MATCH(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 */
|
/* 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++) {
|
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;
|
image_supported = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!image_supported) return BadMatch;
|
if (!image_supported)
|
||||||
|
return BadMatch;
|
||||||
|
|
||||||
/* make sure the size is OK */
|
/* make sure the size is OK */
|
||||||
if ((stuff->width > surface->subpicture_max_width) ||
|
if ((stuff->width > surface->subpicture_max_width) ||
|
||||||
|
|
@ -417,8 +427,9 @@ ProcXvMCCreateSubpicture(ClientPtr client)
|
||||||
pSubpicture->component_order[3] = 0;
|
pSubpicture->component_order[3] = 0;
|
||||||
pSubpicture->context = pContext;
|
pSubpicture->context = pContext;
|
||||||
|
|
||||||
result = (*pScreenPriv->adaptors[pContext->adapt_num].CreateSubpicture)(
|
result =
|
||||||
pSubpicture, &dwords, &data);
|
(*pScreenPriv->adaptors[pContext->adapt_num].
|
||||||
|
CreateSubpicture) (pSubpicture, &dwords, &data);
|
||||||
|
|
||||||
if (result != Success) {
|
if (result != Success) {
|
||||||
free(pSubpicture);
|
free(pSubpicture);
|
||||||
|
|
@ -454,6 +465,7 @@ ProcXvMCDestroySubpicture(ClientPtr client)
|
||||||
{
|
{
|
||||||
pointer val;
|
pointer val;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
REQUEST(xvmcDestroySubpictureReq);
|
REQUEST(xvmcDestroySubpictureReq);
|
||||||
REQUEST_SIZE_MATCH(xvmcDestroySubpictureReq);
|
REQUEST_SIZE_MATCH(xvmcDestroySubpictureReq);
|
||||||
|
|
||||||
|
|
@ -467,7 +479,6 @@ ProcXvMCDestroySubpicture(ClientPtr client)
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ProcXvMCListSubpictureTypes(ClientPtr client)
|
ProcXvMCListSubpictureTypes(ClientPtr client)
|
||||||
{
|
{
|
||||||
|
|
@ -480,6 +491,7 @@ ProcXvMCListSubpictureTypes(ClientPtr client)
|
||||||
xvImageFormatInfo info;
|
xvImageFormatInfo info;
|
||||||
XvImagePtr pImage;
|
XvImagePtr pImage;
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
REQUEST(xvmcListSubpictureTypesReq);
|
REQUEST(xvmcListSubpictureTypesReq);
|
||||||
REQUEST_SIZE_MATCH(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++) {
|
for (i = 0; i < adaptor->num_surfaces; i++) {
|
||||||
if (adaptor->surfaces[i]->surface_type_id == stuff->surface_type_id) {
|
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.type = X_Reply;
|
||||||
rep.sequenceNumber = client->sequence;
|
rep.sequenceNumber = client->sequence;
|
||||||
|
|
@ -525,13 +539,13 @@ ProcXvMCListSubpictureTypes(ClientPtr client)
|
||||||
pImage = NULL;
|
pImage = NULL;
|
||||||
for (j = 0; j < adaptor->num_subpictures; j++) {
|
for (j = 0; j < adaptor->num_subpictures; j++) {
|
||||||
if (surface->compatible_subpictures->xvimage_ids[i] ==
|
if (surface->compatible_subpictures->xvimage_ids[i] ==
|
||||||
adaptor->subpictures[j]->id)
|
adaptor->subpictures[j]->id) {
|
||||||
{
|
|
||||||
pImage = adaptor->subpictures[j];
|
pImage = adaptor->subpictures[j];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!pImage) return BadImplementation;
|
if (!pImage)
|
||||||
|
return BadImplementation;
|
||||||
|
|
||||||
info.id = pImage->id;
|
info.id = pImage->id;
|
||||||
info.type = pImage->type;
|
info.type = pImage->type;
|
||||||
|
|
@ -620,18 +634,14 @@ ProcXvMCGetDRInfo(ClientPtr client)
|
||||||
}
|
}
|
||||||
#endif /* HAS_XVMCSHM */
|
#endif /* HAS_XVMCSHM */
|
||||||
|
|
||||||
WriteToClient(client, sizeof(xvmcGetDRInfoReply),
|
WriteToClient(client, sizeof(xvmcGetDRInfoReply), (char *) &rep);
|
||||||
(char*)&rep);
|
|
||||||
if (rep.length) {
|
if (rep.length) {
|
||||||
WriteToClient(client, rep.nameLen,
|
WriteToClient(client, rep.nameLen, pScreenPriv->clientDriverName);
|
||||||
pScreenPriv->clientDriverName);
|
WriteToClient(client, rep.busIDLen, pScreenPriv->busID);
|
||||||
WriteToClient(client, rep.busIDLen,
|
|
||||||
pScreenPriv->busID);
|
|
||||||
}
|
}
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int (*ProcXvMCVector[xvmcNumRequest]) (ClientPtr) = {
|
int (*ProcXvMCVector[xvmcNumRequest]) (ClientPtr) = {
|
||||||
ProcXvMCQueryVersion,
|
ProcXvMCQueryVersion,
|
||||||
ProcXvMCListSurfaceTypes,
|
ProcXvMCListSurfaceTypes,
|
||||||
|
|
@ -641,9 +651,7 @@ int (*ProcXvMCVector[xvmcNumRequest])(ClientPtr) = {
|
||||||
ProcXvMCDestroySurface,
|
ProcXvMCDestroySurface,
|
||||||
ProcXvMCCreateSubpicture,
|
ProcXvMCCreateSubpicture,
|
||||||
ProcXvMCDestroySubpicture,
|
ProcXvMCDestroySubpicture,
|
||||||
ProcXvMCListSubpictureTypes,
|
ProcXvMCListSubpictureTypes, ProcXvMCGetDRInfo};
|
||||||
ProcXvMCGetDRInfo
|
|
||||||
};
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ProcXvMCDispatch(ClientPtr client)
|
ProcXvMCDispatch(ClientPtr client)
|
||||||
|
|
@ -687,13 +695,17 @@ XvMCExtensionInit(void)
|
||||||
ProcXvMCDispatch, SProcXvMCDispatch,
|
ProcXvMCDispatch, SProcXvMCDispatch,
|
||||||
NULL, StandardMinorOpcode);
|
NULL, StandardMinorOpcode);
|
||||||
|
|
||||||
if(!extEntry) return;
|
if (!extEntry)
|
||||||
|
return;
|
||||||
|
|
||||||
XvMCReqCode = extEntry->base;
|
XvMCReqCode = extEntry->base;
|
||||||
XvMCEventBase = extEntry->eventBase;
|
XvMCEventBase = extEntry->eventBase;
|
||||||
SetResourceTypeErrorValue(XvMCRTContext, extEntry->errorBase + XvMCBadContext);
|
SetResourceTypeErrorValue(XvMCRTContext,
|
||||||
SetResourceTypeErrorValue(XvMCRTSurface, extEntry->errorBase + XvMCBadSurface);
|
extEntry->errorBase + XvMCBadContext);
|
||||||
SetResourceTypeErrorValue(XvMCRTSubpicture, extEntry->errorBase + XvMCBadSubpicture);
|
SetResourceTypeErrorValue(XvMCRTSurface,
|
||||||
|
extEntry->errorBase + XvMCBadSurface);
|
||||||
|
SetResourceTypeErrorValue(XvMCRTSubpicture,
|
||||||
|
extEntry->errorBase + XvMCBadSubpicture);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
|
|
@ -708,7 +720,6 @@ XvMCCloseScreen (int i, ScreenPtr pScreen)
|
||||||
return (*pScreen->CloseScreen) (i, pScreen);
|
return (*pScreen->CloseScreen) (i, pScreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
XvMCScreenInit(ScreenPtr pScreen, int num, XvMCAdaptorPtr pAdapt)
|
XvMCScreenInit(ScreenPtr pScreen, int num, XvMCAdaptorPtr pAdapt)
|
||||||
{
|
{
|
||||||
|
|
@ -738,7 +749,8 @@ XvMCScreenInit(ScreenPtr pScreen, int num, XvMCAdaptorPtr pAdapt)
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
XvImagePtr XvMCFindXvImage(XvPortPtr pPort, CARD32 id)
|
XvImagePtr
|
||||||
|
XvMCFindXvImage(XvPortPtr pPort, CARD32 id)
|
||||||
{
|
{
|
||||||
XvImagePtr pImage = NULL;
|
XvImagePtr pImage = NULL;
|
||||||
ScreenPtr pScreen = pPort->pAdaptor->pScreen;
|
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++) {
|
for (i = 0; i < adaptor->num_subpictures; i++) {
|
||||||
if (adaptor->subpictures[i]->id == id) {
|
if (adaptor->subpictures[i]->id == id) {
|
||||||
|
|
@ -773,16 +786,14 @@ XvImagePtr XvMCFindXvImage(XvPortPtr pPort, CARD32 id)
|
||||||
|
|
||||||
int
|
int
|
||||||
xf86XvMCRegisterDRInfo(ScreenPtr pScreen, char *name,
|
xf86XvMCRegisterDRInfo(ScreenPtr pScreen, char *name,
|
||||||
char *busID, int major, int minor,
|
char *busID, int major, int minor, int patchLevel)
|
||||||
int patchLevel)
|
|
||||||
{
|
{
|
||||||
XvMCScreenPtr pScreenPriv = XVMC_GET_PRIVATE(pScreen);
|
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);
|
strlcpy(pScreenPriv->busID, busID, DR_BUSID_SIZE);
|
||||||
pScreenPriv->major = major;
|
pScreenPriv->major = major;
|
||||||
pScreenPriv->minor = minor;
|
pScreenPriv->minor = minor;
|
||||||
pScreenPriv->patchLevel = patchLevel;
|
pScreenPriv->patchLevel = patchLevel;
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,6 @@ typedef struct {
|
||||||
pointer driver_priv;
|
pointer driver_priv;
|
||||||
} XvMCSurfaceRec, *XvMCSurfacePtr;
|
} XvMCSurfaceRec, *XvMCSurfacePtr;
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
XID subpicture_id;
|
XID subpicture_id;
|
||||||
int xvimage_id;
|
int xvimage_id;
|
||||||
|
|
@ -55,37 +54,21 @@ typedef struct {
|
||||||
pointer driver_priv;
|
pointer driver_priv;
|
||||||
} XvMCSubpictureRec, *XvMCSubpicturePtr;
|
} XvMCSubpictureRec, *XvMCSubpicturePtr;
|
||||||
|
|
||||||
typedef int (*XvMCCreateContextProcPtr) (
|
typedef int (*XvMCCreateContextProcPtr) (XvPortPtr port,
|
||||||
XvPortPtr port,
|
|
||||||
XvMCContextPtr context,
|
XvMCContextPtr context,
|
||||||
int *num_priv,
|
int *num_priv, CARD32 **priv);
|
||||||
CARD32 **priv
|
|
||||||
);
|
|
||||||
|
|
||||||
typedef void (*XvMCDestroyContextProcPtr) (
|
typedef void (*XvMCDestroyContextProcPtr) (XvMCContextPtr context);
|
||||||
XvMCContextPtr context
|
|
||||||
);
|
|
||||||
|
|
||||||
typedef int (*XvMCCreateSurfaceProcPtr) (
|
typedef int (*XvMCCreateSurfaceProcPtr) (XvMCSurfacePtr surface,
|
||||||
XvMCSurfacePtr surface,
|
int *num_priv, CARD32 **priv);
|
||||||
int *num_priv,
|
|
||||||
CARD32 **priv
|
|
||||||
);
|
|
||||||
|
|
||||||
typedef void (*XvMCDestroySurfaceProcPtr) (
|
typedef void (*XvMCDestroySurfaceProcPtr) (XvMCSurfacePtr surface);
|
||||||
XvMCSurfacePtr surface
|
|
||||||
);
|
|
||||||
|
|
||||||
typedef int (*XvMCCreateSubpictureProcPtr) (
|
typedef int (*XvMCCreateSubpictureProcPtr) (XvMCSubpicturePtr subpicture,
|
||||||
XvMCSubpicturePtr subpicture,
|
int *num_priv, CARD32 **priv);
|
||||||
int *num_priv,
|
|
||||||
CARD32 **priv
|
|
||||||
);
|
|
||||||
|
|
||||||
typedef void (*XvMCDestroySubpictureProcPtr) (
|
|
||||||
XvMCSubpicturePtr subpicture
|
|
||||||
);
|
|
||||||
|
|
||||||
|
typedef void (*XvMCDestroySubpictureProcPtr) (XvMCSubpicturePtr subpicture);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
XvAdaptorPtr xv_adaptor;
|
XvAdaptorPtr xv_adaptor;
|
||||||
|
|
@ -105,8 +88,7 @@ typedef struct {
|
||||||
extern _X_EXPORT void XvMCExtensionInit(void);
|
extern _X_EXPORT void XvMCExtensionInit(void);
|
||||||
|
|
||||||
extern _X_EXPORT int XvMCScreenInit(ScreenPtr pScreen,
|
extern _X_EXPORT int XvMCScreenInit(ScreenPtr pScreen,
|
||||||
int num,
|
int num, XvMCAdaptorPtr adapt);
|
||||||
XvMCAdaptorPtr adapt);
|
|
||||||
|
|
||||||
extern _X_EXPORT XvImagePtr XvMCFindXvImage(XvPortPtr pPort, CARD32 id);
|
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:
|
case DEVICE_RESOLUTION:
|
||||||
r = (xDeviceResolutionCtl *) & stuff[1];
|
r = (xDeviceResolutionCtl *) & stuff[1];
|
||||||
if ((len < bytes_to_int32(sizeof(xDeviceResolutionCtl))) ||
|
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;
|
ret = BadLength;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
@ -161,10 +162,12 @@ ProcXChangeDeviceControl(ClientPtr client)
|
||||||
(a++)->resolution = *resolution++;
|
(a++)->resolution = *resolution++;
|
||||||
|
|
||||||
ret = Success;
|
ret = Success;
|
||||||
} else if (status == DeviceBusy) {
|
}
|
||||||
|
else if (status == DeviceBusy) {
|
||||||
rep.status = DeviceBusy;
|
rep.status = DeviceBusy;
|
||||||
ret = Success;
|
ret = Success;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
ret = BadMatch;
|
ret = BadMatch;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -190,10 +193,12 @@ ProcXChangeDeviceControl(ClientPtr client)
|
||||||
else
|
else
|
||||||
DisableDevice(dev, TRUE);
|
DisableDevice(dev, TRUE);
|
||||||
ret = Success;
|
ret = Success;
|
||||||
} else if (status == DeviceBusy) {
|
}
|
||||||
|
else if (status == DeviceBusy) {
|
||||||
rep.status = DeviceBusy;
|
rep.status = DeviceBusy;
|
||||||
ret = Success;
|
ret = Success;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
ret = BadMatch;
|
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;
|
kctrl.autoRepeat = FALSE;
|
||||||
else
|
else
|
||||||
kctrl.autoRepeats[inx] &= ~kmask;
|
kctrl.autoRepeats[inx] &= ~kmask;
|
||||||
} else if (t == AutoRepeatModeOn) {
|
}
|
||||||
|
else if (t == AutoRepeatModeOn) {
|
||||||
if (key == DO_ALL)
|
if (key == DO_ALL)
|
||||||
kctrl.autoRepeat = TRUE;
|
kctrl.autoRepeat = TRUE;
|
||||||
else
|
else
|
||||||
kctrl.autoRepeats[inx] |= kmask;
|
kctrl.autoRepeats[inx] |= kmask;
|
||||||
} else if (t == AutoRepeatModeDefault) {
|
}
|
||||||
|
else if (t == AutoRepeatModeDefault) {
|
||||||
if (key == DO_ALL)
|
if (key == DO_ALL)
|
||||||
kctrl.autoRepeat = defaultKeyboardControl.autoRepeat;
|
kctrl.autoRepeat = defaultKeyboardControl.autoRepeat;
|
||||||
else
|
else
|
||||||
|
|
@ -186,7 +188,8 @@ ChangeKbdFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
|
||||||
kctrl.autoRepeats[inx] =
|
kctrl.autoRepeats[inx] =
|
||||||
(kctrl.autoRepeats[inx] & ~kmask) |
|
(kctrl.autoRepeats[inx] & ~kmask) |
|
||||||
(defaultKeyboardControl.autoRepeats[inx] & kmask);
|
(defaultKeyboardControl.autoRepeats[inx] & kmask);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
client->errorValue = t;
|
client->errorValue = t;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
|
@ -226,7 +229,8 @@ ChangePtrFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
|
||||||
else if (accelNum < 0) {
|
else if (accelNum < 0) {
|
||||||
client->errorValue = accelNum;
|
client->errorValue = accelNum;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
pctrl.num = accelNum;
|
pctrl.num = accelNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -239,7 +243,8 @@ ChangePtrFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
|
||||||
else if (accelDenom <= 0) {
|
else if (accelDenom <= 0) {
|
||||||
client->errorValue = accelDenom;
|
client->errorValue = accelDenom;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
pctrl.den = accelDenom;
|
pctrl.den = accelDenom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -252,7 +257,8 @@ ChangePtrFeedback(ClientPtr client, DeviceIntPtr dev, long unsigned int mask,
|
||||||
else if (threshold < 0) {
|
else if (threshold < 0) {
|
||||||
client->errorValue = threshold;
|
client->errorValue = threshold;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
pctrl.threshold = threshold;
|
pctrl.threshold = threshold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -463,7 +469,8 @@ ProcXChangeFeedbackControl(ClientPtr client)
|
||||||
if (client->swapped) {
|
if (client->swapped) {
|
||||||
swaps(&f->num_keysyms);
|
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;
|
return BadLength;
|
||||||
|
|
||||||
for (s = dev->stringfeed; s; s = s->next)
|
for (s = dev->stringfeed; s; s = s->next)
|
||||||
|
|
@ -479,7 +486,8 @@ ProcXChangeFeedbackControl(ClientPtr client)
|
||||||
for (i = dev->intfeed; i; i = i->next)
|
for (i = dev->intfeed; i; i = i->next)
|
||||||
if (i->ctrl.id == ((xIntegerFeedbackCtl *) & stuff[1])->id)
|
if (i->ctrl.id == ((xIntegerFeedbackCtl *) & stuff[1])->id)
|
||||||
return ChangeIntegerFeedback(client, dev, stuff->mask, i,
|
return ChangeIntegerFeedback(client, dev, stuff->mask, i,
|
||||||
(xIntegerFeedbackCtl *)&stuff[1]);
|
(xIntegerFeedbackCtl *) &
|
||||||
|
stuff[1]);
|
||||||
break;
|
break;
|
||||||
case LedFeedbackClass:
|
case LedFeedbackClass:
|
||||||
if (len != bytes_to_int32(sizeof(xLedFeedbackCtl)))
|
if (len != bytes_to_int32(sizeof(xLedFeedbackCtl)))
|
||||||
|
|
@ -505,4 +513,3 @@ ProcXChangeFeedbackControl(ClientPtr client)
|
||||||
|
|
||||||
return BadMatch;
|
return BadMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,8 @@ ProcXChangeDeviceDontPropagateList(ClientPtr client)
|
||||||
REQUEST(xChangeDeviceDontPropagateListReq);
|
REQUEST(xChangeDeviceDontPropagateListReq);
|
||||||
REQUEST_AT_LEAST_SIZE(xChangeDeviceDontPropagateListReq);
|
REQUEST_AT_LEAST_SIZE(xChangeDeviceDontPropagateListReq);
|
||||||
|
|
||||||
if (stuff->length != bytes_to_int32(sizeof(xChangeDeviceDontPropagateListReq)) +
|
if (stuff->length !=
|
||||||
|
bytes_to_int32(sizeof(xChangeDeviceDontPropagateListReq)) +
|
||||||
stuff->count)
|
stuff->count)
|
||||||
return BadLength;
|
return BadLength;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,8 @@ ProcXDeviceBell(ClientPtr client)
|
||||||
proc = k->BellProc;
|
proc = k->BellProc;
|
||||||
ctrl = (pointer) &(k->ctrl);
|
ctrl = (pointer) &(k->ctrl);
|
||||||
class = KbdFeedbackClass;
|
class = KbdFeedbackClass;
|
||||||
} else if (stuff->feedbackclass == BellFeedbackClass) {
|
}
|
||||||
|
else if (stuff->feedbackclass == BellFeedbackClass) {
|
||||||
for (b = dev->bell; b; b = b->next)
|
for (b = dev->bell; b; b = b->next)
|
||||||
if (b->ctrl.id == stuff->feedbackid)
|
if (b->ctrl.id == stuff->feedbackid)
|
||||||
break;
|
break;
|
||||||
|
|
@ -131,7 +132,8 @@ ProcXDeviceBell(ClientPtr client)
|
||||||
proc = b->BellProc;
|
proc = b->BellProc;
|
||||||
ctrl = (pointer) &(b->ctrl);
|
ctrl = (pointer) &(b->ctrl);
|
||||||
class = BellFeedbackClass;
|
class = BellFeedbackClass;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
client->errorValue = stuff->feedbackclass;
|
client->errorValue = stuff->feedbackclass;
|
||||||
return BadValue;
|
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 RESTYPE RT_INPUTCLIENT;
|
||||||
|
|
||||||
extern DevPrivateKeyRec XIClientPrivateKeyRec;
|
extern DevPrivateKeyRec XIClientPrivateKeyRec;
|
||||||
|
|
||||||
#define XIClientPrivateKey (&XIClientPrivateKeyRec)
|
#define XIClientPrivateKey (&XIClientPrivateKeyRec)
|
||||||
|
|
||||||
#endif /* EXGLOBALS_H */
|
#endif /* EXGLOBALS_H */
|
||||||
|
|
|
||||||
105
Xi/extinit.c
105
Xi/extinit.c
|
|
@ -125,7 +125,6 @@ SOFTWARE.
|
||||||
#include "xisetclientpointer.h"
|
#include "xisetclientpointer.h"
|
||||||
#include "xiwarppointer.h"
|
#include "xiwarppointer.h"
|
||||||
|
|
||||||
|
|
||||||
/* Masks for XI events have to be aligned with core event (partially anyway).
|
/* Masks for XI events have to be aligned with core event (partially anyway).
|
||||||
* If DeviceButtonMotionMask is != ButtonMotionMask, event delivery
|
* If DeviceButtonMotionMask is != ButtonMotionMask, event delivery
|
||||||
* breaks down. The device needs the dev->button->motionMask. If DBMM is
|
* breaks down. The device needs the dev->button->motionMask. If DBMM is
|
||||||
|
|
@ -159,8 +158,7 @@ const Mask XIAllMasks = (1L << 21) - 1;
|
||||||
int ExtEventIndex;
|
int ExtEventIndex;
|
||||||
Mask ExtExclusiveMasks[EMASKSIZE];
|
Mask ExtExclusiveMasks[EMASKSIZE];
|
||||||
|
|
||||||
static struct dev_type
|
static struct dev_type {
|
||||||
{
|
|
||||||
Atom type;
|
Atom type;
|
||||||
const char *name;
|
const char *name;
|
||||||
} dev_type[] = {
|
} dev_type[] = {
|
||||||
|
|
@ -367,7 +365,6 @@ RESTYPE RT_INPUTCLIENT;
|
||||||
|
|
||||||
extern XExtensionVersion XIVersion;
|
extern XExtensionVersion XIVersion;
|
||||||
|
|
||||||
|
|
||||||
Mask PropagateMask[MAXDEVICES];
|
Mask PropagateMask[MAXDEVICES];
|
||||||
|
|
||||||
/*****************************************************************
|
/*****************************************************************
|
||||||
|
|
@ -385,9 +382,7 @@ DevPrivateKeyRec XIClientPrivateKeyRec;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
XIClientCallback(CallbackListPtr *list,
|
XIClientCallback(CallbackListPtr *list, pointer closure, pointer data)
|
||||||
pointer closure,
|
|
||||||
pointer data)
|
|
||||||
{
|
{
|
||||||
NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
|
NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
|
||||||
ClientPtr pClient = clientinfo->client;
|
ClientPtr pClient = clientinfo->client;
|
||||||
|
|
@ -496,7 +491,8 @@ SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep)
|
||||||
SRepXChangeDeviceControl(client, len,
|
SRepXChangeDeviceControl(client, len,
|
||||||
(xChangeDeviceControlReply *) rep);
|
(xChangeDeviceControlReply *) rep);
|
||||||
else if (rep->RepType == X_ListDeviceProperties)
|
else if (rep->RepType == X_ListDeviceProperties)
|
||||||
SRepXListDeviceProperties(client, len, (xListDevicePropertiesReply*)rep);
|
SRepXListDeviceProperties(client, len,
|
||||||
|
(xListDevicePropertiesReply *) rep);
|
||||||
else if (rep->RepType == X_GetDeviceProperty)
|
else if (rep->RepType == X_GetDeviceProperty)
|
||||||
SRepXGetDeviceProperty(client, len, (xGetDevicePropertyReply *) rep);
|
SRepXGetDeviceProperty(client, len, (xGetDevicePropertyReply *) rep);
|
||||||
else if (rep->RepType == X_XIQueryPointer)
|
else if (rep->RepType == X_XIQueryPointer)
|
||||||
|
|
@ -602,7 +598,8 @@ SDeviceMappingNotifyEvent(deviceMappingNotify * from, deviceMappingNotify * to)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
SDevicePresenceNotifyEvent (devicePresenceNotify *from, devicePresenceNotify *to)
|
SDevicePresenceNotifyEvent(devicePresenceNotify * from,
|
||||||
|
devicePresenceNotify * to)
|
||||||
{
|
{
|
||||||
*to = *from;
|
*to = *from;
|
||||||
swaps(&to->sequenceNumber);
|
swaps(&to->sequenceNumber);
|
||||||
|
|
@ -611,7 +608,8 @@ SDevicePresenceNotifyEvent (devicePresenceNotify *from, devicePresenceNotify *to
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
SDevicePropertyNotifyEvent (devicePropertyNotify *from, devicePropertyNotify *to)
|
SDevicePropertyNotifyEvent(devicePropertyNotify * from,
|
||||||
|
devicePropertyNotify * to)
|
||||||
{
|
{
|
||||||
*to = *from;
|
*to = *from;
|
||||||
swaps(&to->sequenceNumber);
|
swaps(&to->sequenceNumber);
|
||||||
|
|
@ -652,16 +650,15 @@ SDeviceChangedEvent(xXIDeviceChangedEvent* from, xXIDeviceChangedEvent* to)
|
||||||
memcpy(&to[1], &from[1], from->length * 4);
|
memcpy(&to[1], &from[1], from->length * 4);
|
||||||
|
|
||||||
any = (xXIAnyInfo *) & to[1];
|
any = (xXIAnyInfo *) & to[1];
|
||||||
for (i = 0; i < to->num_classes; i++)
|
for (i = 0; i < to->num_classes; i++) {
|
||||||
{
|
|
||||||
int length = any->length;
|
int length = any->length;
|
||||||
|
|
||||||
switch(any->type)
|
switch (any->type) {
|
||||||
{
|
|
||||||
case KeyClass:
|
case KeyClass:
|
||||||
{
|
{
|
||||||
xXIKeyInfo *ki = (xXIKeyInfo *) any;
|
xXIKeyInfo *ki = (xXIKeyInfo *) any;
|
||||||
uint32_t *key = (uint32_t *) & ki[1];
|
uint32_t *key = (uint32_t *) & ki[1];
|
||||||
|
|
||||||
for (j = 0; j < ki->num_keycodes; j++, key++)
|
for (j = 0; j < ki->num_keycodes; j++, key++)
|
||||||
swapl(key);
|
swapl(key);
|
||||||
swaps(&ki->num_keycodes);
|
swaps(&ki->num_keycodes);
|
||||||
|
|
@ -671,7 +668,8 @@ SDeviceChangedEvent(xXIDeviceChangedEvent* from, xXIDeviceChangedEvent* to)
|
||||||
{
|
{
|
||||||
xXIButtonInfo *bi = (xXIButtonInfo *) any;
|
xXIButtonInfo *bi = (xXIButtonInfo *) any;
|
||||||
Atom *labels = (Atom *) ((char *) bi + sizeof(xXIButtonInfo) +
|
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++)
|
for (j = 0; j < bi->num_buttons; j++)
|
||||||
swapl(&labels[j]);
|
swapl(&labels[j]);
|
||||||
swaps(&bi->num_buttons);
|
swaps(&bi->num_buttons);
|
||||||
|
|
@ -680,6 +678,7 @@ SDeviceChangedEvent(xXIDeviceChangedEvent* from, xXIDeviceChangedEvent* to)
|
||||||
case ValuatorClass:
|
case ValuatorClass:
|
||||||
{
|
{
|
||||||
xXIValuatorInfo *ai = (xXIValuatorInfo *) any;
|
xXIValuatorInfo *ai = (xXIValuatorInfo *) any;
|
||||||
|
|
||||||
swapl(&ai->label);
|
swapl(&ai->label);
|
||||||
swapl(&ai->min.integral);
|
swapl(&ai->min.integral);
|
||||||
swapl(&ai->min.frac);
|
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;
|
int i;
|
||||||
char *ptr;
|
char *ptr;
|
||||||
|
|
@ -742,10 +742,8 @@ static void SDeviceEvent(xXIDeviceEvent *from, xXIDeviceEvent *to)
|
||||||
ptr += from->buttons_len * 4;
|
ptr += from->buttons_len * 4;
|
||||||
vmask = ptr; /* valuator mask */
|
vmask = ptr; /* valuator mask */
|
||||||
ptr += from->valuators_len * 4;
|
ptr += from->valuators_len * 4;
|
||||||
for (i = 0; i < from->valuators_len * 32; i++)
|
for (i = 0; i < from->valuators_len * 32; i++) {
|
||||||
{
|
if (BitIsOn(vmask, i)) {
|
||||||
if (BitIsOn(vmask, i))
|
|
||||||
{
|
|
||||||
swapl(((uint32_t *) ptr));
|
swapl(((uint32_t *) ptr));
|
||||||
ptr += 4;
|
ptr += 4;
|
||||||
swapl(((uint32_t *) ptr));
|
swapl(((uint32_t *) ptr));
|
||||||
|
|
@ -754,8 +752,8 @@ static void SDeviceEvent(xXIDeviceEvent *from, xXIDeviceEvent *to)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SDeviceHierarchyEvent(xXIHierarchyEvent *from,
|
static void
|
||||||
xXIHierarchyEvent *to)
|
SDeviceHierarchyEvent(xXIHierarchyEvent * from, xXIHierarchyEvent * to)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
xXIHierarchyInfo *info;
|
xXIHierarchyInfo *info;
|
||||||
|
|
@ -771,15 +769,15 @@ static void SDeviceHierarchyEvent(xXIHierarchyEvent *from,
|
||||||
swaps(&to->num_info);
|
swaps(&to->num_info);
|
||||||
|
|
||||||
info = (xXIHierarchyInfo *) & to[1];
|
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->deviceid);
|
||||||
swaps(&info->attachment);
|
swaps(&info->attachment);
|
||||||
info++;
|
info++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SXIPropertyEvent(xXIPropertyEvent *from, xXIPropertyEvent *to)
|
static void
|
||||||
|
SXIPropertyEvent(xXIPropertyEvent * from, xXIPropertyEvent * to)
|
||||||
{
|
{
|
||||||
*to = *from;
|
*to = *from;
|
||||||
swaps(&to->sequenceNumber);
|
swaps(&to->sequenceNumber);
|
||||||
|
|
@ -789,7 +787,8 @@ static void SXIPropertyEvent(xXIPropertyEvent *from, xXIPropertyEvent *to)
|
||||||
swapl(&to->property);
|
swapl(&to->property);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SRawEvent(xXIRawEvent *from, xXIRawEvent *to)
|
static void
|
||||||
|
SRawEvent(xXIRawEvent * from, xXIRawEvent * to)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
FP3232 *values;
|
FP3232 *values;
|
||||||
|
|
@ -804,14 +803,11 @@ static void SRawEvent(xXIRawEvent *from, xXIRawEvent *to)
|
||||||
swapl(&to->time);
|
swapl(&to->time);
|
||||||
swapl(&to->detail);
|
swapl(&to->detail);
|
||||||
|
|
||||||
|
|
||||||
mask = (unsigned char *) &to[1];
|
mask = (unsigned char *) &to[1];
|
||||||
values = (FP3232 *) (mask + from->valuators_len * 4);
|
values = (FP3232 *) (mask + from->valuators_len * 4);
|
||||||
|
|
||||||
for (i = 0; i < from->valuators_len * 4 * 8; i++)
|
for (i = 0; i < from->valuators_len * 4 * 8; i++) {
|
||||||
{
|
if (BitIsOn(mask, i)) {
|
||||||
if (BitIsOn(mask, i))
|
|
||||||
{
|
|
||||||
/* for each bit set there are two FP3232 values on the wire, in
|
/* 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
|
* the order abcABC for data and data_raw. Here we swap as if
|
||||||
* they were in aAbBcC order because it's easier and really
|
* 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);
|
swaps(&to->valuators_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void STouchOwnershipEvent(xXITouchOwnershipEvent *from,
|
static void
|
||||||
xXITouchOwnershipEvent *to)
|
STouchOwnershipEvent(xXITouchOwnershipEvent * from, xXITouchOwnershipEvent * to)
|
||||||
{
|
{
|
||||||
*to = *from;
|
*to = *from;
|
||||||
swaps(&to->sequenceNumber);
|
swaps(&to->sequenceNumber);
|
||||||
|
|
@ -850,8 +846,7 @@ static void STouchOwnershipEvent(xXITouchOwnershipEvent *from,
|
||||||
void
|
void
|
||||||
XI2EventSwap(xGenericEvent *from, xGenericEvent *to)
|
XI2EventSwap(xGenericEvent *from, xGenericEvent *to)
|
||||||
{
|
{
|
||||||
switch(from->evtype)
|
switch (from->evtype) {
|
||||||
{
|
|
||||||
case XI_Enter:
|
case XI_Enter:
|
||||||
case XI_Leave:
|
case XI_Leave:
|
||||||
case XI_FocusIn:
|
case XI_FocusIn:
|
||||||
|
|
@ -863,11 +858,11 @@ XI2EventSwap(xGenericEvent *from, xGenericEvent *to)
|
||||||
(xXIDeviceChangedEvent *) to);
|
(xXIDeviceChangedEvent *) to);
|
||||||
break;
|
break;
|
||||||
case XI_HierarchyChanged:
|
case XI_HierarchyChanged:
|
||||||
SDeviceHierarchyEvent((xXIHierarchyEvent*)from, (xXIHierarchyEvent*)to);
|
SDeviceHierarchyEvent((xXIHierarchyEvent *) from,
|
||||||
|
(xXIHierarchyEvent *) to);
|
||||||
break;
|
break;
|
||||||
case XI_PropertyEvent:
|
case XI_PropertyEvent:
|
||||||
SXIPropertyEvent((xXIPropertyEvent*)from,
|
SXIPropertyEvent((xXIPropertyEvent *) from, (xXIPropertyEvent *) to);
|
||||||
(xXIPropertyEvent*)to);
|
|
||||||
break;
|
break;
|
||||||
case XI_Motion:
|
case XI_Motion:
|
||||||
case XI_KeyPress:
|
case XI_KeyPress:
|
||||||
|
|
@ -1078,8 +1073,7 @@ RestoreExtensionEvents(void)
|
||||||
IEventBase = 0;
|
IEventBase = 0;
|
||||||
|
|
||||||
for (i = 0; i < ExtEventIndex - 1; i++) {
|
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++)
|
for (j = 0; j < MAXDEVICES; j++)
|
||||||
SetMaskForEvent(j, 0, EventInfo[i].type);
|
SetMaskForEvent(j, 0, EventInfo[i].type);
|
||||||
}
|
}
|
||||||
|
|
@ -1145,7 +1139,6 @@ IResetProc(ExtensionEntry * unused)
|
||||||
RestoreExtensionEvents();
|
RestoreExtensionEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
*
|
*
|
||||||
* Assign an id and type to an input device.
|
* Assign an id and type to an input device.
|
||||||
|
|
@ -1193,29 +1186,36 @@ SEventIDispatch(xEvent * from, xEvent * to)
|
||||||
else if (type == DeviceKeyPress) {
|
else if (type == DeviceKeyPress) {
|
||||||
SKeyButtonPtrEvent(from, to);
|
SKeyButtonPtrEvent(from, to);
|
||||||
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
|
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
|
||||||
} else if (type == DeviceKeyRelease) {
|
}
|
||||||
|
else if (type == DeviceKeyRelease) {
|
||||||
SKeyButtonPtrEvent(from, to);
|
SKeyButtonPtrEvent(from, to);
|
||||||
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
|
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
|
||||||
} else if (type == DeviceButtonPress) {
|
}
|
||||||
|
else if (type == DeviceButtonPress) {
|
||||||
SKeyButtonPtrEvent(from, to);
|
SKeyButtonPtrEvent(from, to);
|
||||||
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
|
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
|
||||||
} else if (type == DeviceButtonRelease) {
|
}
|
||||||
|
else if (type == DeviceButtonRelease) {
|
||||||
SKeyButtonPtrEvent(from, to);
|
SKeyButtonPtrEvent(from, to);
|
||||||
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
|
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
|
||||||
} else if (type == DeviceMotionNotify) {
|
}
|
||||||
|
else if (type == DeviceMotionNotify) {
|
||||||
SKeyButtonPtrEvent(from, to);
|
SKeyButtonPtrEvent(from, to);
|
||||||
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
|
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
|
||||||
} else if (type == DeviceFocusIn)
|
}
|
||||||
|
else if (type == DeviceFocusIn)
|
||||||
DO_SWAP(SEventFocus, deviceFocus);
|
DO_SWAP(SEventFocus, deviceFocus);
|
||||||
else if (type == DeviceFocusOut)
|
else if (type == DeviceFocusOut)
|
||||||
DO_SWAP(SEventFocus, deviceFocus);
|
DO_SWAP(SEventFocus, deviceFocus);
|
||||||
else if (type == ProximityIn) {
|
else if (type == ProximityIn) {
|
||||||
SKeyButtonPtrEvent(from, to);
|
SKeyButtonPtrEvent(from, to);
|
||||||
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
|
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
|
||||||
} else if (type == ProximityOut) {
|
}
|
||||||
|
else if (type == ProximityOut) {
|
||||||
SKeyButtonPtrEvent(from, to);
|
SKeyButtonPtrEvent(from, to);
|
||||||
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
|
to->u.keyButtonPointer.pad1 = from->u.keyButtonPointer.pad1;
|
||||||
} else if (type == DeviceStateNotify)
|
}
|
||||||
|
else if (type == DeviceStateNotify)
|
||||||
DO_SWAP(SDeviceStateNotifyEvent, deviceStateNotify);
|
DO_SWAP(SDeviceStateNotifyEvent, deviceStateNotify);
|
||||||
else if (type == DeviceKeyStateNotify)
|
else if (type == DeviceKeyStateNotify)
|
||||||
DO_SWAP(SDeviceKeyStateNotifyEvent, deviceKeyStateNotify);
|
DO_SWAP(SDeviceKeyStateNotifyEvent, deviceKeyStateNotify);
|
||||||
|
|
@ -1250,12 +1250,14 @@ void
|
||||||
XInputExtensionInit(void)
|
XInputExtensionInit(void)
|
||||||
{
|
{
|
||||||
ExtensionEntry *extEntry;
|
ExtensionEntry *extEntry;
|
||||||
|
|
||||||
XExtensionVersion thisversion = { XI_Present,
|
XExtensionVersion thisversion = { XI_Present,
|
||||||
SERVER_XI_MAJOR_VERSION,
|
SERVER_XI_MAJOR_VERSION,
|
||||||
SERVER_XI_MINOR_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");
|
FatalError("Cannot request private for XI.\n");
|
||||||
|
|
||||||
if (!AddCallback(&ClientStateCallback, XIClientCallback, 0))
|
if (!AddCallback(&ClientStateCallback, XIClientCallback, 0))
|
||||||
|
|
@ -1293,7 +1295,6 @@ XInputExtensionInit(void)
|
||||||
|
|
||||||
GERegisterExtension(IReqCode, XI2EventSwap);
|
GERegisterExtension(IReqCode, XI2EventSwap);
|
||||||
|
|
||||||
|
|
||||||
memset(&xi_all_devices, 0, sizeof(xi_all_devices));
|
memset(&xi_all_devices, 0, sizeof(xi_all_devices));
|
||||||
memset(&xi_all_master_devices, 0, sizeof(xi_all_master_devices));
|
memset(&xi_all_master_devices, 0, sizeof(xi_all_master_devices));
|
||||||
xi_all_devices.id = XIAllDevices;
|
xi_all_devices.id = XIAllDevices;
|
||||||
|
|
@ -1305,8 +1306,8 @@ XInputExtensionInit(void)
|
||||||
inputInfo.all_master_devices = &xi_all_master_devices;
|
inputInfo.all_master_devices = &xi_all_master_devices;
|
||||||
|
|
||||||
XIResetProperties();
|
XIResetProperties();
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
FatalError("IExtensionInit: AddExtensions failed\n");
|
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;
|
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;
|
xDeviceEnableState *e = (xDeviceEnableState *) buf;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -113,8 +113,7 @@ ProcXGetDeviceDontPropagateList(ClientPtr client)
|
||||||
|
|
||||||
if ((others = wOtherInputMasks(pWin)) != 0) {
|
if ((others = wOtherInputMasks(pWin)) != 0) {
|
||||||
for (i = 0; i < EMASKSIZE; i++)
|
for (i = 0; i < EMASKSIZE; i++)
|
||||||
ClassFromMask(NULL, others->dontPropagateMask[i], i,
|
ClassFromMask(NULL, others->dontPropagateMask[i], i, &count, COUNT);
|
||||||
&count, COUNT);
|
|
||||||
if (count) {
|
if (count) {
|
||||||
rep.count = count;
|
rep.count = count;
|
||||||
buf = (XEventClass *) malloc(rep.count * sizeof(XEventClass));
|
buf = (XEventClass *) malloc(rep.count * sizeof(XEventClass));
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,8 @@ SProcXGrabDevice(ClientPtr client)
|
||||||
swapl(&stuff->time);
|
swapl(&stuff->time);
|
||||||
swaps(&stuff->event_count);
|
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;
|
return BadLength;
|
||||||
|
|
||||||
SwapLongs((CARD32 *) (&stuff[1]), stuff->event_count);
|
SwapLongs((CARD32 *) (&stuff[1]), stuff->event_count);
|
||||||
|
|
@ -108,7 +109,8 @@ ProcXGrabDevice(ClientPtr client)
|
||||||
REQUEST(xGrabDeviceReq);
|
REQUEST(xGrabDeviceReq);
|
||||||
REQUEST_AT_LEAST_SIZE(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;
|
return BadLength;
|
||||||
|
|
||||||
rep.repType = X_Reply;
|
rep.repType = X_Reply;
|
||||||
|
|
@ -130,8 +132,7 @@ ProcXGrabDevice(ClientPtr client)
|
||||||
rc = GrabDevice(client, dev, stuff->other_devices_mode,
|
rc = GrabDevice(client, dev, stuff->other_devices_mode,
|
||||||
stuff->this_device_mode, stuff->grabWindow,
|
stuff->this_device_mode, stuff->grabWindow,
|
||||||
stuff->ownerEvents, stuff->time,
|
stuff->ownerEvents, stuff->time,
|
||||||
&mask, XI, None, None,
|
&mask, XI, None, None, &rep.status);
|
||||||
&rep.status);
|
|
||||||
|
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,8 @@ ProcXGrabDeviceButton(ClientPtr client)
|
||||||
return ret;
|
return ret;
|
||||||
if (mdev->key == NULL)
|
if (mdev->key == NULL)
|
||||||
return BadMatch;
|
return BadMatch;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
mdev = PickKeyboard(client);
|
mdev = PickKeyboard(client);
|
||||||
ret = XaceHook(XACE_DEVICE_ACCESS, client, mdev, DixUseAccess);
|
ret = XaceHook(XACE_DEVICE_ACCESS, client, mdev, DixUseAccess);
|
||||||
if (ret != Success)
|
if (ret != Success)
|
||||||
|
|
@ -145,8 +146,7 @@ ProcXGrabDeviceButton(ClientPtr client)
|
||||||
param.modifiers = stuff->modifiers;
|
param.modifiers = stuff->modifiers;
|
||||||
mask.xi = tmp[stuff->grabbed_device].mask;
|
mask.xi = tmp[stuff->grabbed_device].mask;
|
||||||
|
|
||||||
ret = GrabButton(client, dev, mdev, stuff->button, ¶m,
|
ret = GrabButton(client, dev, mdev, stuff->button, ¶m, XI, &mask);
|
||||||
XI, &mask);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,8 @@ ProcXGrabDeviceKey(ClientPtr client)
|
||||||
REQUEST(xGrabDeviceKeyReq);
|
REQUEST(xGrabDeviceKeyReq);
|
||||||
REQUEST_AT_LEAST_SIZE(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;
|
return BadLength;
|
||||||
|
|
||||||
ret = dixLookupDevice(&dev, stuff->grabbed_device, client, DixGrabAccess);
|
ret = dixLookupDevice(&dev, stuff->grabbed_device, client, DixGrabAccess);
|
||||||
|
|
@ -119,7 +120,8 @@ ProcXGrabDeviceKey(ClientPtr client)
|
||||||
return ret;
|
return ret;
|
||||||
if (mdev->key == NULL)
|
if (mdev->key == NULL)
|
||||||
return BadMatch;
|
return BadMatch;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
mdev = PickKeyboard(client);
|
mdev = PickKeyboard(client);
|
||||||
ret = XaceHook(XACE_DEVICE_ACCESS, client, mdev, DixUseAccess);
|
ret = XaceHook(XACE_DEVICE_ACCESS, client, mdev, DixUseAccess);
|
||||||
if (ret != Success)
|
if (ret != Success)
|
||||||
|
|
@ -133,7 +135,6 @@ ProcXGrabDeviceKey(ClientPtr client)
|
||||||
X_GrabDeviceKey)) != Success)
|
X_GrabDeviceKey)) != Success)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
|
||||||
memset(¶m, 0, sizeof(param));
|
memset(¶m, 0, sizeof(param));
|
||||||
param.grabtype = XI;
|
param.grabtype = XI;
|
||||||
param.ownerEvents = stuff->ownerEvents;
|
param.ownerEvents = stuff->ownerEvents;
|
||||||
|
|
|
||||||
15
Xi/listdev.c
15
Xi/listdev.c
|
|
@ -68,7 +68,6 @@ SOFTWARE.
|
||||||
|
|
||||||
#include "listdev.h"
|
#include "listdev.h"
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
*
|
*
|
||||||
* This procedure lists the input devices available to the server.
|
* This procedure lists the input devices available to the server.
|
||||||
|
|
@ -128,7 +127,8 @@ CopyDeviceName(char **namebuf, char *name)
|
||||||
*nameptr++ = strlen(name);
|
*nameptr++ = strlen(name);
|
||||||
strcpy(nameptr, name);
|
strcpy(nameptr, name);
|
||||||
*namebuf += (strlen(name) + 1);
|
*namebuf += (strlen(name) + 1);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
*nameptr++ = 0;
|
*nameptr++ = 0;
|
||||||
*namebuf += 1;
|
*namebuf += 1;
|
||||||
}
|
}
|
||||||
|
|
@ -162,8 +162,7 @@ CopySwapButtonClass(ClientPtr client, ButtonClassPtr b, char **buf)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
CopySwapDevice(ClientPtr client, DeviceIntPtr d, int num_classes,
|
CopySwapDevice(ClientPtr client, DeviceIntPtr d, int num_classes, char **buf)
|
||||||
char **buf)
|
|
||||||
{
|
{
|
||||||
xDeviceInfoPtr dev;
|
xDeviceInfoPtr dev;
|
||||||
|
|
||||||
|
|
@ -280,8 +279,7 @@ CopySwapClasses(ClientPtr client, DeviceIntPtr dev, CARD8 *num_classes,
|
||||||
(*num_classes)++;
|
(*num_classes)++;
|
||||||
}
|
}
|
||||||
if (dev->valuator != NULL) {
|
if (dev->valuator != NULL) {
|
||||||
(*num_classes) +=
|
(*num_classes) += CopySwapValuatorClass(client, dev, classbuf);
|
||||||
CopySwapValuatorClass(client, dev, classbuf);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -310,16 +308,15 @@ static Bool
|
||||||
ShouldSkipDevice(ClientPtr client, DeviceIntPtr d)
|
ShouldSkipDevice(ClientPtr client, DeviceIntPtr d)
|
||||||
{
|
{
|
||||||
/* don't send master devices other than VCP/VCK */
|
/* 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);
|
int rc = XaceHook(XACE_DEVICE_ACCESS, client, d, DixGetAttrAccess);
|
||||||
|
|
||||||
if (rc == Success)
|
if (rc == Success)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
*
|
*
|
||||||
* This procedure lists the input devices available to the server.
|
* This procedure lists the input devices available to the server.
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,8 @@ ProcXOpenDevice(ClientPtr client)
|
||||||
break;
|
break;
|
||||||
if (dev == NULL)
|
if (dev == NULL)
|
||||||
return BadDevice;
|
return BadDevice;
|
||||||
} else if (status != Success)
|
}
|
||||||
|
else if (status != Success)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
if (IsMaster(dev))
|
if (IsMaster(dev))
|
||||||
|
|
|
||||||
|
|
@ -149,7 +149,8 @@ ProcXQueryDeviceState(ClientPtr client)
|
||||||
tv->length = sizeof(xValuatorState) + v->numAxes * 4;
|
tv->length = sizeof(xValuatorState) + v->numAxes * 4;
|
||||||
tv->num_valuators = v->numAxes;
|
tv->num_valuators = v->numAxes;
|
||||||
tv->mode = valuator_get_mode(dev, 0);
|
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);
|
buf += sizeof(xValuatorState);
|
||||||
for (i = 0, values = v->axisVal; i < v->numAxes; i++) {
|
for (i = 0, values = v->axisVal; i < v->numAxes; i++) {
|
||||||
if (rc != BadAccess)
|
if (rc != BadAccess)
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,6 @@ SOFTWARE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
#ifdef HAVE_DIX_CONFIG_H
|
||||||
#include <dix-config.h>
|
#include <dix-config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -128,8 +127,7 @@ SProcXSelectExtensionEvent(ClientPtr client)
|
||||||
REQUEST_AT_LEAST_SIZE(xSelectExtensionEventReq);
|
REQUEST_AT_LEAST_SIZE(xSelectExtensionEventReq);
|
||||||
swapl(&stuff->window);
|
swapl(&stuff->window);
|
||||||
swaps(&stuff->count);
|
swaps(&stuff->count);
|
||||||
REQUEST_FIXED_SIZE(xSelectExtensionEventReq,
|
REQUEST_FIXED_SIZE(xSelectExtensionEventReq, stuff->count * sizeof(CARD32));
|
||||||
stuff->count * sizeof(CARD32));
|
|
||||||
SwapLongs((CARD32 *) (&stuff[1]), stuff->count);
|
SwapLongs((CARD32 *) (&stuff[1]), stuff->count);
|
||||||
|
|
||||||
return (ProcXSelectExtensionEvent(client));
|
return (ProcXSelectExtensionEvent(client));
|
||||||
|
|
@ -152,7 +150,8 @@ ProcXSelectExtensionEvent(ClientPtr client)
|
||||||
REQUEST(xSelectExtensionEventReq);
|
REQUEST(xSelectExtensionEventReq);
|
||||||
REQUEST_AT_LEAST_SIZE(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;
|
return BadLength;
|
||||||
|
|
||||||
ret = dixLookupWindow(&pWin, stuff->window, client, DixReceiveAccess);
|
ret = dixLookupWindow(&pWin, stuff->window, client, DixReceiveAccess);
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,8 @@ SProcXSendExtensionEvent(ClientPtr client)
|
||||||
swapl(&stuff->destination);
|
swapl(&stuff->destination);
|
||||||
swaps(&stuff->count);
|
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)))
|
bytes_to_int32(stuff->num_events * sizeof(xEvent)))
|
||||||
return BadLength;
|
return BadLength;
|
||||||
|
|
||||||
|
|
@ -125,7 +126,8 @@ ProcXSendExtensionEvent(ClientPtr client)
|
||||||
REQUEST(xSendExtensionEventReq);
|
REQUEST(xSendExtensionEventReq);
|
||||||
REQUEST_AT_LEAST_SIZE(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))))
|
(stuff->num_events * bytes_to_int32(sizeof(xEvent))))
|
||||||
return BadLength;
|
return BadLength;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,9 @@ ProcXSetDeviceButtonMapping(ClientPtr client)
|
||||||
rep.sequenceNumber = client->sequence;
|
rep.sequenceNumber = client->sequence;
|
||||||
rep.status = MappingSuccess;
|
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)
|
if (ret == -1)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
else if (ret == MappingBusy)
|
else if (ret == MappingBusy)
|
||||||
|
|
|
||||||
|
|
@ -109,8 +109,7 @@ ProcXSetDeviceMode(ClientPtr client)
|
||||||
|
|
||||||
if (rep.status == Success)
|
if (rep.status == Success)
|
||||||
valuator_set_mode(dev, VALUATOR_MODE_ALL_AXES, stuff->mode);
|
valuator_set_mode(dev, VALUATOR_MODE_ALL_AXES, stuff->mode);
|
||||||
else if (rep.status != AlreadyGrabbed)
|
else if (rep.status != AlreadyGrabbed) {
|
||||||
{
|
|
||||||
switch (rep.status) {
|
switch (rep.status) {
|
||||||
case BadMatch:
|
case BadMatch:
|
||||||
case BadImplementation:
|
case BadImplementation:
|
||||||
|
|
|
||||||
|
|
@ -112,13 +112,11 @@ SetDeviceValuators(ClientPtr client, DeviceIntPtr dev,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
ChangeDeviceControl(ClientPtr client, DeviceIntPtr dev,
|
ChangeDeviceControl(ClientPtr client, DeviceIntPtr dev, xDeviceCtl * control)
|
||||||
xDeviceCtl * control)
|
|
||||||
{
|
{
|
||||||
return BadMatch;
|
return BadMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
*
|
*
|
||||||
* Caller: configAddDevice (and others)
|
* Caller: configAddDevice (and others)
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,8 @@ ProcXUngrabDeviceButton(ClientPtr client)
|
||||||
return BadDevice;
|
return BadDevice;
|
||||||
if (mdev->key == NULL)
|
if (mdev->key == NULL)
|
||||||
return BadMatch;
|
return BadMatch;
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
mdev = PickKeyboard(client);
|
mdev = PickKeyboard(client);
|
||||||
|
|
||||||
rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixSetAttrAccess);
|
rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixSetAttrAccess);
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,8 @@ ProcXUngrabDeviceKey(ClientPtr client)
|
||||||
return BadDevice;
|
return BadDevice;
|
||||||
if (mdev->key == NULL)
|
if (mdev->key == NULL)
|
||||||
return BadMatch;
|
return BadMatch;
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
mdev = PickKeyboard(client);
|
mdev = PickKeyboard(client);
|
||||||
|
|
||||||
rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixSetAttrAccess);
|
rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixSetAttrAccess);
|
||||||
|
|
|
||||||
|
|
@ -52,9 +52,9 @@ SProcXIAllowEvents(ClientPtr client)
|
||||||
swaps(&stuff->length);
|
swaps(&stuff->length);
|
||||||
swaps(&stuff->deviceid);
|
swaps(&stuff->deviceid);
|
||||||
swapl(&stuff->time);
|
swapl(&stuff->time);
|
||||||
if (stuff->length > 3)
|
if (stuff->length > 3) {
|
||||||
{
|
|
||||||
xXI2_2AllowEventsReq *req_xi22 = (xXI2_2AllowEventsReq *) stuff;
|
xXI2_2AllowEventsReq *req_xi22 = (xXI2_2AllowEventsReq *) stuff;
|
||||||
|
|
||||||
swapl(&req_xi22->touchid);
|
swapl(&req_xi22->touchid);
|
||||||
swapl(&req_xi22->grab_window);
|
swapl(&req_xi22->grab_window);
|
||||||
}
|
}
|
||||||
|
|
@ -70,17 +70,17 @@ ProcXIAllowEvents(ClientPtr client)
|
||||||
int ret = Success;
|
int ret = Success;
|
||||||
XIClientPtr xi_client;
|
XIClientPtr xi_client;
|
||||||
Bool have_xi22 = FALSE;
|
Bool have_xi22 = FALSE;
|
||||||
|
|
||||||
REQUEST(xXI2_2AllowEventsReq);
|
REQUEST(xXI2_2AllowEventsReq);
|
||||||
|
|
||||||
xi_client = dixLookupPrivate(&client->devPrivates, XIClientPrivateKey);
|
xi_client = dixLookupPrivate(&client->devPrivates, XIClientPrivateKey);
|
||||||
|
|
||||||
if (version_compare(xi_client->major_version,
|
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);
|
REQUEST_AT_LEAST_SIZE(xXI2_2AllowEventsReq);
|
||||||
have_xi22 = TRUE;
|
have_xi22 = TRUE;
|
||||||
} else
|
}
|
||||||
{
|
else {
|
||||||
REQUEST_SIZE_MATCH(xXIAllowEventsReq);
|
REQUEST_SIZE_MATCH(xXIAllowEventsReq);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -136,4 +136,3 @@ ProcXIAllowEvents(ClientPtr client)
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,8 @@ SProcXIChangeCursor(ClientPtr client)
|
||||||
return (ProcXIChangeCursor(client));
|
return (ProcXIChangeCursor(client));
|
||||||
}
|
}
|
||||||
|
|
||||||
int ProcXIChangeCursor(ClientPtr client)
|
int
|
||||||
|
ProcXIChangeCursor(ClientPtr client)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
WindowPtr pWin = NULL;
|
WindowPtr pWin = NULL;
|
||||||
|
|
@ -82,22 +83,19 @@ int ProcXIChangeCursor(ClientPtr client)
|
||||||
if (!IsMaster(pDev) || !IsPointerDevice(pDev))
|
if (!IsMaster(pDev) || !IsPointerDevice(pDev))
|
||||||
return BadDevice;
|
return BadDevice;
|
||||||
|
|
||||||
if (stuff->win != None)
|
if (stuff->win != None) {
|
||||||
{
|
|
||||||
rc = dixLookupWindow(&pWin, stuff->win, client, DixSetAttrAccess);
|
rc = dixLookupWindow(&pWin, stuff->win, client, DixSetAttrAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stuff->cursor == None)
|
if (stuff->cursor == None) {
|
||||||
{
|
|
||||||
if (pWin == pWin->drawable.pScreen->root)
|
if (pWin == pWin->drawable.pScreen->root)
|
||||||
pCursor = rootCursor;
|
pCursor = rootCursor;
|
||||||
else
|
else
|
||||||
pCursor = (CursorPtr) None;
|
pCursor = (CursorPtr) None;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
rc = dixLookupResourceByType((pointer *) &pCursor, stuff->cursor,
|
rc = dixLookupResourceByType((pointer *) &pCursor, stuff->cursor,
|
||||||
RT_CURSOR, client, DixUseAccess);
|
RT_CURSOR, client, DixUseAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
|
|
@ -108,4 +106,3 @@ int ProcXIChangeCursor(ClientPtr client)
|
||||||
|
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,6 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
#ifdef HAVE_DIX_CONFIG_H
|
||||||
#include <dix-config.h>
|
#include <dix-config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -57,7 +56,8 @@
|
||||||
/**
|
/**
|
||||||
* Send the current state of the device hierarchy to all clients.
|
* Send the current state of the device hierarchy to all clients.
|
||||||
*/
|
*/
|
||||||
void XISendDeviceHierarchyEvent(int flags[MAXDEVICES])
|
void
|
||||||
|
XISendDeviceHierarchyEvent(int flags[MAXDEVICES])
|
||||||
{
|
{
|
||||||
xXIHierarchyEvent *ev;
|
xXIHierarchyEvent *ev;
|
||||||
xXIHierarchyInfo *info;
|
xXIHierarchyInfo *info;
|
||||||
|
|
@ -80,8 +80,7 @@ void XISendDeviceHierarchyEvent(int flags[MAXDEVICES])
|
||||||
ev->num_info = inputInfo.numDevices;
|
ev->num_info = inputInfo.numDevices;
|
||||||
|
|
||||||
info = (xXIHierarchyInfo *) & ev[1];
|
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->deviceid = dev->id;
|
||||||
info->enabled = dev->enabled;
|
info->enabled = dev->enabled;
|
||||||
info->use = GetDeviceUse(dev, &info->attachment);
|
info->use = GetDeviceUse(dev, &info->attachment);
|
||||||
|
|
@ -89,8 +88,7 @@ void XISendDeviceHierarchyEvent(int flags[MAXDEVICES])
|
||||||
ev->flags |= info->flags;
|
ev->flags |= info->flags;
|
||||||
info++;
|
info++;
|
||||||
}
|
}
|
||||||
for (dev = inputInfo.off_devices; dev; dev = dev->next)
|
for (dev = inputInfo.off_devices; dev; dev = dev->next) {
|
||||||
{
|
|
||||||
info->deviceid = dev->id;
|
info->deviceid = dev->id;
|
||||||
info->enabled = dev->enabled;
|
info->enabled = dev->enabled;
|
||||||
info->use = GetDeviceUse(dev, &info->attachment);
|
info->use = GetDeviceUse(dev, &info->attachment);
|
||||||
|
|
@ -99,11 +97,8 @@ void XISendDeviceHierarchyEvent(int flags[MAXDEVICES])
|
||||||
info++;
|
info++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < MAXDEVICES; i++) {
|
||||||
for (i = 0; i < MAXDEVICES; i++)
|
if (flags[i] & (XIMasterRemoved | XISlaveRemoved)) {
|
||||||
{
|
|
||||||
if (flags[i] & (XIMasterRemoved | XISlaveRemoved))
|
|
||||||
{
|
|
||||||
info->deviceid = i;
|
info->deviceid = i;
|
||||||
info->enabled = FALSE;
|
info->enabled = FALSE;
|
||||||
info->flags = flags[i];
|
info->flags = flags[i];
|
||||||
|
|
@ -119,11 +114,11 @@ void XISendDeviceHierarchyEvent(int flags[MAXDEVICES])
|
||||||
memset(&dummyDev, 0, sizeof(dummyDev));
|
memset(&dummyDev, 0, sizeof(dummyDev));
|
||||||
dummyDev.id = XIAllDevices;
|
dummyDev.id = XIAllDevices;
|
||||||
dummyDev.type = SLAVE;
|
dummyDev.type = SLAVE;
|
||||||
SendEventToAllWindows(&dummyDev, (XI_HierarchyChangedMask >> 8), (xEvent*)ev, 1);
|
SendEventToAllWindows(&dummyDev, (XI_HierarchyChangedMask >> 8),
|
||||||
|
(xEvent *) ev, 1);
|
||||||
free(ev);
|
free(ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
*
|
*
|
||||||
* This procedure allows a client to change the device hierarchy through
|
* 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);
|
REQUEST(xXIChangeHierarchyReq);
|
||||||
swaps(&stuff->length);
|
swaps(&stuff->length);
|
||||||
|
|
@ -158,8 +154,7 @@ add_master(ClientPtr client, xXIAddMasterInfo *c, int flags[MAXDEVICES])
|
||||||
|
|
||||||
/* Allocate virtual slave devices for xtest events */
|
/* Allocate virtual slave devices for xtest events */
|
||||||
rc = AllocXTestDevice(client, name, &XTestptr, &XTestkeybd, ptr, keybd);
|
rc = AllocXTestDevice(client, name, &XTestptr, &XTestkeybd, ptr, keybd);
|
||||||
if (rc != Success)
|
if (rc != Success) {
|
||||||
{
|
|
||||||
DeleteInputDeviceRequest(ptr);
|
DeleteInputDeviceRequest(ptr);
|
||||||
DeleteInputDeviceRequest(keybd);
|
DeleteInputDeviceRequest(keybd);
|
||||||
goto unwind;
|
goto unwind;
|
||||||
|
|
@ -175,8 +170,7 @@ add_master(ClientPtr client, xXIAddMasterInfo *c, int flags[MAXDEVICES])
|
||||||
flags[XTestptr->id] |= XISlaveAdded;
|
flags[XTestptr->id] |= XISlaveAdded;
|
||||||
flags[XTestkeybd->id] |= XISlaveAdded;
|
flags[XTestkeybd->id] |= XISlaveAdded;
|
||||||
|
|
||||||
if (c->enable)
|
if (c->enable) {
|
||||||
{
|
|
||||||
EnableDevice(ptr, FALSE);
|
EnableDevice(ptr, FALSE);
|
||||||
EnableDevice(keybd, FALSE);
|
EnableDevice(keybd, FALSE);
|
||||||
flags[ptr->id] |= XIDeviceEnabled;
|
flags[ptr->id] |= XIDeviceEnabled;
|
||||||
|
|
@ -205,44 +199,39 @@ disable_clientpointer(DeviceIntPtr dev)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < currentMaxClients; i++)
|
for (i = 0; i < currentMaxClients; i++) {
|
||||||
{
|
|
||||||
ClientPtr client = clients[i];
|
ClientPtr client = clients[i];
|
||||||
|
|
||||||
if (client && client->clientPtr == dev)
|
if (client && client->clientPtr == dev)
|
||||||
client->clientPtr = NULL;
|
client->clientPtr = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
remove_master(ClientPtr client, xXIRemoveMasterInfo *r,
|
remove_master(ClientPtr client, xXIRemoveMasterInfo * r, int flags[MAXDEVICES])
|
||||||
int flags[MAXDEVICES])
|
|
||||||
{
|
{
|
||||||
DeviceIntPtr ptr, keybd, XTestptr, XTestkeybd;
|
DeviceIntPtr ptr, keybd, XTestptr, XTestkeybd;
|
||||||
int rc = Success;
|
int rc = Success;
|
||||||
|
|
||||||
if (r->return_mode != XIAttachToMaster &&
|
if (r->return_mode != XIAttachToMaster && r->return_mode != XIFloating)
|
||||||
r->return_mode != XIFloating)
|
|
||||||
return BadValue;
|
return BadValue;
|
||||||
|
|
||||||
rc = dixLookupDevice(&ptr, r->deviceid, client, DixDestroyAccess);
|
rc = dixLookupDevice(&ptr, r->deviceid, client, DixDestroyAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
goto unwind;
|
goto unwind;
|
||||||
|
|
||||||
if (!IsMaster(ptr))
|
if (!IsMaster(ptr)) {
|
||||||
{
|
|
||||||
client->errorValue = r->deviceid;
|
client->errorValue = r->deviceid;
|
||||||
rc = BadDevice;
|
rc = BadDevice;
|
||||||
goto unwind;
|
goto unwind;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX: For now, don't allow removal of VCP, VCK */
|
/* 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;
|
rc = BadDevice;
|
||||||
goto unwind;
|
goto unwind;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ptr = GetMaster(ptr, MASTER_POINTER);
|
ptr = GetMaster(ptr, MASTER_POINTER);
|
||||||
rc = dixLookupDevice(&ptr, ptr->id, client, DixDestroyAccess);
|
rc = dixLookupDevice(&ptr, ptr->id, client, DixDestroyAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
|
|
@ -258,8 +247,7 @@ remove_master(ClientPtr client, xXIRemoveMasterInfo *r,
|
||||||
goto unwind;
|
goto unwind;
|
||||||
|
|
||||||
XTestkeybd = GetXTestDevice(keybd);
|
XTestkeybd = GetXTestDevice(keybd);
|
||||||
rc = dixLookupDevice(&XTestkeybd, XTestkeybd->id, client,
|
rc = dixLookupDevice(&XTestkeybd, XTestkeybd->id, client, DixDestroyAccess);
|
||||||
DixDestroyAccess);
|
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
goto unwind;
|
goto unwind;
|
||||||
|
|
||||||
|
|
@ -267,18 +255,14 @@ remove_master(ClientPtr client, xXIRemoveMasterInfo *r,
|
||||||
|
|
||||||
/* Disabling sends the devices floating, reattach them if
|
/* Disabling sends the devices floating, reattach them if
|
||||||
* desired. */
|
* desired. */
|
||||||
if (r->return_mode == XIAttachToMaster)
|
if (r->return_mode == XIAttachToMaster) {
|
||||||
{
|
DeviceIntPtr attached, newptr, newkeybd;
|
||||||
DeviceIntPtr attached,
|
|
||||||
newptr,
|
|
||||||
newkeybd;
|
|
||||||
|
|
||||||
rc = dixLookupDevice(&newptr, r->return_pointer, client, DixAddAccess);
|
rc = dixLookupDevice(&newptr, r->return_pointer, client, DixAddAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
goto unwind;
|
goto unwind;
|
||||||
|
|
||||||
if (!IsMaster(newptr))
|
if (!IsMaster(newptr)) {
|
||||||
{
|
|
||||||
client->errorValue = r->return_pointer;
|
client->errorValue = r->return_pointer;
|
||||||
rc = BadDevice;
|
rc = BadDevice;
|
||||||
goto unwind;
|
goto unwind;
|
||||||
|
|
@ -289,23 +273,19 @@ remove_master(ClientPtr client, xXIRemoveMasterInfo *r,
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
goto unwind;
|
goto unwind;
|
||||||
|
|
||||||
if (!IsMaster(newkeybd))
|
if (!IsMaster(newkeybd)) {
|
||||||
{
|
|
||||||
client->errorValue = r->return_keyboard;
|
client->errorValue = r->return_keyboard;
|
||||||
rc = BadDevice;
|
rc = BadDevice;
|
||||||
goto unwind;
|
goto unwind;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (attached = inputInfo.devices; attached; attached = attached->next)
|
for (attached = inputInfo.devices; attached; attached = attached->next) {
|
||||||
{
|
|
||||||
if (!IsMaster(attached)) {
|
if (!IsMaster(attached)) {
|
||||||
if (GetMaster(attached, MASTER_ATTACHED) == ptr)
|
if (GetMaster(attached, MASTER_ATTACHED) == ptr) {
|
||||||
{
|
|
||||||
AttachDevice(client, attached, newptr);
|
AttachDevice(client, attached, newptr);
|
||||||
flags[attached->id] |= XISlaveAttached;
|
flags[attached->id] |= XISlaveAttached;
|
||||||
}
|
}
|
||||||
if (GetMaster(attached, MASTER_ATTACHED) == keybd)
|
if (GetMaster(attached, MASTER_ATTACHED) == keybd) {
|
||||||
{
|
|
||||||
AttachDevice(client, attached, newkeybd);
|
AttachDevice(client, attached, newkeybd);
|
||||||
flags[attached->id] |= XISlaveAttached;
|
flags[attached->id] |= XISlaveAttached;
|
||||||
}
|
}
|
||||||
|
|
@ -353,16 +333,14 @@ detach_slave(ClientPtr client, xXIDetachSlaveInfo *c, int flags[MAXDEVICES])
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
goto unwind;
|
goto unwind;
|
||||||
|
|
||||||
if (IsMaster(dev))
|
if (IsMaster(dev)) {
|
||||||
{
|
|
||||||
client->errorValue = c->deviceid;
|
client->errorValue = c->deviceid;
|
||||||
rc = BadDevice;
|
rc = BadDevice;
|
||||||
goto unwind;
|
goto unwind;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Don't allow changes to XTest Devices, these are fixed */
|
/* Don't allow changes to XTest Devices, these are fixed */
|
||||||
if (IsXTestDevice(dev, NULL))
|
if (IsXTestDevice(dev, NULL)) {
|
||||||
{
|
|
||||||
client->errorValue = c->deviceid;
|
client->errorValue = c->deviceid;
|
||||||
rc = BadDevice;
|
rc = BadDevice;
|
||||||
goto unwind;
|
goto unwind;
|
||||||
|
|
@ -377,8 +355,7 @@ unwind:
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
attach_slave(ClientPtr client, xXIAttachSlaveInfo *c,
|
attach_slave(ClientPtr client, xXIAttachSlaveInfo * c, int flags[MAXDEVICES])
|
||||||
int flags[MAXDEVICES])
|
|
||||||
{
|
{
|
||||||
DeviceIntPtr dev;
|
DeviceIntPtr dev;
|
||||||
DeviceIntPtr newmaster;
|
DeviceIntPtr newmaster;
|
||||||
|
|
@ -388,16 +365,14 @@ attach_slave(ClientPtr client, xXIAttachSlaveInfo *c,
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
goto unwind;
|
goto unwind;
|
||||||
|
|
||||||
if (IsMaster(dev))
|
if (IsMaster(dev)) {
|
||||||
{
|
|
||||||
client->errorValue = c->deviceid;
|
client->errorValue = c->deviceid;
|
||||||
rc = BadDevice;
|
rc = BadDevice;
|
||||||
goto unwind;
|
goto unwind;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Don't allow changes to XTest Devices, these are fixed */
|
/* Don't allow changes to XTest Devices, these are fixed */
|
||||||
if (IsXTestDevice(dev, NULL))
|
if (IsXTestDevice(dev, NULL)) {
|
||||||
{
|
|
||||||
client->errorValue = c->deviceid;
|
client->errorValue = c->deviceid;
|
||||||
rc = BadDevice;
|
rc = BadDevice;
|
||||||
goto unwind;
|
goto unwind;
|
||||||
|
|
@ -406,16 +381,14 @@ attach_slave(ClientPtr client, xXIAttachSlaveInfo *c,
|
||||||
rc = dixLookupDevice(&newmaster, c->new_master, client, DixAddAccess);
|
rc = dixLookupDevice(&newmaster, c->new_master, client, DixAddAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
goto unwind;
|
goto unwind;
|
||||||
if (!IsMaster(newmaster))
|
if (!IsMaster(newmaster)) {
|
||||||
{
|
|
||||||
client->errorValue = c->new_master;
|
client->errorValue = c->new_master;
|
||||||
rc = BadDevice;
|
rc = BadDevice;
|
||||||
goto unwind;
|
goto unwind;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!((IsPointerDevice(newmaster) && IsPointerDevice(dev)) ||
|
if (!((IsPointerDevice(newmaster) && IsPointerDevice(dev)) ||
|
||||||
(IsKeyboardDevice(newmaster) && IsKeyboardDevice(dev))))
|
(IsKeyboardDevice(newmaster) && IsKeyboardDevice(dev)))) {
|
||||||
{
|
|
||||||
rc = BadDevice;
|
rc = BadDevice;
|
||||||
goto unwind;
|
goto unwind;
|
||||||
}
|
}
|
||||||
|
|
@ -428,8 +401,6 @@ unwind:
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define SWAPIF(cmd) if (client->swapped) { cmd; }
|
#define SWAPIF(cmd) if (client->swapped) { cmd; }
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
@ -447,8 +418,7 @@ ProcXIChangeHierarchy(ClientPtr client)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
any = (xXIAnyHierarchyChangeInfo *) & stuff[1];
|
any = (xXIAnyHierarchyChangeInfo *) & stuff[1];
|
||||||
while(stuff->num_changes--)
|
while (stuff->num_changes--) {
|
||||||
{
|
|
||||||
SWAPIF(swaps(&any->type));
|
SWAPIF(swaps(&any->type));
|
||||||
SWAPIF(swaps(&any->length));
|
SWAPIF(swaps(&any->length));
|
||||||
|
|
||||||
|
|
@ -456,11 +426,11 @@ ProcXIChangeHierarchy(ClientPtr client)
|
||||||
if ((stuff->length * 4) < required_len)
|
if ((stuff->length * 4) < required_len)
|
||||||
return BadLength;
|
return BadLength;
|
||||||
|
|
||||||
switch(any->type)
|
switch (any->type) {
|
||||||
{
|
|
||||||
case XIAddMaster:
|
case XIAddMaster:
|
||||||
{
|
{
|
||||||
xXIAddMasterInfo *c = (xXIAddMasterInfo *) any;
|
xXIAddMasterInfo *c = (xXIAddMasterInfo *) any;
|
||||||
|
|
||||||
SWAPIF(swaps(&c->name_len));
|
SWAPIF(swaps(&c->name_len));
|
||||||
|
|
||||||
rc = add_master(client, c, flags);
|
rc = add_master(client, c, flags);
|
||||||
|
|
@ -505,4 +475,3 @@ unwind:
|
||||||
XISendDeviceHierarchyEvent(flags);
|
XISendDeviceHierarchyEvent(flags);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -56,22 +56,23 @@ SProcXIGetClientPointer(ClientPtr client)
|
||||||
return ProcXIGetClientPointer(client);
|
return ProcXIGetClientPointer(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ProcXIGetClientPointer(ClientPtr client)
|
int
|
||||||
|
ProcXIGetClientPointer(ClientPtr client)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
ClientPtr winclient;
|
ClientPtr winclient;
|
||||||
xXIGetClientPointerReply rep;
|
xXIGetClientPointerReply rep;
|
||||||
|
|
||||||
REQUEST(xXIGetClientPointerReq);
|
REQUEST(xXIGetClientPointerReq);
|
||||||
REQUEST_SIZE_MATCH(xXIGetClientPointerReq);
|
REQUEST_SIZE_MATCH(xXIGetClientPointerReq);
|
||||||
|
|
||||||
if (stuff->win != None)
|
if (stuff->win != None) {
|
||||||
{
|
rc = dixLookupClient(&winclient, stuff->win, client, DixGetAttrAccess);
|
||||||
rc = dixLookupClient(&winclient, stuff->win, client,
|
|
||||||
DixGetAttrAccess);
|
|
||||||
|
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return BadWindow;
|
return BadWindow;
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
winclient = client;
|
winclient = client;
|
||||||
|
|
||||||
rep.repType = X_Reply;
|
rep.repType = X_Reply;
|
||||||
|
|
@ -101,4 +102,3 @@ SRepXIGetClientPointer(ClientPtr client, int size,
|
||||||
swaps(&rep->deviceid);
|
swaps(&rep->deviceid);
|
||||||
WriteToClient(client, size, (char *) rep);
|
WriteToClient(client, size, (char *) rep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -88,17 +88,15 @@ ProcXIGrabDevice(ClientPtr client)
|
||||||
|
|
||||||
mask_len = min(xi2mask_mask_size(mask.xi2mask), stuff->mask_len * 4);
|
mask_len = min(xi2mask_mask_size(mask.xi2mask), stuff->mask_len * 4);
|
||||||
/* FIXME: I think the old code was broken here */
|
/* 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,
|
ret = GrabDevice(client, dev, stuff->grab_mode,
|
||||||
stuff->paired_device_mode,
|
stuff->paired_device_mode,
|
||||||
stuff->grab_window,
|
stuff->grab_window,
|
||||||
stuff->owner_events,
|
stuff->owner_events,
|
||||||
stuff->time,
|
stuff->time,
|
||||||
&mask,
|
&mask, XI2, stuff->cursor, None /* confineTo */ ,
|
||||||
XI2,
|
|
||||||
stuff->cursor,
|
|
||||||
None /* confineTo */,
|
|
||||||
&status);
|
&status);
|
||||||
|
|
||||||
xi2mask_free(&mask.xi2mask);
|
xi2mask_free(&mask.xi2mask);
|
||||||
|
|
@ -112,7 +110,6 @@ ProcXIGrabDevice(ClientPtr client)
|
||||||
rep.sequenceNumber = client->sequence;
|
rep.sequenceNumber = client->sequence;
|
||||||
rep.status = status;
|
rep.status = status;
|
||||||
|
|
||||||
|
|
||||||
WriteReplyToClient(client, sizeof(rep), &rep);
|
WriteReplyToClient(client, sizeof(rep), &rep);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
@ -154,7 +151,8 @@ ProcXIUngrabDevice(ClientPtr client)
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SRepXIGrabDevice(ClientPtr client, int size, xXIGrabDeviceReply * rep)
|
void
|
||||||
|
SRepXIGrabDevice(ClientPtr client, int size, xXIGrabDeviceReply * rep)
|
||||||
{
|
{
|
||||||
swaps(&rep->sequenceNumber);
|
swaps(&rep->sequenceNumber);
|
||||||
swapl(&rep->length);
|
swapl(&rep->length);
|
||||||
|
|
|
||||||
|
|
@ -65,8 +65,7 @@ SProcXIPassiveGrabDevice(ClientPtr client)
|
||||||
|
|
||||||
mods = (xXIModifierInfo *) & stuff[1];
|
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->base_mods);
|
||||||
swapl(&mods->latched_mods);
|
swapl(&mods->latched_mods);
|
||||||
swapl(&mods->locked_mods);
|
swapl(&mods->locked_mods);
|
||||||
|
|
@ -95,11 +94,9 @@ ProcXIPassiveGrabDevice(ClientPtr client)
|
||||||
dev = inputInfo.all_devices;
|
dev = inputInfo.all_devices;
|
||||||
else if (stuff->deviceid == XIAllMasterDevices)
|
else if (stuff->deviceid == XIAllMasterDevices)
|
||||||
dev = inputInfo.all_master_devices;
|
dev = inputInfo.all_master_devices;
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
ret = dixLookupDevice(&dev, stuff->deviceid, client, DixGrabAccess);
|
ret = dixLookupDevice(&dev, stuff->deviceid, client, DixGrabAccess);
|
||||||
if (ret != Success)
|
if (ret != Success) {
|
||||||
{
|
|
||||||
client->errorValue = stuff->deviceid;
|
client->errorValue = stuff->deviceid;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
@ -109,24 +106,21 @@ ProcXIPassiveGrabDevice(ClientPtr client)
|
||||||
stuff->grab_type != XIGrabtypeKeycode &&
|
stuff->grab_type != XIGrabtypeKeycode &&
|
||||||
stuff->grab_type != XIGrabtypeEnter &&
|
stuff->grab_type != XIGrabtypeEnter &&
|
||||||
stuff->grab_type != XIGrabtypeFocusIn &&
|
stuff->grab_type != XIGrabtypeFocusIn &&
|
||||||
stuff->grab_type != XIGrabtypeTouchBegin)
|
stuff->grab_type != XIGrabtypeTouchBegin) {
|
||||||
{
|
|
||||||
client->errorValue = stuff->grab_type;
|
client->errorValue = stuff->grab_type;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((stuff->grab_type == XIGrabtypeEnter ||
|
if ((stuff->grab_type == XIGrabtypeEnter ||
|
||||||
stuff->grab_type == XIGrabtypeFocusIn ||
|
stuff->grab_type == XIGrabtypeFocusIn ||
|
||||||
stuff->grab_type == XIGrabtypeTouchBegin) && stuff->detail != 0)
|
stuff->grab_type == XIGrabtypeTouchBegin) && stuff->detail != 0) {
|
||||||
{
|
|
||||||
client->errorValue = stuff->detail;
|
client->errorValue = stuff->detail;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stuff->grab_type == XIGrabtypeTouchBegin &&
|
if (stuff->grab_type == XIGrabtypeTouchBegin &&
|
||||||
(stuff->grab_mode != XIGrabModeTouch ||
|
(stuff->grab_mode != XIGrabModeTouch ||
|
||||||
stuff->paired_device_mode != GrabModeAsync))
|
stuff->paired_device_mode != GrabModeAsync)) {
|
||||||
{
|
|
||||||
client->errorValue = stuff->grab_mode;
|
client->errorValue = stuff->grab_mode;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
|
@ -140,7 +134,8 @@ ProcXIPassiveGrabDevice(ClientPtr client)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
|
||||||
mask_len = min(xi2mask_mask_size(mask.xi2mask), stuff->mask_len * 4);
|
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_Reply;
|
||||||
rep.RepType = X_XIPassiveGrabDevice;
|
rep.RepType = X_XIPassiveGrabDevice;
|
||||||
|
|
@ -157,23 +152,24 @@ ProcXIPassiveGrabDevice(ClientPtr client)
|
||||||
if (IsKeyboardDevice(dev)) {
|
if (IsKeyboardDevice(dev)) {
|
||||||
param.this_device_mode = stuff->grab_mode;
|
param.this_device_mode = stuff->grab_mode;
|
||||||
param.other_devices_mode = stuff->paired_device_mode;
|
param.other_devices_mode = stuff->paired_device_mode;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
param.this_device_mode = stuff->paired_device_mode;
|
param.this_device_mode = stuff->paired_device_mode;
|
||||||
param.other_devices_mode = stuff->grab_mode;
|
param.other_devices_mode = stuff->grab_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stuff->cursor != None)
|
if (stuff->cursor != None) {
|
||||||
{
|
|
||||||
ret = dixLookupResourceByType(&tmp, stuff->cursor,
|
ret = dixLookupResourceByType(&tmp, stuff->cursor,
|
||||||
RT_CURSOR, client, DixUseAccess);
|
RT_CURSOR, client, DixUseAccess);
|
||||||
if (ret != Success)
|
if (ret != Success) {
|
||||||
{
|
|
||||||
client->errorValue = stuff->cursor;
|
client->errorValue = stuff->cursor;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = dixLookupWindow((WindowPtr*)&tmp, stuff->grab_window, client, DixSetAttrAccess);
|
ret =
|
||||||
|
dixLookupWindow((WindowPtr *) &tmp, stuff->grab_window, client,
|
||||||
|
DixSetAttrAccess);
|
||||||
if (ret != Success)
|
if (ret != Success)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
|
@ -182,7 +178,8 @@ ProcXIPassiveGrabDevice(ClientPtr client)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
modifiers = (uint32_t *) & stuff[1] + stuff->mask_len;
|
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) {
|
if (!modifiers_failed) {
|
||||||
ret = BadAlloc;
|
ret = BadAlloc;
|
||||||
goto out;
|
goto out;
|
||||||
|
|
@ -190,13 +187,11 @@ ProcXIPassiveGrabDevice(ClientPtr client)
|
||||||
|
|
||||||
mod_dev = (IsFloating(dev)) ? dev : GetMaster(dev, MASTER_KEYBOARD);
|
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;
|
uint8_t status = Success;
|
||||||
|
|
||||||
param.modifiers = *modifiers;
|
param.modifiers = *modifiers;
|
||||||
switch(stuff->grab_type)
|
switch (stuff->grab_type) {
|
||||||
{
|
|
||||||
case XIGrabtypeButton:
|
case XIGrabtypeButton:
|
||||||
status = GrabButton(client, dev, mod_dev, stuff->detail,
|
status = GrabButton(client, dev, mod_dev, stuff->detail,
|
||||||
¶m, XI2, &mask);
|
¶m, XI2, &mask);
|
||||||
|
|
@ -207,16 +202,14 @@ ProcXIPassiveGrabDevice(ClientPtr client)
|
||||||
break;
|
break;
|
||||||
case XIGrabtypeEnter:
|
case XIGrabtypeEnter:
|
||||||
case XIGrabtypeFocusIn:
|
case XIGrabtypeFocusIn:
|
||||||
status = GrabWindow(client, dev, stuff->grab_type,
|
status = GrabWindow(client, dev, stuff->grab_type, ¶m, &mask);
|
||||||
¶m, &mask);
|
|
||||||
break;
|
break;
|
||||||
case XIGrabtypeTouchBegin:
|
case XIGrabtypeTouchBegin:
|
||||||
status = GrabTouch(client, dev, mod_dev, ¶m, &mask);
|
status = GrabTouch(client, dev, mod_dev, ¶m, &mask);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status != GrabSuccess)
|
if (status != GrabSuccess) {
|
||||||
{
|
|
||||||
xXIGrabModifierInfo *info = modifiers_failed + rep.num_modifiers;
|
xXIGrabModifierInfo *info = modifiers_failed + rep.num_modifiers;
|
||||||
|
|
||||||
info->status = status;
|
info->status = status;
|
||||||
|
|
@ -288,8 +281,7 @@ ProcXIPassiveUngrabDevice(ClientPtr client)
|
||||||
dev = inputInfo.all_devices;
|
dev = inputInfo.all_devices;
|
||||||
else if (stuff->deviceid == XIAllMasterDevices)
|
else if (stuff->deviceid == XIAllMasterDevices)
|
||||||
dev = inputInfo.all_master_devices;
|
dev = inputInfo.all_master_devices;
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGrabAccess);
|
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGrabAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
@ -298,15 +290,13 @@ ProcXIPassiveUngrabDevice(ClientPtr client)
|
||||||
if (stuff->grab_type != XIGrabtypeButton &&
|
if (stuff->grab_type != XIGrabtypeButton &&
|
||||||
stuff->grab_type != XIGrabtypeKeycode &&
|
stuff->grab_type != XIGrabtypeKeycode &&
|
||||||
stuff->grab_type != XIGrabtypeEnter &&
|
stuff->grab_type != XIGrabtypeEnter &&
|
||||||
stuff->grab_type != XIGrabtypeFocusIn)
|
stuff->grab_type != XIGrabtypeFocusIn) {
|
||||||
{
|
|
||||||
client->errorValue = stuff->grab_type;
|
client->errorValue = stuff->grab_type;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((stuff->grab_type == XIGrabtypeEnter ||
|
if ((stuff->grab_type == XIGrabtypeEnter ||
|
||||||
stuff->grab_type == XIGrabtypeFocusIn) && stuff->detail != 0)
|
stuff->grab_type == XIGrabtypeFocusIn) && stuff->detail != 0) {
|
||||||
{
|
|
||||||
client->errorValue = stuff->detail;
|
client->errorValue = stuff->detail;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
|
@ -317,7 +307,6 @@ ProcXIPassiveUngrabDevice(ClientPtr client)
|
||||||
|
|
||||||
mod_dev = (IsFloating(dev)) ? dev : GetMaster(dev, MASTER_KEYBOARD);
|
mod_dev = (IsFloating(dev)) ? dev : GetMaster(dev, MASTER_KEYBOARD);
|
||||||
|
|
||||||
|
|
||||||
tempGrab = AllocGrab();
|
tempGrab = AllocGrab();
|
||||||
if (!tempGrab)
|
if (!tempGrab)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
|
@ -325,12 +314,19 @@ ProcXIPassiveUngrabDevice(ClientPtr client)
|
||||||
tempGrab->resource = client->clientAsMask;
|
tempGrab->resource = client->clientAsMask;
|
||||||
tempGrab->device = dev;
|
tempGrab->device = dev;
|
||||||
tempGrab->window = win;
|
tempGrab->window = win;
|
||||||
switch(stuff->grab_type)
|
switch (stuff->grab_type) {
|
||||||
{
|
case XIGrabtypeButton:
|
||||||
case XIGrabtypeButton: tempGrab->type = XI_ButtonPress; break;
|
tempGrab->type = XI_ButtonPress;
|
||||||
case XIGrabtypeKeycode: tempGrab->type = XI_KeyPress; break;
|
break;
|
||||||
case XIGrabtypeEnter: tempGrab->type = XI_Enter; break;
|
case XIGrabtypeKeycode:
|
||||||
case XIGrabtypeFocusIn: tempGrab->type = XI_FocusIn; break;
|
tempGrab->type = XI_KeyPress;
|
||||||
|
break;
|
||||||
|
case XIGrabtypeEnter:
|
||||||
|
tempGrab->type = XI_Enter;
|
||||||
|
break;
|
||||||
|
case XIGrabtypeFocusIn:
|
||||||
|
tempGrab->type = XI_FocusIn;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
tempGrab->grabtype = XI2;
|
tempGrab->grabtype = XI2;
|
||||||
tempGrab->modifierDevice = mod_dev;
|
tempGrab->modifierDevice = mod_dev;
|
||||||
|
|
@ -340,8 +336,7 @@ ProcXIPassiveUngrabDevice(ClientPtr client)
|
||||||
|
|
||||||
modifiers = (uint32_t *) & stuff[1];
|
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;
|
tempGrab->modifiersDetail.exact = *modifiers;
|
||||||
DeletePassiveGrabFromList(tempGrab);
|
DeletePassiveGrabFromList(tempGrab);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,8 @@
|
||||||
|
|
||||||
int SProcXIPassiveUngrabDevice(ClientPtr client);
|
int SProcXIPassiveUngrabDevice(ClientPtr client);
|
||||||
int ProcXIPassiveUngrabDevice(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 ProcXIPassiveGrabDevice(ClientPtr client);
|
||||||
int SProcXIPassiveGrabDevice(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.
|
* Properties used or alloced from inside the server.
|
||||||
*/
|
*/
|
||||||
static struct dev_properties
|
static struct dev_properties {
|
||||||
{
|
|
||||||
Atom type;
|
Atom type;
|
||||||
const char *name;
|
const char *name;
|
||||||
} dev_properties[] = {
|
} dev_properties[] = {
|
||||||
{0, XI_PROP_ENABLED},
|
{
|
||||||
{0, XI_PROP_XTEST_DEVICE},
|
0, XI_PROP_ENABLED}, {
|
||||||
|
0, XI_PROP_XTEST_DEVICE}, {
|
||||||
{0, XATOM_FLOAT},
|
0, XATOM_FLOAT}, {
|
||||||
|
0, ACCEL_PROP_PROFILE_NUMBER}, {
|
||||||
{0, ACCEL_PROP_PROFILE_NUMBER},
|
0, ACCEL_PROP_CONSTANT_DECELERATION}, {
|
||||||
{0, ACCEL_PROP_CONSTANT_DECELERATION},
|
0, ACCEL_PROP_ADAPTIVE_DECELERATION}, {
|
||||||
{0, ACCEL_PROP_ADAPTIVE_DECELERATION},
|
0, ACCEL_PROP_VELOCITY_SCALING}, {
|
||||||
{0, ACCEL_PROP_VELOCITY_SCALING},
|
0, AXIS_LABEL_PROP}, {
|
||||||
|
0, AXIS_LABEL_PROP_REL_X}, {
|
||||||
{0, AXIS_LABEL_PROP},
|
0, AXIS_LABEL_PROP_REL_Y}, {
|
||||||
{0, AXIS_LABEL_PROP_REL_X},
|
0, AXIS_LABEL_PROP_REL_Z}, {
|
||||||
{0, AXIS_LABEL_PROP_REL_Y},
|
0, AXIS_LABEL_PROP_REL_RX}, {
|
||||||
{0, AXIS_LABEL_PROP_REL_Z},
|
0, AXIS_LABEL_PROP_REL_RY}, {
|
||||||
{0, AXIS_LABEL_PROP_REL_RX},
|
0, AXIS_LABEL_PROP_REL_RZ}, {
|
||||||
{0, AXIS_LABEL_PROP_REL_RY},
|
0, AXIS_LABEL_PROP_REL_HWHEEL}, {
|
||||||
{0, AXIS_LABEL_PROP_REL_RZ},
|
0, AXIS_LABEL_PROP_REL_DIAL}, {
|
||||||
{0, AXIS_LABEL_PROP_REL_HWHEEL},
|
0, AXIS_LABEL_PROP_REL_WHEEL}, {
|
||||||
{0, AXIS_LABEL_PROP_REL_DIAL},
|
0, AXIS_LABEL_PROP_REL_MISC}, {
|
||||||
{0, AXIS_LABEL_PROP_REL_WHEEL},
|
0, AXIS_LABEL_PROP_REL_VSCROLL}, {
|
||||||
{0, AXIS_LABEL_PROP_REL_MISC},
|
0, AXIS_LABEL_PROP_REL_HSCROLL}, {
|
||||||
{0, AXIS_LABEL_PROP_REL_VSCROLL},
|
0, AXIS_LABEL_PROP_ABS_X}, {
|
||||||
{0, AXIS_LABEL_PROP_REL_HSCROLL},
|
0, AXIS_LABEL_PROP_ABS_Y}, {
|
||||||
{0, AXIS_LABEL_PROP_ABS_X},
|
0, AXIS_LABEL_PROP_ABS_Z}, {
|
||||||
{0, AXIS_LABEL_PROP_ABS_Y},
|
0, AXIS_LABEL_PROP_ABS_RX}, {
|
||||||
{0, AXIS_LABEL_PROP_ABS_Z},
|
0, AXIS_LABEL_PROP_ABS_RY}, {
|
||||||
{0, AXIS_LABEL_PROP_ABS_RX},
|
0, AXIS_LABEL_PROP_ABS_RZ}, {
|
||||||
{0, AXIS_LABEL_PROP_ABS_RY},
|
0, AXIS_LABEL_PROP_ABS_THROTTLE}, {
|
||||||
{0, AXIS_LABEL_PROP_ABS_RZ},
|
0, AXIS_LABEL_PROP_ABS_RUDDER}, {
|
||||||
{0, AXIS_LABEL_PROP_ABS_THROTTLE},
|
0, AXIS_LABEL_PROP_ABS_WHEEL}, {
|
||||||
{0, AXIS_LABEL_PROP_ABS_RUDDER},
|
0, AXIS_LABEL_PROP_ABS_GAS}, {
|
||||||
{0, AXIS_LABEL_PROP_ABS_WHEEL},
|
0, AXIS_LABEL_PROP_ABS_BRAKE}, {
|
||||||
{0, AXIS_LABEL_PROP_ABS_GAS},
|
0, AXIS_LABEL_PROP_ABS_HAT0X}, {
|
||||||
{0, AXIS_LABEL_PROP_ABS_BRAKE},
|
0, AXIS_LABEL_PROP_ABS_HAT0Y}, {
|
||||||
{0, AXIS_LABEL_PROP_ABS_HAT0X},
|
0, AXIS_LABEL_PROP_ABS_HAT1X}, {
|
||||||
{0, AXIS_LABEL_PROP_ABS_HAT0Y},
|
0, AXIS_LABEL_PROP_ABS_HAT1Y}, {
|
||||||
{0, AXIS_LABEL_PROP_ABS_HAT1X},
|
0, AXIS_LABEL_PROP_ABS_HAT2X}, {
|
||||||
{0, AXIS_LABEL_PROP_ABS_HAT1Y},
|
0, AXIS_LABEL_PROP_ABS_HAT2Y}, {
|
||||||
{0, AXIS_LABEL_PROP_ABS_HAT2X},
|
0, AXIS_LABEL_PROP_ABS_HAT3X}, {
|
||||||
{0, AXIS_LABEL_PROP_ABS_HAT2Y},
|
0, AXIS_LABEL_PROP_ABS_HAT3Y}, {
|
||||||
{0, AXIS_LABEL_PROP_ABS_HAT3X},
|
0, AXIS_LABEL_PROP_ABS_PRESSURE}, {
|
||||||
{0, AXIS_LABEL_PROP_ABS_HAT3Y},
|
0, AXIS_LABEL_PROP_ABS_DISTANCE}, {
|
||||||
{0, AXIS_LABEL_PROP_ABS_PRESSURE},
|
0, AXIS_LABEL_PROP_ABS_TILT_X}, {
|
||||||
{0, AXIS_LABEL_PROP_ABS_DISTANCE},
|
0, AXIS_LABEL_PROP_ABS_TILT_Y}, {
|
||||||
{0, AXIS_LABEL_PROP_ABS_TILT_X},
|
0, AXIS_LABEL_PROP_ABS_TOOL_WIDTH}, {
|
||||||
{0, AXIS_LABEL_PROP_ABS_TILT_Y},
|
0, AXIS_LABEL_PROP_ABS_VOLUME}, {
|
||||||
{0, AXIS_LABEL_PROP_ABS_TOOL_WIDTH},
|
0, AXIS_LABEL_PROP_ABS_MT_TOUCH_MAJOR}, {
|
||||||
{0, AXIS_LABEL_PROP_ABS_VOLUME},
|
0, AXIS_LABEL_PROP_ABS_MT_TOUCH_MINOR}, {
|
||||||
{0, AXIS_LABEL_PROP_ABS_MT_TOUCH_MAJOR},
|
0, AXIS_LABEL_PROP_ABS_MT_WIDTH_MAJOR}, {
|
||||||
{0, AXIS_LABEL_PROP_ABS_MT_TOUCH_MINOR},
|
0, AXIS_LABEL_PROP_ABS_MT_WIDTH_MINOR}, {
|
||||||
{0, AXIS_LABEL_PROP_ABS_MT_WIDTH_MAJOR},
|
0, AXIS_LABEL_PROP_ABS_MT_ORIENTATION}, {
|
||||||
{0, AXIS_LABEL_PROP_ABS_MT_WIDTH_MINOR},
|
0, AXIS_LABEL_PROP_ABS_MT_POSITION_X}, {
|
||||||
{0, AXIS_LABEL_PROP_ABS_MT_ORIENTATION},
|
0, AXIS_LABEL_PROP_ABS_MT_POSITION_Y}, {
|
||||||
{0, AXIS_LABEL_PROP_ABS_MT_POSITION_X},
|
0, AXIS_LABEL_PROP_ABS_MT_TOOL_TYPE}, {
|
||||||
{0, AXIS_LABEL_PROP_ABS_MT_POSITION_Y},
|
0, AXIS_LABEL_PROP_ABS_MT_BLOB_ID}, {
|
||||||
{0, AXIS_LABEL_PROP_ABS_MT_TOOL_TYPE},
|
0, AXIS_LABEL_PROP_ABS_MT_TRACKING_ID}, {
|
||||||
{0, AXIS_LABEL_PROP_ABS_MT_BLOB_ID},
|
0, AXIS_LABEL_PROP_ABS_MT_PRESSURE}, {
|
||||||
{0, AXIS_LABEL_PROP_ABS_MT_TRACKING_ID},
|
0, AXIS_LABEL_PROP_ABS_MISC}, {
|
||||||
{0, AXIS_LABEL_PROP_ABS_MT_PRESSURE},
|
0, BTN_LABEL_PROP}, {
|
||||||
{0, AXIS_LABEL_PROP_ABS_MISC},
|
0, BTN_LABEL_PROP_BTN_UNKNOWN}, {
|
||||||
|
0, BTN_LABEL_PROP_BTN_WHEEL_UP}, {
|
||||||
{0, BTN_LABEL_PROP},
|
0, BTN_LABEL_PROP_BTN_WHEEL_DOWN}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_UNKNOWN},
|
0, BTN_LABEL_PROP_BTN_HWHEEL_LEFT}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_WHEEL_UP},
|
0, BTN_LABEL_PROP_BTN_HWHEEL_RIGHT}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_WHEEL_DOWN},
|
0, BTN_LABEL_PROP_BTN_0}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_HWHEEL_LEFT},
|
0, BTN_LABEL_PROP_BTN_1}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_HWHEEL_RIGHT},
|
0, BTN_LABEL_PROP_BTN_2}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_0},
|
0, BTN_LABEL_PROP_BTN_3}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_1},
|
0, BTN_LABEL_PROP_BTN_4}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_2},
|
0, BTN_LABEL_PROP_BTN_5}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_3},
|
0, BTN_LABEL_PROP_BTN_6}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_4},
|
0, BTN_LABEL_PROP_BTN_7}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_5},
|
0, BTN_LABEL_PROP_BTN_8}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_6},
|
0, BTN_LABEL_PROP_BTN_9}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_7},
|
0, BTN_LABEL_PROP_BTN_LEFT}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_8},
|
0, BTN_LABEL_PROP_BTN_RIGHT}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_9},
|
0, BTN_LABEL_PROP_BTN_MIDDLE}, {
|
||||||
|
0, BTN_LABEL_PROP_BTN_SIDE}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_LEFT},
|
0, BTN_LABEL_PROP_BTN_EXTRA}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_RIGHT},
|
0, BTN_LABEL_PROP_BTN_FORWARD}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_MIDDLE},
|
0, BTN_LABEL_PROP_BTN_BACK}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_SIDE},
|
0, BTN_LABEL_PROP_BTN_TASK}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_EXTRA},
|
0, BTN_LABEL_PROP_BTN_TRIGGER}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_FORWARD},
|
0, BTN_LABEL_PROP_BTN_THUMB}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_BACK},
|
0, BTN_LABEL_PROP_BTN_THUMB2}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_TASK},
|
0, BTN_LABEL_PROP_BTN_TOP}, {
|
||||||
|
0, BTN_LABEL_PROP_BTN_TOP2}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_TRIGGER},
|
0, BTN_LABEL_PROP_BTN_PINKIE}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_THUMB},
|
0, BTN_LABEL_PROP_BTN_BASE}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_THUMB2},
|
0, BTN_LABEL_PROP_BTN_BASE2}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_TOP},
|
0, BTN_LABEL_PROP_BTN_BASE3}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_TOP2},
|
0, BTN_LABEL_PROP_BTN_BASE4}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_PINKIE},
|
0, BTN_LABEL_PROP_BTN_BASE5}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_BASE},
|
0, BTN_LABEL_PROP_BTN_BASE6}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_BASE2},
|
0, BTN_LABEL_PROP_BTN_DEAD}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_BASE3},
|
0, BTN_LABEL_PROP_BTN_A}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_BASE4},
|
0, BTN_LABEL_PROP_BTN_B}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_BASE5},
|
0, BTN_LABEL_PROP_BTN_C}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_BASE6},
|
0, BTN_LABEL_PROP_BTN_X}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_DEAD},
|
0, BTN_LABEL_PROP_BTN_Y}, {
|
||||||
|
0, BTN_LABEL_PROP_BTN_Z}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_A},
|
0, BTN_LABEL_PROP_BTN_TL}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_B},
|
0, BTN_LABEL_PROP_BTN_TR}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_C},
|
0, BTN_LABEL_PROP_BTN_TL2}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_X},
|
0, BTN_LABEL_PROP_BTN_TR2}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_Y},
|
0, BTN_LABEL_PROP_BTN_SELECT}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_Z},
|
0, BTN_LABEL_PROP_BTN_START}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_TL},
|
0, BTN_LABEL_PROP_BTN_MODE}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_TR},
|
0, BTN_LABEL_PROP_BTN_THUMBL}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_TL2},
|
0, BTN_LABEL_PROP_BTN_THUMBR}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_TR2},
|
0, BTN_LABEL_PROP_BTN_TOOL_PEN}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_SELECT},
|
0, BTN_LABEL_PROP_BTN_TOOL_RUBBER}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_START},
|
0, BTN_LABEL_PROP_BTN_TOOL_BRUSH}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_MODE},
|
0, BTN_LABEL_PROP_BTN_TOOL_PENCIL}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_THUMBL},
|
0, BTN_LABEL_PROP_BTN_TOOL_AIRBRUSH}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_THUMBR},
|
0, BTN_LABEL_PROP_BTN_TOOL_FINGER}, {
|
||||||
|
0, BTN_LABEL_PROP_BTN_TOOL_MOUSE}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_TOOL_PEN},
|
0, BTN_LABEL_PROP_BTN_TOOL_LENS}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_TOOL_RUBBER},
|
0, BTN_LABEL_PROP_BTN_TOUCH}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_TOOL_BRUSH},
|
0, BTN_LABEL_PROP_BTN_STYLUS}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_TOOL_PENCIL},
|
0, BTN_LABEL_PROP_BTN_STYLUS2}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_TOOL_AIRBRUSH},
|
0, BTN_LABEL_PROP_BTN_TOOL_DOUBLETAP}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_TOOL_FINGER},
|
0, BTN_LABEL_PROP_BTN_TOOL_TRIPLETAP}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_TOOL_MOUSE},
|
0, BTN_LABEL_PROP_BTN_GEAR_DOWN}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_TOOL_LENS},
|
0, BTN_LABEL_PROP_BTN_GEAR_UP}, {
|
||||||
{0, BTN_LABEL_PROP_BTN_TOUCH},
|
0, XI_PROP_TRANSFORM}
|
||||||
{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 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;
|
devicePropertyNotify event;
|
||||||
xXIPropertyEvent xi2;
|
xXIPropertyEvent xi2;
|
||||||
|
|
@ -205,8 +196,7 @@ static void send_property_event(DeviceIntPtr dev, Atom property, int what)
|
||||||
event.state = state;
|
event.state = state;
|
||||||
event.atom = property;
|
event.atom = property;
|
||||||
event.time = currentTime.milliseconds;
|
event.time = currentTime.milliseconds;
|
||||||
SendEventToAllWindows(dev, DevicePropertyNotifyMask,
|
SendEventToAllWindows(dev, DevicePropertyNotifyMask, (xEvent *) &event, 1);
|
||||||
(xEvent*)&event, 1);
|
|
||||||
|
|
||||||
xi2.type = GenericEvent;
|
xi2.type = GenericEvent;
|
||||||
xi2.extension = IReqCode;
|
xi2.extension = IReqCode;
|
||||||
|
|
@ -220,7 +210,8 @@ static void send_property_event(DeviceIntPtr dev, Atom property, int what)
|
||||||
(xEvent *) &xi2, 1);
|
(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;
|
XIPropertyPtr prop;
|
||||||
Atom *atoms = NULL;
|
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)
|
for (prop = dev->properties.properties; prop; prop = prop->next)
|
||||||
nprops++;
|
nprops++;
|
||||||
if (nprops)
|
if (nprops) {
|
||||||
{
|
|
||||||
Atom *a;
|
Atom *a;
|
||||||
|
|
||||||
atoms = malloc(nprops * sizeof(Atom));
|
atoms = malloc(nprops * sizeof(Atom));
|
||||||
|
|
@ -256,19 +246,16 @@ get_property(ClientPtr client, DeviceIntPtr dev, Atom property, Atom type,
|
||||||
XIPropertyPtr prop;
|
XIPropertyPtr prop;
|
||||||
XIPropertyValuePtr prop_value;
|
XIPropertyValuePtr prop_value;
|
||||||
|
|
||||||
if (!ValidAtom(property))
|
if (!ValidAtom(property)) {
|
||||||
{
|
|
||||||
client->errorValue = property;
|
client->errorValue = property;
|
||||||
return BadAtom;
|
return BadAtom;
|
||||||
}
|
}
|
||||||
if ((delete != xTrue) && (delete != xFalse))
|
if ((delete != xTrue) && (delete != xFalse)) {
|
||||||
{
|
|
||||||
client->errorValue = delete;
|
client->errorValue = delete;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((type != AnyPropertyType) && !ValidAtom(type))
|
if ((type != AnyPropertyType) && !ValidAtom(type)) {
|
||||||
{
|
|
||||||
client->errorValue = type;
|
client->errorValue = type;
|
||||||
return BadAtom;
|
return BadAtom;
|
||||||
}
|
}
|
||||||
|
|
@ -277,8 +264,7 @@ get_property(ClientPtr client, DeviceIntPtr dev, Atom property, Atom type,
|
||||||
if (prop->propertyName == property)
|
if (prop->propertyName == property)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (!prop)
|
if (!prop) {
|
||||||
{
|
|
||||||
*bytes_after = 0;
|
*bytes_after = 0;
|
||||||
*type_return = None;
|
*type_return = None;
|
||||||
*format = 0;
|
*format = 0;
|
||||||
|
|
@ -288,8 +274,7 @@ get_property(ClientPtr client, DeviceIntPtr dev, Atom property, Atom type,
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = XIGetDeviceProperty(dev, property, &prop_value);
|
rc = XIGetDeviceProperty(dev, property, &prop_value);
|
||||||
if (rc != Success)
|
if (rc != Success) {
|
||||||
{
|
|
||||||
client->errorValue = property;
|
client->errorValue = property;
|
||||||
return rc;
|
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
|
/* If the request type and actual type don't match. Return the
|
||||||
property information, but not the data. */
|
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;
|
*bytes_after = prop_value->size;
|
||||||
*format = prop_value->format;
|
*format = prop_value->format;
|
||||||
*length_return = 0;
|
*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
|
/* If offset is invalid such that it causes "len" to
|
||||||
be negative, it's a value error. */
|
be negative, it's a value error. */
|
||||||
|
|
||||||
if (n < ind)
|
if (n < ind) {
|
||||||
{
|
|
||||||
client->errorValue = offset;
|
client->errorValue = offset;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
|
@ -341,24 +324,20 @@ check_change_property(ClientPtr client, Atom property, Atom type, int format,
|
||||||
int mode, int nitems)
|
int mode, int nitems)
|
||||||
{
|
{
|
||||||
if ((mode != PropModeReplace) && (mode != PropModeAppend) &&
|
if ((mode != PropModeReplace) && (mode != PropModeAppend) &&
|
||||||
(mode != PropModePrepend))
|
(mode != PropModePrepend)) {
|
||||||
{
|
|
||||||
client->errorValue = mode;
|
client->errorValue = mode;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
if ((format != 8) && (format != 16) && (format != 32))
|
if ((format != 8) && (format != 16) && (format != 32)) {
|
||||||
{
|
|
||||||
client->errorValue = format;
|
client->errorValue = format;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ValidAtom(property))
|
if (!ValidAtom(property)) {
|
||||||
{
|
|
||||||
client->errorValue = property;
|
client->errorValue = property;
|
||||||
return BadAtom;
|
return BadAtom;
|
||||||
}
|
}
|
||||||
if (!ValidAtom(type))
|
if (!ValidAtom(type)) {
|
||||||
{
|
|
||||||
client->errorValue = type;
|
client->errorValue = type;
|
||||||
return BadAtom;
|
return BadAtom;
|
||||||
}
|
}
|
||||||
|
|
@ -372,7 +351,8 @@ change_property(ClientPtr client, DeviceIntPtr dev, Atom property, Atom type,
|
||||||
{
|
{
|
||||||
int rc = Success;
|
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)
|
if (rc != Success)
|
||||||
client->errorValue = property;
|
client->errorValue = property;
|
||||||
|
|
||||||
|
|
@ -393,14 +373,13 @@ XIGetKnownProperty(const char *name)
|
||||||
if (!name)
|
if (!name)
|
||||||
return None;
|
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 (strcmp(name, dev_properties[i].name) == 0) {
|
||||||
if (dev_properties[i].type == None) {
|
if (dev_properties[i].type == None) {
|
||||||
dev_properties[i].type =
|
dev_properties[i].type =
|
||||||
MakeAtom(dev_properties[i].name,
|
MakeAtom(dev_properties[i].name,
|
||||||
strlen(dev_properties[i].name),
|
strlen(dev_properties[i].name), TRUE);
|
||||||
TRUE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return dev_properties[i].type;
|
return dev_properties[i].type;
|
||||||
|
|
@ -415,7 +394,8 @@ XIResetProperties(void)
|
||||||
{
|
{
|
||||||
int i;
|
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;
|
dev_properties[i].type = None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -450,8 +430,7 @@ XIPropToInt(XIPropertyValuePtr val, int *nelem_return, int **buf_return)
|
||||||
if (!*buf_return && *nelem_return)
|
if (!*buf_return && *nelem_return)
|
||||||
return BadLength;
|
return BadLength;
|
||||||
|
|
||||||
switch(val->format)
|
switch (val->format) {
|
||||||
{
|
|
||||||
case 8:
|
case 8:
|
||||||
case 16:
|
case 16:
|
||||||
case 32:
|
case 32:
|
||||||
|
|
@ -462,23 +441,27 @@ XIPropToInt(XIPropertyValuePtr val, int *nelem_return, int **buf_return)
|
||||||
|
|
||||||
buf = *buf_return;
|
buf = *buf_return;
|
||||||
|
|
||||||
if (!buf && !(*nelem_return))
|
if (!buf && !(*nelem_return)) {
|
||||||
{
|
|
||||||
buf = calloc(val->size, sizeof(int));
|
buf = calloc(val->size, sizeof(int));
|
||||||
if (!buf)
|
if (!buf)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
*buf_return = buf;
|
*buf_return = buf;
|
||||||
*nelem_return = val->size;
|
*nelem_return = val->size;
|
||||||
} else if (val->size < *nelem_return)
|
}
|
||||||
|
else if (val->size < *nelem_return)
|
||||||
*nelem_return = val->size;
|
*nelem_return = val->size;
|
||||||
|
|
||||||
for (i = 0; i < val->size && i < *nelem_return; i++)
|
for (i = 0; i < val->size && i < *nelem_return; i++) {
|
||||||
{
|
switch (val->format) {
|
||||||
switch(val->format)
|
case 8:
|
||||||
{
|
buf[i] = ((CARD8 *) val->data)[i];
|
||||||
case 8: buf[i] = ((CARD8*)val->data)[i]; break;
|
break;
|
||||||
case 16: buf[i] = ((CARD16*)val->data)[i]; break;
|
case 16:
|
||||||
case 32: buf[i] = ((CARD32*)val->data)[i]; break;
|
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;
|
buf = *buf_return;
|
||||||
|
|
||||||
if (!buf && !(*nelem_return))
|
if (!buf && !(*nelem_return)) {
|
||||||
{
|
|
||||||
buf = calloc(val->size, sizeof(float));
|
buf = calloc(val->size, sizeof(float));
|
||||||
if (!buf)
|
if (!buf)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
*buf_return = buf;
|
*buf_return = buf;
|
||||||
*nelem_return = val->size;
|
*nelem_return = val->size;
|
||||||
} else if (val->size < *nelem_return)
|
}
|
||||||
|
else if (val->size < *nelem_return)
|
||||||
*nelem_return = val->size;
|
*nelem_return = val->size;
|
||||||
|
|
||||||
for (i = 0; i < val->size && i < *nelem_return; i++)
|
for (i = 0; i < val->size && i < *nelem_return; i++)
|
||||||
|
|
@ -576,8 +559,7 @@ XIUnregisterPropertyHandler(DeviceIntPtr dev, long id)
|
||||||
XIPropertyHandlerPtr curr, prev = NULL;
|
XIPropertyHandlerPtr curr, prev = NULL;
|
||||||
|
|
||||||
curr = dev->properties.handlers;
|
curr = dev->properties.handlers;
|
||||||
while(curr && curr->id != id)
|
while (curr && curr->id != id) {
|
||||||
{
|
|
||||||
prev = curr;
|
prev = curr;
|
||||||
curr = curr->next;
|
curr = curr->next;
|
||||||
}
|
}
|
||||||
|
|
@ -641,8 +623,7 @@ XIDeleteAllDeviceProperties (DeviceIntPtr device)
|
||||||
XIPropertyPtr prop, next;
|
XIPropertyPtr prop, next;
|
||||||
XIPropertyHandlerPtr curr_handler, next_handler;
|
XIPropertyHandlerPtr curr_handler, next_handler;
|
||||||
|
|
||||||
for (prop = device->properties.properties; prop; prop = next)
|
for (prop = device->properties.properties; prop; prop = next) {
|
||||||
{
|
|
||||||
next = prop->next;
|
next = prop->next;
|
||||||
send_property_event(device, prop->propertyName, XIPropertyDeleted);
|
send_property_event(device, prop->propertyName, XIPropertyDeleted);
|
||||||
XIDestroyDeviceProperty(prop);
|
XIDestroyDeviceProperty(prop);
|
||||||
|
|
@ -652,8 +633,7 @@ XIDeleteAllDeviceProperties (DeviceIntPtr device)
|
||||||
|
|
||||||
/* Now free all handlers */
|
/* Now free all handlers */
|
||||||
curr_handler = device->properties.handlers;
|
curr_handler = device->properties.handlers;
|
||||||
while(curr_handler)
|
while (curr_handler) {
|
||||||
{
|
|
||||||
next_handler = curr_handler->next;
|
next_handler = curr_handler->next;
|
||||||
free(curr_handler);
|
free(curr_handler);
|
||||||
curr_handler = next_handler;
|
curr_handler = next_handler;
|
||||||
|
|
@ -662,14 +642,14 @@ XIDeleteAllDeviceProperties (DeviceIntPtr device)
|
||||||
device->properties.handlers = NULL;
|
device->properties.handlers = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
XIDeleteDeviceProperty(DeviceIntPtr device, Atom property, Bool fromClient)
|
XIDeleteDeviceProperty(DeviceIntPtr device, Atom property, Bool fromClient)
|
||||||
{
|
{
|
||||||
XIPropertyPtr prop, *prev;
|
XIPropertyPtr prop, *prev;
|
||||||
int rc = Success;
|
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)
|
if (prop->propertyName == property)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -680,11 +660,10 @@ XIDeleteDeviceProperty (DeviceIntPtr device, Atom property, Bool fromClient)
|
||||||
return BadAccess;
|
return BadAccess;
|
||||||
|
|
||||||
/* Ask handlers if we may delete the property */
|
/* Ask handlers if we may delete the property */
|
||||||
if (device->properties.handlers)
|
if (device->properties.handlers) {
|
||||||
{
|
|
||||||
XIPropertyHandlerPtr handler = device->properties.handlers;
|
XIPropertyHandlerPtr handler = device->properties.handlers;
|
||||||
while(handler)
|
|
||||||
{
|
while (handler) {
|
||||||
if (handler->DeleteProperty)
|
if (handler->DeleteProperty)
|
||||||
rc = handler->DeleteProperty(device, prop->propertyName);
|
rc = handler->DeleteProperty(device, prop->propertyName);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
|
|
@ -693,8 +672,7 @@ XIDeleteDeviceProperty (DeviceIntPtr device, Atom property, Bool fromClient)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prop)
|
if (prop) {
|
||||||
{
|
|
||||||
*prev = prop->next;
|
*prev = prop->next;
|
||||||
send_property_event(device, prop->propertyName, XIPropertyDeleted);
|
send_property_event(device, prop->propertyName, XIPropertyDeleted);
|
||||||
XIDestroyDeviceProperty(prop);
|
XIDestroyDeviceProperty(prop);
|
||||||
|
|
@ -721,8 +699,7 @@ XIChangeDeviceProperty (DeviceIntPtr dev, Atom property, Atom type,
|
||||||
|
|
||||||
/* first see if property already exists */
|
/* first see if property already exists */
|
||||||
prop = XIFetchDeviceProperty(dev, property);
|
prop = XIFetchDeviceProperty(dev, property);
|
||||||
if (!prop) /* just add to list */
|
if (!prop) { /* just add to list */
|
||||||
{
|
|
||||||
prop = XICreateDeviceProperty(property);
|
prop = XICreateDeviceProperty(property);
|
||||||
if (!prop)
|
if (!prop)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
|
@ -746,14 +723,12 @@ XIChangeDeviceProperty (DeviceIntPtr dev, Atom property, Atom type,
|
||||||
else
|
else
|
||||||
total_len = prop_value->size + len;
|
total_len = prop_value->size + len;
|
||||||
|
|
||||||
if (mode == PropModeReplace || len > 0)
|
if (mode == PropModeReplace || len > 0) {
|
||||||
{
|
|
||||||
pointer new_data = NULL, old_data = NULL;
|
pointer new_data = NULL, old_data = NULL;
|
||||||
|
|
||||||
total_size = total_len * size_in_bytes;
|
total_size = total_len * size_in_bytes;
|
||||||
new_value.data = (pointer) malloc(total_size);
|
new_value.data = (pointer) malloc(total_size);
|
||||||
if (!new_value.data && total_size)
|
if (!new_value.data && total_size) {
|
||||||
{
|
|
||||||
if (add)
|
if (add)
|
||||||
XIDestroyDeviceProperty(prop);
|
XIDestroyDeviceProperty(prop);
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
|
@ -784,24 +759,20 @@ XIChangeDeviceProperty (DeviceIntPtr dev, Atom property, Atom type,
|
||||||
memcpy((char *) old_data, (char *) prop_value->data,
|
memcpy((char *) old_data, (char *) prop_value->data,
|
||||||
prop_value->size * size_in_bytes);
|
prop_value->size * size_in_bytes);
|
||||||
|
|
||||||
if (dev->properties.handlers)
|
if (dev->properties.handlers) {
|
||||||
{
|
|
||||||
XIPropertyHandlerPtr handler;
|
XIPropertyHandlerPtr handler;
|
||||||
BOOL checkonly = TRUE;
|
BOOL checkonly = TRUE;
|
||||||
|
|
||||||
/* run through all handlers with checkonly TRUE, then again with
|
/* run through all handlers with checkonly TRUE, then again with
|
||||||
* checkonly FALSE. Handlers MUST return error codes on the
|
* checkonly FALSE. Handlers MUST return error codes on the
|
||||||
* checkonly run, errors on the second run are ignored */
|
* checkonly run, errors on the second run are ignored */
|
||||||
do
|
do {
|
||||||
{
|
|
||||||
handler = dev->properties.handlers;
|
handler = dev->properties.handlers;
|
||||||
while(handler)
|
while (handler) {
|
||||||
{
|
if (handler->SetProperty) {
|
||||||
if (handler->SetProperty)
|
|
||||||
{
|
|
||||||
rc = handler->SetProperty(dev, prop->propertyName,
|
rc = handler->SetProperty(dev, prop->propertyName,
|
||||||
&new_value, checkonly);
|
&new_value, checkonly);
|
||||||
if (checkonly && rc != Success)
|
if (checkonly && rc != Success) {
|
||||||
{
|
|
||||||
free(new_value.data);
|
free(new_value.data);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
@ -813,13 +784,12 @@ XIChangeDeviceProperty (DeviceIntPtr dev, Atom property, Atom type,
|
||||||
}
|
}
|
||||||
free(prop_value->data);
|
free(prop_value->data);
|
||||||
*prop_value = new_value;
|
*prop_value = new_value;
|
||||||
} else if (len == 0)
|
}
|
||||||
{
|
else if (len == 0) {
|
||||||
/* do nothing */
|
/* do nothing */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (add)
|
if (add) {
|
||||||
{
|
|
||||||
prop->next = dev->properties.properties;
|
prop->next = dev->properties.properties;
|
||||||
dev->properties.properties = prop;
|
dev->properties.properties = prop;
|
||||||
}
|
}
|
||||||
|
|
@ -837,23 +807,19 @@ XIGetDeviceProperty (DeviceIntPtr dev, Atom property, XIPropertyValuePtr *value)
|
||||||
XIPropertyPtr prop = XIFetchDeviceProperty(dev, property);
|
XIPropertyPtr prop = XIFetchDeviceProperty(dev, property);
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if (!prop)
|
if (!prop) {
|
||||||
{
|
|
||||||
*value = NULL;
|
*value = NULL;
|
||||||
return BadAtom;
|
return BadAtom;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we can, try to update the property value first */
|
/* If we can, try to update the property value first */
|
||||||
if (dev->properties.handlers)
|
if (dev->properties.handlers) {
|
||||||
{
|
|
||||||
XIPropertyHandlerPtr handler = dev->properties.handlers;
|
XIPropertyHandlerPtr handler = dev->properties.handlers;
|
||||||
while(handler)
|
|
||||||
{
|
while (handler) {
|
||||||
if (handler->GetProperty)
|
if (handler->GetProperty) {
|
||||||
{
|
|
||||||
rc = handler->GetProperty(dev, prop->propertyName);
|
rc = handler->GetProperty(dev, prop->propertyName);
|
||||||
if (rc != Success)
|
if (rc != Success) {
|
||||||
{
|
|
||||||
*value = NULL;
|
*value = NULL;
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
@ -905,8 +871,7 @@ ProcXListDeviceProperties (ClientPtr client)
|
||||||
rep.nAtoms = natoms;
|
rep.nAtoms = natoms;
|
||||||
|
|
||||||
WriteReplyToClient(client, sizeof(xListDevicePropertiesReply), &rep);
|
WriteReplyToClient(client, sizeof(xListDevicePropertiesReply), &rep);
|
||||||
if (natoms)
|
if (natoms) {
|
||||||
{
|
|
||||||
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
|
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
|
||||||
WriteSwappedDataToClient(client, natoms * sizeof(Atom), atoms);
|
WriteSwappedDataToClient(client, natoms * sizeof(Atom), atoms);
|
||||||
free(atoms);
|
free(atoms);
|
||||||
|
|
@ -958,8 +923,7 @@ ProcXDeleteDeviceProperty (ClientPtr client)
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
if (!ValidAtom(stuff->property))
|
if (!ValidAtom(stuff->property)) {
|
||||||
{
|
|
||||||
client->errorValue = stuff->property;
|
client->errorValue = stuff->property;
|
||||||
return BadAtom;
|
return BadAtom;
|
||||||
}
|
}
|
||||||
|
|
@ -983,8 +947,7 @@ ProcXGetDeviceProperty (ClientPtr client)
|
||||||
if (stuff->delete)
|
if (stuff->delete)
|
||||||
UpdateCurrentTime();
|
UpdateCurrentTime();
|
||||||
rc = dixLookupDevice(&dev, stuff->deviceid, client,
|
rc = dixLookupDevice(&dev, stuff->deviceid, client,
|
||||||
stuff->delete ? DixSetPropAccess :
|
stuff->delete ? DixSetPropAccess : DixGetPropAccess);
|
||||||
DixGetPropAccess);
|
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
|
|
@ -1010,24 +973,28 @@ ProcXGetDeviceProperty (ClientPtr client)
|
||||||
|
|
||||||
WriteReplyToClient(client, sizeof(xGenericReply), &reply);
|
WriteReplyToClient(client, sizeof(xGenericReply), &reply);
|
||||||
|
|
||||||
if (length)
|
if (length) {
|
||||||
{
|
|
||||||
switch (reply.format) {
|
switch (reply.format) {
|
||||||
case 32: client->pSwapReplyFunc = (ReplySwapPtr)CopySwap32Write; break;
|
case 32:
|
||||||
case 16: client->pSwapReplyFunc = (ReplySwapPtr)CopySwap16Write; break;
|
client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write;
|
||||||
default: client->pSwapReplyFunc = (ReplySwapPtr)WriteToClient; break;
|
break;
|
||||||
|
case 16:
|
||||||
|
client->pSwapReplyFunc = (ReplySwapPtr) CopySwap16Write;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
client->pSwapReplyFunc = (ReplySwapPtr) WriteToClient;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
WriteSwappedDataToClient(client, length, data);
|
WriteSwappedDataToClient(client, length, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* delete the Property */
|
/* delete the Property */
|
||||||
if (stuff->delete && (reply.bytesAfter == 0))
|
if (stuff->delete && (reply.bytesAfter == 0)) {
|
||||||
{
|
|
||||||
XIPropertyPtr prop, *prev;
|
XIPropertyPtr prop, *prev;
|
||||||
for (prev = &dev->properties.properties; (prop = *prev); prev = &prop->next)
|
|
||||||
{
|
for (prev = &dev->properties.properties; (prop = *prev);
|
||||||
if (prop->propertyName == stuff->property)
|
prev = &prop->next) {
|
||||||
{
|
if (prop->propertyName == stuff->property) {
|
||||||
*prev = prop->next;
|
*prev = prop->next;
|
||||||
XIDestroyDeviceProperty(prop);
|
XIDestroyDeviceProperty(prop);
|
||||||
break;
|
break;
|
||||||
|
|
@ -1037,7 +1004,6 @@ ProcXGetDeviceProperty (ClientPtr client)
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
SProcXListDeviceProperties(ClientPtr client)
|
SProcXListDeviceProperties(ClientPtr client)
|
||||||
{
|
{
|
||||||
|
|
@ -1087,7 +1053,6 @@ SProcXGetDeviceProperty (ClientPtr client)
|
||||||
return (ProcXGetDeviceProperty(client));
|
return (ProcXGetDeviceProperty(client));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Reply swapping */
|
/* Reply swapping */
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -1142,8 +1107,7 @@ ProcXIListProperties(ClientPtr client)
|
||||||
rep.num_properties = natoms;
|
rep.num_properties = natoms;
|
||||||
|
|
||||||
WriteReplyToClient(client, sizeof(xXIListPropertiesReply), &rep);
|
WriteReplyToClient(client, sizeof(xXIListPropertiesReply), &rep);
|
||||||
if (natoms)
|
if (natoms) {
|
||||||
{
|
|
||||||
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
|
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
|
||||||
WriteSwappedDataToClient(client, natoms * sizeof(Atom), atoms);
|
WriteSwappedDataToClient(client, natoms * sizeof(Atom), atoms);
|
||||||
free(atoms);
|
free(atoms);
|
||||||
|
|
@ -1186,6 +1150,7 @@ ProcXIDeleteProperty(ClientPtr client)
|
||||||
{
|
{
|
||||||
DeviceIntPtr dev;
|
DeviceIntPtr dev;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
REQUEST(xXIDeletePropertyReq);
|
REQUEST(xXIDeletePropertyReq);
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xXIDeletePropertyReq);
|
REQUEST_SIZE_MATCH(xXIDeletePropertyReq);
|
||||||
|
|
@ -1194,8 +1159,7 @@ ProcXIDeleteProperty(ClientPtr client)
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
if (!ValidAtom(stuff->property))
|
if (!ValidAtom(stuff->property)) {
|
||||||
{
|
|
||||||
client->errorValue = stuff->property;
|
client->errorValue = stuff->property;
|
||||||
return BadAtom;
|
return BadAtom;
|
||||||
}
|
}
|
||||||
|
|
@ -1204,7 +1168,6 @@ ProcXIDeleteProperty(ClientPtr client)
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
ProcXIGetProperty(ClientPtr client)
|
ProcXIGetProperty(ClientPtr client)
|
||||||
{
|
{
|
||||||
|
|
@ -1220,8 +1183,7 @@ ProcXIGetProperty(ClientPtr client)
|
||||||
if (stuff->delete)
|
if (stuff->delete)
|
||||||
UpdateCurrentTime();
|
UpdateCurrentTime();
|
||||||
rc = dixLookupDevice(&dev, stuff->deviceid, client,
|
rc = dixLookupDevice(&dev, stuff->deviceid, client,
|
||||||
stuff->delete ? DixSetPropAccess :
|
stuff->delete ? DixSetPropAccess : DixGetPropAccess);
|
||||||
DixGetPropAccess);
|
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
|
|
@ -1246,24 +1208,28 @@ ProcXIGetProperty(ClientPtr client)
|
||||||
|
|
||||||
WriteReplyToClient(client, sizeof(xXIGetPropertyReply), &reply);
|
WriteReplyToClient(client, sizeof(xXIGetPropertyReply), &reply);
|
||||||
|
|
||||||
if (length)
|
if (length) {
|
||||||
{
|
|
||||||
switch (reply.format) {
|
switch (reply.format) {
|
||||||
case 32: client->pSwapReplyFunc = (ReplySwapPtr)CopySwap32Write; break;
|
case 32:
|
||||||
case 16: client->pSwapReplyFunc = (ReplySwapPtr)CopySwap16Write; break;
|
client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write;
|
||||||
default: client->pSwapReplyFunc = (ReplySwapPtr)WriteToClient; break;
|
break;
|
||||||
|
case 16:
|
||||||
|
client->pSwapReplyFunc = (ReplySwapPtr) CopySwap16Write;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
client->pSwapReplyFunc = (ReplySwapPtr) WriteToClient;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
WriteSwappedDataToClient(client, length, data);
|
WriteSwappedDataToClient(client, length, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* delete the Property */
|
/* delete the Property */
|
||||||
if (stuff->delete && (reply.bytes_after == 0))
|
if (stuff->delete && (reply.bytes_after == 0)) {
|
||||||
{
|
|
||||||
XIPropertyPtr prop, *prev;
|
XIPropertyPtr prop, *prev;
|
||||||
for (prev = &dev->properties.properties; (prop = *prev); prev = &prop->next)
|
|
||||||
{
|
for (prev = &dev->properties.properties; (prop = *prev);
|
||||||
if (prop->propertyName == stuff->property)
|
prev = &prop->next) {
|
||||||
{
|
if (prop->propertyName == stuff->property) {
|
||||||
*prev = prop->next;
|
*prev = prop->next;
|
||||||
XIDestroyDeviceProperty(prop);
|
XIDestroyDeviceProperty(prop);
|
||||||
break;
|
break;
|
||||||
|
|
@ -1327,10 +1293,8 @@ SProcXIGetProperty(ClientPtr client)
|
||||||
return (ProcXIGetProperty(client));
|
return (ProcXIGetProperty(client));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
SRepXIListProperties(ClientPtr client, int size,
|
SRepXIListProperties(ClientPtr client, int size, xXIListPropertiesReply * rep)
|
||||||
xXIListPropertiesReply *rep)
|
|
||||||
{
|
{
|
||||||
swaps(&rep->sequenceNumber);
|
swaps(&rep->sequenceNumber);
|
||||||
swapl(&rep->length);
|
swapl(&rep->length);
|
||||||
|
|
@ -1340,8 +1304,7 @@ SRepXIListProperties(ClientPtr client, int size,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
SRepXIGetProperty(ClientPtr client, int size,
|
SRepXIGetProperty(ClientPtr client, int size, xXIGetPropertyReply * rep)
|
||||||
xXIGetPropertyReply *rep)
|
|
||||||
{
|
{
|
||||||
swaps(&rep->sequenceNumber);
|
swaps(&rep->sequenceNumber);
|
||||||
swapl(&rep->length);
|
swapl(&rep->length);
|
||||||
|
|
|
||||||
|
|
@ -60,8 +60,7 @@ int SProcXIGetProperty (ClientPtr client);
|
||||||
|
|
||||||
void SRepXIListProperties(ClientPtr client, int size,
|
void SRepXIListProperties(ClientPtr client, int size,
|
||||||
xXIListPropertiesReply * rep);
|
xXIListPropertiesReply * rep);
|
||||||
void SRepXIGetProperty(ClientPtr client, int size,
|
void SRepXIGetProperty(ClientPtr client, int size, xXIGetPropertyReply * rep);
|
||||||
xXIGetPropertyReply *rep);
|
|
||||||
|
|
||||||
void XIResetProperties(void);
|
void XIResetProperties(void);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -74,31 +74,27 @@ ProcXIQueryDevice(ClientPtr client)
|
||||||
REQUEST(xXIQueryDeviceReq);
|
REQUEST(xXIQueryDeviceReq);
|
||||||
REQUEST_SIZE_MATCH(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);
|
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess);
|
||||||
if (rc != Success)
|
if (rc != Success) {
|
||||||
{
|
|
||||||
client->errorValue = stuff->deviceid;
|
client->errorValue = stuff->deviceid;
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
len += SizeDeviceInfo(dev);
|
len += SizeDeviceInfo(dev);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
skip = calloc(sizeof(Bool), inputInfo.numDevices);
|
skip = calloc(sizeof(Bool), inputInfo.numDevices);
|
||||||
if (!skip)
|
if (!skip)
|
||||||
return BadAlloc;
|
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);
|
skip[i] = ShouldSkipDevice(client, stuff->deviceid, dev);
|
||||||
if (!skip[i])
|
if (!skip[i])
|
||||||
len += SizeDeviceInfo(dev);
|
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);
|
skip[i] = ShouldSkipDevice(client, stuff->deviceid, dev);
|
||||||
if (!skip[i])
|
if (!skip[i])
|
||||||
len += SizeDeviceInfo(dev);
|
len += SizeDeviceInfo(dev);
|
||||||
|
|
@ -119,20 +115,17 @@ ProcXIQueryDevice(ClientPtr client)
|
||||||
rep.num_devices = 0;
|
rep.num_devices = 0;
|
||||||
|
|
||||||
ptr = info;
|
ptr = info;
|
||||||
if (dev)
|
if (dev) {
|
||||||
{
|
|
||||||
len = ListDeviceInfo(client, dev, (xXIDeviceInfo *) info);
|
len = ListDeviceInfo(client, dev, (xXIDeviceInfo *) info);
|
||||||
if (client->swapped)
|
if (client->swapped)
|
||||||
SwapDeviceInfo(dev, (xXIDeviceInfo *) info);
|
SwapDeviceInfo(dev, (xXIDeviceInfo *) info);
|
||||||
info += len;
|
info += len;
|
||||||
rep.num_devices = 1;
|
rep.num_devices = 1;
|
||||||
} else
|
}
|
||||||
{
|
else {
|
||||||
i = 0;
|
i = 0;
|
||||||
for (dev = inputInfo.devices; dev; dev = dev->next, i++)
|
for (dev = inputInfo.devices; dev; dev = dev->next, i++) {
|
||||||
{
|
if (!skip[i]) {
|
||||||
if (!skip[i])
|
|
||||||
{
|
|
||||||
len = ListDeviceInfo(client, dev, (xXIDeviceInfo *) info);
|
len = ListDeviceInfo(client, dev, (xXIDeviceInfo *) info);
|
||||||
if (client->swapped)
|
if (client->swapped)
|
||||||
SwapDeviceInfo(dev, (xXIDeviceInfo *) info);
|
SwapDeviceInfo(dev, (xXIDeviceInfo *) info);
|
||||||
|
|
@ -141,10 +134,8 @@ ProcXIQueryDevice(ClientPtr client)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (dev = inputInfo.off_devices; dev; dev = dev->next, i++)
|
for (dev = inputInfo.off_devices; dev; dev = dev->next, i++) {
|
||||||
{
|
if (!skip[i]) {
|
||||||
if (!skip[i])
|
|
||||||
{
|
|
||||||
len = ListDeviceInfo(client, dev, (xXIDeviceInfo *) info);
|
len = ListDeviceInfo(client, dev, (xXIDeviceInfo *) info);
|
||||||
if (client->swapped)
|
if (client->swapped)
|
||||||
SwapDeviceInfo(dev, (xXIDeviceInfo *) info);
|
SwapDeviceInfo(dev, (xXIDeviceInfo *) info);
|
||||||
|
|
@ -174,7 +165,6 @@ SRepXIQueryDevice(ClientPtr client, int size, xXIQueryDeviceReply *rep)
|
||||||
WriteToClient(client, size, (char *) rep);
|
WriteToClient(client, size, (char *) rep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Whether the device should be included in the returned list.
|
* @return Whether the device should be included in the returned list.
|
||||||
*/
|
*/
|
||||||
|
|
@ -182,9 +172,9 @@ static Bool
|
||||||
ShouldSkipDevice(ClientPtr client, int deviceid, DeviceIntPtr dev)
|
ShouldSkipDevice(ClientPtr client, int deviceid, DeviceIntPtr dev)
|
||||||
{
|
{
|
||||||
/* if all devices are not being queried, only master devices are */
|
/* 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);
|
int rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixGetAttrAccess);
|
||||||
|
|
||||||
if (rc == Success)
|
if (rc == Success)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
@ -215,23 +205,22 @@ SizeDeviceClasses(DeviceIntPtr dev)
|
||||||
{
|
{
|
||||||
int len = 0;
|
int len = 0;
|
||||||
|
|
||||||
if (dev->button)
|
if (dev->button) {
|
||||||
{
|
|
||||||
len += sizeof(xXIButtonInfo);
|
len += sizeof(xXIButtonInfo);
|
||||||
len += dev->button->numButtons * sizeof(Atom);
|
len += dev->button->numButtons * sizeof(Atom);
|
||||||
len += pad_to_int32(bits_to_bytes(dev->button->numButtons));
|
len += pad_to_int32(bits_to_bytes(dev->button->numButtons));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dev->key)
|
if (dev->key) {
|
||||||
{
|
|
||||||
XkbDescPtr xkb = dev->key->xkbInfo->desc;
|
XkbDescPtr xkb = dev->key->xkbInfo->desc;
|
||||||
|
|
||||||
len += sizeof(xXIKeyInfo);
|
len += sizeof(xXIKeyInfo);
|
||||||
len += (xkb->max_key_code - xkb->min_key_code + 1) * sizeof(uint32_t);
|
len += (xkb->max_key_code - xkb->min_key_code + 1) * sizeof(uint32_t);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dev->valuator)
|
if (dev->valuator) {
|
||||||
{
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
len += (sizeof(xXIValuatorInfo)) * dev->valuator->numAxes;
|
len += (sizeof(xXIValuatorInfo)) * dev->valuator->numAxes;
|
||||||
|
|
||||||
for (i = 0; i < dev->valuator->numAxes; i++) {
|
for (i = 0; i < dev->valuator->numAxes; i++) {
|
||||||
|
|
@ -246,7 +235,6 @@ SizeDeviceClasses(DeviceIntPtr dev)
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write button information into info.
|
* Write button information into info.
|
||||||
* @return Number of bytes written into info.
|
* @return Number of bytes written into info.
|
||||||
|
|
@ -288,6 +276,7 @@ SwapButtonInfo(DeviceIntPtr dev, xXIButtonInfo* info)
|
||||||
{
|
{
|
||||||
Atom *btn;
|
Atom *btn;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
swaps(&info->type);
|
swaps(&info->type);
|
||||||
swaps(&info->length);
|
swaps(&info->length);
|
||||||
swaps(&info->sourceid);
|
swaps(&info->sourceid);
|
||||||
|
|
@ -326,11 +315,13 @@ SwapKeyInfo(DeviceIntPtr dev, xXIKeyInfo* info)
|
||||||
{
|
{
|
||||||
uint32_t *key;
|
uint32_t *key;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
swaps(&info->type);
|
swaps(&info->type);
|
||||||
swaps(&info->length);
|
swaps(&info->length);
|
||||||
swaps(&info->sourceid);
|
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);
|
swapl(key);
|
||||||
|
|
||||||
swaps(&info->num_keycodes);
|
swaps(&info->num_keycodes);
|
||||||
|
|
@ -392,8 +383,7 @@ ListScrollInfo(DeviceIntPtr dev, xXIScrollInfo *info, int axisnumber)
|
||||||
info->type = XIScrollClass;
|
info->type = XIScrollClass;
|
||||||
info->length = sizeof(xXIScrollInfo) / 4;
|
info->length = sizeof(xXIScrollInfo) / 4;
|
||||||
info->number = axisnumber;
|
info->number = axisnumber;
|
||||||
switch(axis->scroll.type)
|
switch (axis->scroll.type) {
|
||||||
{
|
|
||||||
case SCROLL_TYPE_VERTICAL:
|
case SCROLL_TYPE_VERTICAL:
|
||||||
info->scroll_type = XIScrollTypeVertical;
|
info->scroll_type = XIScrollTypeVertical;
|
||||||
break;
|
break;
|
||||||
|
|
@ -401,7 +391,8 @@ ListScrollInfo(DeviceIntPtr dev, xXIScrollInfo *info, int axisnumber)
|
||||||
info->scroll_type = XIScrollTypeHorizontal;
|
info->scroll_type = XIScrollTypeHorizontal;
|
||||||
break;
|
break;
|
||||||
default:
|
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;
|
break;
|
||||||
}
|
}
|
||||||
info->increment = double_to_fp3232(axis->scroll.increment);
|
info->increment = double_to_fp3232(axis->scroll.increment);
|
||||||
|
|
@ -454,21 +445,23 @@ SwapTouchInfo(DeviceIntPtr dev, xXITouchInfo* touch)
|
||||||
swaps(&touch->sourceid);
|
swaps(&touch->sourceid);
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetDeviceUse(DeviceIntPtr dev, uint16_t *attachment)
|
int
|
||||||
|
GetDeviceUse(DeviceIntPtr dev, uint16_t * attachment)
|
||||||
{
|
{
|
||||||
DeviceIntPtr master = GetMaster(dev, MASTER_ATTACHED);
|
DeviceIntPtr master = GetMaster(dev, MASTER_ATTACHED);
|
||||||
int use;
|
int use;
|
||||||
|
|
||||||
if (IsMaster(dev))
|
if (IsMaster(dev)) {
|
||||||
{
|
|
||||||
DeviceIntPtr paired = GetPairedDevice(dev);
|
DeviceIntPtr paired = GetPairedDevice(dev);
|
||||||
|
|
||||||
use = IsPointerDevice(dev) ? XIMasterPointer : XIMasterKeyboard;
|
use = IsPointerDevice(dev) ? XIMasterPointer : XIMasterKeyboard;
|
||||||
*attachment = (paired ? paired->id : 0);
|
*attachment = (paired ? paired->id : 0);
|
||||||
} else if (!IsFloating(dev))
|
}
|
||||||
{
|
else if (!IsFloating(dev)) {
|
||||||
use = IsPointerDevice(master) ? XISlavePointer : XISlaveKeyboard;
|
use = IsPointerDevice(master) ? XISlavePointer : XISlaveKeyboard;
|
||||||
*attachment = master->id;
|
*attachment = master->id;
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
use = XIFloatingSlave;
|
use = XIFloatingSlave;
|
||||||
|
|
||||||
return use;
|
return use;
|
||||||
|
|
@ -519,32 +512,28 @@ ListDeviceClasses(ClientPtr client, DeviceIntPtr dev,
|
||||||
/* Check if the current device state should be suppressed */
|
/* Check if the current device state should be suppressed */
|
||||||
rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixReadAccess);
|
rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixReadAccess);
|
||||||
|
|
||||||
if (dev->button)
|
if (dev->button) {
|
||||||
{
|
|
||||||
(*nclasses)++;
|
(*nclasses)++;
|
||||||
len = ListButtonInfo(dev, (xXIButtonInfo *) any, rc == Success);
|
len = ListButtonInfo(dev, (xXIButtonInfo *) any, rc == Success);
|
||||||
any += len;
|
any += len;
|
||||||
total_len += len;
|
total_len += len;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dev->key)
|
if (dev->key) {
|
||||||
{
|
|
||||||
(*nclasses)++;
|
(*nclasses)++;
|
||||||
len = ListKeyInfo(dev, (xXIKeyInfo *) any);
|
len = ListKeyInfo(dev, (xXIKeyInfo *) any);
|
||||||
any += len;
|
any += len;
|
||||||
total_len += 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)++;
|
(*nclasses)++;
|
||||||
len = ListValuatorInfo(dev, (xXIValuatorInfo *) any, i, rc == Success);
|
len = ListValuatorInfo(dev, (xXIValuatorInfo *) any, i, rc == Success);
|
||||||
any += len;
|
any += len;
|
||||||
total_len += 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);
|
len = ListScrollInfo(dev, (xXIScrollInfo *) any, i);
|
||||||
if (len)
|
if (len)
|
||||||
(*nclasses)++;
|
(*nclasses)++;
|
||||||
|
|
@ -552,8 +541,7 @@ ListDeviceClasses(ClientPtr client, DeviceIntPtr dev,
|
||||||
total_len += len;
|
total_len += len;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dev->touch)
|
if (dev->touch) {
|
||||||
{
|
|
||||||
(*nclasses)++;
|
(*nclasses)++;
|
||||||
len = ListTouchInfo(dev, (xXITouchInfo *) any);
|
len = ListTouchInfo(dev, (xXITouchInfo *) any);
|
||||||
any += len;
|
any += len;
|
||||||
|
|
@ -572,11 +560,10 @@ SwapDeviceInfo(DeviceIntPtr dev, xXIDeviceInfo* info)
|
||||||
/* Skip over name */
|
/* Skip over name */
|
||||||
any += pad_to_int32(info->name_len);
|
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;
|
int len = ((xXIAnyInfo *) any)->length;
|
||||||
switch(((xXIAnyInfo*)any)->type)
|
|
||||||
{
|
switch (((xXIAnyInfo *) any)->type) {
|
||||||
case XIButtonClass:
|
case XIButtonClass:
|
||||||
SwapButtonInfo(dev, (xXIButtonInfo *) any);
|
SwapButtonInfo(dev, (xXIButtonInfo *) any);
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -84,24 +84,19 @@ ProcXIQueryPointer(ClientPtr client)
|
||||||
REQUEST_SIZE_MATCH(xXIQueryPointerReq);
|
REQUEST_SIZE_MATCH(xXIQueryPointerReq);
|
||||||
|
|
||||||
rc = dixLookupDevice(&pDev, stuff->deviceid, client, DixReadAccess);
|
rc = dixLookupDevice(&pDev, stuff->deviceid, client, DixReadAccess);
|
||||||
if (rc != Success)
|
if (rc != Success) {
|
||||||
{
|
|
||||||
client->errorValue = stuff->deviceid;
|
client->errorValue = stuff->deviceid;
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pDev->valuator == NULL || IsKeyboardDevice(pDev) ||
|
if (pDev->valuator == NULL || IsKeyboardDevice(pDev) || (!IsMaster(pDev) && !IsFloating(pDev))) { /* no attached devices */
|
||||||
(!IsMaster(pDev) && !IsFloating(pDev))) /* no attached devices */
|
|
||||||
{
|
|
||||||
client->errorValue = stuff->deviceid;
|
client->errorValue = stuff->deviceid;
|
||||||
return BadDevice;
|
return BadDevice;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = dixLookupWindow(&pWin, stuff->win, client, DixGetAttrAccess);
|
rc = dixLookupWindow(&pWin, stuff->win, client, DixGetAttrAccess);
|
||||||
if (rc != Success)
|
if (rc != Success) {
|
||||||
{
|
SendErrorToClient(client, IReqCode, X_XIQueryPointer, stuff->win, rc);
|
||||||
SendErrorToClient(client, IReqCode, X_XIQueryPointer,
|
|
||||||
stuff->win, rc);
|
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -125,8 +120,7 @@ ProcXIQueryPointer(ClientPtr client)
|
||||||
rep.root_y = FP1616(pSprite->hot.y, 0);
|
rep.root_y = FP1616(pSprite->hot.y, 0);
|
||||||
rep.child = None;
|
rep.child = None;
|
||||||
|
|
||||||
if (kbd)
|
if (kbd) {
|
||||||
{
|
|
||||||
state = &kbd->key->xkbInfo->state;
|
state = &kbd->key->xkbInfo->state;
|
||||||
rep.mods.base_mods = state->base_mods;
|
rep.mods.base_mods = state->base_mods;
|
||||||
rep.mods.latched_mods = state->latched_mods;
|
rep.mods.latched_mods = state->latched_mods;
|
||||||
|
|
@ -137,10 +131,11 @@ ProcXIQueryPointer(ClientPtr client)
|
||||||
rep.group.locked_group = state->locked_group;
|
rep.group.locked_group = state->locked_group;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pDev->button)
|
if (pDev->button) {
|
||||||
{
|
|
||||||
int i, down;
|
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;
|
rep.length += rep.buttons_len;
|
||||||
buttons_size = rep.buttons_len * 4;
|
buttons_size = rep.buttons_len * 4;
|
||||||
buttons = calloc(1, buttons_size);
|
buttons = calloc(1, buttons_size);
|
||||||
|
|
@ -149,30 +144,27 @@ ProcXIQueryPointer(ClientPtr client)
|
||||||
|
|
||||||
down = pDev->button->buttonsDown;
|
down = pDev->button->buttonsDown;
|
||||||
|
|
||||||
for (i = 0; i < pDev->button->numButtons && down; i++)
|
for (i = 0; i < pDev->button->numButtons && down; i++) {
|
||||||
{
|
if (BitIsOn(pDev->button->down, i)) {
|
||||||
if (BitIsOn(pDev->button->down, i))
|
|
||||||
{
|
|
||||||
SetBit(buttons, i);
|
SetBit(buttons, i);
|
||||||
down--;
|
down--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
rep.buttons_len = 0;
|
rep.buttons_len = 0;
|
||||||
|
|
||||||
if (pSprite->hot.pScreen == pWin->drawable.pScreen)
|
if (pSprite->hot.pScreen == pWin->drawable.pScreen) {
|
||||||
{
|
|
||||||
rep.same_screen = xTrue;
|
rep.same_screen = xTrue;
|
||||||
rep.win_x = FP1616(pSprite->hot.x - pWin->drawable.x, 0);
|
rep.win_x = FP1616(pSprite->hot.x - pWin->drawable.x, 0);
|
||||||
rep.win_y = FP1616(pSprite->hot.y - pWin->drawable.y, 0);
|
rep.win_y = FP1616(pSprite->hot.y - pWin->drawable.y, 0);
|
||||||
for (t = pSprite->win; t; t = t->parent)
|
for (t = pSprite->win; t; t = t->parent)
|
||||||
if (t->parent == pWin)
|
if (t->parent == pWin) {
|
||||||
{
|
|
||||||
rep.child = t->drawable.id;
|
rep.child = t->drawable.id;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else
|
}
|
||||||
{
|
else {
|
||||||
rep.same_screen = xFalse;
|
rep.same_screen = xFalse;
|
||||||
rep.win_x = 0;
|
rep.win_x = 0;
|
||||||
rep.win_y = 0;
|
rep.win_y = 0;
|
||||||
|
|
@ -182,8 +174,7 @@ ProcXIQueryPointer(ClientPtr client)
|
||||||
if (!noPanoramiXExtension) {
|
if (!noPanoramiXExtension) {
|
||||||
rep.root_x += FP1616(screenInfo.screens[0]->x, 0);
|
rep.root_x += FP1616(screenInfo.screens[0]->x, 0);
|
||||||
rep.root_y += FP1616(screenInfo.screens[0]->y, 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_x += FP1616(screenInfo.screens[0]->x, 0);
|
||||||
rep.win_y += FP1616(screenInfo.screens[0]->y, 0);
|
rep.win_y += FP1616(screenInfo.screens[0]->y, 0);
|
||||||
}
|
}
|
||||||
|
|
@ -207,8 +198,7 @@ ProcXIQueryPointer(ClientPtr client)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
SRepXIQueryPointer(ClientPtr client, int size,
|
SRepXIQueryPointer(ClientPtr client, int size, xXIQueryPointerReply * rep)
|
||||||
xXIQueryPointerReply * rep)
|
|
||||||
{
|
{
|
||||||
swaps(&rep->sequenceNumber);
|
swaps(&rep->sequenceNumber);
|
||||||
swapl(&rep->length);
|
swapl(&rep->length);
|
||||||
|
|
@ -222,4 +212,3 @@ SRepXIQueryPointer(ClientPtr client, int size,
|
||||||
|
|
||||||
WriteToClient(client, size, (char *) rep);
|
WriteToClient(client, size, (char *) rep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,6 @@
|
||||||
#include <dix-config.h>
|
#include <dix-config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#include "inputstr.h"
|
#include "inputstr.h"
|
||||||
|
|
||||||
#include <X11/Xmd.h>
|
#include <X11/Xmd.h>
|
||||||
|
|
@ -46,6 +45,7 @@
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
|
||||||
extern XExtensionVersion XIVersion; /* defined in getvers.c */
|
extern XExtensionVersion XIVersion; /* defined in getvers.c */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the supported XI version.
|
* Return the supported XI version.
|
||||||
*
|
*
|
||||||
|
|
@ -63,8 +63,7 @@ ProcXIQueryVersion(ClientPtr client)
|
||||||
REQUEST_SIZE_MATCH(xXIQueryVersionReq);
|
REQUEST_SIZE_MATCH(xXIQueryVersionReq);
|
||||||
|
|
||||||
/* This request only exists after XI2 */
|
/* This request only exists after XI2 */
|
||||||
if (stuff->major_version < 2)
|
if (stuff->major_version < 2) {
|
||||||
{
|
|
||||||
client->errorValue = stuff->major_version;
|
client->errorValue = stuff->major_version;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
|
@ -72,12 +71,11 @@ ProcXIQueryVersion(ClientPtr client)
|
||||||
pXIClient = dixLookupPrivate(&client->devPrivates, XIClientPrivateKey);
|
pXIClient = dixLookupPrivate(&client->devPrivates, XIClientPrivateKey);
|
||||||
|
|
||||||
if (version_compare(XIVersion.major_version, XIVersion.minor_version,
|
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;
|
major = stuff->major_version;
|
||||||
minor = stuff->minor_version;
|
minor = stuff->minor_version;
|
||||||
} else
|
}
|
||||||
{
|
else {
|
||||||
major = XIVersion.major_version;
|
major = XIVersion.major_version;
|
||||||
minor = XIVersion.minor_version;
|
minor = XIVersion.minor_version;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
102
Xi/xiselectev.c
102
Xi/xiselectev.c
|
|
@ -27,7 +27,6 @@
|
||||||
#include <dix-config.h>
|
#include <dix-config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#include "dixstruct.h"
|
#include "dixstruct.h"
|
||||||
#include "windowstr.h"
|
#include "windowstr.h"
|
||||||
#include "exglobals.h"
|
#include "exglobals.h"
|
||||||
|
|
@ -43,15 +42,14 @@
|
||||||
*
|
*
|
||||||
* @return BadValue if at least one invalid bit is set or Success otherwise.
|
* @return BadValue if at least one invalid bit is set or Success otherwise.
|
||||||
*/
|
*/
|
||||||
int XICheckInvalidMaskBits(ClientPtr client, unsigned char *mask, int len)
|
int
|
||||||
{
|
XICheckInvalidMaskBits(ClientPtr client, unsigned char *mask, int len)
|
||||||
if (len >= XIMaskLen(XI2LASTEVENT))
|
|
||||||
{
|
{
|
||||||
|
if (len >= XIMaskLen(XI2LASTEVENT)) {
|
||||||
int i;
|
int i;
|
||||||
for (i = XI2LASTEVENT + 1; i < len * 8; i++)
|
|
||||||
{
|
for (i = XI2LASTEVENT + 1; i < len * 8; i++) {
|
||||||
if (BitIsOn(mask, i))
|
if (BitIsOn(mask, i)) {
|
||||||
{
|
|
||||||
client->errorValue = i;
|
client->errorValue = i;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
|
@ -74,11 +72,11 @@ SProcXISelectEvents(ClientPtr client)
|
||||||
swaps(&stuff->num_masks);
|
swaps(&stuff->num_masks);
|
||||||
|
|
||||||
evmask = (xXIEventMask *) & stuff[1];
|
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->deviceid);
|
||||||
swaps(&evmask->mask_len);
|
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));
|
return (ProcXISelectEvents(client));
|
||||||
|
|
@ -110,8 +108,7 @@ ProcXISelectEvents(ClientPtr client)
|
||||||
/* check request validity */
|
/* check request validity */
|
||||||
evmask = (xXIEventMask *) & stuff[1];
|
evmask = (xXIEventMask *) & stuff[1];
|
||||||
num_masks = stuff->num_masks;
|
num_masks = stuff->num_masks;
|
||||||
while(num_masks--)
|
while (num_masks--) {
|
||||||
{
|
|
||||||
len += sizeof(xXIEventMask) + evmask->mask_len * 4;
|
len += sizeof(xXIEventMask) + evmask->mask_len * 4;
|
||||||
|
|
||||||
if (bytes_to_int32(len) > stuff->length)
|
if (bytes_to_int32(len) > stuff->length)
|
||||||
|
|
@ -127,20 +124,19 @@ ProcXISelectEvents(ClientPtr client)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
/* hierarchy event mask is not allowed on devices */
|
/* 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];
|
unsigned char *bits = (unsigned char *) &evmask[1];
|
||||||
if (BitIsOn(bits, XI_HierarchyChanged))
|
|
||||||
{
|
if (BitIsOn(bits, XI_HierarchyChanged)) {
|
||||||
client->errorValue = XI_HierarchyChanged;
|
client->errorValue = XI_HierarchyChanged;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Raw events may only be selected on root windows */
|
/* 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];
|
unsigned char *bits = (unsigned char *) &evmask[1];
|
||||||
|
|
||||||
if (BitIsOn(bits, XI_RawKeyPress) ||
|
if (BitIsOn(bits, XI_RawKeyPress) ||
|
||||||
BitIsOn(bits, XI_RawKeyRelease) ||
|
BitIsOn(bits, XI_RawKeyRelease) ||
|
||||||
BitIsOn(bits, XI_RawButtonPress) ||
|
BitIsOn(bits, XI_RawButtonPress) ||
|
||||||
|
|
@ -148,15 +144,13 @@ ProcXISelectEvents(ClientPtr client)
|
||||||
BitIsOn(bits, XI_RawMotion) ||
|
BitIsOn(bits, XI_RawMotion) ||
|
||||||
BitIsOn(bits, XI_RawTouchBegin) ||
|
BitIsOn(bits, XI_RawTouchBegin) ||
|
||||||
BitIsOn(bits, XI_RawTouchUpdate) ||
|
BitIsOn(bits, XI_RawTouchUpdate) ||
|
||||||
BitIsOn(bits, XI_RawTouchEnd))
|
BitIsOn(bits, XI_RawTouchEnd)) {
|
||||||
{
|
|
||||||
client->errorValue = XI_RawKeyPress;
|
client->errorValue = XI_RawKeyPress;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (evmask->mask_len >= 1)
|
if (evmask->mask_len >= 1) {
|
||||||
{
|
|
||||||
unsigned char *bits = (unsigned char *) &evmask[1];
|
unsigned char *bits = (unsigned char *) &evmask[1];
|
||||||
|
|
||||||
/* All three touch events must be selected at once */
|
/* All three touch events must be selected at once */
|
||||||
|
|
@ -166,8 +160,7 @@ ProcXISelectEvents(ClientPtr client)
|
||||||
BitIsOn(bits, XI_TouchEnd)) &&
|
BitIsOn(bits, XI_TouchEnd)) &&
|
||||||
(!BitIsOn(bits, XI_TouchBegin) ||
|
(!BitIsOn(bits, XI_TouchBegin) ||
|
||||||
!BitIsOn(bits, XI_TouchUpdate) ||
|
!BitIsOn(bits, XI_TouchUpdate) ||
|
||||||
!BitIsOn(bits, XI_TouchEnd)))
|
!BitIsOn(bits, XI_TouchEnd))) {
|
||||||
{
|
|
||||||
client->errorValue = XI_TouchBegin;
|
client->errorValue = XI_TouchBegin;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
|
@ -175,20 +168,20 @@ ProcXISelectEvents(ClientPtr client)
|
||||||
/* Only one client per window may select for touch events on the
|
/* Only one client per window may select for touch events on the
|
||||||
* same devices, including master devices.
|
* same devices, including master devices.
|
||||||
* XXX: This breaks if a device goes from floating to attached. */
|
* 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);
|
OtherInputMasks *inputMasks = wOtherInputMasks(win);
|
||||||
InputClients *iclient = NULL;
|
InputClients *iclient = NULL;
|
||||||
|
|
||||||
if (inputMasks)
|
if (inputMasks)
|
||||||
iclient = inputMasks->inputClients;
|
iclient = inputMasks->inputClients;
|
||||||
for (; iclient; iclient = iclient->next)
|
for (; iclient; iclient = iclient->next) {
|
||||||
{
|
|
||||||
DeviceIntPtr dummy;
|
DeviceIntPtr dummy;
|
||||||
|
|
||||||
if (CLIENT_ID(iclient->resource) == client->index)
|
if (CLIENT_ID(iclient->resource) == client->index)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
dixLookupDevice(&dummy, evmask->deviceid, serverClient, DixReadAccess);
|
dixLookupDevice(&dummy, evmask->deviceid, serverClient,
|
||||||
|
DixReadAccess);
|
||||||
if (!dummy)
|
if (!dummy)
|
||||||
return BadImplementation; /* this shouldn't happen */
|
return BadImplementation; /* this shouldn't happen */
|
||||||
|
|
||||||
|
|
@ -202,7 +195,9 @@ ProcXISelectEvents(ClientPtr client)
|
||||||
evmask->mask_len * 4) != Success)
|
evmask->mask_len * 4) != Success)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
|
|
||||||
evmask = (xXIEventMask*)(((unsigned char*)evmask) + evmask->mask_len * 4);
|
evmask =
|
||||||
|
(xXIEventMask *) (((unsigned char *) evmask) +
|
||||||
|
evmask->mask_len * 4);
|
||||||
evmask++;
|
evmask++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -212,19 +207,20 @@ ProcXISelectEvents(ClientPtr client)
|
||||||
/* Set masks on window */
|
/* Set masks on window */
|
||||||
evmask = (xXIEventMask *) & stuff[1];
|
evmask = (xXIEventMask *) & stuff[1];
|
||||||
num_masks = stuff->num_masks;
|
num_masks = stuff->num_masks;
|
||||||
while(num_masks--)
|
while (num_masks--) {
|
||||||
{
|
|
||||||
if (evmask->deviceid == XIAllDevices ||
|
if (evmask->deviceid == XIAllDevices ||
|
||||||
evmask->deviceid == XIAllMasterDevices)
|
evmask->deviceid == XIAllMasterDevices) {
|
||||||
{
|
|
||||||
dummy.id = evmask->deviceid;
|
dummy.id = evmask->deviceid;
|
||||||
dev = &dummy;
|
dev = &dummy;
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
dixLookupDevice(&dev, evmask->deviceid, client, DixUseAccess);
|
dixLookupDevice(&dev, evmask->deviceid, client, DixUseAccess);
|
||||||
if (XISetEventMask(dev, win, client, evmask->mask_len * 4,
|
if (XISetEventMask(dev, win, client, evmask->mask_len * 4,
|
||||||
(unsigned char *) &evmask[1]) != Success)
|
(unsigned char *) &evmask[1]) != Success)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
evmask = (xXIEventMask*)(((unsigned char*)evmask) + evmask->mask_len * 4);
|
evmask =
|
||||||
|
(xXIEventMask *) (((unsigned char *) evmask) +
|
||||||
|
evmask->mask_len * 4);
|
||||||
evmask++;
|
evmask++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -234,7 +230,6 @@ ProcXISelectEvents(ClientPtr client)
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
SProcXIGetSelectedEvents(ClientPtr client)
|
SProcXIGetSelectedEvents(ClientPtr client)
|
||||||
{
|
{
|
||||||
|
|
@ -272,8 +267,7 @@ ProcXIGetSelectedEvents(ClientPtr client)
|
||||||
reply.num_masks = 0;
|
reply.num_masks = 0;
|
||||||
|
|
||||||
masks = wOtherInputMasks(win);
|
masks = wOtherInputMasks(win);
|
||||||
if (masks)
|
if (masks) {
|
||||||
{
|
|
||||||
for (others = wOtherInputMasks(win)->inputClients; others;
|
for (others = wOtherInputMasks(win)->inputClients; others;
|
||||||
others = others->next) {
|
others = others->next) {
|
||||||
if (SameClient(others, client)) {
|
if (SameClient(others, client)) {
|
||||||
|
|
@ -282,42 +276,37 @@ ProcXIGetSelectedEvents(ClientPtr client)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!others)
|
if (!others) {
|
||||||
{
|
|
||||||
WriteReplyToClient(client, sizeof(xXIGetSelectedEventsReply), &reply);
|
WriteReplyToClient(client, sizeof(xXIGetSelectedEventsReply), &reply);
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer = calloc(MAXDEVICES, sizeof(xXIEventMask) + pad_to_int32(XI2MASKSIZE));
|
buffer =
|
||||||
|
calloc(MAXDEVICES, sizeof(xXIEventMask) + pad_to_int32(XI2MASKSIZE));
|
||||||
if (!buffer)
|
if (!buffer)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
|
||||||
evmask = (xXIEventMask *) buffer;
|
evmask = (xXIEventMask *) buffer;
|
||||||
for (i = 0; i < MAXDEVICES; i++)
|
for (i = 0; i < MAXDEVICES; i++) {
|
||||||
{
|
|
||||||
int j;
|
int j;
|
||||||
const unsigned char *devmask = xi2mask_get_one_mask(others->xi2mask, i);
|
const unsigned char *devmask = xi2mask_get_one_mask(others->xi2mask, i);
|
||||||
|
|
||||||
if (i > 2)
|
if (i > 2) {
|
||||||
{
|
|
||||||
rc = dixLookupDevice(&dev, i, client, DixGetAttrAccess);
|
rc = dixLookupDevice(&dev, i, client, DixGetAttrAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (j = xi2mask_mask_size(others->xi2mask) - 1; j >= 0; j--) {
|
||||||
for (j = xi2mask_mask_size(others->xi2mask) - 1; j >= 0; j--)
|
if (devmask[j] != 0) {
|
||||||
{
|
|
||||||
if (devmask[j] != 0)
|
|
||||||
{
|
|
||||||
int mask_len = (j + 4) / 4; /* j is an index, hence + 4, not + 3 */
|
int mask_len = (j + 4) / 4; /* j is an index, hence + 4, not + 3 */
|
||||||
|
|
||||||
evmask->deviceid = i;
|
evmask->deviceid = i;
|
||||||
evmask->mask_len = mask_len;
|
evmask->mask_len = mask_len;
|
||||||
reply.num_masks++;
|
reply.num_masks++;
|
||||||
reply.length += sizeof(xXIEventMask) / 4 + evmask->mask_len;
|
reply.length += sizeof(xXIEventMask) / 4 + evmask->mask_len;
|
||||||
|
|
||||||
if (client->swapped)
|
if (client->swapped) {
|
||||||
{
|
|
||||||
swaps(&evmask->deviceid);
|
swaps(&evmask->deviceid);
|
||||||
swaps(&evmask->mask_len);
|
swaps(&evmask->mask_len);
|
||||||
}
|
}
|
||||||
|
|
@ -339,7 +328,8 @@ ProcXIGetSelectedEvents(ClientPtr client)
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SRepXIGetSelectedEvents(ClientPtr client,
|
void
|
||||||
|
SRepXIGetSelectedEvents(ClientPtr client,
|
||||||
int len, xXIGetSelectedEventsReply * rep)
|
int len, xXIGetSelectedEventsReply * rep)
|
||||||
{
|
{
|
||||||
swaps(&rep->sequenceNumber);
|
swaps(&rep->sequenceNumber);
|
||||||
|
|
@ -347,5 +337,3 @@ void SRepXIGetSelectedEvents(ClientPtr client,
|
||||||
swaps(&rep->num_masks);
|
swaps(&rep->num_masks);
|
||||||
WriteToClient(client, len, (char *) rep);
|
WriteToClient(client, len, (char *) rep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,6 @@
|
||||||
* default value.
|
* default value.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
#ifdef HAVE_DIX_CONFIG_H
|
||||||
#include <dix-config.h>
|
#include <dix-config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -69,36 +68,32 @@ ProcXISetClientPointer(ClientPtr client)
|
||||||
REQUEST(xXISetClientPointerReq);
|
REQUEST(xXISetClientPointerReq);
|
||||||
REQUEST_SIZE_MATCH(xXISetClientPointerReq);
|
REQUEST_SIZE_MATCH(xXISetClientPointerReq);
|
||||||
|
|
||||||
|
|
||||||
rc = dixLookupDevice(&pDev, stuff->deviceid, client, DixManageAccess);
|
rc = dixLookupDevice(&pDev, stuff->deviceid, client, DixManageAccess);
|
||||||
if (rc != Success)
|
if (rc != Success) {
|
||||||
{
|
|
||||||
client->errorValue = stuff->deviceid;
|
client->errorValue = stuff->deviceid;
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IsMaster(pDev))
|
if (!IsMaster(pDev)) {
|
||||||
{
|
|
||||||
client->errorValue = stuff->deviceid;
|
client->errorValue = stuff->deviceid;
|
||||||
return BadDevice;
|
return BadDevice;
|
||||||
}
|
}
|
||||||
|
|
||||||
pDev = GetMaster(pDev, MASTER_POINTER);
|
pDev = GetMaster(pDev, MASTER_POINTER);
|
||||||
|
|
||||||
if (stuff->win != None)
|
if (stuff->win != None) {
|
||||||
{
|
|
||||||
rc = dixLookupClient(&targetClient, stuff->win, client,
|
rc = dixLookupClient(&targetClient, stuff->win, client,
|
||||||
DixManageAccess);
|
DixManageAccess);
|
||||||
|
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return BadWindow;
|
return BadWindow;
|
||||||
|
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
targetClient = client;
|
targetClient = client;
|
||||||
|
|
||||||
rc = SetClientPointer(targetClient, pDev);
|
rc = SetClientPointer(targetClient, pDev);
|
||||||
if (rc != Success)
|
if (rc != Success) {
|
||||||
{
|
|
||||||
client->errorValue = stuff->deviceid;
|
client->errorValue = stuff->deviceid;
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,6 @@
|
||||||
#include "exglobals.h"
|
#include "exglobals.h"
|
||||||
#include "mipointer.h" /* for miPointerUpdateSprite */
|
#include "mipointer.h" /* for miPointerUpdateSprite */
|
||||||
|
|
||||||
|
|
||||||
#include "xiwarppointer.h"
|
#include "xiwarppointer.h"
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
*
|
*
|
||||||
|
|
@ -89,24 +88,20 @@ ProcXIWarpPointer(ClientPtr client)
|
||||||
|
|
||||||
rc = dixLookupDevice(&pDev, stuff->deviceid, client, DixWriteAccess);
|
rc = dixLookupDevice(&pDev, stuff->deviceid, client, DixWriteAccess);
|
||||||
|
|
||||||
if (rc != Success)
|
if (rc != Success) {
|
||||||
{
|
|
||||||
client->errorValue = stuff->deviceid;
|
client->errorValue = stuff->deviceid;
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((!IsMaster(pDev) && !IsFloating(pDev)) ||
|
if ((!IsMaster(pDev) && !IsFloating(pDev)) ||
|
||||||
(IsMaster(pDev) && !IsPointerDevice(pDev)))
|
(IsMaster(pDev) && !IsPointerDevice(pDev))) {
|
||||||
{
|
|
||||||
client->errorValue = stuff->deviceid;
|
client->errorValue = stuff->deviceid;
|
||||||
return BadDevice;
|
return BadDevice;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stuff->dst_win != None)
|
if (stuff->dst_win != None) {
|
||||||
{
|
|
||||||
rc = dixLookupWindow(&dest, stuff->dst_win, client, DixGetAttrAccess);
|
rc = dixLookupWindow(&dest, stuff->dst_win, client, DixGetAttrAccess);
|
||||||
if (rc != Success)
|
if (rc != Success) {
|
||||||
{
|
|
||||||
client->errorValue = stuff->dst_win;
|
client->errorValue = stuff->dst_win;
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
@ -121,14 +116,12 @@ ProcXIWarpPointer(ClientPtr client)
|
||||||
dst_x = stuff->dst_x / (double) (1 << 16);
|
dst_x = stuff->dst_x / (double) (1 << 16);
|
||||||
dst_y = stuff->dst_y / (double) (1 << 16);
|
dst_y = stuff->dst_y / (double) (1 << 16);
|
||||||
|
|
||||||
if (stuff->src_win != None)
|
if (stuff->src_win != None) {
|
||||||
{
|
|
||||||
int winX, winY;
|
int winX, winY;
|
||||||
WindowPtr src;
|
WindowPtr src;
|
||||||
|
|
||||||
rc = dixLookupWindow(&src, stuff->src_win, client, DixGetAttrAccess);
|
rc = dixLookupWindow(&src, stuff->src_win, client, DixGetAttrAccess);
|
||||||
if (rc != Success)
|
if (rc != Success) {
|
||||||
{
|
|
||||||
client->errorValue = stuff->src_win;
|
client->errorValue = stuff->src_win;
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
@ -146,12 +139,12 @@ ProcXIWarpPointer(ClientPtr client)
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dest)
|
if (dest) {
|
||||||
{
|
|
||||||
x = dest->drawable.x;
|
x = dest->drawable.x;
|
||||||
y = dest->drawable.y;
|
y = dest->drawable.y;
|
||||||
newScreen = dest->drawable.pScreen;
|
newScreen = dest->drawable.pScreen;
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
newScreen = pSprite->hotPhys.pScreen;
|
newScreen = pSprite->hotPhys.pScreen;
|
||||||
|
|
||||||
x += dst_x;
|
x += dst_x;
|
||||||
|
|
@ -167,8 +160,7 @@ ProcXIWarpPointer(ClientPtr client)
|
||||||
else if (y > newScreen->height)
|
else if (y > newScreen->height)
|
||||||
y = newScreen->height - 1;
|
y = newScreen->height - 1;
|
||||||
|
|
||||||
if (newScreen == pSprite->hotPhys.pScreen)
|
if (newScreen == pSprite->hotPhys.pScreen) {
|
||||||
{
|
|
||||||
if (x < pSprite->physLimits.x1)
|
if (x < pSprite->physLimits.x1)
|
||||||
x = pSprite->physLimits.x1;
|
x = pSprite->physLimits.x1;
|
||||||
else if (x >= pSprite->physLimits.x2)
|
else if (x >= pSprite->physLimits.x2)
|
||||||
|
|
@ -182,8 +174,8 @@ ProcXIWarpPointer(ClientPtr client)
|
||||||
if (pSprite->hotShape)
|
if (pSprite->hotShape)
|
||||||
ConfineToShape(pDev, pSprite->hotShape, &x, &y);
|
ConfineToShape(pDev, pSprite->hotShape, &x, &y);
|
||||||
(*newScreen->SetCursorPosition) (pDev, newScreen, x, y, TRUE);
|
(*newScreen->SetCursorPosition) (pDev, newScreen, x, y, TRUE);
|
||||||
} else if (!PointerConfinedToScreen(pDev))
|
}
|
||||||
{
|
else if (!PointerConfinedToScreen(pDev)) {
|
||||||
NewCurrentScreen(pDev, newScreen, x, y);
|
NewCurrentScreen(pDev, newScreen, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -196,4 +188,3 @@ ProcXIWarpPointer(ClientPtr client)
|
||||||
here though. */
|
here though. */
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,10 +55,7 @@ compScreenUpdate (ScreenPtr pScreen)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
compBlockHandler (int i,
|
compBlockHandler(int i, pointer blockData, pointer pTimeout, pointer pReadmask)
|
||||||
pointer blockData,
|
|
||||||
pointer pTimeout,
|
|
||||||
pointer pReadmask)
|
|
||||||
{
|
{
|
||||||
ScreenPtr pScreen = screenInfo.screens[i];
|
ScreenPtr pScreen = screenInfo.screens[i];
|
||||||
CompScreenPtr cs = GetCompScreen(pScreen);
|
CompScreenPtr cs = GetCompScreen(pScreen);
|
||||||
|
|
@ -105,8 +102,7 @@ compDestroyDamage (DamagePtr pDamage, void *closure)
|
||||||
}
|
}
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
compMarkWindows(WindowPtr pWin,
|
compMarkWindows(WindowPtr pWin, WindowPtr *ppLayerWin)
|
||||||
WindowPtr *ppLayerWin)
|
|
||||||
{
|
{
|
||||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||||
WindowPtr pLayerWin = pWin;
|
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
|
* Now make sure there's a per-window structure to hang this from
|
||||||
*/
|
*/
|
||||||
if (!cw)
|
if (!cw) {
|
||||||
{
|
|
||||||
cw = malloc(sizeof(CompWindowRec));
|
cw = malloc(sizeof(CompWindowRec));
|
||||||
if (!cw)
|
if (!cw) {
|
||||||
{
|
|
||||||
free(ccw);
|
free(ccw);
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
cw->damage = DamageCreate(compReportDamage,
|
cw->damage = DamageCreate(compReportDamage,
|
||||||
compDestroyDamage,
|
compDestroyDamage,
|
||||||
DamageReportNonEmpty,
|
DamageReportNonEmpty,
|
||||||
FALSE,
|
FALSE, pWin->drawable.pScreen, pWin);
|
||||||
pWin->drawable.pScreen,
|
if (!cw->damage) {
|
||||||
pWin);
|
|
||||||
if (!cw->damage)
|
|
||||||
{
|
|
||||||
free(ccw);
|
free(ccw);
|
||||||
free(cw);
|
free(cw);
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
|
@ -210,13 +201,11 @@ compRedirectWindow (ClientPtr pClient, WindowPtr pWin, int update)
|
||||||
cw->clients = ccw;
|
cw->clients = ccw;
|
||||||
if (!AddResource(ccw->id, CompositeClientWindowType, pWin))
|
if (!AddResource(ccw->id, CompositeClientWindowType, pWin))
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
if (ccw->update == CompositeRedirectManual)
|
if (ccw->update == CompositeRedirectManual) {
|
||||||
{
|
|
||||||
if (!anyMarked)
|
if (!anyMarked)
|
||||||
anyMarked = compMarkWindows(pWin, &pLayerWin);
|
anyMarked = compMarkWindows(pWin, &pLayerWin);
|
||||||
|
|
||||||
if (cw->damageRegistered)
|
if (cw->damageRegistered) {
|
||||||
{
|
|
||||||
DamageUnregister(&pWin->drawable, cw->damage);
|
DamageUnregister(&pWin->drawable, cw->damage);
|
||||||
cw->damageRegistered = FALSE;
|
cw->damageRegistered = FALSE;
|
||||||
}
|
}
|
||||||
|
|
@ -227,8 +216,7 @@ compRedirectWindow (ClientPtr pClient, WindowPtr pWin, int update)
|
||||||
anyMarked = compMarkWindows(pWin, &pLayerWin);
|
anyMarked = compMarkWindows(pWin, &pLayerWin);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!compCheckRedirect (pWin))
|
if (!compCheckRedirect(pWin)) {
|
||||||
{
|
|
||||||
FreeResource(ccw->id, RT_NONE);
|
FreeResource(ccw->id, RT_NONE);
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
|
|
@ -255,13 +243,12 @@ compRestoreWindow (WindowPtr pWin, PixmapPtr pPixmap)
|
||||||
|
|
||||||
if (pGC) {
|
if (pGC) {
|
||||||
ChangeGCVal val;
|
ChangeGCVal val;
|
||||||
|
|
||||||
val.val = IncludeInferiors;
|
val.val = IncludeInferiors;
|
||||||
ChangeGC(NullClient, pGC, GCSubwindowMode, &val);
|
ChangeGC(NullClient, pGC, GCSubwindowMode, &val);
|
||||||
ValidateGC(&pWin->drawable, pGC);
|
ValidateGC(&pWin->drawable, pGC);
|
||||||
(*pGC->ops->CopyArea) (&pPixmap->drawable,
|
(*pGC->ops->CopyArea) (&pPixmap->drawable,
|
||||||
&pWin->drawable,
|
&pWin->drawable, pGC, x, y, w, h, 0, 0);
|
||||||
pGC,
|
|
||||||
x, y, w, h, 0, 0);
|
|
||||||
FreeScratchGC(pGC);
|
FreeScratchGC(pGC);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -283,10 +270,8 @@ compFreeClientWindow (WindowPtr pWin, XID id)
|
||||||
|
|
||||||
if (!cw)
|
if (!cw)
|
||||||
return;
|
return;
|
||||||
for (prev = &cw->clients; (ccw = *prev); prev = &ccw->next)
|
for (prev = &cw->clients; (ccw = *prev); prev = &ccw->next) {
|
||||||
{
|
if (ccw->id == id) {
|
||||||
if (ccw->id == id)
|
|
||||||
{
|
|
||||||
*prev = ccw->next;
|
*prev = ccw->next;
|
||||||
if (ccw->update == CompositeRedirectManual)
|
if (ccw->update == CompositeRedirectManual)
|
||||||
cw->update = CompositeRedirectAutomatic;
|
cw->update = CompositeRedirectAutomatic;
|
||||||
|
|
@ -294,8 +279,7 @@ compFreeClientWindow (WindowPtr pWin, XID id)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!cw->clients)
|
if (!cw->clients) {
|
||||||
{
|
|
||||||
anyMarked = compMarkWindows(pWin, &pLayerWin);
|
anyMarked = compMarkWindows(pWin, &pLayerWin);
|
||||||
|
|
||||||
if (pWin->redirectDraw != RedirectDrawNone) {
|
if (pWin->redirectDraw != RedirectDrawNone) {
|
||||||
|
|
@ -312,8 +296,7 @@ compFreeClientWindow (WindowPtr pWin, XID id)
|
||||||
free(cw);
|
free(cw);
|
||||||
}
|
}
|
||||||
else if (cw->update == CompositeRedirectAutomatic &&
|
else if (cw->update == CompositeRedirectAutomatic &&
|
||||||
!cw->damageRegistered && pWin->redirectDraw != RedirectDrawNone)
|
!cw->damageRegistered && pWin->redirectDraw != RedirectDrawNone) {
|
||||||
{
|
|
||||||
anyMarked = compMarkWindows(pWin, &pLayerWin);
|
anyMarked = compMarkWindows(pWin, &pLayerWin);
|
||||||
|
|
||||||
DamageRegister(&pWin->drawable, cw->damage);
|
DamageRegister(&pWin->drawable, cw->damage);
|
||||||
|
|
@ -345,8 +328,7 @@ compUnredirectWindow (ClientPtr pClient, WindowPtr pWin, int update)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
|
|
||||||
for (ccw = cw->clients; ccw; ccw = ccw->next)
|
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);
|
FreeResource(ccw->id, RT_NONE);
|
||||||
return Success;
|
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
|
* Now make sure there's a per-window structure to hang this from
|
||||||
*/
|
*/
|
||||||
if (!csw)
|
if (!csw) {
|
||||||
{
|
|
||||||
csw = malloc(sizeof(CompSubwindowsRec));
|
csw = malloc(sizeof(CompSubwindowsRec));
|
||||||
if (!csw)
|
if (!csw) {
|
||||||
{
|
|
||||||
free(ccw);
|
free(ccw);
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
|
|
@ -399,15 +379,13 @@ compRedirectSubwindows (ClientPtr pClient, WindowPtr pWin, int update)
|
||||||
/*
|
/*
|
||||||
* Redirect all existing windows
|
* 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);
|
int ret = compRedirectWindow(pClient, pChild, update);
|
||||||
if (ret != Success)
|
|
||||||
{
|
if (ret != Success) {
|
||||||
for (pChild = pChild->nextSib; pChild; pChild = pChild->nextSib)
|
for (pChild = pChild->nextSib; pChild; pChild = pChild->nextSib)
|
||||||
(void) compUnredirectWindow(pClient, pChild, update);
|
(void) compUnredirectWindow(pClient, pChild, update);
|
||||||
if (!csw->clients)
|
if (!csw->clients) {
|
||||||
{
|
|
||||||
free(csw);
|
free(csw);
|
||||||
dixSetPrivate(&pWin->devPrivates, CompSubwindowsPrivateKey, 0);
|
dixSetPrivate(&pWin->devPrivates, CompSubwindowsPrivateKey, 0);
|
||||||
}
|
}
|
||||||
|
|
@ -422,8 +400,7 @@ compRedirectSubwindows (ClientPtr pClient, WindowPtr pWin, int update)
|
||||||
csw->clients = ccw;
|
csw->clients = ccw;
|
||||||
if (!AddResource(ccw->id, CompositeClientSubwindowsType, pWin))
|
if (!AddResource(ccw->id, CompositeClientSubwindowsType, pWin))
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
if (ccw->update == CompositeRedirectManual)
|
if (ccw->update == CompositeRedirectManual) {
|
||||||
{
|
|
||||||
csw->update = CompositeRedirectManual;
|
csw->update = CompositeRedirectManual;
|
||||||
/*
|
/*
|
||||||
* tell damage extension that damage events for this client are
|
* tell damage extension that damage events for this client are
|
||||||
|
|
@ -448,15 +425,12 @@ compFreeClientSubwindows (WindowPtr pWin, XID id)
|
||||||
|
|
||||||
if (!csw)
|
if (!csw)
|
||||||
return;
|
return;
|
||||||
for (prev = &csw->clients; (ccw = *prev); prev = &ccw->next)
|
for (prev = &csw->clients; (ccw = *prev); prev = &ccw->next) {
|
||||||
{
|
if (ccw->id == id) {
|
||||||
if (ccw->id == id)
|
|
||||||
{
|
|
||||||
ClientPtr pClient = clients[CLIENT_ID(id)];
|
ClientPtr pClient = clients[CLIENT_ID(id)];
|
||||||
|
|
||||||
*prev = ccw->next;
|
*prev = ccw->next;
|
||||||
if (ccw->update == CompositeRedirectManual)
|
if (ccw->update == CompositeRedirectManual) {
|
||||||
{
|
|
||||||
/*
|
/*
|
||||||
* tell damage extension that damage events for this client are
|
* tell damage extension that damage events for this client are
|
||||||
* critical output
|
* critical output
|
||||||
|
|
@ -465,7 +439,8 @@ compFreeClientSubwindows (WindowPtr pWin, XID id)
|
||||||
csw->update = CompositeRedirectAutomatic;
|
csw->update = CompositeRedirectAutomatic;
|
||||||
pWin->inhibitBGPaint = FALSE;
|
pWin->inhibitBGPaint = FALSE;
|
||||||
if (pWin->mapped)
|
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
|
* Check if all of the per-client records are gone
|
||||||
*/
|
*/
|
||||||
if (!csw->clients)
|
if (!csw->clients) {
|
||||||
{
|
|
||||||
dixSetPrivate(&pWin->devPrivates, CompSubwindowsPrivateKey, NULL);
|
dixSetPrivate(&pWin->devPrivates, CompSubwindowsPrivateKey, NULL);
|
||||||
free(csw);
|
free(csw);
|
||||||
}
|
}
|
||||||
|
|
@ -502,8 +476,7 @@ compUnredirectSubwindows (ClientPtr pClient, WindowPtr pWin, int update)
|
||||||
if (!csw)
|
if (!csw)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
for (ccw = csw->clients; ccw; ccw = ccw->next)
|
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);
|
FreeResource(ccw->id, RT_NONE);
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
@ -522,10 +495,10 @@ compRedirectOneSubwindow (WindowPtr pParent, WindowPtr pWin)
|
||||||
|
|
||||||
if (!csw)
|
if (!csw)
|
||||||
return Success;
|
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)],
|
int ret = compRedirectWindow(clients[CLIENT_ID(ccw->id)],
|
||||||
pWin, ccw->update);
|
pWin, ccw->update);
|
||||||
|
|
||||||
if (ret != Success)
|
if (ret != Success)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
@ -544,10 +517,10 @@ compUnredirectOneSubwindow (WindowPtr pParent, WindowPtr pWin)
|
||||||
|
|
||||||
if (!csw)
|
if (!csw)
|
||||||
return Success;
|
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)],
|
int ret = compUnredirectWindow(clients[CLIENT_ID(ccw->id)],
|
||||||
pWin, ccw->update);
|
pWin, ccw->update);
|
||||||
|
|
||||||
if (ret != Success)
|
if (ret != Success)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
@ -570,13 +543,12 @@ compNewPixmap (WindowPtr pWin, int x, int y, int w, int h)
|
||||||
pPixmap->screen_x = x;
|
pPixmap->screen_x = x;
|
||||||
pPixmap->screen_y = y;
|
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);
|
GCPtr pGC = GetScratchGC(pWin->drawable.depth, pScreen);
|
||||||
|
|
||||||
if (pGC)
|
if (pGC) {
|
||||||
{
|
|
||||||
ChangeGCVal val;
|
ChangeGCVal val;
|
||||||
|
|
||||||
val.val = IncludeInferiors;
|
val.val = IncludeInferiors;
|
||||||
ChangeGC(NullClient, pGC, GCSubwindowMode, &val);
|
ChangeGC(NullClient, pGC, GCSubwindowMode, &val);
|
||||||
ValidateGC(&pPixmap->drawable, pGC);
|
ValidateGC(&pPixmap->drawable, pGC);
|
||||||
|
|
@ -584,13 +556,11 @@ compNewPixmap (WindowPtr pWin, int x, int y, int w, int h)
|
||||||
&pPixmap->drawable,
|
&pPixmap->drawable,
|
||||||
pGC,
|
pGC,
|
||||||
x - pParent->drawable.x,
|
x - pParent->drawable.x,
|
||||||
y - pParent->drawable.y,
|
y - pParent->drawable.y, w, h, 0, 0);
|
||||||
w, h, 0, 0);
|
|
||||||
FreeScratchGC(pGC);
|
FreeScratchGC(pGC);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
PictFormatPtr pSrcFormat = compWindowFormat(pParent);
|
PictFormatPtr pSrcFormat = compWindowFormat(pParent);
|
||||||
PictFormatPtr pDstFormat = compWindowFormat(pWin);
|
PictFormatPtr pDstFormat = compWindowFormat(pWin);
|
||||||
XID inferiors = IncludeInferiors;
|
XID inferiors = IncludeInferiors;
|
||||||
|
|
@ -609,15 +579,13 @@ compNewPixmap (WindowPtr pWin, int x, int y, int w, int h)
|
||||||
0, 0,
|
0, 0,
|
||||||
serverClient, &error);
|
serverClient, &error);
|
||||||
|
|
||||||
if (pSrcPicture && pDstPicture)
|
if (pSrcPicture && pDstPicture) {
|
||||||
{
|
|
||||||
CompositePicture(PictOpSrc,
|
CompositePicture(PictOpSrc,
|
||||||
pSrcPicture,
|
pSrcPicture,
|
||||||
NULL,
|
NULL,
|
||||||
pDstPicture,
|
pDstPicture,
|
||||||
x - pParent->drawable.x,
|
x - pParent->drawable.x,
|
||||||
y - pParent->drawable.y,
|
y - pParent->drawable.y, 0, 0, 0, 0, w, h);
|
||||||
0, 0, 0, 0, w, h);
|
|
||||||
}
|
}
|
||||||
if (pSrcPicture)
|
if (pSrcPicture)
|
||||||
FreePicture(pSrcPicture, 0);
|
FreePicture(pSrcPicture, 0);
|
||||||
|
|
@ -649,8 +617,7 @@ compAllocPixmap (WindowPtr pWin)
|
||||||
cw->oldx = COMP_ORIGIN_INVALID;
|
cw->oldx = COMP_ORIGIN_INVALID;
|
||||||
cw->oldy = COMP_ORIGIN_INVALID;
|
cw->oldy = COMP_ORIGIN_INVALID;
|
||||||
cw->damageRegistered = FALSE;
|
cw->damageRegistered = FALSE;
|
||||||
if (cw->update == CompositeRedirectAutomatic)
|
if (cw->update == CompositeRedirectAutomatic) {
|
||||||
{
|
|
||||||
DamageRegister(&pWin->drawable, cw->damage);
|
DamageRegister(&pWin->drawable, cw->damage);
|
||||||
cw->damageRegistered = TRUE;
|
cw->damageRegistered = TRUE;
|
||||||
}
|
}
|
||||||
|
|
@ -671,8 +638,7 @@ compSetParentPixmap (WindowPtr pWin)
|
||||||
PixmapPtr pParentPixmap;
|
PixmapPtr pParentPixmap;
|
||||||
CompWindowPtr cw = GetCompWindow(pWin);
|
CompWindowPtr cw = GetCompWindow(pWin);
|
||||||
|
|
||||||
if (cw->damageRegistered)
|
if (cw->damageRegistered) {
|
||||||
{
|
|
||||||
DamageUnregister(&pWin->drawable, cw->damage);
|
DamageUnregister(&pWin->drawable, cw->damage);
|
||||||
cw->damageRegistered = FALSE;
|
cw->damageRegistered = FALSE;
|
||||||
DamageEmpty(cw->damage);
|
DamageEmpty(cw->damage);
|
||||||
|
|
@ -712,16 +678,14 @@ compReallocPixmap (WindowPtr pWin, int draw_x, int draw_y,
|
||||||
pix_y = draw_y - bw;
|
pix_y = draw_y - bw;
|
||||||
pix_w = w + (bw << 1);
|
pix_w = w + (bw << 1);
|
||||||
pix_h = h + (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);
|
pNew = compNewPixmap(pWin, pix_x, pix_y, pix_w, pix_h);
|
||||||
if (!pNew)
|
if (!pNew)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
cw->pOldPixmap = pOld;
|
cw->pOldPixmap = pOld;
|
||||||
compSetPixmap(pWin, pNew);
|
compSetPixmap(pWin, pNew);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
pNew = pOld;
|
pNew = pOld;
|
||||||
cw->pOldPixmap = 0;
|
cw->pOldPixmap = 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,7 @@
|
||||||
|
|
||||||
static CARD8 CompositeReqCode;
|
static CARD8 CompositeReqCode;
|
||||||
static DevPrivateKeyRec CompositeClientPrivateKeyRec;
|
static DevPrivateKeyRec CompositeClientPrivateKeyRec;
|
||||||
|
|
||||||
#define CompositeClientPrivateKey (&CompositeClientPrivateKeyRec)
|
#define CompositeClientPrivateKey (&CompositeClientPrivateKeyRec)
|
||||||
RESTYPE CompositeClientWindowType;
|
RESTYPE CompositeClientWindowType;
|
||||||
RESTYPE CompositeClientSubwindowsType;
|
RESTYPE CompositeClientSubwindowsType;
|
||||||
|
|
@ -65,9 +66,7 @@ typedef struct _CompositeClient {
|
||||||
dixLookupPrivate(&(pClient)->devPrivates, CompositeClientPrivateKey))
|
dixLookupPrivate(&(pClient)->devPrivates, CompositeClientPrivateKey))
|
||||||
|
|
||||||
static void
|
static void
|
||||||
CompositeClientCallback (CallbackListPtr *list,
|
CompositeClientCallback(CallbackListPtr *list, pointer closure, pointer data)
|
||||||
pointer closure,
|
|
||||||
pointer data)
|
|
||||||
{
|
{
|
||||||
NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
|
NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
|
||||||
ClientPtr pClient = clientinfo->client;
|
ClientPtr pClient = clientinfo->client;
|
||||||
|
|
@ -109,6 +108,7 @@ ProcCompositeQueryVersion (ClientPtr client)
|
||||||
{
|
{
|
||||||
CompositeClientPtr pCompositeClient = GetCompositeClient(client);
|
CompositeClientPtr pCompositeClient = GetCompositeClient(client);
|
||||||
xCompositeQueryVersionReply rep;
|
xCompositeQueryVersionReply rep;
|
||||||
|
|
||||||
REQUEST(xCompositeQueryVersionReq);
|
REQUEST(xCompositeQueryVersionReq);
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xCompositeQueryVersionReq);
|
REQUEST_SIZE_MATCH(xCompositeQueryVersionReq);
|
||||||
|
|
@ -118,7 +118,8 @@ ProcCompositeQueryVersion (ClientPtr client)
|
||||||
if (stuff->majorVersion < SERVER_COMPOSITE_MAJOR_VERSION) {
|
if (stuff->majorVersion < SERVER_COMPOSITE_MAJOR_VERSION) {
|
||||||
rep.majorVersion = stuff->majorVersion;
|
rep.majorVersion = stuff->majorVersion;
|
||||||
rep.minorVersion = stuff->minorVersion;
|
rep.minorVersion = stuff->minorVersion;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
rep.majorVersion = SERVER_COMPOSITE_MAJOR_VERSION;
|
rep.majorVersion = SERVER_COMPOSITE_MAJOR_VERSION;
|
||||||
rep.minorVersion = SERVER_COMPOSITE_MINOR_VERSION;
|
rep.minorVersion = SERVER_COMPOSITE_MINOR_VERSION;
|
||||||
}
|
}
|
||||||
|
|
@ -149,6 +150,7 @@ static int
|
||||||
ProcCompositeRedirectWindow(ClientPtr client)
|
ProcCompositeRedirectWindow(ClientPtr client)
|
||||||
{
|
{
|
||||||
WindowPtr pWin;
|
WindowPtr pWin;
|
||||||
|
|
||||||
REQUEST(xCompositeRedirectWindowReq);
|
REQUEST(xCompositeRedirectWindowReq);
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xCompositeRedirectWindowReq);
|
REQUEST_SIZE_MATCH(xCompositeRedirectWindowReq);
|
||||||
|
|
@ -162,6 +164,7 @@ static int
|
||||||
ProcCompositeRedirectSubwindows(ClientPtr client)
|
ProcCompositeRedirectSubwindows(ClientPtr client)
|
||||||
{
|
{
|
||||||
WindowPtr pWin;
|
WindowPtr pWin;
|
||||||
|
|
||||||
REQUEST(xCompositeRedirectSubwindowsReq);
|
REQUEST(xCompositeRedirectSubwindowsReq);
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xCompositeRedirectSubwindowsReq);
|
REQUEST_SIZE_MATCH(xCompositeRedirectSubwindowsReq);
|
||||||
|
|
@ -175,6 +178,7 @@ static int
|
||||||
ProcCompositeUnredirectWindow(ClientPtr client)
|
ProcCompositeUnredirectWindow(ClientPtr client)
|
||||||
{
|
{
|
||||||
WindowPtr pWin;
|
WindowPtr pWin;
|
||||||
|
|
||||||
REQUEST(xCompositeUnredirectWindowReq);
|
REQUEST(xCompositeUnredirectWindowReq);
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xCompositeUnredirectWindowReq);
|
REQUEST_SIZE_MATCH(xCompositeUnredirectWindowReq);
|
||||||
|
|
@ -188,6 +192,7 @@ static int
|
||||||
ProcCompositeUnredirectSubwindows(ClientPtr client)
|
ProcCompositeUnredirectSubwindows(ClientPtr client)
|
||||||
{
|
{
|
||||||
WindowPtr pWin;
|
WindowPtr pWin;
|
||||||
|
|
||||||
REQUEST(xCompositeUnredirectSubwindowsReq);
|
REQUEST(xCompositeUnredirectSubwindowsReq);
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xCompositeUnredirectSubwindowsReq);
|
REQUEST_SIZE_MATCH(xCompositeUnredirectSubwindowsReq);
|
||||||
|
|
@ -203,6 +208,7 @@ ProcCompositeCreateRegionFromBorderClip (ClientPtr client)
|
||||||
WindowPtr pWin;
|
WindowPtr pWin;
|
||||||
CompWindowPtr cw;
|
CompWindowPtr cw;
|
||||||
RegionPtr pBorderClip, pRegion;
|
RegionPtr pBorderClip, pRegion;
|
||||||
|
|
||||||
REQUEST(xCompositeCreateRegionFromBorderClipReq);
|
REQUEST(xCompositeCreateRegionFromBorderClipReq);
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xCompositeCreateRegionFromBorderClipReq);
|
REQUEST_SIZE_MATCH(xCompositeCreateRegionFromBorderClipReq);
|
||||||
|
|
@ -232,6 +238,7 @@ ProcCompositeNameWindowPixmap (ClientPtr client)
|
||||||
CompWindowPtr cw;
|
CompWindowPtr cw;
|
||||||
PixmapPtr pPixmap;
|
PixmapPtr pPixmap;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
REQUEST(xCompositeNameWindowPixmapReq);
|
REQUEST(xCompositeNameWindowPixmapReq);
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xCompositeNameWindowPixmapReq);
|
REQUEST_SIZE_MATCH(xCompositeNameWindowPixmapReq);
|
||||||
|
|
@ -264,7 +271,6 @@ ProcCompositeNameWindowPixmap (ClientPtr client)
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ProcCompositeGetOverlayWindow(ClientPtr client)
|
ProcCompositeGetOverlayWindow(ClientPtr client)
|
||||||
{
|
{
|
||||||
|
|
@ -293,16 +299,14 @@ ProcCompositeGetOverlayWindow (ClientPtr client)
|
||||||
*/
|
*/
|
||||||
cs = GetCompScreen(pScreen);
|
cs = GetCompScreen(pScreen);
|
||||||
if (cs->pOverlayWin == NULL)
|
if (cs->pOverlayWin == NULL)
|
||||||
if (!compCreateOverlayWindow(pScreen))
|
if (!compCreateOverlayWindow(pScreen)) {
|
||||||
{
|
|
||||||
FreeResource(pOc->resource, RT_NONE);
|
FreeResource(pOc->resource, RT_NONE);
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = XaceHook(XACE_RESOURCE_ACCESS, client, cs->pOverlayWin->drawable.id,
|
rc = XaceHook(XACE_RESOURCE_ACCESS, client, cs->pOverlayWin->drawable.id,
|
||||||
RT_WINDOW, cs->pOverlayWin, RT_NONE, NULL, DixGetAttrAccess);
|
RT_WINDOW, cs->pOverlayWin, RT_NONE, NULL, DixGetAttrAccess);
|
||||||
if (rc != Success)
|
if (rc != Success) {
|
||||||
{
|
|
||||||
FreeResource(pOc->resource, RT_NONE);
|
FreeResource(pOc->resource, RT_NONE);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
@ -312,13 +316,13 @@ ProcCompositeGetOverlayWindow (ClientPtr client)
|
||||||
rep.length = 0;
|
rep.length = 0;
|
||||||
rep.overlayWin = cs->pOverlayWin->drawable.id;
|
rep.overlayWin = cs->pOverlayWin->drawable.id;
|
||||||
|
|
||||||
if (client->swapped)
|
if (client->swapped) {
|
||||||
{
|
|
||||||
swaps(&rep.sequenceNumber);
|
swaps(&rep.sequenceNumber);
|
||||||
swapl(&rep.length);
|
swapl(&rep.length);
|
||||||
swapl(&rep.overlayWin);
|
swapl(&rep.overlayWin);
|
||||||
}
|
}
|
||||||
(void) WriteToClient(client, sz_xCompositeGetOverlayWindowReply, (char *)&rep);
|
(void) WriteToClient(client, sz_xCompositeGetOverlayWindowReply,
|
||||||
|
(char *) &rep);
|
||||||
|
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
@ -357,9 +361,7 @@ static int (*ProcCompositeVector[CompositeNumberRequests])(ClientPtr) = {
|
||||||
ProcCompositeUnredirectSubwindows,
|
ProcCompositeUnredirectSubwindows,
|
||||||
ProcCompositeCreateRegionFromBorderClip,
|
ProcCompositeCreateRegionFromBorderClip,
|
||||||
ProcCompositeNameWindowPixmap,
|
ProcCompositeNameWindowPixmap,
|
||||||
ProcCompositeGetOverlayWindow,
|
ProcCompositeGetOverlayWindow, ProcCompositeReleaseOverlayWindow,};
|
||||||
ProcCompositeReleaseOverlayWindow,
|
|
||||||
};
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ProcCompositeDispatch(ClientPtr client)
|
ProcCompositeDispatch(ClientPtr client)
|
||||||
|
|
@ -482,9 +484,7 @@ static int (*SProcCompositeVector[CompositeNumberRequests])(ClientPtr) = {
|
||||||
SProcCompositeUnredirectSubwindows,
|
SProcCompositeUnredirectSubwindows,
|
||||||
SProcCompositeCreateRegionFromBorderClip,
|
SProcCompositeCreateRegionFromBorderClip,
|
||||||
SProcCompositeNameWindowPixmap,
|
SProcCompositeNameWindowPixmap,
|
||||||
SProcCompositeGetOverlayWindow,
|
SProcCompositeGetOverlayWindow, SProcCompositeReleaseOverlayWindow,};
|
||||||
SProcCompositeReleaseOverlayWindow,
|
|
||||||
};
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
SProcCompositeDispatch(ClientPtr client)
|
SProcCompositeDispatch(ClientPtr client)
|
||||||
|
|
@ -513,8 +513,7 @@ CompositeExtensionInit (void)
|
||||||
/* Composite on 8bpp pseudocolor root windows appears to fail, so
|
/* Composite on 8bpp pseudocolor root windows appears to fail, so
|
||||||
* just disable it on anything pseudocolor for safety.
|
* 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)
|
if ((vis->class | DynamicClass) == PseudoColor)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -575,6 +574,7 @@ PanoramiXCompositeRedirectWindow (ClientPtr client)
|
||||||
{
|
{
|
||||||
PanoramiXRes *win;
|
PanoramiXRes *win;
|
||||||
int rc = 0, j;
|
int rc = 0, j;
|
||||||
|
|
||||||
REQUEST(xCompositeRedirectWindowReq);
|
REQUEST(xCompositeRedirectWindowReq);
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xCompositeRedirectWindowReq);
|
REQUEST_SIZE_MATCH(xCompositeRedirectWindowReq);
|
||||||
|
|
@ -588,7 +588,8 @@ PanoramiXCompositeRedirectWindow (ClientPtr client)
|
||||||
FOR_NSCREENS_FORWARD(j) {
|
FOR_NSCREENS_FORWARD(j) {
|
||||||
stuff->window = win->info[j].id;
|
stuff->window = win->info[j].id;
|
||||||
rc = (*PanoramiXSaveCompositeVector[stuff->compositeReqType]) (client);
|
rc = (*PanoramiXSaveCompositeVector[stuff->compositeReqType]) (client);
|
||||||
if (rc != Success) break;
|
if (rc != Success)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
|
|
@ -599,6 +600,7 @@ PanoramiXCompositeRedirectSubwindows (ClientPtr client)
|
||||||
{
|
{
|
||||||
PanoramiXRes *win;
|
PanoramiXRes *win;
|
||||||
int rc = 0, j;
|
int rc = 0, j;
|
||||||
|
|
||||||
REQUEST(xCompositeRedirectSubwindowsReq);
|
REQUEST(xCompositeRedirectSubwindowsReq);
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xCompositeRedirectSubwindowsReq);
|
REQUEST_SIZE_MATCH(xCompositeRedirectSubwindowsReq);
|
||||||
|
|
@ -612,7 +614,8 @@ PanoramiXCompositeRedirectSubwindows (ClientPtr client)
|
||||||
FOR_NSCREENS_FORWARD(j) {
|
FOR_NSCREENS_FORWARD(j) {
|
||||||
stuff->window = win->info[j].id;
|
stuff->window = win->info[j].id;
|
||||||
rc = (*PanoramiXSaveCompositeVector[stuff->compositeReqType]) (client);
|
rc = (*PanoramiXSaveCompositeVector[stuff->compositeReqType]) (client);
|
||||||
if (rc != Success) break;
|
if (rc != Success)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
|
|
@ -623,6 +626,7 @@ PanoramiXCompositeUnredirectWindow (ClientPtr client)
|
||||||
{
|
{
|
||||||
PanoramiXRes *win;
|
PanoramiXRes *win;
|
||||||
int rc = 0, j;
|
int rc = 0, j;
|
||||||
|
|
||||||
REQUEST(xCompositeUnredirectWindowReq);
|
REQUEST(xCompositeUnredirectWindowReq);
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xCompositeUnredirectWindowReq);
|
REQUEST_SIZE_MATCH(xCompositeUnredirectWindowReq);
|
||||||
|
|
@ -636,7 +640,8 @@ PanoramiXCompositeUnredirectWindow (ClientPtr client)
|
||||||
FOR_NSCREENS_FORWARD(j) {
|
FOR_NSCREENS_FORWARD(j) {
|
||||||
stuff->window = win->info[j].id;
|
stuff->window = win->info[j].id;
|
||||||
rc = (*PanoramiXSaveCompositeVector[stuff->compositeReqType]) (client);
|
rc = (*PanoramiXSaveCompositeVector[stuff->compositeReqType]) (client);
|
||||||
if (rc != Success) break;
|
if (rc != Success)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
|
|
@ -647,6 +652,7 @@ PanoramiXCompositeUnredirectSubwindows (ClientPtr client)
|
||||||
{
|
{
|
||||||
PanoramiXRes *win;
|
PanoramiXRes *win;
|
||||||
int rc = 0, j;
|
int rc = 0, j;
|
||||||
|
|
||||||
REQUEST(xCompositeUnredirectSubwindowsReq);
|
REQUEST(xCompositeUnredirectSubwindowsReq);
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xCompositeUnredirectSubwindowsReq);
|
REQUEST_SIZE_MATCH(xCompositeUnredirectSubwindowsReq);
|
||||||
|
|
@ -660,7 +666,8 @@ PanoramiXCompositeUnredirectSubwindows (ClientPtr client)
|
||||||
FOR_NSCREENS_FORWARD(j) {
|
FOR_NSCREENS_FORWARD(j) {
|
||||||
stuff->window = win->info[j].id;
|
stuff->window = win->info[j].id;
|
||||||
rc = (*PanoramiXSaveCompositeVector[stuff->compositeReqType]) (client);
|
rc = (*PanoramiXSaveCompositeVector[stuff->compositeReqType]) (client);
|
||||||
if (rc != Success) break;
|
if (rc != Success)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
|
|
@ -675,6 +682,7 @@ PanoramiXCompositeNameWindowPixmap (ClientPtr client)
|
||||||
int rc;
|
int rc;
|
||||||
PanoramiXRes *win, *newPix;
|
PanoramiXRes *win, *newPix;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
REQUEST(xCompositeNameWindowPixmapReq);
|
REQUEST(xCompositeNameWindowPixmapReq);
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xCompositeNameWindowPixmapReq);
|
REQUEST_SIZE_MATCH(xCompositeNameWindowPixmapReq);
|
||||||
|
|
@ -697,35 +705,30 @@ PanoramiXCompositeNameWindowPixmap (ClientPtr client)
|
||||||
FOR_NSCREENS(i) {
|
FOR_NSCREENS(i) {
|
||||||
rc = dixLookupResourceByType((void **) &pWin, win->info[i].id,
|
rc = dixLookupResourceByType((void **) &pWin, win->info[i].id,
|
||||||
RT_WINDOW, client, DixGetAttrAccess);
|
RT_WINDOW, client, DixGetAttrAccess);
|
||||||
if (rc != Success)
|
if (rc != Success) {
|
||||||
{
|
|
||||||
client->errorValue = stuff->window;
|
client->errorValue = stuff->window;
|
||||||
free(newPix);
|
free(newPix);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pWin->viewable)
|
if (!pWin->viewable) {
|
||||||
{
|
|
||||||
free(newPix);
|
free(newPix);
|
||||||
return BadMatch;
|
return BadMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
cw = GetCompWindow(pWin);
|
cw = GetCompWindow(pWin);
|
||||||
if (!cw)
|
if (!cw) {
|
||||||
{
|
|
||||||
free(newPix);
|
free(newPix);
|
||||||
return BadMatch;
|
return BadMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
pPixmap = (*pWin->drawable.pScreen->GetWindowPixmap) (pWin);
|
pPixmap = (*pWin->drawable.pScreen->GetWindowPixmap) (pWin);
|
||||||
if (!pPixmap)
|
if (!pPixmap) {
|
||||||
{
|
|
||||||
free(newPix);
|
free(newPix);
|
||||||
return BadMatch;
|
return BadMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!AddResource (newPix->info[i].id, RT_PIXMAP,
|
if (!AddResource(newPix->info[i].id, RT_PIXMAP, (pointer) pPixmap))
|
||||||
(pointer) pPixmap))
|
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
|
||||||
++pPixmap->refcnt;
|
++pPixmap->refcnt;
|
||||||
|
|
@ -737,7 +740,6 @@ PanoramiXCompositeNameWindowPixmap (ClientPtr client)
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
PanoramiXCompositeGetOverlayWindow(ClientPtr client)
|
PanoramiXCompositeGetOverlayWindow(ClientPtr client)
|
||||||
{
|
{
|
||||||
|
|
@ -760,8 +762,7 @@ PanoramiXCompositeGetOverlayWindow (ClientPtr client)
|
||||||
}
|
}
|
||||||
|
|
||||||
cs = GetCompScreen(screenInfo.screens[0]);
|
cs = GetCompScreen(screenInfo.screens[0]);
|
||||||
if (!cs->pOverlayWin)
|
if (!cs->pOverlayWin) {
|
||||||
{
|
|
||||||
if (!(overlayWin = malloc(sizeof(PanoramiXRes))))
|
if (!(overlayWin = malloc(sizeof(PanoramiXRes))))
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
|
||||||
|
|
@ -772,8 +773,7 @@ PanoramiXCompositeGetOverlayWindow (ClientPtr client)
|
||||||
FOR_NSCREENS_BACKWARD(i) {
|
FOR_NSCREENS_BACKWARD(i) {
|
||||||
rc = dixLookupResourceByType((pointer *) &pWin, win->info[i].id,
|
rc = dixLookupResourceByType((pointer *) &pWin, win->info[i].id,
|
||||||
RT_WINDOW, client, DixGetAttrAccess);
|
RT_WINDOW, client, DixGetAttrAccess);
|
||||||
if (rc != Success)
|
if (rc != Success) {
|
||||||
{
|
|
||||||
client->errorValue = stuff->window;
|
client->errorValue = stuff->window;
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
@ -792,8 +792,7 @@ PanoramiXCompositeGetOverlayWindow (ClientPtr client)
|
||||||
*/
|
*/
|
||||||
cs = GetCompScreen(pScreen);
|
cs = GetCompScreen(pScreen);
|
||||||
if (cs->pOverlayWin == NULL)
|
if (cs->pOverlayWin == NULL)
|
||||||
if (!compCreateOverlayWindow(pScreen))
|
if (!compCreateOverlayWindow(pScreen)) {
|
||||||
{
|
|
||||||
FreeResource(pOc->resource, RT_NONE);
|
FreeResource(pOc->resource, RT_NONE);
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
|
|
@ -802,15 +801,13 @@ PanoramiXCompositeGetOverlayWindow (ClientPtr client)
|
||||||
cs->pOverlayWin->drawable.id,
|
cs->pOverlayWin->drawable.id,
|
||||||
RT_WINDOW, cs->pOverlayWin, RT_NONE, NULL,
|
RT_WINDOW, cs->pOverlayWin, RT_NONE, NULL,
|
||||||
DixGetAttrAccess);
|
DixGetAttrAccess);
|
||||||
if (rc != Success)
|
if (rc != Success) {
|
||||||
{
|
|
||||||
FreeResource(pOc->resource, RT_NONE);
|
FreeResource(pOc->resource, RT_NONE);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (overlayWin)
|
if (overlayWin) {
|
||||||
{
|
|
||||||
FOR_NSCREENS(i) {
|
FOR_NSCREENS(i) {
|
||||||
cs = GetCompScreen(screenInfo.screens[i]);
|
cs = GetCompScreen(screenInfo.screens[i]);
|
||||||
overlayWin->info[i].id = cs->pOverlayWin->drawable.id;
|
overlayWin->info[i].id = cs->pOverlayWin->drawable.id;
|
||||||
|
|
@ -826,13 +823,13 @@ PanoramiXCompositeGetOverlayWindow (ClientPtr client)
|
||||||
rep.length = 0;
|
rep.length = 0;
|
||||||
rep.overlayWin = cs->pOverlayWin->drawable.id;
|
rep.overlayWin = cs->pOverlayWin->drawable.id;
|
||||||
|
|
||||||
if (client->swapped)
|
if (client->swapped) {
|
||||||
{
|
|
||||||
swaps(&rep.sequenceNumber);
|
swaps(&rep.sequenceNumber);
|
||||||
swapl(&rep.length);
|
swapl(&rep.length);
|
||||||
swapl(&rep.overlayWin);
|
swapl(&rep.overlayWin);
|
||||||
}
|
}
|
||||||
(void) WriteToClient(client, sz_xCompositeGetOverlayWindowReply, (char *)&rep);
|
(void) WriteToClient(client, sz_xCompositeGetOverlayWindowReply,
|
||||||
|
(char *) &rep);
|
||||||
|
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,8 @@ compChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
|
||||||
if (pWin->backingStore != NotUseful) {
|
if (pWin->backingStore != NotUseful) {
|
||||||
compRedirectWindow(serverClient, pWin, CompositeRedirectAutomatic);
|
compRedirectWindow(serverClient, pWin, CompositeRedirectAutomatic);
|
||||||
pWin->backStorage = (pointer) (intptr_t) 1;
|
pWin->backStorage = (pointer) (intptr_t) 1;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
compUnredirectWindow(serverClient, pWin,
|
compUnredirectWindow(serverClient, pWin,
|
||||||
CompositeRedirectAutomatic);
|
CompositeRedirectAutomatic);
|
||||||
pWin->backStorage = NULL;
|
pWin->backStorage = NULL;
|
||||||
|
|
@ -136,9 +137,7 @@ static void
|
||||||
compGetImage(DrawablePtr pDrawable,
|
compGetImage(DrawablePtr pDrawable,
|
||||||
int sx, int sy,
|
int sx, int sy,
|
||||||
int w, int h,
|
int w, int h,
|
||||||
unsigned int format,
|
unsigned int format, unsigned long planemask, char *pdstLine)
|
||||||
unsigned long planemask,
|
|
||||||
char *pdstLine)
|
|
||||||
{
|
{
|
||||||
ScreenPtr pScreen = pDrawable->pScreen;
|
ScreenPtr pScreen = pDrawable->pScreen;
|
||||||
CompScreenPtr cs = GetCompScreen(pScreen);
|
CompScreenPtr cs = GetCompScreen(pScreen);
|
||||||
|
|
@ -151,10 +150,10 @@ compGetImage (DrawablePtr pDrawable,
|
||||||
pScreen->GetImage = compGetImage;
|
pScreen->GetImage = compGetImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void compSourceValidate(DrawablePtr pDrawable,
|
static void
|
||||||
|
compSourceValidate(DrawablePtr pDrawable,
|
||||||
int x, int y,
|
int x, int y,
|
||||||
int width, int height,
|
int width, int height, unsigned int subWindowMode)
|
||||||
unsigned int subWindowMode)
|
|
||||||
{
|
{
|
||||||
ScreenPtr pScreen = pDrawable->pScreen;
|
ScreenPtr pScreen = pDrawable->pScreen;
|
||||||
CompScreenPtr cs = GetCompScreen(pScreen);
|
CompScreenPtr cs = GetCompScreen(pScreen);
|
||||||
|
|
@ -178,11 +177,10 @@ compFindVisuallessDepth (ScreenPtr pScreen, int d)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < pScreen->numDepths; i++)
|
for (i = 0; i < pScreen->numDepths; i++) {
|
||||||
{
|
|
||||||
DepthPtr depth = &pScreen->allowedDepths[i];
|
DepthPtr depth = &pScreen->allowedDepths[i];
|
||||||
if (depth->depth == d)
|
|
||||||
{
|
if (depth->depth == d) {
|
||||||
/*
|
/*
|
||||||
* Make sure it doesn't have visuals already
|
* Make sure it doesn't have visuals already
|
||||||
*/
|
*/
|
||||||
|
|
@ -222,10 +220,12 @@ compRegisterAlternateVisuals (CompScreenPtr cs, VisualID *vids, int nVisuals)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool CompositeRegisterAlternateVisuals (ScreenPtr pScreen, VisualID *vids,
|
Bool
|
||||||
|
CompositeRegisterAlternateVisuals(ScreenPtr pScreen, VisualID * vids,
|
||||||
int nVisuals)
|
int nVisuals)
|
||||||
{
|
{
|
||||||
CompScreenPtr cs = GetCompScreen(pScreen);
|
CompScreenPtr cs = GetCompScreen(pScreen);
|
||||||
|
|
||||||
return compRegisterAlternateVisuals(cs, vids, nVisuals);
|
return compRegisterAlternateVisuals(cs, vids, nVisuals);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -282,11 +282,14 @@ compAddAlternateVisual(ScreenPtr pScreen, CompScreenPtr cs,
|
||||||
visual->class = PseudoColor;
|
visual->class = PseudoColor;
|
||||||
visual->nplanes = PICT_FORMAT_BPP(alt->format);
|
visual->nplanes = PICT_FORMAT_BPP(alt->format);
|
||||||
visual->ColormapEntries = 1 << visual->nplanes;
|
visual->ColormapEntries = 1 << visual->nplanes;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
DirectFormatRec *direct = &pPictFormat->direct;
|
DirectFormatRec *direct = &pPictFormat->direct;
|
||||||
|
|
||||||
visual->class = TrueColor;
|
visual->class = TrueColor;
|
||||||
visual->redMask = ((unsigned long) direct->redMask) << direct->red;
|
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;
|
visual->blueMask = ((unsigned long) direct->blueMask) << direct->blue;
|
||||||
alphaMask = ((unsigned long) direct->alphaMask) << direct->alpha;
|
alphaMask = ((unsigned long) direct->alphaMask) << direct->alpha;
|
||||||
visual->offsetRed = direct->red;
|
visual->offsetRed = direct->red;
|
||||||
|
|
@ -298,8 +301,7 @@ compAddAlternateVisual(ScreenPtr pScreen, CompScreenPtr cs,
|
||||||
*/
|
*/
|
||||||
visual->nplanes = Ones(visual->redMask |
|
visual->nplanes = Ones(visual->redMask |
|
||||||
visual->greenMask |
|
visual->greenMask |
|
||||||
visual->blueMask |
|
visual->blueMask | alphaMask);
|
||||||
alphaMask);
|
|
||||||
/* find widest component */
|
/* find widest component */
|
||||||
visual->ColormapEntries = (1 << max(Ones(visual->redMask),
|
visual->ColormapEntries = (1 << max(Ones(visual->redMask),
|
||||||
max(Ones(visual->greenMask),
|
max(Ones(visual->greenMask),
|
||||||
|
|
@ -348,8 +350,7 @@ compScreenInit (ScreenPtr pScreen)
|
||||||
cs->numAlternateVisuals = 0;
|
cs->numAlternateVisuals = 0;
|
||||||
cs->alternateVisuals = NULL;
|
cs->alternateVisuals = NULL;
|
||||||
|
|
||||||
if (!compAddAlternateVisuals (pScreen, cs))
|
if (!compAddAlternateVisuals(pScreen, cs)) {
|
||||||
{
|
|
||||||
free(cs);
|
free(cs);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -164,12 +164,15 @@ typedef struct _CompScreen {
|
||||||
} CompScreenRec, *CompScreenPtr;
|
} CompScreenRec, *CompScreenPtr;
|
||||||
|
|
||||||
extern DevPrivateKeyRec CompScreenPrivateKeyRec;
|
extern DevPrivateKeyRec CompScreenPrivateKeyRec;
|
||||||
|
|
||||||
#define CompScreenPrivateKey (&CompScreenPrivateKeyRec)
|
#define CompScreenPrivateKey (&CompScreenPrivateKeyRec)
|
||||||
|
|
||||||
extern DevPrivateKeyRec CompWindowPrivateKeyRec;
|
extern DevPrivateKeyRec CompWindowPrivateKeyRec;
|
||||||
|
|
||||||
#define CompWindowPrivateKey (&CompWindowPrivateKeyRec)
|
#define CompWindowPrivateKey (&CompWindowPrivateKeyRec)
|
||||||
|
|
||||||
extern DevPrivateKeyRec CompSubwindowsPrivateKeyRec;
|
extern DevPrivateKeyRec CompSubwindowsPrivateKeyRec;
|
||||||
|
|
||||||
#define CompSubwindowsPrivateKey (&CompSubwindowsPrivateKeyRec)
|
#define CompSubwindowsPrivateKey (&CompSubwindowsPrivateKeyRec)
|
||||||
|
|
||||||
#define GetCompScreen(s) ((CompScreenPtr) \
|
#define GetCompScreen(s) ((CompScreenPtr) \
|
||||||
|
|
@ -221,6 +224,7 @@ void
|
||||||
compRestoreWindow(WindowPtr pWin, PixmapPtr pPixmap);
|
compRestoreWindow(WindowPtr pWin, PixmapPtr pPixmap);
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
|
|
||||||
compReallocPixmap(WindowPtr pWin, int x, int y,
|
compReallocPixmap(WindowPtr pWin, int x, int y,
|
||||||
unsigned int w, unsigned int h, int bw);
|
unsigned int w, unsigned int h, int bw);
|
||||||
|
|
||||||
|
|
@ -268,8 +272,7 @@ compCheckTree (ScreenPtr pScreen);
|
||||||
#define compCheckTree(s)
|
#define compCheckTree(s)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PictFormatPtr
|
PictFormatPtr compWindowFormat(WindowPtr pWin);
|
||||||
compWindowFormat (WindowPtr pWin);
|
|
||||||
|
|
||||||
void
|
void
|
||||||
compSetPixmap(WindowPtr pWin, PixmapPtr pPixmap);
|
compSetPixmap(WindowPtr pWin, PixmapPtr pPixmap);
|
||||||
|
|
@ -293,6 +296,7 @@ void
|
||||||
compMoveWindow(WindowPtr pWin, int x, int y, WindowPtr pSib, VTKind kind);
|
compMoveWindow(WindowPtr pWin, int x, int y, WindowPtr pSib, VTKind kind);
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
||||||
compResizeWindow(WindowPtr pWin, int x, int y,
|
compResizeWindow(WindowPtr pWin, int x, int y,
|
||||||
unsigned int w, unsigned int h, WindowPtr pSib);
|
unsigned int w, unsigned int h, WindowPtr pSib);
|
||||||
|
|
||||||
|
|
@ -327,6 +331,7 @@ int
|
||||||
DeleteWindowNoInputDevices(pointer value, XID wid);
|
DeleteWindowNoInputDevices(pointer value, XID wid);
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
||||||
compConfigNotify(WindowPtr pWin, int x, int y, int w, int h,
|
compConfigNotify(WindowPtr pWin, int x, int y, int w, int h,
|
||||||
int bw, WindowPtr pSib);
|
int bw, WindowPtr pSib);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,8 +62,7 @@ compFreeOverlayClient (CompOverlayClientPtr pOcToDel)
|
||||||
CompScreenPtr cs = GetCompScreen(pScreen);
|
CompScreenPtr cs = GetCompScreen(pScreen);
|
||||||
CompOverlayClientPtr *pPrev, pOc;
|
CompOverlayClientPtr *pPrev, pOc;
|
||||||
|
|
||||||
for (pPrev = &cs->pOverlayClients; (pOc = *pPrev); pPrev = &pOc->pNext)
|
for (pPrev = &cs->pOverlayClients; (pOc = *pPrev); pPrev = &pOc->pNext) {
|
||||||
{
|
|
||||||
if (pOc == pOcToDel) {
|
if (pOc == pOcToDel) {
|
||||||
*pPrev = pOc->pNext;
|
*pPrev = pOc->pNext;
|
||||||
free(pOc);
|
free(pOc);
|
||||||
|
|
@ -136,8 +135,7 @@ compCreateOverlayWindow (ScreenPtr pScreen)
|
||||||
int h = pScreen->height;
|
int h = pScreen->height;
|
||||||
|
|
||||||
#ifdef PANORAMIX
|
#ifdef PANORAMIX
|
||||||
if (!noPanoramiXExtension)
|
if (!noPanoramiXExtension) {
|
||||||
{
|
|
||||||
w = PanoramiXPixWidth;
|
w = PanoramiXPixWidth;
|
||||||
h = PanoramiXPixHeight;
|
h = PanoramiXPixHeight;
|
||||||
}
|
}
|
||||||
|
|
@ -170,4 +168,3 @@ compDestroyOverlayWindow (ScreenPtr pScreen)
|
||||||
cs->pOverlayWin = NullWindow;
|
cs->pOverlayWin = NullWindow;
|
||||||
FreeResource(cs->overlayWid, RT_NONE);
|
FreeResource(cs->overlayWid, RT_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,21 +57,19 @@ compCheckWindow (WindowPtr pWin, pointer data)
|
||||||
{
|
{
|
||||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||||
PixmapPtr pWinPixmap = (*pScreen->GetWindowPixmap) (pWin);
|
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);
|
PixmapPtr pScreenPixmap = (*pScreen->GetScreenPixmap) (pScreen);
|
||||||
|
|
||||||
if (!pWin->parent)
|
if (!pWin->parent) {
|
||||||
{
|
|
||||||
assert(pWin->redirectDraw == RedirectDrawNone);
|
assert(pWin->redirectDraw == RedirectDrawNone);
|
||||||
assert(pWinPixmap == pScreenPixmap);
|
assert(pWinPixmap == pScreenPixmap);
|
||||||
}
|
}
|
||||||
else if (pWin->redirectDraw != RedirectDrawNone)
|
else if (pWin->redirectDraw != RedirectDrawNone) {
|
||||||
{
|
|
||||||
assert(pWinPixmap != pParentPixmap);
|
assert(pWinPixmap != pParentPixmap);
|
||||||
assert(pWinPixmap != pScreenPixmap);
|
assert(pWinPixmap != pScreenPixmap);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
assert(pWinPixmap == pParentPixmap);
|
assert(pWinPixmap == pParentPixmap);
|
||||||
}
|
}
|
||||||
assert(0 < pWinPixmap->refcnt && pWinPixmap->refcnt < 3);
|
assert(0 < pWinPixmap->refcnt && pWinPixmap->refcnt < 3);
|
||||||
|
|
@ -97,7 +95,9 @@ static Bool
|
||||||
compRepaintBorder(ClientPtr pClient, pointer closure)
|
compRepaintBorder(ClientPtr pClient, pointer closure)
|
||||||
{
|
{
|
||||||
WindowPtr pWindow;
|
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) {
|
if (rc == Success) {
|
||||||
RegionRec exposed;
|
RegionRec exposed;
|
||||||
|
|
@ -160,18 +160,19 @@ compCheckRedirect (WindowPtr pWin)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (should != (pWin->redirectDraw != RedirectDrawNone))
|
if (should != (pWin->redirectDraw != RedirectDrawNone)) {
|
||||||
{
|
|
||||||
if (should)
|
if (should)
|
||||||
return compAllocPixmap(pWin);
|
return compAllocPixmap(pWin);
|
||||||
else {
|
else {
|
||||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||||
PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
|
PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
|
||||||
|
|
||||||
compSetParentPixmap(pWin);
|
compSetParentPixmap(pWin);
|
||||||
compRestoreWindow(pWin, pPixmap);
|
compRestoreWindow(pWin, pPixmap);
|
||||||
(*pScreen->DestroyPixmap) (pPixmap);
|
(*pScreen->DestroyPixmap) (pPixmap);
|
||||||
}
|
}
|
||||||
} else if (should) {
|
}
|
||||||
|
else if (should) {
|
||||||
if (cw->update == CompositeRedirectAutomatic)
|
if (cw->update == CompositeRedirectAutomatic)
|
||||||
pWin->redirectDraw = RedirectDrawAutomatic;
|
pWin->redirectDraw = RedirectDrawAutomatic;
|
||||||
else
|
else
|
||||||
|
|
@ -190,8 +191,7 @@ updateOverlayWindow(ScreenPtr pScreen)
|
||||||
int h = pScreen->height;
|
int h = pScreen->height;
|
||||||
|
|
||||||
#ifdef PANORAMIX
|
#ifdef PANORAMIX
|
||||||
if (!noPanoramiXExtension)
|
if (!noPanoramiXExtension) {
|
||||||
{
|
|
||||||
w = PanoramiXPixWidth;
|
w = PanoramiXPixWidth;
|
||||||
h = PanoramiXPixHeight;
|
h = PanoramiXPixHeight;
|
||||||
}
|
}
|
||||||
|
|
@ -199,8 +199,7 @@ updateOverlayWindow(ScreenPtr pScreen)
|
||||||
|
|
||||||
cs = GetCompScreen(pScreen);
|
cs = GetCompScreen(pScreen);
|
||||||
if ((pWin = cs->pOverlayWin) != NULL) {
|
if ((pWin = cs->pOverlayWin) != NULL) {
|
||||||
if ((pWin->drawable.width == w) &&
|
if ((pWin->drawable.width == w) && (pWin->drawable.height == h))
|
||||||
(pWin->drawable.height == h))
|
|
||||||
return Success;
|
return Success;
|
||||||
|
|
||||||
/* Let's resize the overlay window. */
|
/* Let's resize the overlay window. */
|
||||||
|
|
@ -231,15 +230,13 @@ compPositionWindow (WindowPtr pWin, int x, int y)
|
||||||
(pWin->viewable && (GetCompWindow(pWin) != NULL)))
|
(pWin->viewable && (GetCompWindow(pWin) != NULL)))
|
||||||
OsAbort();
|
OsAbort();
|
||||||
#endif
|
#endif
|
||||||
if (pWin->redirectDraw != RedirectDrawNone)
|
if (pWin->redirectDraw != RedirectDrawNone) {
|
||||||
{
|
|
||||||
PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
|
PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
|
||||||
int bw = wBorderWidth(pWin);
|
int bw = wBorderWidth(pWin);
|
||||||
int nx = pWin->drawable.x - bw;
|
int nx = pWin->drawable.x - bw;
|
||||||
int ny = pWin->drawable.y - 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_x = nx;
|
||||||
pPixmap->screen_y = ny;
|
pPixmap->screen_y = ny;
|
||||||
pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
|
pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
|
||||||
|
|
@ -302,11 +299,9 @@ compClipNotify (WindowPtr pWin, int dx, int dy)
|
||||||
CompScreenPtr cs = GetCompScreen(pScreen);
|
CompScreenPtr cs = GetCompScreen(pScreen);
|
||||||
CompWindowPtr cw = GetCompWindow(pWin);
|
CompWindowPtr cw = GetCompWindow(pWin);
|
||||||
|
|
||||||
if (cw)
|
if (cw) {
|
||||||
{
|
|
||||||
if (cw->borderClipX != pWin->drawable.x ||
|
if (cw->borderClipX != pWin->drawable.x ||
|
||||||
cw->borderClipY != pWin->drawable.y)
|
cw->borderClipY != pWin->drawable.y) {
|
||||||
{
|
|
||||||
RegionTranslate(&cw->borderClip,
|
RegionTranslate(&cw->borderClip,
|
||||||
pWin->drawable.x - cw->borderClipX,
|
pWin->drawable.x - cw->borderClipX,
|
||||||
pWin->drawable.y - cw->borderClipY);
|
pWin->drawable.y - cw->borderClipY);
|
||||||
|
|
@ -314,8 +309,7 @@ compClipNotify (WindowPtr pWin, int dx, int dy)
|
||||||
cw->borderClipY = pWin->drawable.y;
|
cw->borderClipY = pWin->drawable.y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (cs->ClipNotify)
|
if (cs->ClipNotify) {
|
||||||
{
|
|
||||||
pScreen->ClipNotify = cs->ClipNotify;
|
pScreen->ClipNotify = cs->ClipNotify;
|
||||||
(*pScreen->ClipNotify) (pWin, dx, dy);
|
(*pScreen->ClipNotify) (pWin, dx, dy);
|
||||||
cs->ClipNotify = pScreen->ClipNotify;
|
cs->ClipNotify = pScreen->ClipNotify;
|
||||||
|
|
@ -329,8 +323,7 @@ compClipNotify (WindowPtr pWin, int dx, int dy)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
compIsAlternateVisual (ScreenPtr pScreen,
|
compIsAlternateVisual(ScreenPtr pScreen, XID visual)
|
||||||
XID visual)
|
|
||||||
{
|
{
|
||||||
CompScreenPtr cs = GetCompScreen(pScreen);
|
CompScreenPtr cs = GetCompScreen(pScreen);
|
||||||
int i;
|
int i;
|
||||||
|
|
@ -344,8 +337,7 @@ compIsAlternateVisual (ScreenPtr pScreen,
|
||||||
static Bool
|
static Bool
|
||||||
compImplicitRedirect(WindowPtr pWin, WindowPtr pParent)
|
compImplicitRedirect(WindowPtr pWin, WindowPtr pParent)
|
||||||
{
|
{
|
||||||
if (pParent)
|
if (pParent) {
|
||||||
{
|
|
||||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||||
XID winVisual = wVisual(pWin);
|
XID winVisual = wVisual(pWin);
|
||||||
XID parentVisual = wVisual(pParent);
|
XID parentVisual = wVisual(pParent);
|
||||||
|
|
@ -358,19 +350,21 @@ compImplicitRedirect (WindowPtr pWin, WindowPtr pParent)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void compFreeOldPixmap(WindowPtr pWin)
|
static void
|
||||||
|
compFreeOldPixmap(WindowPtr pWin)
|
||||||
{
|
{
|
||||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||||
if (pWin->redirectDraw != RedirectDrawNone)
|
|
||||||
{
|
if (pWin->redirectDraw != RedirectDrawNone) {
|
||||||
CompWindowPtr cw = GetCompWindow(pWin);
|
CompWindowPtr cw = GetCompWindow(pWin);
|
||||||
if (cw->pOldPixmap)
|
|
||||||
{
|
if (cw->pOldPixmap) {
|
||||||
(*pScreen->DestroyPixmap) (cw->pOldPixmap);
|
(*pScreen->DestroyPixmap) (cw->pOldPixmap);
|
||||||
cw->pOldPixmap = NullPixmap;
|
cw->pOldPixmap = NullPixmap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
compMoveWindow(WindowPtr pWin, int x, int y, WindowPtr pSib, VTKind kind)
|
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);
|
CompScreenPtr cs = GetCompScreen(pScreen);
|
||||||
int dx = 0, dy = 0;
|
int dx = 0, dy = 0;
|
||||||
|
|
||||||
if (pWin->redirectDraw != RedirectDrawNone)
|
if (pWin->redirectDraw != RedirectDrawNone) {
|
||||||
{
|
|
||||||
PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
|
PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
|
||||||
CompWindowPtr cw = GetCompWindow(pWin);
|
CompWindowPtr cw = GetCompWindow(pWin);
|
||||||
|
|
||||||
assert(cw->oldx != COMP_ORIGIN_INVALID);
|
assert(cw->oldx != COMP_ORIGIN_INVALID);
|
||||||
assert(cw->oldy != COMP_ORIGIN_INVALID);
|
assert(cw->oldy != COMP_ORIGIN_INVALID);
|
||||||
if (cw->pOldPixmap)
|
if (cw->pOldPixmap) {
|
||||||
{
|
|
||||||
/*
|
/*
|
||||||
* Ok, the old bits are available in pOldPixmap and
|
* Ok, the old bits are available in pOldPixmap and
|
||||||
* need to be copied to pNewPixmap.
|
* need to be copied to pNewPixmap.
|
||||||
|
|
@ -491,23 +483,19 @@ compCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
|
||||||
|
|
||||||
RegionNull(&rgnDst);
|
RegionNull(&rgnDst);
|
||||||
|
|
||||||
RegionIntersect(&rgnDst,
|
RegionIntersect(&rgnDst, &pWin->borderClip, prgnSrc);
|
||||||
&pWin->borderClip, prgnSrc);
|
|
||||||
|
|
||||||
RegionTranslate(&rgnDst,
|
RegionTranslate(&rgnDst, -pPixmap->screen_x, -pPixmap->screen_y);
|
||||||
-pPixmap->screen_x, -pPixmap->screen_y);
|
|
||||||
|
|
||||||
dx = dx + pPixmap->screen_x - cw->oldx;
|
dx = dx + pPixmap->screen_x - cw->oldx;
|
||||||
dy = dy + pPixmap->screen_y - cw->oldy;
|
dy = dy + pPixmap->screen_y - cw->oldy;
|
||||||
pGC = GetScratchGC(pPixmap->drawable.depth, pScreen);
|
pGC = GetScratchGC(pPixmap->drawable.depth, pScreen);
|
||||||
if (pGC)
|
if (pGC) {
|
||||||
{
|
|
||||||
BoxPtr pBox = RegionRects(&rgnDst);
|
BoxPtr pBox = RegionRects(&rgnDst);
|
||||||
int nBox = RegionNumRects(&rgnDst);
|
int nBox = RegionNumRects(&rgnDst);
|
||||||
|
|
||||||
ValidateGC(&pPixmap->drawable, pGC);
|
ValidateGC(&pPixmap->drawable, pGC);
|
||||||
while (nBox--)
|
while (nBox--) {
|
||||||
{
|
|
||||||
(void) (*pGC->ops->CopyArea) (&cw->pOldPixmap->drawable,
|
(void) (*pGC->ops->CopyArea) (&cw->pOldPixmap->drawable,
|
||||||
&pPixmap->drawable,
|
&pPixmap->drawable,
|
||||||
pGC,
|
pGC,
|
||||||
|
|
@ -528,16 +516,14 @@ compCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
|
||||||
}
|
}
|
||||||
|
|
||||||
pScreen->CopyWindow = cs->CopyWindow;
|
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)
|
if (dx || dy)
|
||||||
RegionTranslate(prgnSrc, dx, dy);
|
RegionTranslate(prgnSrc, dx, dy);
|
||||||
(*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc);
|
(*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc);
|
||||||
if (dx || dy)
|
if (dx || dy)
|
||||||
RegionTranslate(prgnSrc, -dx, -dy);
|
RegionTranslate(prgnSrc, -dx, -dy);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
ptOldOrg.x -= dx;
|
ptOldOrg.x -= dx;
|
||||||
ptOldOrg.y -= dy;
|
ptOldOrg.y -= dy;
|
||||||
RegionTranslate(prgnSrc,
|
RegionTranslate(prgnSrc,
|
||||||
|
|
@ -559,12 +545,13 @@ compCreateWindow (WindowPtr pWin)
|
||||||
|
|
||||||
pScreen->CreateWindow = cs->CreateWindow;
|
pScreen->CreateWindow = cs->CreateWindow;
|
||||||
ret = (*pScreen->CreateWindow) (pWin);
|
ret = (*pScreen->CreateWindow) (pWin);
|
||||||
if (pWin->parent && ret)
|
if (pWin->parent && ret) {
|
||||||
{
|
|
||||||
CompSubwindowsPtr csw = GetCompSubwindows(pWin->parent);
|
CompSubwindowsPtr csw = GetCompSubwindows(pWin->parent);
|
||||||
CompClientWindowPtr ccw;
|
CompClientWindowPtr ccw;
|
||||||
|
|
||||||
(*pScreen->SetWindowPixmap) (pWin, (*pScreen->GetWindowPixmap) (pWin->parent));
|
(*pScreen->SetWindowPixmap) (pWin,
|
||||||
|
(*pScreen->GetWindowPixmap) (pWin->
|
||||||
|
parent));
|
||||||
if (csw)
|
if (csw)
|
||||||
for (ccw = csw->clients; ccw; ccw = ccw->next)
|
for (ccw = csw->clients; ccw; ccw = ccw->next)
|
||||||
compRedirectWindow(clients[CLIENT_ID(ccw->id)],
|
compRedirectWindow(clients[CLIENT_ID(ccw->id)],
|
||||||
|
|
@ -595,6 +582,7 @@ compDestroyWindow (WindowPtr pWin)
|
||||||
|
|
||||||
if (pWin->redirectDraw != RedirectDrawNone) {
|
if (pWin->redirectDraw != RedirectDrawNone) {
|
||||||
PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
|
PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
|
||||||
|
|
||||||
compSetParentPixmap(pWin);
|
compSetParentPixmap(pWin);
|
||||||
(*pScreen->DestroyPixmap) (pPixmap);
|
(*pScreen->DestroyPixmap) (pPixmap);
|
||||||
}
|
}
|
||||||
|
|
@ -692,8 +680,7 @@ compWindowUpdateAutomatic (WindowPtr pWin)
|
||||||
/*
|
/*
|
||||||
* First move the region from window to screen coordinates
|
* First move the region from window to screen coordinates
|
||||||
*/
|
*/
|
||||||
RegionTranslate(pRegion,
|
RegionTranslate(pRegion, pWin->drawable.x, pWin->drawable.y);
|
||||||
pWin->drawable.x, pWin->drawable.y);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Clip against the "real" border clip
|
* Clip against the "real" border clip
|
||||||
|
|
@ -703,8 +690,7 @@ compWindowUpdateAutomatic (WindowPtr pWin)
|
||||||
/*
|
/*
|
||||||
* Now translate from screen to dest coordinates
|
* Now translate from screen to dest coordinates
|
||||||
*/
|
*/
|
||||||
RegionTranslate(pRegion,
|
RegionTranslate(pRegion, -pParent->drawable.x, -pParent->drawable.y);
|
||||||
-pParent->drawable.x, -pParent->drawable.y);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Clip the picture
|
* Clip the picture
|
||||||
|
|
@ -714,16 +700,11 @@ compWindowUpdateAutomatic (WindowPtr pWin)
|
||||||
/*
|
/*
|
||||||
* And paint
|
* And paint
|
||||||
*/
|
*/
|
||||||
CompositePicture (PictOpSrc,
|
CompositePicture(PictOpSrc, pSrcPicture, 0, pDstPicture, 0, 0, /* src_x, src_y */
|
||||||
pSrcPicture,
|
|
||||||
0,
|
|
||||||
pDstPicture,
|
|
||||||
0, 0, /* src_x, src_y */
|
|
||||||
0, 0, /* msk_x, msk_y */
|
0, 0, /* msk_x, msk_y */
|
||||||
pSrcPixmap->screen_x - pParent->drawable.x,
|
pSrcPixmap->screen_x - pParent->drawable.x,
|
||||||
pSrcPixmap->screen_y - pParent->drawable.y,
|
pSrcPixmap->screen_y - pParent->drawable.y,
|
||||||
pSrcPixmap->drawable.width,
|
pSrcPixmap->drawable.width, pSrcPixmap->drawable.height);
|
||||||
pSrcPixmap->drawable.height);
|
|
||||||
FreePicture(pSrcPicture, 0);
|
FreePicture(pSrcPicture, 0);
|
||||||
FreePicture(pDstPicture, 0);
|
FreePicture(pDstPicture, 0);
|
||||||
/*
|
/*
|
||||||
|
|
@ -738,12 +719,10 @@ compPaintWindowToParent (WindowPtr pWin)
|
||||||
{
|
{
|
||||||
compPaintChildrenToWindow(pWin);
|
compPaintChildrenToWindow(pWin);
|
||||||
|
|
||||||
if (pWin->redirectDraw != RedirectDrawNone)
|
if (pWin->redirectDraw != RedirectDrawNone) {
|
||||||
{
|
|
||||||
CompWindowPtr cw = GetCompWindow(pWin);
|
CompWindowPtr cw = GetCompWindow(pWin);
|
||||||
|
|
||||||
if (cw->damaged)
|
if (cw->damaged) {
|
||||||
{
|
|
||||||
compWindowUpdateAutomatic(pWin);
|
compWindowUpdateAutomatic(pWin);
|
||||||
cw->damaged = FALSE;
|
cw->damaged = FALSE;
|
||||||
}
|
}
|
||||||
|
|
@ -778,7 +757,8 @@ CompositeRealChildHead (WindowPtr pWin)
|
||||||
pChildBefore = pWin->firstChild;
|
pChildBefore = pWin->firstChild;
|
||||||
pChild = pChildBefore->nextSib;
|
pChild = pChildBefore->nextSib;
|
||||||
|
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
pChildBefore = NullWindow;
|
pChildBefore = NullWindow;
|
||||||
pChild = pWin->firstChild;
|
pChild = pWin->firstChild;
|
||||||
}
|
}
|
||||||
|
|
@ -790,7 +770,8 @@ CompositeRealChildHead (WindowPtr pWin)
|
||||||
cs = GetCompScreen(pWin->drawable.pScreen);
|
cs = GetCompScreen(pWin->drawable.pScreen);
|
||||||
if (pChild == cs->pOverlayWin) {
|
if (pChild == cs->pOverlayWin) {
|
||||||
return pChild;
|
return pChild;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
return pChildBefore;
|
return pChildBefore;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -806,8 +787,7 @@ compConfigNotify(WindowPtr pWin, int x, int y, int w, int h,
|
||||||
int draw_x, draw_y;
|
int draw_x, draw_y;
|
||||||
Bool alloc_ret;
|
Bool alloc_ret;
|
||||||
|
|
||||||
if (cs->ConfigNotify)
|
if (cs->ConfigNotify) {
|
||||||
{
|
|
||||||
pScreen->ConfigNotify = cs->ConfigNotify;
|
pScreen->ConfigNotify = cs->ConfigNotify;
|
||||||
ret = (*pScreen->ConfigNotify) (pWin, x, y, w, h, bw, pSib);
|
ret = (*pScreen->ConfigNotify) (pWin, x, y, w, h, bw, pSib);
|
||||||
cs->ConfigNotify = pScreen->ConfigNotify;
|
cs->ConfigNotify = pScreen->ConfigNotify;
|
||||||
|
|
|
||||||
|
|
@ -112,18 +112,15 @@ device_is_duplicate(const char *config_info)
|
||||||
{
|
{
|
||||||
DeviceIntPtr dev;
|
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))
|
if (dev->config_info && (strcmp(dev->config_info, config_info) == 0))
|
||||||
return TRUE;
|
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))
|
if (dev->config_info && (strcmp(dev->config_info, config_info) == 0))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,8 @@ wakeup_handler(pointer data, int err, pointer read_mask)
|
||||||
dbus_connection_read_write_dispatch(info->connection, 0);
|
dbus_connection_read_write_dispatch(info->connection, 0);
|
||||||
} while (info->connection &&
|
} while (info->connection &&
|
||||||
dbus_connection_get_is_connected(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
|
/* If we get disconnected, then take everything down, and attempt to
|
||||||
* reconnect immediately (assuming it's just a restart). The
|
* reconnect immediately (assuming it's just a restart). The
|
||||||
* connection isn't valid at this point, so throw it out immediately. */
|
* connection isn't valid at this point, so throw it out immediately. */
|
||||||
if (dbus_message_is_signal(message, DBUS_INTERFACE_LOCAL,
|
if (dbus_message_is_signal(message, DBUS_INTERFACE_LOCAL, "Disconnected")) {
|
||||||
"Disconnected")) {
|
|
||||||
DebugF("[config/dbus-core] disconnected from bus\n");
|
DebugF("[config/dbus-core] disconnected from bus\n");
|
||||||
bus_info.connection = NULL;
|
bus_info.connection = NULL;
|
||||||
teardown();
|
teardown();
|
||||||
|
|
@ -202,8 +202,7 @@ config_dbus_core_add_hook(struct config_dbus_core_hook *hook)
|
||||||
{
|
{
|
||||||
struct config_dbus_core_hook **prev;
|
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;
|
hook->next = NULL;
|
||||||
*prev = hook;
|
*prev = hook;
|
||||||
|
|
|
||||||
|
|
@ -89,6 +89,7 @@ add_device(DBusMessage *message, DBusMessage *reply, DBusError *error)
|
||||||
/* signature should be [ss][ss]... */
|
/* signature should be [ss][ss]... */
|
||||||
while (dbus_message_iter_get_arg_type(&iter) == DBUS_TYPE_ARRAY) {
|
while (dbus_message_iter_get_arg_type(&iter) == DBUS_TYPE_ARRAY) {
|
||||||
char *key, *value;
|
char *key, *value;
|
||||||
|
|
||||||
dbus_message_iter_recurse(&iter, &subiter);
|
dbus_message_iter_recurse(&iter, &subiter);
|
||||||
|
|
||||||
if (dbus_message_iter_get_arg_type(&subiter) != DBUS_TYPE_STRING)
|
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,
|
if (!dbus_connection_register_object_path(info->connection,
|
||||||
info->busobject, &vtable,
|
info->busobject, &vtable, info)) {
|
||||||
info)) {
|
|
||||||
ErrorF("[config/dbus] couldn't register object path\n");
|
ErrorF("[config/dbus] couldn't register object path\n");
|
||||||
goto err_match;
|
goto err_match;
|
||||||
}
|
}
|
||||||
|
|
@ -372,8 +372,7 @@ pre_disconnect_hook(void)
|
||||||
dbus_error_init(&error);
|
dbus_error_init(&error);
|
||||||
dbus_connection_unregister_object_path(connection_data->connection,
|
dbus_connection_unregister_object_path(connection_data->connection,
|
||||||
connection_data->busobject);
|
connection_data->busobject);
|
||||||
dbus_bus_remove_match(connection_data->connection, MATCH_RULE,
|
dbus_bus_remove_match(connection_data->connection, MATCH_RULE, &error);
|
||||||
&error);
|
|
||||||
dbus_bus_release_name(connection_data->connection,
|
dbus_bus_release_name(connection_data->connection,
|
||||||
connection_data->busname, &error);
|
connection_data->busname, &error);
|
||||||
dbus_error_free(&error);
|
dbus_error_free(&error);
|
||||||
|
|
@ -381,6 +380,7 @@ pre_disconnect_hook(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static struct connection_info connection_data;
|
static struct connection_info connection_data;
|
||||||
|
|
||||||
static struct config_dbus_core_hook core_hook = {
|
static struct config_dbus_core_hook core_hook = {
|
||||||
.connect = connect_hook,
|
.connect = connect_hook,
|
||||||
.disconnect = disconnect_hook,
|
.disconnect = disconnect_hook,
|
||||||
|
|
|
||||||
165
config/hal.c
165
config/hal.c
|
|
@ -39,11 +39,9 @@
|
||||||
#include "config-backends.h"
|
#include "config-backends.h"
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
|
|
||||||
|
|
||||||
#define LIBHAL_PROP_KEY "input.x11_options."
|
#define LIBHAL_PROP_KEY "input.x11_options."
|
||||||
#define LIBHAL_XKB_PROP_KEY "input.xkb."
|
#define LIBHAL_XKB_PROP_KEY "input.xkb."
|
||||||
|
|
||||||
|
|
||||||
struct config_hal_info {
|
struct config_hal_info {
|
||||||
DBusConnection *system_bus;
|
DBusConnection *system_bus;
|
||||||
LibHalContext *hal_ctx;
|
LibHalContext *hal_ctx;
|
||||||
|
|
@ -77,7 +75,8 @@ get_prop_string(LibHalContext *hal_ctx, const char *udi, const char *name)
|
||||||
char *prop, *ret;
|
char *prop, *ret;
|
||||||
|
|
||||||
prop = libhal_device_get_property_string(hal_ctx, udi, name, NULL);
|
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) {
|
if (prop) {
|
||||||
ret = strdup(prop);
|
ret = strdup(prop);
|
||||||
libhal_free_string(prop);
|
libhal_free_string(prop);
|
||||||
|
|
@ -90,7 +89,8 @@ get_prop_string(LibHalContext *hal_ctx, const char *udi, const char *name)
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
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;
|
char **props, *ret, *str;
|
||||||
int i, len = 0;
|
int i, len = 0;
|
||||||
|
|
@ -139,19 +139,20 @@ device_added(LibHalContext *hal_ctx, const char *udi)
|
||||||
LibHalPropertySetIterator set_iter;
|
LibHalPropertySetIterator set_iter;
|
||||||
char *psi_key = NULL, *tmp_val;
|
char *psi_key = NULL, *tmp_val;
|
||||||
|
|
||||||
|
|
||||||
dbus_error_init(&error);
|
dbus_error_init(&error);
|
||||||
|
|
||||||
driver = get_prop_string(hal_ctx, udi, "input.x11_driver");
|
driver = get_prop_string(hal_ctx, udi, "input.x11_driver");
|
||||||
if (!driver) {
|
if (!driver) {
|
||||||
/* verbose, don't tell the user unless they _want_ to see it */
|
/* 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;
|
goto unwind;
|
||||||
}
|
}
|
||||||
|
|
||||||
path = get_prop_string(hal_ctx, udi, "input.device");
|
path = get_prop_string(hal_ctx, udi, "input.device");
|
||||||
if (!path) {
|
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;
|
goto unwind;
|
||||||
}
|
}
|
||||||
attrs.device = strdup(path);
|
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");
|
input_options = input_option_new(NULL, "_source", "server/hal");
|
||||||
if (!input_options) {
|
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;
|
goto unwind;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -226,9 +228,9 @@ device_added(LibHalContext *hal_ctx, const char *udi)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check for duplicate devices */
|
/* Check for duplicate devices */
|
||||||
if (device_is_duplicate(config_info))
|
if (device_is_duplicate(config_info)) {
|
||||||
{
|
LogMessage(X_WARNING,
|
||||||
LogMessage(X_WARNING, "config/hal: device %s already added. Ignoring.\n", name);
|
"config/hal: device %s already added. Ignoring.\n", name);
|
||||||
goto unwind;
|
goto unwind;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -237,7 +239,8 @@ device_added(LibHalContext *hal_ctx, const char *udi)
|
||||||
set = libhal_device_get_all_properties(hal_ctx, udi, &error);
|
set = libhal_device_get_all_properties(hal_ctx, udi, &error);
|
||||||
|
|
||||||
if (!set) {
|
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);
|
udi, error.name, error.message);
|
||||||
goto unwind;
|
goto unwind;
|
||||||
}
|
}
|
||||||
|
|
@ -250,7 +253,8 @@ device_added(LibHalContext *hal_ctx, const char *udi)
|
||||||
if (psi_key) {
|
if (psi_key) {
|
||||||
|
|
||||||
/* normal options first (input.x11_options.<propname>) */
|
/* 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;
|
char *tmp;
|
||||||
|
|
||||||
/* only support strings for all values */
|
/* 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
|
* Since we can't predict the order in which the keys
|
||||||
* arrive, we need to store them.
|
* arrive, we need to store them.
|
||||||
*/
|
*/
|
||||||
if ((tmp = strcasestr(psi_key, "xkb")) && strlen(tmp) >= 4)
|
if ((tmp = strcasestr(psi_key, "xkb")) && strlen(tmp) >= 4) {
|
||||||
{
|
if (!strcasecmp(&tmp[3], "layout")) {
|
||||||
if (!strcasecmp(&tmp[3], "layout"))
|
|
||||||
{
|
|
||||||
free(xkb_opts.layout);
|
free(xkb_opts.layout);
|
||||||
xkb_opts.layout = strdup(tmp_val);
|
xkb_opts.layout = strdup(tmp_val);
|
||||||
} else if (!strcasecmp(&tmp[3], "model"))
|
}
|
||||||
{
|
else if (!strcasecmp(&tmp[3], "model")) {
|
||||||
free(xkb_opts.model);
|
free(xkb_opts.model);
|
||||||
xkb_opts.model = strdup(tmp_val);
|
xkb_opts.model = strdup(tmp_val);
|
||||||
} else if (!strcasecmp(&tmp[3], "rules"))
|
}
|
||||||
{
|
else if (!strcasecmp(&tmp[3], "rules")) {
|
||||||
free(xkb_opts.rules);
|
free(xkb_opts.rules);
|
||||||
xkb_opts.rules = strdup(tmp_val);
|
xkb_opts.rules = strdup(tmp_val);
|
||||||
} else if (!strcasecmp(&tmp[3], "variant"))
|
}
|
||||||
{
|
else if (!strcasecmp(&tmp[3], "variant")) {
|
||||||
free(xkb_opts.variant);
|
free(xkb_opts.variant);
|
||||||
xkb_opts.variant = strdup(tmp_val);
|
xkb_opts.variant = strdup(tmp_val);
|
||||||
} else if (!strcasecmp(&tmp[3], "options"))
|
}
|
||||||
{
|
else if (!strcasecmp(&tmp[3], "options")) {
|
||||||
free(xkb_opts.options);
|
free(xkb_opts.options);
|
||||||
xkb_opts.options = strdup(tmp_val);
|
xkb_opts.options = strdup(tmp_val);
|
||||||
}
|
}
|
||||||
} else
|
}
|
||||||
{
|
else {
|
||||||
/* all others */
|
/* 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);
|
free(tmp_val);
|
||||||
}
|
}
|
||||||
} else
|
}
|
||||||
{
|
else {
|
||||||
/* server 1.4 had xkb_options as strlist. */
|
/* server 1.4 had xkb_options as strlist. */
|
||||||
if ((tmp = strcasestr(psi_key, "xkb")) &&
|
if ((tmp = strcasestr(psi_key, "xkb")) &&
|
||||||
(strlen(tmp) >= 4) &&
|
(strlen(tmp) >= 4) &&
|
||||||
(!strcasecmp(&tmp[3], "options")) &&
|
(!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);
|
free(xkb_opts.options);
|
||||||
xkb_opts.options = strdup(tmp_val);
|
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;
|
char *tmp;
|
||||||
|
|
||||||
/* only support strings for all values */
|
/* 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];
|
tmp = &psi_key[sizeof(LIBHAL_XKB_PROP_KEY) - 1];
|
||||||
|
|
||||||
if (!strcasecmp(tmp, "layout"))
|
if (!strcasecmp(tmp, "layout")) {
|
||||||
{
|
|
||||||
if (!xkb_opts.layout)
|
if (!xkb_opts.layout)
|
||||||
xkb_opts.layout = strdup(tmp_val);
|
xkb_opts.layout = strdup(tmp_val);
|
||||||
} else if (!strcasecmp(tmp, "rules"))
|
}
|
||||||
{
|
else if (!strcasecmp(tmp, "rules")) {
|
||||||
if (!xkb_opts.rules)
|
if (!xkb_opts.rules)
|
||||||
xkb_opts.rules = strdup(tmp_val);
|
xkb_opts.rules = strdup(tmp_val);
|
||||||
} else if (!strcasecmp(tmp, "variant"))
|
}
|
||||||
{
|
else if (!strcasecmp(tmp, "variant")) {
|
||||||
if (!xkb_opts.variant)
|
if (!xkb_opts.variant)
|
||||||
xkb_opts.variant = strdup(tmp_val);
|
xkb_opts.variant = strdup(tmp_val);
|
||||||
} else if (!strcasecmp(tmp, "model"))
|
}
|
||||||
{
|
else if (!strcasecmp(tmp, "model")) {
|
||||||
if (!xkb_opts.model)
|
if (!xkb_opts.model)
|
||||||
xkb_opts.model = strdup(tmp_val);
|
xkb_opts.model = strdup(tmp_val);
|
||||||
} else if (!strcasecmp(tmp, "options"))
|
}
|
||||||
{
|
else if (!strcasecmp(tmp, "options")) {
|
||||||
if (!xkb_opts.options)
|
if (!xkb_opts.options)
|
||||||
xkb_opts.options = strdup(tmp_val);
|
xkb_opts.options = strdup(tmp_val);
|
||||||
}
|
}
|
||||||
free(tmp_val);
|
free(tmp_val);
|
||||||
} else
|
}
|
||||||
{
|
else {
|
||||||
/* server 1.4 had xkb options as strlist */
|
/* server 1.4 had xkb options as strlist */
|
||||||
tmp_val = get_prop_string_array(hal_ctx, udi, psi_key);
|
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];
|
tmp = &psi_key[sizeof(LIBHAL_XKB_PROP_KEY) - 1];
|
||||||
if (!strcasecmp(tmp, ".options") && (!xkb_opts.options))
|
if (!strcasecmp(tmp, ".options") && (!xkb_opts.options))
|
||||||
xkb_opts.options = strdup(tmp_val);
|
xkb_opts.options = strdup(tmp_val);
|
||||||
|
|
@ -357,24 +364,29 @@ device_added(LibHalContext *hal_ctx, const char *udi)
|
||||||
libhal_psi_next(&set_iter);
|
libhal_psi_next(&set_iter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Now add xkb options */
|
/* Now add xkb options */
|
||||||
if (xkb_opts.layout)
|
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)
|
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)
|
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)
|
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)
|
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);
|
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? */
|
/* 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);
|
LogMessage(X_INFO, "config/hal: Adding input device %s\n", name);
|
||||||
if ((rc = NewInputDeviceRequest(input_options, &attrs, &dev)) != Success) {
|
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;
|
dev = NULL;
|
||||||
goto unwind;
|
goto unwind;
|
||||||
}
|
}
|
||||||
|
|
@ -395,6 +407,7 @@ unwind:
|
||||||
free(attrs.usb_id);
|
free(attrs.usb_id);
|
||||||
if (attrs.tags) {
|
if (attrs.tags) {
|
||||||
char **tag = attrs.tags;
|
char **tag = attrs.tags;
|
||||||
|
|
||||||
while (*tag) {
|
while (*tag) {
|
||||||
free(*tag);
|
free(*tag);
|
||||||
tag++;
|
tag++;
|
||||||
|
|
@ -423,7 +436,8 @@ disconnect_hook(void *data)
|
||||||
if (dbus_connection_get_is_connected(info->system_bus)) {
|
if (dbus_connection_get_is_connected(info->system_bus)) {
|
||||||
dbus_error_init(&error);
|
dbus_error_init(&error);
|
||||||
if (!libhal_ctx_shutdown(info->hal_ctx, &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);
|
error.name, error.message);
|
||||||
dbus_error_free(&error);
|
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)) {
|
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;
|
goto out_err;
|
||||||
}
|
}
|
||||||
if (!libhal_ctx_init(info->hal_ctx, &error)) {
|
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.name ? error.name : "unknown error",
|
||||||
error.message ? error.message : "null");
|
error.message ? error.message : "null");
|
||||||
goto out_err;
|
goto out_err;
|
||||||
}
|
}
|
||||||
if (!libhal_device_property_watch_all(info->hal_ctx, &error)) {
|
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.name ? error.name : "unknown error",
|
||||||
error.message ? error.message : "null");
|
error.message ? error.message : "null");
|
||||||
goto out_ctx;
|
goto out_ctx;
|
||||||
|
|
@ -494,7 +511,8 @@ out_ctx:
|
||||||
dbus_error_free(&error);
|
dbus_error_free(&error);
|
||||||
|
|
||||||
if (!libhal_ctx_shutdown(info->hal_ctx, &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.name ? error.name : "unknown error",
|
||||||
error.message ? error.message : "null");
|
error.message ? error.message : "null");
|
||||||
dbus_error_free(&error);
|
dbus_error_free(&error);
|
||||||
|
|
@ -513,7 +531,6 @@ out_err:
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle NewOwnerChanged signals to deal with HAL startup at X server runtime.
|
* Handle NewOwnerChanged signals to deal with HAL startup at X server runtime.
|
||||||
*
|
*
|
||||||
|
|
@ -523,13 +540,13 @@ out_err:
|
||||||
* owner.
|
* owner.
|
||||||
*/
|
*/
|
||||||
static DBusHandlerResult
|
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;
|
int ret = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
|
||||||
|
|
||||||
if (dbus_message_is_signal(message,
|
if (dbus_message_is_signal(message,
|
||||||
"org.freedesktop.DBus",
|
"org.freedesktop.DBus", "NameOwnerChanged")) {
|
||||||
"NameOwnerChanged")) {
|
|
||||||
DBusError error;
|
DBusError error;
|
||||||
char *name, *old_owner, *new_owner;
|
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_message_get_args(message, &error,
|
||||||
DBUS_TYPE_STRING, &name,
|
DBUS_TYPE_STRING, &name,
|
||||||
DBUS_TYPE_STRING, &old_owner,
|
DBUS_TYPE_STRING, &old_owner,
|
||||||
DBUS_TYPE_STRING, &new_owner,
|
DBUS_TYPE_STRING, &new_owner, DBUS_TYPE_INVALID);
|
||||||
DBUS_TYPE_INVALID);
|
|
||||||
|
|
||||||
if (dbus_error_is_set(&error)) {
|
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);
|
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)) {
|
if (!old_owner || !strlen(old_owner)) {
|
||||||
DebugF("[config/hal] HAL startup detected.\n");
|
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,
|
dbus_connection_unregister_object_path(connection,
|
||||||
"/org/freedesktop/DBus");
|
"/org/freedesktop/DBus");
|
||||||
else
|
else
|
||||||
|
|
@ -573,8 +592,7 @@ listen_for_startup(DBusConnection *connection, void *data)
|
||||||
const char MATCH_RULE[] = "sender='org.freedesktop.DBus',"
|
const char MATCH_RULE[] = "sender='org.freedesktop.DBus',"
|
||||||
"interface='org.freedesktop.DBus',"
|
"interface='org.freedesktop.DBus',"
|
||||||
"type='signal',"
|
"type='signal',"
|
||||||
"path='/org/freedesktop/DBus',"
|
"path='/org/freedesktop/DBus'," "member='NameOwnerChanged'";
|
||||||
"member='NameOwnerChanged'";
|
|
||||||
int rc = FALSE;
|
int rc = FALSE;
|
||||||
|
|
||||||
dbus_error_init(&error);
|
dbus_error_init(&error);
|
||||||
|
|
@ -582,12 +600,12 @@ listen_for_startup(DBusConnection *connection, void *data)
|
||||||
if (!dbus_error_is_set(&error)) {
|
if (!dbus_error_is_set(&error)) {
|
||||||
if (dbus_connection_register_object_path(connection,
|
if (dbus_connection_register_object_path(connection,
|
||||||
"/org/freedesktop/DBus",
|
"/org/freedesktop/DBus",
|
||||||
&vtable,
|
&vtable, data))
|
||||||
data))
|
|
||||||
rc = TRUE;
|
rc = TRUE;
|
||||||
else
|
else
|
||||||
ErrorF("[config/hal] cannot register object path.\n");
|
ErrorF("[config/hal] cannot register object path.\n");
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
ErrorF("[config/hal] couldn't add match rule: %s (%s)\n", error.name,
|
ErrorF("[config/hal] couldn't add match rule: %s (%s)\n", error.name,
|
||||||
error.message);
|
error.message);
|
||||||
ErrorF("[config/hal] cannot detect a HAL startup.\n");
|
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_hal_info hal_info;
|
||||||
|
|
||||||
static struct config_dbus_core_hook hook = {
|
static struct config_dbus_core_hook hook = {
|
||||||
.connect = connect_hook,
|
.connect = connect_hook,
|
||||||
.disconnect = disconnect_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")) {
|
if (!udev_device_get_property_value(udev_device, "ID_INPUT")) {
|
||||||
LogMessageVerb(X_INFO, 10,
|
LogMessageVerb(X_INFO, 10,
|
||||||
"config/udev: ignoring device %s without "
|
"config/udev: ignoring device %s without "
|
||||||
"property ID_INPUT set\n",
|
"property ID_INPUT set\n", path);
|
||||||
path);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -116,7 +115,8 @@ device_added(struct udev_device *udev_device)
|
||||||
LOG_SYSATTR(ppath, "id", pnp_id);
|
LOG_SYSATTR(ppath, "id", pnp_id);
|
||||||
|
|
||||||
/* construct USB ID in lowercase hex - "0000:ffff" */
|
/* 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)
|
if (asprintf(&attrs.usb_id, "%04x:%04x", usb_vendor, usb_model)
|
||||||
== -1)
|
== -1)
|
||||||
attrs.usb_id = NULL;
|
attrs.usb_id = NULL;
|
||||||
|
|
@ -155,39 +155,50 @@ device_added(struct udev_device *udev_device)
|
||||||
if (!key)
|
if (!key)
|
||||||
continue;
|
continue;
|
||||||
value = udev_list_entry_get_value(entry);
|
value = udev_list_entry_get_value(entry);
|
||||||
if (!strncasecmp(key, UDEV_XKB_PROP_KEY,
|
if (!strncasecmp(key, UDEV_XKB_PROP_KEY, sizeof(UDEV_XKB_PROP_KEY) - 1)) {
|
||||||
sizeof(UDEV_XKB_PROP_KEY) - 1)) {
|
|
||||||
LOG_PROPERTY(path, key, value);
|
LOG_PROPERTY(path, key, value);
|
||||||
tmp = key + sizeof(UDEV_XKB_PROP_KEY) - 1;
|
tmp = key + sizeof(UDEV_XKB_PROP_KEY) - 1;
|
||||||
if (!strcasecmp(tmp, "rules"))
|
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"))
|
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"))
|
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"))
|
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"))
|
else if (!strcasecmp(tmp, "options"))
|
||||||
input_options = input_option_new(input_options, "xkb_options", value);
|
input_options =
|
||||||
} else if (!strcmp(key, "ID_VENDOR")) {
|
input_option_new(input_options, "xkb_options", value);
|
||||||
|
}
|
||||||
|
else if (!strcmp(key, "ID_VENDOR")) {
|
||||||
LOG_PROPERTY(path, key, value);
|
LOG_PROPERTY(path, key, value);
|
||||||
attrs.vendor = strdup(value);
|
attrs.vendor = strdup(value);
|
||||||
} else if (!strcmp(key, "ID_INPUT_KEY")) {
|
}
|
||||||
|
else if (!strcmp(key, "ID_INPUT_KEY")) {
|
||||||
LOG_PROPERTY(path, key, value);
|
LOG_PROPERTY(path, key, value);
|
||||||
attrs.flags |= ATTR_KEYBOARD;
|
attrs.flags |= ATTR_KEYBOARD;
|
||||||
} else if (!strcmp(key, "ID_INPUT_MOUSE")) {
|
}
|
||||||
|
else if (!strcmp(key, "ID_INPUT_MOUSE")) {
|
||||||
LOG_PROPERTY(path, key, value);
|
LOG_PROPERTY(path, key, value);
|
||||||
attrs.flags |= ATTR_POINTER;
|
attrs.flags |= ATTR_POINTER;
|
||||||
} else if (!strcmp(key, "ID_INPUT_JOYSTICK")) {
|
}
|
||||||
|
else if (!strcmp(key, "ID_INPUT_JOYSTICK")) {
|
||||||
LOG_PROPERTY(path, key, value);
|
LOG_PROPERTY(path, key, value);
|
||||||
attrs.flags |= ATTR_JOYSTICK;
|
attrs.flags |= ATTR_JOYSTICK;
|
||||||
} else if (!strcmp(key, "ID_INPUT_TABLET")) {
|
}
|
||||||
|
else if (!strcmp(key, "ID_INPUT_TABLET")) {
|
||||||
LOG_PROPERTY(path, key, value);
|
LOG_PROPERTY(path, key, value);
|
||||||
attrs.flags |= ATTR_TABLET;
|
attrs.flags |= ATTR_TABLET;
|
||||||
} else if (!strcmp(key, "ID_INPUT_TOUCHPAD")) {
|
}
|
||||||
|
else if (!strcmp(key, "ID_INPUT_TOUCHPAD")) {
|
||||||
LOG_PROPERTY(path, key, value);
|
LOG_PROPERTY(path, key, value);
|
||||||
attrs.flags |= ATTR_TOUCHPAD;
|
attrs.flags |= ATTR_TOUCHPAD;
|
||||||
} else if (!strcmp(key, "ID_INPUT_TOUCHSCREEN")) {
|
}
|
||||||
|
else if (!strcmp(key, "ID_INPUT_TOUCHSCREEN")) {
|
||||||
LOG_PROPERTY(path, key, value);
|
LOG_PROPERTY(path, key, value);
|
||||||
attrs.flags |= ATTR_TOUCHSCREEN;
|
attrs.flags |= ATTR_TOUCHSCREEN;
|
||||||
}
|
}
|
||||||
|
|
@ -212,6 +223,7 @@ device_added(struct udev_device *udev_device)
|
||||||
free(attrs.vendor);
|
free(attrs.vendor);
|
||||||
if (attrs.tags) {
|
if (attrs.tags) {
|
||||||
char **tag = attrs.tags;
|
char **tag = attrs.tags;
|
||||||
|
|
||||||
while (*tag) {
|
while (*tag) {
|
||||||
free(*tag);
|
free(*tag);
|
||||||
tag++;
|
tag++;
|
||||||
|
|
@ -282,7 +294,8 @@ config_udev_init(void)
|
||||||
if (!udev_monitor)
|
if (!udev_monitor)
|
||||||
return 0;
|
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 */
|
udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "tty", NULL); /* For Wacom serial devices */
|
||||||
|
|
||||||
#ifdef HAVE_UDEV_MONITOR_FILTER_ADD_MATCH_TAG
|
#ifdef HAVE_UDEV_MONITOR_FILTER_ADD_MATCH_TAG
|
||||||
|
|
@ -311,7 +324,8 @@ config_udev_init(void)
|
||||||
devices = udev_enumerate_get_list_entry(enumerate);
|
devices = udev_enumerate_get_list_entry(enumerate);
|
||||||
udev_list_entry_foreach(device, devices) {
|
udev_list_entry_foreach(device, devices) {
|
||||||
const char *syspath = udev_list_entry_get_name(device);
|
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 */
|
/* Device might be gone by the time we try to open it */
|
||||||
if (!udev_device)
|
if (!udev_device)
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,9 @@
|
||||||
struct nameint {
|
struct nameint {
|
||||||
int val;
|
int val;
|
||||||
char *name;
|
char *name;
|
||||||
} kbdenc[] = { KB_OVRENC, KB_ENCTAB, { 0 } };
|
} kbdenc[] = {
|
||||||
|
KB_OVRENC, KB_ENCTAB, {
|
||||||
|
0}};
|
||||||
|
|
||||||
struct nameint kbdvar[] = {
|
struct nameint kbdvar[] = {
|
||||||
{KB_NODEAD | KB_SG, "de_nodeadkeys"},
|
{KB_NODEAD | KB_SG, "de_nodeadkeys"},
|
||||||
|
|
@ -108,15 +110,13 @@ wscons_add_keyboard(void)
|
||||||
}
|
}
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
input_options = input_option_new(input_options, "_source",
|
input_options = input_option_new(input_options, "_source", "server/wscons");
|
||||||
"server/wscons");
|
|
||||||
if (input_options == NULL)
|
if (input_options == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
LogMessage(X_INFO, "config/wscons: checking input device %s\n",
|
LogMessage(X_INFO, "config/wscons: checking input device %s\n",
|
||||||
WSCONS_KBD_DEVICE);
|
WSCONS_KBD_DEVICE);
|
||||||
input_options = input_option_new(input_options, "name",
|
input_options = input_option_new(input_options, "name", WSCONS_KBD_DEVICE);
|
||||||
WSCONS_KBD_DEVICE);
|
|
||||||
input_options = input_option_new(input_options, "driver", "kbd");
|
input_options = input_option_new(input_options, "driver", "kbd");
|
||||||
|
|
||||||
config_info = Xprintf("wscons:%s", WSCONS_KBD_DEVICE);
|
config_info = Xprintf("wscons:%s", WSCONS_KBD_DEVICE);
|
||||||
|
|
@ -136,8 +136,7 @@ wscons_add_keyboard(void)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
for (i = 0; kbdvar[i].val; i++)
|
for (i = 0; kbdvar[i].val; i++)
|
||||||
if (wsenc == kbdvar[i].val ||
|
if (wsenc == kbdvar[i].val || KB_VARIANT(wsenc) == kbdvar[i].val) {
|
||||||
KB_VARIANT(wsenc) == kbdvar[i].val) {
|
|
||||||
LogMessageVerb(X_INFO, 3, "wskbd: using variant %s\n",
|
LogMessageVerb(X_INFO, 3, "wskbd: using variant %s\n",
|
||||||
kbdvar[i].name);
|
kbdvar[i].name);
|
||||||
input_options = input_option_new(input_options,
|
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)
|
if (!config_info)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
input_options = input_option_new(input_options, "_source",
|
input_options = input_option_new(input_options, "_source", "server/wscons");
|
||||||
"server/wscons");
|
|
||||||
if (input_options == NULL)
|
if (input_options == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
input_options = input_option_new(input_options, "name",
|
input_options = input_option_new(input_options, "name", strdup(path));
|
||||||
strdup(path));
|
input_options = input_option_new(input_options, "driver", strdup(driver));
|
||||||
input_options = input_option_new(input_options, "driver",
|
input_options = input_option_new(input_options, "device", strdup(path));
|
||||||
strdup(driver));
|
|
||||||
input_options = input_option_new(input_options, "device",
|
|
||||||
strdup(path));
|
|
||||||
LogMessage(X_INFO, "config/wscons: checking input device %s\n", path);
|
LogMessage(X_INFO, "config/wscons: checking input device %s\n", path);
|
||||||
attrs.flags |= flags;
|
attrs.flags |= flags;
|
||||||
rc = NewInputDeviceRequest(input_options, &attrs, &dev);
|
rc = NewInputDeviceRequest(input_options, &attrs, &dev);
|
||||||
|
|
@ -221,13 +216,11 @@ wscons_add_pointers(void)
|
||||||
|
|
||||||
/* Check pointing devices */
|
/* Check pointing devices */
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
snprintf(devname, sizeof(devname), "%s%d",
|
snprintf(devname, sizeof(devname), "%s%d", WSCONS_MOUSE_PREFIX, i);
|
||||||
WSCONS_MOUSE_PREFIX, i);
|
|
||||||
LogMessageVerb(X_INFO, 10, "wsmouse: checking %s\n", devname);
|
LogMessageVerb(X_INFO, 10, "wsmouse: checking %s\n", devname);
|
||||||
fd = open_device(devnamem O_RDWR | O_NONBLOCK | O_EXCL);
|
fd = open_device(devnamem O_RDWR | O_NONBLOCK | O_EXCL);
|
||||||
if (fd == -1) {
|
if (fd == -1) {
|
||||||
LogMessageVerb(X_WARNING, 10, "%s: %s\n", devname,
|
LogMessageVerb(X_WARNING, 10, "%s: %s\n", devname, strerror(errno));
|
||||||
strerror(errno));
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (ioctl(fd, WSMOUSEIO_GTYPE, &wsmouse_type) != 0) {
|
if (ioctl(fd, WSMOUSEIO_GTYPE, &wsmouse_type) != 0) {
|
||||||
|
|
@ -239,8 +232,7 @@ wscons_add_pointers(void)
|
||||||
close(fd);
|
close(fd);
|
||||||
switch (wsmouse_type) {
|
switch (wsmouse_type) {
|
||||||
case WSMOUSE_TYPE_SYNAPTICS:
|
case WSMOUSE_TYPE_SYNAPTICS:
|
||||||
wscons_add_pointer(devname, "synaptics",
|
wscons_add_pointer(devname, "synaptics", ATTR_TOUCHPAD);
|
||||||
ATTR_TOUCHPAD);
|
|
||||||
break;
|
break;
|
||||||
case WSMOUSE_TYPE_TPANEL:
|
case WSMOUSE_TYPE_TPANEL:
|
||||||
wscons_add_pointer(devname, "ws", ATTR_TOUCHSCREEN);
|
wscons_add_pointer(devname, "ws", ATTR_TOUCHSCREEN);
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ static RESTYPE DamageExtType;
|
||||||
static RESTYPE DamageExtWinType;
|
static RESTYPE DamageExtWinType;
|
||||||
|
|
||||||
static DevPrivateKeyRec DamageClientPrivateKeyRec;
|
static DevPrivateKeyRec DamageClientPrivateKeyRec;
|
||||||
|
|
||||||
#define DamageClientPrivateKey (&DamageClientPrivateKeyRec)
|
#define DamageClientPrivateKey (&DamageClientPrivateKeyRec)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -54,10 +55,8 @@ DamageExtNotify (DamageExtPtr pDamageExt, BoxPtr pBoxes, int nBoxes)
|
||||||
ev.geometry.y = pDrawable->y;
|
ev.geometry.y = pDrawable->y;
|
||||||
ev.geometry.width = pDrawable->width;
|
ev.geometry.width = pDrawable->width;
|
||||||
ev.geometry.height = pDrawable->height;
|
ev.geometry.height = pDrawable->height;
|
||||||
if (pBoxes)
|
if (pBoxes) {
|
||||||
{
|
for (i = 0; i < nBoxes; i++) {
|
||||||
for (i = 0; i < nBoxes; i++)
|
|
||||||
{
|
|
||||||
ev.level = pDamageExt->level;
|
ev.level = pDamageExt->level;
|
||||||
if (i < nBoxes - 1)
|
if (i < nBoxes - 1)
|
||||||
ev.level |= DamageNotifyMore;
|
ev.level |= DamageNotifyMore;
|
||||||
|
|
@ -68,8 +67,7 @@ DamageExtNotify (DamageExtPtr pDamageExt, BoxPtr pBoxes, int nBoxes)
|
||||||
WriteEventsToClient(pClient, 1, (xEvent *) &ev);
|
WriteEventsToClient(pClient, 1, (xEvent *) &ev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
ev.area.x = 0;
|
ev.area.x = 0;
|
||||||
ev.area.y = 0;
|
ev.area.y = 0;
|
||||||
ev.area.width = pDrawable->width;
|
ev.area.width = pDrawable->width;
|
||||||
|
|
@ -77,8 +75,7 @@ DamageExtNotify (DamageExtPtr pDamageExt, BoxPtr pBoxes, int nBoxes)
|
||||||
WriteEventsToClient(pClient, 1, (xEvent *) &ev);
|
WriteEventsToClient(pClient, 1, (xEvent *) &ev);
|
||||||
}
|
}
|
||||||
/* Composite extension marks clients with manual Subwindows as critical */
|
/* Composite extension marks clients with manual Subwindows as critical */
|
||||||
if (pDamageClient->critical > 0)
|
if (pDamageClient->critical > 0) {
|
||||||
{
|
|
||||||
SetCriticalOutputPending();
|
SetCriticalOutputPending();
|
||||||
pClient->smart_priority = SMART_MAX_PRIORITY;
|
pClient->smart_priority = SMART_MAX_PRIORITY;
|
||||||
}
|
}
|
||||||
|
|
@ -92,7 +89,8 @@ DamageExtReport (DamagePtr pDamage, RegionPtr pRegion, void *closure)
|
||||||
switch (pDamageExt->level) {
|
switch (pDamageExt->level) {
|
||||||
case DamageReportRawRegion:
|
case DamageReportRawRegion:
|
||||||
case DamageReportDeltaRegion:
|
case DamageReportDeltaRegion:
|
||||||
DamageExtNotify (pDamageExt, RegionRects(pRegion), RegionNumRects(pRegion));
|
DamageExtNotify(pDamageExt, RegionRects(pRegion),
|
||||||
|
RegionNumRects(pRegion));
|
||||||
break;
|
break;
|
||||||
case DamageReportBoundingBox:
|
case DamageReportBoundingBox:
|
||||||
DamageExtNotify(pDamageExt, RegionExtents(pRegion), 1);
|
DamageExtNotify(pDamageExt, RegionExtents(pRegion), 1);
|
||||||
|
|
@ -129,6 +127,7 @@ ProcDamageQueryVersion(ClientPtr client)
|
||||||
{
|
{
|
||||||
DamageClientPtr pDamageClient = GetDamageClient(client);
|
DamageClientPtr pDamageClient = GetDamageClient(client);
|
||||||
xDamageQueryVersionReply rep;
|
xDamageQueryVersionReply rep;
|
||||||
|
|
||||||
REQUEST(xDamageQueryVersionReq);
|
REQUEST(xDamageQueryVersionReq);
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xDamageQueryVersionReq);
|
REQUEST_SIZE_MATCH(xDamageQueryVersionReq);
|
||||||
|
|
@ -138,7 +137,8 @@ ProcDamageQueryVersion(ClientPtr client)
|
||||||
if (stuff->majorVersion < SERVER_DAMAGE_MAJOR_VERSION) {
|
if (stuff->majorVersion < SERVER_DAMAGE_MAJOR_VERSION) {
|
||||||
rep.majorVersion = stuff->majorVersion;
|
rep.majorVersion = stuff->majorVersion;
|
||||||
rep.minorVersion = stuff->minorVersion;
|
rep.minorVersion = stuff->minorVersion;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
rep.majorVersion = SERVER_DAMAGE_MAJOR_VERSION;
|
rep.majorVersion = SERVER_DAMAGE_MAJOR_VERSION;
|
||||||
if (stuff->majorVersion == SERVER_DAMAGE_MAJOR_VERSION &&
|
if (stuff->majorVersion == SERVER_DAMAGE_MAJOR_VERSION &&
|
||||||
stuff->minorVersion < SERVER_DAMAGE_MINOR_VERSION)
|
stuff->minorVersion < SERVER_DAMAGE_MINOR_VERSION)
|
||||||
|
|
@ -205,11 +205,8 @@ ProcDamageCreate (ClientPtr client)
|
||||||
pDamageExt->pDamage = DamageCreate(DamageExtReport,
|
pDamageExt->pDamage = DamageCreate(DamageExtReport,
|
||||||
DamageExtDestroy,
|
DamageExtDestroy,
|
||||||
level,
|
level,
|
||||||
FALSE,
|
FALSE, pDrawable->pScreen, pDamageExt);
|
||||||
pDrawable->pScreen,
|
if (!pDamageExt->pDamage) {
|
||||||
pDamageExt);
|
|
||||||
if (!pDamageExt->pDamage)
|
|
||||||
{
|
|
||||||
free(pDamageExt);
|
free(pDamageExt);
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
|
|
@ -219,8 +216,7 @@ ProcDamageCreate (ClientPtr client)
|
||||||
DamageSetReportAfterOp(pDamageExt->pDamage, TRUE);
|
DamageSetReportAfterOp(pDamageExt->pDamage, TRUE);
|
||||||
DamageRegister(pDamageExt->pDrawable, pDamageExt->pDamage);
|
DamageRegister(pDamageExt->pDrawable, pDamageExt->pDamage);
|
||||||
|
|
||||||
if (pDrawable->type == DRAWABLE_WINDOW)
|
if (pDrawable->type == DRAWABLE_WINDOW) {
|
||||||
{
|
|
||||||
pRegion = &((WindowPtr) pDrawable)->borderClip;
|
pRegion = &((WindowPtr) pDrawable)->borderClip;
|
||||||
DamageReportDamage(pDamageExt->pDamage, pRegion);
|
DamageReportDamage(pDamageExt->pDamage, pRegion);
|
||||||
}
|
}
|
||||||
|
|
@ -253,18 +249,17 @@ ProcDamageSubtract (ClientPtr client)
|
||||||
VERIFY_REGION_OR_NONE(pRepair, stuff->repair, client, DixWriteAccess);
|
VERIFY_REGION_OR_NONE(pRepair, stuff->repair, client, DixWriteAccess);
|
||||||
VERIFY_REGION_OR_NONE(pParts, stuff->parts, client, DixWriteAccess);
|
VERIFY_REGION_OR_NONE(pParts, stuff->parts, client, DixWriteAccess);
|
||||||
|
|
||||||
if (pDamageExt->level != DamageReportRawRegion)
|
if (pDamageExt->level != DamageReportRawRegion) {
|
||||||
{
|
|
||||||
DamagePtr pDamage = pDamageExt->pDamage;
|
DamagePtr pDamage = pDamageExt->pDamage;
|
||||||
if (pRepair)
|
|
||||||
{
|
if (pRepair) {
|
||||||
if (pParts)
|
if (pParts)
|
||||||
RegionIntersect(pParts, DamageRegion(pDamage), pRepair);
|
RegionIntersect(pParts, DamageRegion(pDamage), pRepair);
|
||||||
if (DamageSubtract(pDamage, pRepair))
|
if (DamageSubtract(pDamage, pRepair))
|
||||||
DamageExtReport (pDamage, DamageRegion (pDamage), (void *) pDamageExt);
|
DamageExtReport(pDamage, DamageRegion(pDamage),
|
||||||
|
(void *) pDamageExt);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
if (pParts)
|
if (pParts)
|
||||||
RegionCopy(pParts, DamageRegion(pDamage));
|
RegionCopy(pParts, DamageRegion(pDamage));
|
||||||
DamageEmpty(pDamage);
|
DamageEmpty(pDamage);
|
||||||
|
|
@ -309,13 +304,9 @@ static const int version_requests[] = {
|
||||||
static int (*ProcDamageVector[XDamageNumberRequests]) (ClientPtr) = {
|
static int (*ProcDamageVector[XDamageNumberRequests]) (ClientPtr) = {
|
||||||
/*************** Version 1 ******************/
|
/*************** Version 1 ******************/
|
||||||
ProcDamageQueryVersion,
|
ProcDamageQueryVersion,
|
||||||
ProcDamageCreate,
|
ProcDamageCreate, ProcDamageDestroy, ProcDamageSubtract,
|
||||||
ProcDamageDestroy,
|
|
||||||
ProcDamageSubtract,
|
|
||||||
/*************** Version 1.1 ****************/
|
/*************** Version 1.1 ****************/
|
||||||
ProcDamageAdd,
|
ProcDamageAdd,};
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ProcDamageDispatch(ClientPtr client)
|
ProcDamageDispatch(ClientPtr client)
|
||||||
|
|
@ -393,12 +384,9 @@ SProcDamageAdd (ClientPtr client)
|
||||||
static int (*SProcDamageVector[XDamageNumberRequests]) (ClientPtr) = {
|
static int (*SProcDamageVector[XDamageNumberRequests]) (ClientPtr) = {
|
||||||
/*************** Version 1 ******************/
|
/*************** Version 1 ******************/
|
||||||
SProcDamageQueryVersion,
|
SProcDamageQueryVersion,
|
||||||
SProcDamageCreate,
|
SProcDamageCreate, SProcDamageDestroy, SProcDamageSubtract,
|
||||||
SProcDamageDestroy,
|
|
||||||
SProcDamageSubtract,
|
|
||||||
/*************** Version 1.1 ****************/
|
/*************** Version 1.1 ****************/
|
||||||
SProcDamageAdd,
|
SProcDamageAdd,};
|
||||||
};
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
SProcDamageDispatch(ClientPtr client)
|
SProcDamageDispatch(ClientPtr client)
|
||||||
|
|
@ -410,9 +398,7 @@ SProcDamageDispatch (ClientPtr client)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
DamageClientCallback (CallbackListPtr *list,
|
DamageClientCallback(CallbackListPtr *list, pointer closure, pointer data)
|
||||||
pointer closure,
|
|
||||||
pointer data)
|
|
||||||
{
|
{
|
||||||
NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
|
NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
|
||||||
ClientPtr pClient = clientinfo->client;
|
ClientPtr pClient = clientinfo->client;
|
||||||
|
|
@ -423,8 +409,7 @@ DamageClientCallback (CallbackListPtr *list,
|
||||||
pDamageClient->minor_version = 0;
|
pDamageClient->minor_version = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*ARGSUSED*/
|
/*ARGSUSED*/ static void
|
||||||
static void
|
|
||||||
DamageResetProc(ExtensionEntry * extEntry)
|
DamageResetProc(ExtensionEntry * extEntry)
|
||||||
{
|
{
|
||||||
DeleteCallback(&ClientStateCallback, DamageClientCallback, 0);
|
DeleteCallback(&ClientStateCallback, DamageClientCallback, 0);
|
||||||
|
|
@ -441,8 +426,7 @@ FreeDamageExt (pointer value, XID did)
|
||||||
pDamageExt->id = 0;
|
pDamageExt->id = 0;
|
||||||
if (WindowDrawable(pDamageExt->pDrawable->type))
|
if (WindowDrawable(pDamageExt->pDrawable->type))
|
||||||
FreeResourceByType(pDamageExt->pDrawable->id, DamageExtWinType, TRUE);
|
FreeResourceByType(pDamageExt->pDrawable->id, DamageExtWinType, TRUE);
|
||||||
if (pDamageExt->pDamage)
|
if (pDamageExt->pDamage) {
|
||||||
{
|
|
||||||
DamageUnregister(pDamageExt->pDrawable, pDamageExt->pDamage);
|
DamageUnregister(pDamageExt->pDrawable, pDamageExt->pDamage);
|
||||||
DamageDestroy(pDamageExt->pDamage);
|
DamageDestroy(pDamageExt->pDamage);
|
||||||
}
|
}
|
||||||
|
|
@ -461,8 +445,7 @@ FreeDamageExtWin (pointer value, XID wid)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
SDamageNotifyEvent (xDamageNotifyEvent *from,
|
SDamageNotifyEvent(xDamageNotifyEvent * from, xDamageNotifyEvent * to)
|
||||||
xDamageNotifyEvent *to)
|
|
||||||
{
|
{
|
||||||
to->type = from->type;
|
to->type = from->type;
|
||||||
cpswaps(from->sequenceNumber, to->sequenceNumber);
|
cpswaps(from->sequenceNumber, to->sequenceNumber);
|
||||||
|
|
@ -495,7 +478,8 @@ DamageExtensionInit(void)
|
||||||
if (!DamageExtWinType)
|
if (!DamageExtWinType)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!dixRegisterPrivateKey(&DamageClientPrivateKeyRec, PRIVATE_CLIENT, sizeof (DamageClientRec)))
|
if (!dixRegisterPrivateKey
|
||||||
|
(&DamageClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(DamageClientRec)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!AddCallback(&ClientStateCallback, DamageClientCallback, 0))
|
if (!AddCallback(&ClientStateCallback, DamageClientCallback, 0))
|
||||||
|
|
@ -504,12 +488,12 @@ DamageExtensionInit(void)
|
||||||
if ((extEntry = AddExtension(DAMAGE_NAME, XDamageNumberEvents,
|
if ((extEntry = AddExtension(DAMAGE_NAME, XDamageNumberEvents,
|
||||||
XDamageNumberErrors,
|
XDamageNumberErrors,
|
||||||
ProcDamageDispatch, SProcDamageDispatch,
|
ProcDamageDispatch, SProcDamageDispatch,
|
||||||
DamageResetProc, StandardMinorOpcode)) != 0)
|
DamageResetProc, StandardMinorOpcode)) != 0) {
|
||||||
{
|
|
||||||
DamageReqCode = (unsigned char) extEntry->base;
|
DamageReqCode = (unsigned char) extEntry->base;
|
||||||
DamageEventBase = extEntry->eventBase;
|
DamageEventBase = extEntry->eventBase;
|
||||||
EventSwapVector[DamageEventBase + XDamageNotify] =
|
EventSwapVector[DamageEventBase + XDamageNotify] =
|
||||||
(EventSwapPtr) SDamageNotifyEvent;
|
(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 */
|
/* INCLUDES */
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
#ifdef HAVE_DIX_CONFIG_H
|
||||||
|
|
@ -98,8 +97,6 @@ DbeStubScreen(DbeScreenPrivPtr pDbeScreenPriv, int *nStubbedScreens)
|
||||||
(*nStubbedScreens)++;
|
(*nStubbedScreens)++;
|
||||||
|
|
||||||
} /* DbeStubScreen() */
|
} /* DbeStubScreen() */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
|
|
@ -131,8 +128,7 @@ ProcDbeGetVersion(ClientPtr client)
|
||||||
rep.majorVersion = DBE_MAJOR_VERSION;
|
rep.majorVersion = DBE_MAJOR_VERSION;
|
||||||
rep.minorVersion = DBE_MINOR_VERSION;
|
rep.minorVersion = DBE_MINOR_VERSION;
|
||||||
|
|
||||||
if (client->swapped)
|
if (client->swapped) {
|
||||||
{
|
|
||||||
swaps(&rep.sequenceNumber);
|
swaps(&rep.sequenceNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -141,7 +137,6 @@ ProcDbeGetVersion(ClientPtr client)
|
||||||
return Success;
|
return Success;
|
||||||
|
|
||||||
} /* ProcDbeGetVersion() */
|
} /* ProcDbeGetVersion() */
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
|
|
@ -181,7 +176,6 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
|
||||||
int status;
|
int status;
|
||||||
int add_index;
|
int add_index;
|
||||||
|
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xDbeAllocateBackBufferNameReq);
|
REQUEST_SIZE_MATCH(xDbeAllocateBackBufferNameReq);
|
||||||
|
|
||||||
/* The window must be valid. */
|
/* The window must be valid. */
|
||||||
|
|
@ -190,8 +184,7 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
/* The window must be InputOutput. */
|
/* The window must be InputOutput. */
|
||||||
if (pWin->drawable.class != InputOutput)
|
if (pWin->drawable.class != InputOutput) {
|
||||||
{
|
|
||||||
return BadMatch;
|
return BadMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -199,9 +192,7 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
|
||||||
swapAction = stuff->swapAction; /* use local var for performance. */
|
swapAction = stuff->swapAction; /* use local var for performance. */
|
||||||
if ((swapAction != XdbeUndefined) &&
|
if ((swapAction != XdbeUndefined) &&
|
||||||
(swapAction != XdbeBackground) &&
|
(swapAction != XdbeBackground) &&
|
||||||
(swapAction != XdbeUntouched ) &&
|
(swapAction != XdbeUntouched) && (swapAction != XdbeCopied)) {
|
||||||
(swapAction != XdbeCopied ))
|
|
||||||
{
|
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -215,18 +206,15 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
|
||||||
if (!pDbeScreenPriv->GetVisualInfo)
|
if (!pDbeScreenPriv->GetVisualInfo)
|
||||||
return BadMatch; /* screen doesn't support double buffering */
|
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. */
|
/* GetVisualInfo() failed to allocate visual info data. */
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* See if the window's visual is on the list. */
|
/* See if the window's visual is on the list. */
|
||||||
visual = wVisual(pWin);
|
visual = wVisual(pWin);
|
||||||
for (i = 0; (i < scrVisInfo.count) && !visualMatched; i++)
|
for (i = 0; (i < scrVisInfo.count) && !visualMatched; i++) {
|
||||||
{
|
if (scrVisInfo.visinfo[i].visual == visual) {
|
||||||
if (scrVisInfo.visinfo[i].visual == visual)
|
|
||||||
{
|
|
||||||
visualMatched = TRUE;
|
visualMatched = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -234,18 +222,17 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
|
||||||
/* Free what was allocated by the GetVisualInfo() call above. */
|
/* Free what was allocated by the GetVisualInfo() call above. */
|
||||||
free(scrVisInfo.visinfo);
|
free(scrVisInfo.visinfo);
|
||||||
|
|
||||||
if (!visualMatched)
|
if (!visualMatched) {
|
||||||
{
|
|
||||||
return BadMatch;
|
return BadMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((pDbeWindowPriv = DBE_WINDOW_PRIV(pWin)) == NULL)
|
if ((pDbeWindowPriv = DBE_WINDOW_PRIV(pWin)) == NULL) {
|
||||||
{
|
|
||||||
/* There is no buffer associated with the window.
|
/* There is no buffer associated with the window.
|
||||||
* Allocate a window priv.
|
* Allocate a window priv.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
pDbeWindowPriv = dixAllocateObjectWithPrivates(DbeWindowPrivRec, PRIVATE_DBE_WINDOW);
|
pDbeWindowPriv =
|
||||||
|
dixAllocateObjectWithPrivates(DbeWindowPrivRec, PRIVATE_DBE_WINDOW);
|
||||||
if (!pDbeWindowPriv)
|
if (!pDbeWindowPriv)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
|
||||||
|
|
@ -265,8 +252,7 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
|
||||||
pDbeWindowPriv->IDs[0] = stuff->buffer;
|
pDbeWindowPriv->IDs[0] = stuff->buffer;
|
||||||
|
|
||||||
add_index = 0;
|
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;
|
pDbeWindowPriv->IDs[i] = DBE_FREE_ID_ELEMENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -275,53 +261,48 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
|
||||||
|
|
||||||
} /* if -- There is no buffer associated with the window. */
|
} /* if -- There is no buffer associated with the window. */
|
||||||
|
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
/* A buffer is already associated with the window.
|
/* A buffer is already associated with the window.
|
||||||
* Add the new buffer ID to the array, reallocating the array memory
|
* Add the new buffer ID to the array, reallocating the array memory
|
||||||
* if necessary.
|
* if necessary.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Determine if there is a free element in the ID array. */
|
/* Determine if there is a free element in the ID array. */
|
||||||
for (i = 0; i < pDbeWindowPriv->maxAvailableIDs; i++)
|
for (i = 0; i < pDbeWindowPriv->maxAvailableIDs; i++) {
|
||||||
{
|
if (pDbeWindowPriv->IDs[i] == DBE_FREE_ID_ELEMENT) {
|
||||||
if (pDbeWindowPriv->IDs[i] == DBE_FREE_ID_ELEMENT)
|
|
||||||
{
|
|
||||||
/* There is still room in the ID array. */
|
/* There is still room in the ID array. */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i == pDbeWindowPriv->maxAvailableIDs)
|
if (i == pDbeWindowPriv->maxAvailableIDs) {
|
||||||
{
|
|
||||||
/* No more room in the ID array -- reallocate another array. */
|
/* No more room in the ID array -- reallocate another array. */
|
||||||
XID *pIDs;
|
XID *pIDs;
|
||||||
|
|
||||||
/* Setup an array pointer for the realloc operation below. */
|
/* 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. */
|
/* We will malloc a new array. */
|
||||||
pIDs = NULL;
|
pIDs = NULL;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
/* We will realloc a new array. */
|
/* We will realloc a new array. */
|
||||||
pIDs = pDbeWindowPriv->IDs;
|
pIDs = pDbeWindowPriv->IDs;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* malloc/realloc a new array and initialize all elements to 0. */
|
/* malloc/realloc a new array and initialize all elements to 0. */
|
||||||
pDbeWindowPriv->IDs = (XID *) realloc(pIDs,
|
pDbeWindowPriv->IDs = (XID *) realloc(pIDs,
|
||||||
(pDbeWindowPriv->maxAvailableIDs+DBE_INCR_MAX_IDS)*sizeof(XID));
|
(pDbeWindowPriv->
|
||||||
if (!pDbeWindowPriv->IDs)
|
maxAvailableIDs +
|
||||||
{
|
DBE_INCR_MAX_IDS) *
|
||||||
|
sizeof(XID));
|
||||||
|
if (!pDbeWindowPriv->IDs) {
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
memset(&pDbeWindowPriv->IDs[pDbeWindowPriv->nBufferIDs], 0,
|
memset(&pDbeWindowPriv->IDs[pDbeWindowPriv->nBufferIDs], 0,
|
||||||
(pDbeWindowPriv->maxAvailableIDs + DBE_INCR_MAX_IDS -
|
(pDbeWindowPriv->maxAvailableIDs + DBE_INCR_MAX_IDS -
|
||||||
pDbeWindowPriv->nBufferIDs) * sizeof(XID));
|
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
|
/* We just went from using the initial (static) array to a
|
||||||
* newly allocated array. Copy the IDs from the initial array
|
* newly allocated array. Copy the IDs from the initial array
|
||||||
* to the new array.
|
* to the new array.
|
||||||
|
|
@ -337,17 +318,14 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
|
||||||
|
|
||||||
} /* else -- A buffer is already associated with the window. */
|
} /* else -- A buffer is already associated with the window. */
|
||||||
|
|
||||||
|
|
||||||
/* Call the DDX routine to allocate the back buffer. */
|
/* Call the DDX routine to allocate the back buffer. */
|
||||||
status = (*pDbeScreenPriv->AllocBackBufferName) (pWin, stuff->buffer,
|
status = (*pDbeScreenPriv->AllocBackBufferName) (pWin, stuff->buffer,
|
||||||
stuff->swapAction);
|
stuff->swapAction);
|
||||||
|
|
||||||
if (status == Success)
|
if (status == Success) {
|
||||||
{
|
|
||||||
pDbeWindowPriv->IDs[add_index] = stuff->buffer;
|
pDbeWindowPriv->IDs[add_index] = stuff->buffer;
|
||||||
if (!AddResource(stuff->buffer, dbeWindowPrivResType,
|
if (!AddResource(stuff->buffer, dbeWindowPrivResType,
|
||||||
(pointer)pDbeWindowPriv))
|
(pointer) pDbeWindowPriv)) {
|
||||||
{
|
|
||||||
pDbeWindowPriv->IDs[add_index] = DBE_FREE_ID_ELEMENT;
|
pDbeWindowPriv->IDs[add_index] = DBE_FREE_ID_ELEMENT;
|
||||||
|
|
||||||
if (pDbeWindowPriv->nBufferIDs == 0) {
|
if (pDbeWindowPriv->nBufferIDs == 0) {
|
||||||
|
|
@ -355,7 +333,8 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
|
||||||
goto out_free;
|
goto out_free;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
/* The DDX buffer allocation routine failed for the first buffer of
|
/* The DDX buffer allocation routine failed for the first buffer of
|
||||||
* this window.
|
* this window.
|
||||||
*/
|
*/
|
||||||
|
|
@ -378,7 +357,6 @@ out_free:
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
} /* ProcDbeAllocateBackBufferName() */
|
} /* ProcDbeAllocateBackBufferName() */
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
|
|
@ -405,7 +383,6 @@ ProcDbeDeallocateBackBufferName(ClientPtr client)
|
||||||
int rc, i;
|
int rc, i;
|
||||||
pointer val;
|
pointer val;
|
||||||
|
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xDbeDeallocateBackBufferNameReq);
|
REQUEST_SIZE_MATCH(xDbeDeallocateBackBufferNameReq);
|
||||||
|
|
||||||
/* Buffer name must be valid */
|
/* Buffer name must be valid */
|
||||||
|
|
@ -425,17 +402,14 @@ ProcDbeDeallocateBackBufferName(ClientPtr client)
|
||||||
* above.
|
* above.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
for (i = 0; i < pDbeWindowPriv->nBufferIDs; i++)
|
for (i = 0; i < pDbeWindowPriv->nBufferIDs; i++) {
|
||||||
{
|
|
||||||
/* Loop through the ID list to find the ID. */
|
/* Loop through the ID list to find the ID. */
|
||||||
if (pDbeWindowPriv->IDs[i] == stuff->buffer)
|
if (pDbeWindowPriv->IDs[i] == stuff->buffer) {
|
||||||
{
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i == pDbeWindowPriv->nBufferIDs)
|
if (i == pDbeWindowPriv->nBufferIDs) {
|
||||||
{
|
|
||||||
/* We did not find the ID in the ID list. */
|
/* We did not find the ID in the ID list. */
|
||||||
client->errorValue = stuff->buffer;
|
client->errorValue = stuff->buffer;
|
||||||
return dbeErrorBase + DbeBadBuffer;
|
return dbeErrorBase + DbeBadBuffer;
|
||||||
|
|
@ -446,7 +420,6 @@ ProcDbeDeallocateBackBufferName(ClientPtr client)
|
||||||
return Success;
|
return Success;
|
||||||
|
|
||||||
} /* ProcDbeDeallocateBackBufferName() */
|
} /* ProcDbeDeallocateBackBufferName() */
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
|
|
@ -483,12 +456,10 @@ ProcDbeSwapBuffers(ClientPtr client)
|
||||||
register int i, j;
|
register int i, j;
|
||||||
int nStuff;
|
int nStuff;
|
||||||
|
|
||||||
|
|
||||||
REQUEST_AT_LEAST_SIZE(xDbeSwapBuffersReq);
|
REQUEST_AT_LEAST_SIZE(xDbeSwapBuffersReq);
|
||||||
nStuff = stuff->n; /* use local variable for performance. */
|
nStuff = stuff->n; /* use local variable for performance. */
|
||||||
|
|
||||||
if (nStuff == 0)
|
if (nStuff == 0) {
|
||||||
{
|
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -500,14 +471,11 @@ ProcDbeSwapBuffers(ClientPtr client)
|
||||||
|
|
||||||
/* Allocate array to record swap information. */
|
/* Allocate array to record swap information. */
|
||||||
swapInfo = (DbeSwapInfoPtr) malloc(nStuff * sizeof(DbeSwapInfoRec));
|
swapInfo = (DbeSwapInfoPtr) malloc(nStuff * sizeof(DbeSwapInfoRec));
|
||||||
if (swapInfo == NULL)
|
if (swapInfo == NULL) {
|
||||||
{
|
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < nStuff; i++) {
|
||||||
for (i = 0; i < nStuff; i++)
|
|
||||||
{
|
|
||||||
/* Check all windows to swap. */
|
/* Check all windows to swap. */
|
||||||
|
|
||||||
/* Each window must be a valid window - BadWindow. */
|
/* Each window must be a valid window - BadWindow. */
|
||||||
|
|
@ -519,17 +487,14 @@ ProcDbeSwapBuffers(ClientPtr client)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Each window must be double-buffered - BadMatch. */
|
/* Each window must be double-buffered - BadMatch. */
|
||||||
if (DBE_WINDOW_PRIV(pWin) == NULL)
|
if (DBE_WINDOW_PRIV(pWin) == NULL) {
|
||||||
{
|
|
||||||
free(swapInfo);
|
free(swapInfo);
|
||||||
return BadMatch;
|
return BadMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Each window must only be specified once - BadMatch. */
|
/* Each window must only be specified once - BadMatch. */
|
||||||
for (j = i + 1; j < nStuff; j++)
|
for (j = i + 1; j < nStuff; j++) {
|
||||||
{
|
if (dbeSwapInfo[i].window == dbeSwapInfo[j].window) {
|
||||||
if (dbeSwapInfo[i].window == dbeSwapInfo[j].window)
|
|
||||||
{
|
|
||||||
free(swapInfo);
|
free(swapInfo);
|
||||||
return BadMatch;
|
return BadMatch;
|
||||||
}
|
}
|
||||||
|
|
@ -539,8 +504,7 @@ ProcDbeSwapBuffers(ClientPtr client)
|
||||||
if ((dbeSwapInfo[i].swapAction != XdbeUndefined) &&
|
if ((dbeSwapInfo[i].swapAction != XdbeUndefined) &&
|
||||||
(dbeSwapInfo[i].swapAction != XdbeBackground) &&
|
(dbeSwapInfo[i].swapAction != XdbeBackground) &&
|
||||||
(dbeSwapInfo[i].swapAction != XdbeUntouched) &&
|
(dbeSwapInfo[i].swapAction != XdbeUntouched) &&
|
||||||
(dbeSwapInfo[i].swapAction != XdbeCopied ))
|
(dbeSwapInfo[i].swapAction != XdbeCopied)) {
|
||||||
{
|
|
||||||
free(swapInfo);
|
free(swapInfo);
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
|
@ -551,7 +515,6 @@ ProcDbeSwapBuffers(ClientPtr client)
|
||||||
|
|
||||||
} /* for (i = 0; i < nStuff; i++) */
|
} /* for (i = 0; i < nStuff; i++) */
|
||||||
|
|
||||||
|
|
||||||
/* Call the DDX routine to perform the swap(s). The DDX routine should
|
/* 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
|
* 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
|
* 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.
|
* could deal with cross-screen synchronization.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
while (nStuff > 0)
|
while (nStuff > 0) {
|
||||||
{
|
|
||||||
pDbeScreenPriv = DBE_SCREEN_PRIV_FROM_WINDOW(swapInfo[0].pWindow);
|
pDbeScreenPriv = DBE_SCREEN_PRIV_FROM_WINDOW(swapInfo[0].pWindow);
|
||||||
error = (*pDbeScreenPriv->SwapBuffers) (client, &nStuff, swapInfo);
|
error = (*pDbeScreenPriv->SwapBuffers) (client, &nStuff, swapInfo);
|
||||||
if (error != Success)
|
if (error != Success) {
|
||||||
{
|
|
||||||
free(swapInfo);
|
free(swapInfo);
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
@ -580,7 +541,6 @@ ProcDbeSwapBuffers(ClientPtr client)
|
||||||
return Success;
|
return Success;
|
||||||
|
|
||||||
} /* ProcDbeSwapBuffers() */
|
} /* ProcDbeSwapBuffers() */
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
|
|
@ -605,16 +565,13 @@ ProcDbeBeginIdiom(ClientPtr client)
|
||||||
DbeScreenPrivPtr pDbeScreenPriv;
|
DbeScreenPrivPtr pDbeScreenPriv;
|
||||||
register int i;
|
register int i;
|
||||||
|
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xDbeBeginIdiomReq);
|
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]);
|
pDbeScreenPriv = DBE_SCREEN_PRIV(screenInfo.screens[i]);
|
||||||
|
|
||||||
/* Call the DDX begin idiom procedure if there is one. */
|
/* Call the DDX begin idiom procedure if there is one. */
|
||||||
if (pDbeScreenPriv->BeginIdiom)
|
if (pDbeScreenPriv->BeginIdiom) {
|
||||||
{
|
|
||||||
(*pDbeScreenPriv->BeginIdiom) (client);
|
(*pDbeScreenPriv->BeginIdiom) (client);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -622,7 +579,6 @@ ProcDbeBeginIdiom(ClientPtr client)
|
||||||
return Success;
|
return Success;
|
||||||
|
|
||||||
} /* ProcDbeBeginIdiom() */
|
} /* ProcDbeBeginIdiom() */
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
|
|
@ -655,24 +611,20 @@ ProcDbeGetVisualInfo(ClientPtr client)
|
||||||
ScreenPtr pScreen;
|
ScreenPtr pScreen;
|
||||||
XdbeScreenVisualInfo *pScrVisInfo;
|
XdbeScreenVisualInfo *pScrVisInfo;
|
||||||
|
|
||||||
|
|
||||||
REQUEST_AT_LEAST_SIZE(xDbeGetVisualInfoReq);
|
REQUEST_AT_LEAST_SIZE(xDbeGetVisualInfoReq);
|
||||||
|
|
||||||
if (stuff->n > UINT32_MAX / sizeof(DrawablePtr))
|
if (stuff->n > UINT32_MAX / sizeof(DrawablePtr))
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
/* Make sure any specified drawables are valid. */
|
/* Make sure any specified drawables are valid. */
|
||||||
if (stuff->n != 0)
|
if (stuff->n != 0) {
|
||||||
{
|
|
||||||
if (!(pDrawables = (DrawablePtr *) malloc(stuff->n *
|
if (!(pDrawables = (DrawablePtr *) malloc(stuff->n *
|
||||||
sizeof(DrawablePtr))))
|
sizeof(DrawablePtr)))) {
|
||||||
{
|
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
|
|
||||||
drawables = (Drawable *) &stuff[1];
|
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,
|
rc = dixLookupDrawable(pDrawables + i, drawables[i], client, 0,
|
||||||
DixGetAttrAccess);
|
DixGetAttrAccess);
|
||||||
if (rc != Success) {
|
if (rc != Success) {
|
||||||
|
|
@ -683,8 +635,7 @@ ProcDbeGetVisualInfo(ClientPtr client)
|
||||||
}
|
}
|
||||||
|
|
||||||
count = (stuff->n == 0) ? screenInfo.numScreens : stuff->n;
|
count = (stuff->n == 0) ? screenInfo.numScreens : stuff->n;
|
||||||
if (!(pScrVisInfo = calloc(count, sizeof(XdbeScreenVisualInfo))))
|
if (!(pScrVisInfo = calloc(count, sizeof(XdbeScreenVisualInfo)))) {
|
||||||
{
|
|
||||||
free(pDrawables);
|
free(pDrawables);
|
||||||
|
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
|
@ -692,8 +643,7 @@ ProcDbeGetVisualInfo(ClientPtr client)
|
||||||
|
|
||||||
length = 0;
|
length = 0;
|
||||||
|
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++) {
|
||||||
{
|
|
||||||
pScreen = (stuff->n == 0) ? screenInfo.screens[i] :
|
pScreen = (stuff->n == 0) ? screenInfo.screens[i] :
|
||||||
pDrawables[i]->pScreen;
|
pDrawables[i]->pScreen;
|
||||||
pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
|
pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
|
||||||
|
|
@ -702,8 +652,7 @@ ProcDbeGetVisualInfo(ClientPtr client)
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
goto freeScrVisInfo;
|
goto freeScrVisInfo;
|
||||||
|
|
||||||
if (!(*pDbeScreenPriv->GetVisualInfo)(pScreen, &pScrVisInfo[i]))
|
if (!(*pDbeScreenPriv->GetVisualInfo) (pScreen, &pScrVisInfo[i])) {
|
||||||
{
|
|
||||||
/* We failed to alloc pScrVisInfo[i].visinfo. */
|
/* We failed to alloc pScrVisInfo[i].visinfo. */
|
||||||
rc = BadAlloc;
|
rc = BadAlloc;
|
||||||
|
|
||||||
|
|
@ -723,8 +672,7 @@ ProcDbeGetVisualInfo(ClientPtr client)
|
||||||
rep.length = bytes_to_int32(length);
|
rep.length = bytes_to_int32(length);
|
||||||
rep.m = count;
|
rep.m = count;
|
||||||
|
|
||||||
if (client->swapped)
|
if (client->swapped) {
|
||||||
{
|
|
||||||
swaps(&rep.sequenceNumber);
|
swaps(&rep.sequenceNumber);
|
||||||
swapl(&rep.length);
|
swapl(&rep.length);
|
||||||
swapl(&rep.m);
|
swapl(&rep.m);
|
||||||
|
|
@ -733,8 +681,7 @@ ProcDbeGetVisualInfo(ClientPtr client)
|
||||||
/* Send off reply. */
|
/* Send off reply. */
|
||||||
WriteToClient(client, sizeof(xDbeGetVisualInfoReply), (char *) &rep);
|
WriteToClient(client, sizeof(xDbeGetVisualInfoReply), (char *) &rep);
|
||||||
|
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++) {
|
||||||
{
|
|
||||||
CARD32 data32;
|
CARD32 data32;
|
||||||
|
|
||||||
/* For each screen in the reply, send off the visual info */
|
/* For each screen in the reply, send off the visual info */
|
||||||
|
|
@ -742,16 +689,14 @@ ProcDbeGetVisualInfo(ClientPtr client)
|
||||||
/* Send off number of visuals. */
|
/* Send off number of visuals. */
|
||||||
data32 = (CARD32) pScrVisInfo[i].count;
|
data32 = (CARD32) pScrVisInfo[i].count;
|
||||||
|
|
||||||
if (client->swapped)
|
if (client->swapped) {
|
||||||
{
|
|
||||||
swapl(&data32);
|
swapl(&data32);
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteToClient(client, sizeof(CARD32), (char *) &data32);
|
WriteToClient(client, sizeof(CARD32), (char *) &data32);
|
||||||
|
|
||||||
/* Now send off visual info items. */
|
/* Now send off visual info items. */
|
||||||
for (j = 0; j < pScrVisInfo[i].count; j++)
|
for (j = 0; j < pScrVisInfo[i].count; j++) {
|
||||||
{
|
|
||||||
xDbeVisInfo visInfo;
|
xDbeVisInfo visInfo;
|
||||||
|
|
||||||
/* Copy the data in the client data structure to a protocol
|
/* 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.depth = (CARD8) pScrVisInfo[i].visinfo[j].depth;
|
||||||
visInfo.perfLevel = (CARD8) pScrVisInfo[i].visinfo[j].perflevel;
|
visInfo.perfLevel = (CARD8) pScrVisInfo[i].visinfo[j].perflevel;
|
||||||
|
|
||||||
if (client->swapped)
|
if (client->swapped) {
|
||||||
{
|
|
||||||
swapl(&visInfo.visualID);
|
swapl(&visInfo.visualID);
|
||||||
|
|
||||||
/* We do not need to swap depth and perfLevel since they are
|
/* 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). */
|
/* 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:
|
freeScrVisInfo:
|
||||||
/* Clean up memory. */
|
/* Clean up memory. */
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++) {
|
||||||
{
|
|
||||||
free(pScrVisInfo[i].visinfo);
|
free(pScrVisInfo[i].visinfo);
|
||||||
}
|
}
|
||||||
free(pScrVisInfo);
|
free(pScrVisInfo);
|
||||||
|
|
@ -792,7 +736,6 @@ ProcDbeGetVisualInfo(ClientPtr client)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
} /* ProcDbeGetVisualInfo() */
|
} /* ProcDbeGetVisualInfo() */
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
|
|
@ -817,18 +760,15 @@ ProcDbeGetBackBufferAttributes(ClientPtr client)
|
||||||
DbeWindowPrivPtr pDbeWindowPriv;
|
DbeWindowPrivPtr pDbeWindowPriv;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xDbeGetBackBufferAttributesReq);
|
REQUEST_SIZE_MATCH(xDbeGetBackBufferAttributesReq);
|
||||||
|
|
||||||
rc = dixLookupResourceByType((pointer *) &pDbeWindowPriv, stuff->buffer,
|
rc = dixLookupResourceByType((pointer *) &pDbeWindowPriv, stuff->buffer,
|
||||||
dbeWindowPrivResType, client,
|
dbeWindowPrivResType, client,
|
||||||
DixGetAttrAccess);
|
DixGetAttrAccess);
|
||||||
if (rc == Success)
|
if (rc == Success) {
|
||||||
{
|
|
||||||
rep.attributes = pDbeWindowPriv->pWindow->drawable.id;
|
rep.attributes = pDbeWindowPriv->pWindow->drawable.id;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
rep.attributes = None;
|
rep.attributes = None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -836,8 +776,7 @@ ProcDbeGetBackBufferAttributes(ClientPtr client)
|
||||||
rep.sequenceNumber = client->sequence;
|
rep.sequenceNumber = client->sequence;
|
||||||
rep.length = 0;
|
rep.length = 0;
|
||||||
|
|
||||||
if (client->swapped)
|
if (client->swapped) {
|
||||||
{
|
|
||||||
swaps(&rep.sequenceNumber);
|
swaps(&rep.sequenceNumber);
|
||||||
swapl(&rep.length);
|
swapl(&rep.length);
|
||||||
swapl(&rep.attributes);
|
swapl(&rep.attributes);
|
||||||
|
|
@ -848,7 +787,6 @@ ProcDbeGetBackBufferAttributes(ClientPtr client)
|
||||||
return Success;
|
return Success;
|
||||||
|
|
||||||
} /* ProcDbeGetbackBufferAttributes() */
|
} /* ProcDbeGetbackBufferAttributes() */
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
|
|
@ -865,9 +803,7 @@ ProcDbeDispatch(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xReq);
|
REQUEST(xReq);
|
||||||
|
|
||||||
|
switch (stuff->data) {
|
||||||
switch (stuff->data)
|
|
||||||
{
|
|
||||||
case X_DbeGetVersion:
|
case X_DbeGetVersion:
|
||||||
return (ProcDbeGetVersion(client));
|
return (ProcDbeGetVersion(client));
|
||||||
|
|
||||||
|
|
@ -897,7 +833,6 @@ ProcDbeDispatch(ClientPtr client)
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* ProcDbeDispatch() */
|
} /* ProcDbeDispatch() */
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
|
|
@ -924,7 +859,6 @@ SProcDbeGetVersion(ClientPtr client)
|
||||||
return (ProcDbeGetVersion(client));
|
return (ProcDbeGetVersion(client));
|
||||||
|
|
||||||
} /* SProcDbeGetVersion() */
|
} /* SProcDbeGetVersion() */
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
|
|
@ -964,7 +898,6 @@ SProcDbeAllocateBackBufferName(ClientPtr client)
|
||||||
return (ProcDbeAllocateBackBufferName(client));
|
return (ProcDbeAllocateBackBufferName(client));
|
||||||
|
|
||||||
} /* SProcDbeAllocateBackBufferName() */
|
} /* SProcDbeAllocateBackBufferName() */
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
|
|
@ -996,7 +929,6 @@ SProcDbeDeallocateBackBufferName(ClientPtr client)
|
||||||
return (ProcDbeDeallocateBackBufferName(client));
|
return (ProcDbeDeallocateBackBufferName(client));
|
||||||
|
|
||||||
} /* SProcDbeDeallocateBackBufferName() */
|
} /* SProcDbeDeallocateBackBufferName() */
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
|
|
@ -1026,22 +958,19 @@ SProcDbeSwapBuffers(ClientPtr client)
|
||||||
register int i;
|
register int i;
|
||||||
xDbeSwapInfo *pSwapInfo;
|
xDbeSwapInfo *pSwapInfo;
|
||||||
|
|
||||||
|
|
||||||
swaps(&stuff->length);
|
swaps(&stuff->length);
|
||||||
REQUEST_AT_LEAST_SIZE(xDbeSwapBuffersReq);
|
REQUEST_AT_LEAST_SIZE(xDbeSwapBuffersReq);
|
||||||
|
|
||||||
swapl(&stuff->n);
|
swapl(&stuff->n);
|
||||||
|
|
||||||
if (stuff->n != 0)
|
if (stuff->n != 0) {
|
||||||
{
|
|
||||||
pSwapInfo = (xDbeSwapInfo *) stuff + 1;
|
pSwapInfo = (xDbeSwapInfo *) stuff + 1;
|
||||||
|
|
||||||
/* The swap info following the fix part of this request is a window(32)
|
/* 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
|
* followed by a 1 byte swap action and then 3 pad bytes. We only need
|
||||||
* to swap the window information.
|
* to swap the window information.
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < stuff->n; i++)
|
for (i = 0; i < stuff->n; i++) {
|
||||||
{
|
|
||||||
swapl(&pSwapInfo->window);
|
swapl(&pSwapInfo->window);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1049,7 +978,6 @@ SProcDbeSwapBuffers(ClientPtr client)
|
||||||
return (ProcDbeSwapBuffers(client));
|
return (ProcDbeSwapBuffers(client));
|
||||||
|
|
||||||
} /* SProcDbeSwapBuffers() */
|
} /* SProcDbeSwapBuffers() */
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
|
|
@ -1076,7 +1004,6 @@ SProcDbeBeginIdiom(ClientPtr client)
|
||||||
return (ProcDbeBeginIdiom(client));
|
return (ProcDbeBeginIdiom(client));
|
||||||
|
|
||||||
} /* SProcDbeBeginIdiom() */
|
} /* SProcDbeBeginIdiom() */
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
|
|
@ -1109,7 +1036,6 @@ SProcDbeGetVisualInfo(ClientPtr client)
|
||||||
return (ProcDbeGetVisualInfo(client));
|
return (ProcDbeGetVisualInfo(client));
|
||||||
|
|
||||||
} /* SProcDbeGetVisualInfo() */
|
} /* SProcDbeGetVisualInfo() */
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
|
|
@ -1140,7 +1066,6 @@ SProcDbeGetBackBufferAttributes(ClientPtr client)
|
||||||
return (ProcDbeGetBackBufferAttributes(client));
|
return (ProcDbeGetBackBufferAttributes(client));
|
||||||
|
|
||||||
} /* SProcDbeGetBackBufferAttributes() */
|
} /* SProcDbeGetBackBufferAttributes() */
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
|
|
@ -1157,9 +1082,7 @@ SProcDbeDispatch(ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xReq);
|
REQUEST(xReq);
|
||||||
|
|
||||||
|
switch (stuff->data) {
|
||||||
switch (stuff->data)
|
|
||||||
{
|
|
||||||
case X_DbeGetVersion:
|
case X_DbeGetVersion:
|
||||||
return (SProcDbeGetVersion(client));
|
return (SProcDbeGetVersion(client));
|
||||||
|
|
||||||
|
|
@ -1189,7 +1112,6 @@ SProcDbeDispatch(ClientPtr client)
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* SProcDbeDispatch() */
|
} /* SProcDbeDispatch() */
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
|
|
@ -1215,15 +1137,13 @@ DbeSetupBackgroundPainter(WindowPtr pWin, GCPtr pGC)
|
||||||
int backgroundState;
|
int backgroundState;
|
||||||
Mask gcmask;
|
Mask gcmask;
|
||||||
|
|
||||||
|
|
||||||
/* First take care of any ParentRelative stuff by altering the
|
/* First take care of any ParentRelative stuff by altering the
|
||||||
* tile/stipple origin to match the coordinates of the upper-left
|
* tile/stipple origin to match the coordinates of the upper-left
|
||||||
* corner of the first ancestor without a ParentRelative background.
|
* corner of the first ancestor without a ParentRelative background.
|
||||||
* This coordinate is, of course, negative.
|
* This coordinate is, of course, negative.
|
||||||
*/
|
*/
|
||||||
ts_x_origin = ts_y_origin = 0;
|
ts_x_origin = ts_y_origin = 0;
|
||||||
while (pWin->backgroundState == ParentRelative)
|
while (pWin->backgroundState == ParentRelative) {
|
||||||
{
|
|
||||||
ts_x_origin -= pWin->origin.x;
|
ts_x_origin -= pWin->origin.x;
|
||||||
ts_y_origin -= pWin->origin.y;
|
ts_y_origin -= pWin->origin.y;
|
||||||
|
|
||||||
|
|
@ -1232,8 +1152,7 @@ DbeSetupBackgroundPainter(WindowPtr pWin, GCPtr pGC)
|
||||||
backgroundState = pWin->backgroundState;
|
backgroundState = pWin->backgroundState;
|
||||||
background = pWin->background;
|
background = pWin->background;
|
||||||
|
|
||||||
switch (backgroundState)
|
switch (backgroundState) {
|
||||||
{
|
|
||||||
case BackgroundPixel:
|
case BackgroundPixel:
|
||||||
gcvalues[0].val = background.pixel;
|
gcvalues[0].val = background.pixel;
|
||||||
gcvalues[1].val = FillSolid;
|
gcvalues[1].val = FillSolid;
|
||||||
|
|
@ -1255,7 +1174,6 @@ DbeSetupBackgroundPainter(WindowPtr pWin, GCPtr pGC)
|
||||||
|
|
||||||
return ChangeGC(NullClient, pGC, gcmask, gcvalues) == 0;
|
return ChangeGC(NullClient, pGC, gcmask, gcvalues) == 0;
|
||||||
} /* DbeSetupBackgroundPainter() */
|
} /* DbeSetupBackgroundPainter() */
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
|
|
@ -1279,7 +1197,6 @@ DbeDrawableDelete(pointer pDrawable, XID id)
|
||||||
return Success;
|
return Success;
|
||||||
|
|
||||||
} /* DbeDrawableDelete() */
|
} /* DbeDrawableDelete() */
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
|
|
@ -1299,7 +1216,6 @@ DbeWindowPrivDelete(pointer pDbeWinPriv, XID id)
|
||||||
DbeWindowPrivPtr pDbeWindowPriv = (DbeWindowPrivPtr) pDbeWinPriv;
|
DbeWindowPrivPtr pDbeWindowPriv = (DbeWindowPrivPtr) pDbeWinPriv;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
** Remove the buffer ID from the ID array.
|
** Remove the buffer ID from the ID array.
|
||||||
|
|
@ -1308,27 +1224,23 @@ DbeWindowPrivDelete(pointer pDbeWinPriv, XID id)
|
||||||
|
|
||||||
/* Find the ID in the ID array. */
|
/* Find the ID in the ID array. */
|
||||||
i = 0;
|
i = 0;
|
||||||
while ((i < pDbeWindowPriv->nBufferIDs) && (pDbeWindowPriv->IDs[i] != id))
|
while ((i < pDbeWindowPriv->nBufferIDs) && (pDbeWindowPriv->IDs[i] != id)) {
|
||||||
{
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i == pDbeWindowPriv->nBufferIDs)
|
if (i == pDbeWindowPriv->nBufferIDs) {
|
||||||
{
|
|
||||||
/* We did not find the ID in the array. We should never get here. */
|
/* We did not find the ID in the array. We should never get here. */
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Remove the ID from the array. */
|
/* 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. */
|
/* Compress the buffer ID array, overwriting the ID in the process. */
|
||||||
memmove(&pDbeWindowPriv->IDs[i], &pDbeWindowPriv->IDs[i + 1],
|
memmove(&pDbeWindowPriv->IDs[i], &pDbeWindowPriv->IDs[i + 1],
|
||||||
(pDbeWindowPriv->nBufferIDs - i - 1) * sizeof(XID));
|
(pDbeWindowPriv->nBufferIDs - i - 1) * sizeof(XID));
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
/* We are removing the last ID in the array, in which case, the
|
/* We are removing the last ID in the array, in which case, the
|
||||||
* assignement below is all that we need to do.
|
* 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) &&
|
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. */
|
/* Copy the IDs back into the static array. */
|
||||||
memcpy(pDbeWindowPriv->initIDs, pDbeWindowPriv->IDs,
|
memcpy(pDbeWindowPriv->initIDs, pDbeWindowPriv->IDs,
|
||||||
DBE_INIT_MAX_IDS * sizeof(XID));
|
DBE_INIT_MAX_IDS * sizeof(XID));
|
||||||
|
|
@ -1354,18 +1265,16 @@ DbeWindowPrivDelete(pointer pDbeWinPriv, XID id)
|
||||||
pDbeWindowPriv->maxAvailableIDs = DBE_INIT_MAX_IDS;
|
pDbeWindowPriv->maxAvailableIDs = DBE_INIT_MAX_IDS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
** Perform DDX level tasks.
|
** Perform DDX level tasks.
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
pDbeScreenPriv = DBE_SCREEN_PRIV_FROM_WINDOW_PRIV(
|
pDbeScreenPriv = DBE_SCREEN_PRIV_FROM_WINDOW_PRIV((DbeWindowPrivPtr)
|
||||||
(DbeWindowPrivPtr)pDbeWindowPriv);
|
pDbeWindowPriv);
|
||||||
(*pDbeScreenPriv->WinPrivDelete) ((DbeWindowPrivPtr) pDbeWindowPriv, id);
|
(*pDbeScreenPriv->WinPrivDelete) ((DbeWindowPrivPtr) pDbeWindowPriv, id);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
** Perform miscellaneous tasks if this is the last buffer associated
|
** 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. */
|
/* Reset the DBE window priv pointer. */
|
||||||
dixSetPrivate(&pDbeWindowPriv->pWindow->devPrivates, dbeWindowPrivKey,
|
dixSetPrivate(&pDbeWindowPriv->pWindow->devPrivates, dbeWindowPrivKey,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
@ -1386,7 +1294,6 @@ DbeWindowPrivDelete(pointer pDbeWinPriv, XID id)
|
||||||
return Success;
|
return Success;
|
||||||
|
|
||||||
} /* DbeWindowPrivDelete() */
|
} /* DbeWindowPrivDelete() */
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
|
|
@ -1406,13 +1313,11 @@ DbeResetProc(ExtensionEntry *extEntry)
|
||||||
ScreenPtr pScreen;
|
ScreenPtr pScreen;
|
||||||
DbeScreenPrivPtr pDbeScreenPriv;
|
DbeScreenPrivPtr pDbeScreenPriv;
|
||||||
|
|
||||||
for (i = 0; i < screenInfo.numScreens; i++)
|
for (i = 0; i < screenInfo.numScreens; i++) {
|
||||||
{
|
|
||||||
pScreen = screenInfo.screens[i];
|
pScreen = screenInfo.screens[i];
|
||||||
pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
|
pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
|
||||||
|
|
||||||
if (pDbeScreenPriv)
|
if (pDbeScreenPriv) {
|
||||||
{
|
|
||||||
/* Unwrap DestroyWindow, which was wrapped in DbeExtensionInit(). */
|
/* Unwrap DestroyWindow, which was wrapped in DbeExtensionInit(). */
|
||||||
pScreen->DestroyWindow = pDbeScreenPriv->DestroyWindow;
|
pScreen->DestroyWindow = pDbeScreenPriv->DestroyWindow;
|
||||||
|
|
||||||
|
|
@ -1423,7 +1328,6 @@ DbeResetProc(ExtensionEntry *extEntry)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} /* DbeResetProc() */
|
} /* DbeResetProc() */
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
|
|
@ -1445,7 +1349,6 @@ DbeDestroyWindow(WindowPtr pWin)
|
||||||
ScreenPtr pScreen;
|
ScreenPtr pScreen;
|
||||||
Bool ret;
|
Bool ret;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
** 1. Unwrap the member routine.
|
** 1. Unwrap the member routine.
|
||||||
|
|
@ -1465,10 +1368,8 @@ DbeDestroyWindow(WindowPtr pWin)
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ((pDbeWindowPriv = DBE_WINDOW_PRIV(pWin)))
|
if ((pDbeWindowPriv = DBE_WINDOW_PRIV(pWin))) {
|
||||||
{
|
while (pDbeWindowPriv) {
|
||||||
while (pDbeWindowPriv)
|
|
||||||
{
|
|
||||||
/* *DbeWinPrivDelete() will free the window private and set it to
|
/* *DbeWinPrivDelete() will free the window private and set it to
|
||||||
* NULL if there are no more buffer IDs associated with this
|
* NULL if there are no more buffer IDs associated with this
|
||||||
* window.
|
* window.
|
||||||
|
|
@ -1507,7 +1408,6 @@ DbeDestroyWindow(WindowPtr pWin)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
} /* DbeDestroyWindow() */
|
} /* DbeDestroyWindow() */
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
|
|
@ -1530,7 +1430,8 @@ DbeExtensionInit(void)
|
||||||
Bool ddxInitSuccess;
|
Bool ddxInitSuccess;
|
||||||
|
|
||||||
#ifdef PANORAMIX
|
#ifdef PANORAMIX
|
||||||
if(!noPanoramiXExtension) return;
|
if (!noPanoramiXExtension)
|
||||||
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Create the resource types. */
|
/* Create the resource types. */
|
||||||
|
|
@ -1551,22 +1452,19 @@ DbeExtensionInit(void)
|
||||||
if (!dixRegisterPrivateKey(&dbeWindowPrivKeyRec, PRIVATE_WINDOW, 0))
|
if (!dixRegisterPrivateKey(&dbeWindowPrivKeyRec, PRIVATE_WINDOW, 0))
|
||||||
return;
|
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
|
/* For each screen, set up DBE screen privates and init DIX and DDX
|
||||||
* interface.
|
* interface.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
pScreen = screenInfo.screens[i];
|
pScreen = screenInfo.screens[i];
|
||||||
|
|
||||||
if (!(pDbeScreenPriv = malloc (sizeof (DbeScreenPrivRec))))
|
if (!(pDbeScreenPriv = malloc(sizeof(DbeScreenPrivRec)))) {
|
||||||
{
|
|
||||||
/* If we can not alloc a window or screen private,
|
/* If we can not alloc a window or screen private,
|
||||||
* then free any privates that we already alloc'ed and return
|
* 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,
|
free(dixLookupPrivate(&screenInfo.screens[j]->devPrivates,
|
||||||
dbeScreenPrivKey));
|
dbeScreenPrivKey));
|
||||||
dixSetPrivate(&screenInfo.screens[j]->devPrivates,
|
dixSetPrivate(&screenInfo.screens[j]->devPrivates,
|
||||||
|
|
@ -1592,8 +1490,7 @@ DbeExtensionInit(void)
|
||||||
*/
|
*/
|
||||||
pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
|
pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
|
||||||
|
|
||||||
if (ddxInitSuccess)
|
if (ddxInitSuccess) {
|
||||||
{
|
|
||||||
/* Wrap DestroyWindow. The DDX initialization function
|
/* Wrap DestroyWindow. The DDX initialization function
|
||||||
* already wrapped PositionWindow for us.
|
* already wrapped PositionWindow for us.
|
||||||
*/
|
*/
|
||||||
|
|
@ -1601,8 +1498,7 @@ DbeExtensionInit(void)
|
||||||
pDbeScreenPriv->DestroyWindow = pScreen->DestroyWindow;
|
pDbeScreenPriv->DestroyWindow = pScreen->DestroyWindow;
|
||||||
pScreen->DestroyWindow = DbeDestroyWindow;
|
pScreen->DestroyWindow = DbeDestroyWindow;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
/* DDX initialization failed. Stub the screen. */
|
/* DDX initialization failed. Stub the screen. */
|
||||||
DbeStubScreen(pDbeScreenPriv, &nStubbedScreens);
|
DbeStubScreen(pDbeScreenPriv, &nStubbedScreens);
|
||||||
}
|
}
|
||||||
|
|
@ -1614,13 +1510,10 @@ DbeExtensionInit(void)
|
||||||
|
|
||||||
} /* for (i = 0; i < screenInfo.numScreens; i++) */
|
} /* for (i = 0; i < screenInfo.numScreens; i++) */
|
||||||
|
|
||||||
|
if (nStubbedScreens == screenInfo.numScreens) {
|
||||||
if (nStubbedScreens == screenInfo.numScreens)
|
|
||||||
{
|
|
||||||
/* All screens stubbed. Clean up and return. */
|
/* 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,
|
free(dixLookupPrivate(&screenInfo.screens[i]->devPrivates,
|
||||||
dbeScreenPrivKey));
|
dbeScreenPrivKey));
|
||||||
dixSetPrivate(&pScreen->devPrivates, dbeScreenPrivKey, NULL);
|
dixSetPrivate(&pScreen->devPrivates, dbeScreenPrivKey, NULL);
|
||||||
|
|
@ -1628,15 +1521,14 @@ DbeExtensionInit(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Now add the extension. */
|
/* Now add the extension. */
|
||||||
extEntry = AddExtension(DBE_PROTOCOL_NAME, DbeNumberEvents,
|
extEntry = AddExtension(DBE_PROTOCOL_NAME, DbeNumberEvents,
|
||||||
DbeNumberErrors, ProcDbeDispatch, SProcDbeDispatch,
|
DbeNumberErrors, ProcDbeDispatch, SProcDbeDispatch,
|
||||||
DbeResetProc, StandardMinorOpcode);
|
DbeResetProc, StandardMinorOpcode);
|
||||||
|
|
||||||
dbeErrorBase = extEntry->errorBase;
|
dbeErrorBase = extEntry->errorBase;
|
||||||
SetResourceTypeErrorValue(dbeWindowPrivResType, dbeErrorBase + DbeBadBuffer);
|
SetResourceTypeErrorValue(dbeWindowPrivResType,
|
||||||
|
dbeErrorBase + DbeBadBuffer);
|
||||||
SetResourceTypeErrorValue(dbeDrawableResType, dbeErrorBase + DbeBadBuffer);
|
SetResourceTypeErrorValue(dbeDrawableResType, dbeErrorBase + DbeBadBuffer);
|
||||||
|
|
||||||
} /* DbeExtensionInit() */
|
} /* DbeExtensionInit() */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,6 @@
|
||||||
#ifndef DBE_STRUCT_H
|
#ifndef DBE_STRUCT_H
|
||||||
#define DBE_STRUCT_H
|
#define DBE_STRUCT_H
|
||||||
|
|
||||||
|
|
||||||
/* INCLUDES */
|
/* INCLUDES */
|
||||||
|
|
||||||
#define NEED_DBE_PROTOCOL
|
#define NEED_DBE_PROTOCOL
|
||||||
|
|
@ -41,20 +40,16 @@
|
||||||
#include "windowstr.h"
|
#include "windowstr.h"
|
||||||
#include "privates.h"
|
#include "privates.h"
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
VisualID visual; /* one visual ID that supports double-buffering */
|
VisualID visual; /* one visual ID that supports double-buffering */
|
||||||
int depth; /* depth of visual in bits */
|
int depth; /* depth of visual in bits */
|
||||||
int perflevel; /* performance level of visual */
|
int perflevel; /* performance level of visual */
|
||||||
}
|
} XdbeVisualInfo;
|
||||||
XdbeVisualInfo;
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
int count; /* number of items in visual_depth */
|
int count; /* number of items in visual_depth */
|
||||||
XdbeVisualInfo *visinfo; /* list of visuals & depths for scrn */
|
XdbeVisualInfo *visinfo; /* list of visuals & depths for scrn */
|
||||||
}
|
} XdbeScreenVisualInfo;
|
||||||
XdbeScreenVisualInfo;
|
|
||||||
|
|
||||||
/* DEFINES */
|
/* DEFINES */
|
||||||
|
|
||||||
|
|
@ -95,8 +90,7 @@ extern _X_EXPORT void DbeExtensionInit (void);
|
||||||
/* Record used to pass swap information between DIX and DDX swapping
|
/* Record used to pass swap information between DIX and DDX swapping
|
||||||
* procedures.
|
* procedures.
|
||||||
*/
|
*/
|
||||||
typedef struct _DbeSwapInfoRec
|
typedef struct _DbeSwapInfoRec {
|
||||||
{
|
|
||||||
WindowPtr pWindow;
|
WindowPtr pWindow;
|
||||||
unsigned char swapAction;
|
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
|
/* A pointer to the window with which the DBE window private (buffer) is
|
||||||
* associated.
|
* associated.
|
||||||
*/
|
*/
|
||||||
|
|
@ -158,15 +151,13 @@ typedef struct _DbeWindowPrivRec
|
||||||
|
|
||||||
} DbeWindowPrivRec, *DbeWindowPrivPtr;
|
} DbeWindowPrivRec, *DbeWindowPrivPtr;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
** Per-screen data
|
** Per-screen data
|
||||||
******************************************************************************
|
******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct _DbeScreenPrivRec
|
typedef struct _DbeScreenPrivRec {
|
||||||
{
|
|
||||||
/* Wrapped functions
|
/* Wrapped functions
|
||||||
* It is the responsibilty of the DDX layer to wrap PositionWindow().
|
* It is the responsibilty of the DDX layer to wrap PositionWindow().
|
||||||
* DbeExtensionInit wraps DestroyWindow().
|
* DbeExtensionInit wraps DestroyWindow().
|
||||||
|
|
@ -175,38 +166,30 @@ typedef struct _DbeScreenPrivRec
|
||||||
DestroyWindowProcPtr DestroyWindow;
|
DestroyWindowProcPtr DestroyWindow;
|
||||||
|
|
||||||
/* Per-screen DIX routines */
|
/* Per-screen DIX routines */
|
||||||
Bool (*SetupBackgroundPainter)(
|
Bool (*SetupBackgroundPainter) (WindowPtr /*pWin */ ,
|
||||||
WindowPtr /*pWin*/,
|
|
||||||
GCPtr /*pGC */
|
GCPtr /*pGC */
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Per-screen DDX routines */
|
/* Per-screen DDX routines */
|
||||||
Bool (*GetVisualInfo)(
|
Bool (*GetVisualInfo) (ScreenPtr /*pScreen */ ,
|
||||||
ScreenPtr /*pScreen*/,
|
|
||||||
XdbeScreenVisualInfo * /*pVisInfo */
|
XdbeScreenVisualInfo * /*pVisInfo */
|
||||||
);
|
);
|
||||||
int (*AllocBackBufferName)(
|
int (*AllocBackBufferName) (WindowPtr /*pWin */ ,
|
||||||
WindowPtr /*pWin*/,
|
|
||||||
XID /*bufId */ ,
|
XID /*bufId */ ,
|
||||||
int /*swapAction */
|
int /*swapAction */
|
||||||
);
|
);
|
||||||
int (*SwapBuffers)(
|
int (*SwapBuffers) (ClientPtr /*client */ ,
|
||||||
ClientPtr /*client*/,
|
|
||||||
int * /*pNumWindows */ ,
|
int * /*pNumWindows */ ,
|
||||||
DbeSwapInfoPtr /*swapInfo */
|
DbeSwapInfoPtr /*swapInfo */
|
||||||
);
|
);
|
||||||
void (*BeginIdiom)(
|
void (*BeginIdiom) (ClientPtr /*client */
|
||||||
ClientPtr /*client*/
|
|
||||||
);
|
);
|
||||||
void (*EndIdiom)(
|
void (*EndIdiom) (ClientPtr /*client */
|
||||||
ClientPtr /*client*/
|
|
||||||
);
|
);
|
||||||
void (*WinPrivDelete)(
|
void (*WinPrivDelete) (DbeWindowPrivPtr /*pDbeWindowPriv */ ,
|
||||||
DbeWindowPrivPtr /*pDbeWindowPriv*/,
|
|
||||||
XID /*bufId */
|
XID /*bufId */
|
||||||
);
|
);
|
||||||
void (*ResetProc)(
|
void (*ResetProc) (ScreenPtr /*pScreen */
|
||||||
ScreenPtr /*pScreen*/
|
|
||||||
);
|
);
|
||||||
|
|
||||||
} DbeScreenPrivRec, *DbeScreenPrivPtr;
|
} DbeScreenPrivRec, *DbeScreenPrivPtr;
|
||||||
|
|
|
||||||
176
dbe/midbe.c
176
dbe/midbe.c
|
|
@ -30,7 +30,6 @@
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
/* INCLUDES */
|
/* INCLUDES */
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
#ifdef HAVE_DIX_CONFIG_H
|
||||||
|
|
@ -59,8 +58,8 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
static DevPrivateKeyRec miDbeWindowPrivPrivKeyRec;
|
static DevPrivateKeyRec miDbeWindowPrivPrivKeyRec;
|
||||||
#define miDbeWindowPrivPrivKey (&miDbeWindowPrivPrivKeyRec)
|
|
||||||
|
|
||||||
|
#define miDbeWindowPrivPrivKey (&miDbeWindowPrivPrivKeyRec)
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
|
|
@ -86,27 +85,22 @@ miDbeGetVisualInfo(ScreenPtr pScreen, XdbeScreenVisualInfo *pScrVisInfo)
|
||||||
DepthPtr pDepth;
|
DepthPtr pDepth;
|
||||||
XdbeVisualInfo *visInfo;
|
XdbeVisualInfo *visInfo;
|
||||||
|
|
||||||
|
|
||||||
/* Determine number of visuals for this screen. */
|
/* 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;
|
count += pScreen->allowedDepths[i].numVids;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate an array of XdbeVisualInfo items. */
|
/* 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 */
|
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. */
|
/* For each depth of this screen, get visual information. */
|
||||||
|
|
||||||
pDepth = &pScreen->allowedDepths[i];
|
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
|
/* For each visual for this depth of this screen, get visual ID
|
||||||
* and visual depth. Since this is MI code, we will always return
|
* and visual depth. Since this is MI code, we will always return
|
||||||
* the same performance level for all visuals (0). A higher
|
* the same performance level for all visuals (0). A higher
|
||||||
|
|
@ -128,7 +122,6 @@ miDbeGetVisualInfo(ScreenPtr pScreen, XdbeScreenVisualInfo *pScrVisInfo)
|
||||||
return TRUE; /* success */
|
return TRUE; /* success */
|
||||||
|
|
||||||
} /* miDbeGetVisualInfo() */
|
} /* miDbeGetVisualInfo() */
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
|
|
@ -151,12 +144,10 @@ miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction)
|
||||||
xRectangle clearRect;
|
xRectangle clearRect;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
|
|
||||||
pScreen = pWin->drawable.pScreen;
|
pScreen = pWin->drawable.pScreen;
|
||||||
pDbeWindowPriv = DBE_WINDOW_PRIV(pWin);
|
pDbeWindowPriv = DBE_WINDOW_PRIV(pWin);
|
||||||
|
|
||||||
if (pDbeWindowPriv->nBufferIDs == 0)
|
if (pDbeWindowPriv->nBufferIDs == 0) {
|
||||||
{
|
|
||||||
/* There is no buffer associated with the window.
|
/* There is no buffer associated with the window.
|
||||||
* We have to create the window priv priv. Remember, 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
|
* 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 =
|
if (!(pDbeWindowPrivPriv->pFrontBuffer =
|
||||||
(*pScreen->CreatePixmap) (pScreen, pDbeWindowPriv->width,
|
(*pScreen->CreatePixmap) (pScreen, pDbeWindowPriv->width,
|
||||||
pDbeWindowPriv->height,
|
pDbeWindowPriv->height,
|
||||||
pWin->drawable.depth, 0)))
|
pWin->drawable.depth, 0))) {
|
||||||
{
|
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -182,8 +172,7 @@ miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction)
|
||||||
if (!(pDbeWindowPrivPriv->pBackBuffer =
|
if (!(pDbeWindowPrivPriv->pBackBuffer =
|
||||||
(*pScreen->CreatePixmap) (pScreen, pDbeWindowPriv->width,
|
(*pScreen->CreatePixmap) (pScreen, pDbeWindowPriv->width,
|
||||||
pDbeWindowPriv->height,
|
pDbeWindowPriv->height,
|
||||||
pWin->drawable.depth, 0)))
|
pWin->drawable.depth, 0))) {
|
||||||
{
|
|
||||||
(*pScreen->DestroyPixmap) (pDbeWindowPrivPriv->pFrontBuffer);
|
(*pScreen->DestroyPixmap) (pDbeWindowPrivPriv->pFrontBuffer);
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
|
|
@ -195,8 +184,7 @@ miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction)
|
||||||
|
|
||||||
/* Make the back pixmap a DBE drawable resource. */
|
/* Make the back pixmap a DBE drawable resource. */
|
||||||
if (rc != Success || !AddResource(bufId, dbeDrawableResType,
|
if (rc != Success || !AddResource(bufId, dbeDrawableResType,
|
||||||
pDbeWindowPrivPriv->pBackBuffer))
|
pDbeWindowPrivPriv->pBackBuffer)) {
|
||||||
{
|
|
||||||
/* free the buffer and the drawable resource */
|
/* free the buffer and the drawable resource */
|
||||||
FreeResource(bufId, RT_NONE);
|
FreeResource(bufId, RT_NONE);
|
||||||
return (rc == Success) ? BadAlloc : rc;
|
return (rc == Success) ? BadAlloc : rc;
|
||||||
|
|
@ -204,22 +192,19 @@ miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction)
|
||||||
|
|
||||||
/* Clear the back buffer. */
|
/* Clear the back buffer. */
|
||||||
pGC = GetScratchGC(pWin->drawable.depth, pWin->drawable.pScreen);
|
pGC = GetScratchGC(pWin->drawable.depth, pWin->drawable.pScreen);
|
||||||
if ((*pDbeScreenPriv->SetupBackgroundPainter)(pWin, pGC))
|
if ((*pDbeScreenPriv->SetupBackgroundPainter) (pWin, pGC)) {
|
||||||
{
|
|
||||||
ValidateGC((DrawablePtr) pDbeWindowPrivPriv->pBackBuffer, pGC);
|
ValidateGC((DrawablePtr) pDbeWindowPrivPriv->pBackBuffer, pGC);
|
||||||
clearRect.x = clearRect.y = 0;
|
clearRect.x = clearRect.y = 0;
|
||||||
clearRect.width = pDbeWindowPrivPriv->pBackBuffer->drawable.width;
|
clearRect.width = pDbeWindowPrivPriv->pBackBuffer->drawable.width;
|
||||||
clearRect.height = pDbeWindowPrivPriv->pBackBuffer->drawable.height;
|
clearRect.height = pDbeWindowPrivPriv->pBackBuffer->drawable.height;
|
||||||
(*pGC->ops->PolyFillRect)(
|
(*pGC->ops->PolyFillRect) ((DrawablePtr) pDbeWindowPrivPriv->
|
||||||
(DrawablePtr)pDbeWindowPrivPriv->pBackBuffer, pGC, 1,
|
pBackBuffer, pGC, 1, &clearRect);
|
||||||
&clearRect);
|
|
||||||
}
|
}
|
||||||
FreeScratchGC(pGC);
|
FreeScratchGC(pGC);
|
||||||
|
|
||||||
} /* if no buffer associated with the window */
|
} /* if no buffer associated with the window */
|
||||||
|
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
/* A buffer is already associated with the window.
|
/* A buffer is already associated with the window.
|
||||||
* Place the new buffer ID information at the head of the ID list.
|
* 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. */
|
/* Associate the new ID with an existing pixmap. */
|
||||||
pDbeWindowPrivPriv = MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv);
|
pDbeWindowPrivPriv = MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv);
|
||||||
if (!AddResource(bufId, dbeDrawableResType,
|
if (!AddResource(bufId, dbeDrawableResType,
|
||||||
(pointer)pDbeWindowPrivPriv->pBackBuffer))
|
(pointer) pDbeWindowPrivPriv->pBackBuffer)) {
|
||||||
{
|
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -237,7 +221,6 @@ miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction)
|
||||||
return Success;
|
return Success;
|
||||||
|
|
||||||
} /* miDbeAllocBackBufferName() */
|
} /* miDbeAllocBackBufferName() */
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
|
|
@ -257,14 +240,12 @@ miDbeAliasBuffers(DbeWindowPrivPtr pDbeWindowPriv)
|
||||||
MiDbeWindowPrivPrivPtr pDbeWindowPrivPriv =
|
MiDbeWindowPrivPrivPtr pDbeWindowPrivPriv =
|
||||||
MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv);
|
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,
|
ChangeResourceValue(pDbeWindowPriv->IDs[i], dbeDrawableResType,
|
||||||
(pointer) pDbeWindowPrivPriv->pBackBuffer);
|
(pointer) pDbeWindowPrivPriv->pBackBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* miDbeAliasBuffers() */
|
} /* miDbeAliasBuffers() */
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
|
|
@ -286,7 +267,6 @@ miDbeSwapBuffers(ClientPtr client, int *pNumWindows, DbeSwapInfoPtr swapInfo)
|
||||||
PixmapPtr pTmpBuffer;
|
PixmapPtr pTmpBuffer;
|
||||||
xRectangle clearRect;
|
xRectangle clearRect;
|
||||||
|
|
||||||
|
|
||||||
pWin = swapInfo[0].pWindow;
|
pWin = swapInfo[0].pWindow;
|
||||||
pDbeScreenPriv = DBE_SCREEN_PRIV_FROM_WINDOW(pWin);
|
pDbeScreenPriv = DBE_SCREEN_PRIV_FROM_WINDOW(pWin);
|
||||||
pDbeWindowPrivPriv = MI_DBE_WINDOW_PRIV_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:
|
case XdbeUndefined:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -328,8 +307,7 @@ miDbeSwapBuffers(ClientPtr client, int *pNumWindows, DbeSwapInfoPtr swapInfo)
|
||||||
ValidateGC((DrawablePtr) pWin, pGC);
|
ValidateGC((DrawablePtr) pWin, pGC);
|
||||||
(*pGC->ops->CopyArea) ((DrawablePtr) pDbeWindowPrivPriv->pBackBuffer,
|
(*pGC->ops->CopyArea) ((DrawablePtr) pDbeWindowPrivPriv->pBackBuffer,
|
||||||
(DrawablePtr) pWin, pGC, 0, 0,
|
(DrawablePtr) pWin, pGC, 0, 0,
|
||||||
pWin->drawable.width, pWin->drawable.height,
|
pWin->drawable.width, pWin->drawable.height, 0, 0);
|
||||||
0, 0);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
|
|
@ -337,32 +315,26 @@ miDbeSwapBuffers(ClientPtr client, int *pNumWindows, DbeSwapInfoPtr swapInfo)
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
switch(swapInfo[0].swapAction)
|
switch (swapInfo[0].swapAction) {
|
||||||
{
|
|
||||||
case XdbeUndefined:
|
case XdbeUndefined:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XdbeBackground:
|
case XdbeBackground:
|
||||||
if ((*pDbeScreenPriv->SetupBackgroundPainter)(pWin, pGC))
|
if ((*pDbeScreenPriv->SetupBackgroundPainter) (pWin, pGC)) {
|
||||||
{
|
|
||||||
ValidateGC((DrawablePtr) pDbeWindowPrivPriv->pBackBuffer, pGC);
|
ValidateGC((DrawablePtr) pDbeWindowPrivPriv->pBackBuffer, pGC);
|
||||||
clearRect.x = 0;
|
clearRect.x = 0;
|
||||||
clearRect.y = 0;
|
clearRect.y = 0;
|
||||||
clearRect.width =
|
clearRect.width = pDbeWindowPrivPriv->pBackBuffer->drawable.width;
|
||||||
pDbeWindowPrivPriv->pBackBuffer->drawable.width;
|
clearRect.height = pDbeWindowPrivPriv->pBackBuffer->drawable.height;
|
||||||
clearRect.height =
|
(*pGC->ops->PolyFillRect) ((DrawablePtr) pDbeWindowPrivPriv->
|
||||||
pDbeWindowPrivPriv->pBackBuffer->drawable.height;
|
pBackBuffer, pGC, 1, &clearRect);
|
||||||
(*pGC->ops->PolyFillRect)(
|
|
||||||
(DrawablePtr)pDbeWindowPrivPriv->pBackBuffer,
|
|
||||||
pGC, 1, &clearRect);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XdbeUntouched:
|
case XdbeUntouched:
|
||||||
/* Swap pixmap pointers. */
|
/* Swap pixmap pointers. */
|
||||||
pTmpBuffer = pDbeWindowPrivPriv->pBackBuffer;
|
pTmpBuffer = pDbeWindowPrivPriv->pBackBuffer;
|
||||||
pDbeWindowPrivPriv->pBackBuffer =
|
pDbeWindowPrivPriv->pBackBuffer = pDbeWindowPrivPriv->pFrontBuffer;
|
||||||
pDbeWindowPrivPriv->pFrontBuffer;
|
|
||||||
pDbeWindowPrivPriv->pFrontBuffer = pTmpBuffer;
|
pDbeWindowPrivPriv->pFrontBuffer = pTmpBuffer;
|
||||||
|
|
||||||
miDbeAliasBuffers(pDbeWindowPrivPriv->pDbeWindowPriv);
|
miDbeAliasBuffers(pDbeWindowPrivPriv->pDbeWindowPriv);
|
||||||
|
|
@ -379,8 +351,7 @@ miDbeSwapBuffers(ClientPtr client, int *pNumWindows, DbeSwapInfoPtr swapInfo)
|
||||||
* swapped.
|
* swapped.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (*pNumWindows > 1)
|
if (*pNumWindows > 1) {
|
||||||
{
|
|
||||||
/* We were told to swap more than one window, but we only swapped the
|
/* 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
|
* first one. Remove the first window in the list by moving the last
|
||||||
* window to the beginning.
|
* window to the beginning.
|
||||||
|
|
@ -392,8 +363,7 @@ miDbeSwapBuffers(ClientPtr client, int *pNumWindows, DbeSwapInfoPtr swapInfo)
|
||||||
swapInfo[*pNumWindows - 1].pWindow = (WindowPtr) NULL;
|
swapInfo[*pNumWindows - 1].pWindow = (WindowPtr) NULL;
|
||||||
swapInfo[*pNumWindows - 1].swapAction = 0;
|
swapInfo[*pNumWindows - 1].swapAction = 0;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
/* Clear the window information just to be safe. */
|
/* Clear the window information just to be safe. */
|
||||||
swapInfo[0].pWindow = (WindowPtr) NULL;
|
swapInfo[0].pWindow = (WindowPtr) NULL;
|
||||||
swapInfo[0].swapAction = 0;
|
swapInfo[0].swapAction = 0;
|
||||||
|
|
@ -406,7 +376,6 @@ miDbeSwapBuffers(ClientPtr client, int *pNumWindows, DbeSwapInfoPtr swapInfo)
|
||||||
return Success;
|
return Success;
|
||||||
|
|
||||||
} /* miSwapBuffers() */
|
} /* miSwapBuffers() */
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
|
|
@ -460,16 +429,13 @@ miDbeWinPrivDelete(DbeWindowPrivPtr pDbeWindowPriv, XID bufId)
|
||||||
{
|
{
|
||||||
MiDbeWindowPrivPrivPtr pDbeWindowPrivPriv;
|
MiDbeWindowPrivPrivPtr pDbeWindowPrivPriv;
|
||||||
|
|
||||||
|
if (pDbeWindowPriv->nBufferIDs != 0) {
|
||||||
if (pDbeWindowPriv->nBufferIDs != 0)
|
|
||||||
{
|
|
||||||
/* We still have at least one more buffer ID associated with this
|
/* We still have at least one more buffer ID associated with this
|
||||||
* window.
|
* window.
|
||||||
*/
|
*/
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* We have no more buffer IDs associated with this window. We need to
|
/* We have no more buffer IDs associated with this window. We need to
|
||||||
* free some stuff.
|
* free some stuff.
|
||||||
*/
|
*/
|
||||||
|
|
@ -477,19 +443,16 @@ miDbeWinPrivDelete(DbeWindowPrivPtr pDbeWindowPriv, XID bufId)
|
||||||
pDbeWindowPrivPriv = MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv);
|
pDbeWindowPrivPriv = MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv);
|
||||||
|
|
||||||
/* Destroy the front and back pixmaps. */
|
/* Destroy the front and back pixmaps. */
|
||||||
if (pDbeWindowPrivPriv->pFrontBuffer)
|
if (pDbeWindowPrivPriv->pFrontBuffer) {
|
||||||
{
|
(*pDbeWindowPriv->pWindow->drawable.pScreen->
|
||||||
(*pDbeWindowPriv->pWindow->drawable.pScreen->DestroyPixmap)(
|
DestroyPixmap) (pDbeWindowPrivPriv->pFrontBuffer);
|
||||||
pDbeWindowPrivPriv->pFrontBuffer);
|
|
||||||
}
|
}
|
||||||
if (pDbeWindowPrivPriv->pBackBuffer)
|
if (pDbeWindowPrivPriv->pBackBuffer) {
|
||||||
{
|
(*pDbeWindowPriv->pWindow->drawable.pScreen->
|
||||||
(*pDbeWindowPriv->pWindow->drawable.pScreen->DestroyPixmap)(
|
DestroyPixmap) (pDbeWindowPrivPriv->pBackBuffer);
|
||||||
pDbeWindowPrivPriv->pBackBuffer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* miDbeWinPrivDelete() */
|
} /* miDbeWinPrivDelete() */
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
|
|
@ -520,7 +483,6 @@ miDbePositionWindow(WindowPtr pWin, int x, int y)
|
||||||
xRectangle clearRect;
|
xRectangle clearRect;
|
||||||
Bool ret;
|
Bool ret;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
** 1. Unwrap the member routine.
|
** 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;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pDbeWindowPriv->width == pWin->drawable.width &&
|
if (pDbeWindowPriv->width == pWin->drawable.width &&
|
||||||
pDbeWindowPriv->height == pWin->drawable.height)
|
pDbeWindowPriv->height == pWin->drawable.height) {
|
||||||
{
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -594,27 +554,23 @@ miDbePositionWindow(WindowPtr pWin, int x, int y)
|
||||||
saveheight = pDbeWindowPriv->height;
|
saveheight = pDbeWindowPriv->height;
|
||||||
|
|
||||||
/* Clip rectangle to source and destination. */
|
/* Clip rectangle to source and destination. */
|
||||||
if (destx < 0)
|
if (destx < 0) {
|
||||||
{
|
|
||||||
savewidth += destx;
|
savewidth += destx;
|
||||||
sourcex -= destx;
|
sourcex -= destx;
|
||||||
destx = 0;
|
destx = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (destx + savewidth > width)
|
if (destx + savewidth > width) {
|
||||||
{
|
|
||||||
savewidth = width - destx;
|
savewidth = width - destx;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (desty < 0)
|
if (desty < 0) {
|
||||||
{
|
|
||||||
saveheight += desty;
|
saveheight += desty;
|
||||||
sourcey -= desty;
|
sourcey -= desty;
|
||||||
desty = 0;
|
desty = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (desty + saveheight > height)
|
if (desty + saveheight > height) {
|
||||||
{
|
|
||||||
saveheight = height - desty;
|
saveheight = height - desty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -625,17 +581,14 @@ miDbePositionWindow(WindowPtr pWin, int x, int y)
|
||||||
|
|
||||||
pGC = GetScratchGC(pWin->drawable.depth, pScreen);
|
pGC = GetScratchGC(pWin->drawable.depth, pScreen);
|
||||||
|
|
||||||
if (clear)
|
if (clear) {
|
||||||
{
|
if ((*pDbeScreenPriv->SetupBackgroundPainter) (pWin, pGC)) {
|
||||||
if ((*pDbeScreenPriv->SetupBackgroundPainter)(pWin, pGC))
|
|
||||||
{
|
|
||||||
clearRect.x = 0;
|
clearRect.x = 0;
|
||||||
clearRect.y = 0;
|
clearRect.y = 0;
|
||||||
clearRect.width = width;
|
clearRect.width = width;
|
||||||
clearRect.height = height;
|
clearRect.height = height;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
clear = FALSE;
|
clear = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -647,23 +600,19 @@ miDbePositionWindow(WindowPtr pWin, int x, int y)
|
||||||
pBackBuffer = (*pScreen->CreatePixmap) (pScreen, width, height,
|
pBackBuffer = (*pScreen->CreatePixmap) (pScreen, width, height,
|
||||||
pWin->drawable.depth, 0);
|
pWin->drawable.depth, 0);
|
||||||
|
|
||||||
if (!pFrontBuffer || !pBackBuffer)
|
if (!pFrontBuffer || !pBackBuffer) {
|
||||||
{
|
|
||||||
/* We failed at creating 1 or 2 of the pixmaps. */
|
/* We failed at creating 1 or 2 of the pixmaps. */
|
||||||
|
|
||||||
if (pFrontBuffer)
|
if (pFrontBuffer) {
|
||||||
{
|
|
||||||
(*pScreen->DestroyPixmap) (pFrontBuffer);
|
(*pScreen->DestroyPixmap) (pFrontBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pBackBuffer)
|
if (pBackBuffer) {
|
||||||
{
|
|
||||||
(*pScreen->DestroyPixmap) (pBackBuffer);
|
(*pScreen->DestroyPixmap) (pBackBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Destroy all buffers for this window. */
|
/* Destroy all buffers for this window. */
|
||||||
while (pDbeWindowPriv)
|
while (pDbeWindowPriv) {
|
||||||
{
|
|
||||||
/* DbeWindowPrivDelete() will free the window private if there no
|
/* DbeWindowPrivDelete() will free the window private if there no
|
||||||
* more buffer IDs associated with this window.
|
* more buffer IDs associated with this window.
|
||||||
*/
|
*/
|
||||||
|
|
@ -675,44 +624,40 @@ miDbePositionWindow(WindowPtr pWin, int x, int y)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
/* Clear out the new DBE buffer pixmaps. */
|
/* Clear out the new DBE buffer pixmaps. */
|
||||||
|
|
||||||
MiDbeWindowPrivPrivPtr pDbeWindowPrivPriv;
|
MiDbeWindowPrivPrivPtr pDbeWindowPrivPriv;
|
||||||
|
|
||||||
|
|
||||||
pDbeWindowPrivPriv = MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv);
|
pDbeWindowPrivPriv = MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv);
|
||||||
|
|
||||||
/* I suppose this could avoid quite a bit of work if
|
/* I suppose this could avoid quite a bit of work if
|
||||||
* it computed the minimal area required.
|
* it computed the minimal area required.
|
||||||
*/
|
*/
|
||||||
ValidateGC(&pFrontBuffer->drawable, pGC);
|
ValidateGC(&pFrontBuffer->drawable, pGC);
|
||||||
if (clear)
|
if (clear) {
|
||||||
{
|
|
||||||
(*pGC->ops->PolyFillRect) ((DrawablePtr) pFrontBuffer, pGC, 1,
|
(*pGC->ops->PolyFillRect) ((DrawablePtr) pFrontBuffer, pGC, 1,
|
||||||
&clearRect);
|
&clearRect);
|
||||||
}
|
}
|
||||||
/* Copy the contents of the old front pixmap to the new one. */
|
/* Copy the contents of the old front pixmap to the new one. */
|
||||||
if (pWin->bitGravity != ForgetGravity)
|
if (pWin->bitGravity != ForgetGravity) {
|
||||||
{
|
(*pGC->ops->CopyArea) ((DrawablePtr) pDbeWindowPrivPriv->
|
||||||
(*pGC->ops->CopyArea)((DrawablePtr)pDbeWindowPrivPriv->pFrontBuffer,
|
pFrontBuffer, (DrawablePtr) pFrontBuffer,
|
||||||
(DrawablePtr)pFrontBuffer, pGC, sourcex,
|
pGC, sourcex, sourcey, savewidth, saveheight,
|
||||||
sourcey, savewidth, saveheight, destx, desty);
|
destx, desty);
|
||||||
}
|
}
|
||||||
|
|
||||||
ValidateGC(&pBackBuffer->drawable, pGC);
|
ValidateGC(&pBackBuffer->drawable, pGC);
|
||||||
if (clear)
|
if (clear) {
|
||||||
{
|
|
||||||
(*pGC->ops->PolyFillRect) ((DrawablePtr) pBackBuffer, pGC, 1,
|
(*pGC->ops->PolyFillRect) ((DrawablePtr) pBackBuffer, pGC, 1,
|
||||||
&clearRect);
|
&clearRect);
|
||||||
}
|
}
|
||||||
/* Copy the contents of the old back pixmap to the new one. */
|
/* Copy the contents of the old back pixmap to the new one. */
|
||||||
if (pWin->bitGravity != ForgetGravity)
|
if (pWin->bitGravity != ForgetGravity) {
|
||||||
{
|
(*pGC->ops->CopyArea) ((DrawablePtr) pDbeWindowPrivPriv->
|
||||||
(*pGC->ops->CopyArea)((DrawablePtr)pDbeWindowPrivPriv->pBackBuffer,
|
pBackBuffer, (DrawablePtr) pBackBuffer, pGC,
|
||||||
(DrawablePtr)pBackBuffer, pGC, sourcex,
|
sourcex, sourcey, savewidth, saveheight,
|
||||||
sourcey, savewidth, saveheight, destx, desty);
|
destx, desty);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Destroy the old pixmaps, and point the DBE window priv to the new
|
/* 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;
|
return ret;
|
||||||
|
|
||||||
} /* miDbePositionWindow() */
|
} /* miDbePositionWindow() */
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
|
|
@ -753,14 +697,12 @@ miDbeResetProc(ScreenPtr pScreen)
|
||||||
{
|
{
|
||||||
DbeScreenPrivPtr pDbeScreenPriv;
|
DbeScreenPrivPtr pDbeScreenPriv;
|
||||||
|
|
||||||
|
|
||||||
pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
|
pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
|
||||||
|
|
||||||
/* Unwrap wrappers */
|
/* Unwrap wrappers */
|
||||||
pScreen->PositionWindow = pDbeScreenPriv->PositionWindow;
|
pScreen->PositionWindow = pDbeScreenPriv->PositionWindow;
|
||||||
|
|
||||||
} /* miDbeResetProc() */
|
} /* miDbeResetProc() */
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -40,19 +40,17 @@
|
||||||
|
|
||||||
/* EXTERNS */
|
/* EXTERNS */
|
||||||
|
|
||||||
extern Bool miDbeInit(
|
extern Bool miDbeInit(ScreenPtr pScreen, DbeScreenPrivPtr pDbeScreenPriv);
|
||||||
ScreenPtr pScreen,
|
|
||||||
DbeScreenPrivPtr pDbeScreenPriv
|
|
||||||
);
|
|
||||||
|
|
||||||
extern DevPrivateKeyRec dbeScreenPrivKeyRec;
|
extern DevPrivateKeyRec dbeScreenPrivKeyRec;
|
||||||
|
|
||||||
#define dbeScreenPrivKey (&dbeScreenPrivKeyRec)
|
#define dbeScreenPrivKey (&dbeScreenPrivKeyRec)
|
||||||
|
|
||||||
extern DevPrivateKeyRec dbeWindowPrivKeyRec;
|
extern DevPrivateKeyRec dbeWindowPrivKeyRec;
|
||||||
|
|
||||||
#define dbeWindowPrivKey (&dbeWindowPrivKeyRec)
|
#define dbeWindowPrivKey (&dbeWindowPrivKeyRec)
|
||||||
|
|
||||||
extern RESTYPE dbeDrawableResType;
|
extern RESTYPE dbeDrawableResType;
|
||||||
extern RESTYPE dbeWindowPrivResType;
|
extern RESTYPE dbeWindowPrivResType;
|
||||||
|
|
||||||
#endif /* MIDBE_H */
|
#endif /* MIDBE_H */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,6 @@
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
#ifdef HAVE_DIX_CONFIG_H
|
||||||
#include <dix-config.h>
|
#include <dix-config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -38,7 +37,6 @@
|
||||||
#ifndef MIDBE_STRUCT_H
|
#ifndef MIDBE_STRUCT_H
|
||||||
#define MIDBE_STRUCT_H
|
#define MIDBE_STRUCT_H
|
||||||
|
|
||||||
|
|
||||||
/* DEFINES */
|
/* DEFINES */
|
||||||
|
|
||||||
#define MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv) \
|
#define MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv) \
|
||||||
|
|
@ -50,8 +48,7 @@
|
||||||
|
|
||||||
/* TYPEDEFS */
|
/* TYPEDEFS */
|
||||||
|
|
||||||
typedef struct _MiDbeWindowPrivPrivRec
|
typedef struct _MiDbeWindowPrivPrivRec {
|
||||||
{
|
|
||||||
/* Place machine-specific fields in here.
|
/* Place machine-specific fields in here.
|
||||||
* Since this is mi code, we do not really have machine-specific fields.
|
* Since this is mi code, we do not really have machine-specific fields.
|
||||||
*/
|
*/
|
||||||
|
|
@ -76,4 +73,3 @@ typedef struct _MiDbeWindowPrivPrivRec
|
||||||
} MiDbeWindowPrivPrivRec, *MiDbeWindowPrivPrivPtr;
|
} MiDbeWindowPrivPrivRec, *MiDbeWindowPrivPrivPtr;
|
||||||
|
|
||||||
#endif /* MIDBE_STRUCT_H */
|
#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
|
used in advertising or otherwise to promote the sale, use or other dealings
|
||||||
in this Software without prior written authorization from The Open Group.
|
in this Software without prior written authorization from The Open Group.
|
||||||
|
|
||||||
|
|
||||||
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
|
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
|
||||||
|
|
||||||
All Rights Reserved
|
All Rights Reserved
|
||||||
|
|
@ -45,7 +44,6 @@ SOFTWARE.
|
||||||
|
|
||||||
******************************************************************/
|
******************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
#ifdef HAVE_DIX_CONFIG_H
|
||||||
#include <dix-config.h>
|
#include <dix-config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -83,19 +81,16 @@ MakeAtom(const char *string, unsigned len, Bool makeit)
|
||||||
unsigned int fp = 0;
|
unsigned int fp = 0;
|
||||||
|
|
||||||
np = &atomRoot;
|
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[i];
|
||||||
fp = fp * 27 + string[len - 1 - i];
|
fp = fp * 27 + string[len - 1 - i];
|
||||||
}
|
}
|
||||||
while (*np != NULL)
|
while (*np != NULL) {
|
||||||
{
|
|
||||||
if (fp < (*np)->fingerPrint)
|
if (fp < (*np)->fingerPrint)
|
||||||
np = &((*np)->left);
|
np = &((*np)->left);
|
||||||
else if (fp > (*np)->fingerPrint)
|
else if (fp > (*np)->fingerPrint)
|
||||||
np = &((*np)->right);
|
np = &((*np)->right);
|
||||||
else
|
else { /* now start testing the strings */
|
||||||
{ /* now start testing the strings */
|
|
||||||
comp = strncmp(string, (*np)->string, (int) len);
|
comp = strncmp(string, (*np)->string, (int) len);
|
||||||
if ((comp < 0) || ((comp == 0) && (len < strlen((*np)->string))))
|
if ((comp < 0) || ((comp == 0) && (len < strlen((*np)->string))))
|
||||||
np = &((*np)->left);
|
np = &((*np)->left);
|
||||||
|
|
@ -105,19 +100,16 @@ MakeAtom(const char *string, unsigned len, Bool makeit)
|
||||||
return (*np)->a;
|
return (*np)->a;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (makeit)
|
if (makeit) {
|
||||||
{
|
|
||||||
NodePtr nd;
|
NodePtr nd;
|
||||||
|
|
||||||
nd = malloc(sizeof(NodeRec));
|
nd = malloc(sizeof(NodeRec));
|
||||||
if (!nd)
|
if (!nd)
|
||||||
return BAD_RESOURCE;
|
return BAD_RESOURCE;
|
||||||
if (lastAtom < XA_LAST_PREDEFINED)
|
if (lastAtom < XA_LAST_PREDEFINED) {
|
||||||
{
|
|
||||||
nd->string = string;
|
nd->string = string;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
nd->string = strndup(string, len);
|
nd->string = strndup(string, len);
|
||||||
if (!nd->string) {
|
if (!nd->string) {
|
||||||
free(nd);
|
free(nd);
|
||||||
|
|
@ -160,8 +152,11 @@ const char *
|
||||||
NameForAtom(Atom atom)
|
NameForAtom(Atom atom)
|
||||||
{
|
{
|
||||||
NodePtr node;
|
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;
|
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
|
used in advertising or otherwise to promote the sale, use or other dealings
|
||||||
in this Software without prior written authorization from The Open Group.
|
in this Software without prior written authorization from The Open Group.
|
||||||
|
|
||||||
|
|
||||||
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
|
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
|
||||||
|
|
||||||
All Rights Reserved
|
All Rights Reserved
|
||||||
|
|
@ -45,8 +44,6 @@ SOFTWARE.
|
||||||
|
|
||||||
******************************************************************/
|
******************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
#ifdef HAVE_DIX_CONFIG_H
|
||||||
#include <dix-config.h>
|
#include <dix-config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -89,16 +86,12 @@ FreeCursorBits(CursorBitsPtr bits)
|
||||||
free(bits->argb);
|
free(bits->argb);
|
||||||
#endif
|
#endif
|
||||||
dixFiniPrivates(bits, PRIVATE_CURSOR_BITS);
|
dixFiniPrivates(bits, PRIVATE_CURSOR_BITS);
|
||||||
if (bits->refcnt == 0)
|
if (bits->refcnt == 0) {
|
||||||
{
|
|
||||||
GlyphSharePtr *prev, this;
|
GlyphSharePtr *prev, this;
|
||||||
|
|
||||||
for (prev = &sharedGlyphs;
|
for (prev = &sharedGlyphs;
|
||||||
(this = *prev) && (this->bits != bits);
|
(this = *prev) && (this->bits != bits); prev = &this->next);
|
||||||
prev = &this->next)
|
if (this) {
|
||||||
;
|
|
||||||
if (this)
|
|
||||||
{
|
|
||||||
*prev = this->next;
|
*prev = this->next;
|
||||||
CloseFont(this->font, (Font) 0);
|
CloseFont(this->font, (Font) 0);
|
||||||
free(this);
|
free(this);
|
||||||
|
|
@ -124,8 +117,7 @@ FreeCursor(pointer value, XID cid)
|
||||||
if (--pCurs->refcnt != 0)
|
if (--pCurs->refcnt != 0)
|
||||||
return Success;
|
return Success;
|
||||||
|
|
||||||
for (nscr = 0; nscr < screenInfo.numScreens; nscr++)
|
for (nscr = 0; nscr < screenInfo.numScreens; nscr++) {
|
||||||
{
|
|
||||||
pscr = screenInfo.screens[nscr];
|
pscr = screenInfo.screens[nscr];
|
||||||
(void) (*pscr->UnrealizeCursor) (pDev, pscr, pCurs);
|
(void) (*pscr->UnrealizeCursor) (pDev, pscr, pCurs);
|
||||||
}
|
}
|
||||||
|
|
@ -135,7 +127,6 @@ FreeCursor(pointer value, XID cid)
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We check for empty cursors so that we won't have to display them
|
* We check for empty cursors so that we won't have to display them
|
||||||
*/
|
*/
|
||||||
|
|
@ -147,14 +138,16 @@ CheckForEmptyMask(CursorBitsPtr bits)
|
||||||
|
|
||||||
bits->emptyMask = FALSE;
|
bits->emptyMask = FALSE;
|
||||||
while (n--)
|
while (n--)
|
||||||
if(*(msk++) != 0) return;
|
if (*(msk++) != 0)
|
||||||
|
return;
|
||||||
#ifdef ARGB_CURSOR
|
#ifdef ARGB_CURSOR
|
||||||
if (bits->argb)
|
if (bits->argb) {
|
||||||
{
|
|
||||||
CARD32 *argb = bits->argb;
|
CARD32 *argb = bits->argb;
|
||||||
|
|
||||||
n = bits->width * bits->height;
|
n = bits->width * bits->height;
|
||||||
while (n--)
|
while (n--)
|
||||||
if (*argb++ & 0xff000000) return;
|
if (*argb++ & 0xff000000)
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
bits->emptyMask = TRUE;
|
bits->emptyMask = TRUE;
|
||||||
|
|
@ -174,15 +167,11 @@ RealizeCursorAllScreens(CursorPtr pCurs)
|
||||||
ScreenPtr pscr;
|
ScreenPtr pscr;
|
||||||
int nscr;
|
int nscr;
|
||||||
|
|
||||||
for (nscr = 0; nscr < screenInfo.numScreens; nscr++)
|
for (nscr = 0; nscr < screenInfo.numScreens; nscr++) {
|
||||||
{
|
|
||||||
pscr = screenInfo.screens[nscr];
|
pscr = screenInfo.screens[nscr];
|
||||||
for (pDev = inputInfo.devices; pDev; pDev = pDev->next)
|
for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
|
||||||
{
|
if (DevHasCursor(pDev)) {
|
||||||
if (DevHasCursor(pDev))
|
if (!(*pscr->RealizeCursor) (pDev, pscr, pCurs)) {
|
||||||
{
|
|
||||||
if (!( *pscr->RealizeCursor)(pDev, pscr, pCurs))
|
|
||||||
{
|
|
||||||
/* Realize failed for device pDev on screen pscr.
|
/* Realize failed for device pDev on screen pscr.
|
||||||
* We have to assume that for all devices before, realize
|
* We have to assume that for all devices before, realize
|
||||||
* worked. We need to rollback all devices so far on the
|
* worked. We need to rollback all devices so far on the
|
||||||
|
|
@ -190,19 +179,17 @@ RealizeCursorAllScreens(CursorPtr pCurs)
|
||||||
* screens.
|
* screens.
|
||||||
*/
|
*/
|
||||||
DeviceIntPtr pDevIt = inputInfo.devices; /*dev iterator */
|
DeviceIntPtr pDevIt = inputInfo.devices; /*dev iterator */
|
||||||
while(pDevIt && pDevIt != pDev)
|
|
||||||
{
|
while (pDevIt && pDevIt != pDev) {
|
||||||
if (DevHasCursor(pDevIt))
|
if (DevHasCursor(pDevIt))
|
||||||
(*pscr->UnrealizeCursor) (pDevIt, pscr, pCurs);
|
(*pscr->UnrealizeCursor) (pDevIt, pscr, pCurs);
|
||||||
pDevIt = pDevIt->next;
|
pDevIt = pDevIt->next;
|
||||||
}
|
}
|
||||||
while (--nscr >= 0)
|
while (--nscr >= 0) {
|
||||||
{
|
|
||||||
pscr = screenInfo.screens[nscr];
|
pscr = screenInfo.screens[nscr];
|
||||||
/* now unrealize all devices on previous screens */
|
/* now unrealize all devices on previous screens */
|
||||||
pDevIt = inputInfo.devices;
|
pDevIt = inputInfo.devices;
|
||||||
while (pDevIt)
|
while (pDevIt) {
|
||||||
{
|
|
||||||
if (DevHasCursor(pDevIt))
|
if (DevHasCursor(pDevIt))
|
||||||
(*pscr->UnrealizeCursor) (pDevIt, pscr, pCurs);
|
(*pscr->UnrealizeCursor) (pDevIt, pscr, pCurs);
|
||||||
pDevIt = pDevIt->next;
|
pDevIt = pDevIt->next;
|
||||||
|
|
@ -218,7 +205,6 @@ RealizeCursorAllScreens(CursorPtr pCurs)
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* does nothing about the resource table, just creates the data structure.
|
* does nothing about the resource table, just creates the data structure.
|
||||||
* does not copy the src and mask bits
|
* does not copy the src and mask bits
|
||||||
|
|
@ -310,34 +296,28 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar,
|
||||||
CursorPtr pCurs;
|
CursorPtr pCurs;
|
||||||
GlyphSharePtr pShare;
|
GlyphSharePtr pShare;
|
||||||
|
|
||||||
rc = dixLookupResourceByType((pointer *)&sourcefont, source, RT_FONT, client,
|
rc = dixLookupResourceByType((pointer *) &sourcefont, source, RT_FONT,
|
||||||
DixUseAccess);
|
client, DixUseAccess);
|
||||||
if (rc != Success)
|
if (rc != Success) {
|
||||||
{
|
|
||||||
client->errorValue = source;
|
client->errorValue = source;
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
rc = dixLookupResourceByType((pointer *) &maskfont, mask, RT_FONT, client,
|
rc = dixLookupResourceByType((pointer *) &maskfont, mask, RT_FONT, client,
|
||||||
DixUseAccess);
|
DixUseAccess);
|
||||||
if (rc != Success && mask != None)
|
if (rc != Success && mask != None) {
|
||||||
{
|
|
||||||
client->errorValue = mask;
|
client->errorValue = mask;
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
if (sourcefont != maskfont)
|
if (sourcefont != maskfont)
|
||||||
pShare = (GlyphSharePtr) NULL;
|
pShare = (GlyphSharePtr) NULL;
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
for (pShare = sharedGlyphs;
|
for (pShare = sharedGlyphs;
|
||||||
pShare &&
|
pShare &&
|
||||||
((pShare->font != sourcefont) ||
|
((pShare->font != sourcefont) ||
|
||||||
(pShare->sourceChar != sourceChar) ||
|
(pShare->sourceChar != sourceChar) ||
|
||||||
(pShare->maskChar != maskChar));
|
(pShare->maskChar != maskChar)); pShare = pShare->next);
|
||||||
pShare = pShare->next)
|
|
||||||
;
|
|
||||||
}
|
}
|
||||||
if (pShare)
|
if (pShare) {
|
||||||
{
|
|
||||||
pCurs = (CursorPtr) calloc(CURSOR_REC_SIZE, 1);
|
pCurs = (CursorPtr) calloc(CURSOR_REC_SIZE, 1);
|
||||||
if (!pCurs)
|
if (!pCurs)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
|
@ -345,15 +325,12 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar,
|
||||||
bits = pShare->bits;
|
bits = pShare->bits;
|
||||||
bits->refcnt++;
|
bits->refcnt++;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
if (!CursorMetricsFromGlyph(sourcefont, sourceChar, &cm)) {
|
||||||
if (!CursorMetricsFromGlyph(sourcefont, sourceChar, &cm))
|
|
||||||
{
|
|
||||||
client->errorValue = sourceChar;
|
client->errorValue = sourceChar;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
if (!maskfont)
|
if (!maskfont) {
|
||||||
{
|
|
||||||
long n;
|
long n;
|
||||||
unsigned char *mskptr;
|
unsigned char *mskptr;
|
||||||
|
|
||||||
|
|
@ -364,40 +341,33 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar,
|
||||||
while (--n >= 0)
|
while (--n >= 0)
|
||||||
*mskptr++ = ~0;
|
*mskptr++ = ~0;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
if (!CursorMetricsFromGlyph(maskfont, maskChar, &cm)) {
|
||||||
if (!CursorMetricsFromGlyph(maskfont, maskChar, &cm))
|
|
||||||
{
|
|
||||||
client->errorValue = maskChar;
|
client->errorValue = maskChar;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
if ((rc = ServerBitsFromGlyph(maskfont, maskChar, &cm, &mskbits)))
|
if ((rc = ServerBitsFromGlyph(maskfont, maskChar, &cm, &mskbits)))
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
if ((rc = ServerBitsFromGlyph(sourcefont, sourceChar, &cm, &srcbits)))
|
if ((rc = ServerBitsFromGlyph(sourcefont, sourceChar, &cm, &srcbits))) {
|
||||||
{
|
|
||||||
free(mskbits);
|
free(mskbits);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
if (sourcefont != maskfont)
|
if (sourcefont != maskfont) {
|
||||||
{
|
pCurs = (CursorPtr) calloc(CURSOR_REC_SIZE + CURSOR_BITS_SIZE, 1);
|
||||||
pCurs =
|
|
||||||
(CursorPtr)calloc(CURSOR_REC_SIZE + CURSOR_BITS_SIZE, 1);
|
|
||||||
if (pCurs)
|
if (pCurs)
|
||||||
bits = (CursorBitsPtr) ((char *) pCurs + CURSOR_REC_SIZE);
|
bits = (CursorBitsPtr) ((char *) pCurs + CURSOR_REC_SIZE);
|
||||||
else
|
else
|
||||||
bits = (CursorBitsPtr) NULL;
|
bits = (CursorBitsPtr) NULL;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
pCurs = (CursorPtr) calloc(CURSOR_REC_SIZE, 1);
|
pCurs = (CursorPtr) calloc(CURSOR_REC_SIZE, 1);
|
||||||
if (pCurs)
|
if (pCurs)
|
||||||
bits = (CursorBitsPtr) calloc(CURSOR_BITS_SIZE, 1);
|
bits = (CursorBitsPtr) calloc(CURSOR_BITS_SIZE, 1);
|
||||||
else
|
else
|
||||||
bits = (CursorBitsPtr) NULL;
|
bits = (CursorBitsPtr) NULL;
|
||||||
}
|
}
|
||||||
if (!bits)
|
if (!bits) {
|
||||||
{
|
|
||||||
free(pCurs);
|
free(pCurs);
|
||||||
free(mskbits);
|
free(mskbits);
|
||||||
free(srcbits);
|
free(srcbits);
|
||||||
|
|
@ -416,12 +386,10 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar,
|
||||||
bits->yhot = cm.yhot;
|
bits->yhot = cm.yhot;
|
||||||
if (sourcefont != maskfont)
|
if (sourcefont != maskfont)
|
||||||
bits->refcnt = -1;
|
bits->refcnt = -1;
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
bits->refcnt = 1;
|
bits->refcnt = 1;
|
||||||
pShare = malloc(sizeof(GlyphShare));
|
pShare = malloc(sizeof(GlyphShare));
|
||||||
if (!pShare)
|
if (!pShare) {
|
||||||
{
|
|
||||||
FreeCursorBits(bits);
|
FreeCursorBits(bits);
|
||||||
return BadAlloc;
|
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
|
used in advertising or otherwise to promote the sale, use or other dealings
|
||||||
in this Software without prior written authorization from The Open Group.
|
in this Software without prior written authorization from The Open Group.
|
||||||
|
|
||||||
|
|
||||||
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
|
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
|
||||||
|
|
||||||
All Rights Reserved
|
All Rights Reserved
|
||||||
|
|
@ -45,8 +44,6 @@ SOFTWARE.
|
||||||
|
|
||||||
********************************************************/
|
********************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
#ifdef HAVE_DIX_CONFIG_H
|
||||||
#include <dix-config.h>
|
#include <dix-config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -143,25 +140,23 @@ static int
|
||||||
DeviceSetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop,
|
DeviceSetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop,
|
||||||
BOOL checkonly)
|
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)
|
if (prop->format != 8 || prop->type != XA_INTEGER || prop->size != 1)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
|
|
||||||
/* Don't allow disabling of VCP/VCK */
|
/* Don't allow disabling of VCP/VCK */
|
||||||
if ((dev == inputInfo.pointer || dev == inputInfo.keyboard) &&
|
if ((dev == inputInfo.pointer ||dev ==
|
||||||
!(*(CARD8*)prop->data))
|
inputInfo.keyboard) &&!(*(CARD8 *) prop->data))
|
||||||
return BadAccess;
|
return BadAccess;
|
||||||
|
|
||||||
if (!checkonly)
|
if (!checkonly) {
|
||||||
{
|
|
||||||
if ((*((CARD8 *) prop->data)) && !dev->enabled)
|
if ((*((CARD8 *) prop->data)) && !dev->enabled)
|
||||||
EnableDevice(dev, TRUE);
|
EnableDevice(dev, TRUE);
|
||||||
else if (!(*((CARD8 *) prop->data)) && dev->enabled)
|
else if (!(*((CARD8 *) prop->data)) && dev->enabled)
|
||||||
DisableDevice(dev, TRUE);
|
DisableDevice(dev, TRUE);
|
||||||
}
|
}
|
||||||
} else if (property == XIGetKnownProperty(XI_PROP_TRANSFORM))
|
}
|
||||||
{
|
else if (property == XIGetKnownProperty(XI_PROP_TRANSFORM)) {
|
||||||
float *f = (float *) prop->data;
|
float *f = (float *) prop->data;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
@ -199,8 +194,7 @@ PairDevices(ClientPtr client, DeviceIntPtr ptr, DeviceIntPtr kbd)
|
||||||
if (ptr->spriteInfo->paired)
|
if (ptr->spriteInfo->paired)
|
||||||
return BadDevice;
|
return BadDevice;
|
||||||
|
|
||||||
if (kbd->spriteInfo->spriteOwner)
|
if (kbd->spriteInfo->spriteOwner) {
|
||||||
{
|
|
||||||
free(kbd->spriteInfo->sprite);
|
free(kbd->spriteInfo->sprite);
|
||||||
kbd->spriteInfo->sprite = NULL;
|
kbd->spriteInfo->sprite = NULL;
|
||||||
kbd->spriteInfo->spriteOwner = FALSE;
|
kbd->spriteInfo->spriteOwner = FALSE;
|
||||||
|
|
@ -212,7 +206,6 @@ PairDevices(ClientPtr client, DeviceIntPtr ptr, DeviceIntPtr kbd)
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find and return the next unpaired MD pointer device.
|
* Find and return the next unpaired MD pointer device.
|
||||||
*/
|
*/
|
||||||
|
|
@ -220,10 +213,10 @@ static DeviceIntPtr
|
||||||
NextFreePointerDevice(void)
|
NextFreePointerDevice(void)
|
||||||
{
|
{
|
||||||
DeviceIntPtr dev;
|
DeviceIntPtr dev;
|
||||||
|
|
||||||
for (dev = inputInfo.devices; dev; dev = dev->next)
|
for (dev = inputInfo.devices; dev; dev = dev->next)
|
||||||
if (IsMaster(dev) &&
|
if (IsMaster(dev) &&
|
||||||
dev->spriteInfo->spriteOwner &&
|
dev->spriteInfo->spriteOwner && !dev->spriteInfo->paired)
|
||||||
!dev->spriteInfo->paired)
|
|
||||||
return dev;
|
return dev;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -251,14 +244,17 @@ AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart)
|
||||||
devind[devtmp->id]++;
|
devind[devtmp->id]++;
|
||||||
for (devtmp = inputInfo.off_devices; devtmp; devtmp = devtmp->next)
|
for (devtmp = inputInfo.off_devices; devtmp; devtmp = devtmp->next)
|
||||||
devind[devtmp->id]++;
|
devind[devtmp->id]++;
|
||||||
for (devid = 2; devid < MAXDEVICES && devind[devid]; devid++)
|
for (devid = 2; devid < MAXDEVICES && devind[devid]; devid++);
|
||||||
;
|
|
||||||
|
|
||||||
if (devid >= MAXDEVICES)
|
if (devid >= MAXDEVICES)
|
||||||
return (DeviceIntPtr) NULL;
|
return (DeviceIntPtr) NULL;
|
||||||
dev = _dixAllocateObjectWithPrivates(sizeof(DeviceIntRec) + sizeof(SpriteInfoRec),
|
dev =
|
||||||
sizeof(DeviceIntRec) + sizeof(SpriteInfoRec),
|
_dixAllocateObjectWithPrivates(sizeof(DeviceIntRec) +
|
||||||
offsetof(DeviceIntRec, devPrivates), PRIVATE_DEVICE);
|
sizeof(SpriteInfoRec),
|
||||||
|
sizeof(DeviceIntRec) +
|
||||||
|
sizeof(SpriteInfoRec),
|
||||||
|
offsetof(DeviceIntRec, devPrivates),
|
||||||
|
PRIVATE_DEVICE);
|
||||||
if (!dev)
|
if (!dev)
|
||||||
return (DeviceIntPtr) NULL;
|
return (DeviceIntPtr) NULL;
|
||||||
|
|
||||||
|
|
@ -294,16 +290,15 @@ AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart)
|
||||||
|
|
||||||
inputInfo.numDevices++;
|
inputInfo.numDevices++;
|
||||||
|
|
||||||
for (prev = &inputInfo.off_devices; *prev; prev = &(*prev)->next)
|
for (prev = &inputInfo.off_devices; *prev; prev = &(*prev)->next);
|
||||||
;
|
|
||||||
*prev = dev;
|
*prev = dev;
|
||||||
dev->next = NULL;
|
dev->next = NULL;
|
||||||
|
|
||||||
enabled = FALSE;
|
enabled = FALSE;
|
||||||
XIChangeDeviceProperty(dev, XIGetKnownProperty(XI_PROP_ENABLED),
|
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);
|
FALSE);
|
||||||
XISetDevicePropertyDeletable(dev, XIGetKnownProperty(XI_PROP_ENABLED), FALSE);
|
|
||||||
|
|
||||||
/* unity matrix */
|
/* unity matrix */
|
||||||
memset(transform, 0, sizeof(transform));
|
memset(transform, 0, sizeof(transform));
|
||||||
|
|
@ -359,30 +354,25 @@ EnableDevice(DeviceIntPtr dev, BOOL sendevent)
|
||||||
int flags[MAXDEVICES] = { 0 };
|
int flags[MAXDEVICES] = { 0 };
|
||||||
|
|
||||||
for (prev = &inputInfo.off_devices;
|
for (prev = &inputInfo.off_devices;
|
||||||
*prev && (*prev != dev);
|
*prev && (*prev != dev); prev = &(*prev)->next);
|
||||||
prev = &(*prev)->next)
|
|
||||||
;
|
|
||||||
|
|
||||||
if (!dev->spriteInfo->sprite)
|
if (!dev->spriteInfo->sprite) {
|
||||||
{
|
if (IsMaster(dev)) {
|
||||||
if (IsMaster(dev))
|
|
||||||
{
|
|
||||||
/* Sprites appear on first root window, so we can hardcode it */
|
/* 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);
|
InitializeSprite(dev, screenInfo.screens[0]->root);
|
||||||
/* mode doesn't matter */
|
/* mode doesn't matter */
|
||||||
EnterWindow(dev, screenInfo.screens[0]->root, NotifyAncestor);
|
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. "
|
ErrorF("[dix] cannot find pointer to pair with. "
|
||||||
"This is a bug.\n");
|
"This is a bug.\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
PairDevices(NULL, other, dev);
|
PairDevices(NULL, other, dev);
|
||||||
} else
|
}
|
||||||
{
|
else {
|
||||||
if (dev->coreEvents)
|
if (dev->coreEvents)
|
||||||
other = (IsPointerDevice(dev)) ? inputInfo.pointer :
|
other = (IsPointerDevice(dev)) ? inputInfo.pointer :
|
||||||
inputInfo.keyboard;
|
inputInfo.keyboard;
|
||||||
|
|
@ -400,19 +390,16 @@ EnableDevice(DeviceIntPtr dev, BOOL sendevent)
|
||||||
dev->enabled = TRUE;
|
dev->enabled = TRUE;
|
||||||
*prev = dev->next;
|
*prev = dev->next;
|
||||||
|
|
||||||
for (prev = &inputInfo.devices; *prev; prev = &(*prev)->next)
|
for (prev = &inputInfo.devices; *prev; prev = &(*prev)->next);
|
||||||
;
|
|
||||||
*prev = dev;
|
*prev = dev;
|
||||||
dev->next = NULL;
|
dev->next = NULL;
|
||||||
|
|
||||||
enabled = TRUE;
|
enabled = TRUE;
|
||||||
XIChangeDeviceProperty(dev, XIGetKnownProperty(XI_PROP_ENABLED),
|
XIChangeDeviceProperty(dev, XIGetKnownProperty(XI_PROP_ENABLED),
|
||||||
XA_INTEGER, 8, PropModeReplace, 1, &enabled,
|
XA_INTEGER, 8, PropModeReplace, 1, &enabled, TRUE);
|
||||||
TRUE);
|
|
||||||
|
|
||||||
SendDevicePresenceEvent(dev->id, DeviceEnabled);
|
SendDevicePresenceEvent(dev->id, DeviceEnabled);
|
||||||
if (sendevent)
|
if (sendevent) {
|
||||||
{
|
|
||||||
flags[dev->id] |= XIDeviceEnabled;
|
flags[dev->id] |= XIDeviceEnabled;
|
||||||
XISendDeviceHierarchyEvent(flags);
|
XISendDeviceHierarchyEvent(flags);
|
||||||
}
|
}
|
||||||
|
|
@ -441,39 +428,29 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent)
|
||||||
int flags[MAXDEVICES] = { 0 };
|
int flags[MAXDEVICES] = { 0 };
|
||||||
|
|
||||||
for (prev = &inputInfo.devices;
|
for (prev = &inputInfo.devices;
|
||||||
*prev && (*prev != dev);
|
*prev && (*prev != dev); prev = &(*prev)->next);
|
||||||
prev = &(*prev)->next)
|
|
||||||
;
|
|
||||||
if (*prev != dev)
|
if (*prev != dev)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* float attached devices */
|
/* float attached devices */
|
||||||
if (IsMaster(dev))
|
if (IsMaster(dev)) {
|
||||||
{
|
for (other = inputInfo.devices; other; other = other->next) {
|
||||||
for (other = inputInfo.devices; other; other = other->next)
|
if (!IsMaster(other) && GetMaster(other, MASTER_ATTACHED) == dev) {
|
||||||
{
|
|
||||||
if (!IsMaster(other) && GetMaster(other, MASTER_ATTACHED) == dev)
|
|
||||||
{
|
|
||||||
AttachDevice(NULL, other, NULL);
|
AttachDevice(NULL, other, NULL);
|
||||||
flags[other->id] |= XISlaveDetached;
|
flags[other->id] |= XISlaveDetached;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
for (other = inputInfo.devices; other; other = other->next) {
|
||||||
for (other = inputInfo.devices; other; other = other->next)
|
|
||||||
{
|
|
||||||
if (IsMaster(other) && other->lastSlave == dev)
|
if (IsMaster(other) && other->lastSlave == dev)
|
||||||
other->lastSlave = NULL;
|
other->lastSlave = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsMaster(dev) && dev->spriteInfo->sprite)
|
if (IsMaster(dev) && dev->spriteInfo->sprite) {
|
||||||
{
|
for (other = inputInfo.devices; other; other = other->next) {
|
||||||
for (other = inputInfo.devices; other; other = other->next)
|
if (other->spriteInfo->paired == dev) {
|
||||||
{
|
|
||||||
if (other->spriteInfo->paired == dev)
|
|
||||||
{
|
|
||||||
ErrorF("[dix] cannot disable device, still paired. "
|
ErrorF("[dix] cannot disable device, still paired. "
|
||||||
"This is a bug. \n");
|
"This is a bug. \n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
@ -487,8 +464,7 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent)
|
||||||
/* now that the device is disabled, we can reset the signal handler's
|
/* now that the device is disabled, we can reset the signal handler's
|
||||||
* last.slave */
|
* last.slave */
|
||||||
OsBlockSignals();
|
OsBlockSignals();
|
||||||
for (other = inputInfo.devices; other; other = other->next)
|
for (other = inputInfo.devices; other; other = other->next) {
|
||||||
{
|
|
||||||
if (other->last.slave == dev)
|
if (other->last.slave == dev)
|
||||||
other->last.slave = NULL;
|
other->last.slave = NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -503,12 +479,10 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent)
|
||||||
|
|
||||||
enabled = FALSE;
|
enabled = FALSE;
|
||||||
XIChangeDeviceProperty(dev, XIGetKnownProperty(XI_PROP_ENABLED),
|
XIChangeDeviceProperty(dev, XIGetKnownProperty(XI_PROP_ENABLED),
|
||||||
XA_INTEGER, 8, PropModeReplace, 1, &enabled,
|
XA_INTEGER, 8, PropModeReplace, 1, &enabled, TRUE);
|
||||||
TRUE);
|
|
||||||
|
|
||||||
SendDevicePresenceEvent(dev->id, DeviceDisabled);
|
SendDevicePresenceEvent(dev->id, DeviceDisabled);
|
||||||
if (sendevent)
|
if (sendevent) {
|
||||||
{
|
|
||||||
flags[dev->id] = XIDeviceDisabled;
|
flags[dev->id] = XIDeviceDisabled;
|
||||||
XISendDeviceHierarchyEvent(flags);
|
XISendDeviceHierarchyEvent(flags);
|
||||||
}
|
}
|
||||||
|
|
@ -548,8 +522,7 @@ ActivateDevice(DeviceIntPtr dev, BOOL sendevent)
|
||||||
ret = BadAlloc;
|
ret = BadAlloc;
|
||||||
|
|
||||||
SendDevicePresenceEvent(dev->id, DeviceAdded);
|
SendDevicePresenceEvent(dev->id, DeviceAdded);
|
||||||
if (sendevent)
|
if (sendevent) {
|
||||||
{
|
|
||||||
int flags[MAXDEVICES] = { 0 };
|
int flags[MAXDEVICES] = { 0 };
|
||||||
flags[dev->id] = XISlaveAdded;
|
flags[dev->id] = XISlaveAdded;
|
||||||
XISendDeviceHierarchyEvent(flags);
|
XISendDeviceHierarchyEvent(flags);
|
||||||
|
|
@ -585,8 +558,7 @@ CoreKeyboardProc(DeviceIntPtr pDev, int what)
|
||||||
switch (what) {
|
switch (what) {
|
||||||
case DEVICE_INIT:
|
case DEVICE_INIT:
|
||||||
if (!InitKeyboardDeviceStruct(pDev, NULL, CoreKeyboardBell,
|
if (!InitKeyboardDeviceStruct(pDev, NULL, CoreKeyboardBell,
|
||||||
CoreKeyboardCtl))
|
CoreKeyboardCtl)) {
|
||||||
{
|
|
||||||
ErrorF("Keyboard initialization failed. This could be a missing "
|
ErrorF("Keyboard initialization failed. This could be a missing "
|
||||||
"or incorrect setup of xkeyboard-config.\n");
|
"or incorrect setup of xkeyboard-config.\n");
|
||||||
return BadValue;
|
return BadValue;
|
||||||
|
|
@ -635,10 +607,10 @@ CorePointerProc(DeviceIntPtr pDev, int what)
|
||||||
axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X);
|
axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X);
|
||||||
axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y);
|
axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y);
|
||||||
|
|
||||||
if (!InitPointerDeviceStruct((DevicePtr)pDev, map, NBUTTONS, btn_labels,
|
if (!InitPointerDeviceStruct
|
||||||
(PtrCtrlProcPtr)NoopDDA,
|
((DevicePtr) pDev, map, NBUTTONS, btn_labels,
|
||||||
GetMotionHistorySize(), NAXES, axes_labels))
|
(PtrCtrlProcPtr) NoopDDA, GetMotionHistorySize(), NAXES,
|
||||||
{
|
axes_labels)) {
|
||||||
ErrorF("Could not initialize device '%s'. Out of memory.\n",
|
ErrorF("Could not initialize device '%s'. Out of memory.\n",
|
||||||
pDev->name);
|
pDev->name);
|
||||||
return BadAlloc; /* IPDS only fails on allocs */
|
return BadAlloc; /* IPDS only fails on allocs */
|
||||||
|
|
@ -676,8 +648,7 @@ InitCoreDevices(void)
|
||||||
{
|
{
|
||||||
if (AllocDevicePair(serverClient, "Virtual core",
|
if (AllocDevicePair(serverClient, "Virtual core",
|
||||||
&inputInfo.pointer, &inputInfo.keyboard,
|
&inputInfo.pointer, &inputInfo.keyboard,
|
||||||
CorePointerProc, CoreKeyboardProc,
|
CorePointerProc, CoreKeyboardProc, TRUE) != Success)
|
||||||
TRUE) != Success)
|
|
||||||
FatalError("Failed to allocate core devices");
|
FatalError("Failed to allocate core devices");
|
||||||
|
|
||||||
if (ActivateDevice(inputInfo.pointer, TRUE) != Success ||
|
if (ActivateDevice(inputInfo.pointer, TRUE) != Success ||
|
||||||
|
|
@ -714,8 +685,7 @@ InitAndStartDevices(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* enable real devices */
|
/* 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);
|
DebugF("(dix) enabling device %d\n", dev->id);
|
||||||
next = dev->next;
|
next = dev->next;
|
||||||
if (dev->inited && dev->startup)
|
if (dev->inited && dev->startup)
|
||||||
|
|
@ -734,13 +704,12 @@ FreeDeviceClass(int type, pointer *class)
|
||||||
if (!(*class))
|
if (!(*class))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch(type)
|
switch (type) {
|
||||||
{
|
|
||||||
case KeyClass:
|
case KeyClass:
|
||||||
{
|
{
|
||||||
KeyClassPtr *k = (KeyClassPtr *) class;
|
KeyClassPtr *k = (KeyClassPtr *) class;
|
||||||
if ((*k)->xkbInfo)
|
|
||||||
{
|
if ((*k)->xkbInfo) {
|
||||||
XkbFreeInfo((*k)->xkbInfo);
|
XkbFreeInfo((*k)->xkbInfo);
|
||||||
(*k)->xkbInfo = NULL;
|
(*k)->xkbInfo = NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -750,6 +719,7 @@ FreeDeviceClass(int type, pointer *class)
|
||||||
case ButtonClass:
|
case ButtonClass:
|
||||||
{
|
{
|
||||||
ButtonClassPtr *b = (ButtonClassPtr *) class;
|
ButtonClassPtr *b = (ButtonClassPtr *) class;
|
||||||
|
|
||||||
free((*b)->xkb_acts);
|
free((*b)->xkb_acts);
|
||||||
free((*b));
|
free((*b));
|
||||||
break;
|
break;
|
||||||
|
|
@ -767,8 +737,7 @@ FreeDeviceClass(int type, pointer *class)
|
||||||
TouchClassPtr *t = (TouchClassPtr *) class;
|
TouchClassPtr *t = (TouchClassPtr *) class;
|
||||||
int i;
|
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].sprite.spriteTrace);
|
||||||
free((*t)->touches[i].listeners);
|
free((*t)->touches[i].listeners);
|
||||||
free((*t)->touches[i].valuators);
|
free((*t)->touches[i].valuators);
|
||||||
|
|
@ -780,6 +749,7 @@ FreeDeviceClass(int type, pointer *class)
|
||||||
case FocusClass:
|
case FocusClass:
|
||||||
{
|
{
|
||||||
FocusClassPtr *f = (FocusClassPtr *) class;
|
FocusClassPtr *f = (FocusClassPtr *) class;
|
||||||
|
|
||||||
free((*f)->trace);
|
free((*f)->trace);
|
||||||
free((*f));
|
free((*f));
|
||||||
break;
|
break;
|
||||||
|
|
@ -787,6 +757,7 @@ FreeDeviceClass(int type, pointer *class)
|
||||||
case ProximityClass:
|
case ProximityClass:
|
||||||
{
|
{
|
||||||
ProximityClassPtr *p = (ProximityClassPtr *) class;
|
ProximityClassPtr *p = (ProximityClassPtr *) class;
|
||||||
|
|
||||||
free((*p));
|
free((*p));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -800,12 +771,12 @@ FreeFeedbackClass(int type, pointer *class)
|
||||||
if (!(*class))
|
if (!(*class))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch(type)
|
switch (type) {
|
||||||
{
|
|
||||||
case KbdFeedbackClass:
|
case KbdFeedbackClass:
|
||||||
{
|
{
|
||||||
KbdFeedbackPtr *kbdfeed = (KbdFeedbackPtr *) class;
|
KbdFeedbackPtr *kbdfeed = (KbdFeedbackPtr *) class;
|
||||||
KbdFeedbackPtr k, knext;
|
KbdFeedbackPtr k, knext;
|
||||||
|
|
||||||
for (k = (*kbdfeed); k; k = knext) {
|
for (k = (*kbdfeed); k; k = knext) {
|
||||||
knext = k->next;
|
knext = k->next;
|
||||||
if (k->xkb_sli)
|
if (k->xkb_sli)
|
||||||
|
|
@ -937,8 +908,7 @@ CloseDevice(DeviceIntPtr dev)
|
||||||
classes = (ClassesPtr) & dev->key;
|
classes = (ClassesPtr) & dev->key;
|
||||||
FreeAllDeviceClasses(classes);
|
FreeAllDeviceClasses(classes);
|
||||||
|
|
||||||
if (IsMaster(dev))
|
if (IsMaster(dev)) {
|
||||||
{
|
|
||||||
classes = dev->unused_classes;
|
classes = dev->unused_classes;
|
||||||
FreeAllDeviceClasses(classes);
|
FreeAllDeviceClasses(classes);
|
||||||
free(classes);
|
free(classes);
|
||||||
|
|
@ -952,10 +922,8 @@ CloseDevice(DeviceIntPtr dev)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* a client may have the device set as client pointer */
|
/* a client may have the device set as client pointer */
|
||||||
for (j = 0; j < currentMaxClients; j++)
|
for (j = 0; j < currentMaxClients; j++) {
|
||||||
{
|
if (clients[j] && clients[j]->clientPtr == dev) {
|
||||||
if (clients[j] && clients[j]->clientPtr == dev)
|
|
||||||
{
|
|
||||||
clients[j]->clientPtr = NULL;
|
clients[j]->clientPtr = NULL;
|
||||||
clients[j]->clientPtr = PickPointer(clients[j]);
|
clients[j]->clientPtr = PickPointer(clients[j]);
|
||||||
}
|
}
|
||||||
|
|
@ -991,8 +959,7 @@ CloseDeviceList(DeviceIntPtr *listHead)
|
||||||
freedIds[i] = FALSE;
|
freedIds[i] = FALSE;
|
||||||
|
|
||||||
dev = *listHead;
|
dev = *listHead;
|
||||||
while (dev != NULL)
|
while (dev != NULL) {
|
||||||
{
|
|
||||||
freedIds[dev->id] = TRUE;
|
freedIds[dev->id] = TRUE;
|
||||||
DeleteInputDeviceRequest(dev);
|
DeleteInputDeviceRequest(dev);
|
||||||
|
|
||||||
|
|
@ -1018,8 +985,7 @@ CloseDownDevices(void)
|
||||||
* AttachDevice(NULL, dev, NULL). Instead, we have to forcibly set master
|
* AttachDevice(NULL, dev, NULL). Instead, we have to forcibly set master
|
||||||
* to NULL and pretend nothing happened.
|
* 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))
|
if (!IsMaster(dev) && !IsFloating(dev))
|
||||||
dev->master = NULL;
|
dev->master = NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -1028,12 +994,14 @@ CloseDownDevices(void)
|
||||||
CloseDeviceList(&inputInfo.off_devices);
|
CloseDeviceList(&inputInfo.off_devices);
|
||||||
|
|
||||||
CloseDevice(inputInfo.pointer);
|
CloseDevice(inputInfo.pointer);
|
||||||
|
|
||||||
CloseDevice(inputInfo.keyboard);
|
CloseDevice(inputInfo.keyboard);
|
||||||
|
|
||||||
inputInfo.devices = NULL;
|
inputInfo.devices = NULL;
|
||||||
inputInfo.off_devices = NULL;
|
inputInfo.off_devices = NULL;
|
||||||
inputInfo.keyboard = NULL;
|
inputInfo.keyboard = NULL;
|
||||||
inputInfo.pointer = NULL;
|
inputInfo.pointer = NULL;
|
||||||
|
|
||||||
XkbDeleteRulesDflts();
|
XkbDeleteRulesDflts();
|
||||||
|
|
||||||
OsReleaseSignals();
|
OsReleaseSignals();
|
||||||
|
|
@ -1084,8 +1052,7 @@ RemoveDevice(DeviceIntPtr dev, BOOL sendevent)
|
||||||
initialized = dev->inited;
|
initialized = dev->inited;
|
||||||
deviceid = dev->id;
|
deviceid = dev->id;
|
||||||
|
|
||||||
if (initialized)
|
if (initialized) {
|
||||||
{
|
|
||||||
if (DevHasCursor(dev))
|
if (DevHasCursor(dev))
|
||||||
screen->DisplayCursor(dev, screen, NullCursor);
|
screen->DisplayCursor(dev, screen, NullCursor);
|
||||||
|
|
||||||
|
|
@ -1148,6 +1115,7 @@ dixLookupDevice(DeviceIntPtr *pDev, int id, ClientPtr client, Mask access_mode)
|
||||||
{
|
{
|
||||||
DeviceIntPtr dev;
|
DeviceIntPtr dev;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
*pDev = NULL;
|
*pDev = NULL;
|
||||||
|
|
||||||
for (dev = inputInfo.devices; dev; dev = dev->next) {
|
for (dev = inputInfo.devices; dev; dev = dev->next) {
|
||||||
|
|
@ -1267,11 +1235,16 @@ ValuatorClassPtr
|
||||||
AllocValuatorClass(ValuatorClassPtr src, int numAxes)
|
AllocValuatorClass(ValuatorClassPtr src, int numAxes)
|
||||||
{
|
{
|
||||||
ValuatorClassPtr v;
|
ValuatorClassPtr v;
|
||||||
|
|
||||||
/* force alignment with double */
|
/* force alignment with double */
|
||||||
union align_u { ValuatorClassRec valc; double d; } *align;
|
union align_u {
|
||||||
|
ValuatorClassRec valc;
|
||||||
|
double d;
|
||||||
|
} *align;
|
||||||
int size;
|
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);
|
align = (union align_u *) realloc(src, size);
|
||||||
|
|
||||||
if (!align)
|
if (!align)
|
||||||
|
|
@ -1298,8 +1271,7 @@ InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes, Atom *labels,
|
||||||
if (!dev)
|
if (!dev)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (numAxes > MAX_VALUATORS)
|
if (numAxes > MAX_VALUATORS) {
|
||||||
{
|
|
||||||
LogMessage(X_WARNING,
|
LogMessage(X_WARNING,
|
||||||
"Device '%s' has %d axes, only using first %d.\n",
|
"Device '%s' has %d axes, only using first %d.\n",
|
||||||
dev->name, numAxes, MAX_VALUATORS);
|
dev->name, numAxes, MAX_VALUATORS);
|
||||||
|
|
@ -1311,8 +1283,7 @@ InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes, Atom *labels,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
dev->last.scroll = valuator_mask_new(numAxes);
|
dev->last.scroll = valuator_mask_new(numAxes);
|
||||||
if (!dev->last.scroll)
|
if (!dev->last.scroll) {
|
||||||
{
|
|
||||||
free(valc);
|
free(valc);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
@ -1335,8 +1306,8 @@ InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes, Atom *labels,
|
||||||
AllocateMotionHistory(dev);
|
AllocateMotionHistory(dev);
|
||||||
|
|
||||||
for (i = 0; i < numAxes; i++) {
|
for (i = 0; i < numAxes; i++) {
|
||||||
InitValuatorAxisStruct(dev, i, labels[i], NO_AXIS_LIMITS, NO_AXIS_LIMITS,
|
InitValuatorAxisStruct(dev, i, labels[i], NO_AXIS_LIMITS,
|
||||||
0, 0, 0, mode);
|
NO_AXIS_LIMITS, 0, 0, 0, mode);
|
||||||
valc->axisVal[i] = 0;
|
valc->axisVal[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1352,10 +1323,13 @@ InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes, Atom *labels,
|
||||||
|
|
||||||
/* global list of acceleration schemes */
|
/* global list of acceleration schemes */
|
||||||
ValuatorAccelerationRec pointerAccelerationScheme[] = {
|
ValuatorAccelerationRec pointerAccelerationScheme[] = {
|
||||||
{PtrAccelNoOp, NULL, NULL, NULL, NULL},
|
{PtrAccelNoOp, NULL, NULL, NULL, NULL}
|
||||||
|
,
|
||||||
{PtrAccelPredictable, acceleratePointerPredictable, NULL,
|
{PtrAccelPredictable, acceleratePointerPredictable, NULL,
|
||||||
InitPredictableAccelerationScheme, AccelerationDefaultCleanup},
|
InitPredictableAccelerationScheme, AccelerationDefaultCleanup}
|
||||||
{PtrAccelLightweight, acceleratePointerLightweight, NULL, NULL, NULL},
|
,
|
||||||
|
{PtrAccelLightweight, acceleratePointerLightweight, NULL, NULL, NULL}
|
||||||
|
,
|
||||||
{-1, NULL, NULL, NULL, NULL} /* terminator */
|
{-1, NULL, NULL, NULL, NULL} /* terminator */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -1364,8 +1338,7 @@ ValuatorAccelerationRec pointerAccelerationScheme[] = {
|
||||||
* change anything if unsuccessful.
|
* change anything if unsuccessful.
|
||||||
*/
|
*/
|
||||||
Bool
|
Bool
|
||||||
InitPointerAccelerationScheme(DeviceIntPtr dev,
|
InitPointerAccelerationScheme(DeviceIntPtr dev, int scheme)
|
||||||
int scheme)
|
|
||||||
{
|
{
|
||||||
int x, i = -1;
|
int x, i = -1;
|
||||||
ValuatorClassPtr val;
|
ValuatorClassPtr val;
|
||||||
|
|
@ -1393,10 +1366,12 @@ InitPointerAccelerationScheme(DeviceIntPtr dev,
|
||||||
|
|
||||||
if (pointerAccelerationScheme[i].AccelInitProc) {
|
if (pointerAccelerationScheme[i].AccelInitProc) {
|
||||||
if (!pointerAccelerationScheme[i].AccelInitProc(dev,
|
if (!pointerAccelerationScheme[i].AccelInitProc(dev,
|
||||||
&pointerAccelerationScheme[i])) {
|
&pointerAccelerationScheme
|
||||||
|
[i])) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
val->accelScheme = pointerAccelerationScheme[i];
|
val->accelScheme = pointerAccelerationScheme[i];
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
@ -1440,25 +1415,29 @@ InitPtrFeedbackClassDeviceStruct(DeviceIntPtr dev, PtrCtrlProcPtr controlProc)
|
||||||
}
|
}
|
||||||
|
|
||||||
static LedCtrl defaultLedControl = {
|
static LedCtrl defaultLedControl = {
|
||||||
DEFAULT_LEDS, DEFAULT_LEDS_MASK, 0};
|
DEFAULT_LEDS, DEFAULT_LEDS_MASK, 0
|
||||||
|
};
|
||||||
|
|
||||||
static BellCtrl defaultBellControl = {
|
static BellCtrl defaultBellControl = {
|
||||||
DEFAULT_BELL,
|
DEFAULT_BELL,
|
||||||
DEFAULT_BELL_PITCH,
|
DEFAULT_BELL_PITCH,
|
||||||
DEFAULT_BELL_DURATION,
|
DEFAULT_BELL_DURATION,
|
||||||
0};
|
0
|
||||||
|
};
|
||||||
|
|
||||||
static IntegerCtrl defaultIntegerControl = {
|
static IntegerCtrl defaultIntegerControl = {
|
||||||
DEFAULT_INT_RESOLUTION,
|
DEFAULT_INT_RESOLUTION,
|
||||||
DEFAULT_INT_MIN_VALUE,
|
DEFAULT_INT_MIN_VALUE,
|
||||||
DEFAULT_INT_MAX_VALUE,
|
DEFAULT_INT_MAX_VALUE,
|
||||||
DEFAULT_INT_DISPLAYED,
|
DEFAULT_INT_DISPLAYED,
|
||||||
0};
|
0
|
||||||
|
};
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
InitStringFeedbackClassDeviceStruct (
|
InitStringFeedbackClassDeviceStruct(DeviceIntPtr dev,
|
||||||
DeviceIntPtr dev, StringCtrlProcPtr controlProc,
|
StringCtrlProcPtr controlProc,
|
||||||
int max_symbols, int num_symbols_supported, KeySym *symbols)
|
int max_symbols, int num_symbols_supported,
|
||||||
|
KeySym * symbols)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
StringFeedbackPtr feedc;
|
StringFeedbackPtr feedc;
|
||||||
|
|
@ -1470,10 +1449,10 @@ InitStringFeedbackClassDeviceStruct (
|
||||||
feedc->ctrl.num_symbols_supported = num_symbols_supported;
|
feedc->ctrl.num_symbols_supported = num_symbols_supported;
|
||||||
feedc->ctrl.num_symbols_displayed = 0;
|
feedc->ctrl.num_symbols_displayed = 0;
|
||||||
feedc->ctrl.max_symbols = max_symbols;
|
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);
|
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_supported);
|
||||||
free(feedc->ctrl.symbols_displayed);
|
free(feedc->ctrl.symbols_displayed);
|
||||||
free(feedc);
|
free(feedc);
|
||||||
|
|
@ -1531,7 +1510,8 @@ InitLedFeedbackClassDeviceStruct (DeviceIntPtr dev, LedCtrlProcPtr controlProc)
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
InitIntegerFeedbackClassDeviceStruct (DeviceIntPtr dev, IntegerCtrlProcPtr controlProc)
|
InitIntegerFeedbackClassDeviceStruct(DeviceIntPtr dev,
|
||||||
|
IntegerCtrlProcPtr controlProc)
|
||||||
{
|
{
|
||||||
IntegerFeedbackPtr feedc;
|
IntegerFeedbackPtr feedc;
|
||||||
|
|
||||||
|
|
@ -1549,9 +1529,9 @@ InitIntegerFeedbackClassDeviceStruct (DeviceIntPtr dev, IntegerCtrlProcPtr contr
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
InitPointerDeviceStruct(DevicePtr device, CARD8 *map, int numButtons, Atom* btn_labels,
|
InitPointerDeviceStruct(DevicePtr device, CARD8 *map, int numButtons,
|
||||||
PtrCtrlProcPtr controlProc, int numMotionEvents,
|
Atom *btn_labels, PtrCtrlProcPtr controlProc,
|
||||||
int numAxes, Atom *axes_labels)
|
int numMotionEvents, int numAxes, Atom *axes_labels)
|
||||||
{
|
{
|
||||||
DeviceIntPtr dev = (DeviceIntPtr) device;
|
DeviceIntPtr dev = (DeviceIntPtr) device;
|
||||||
|
|
||||||
|
|
@ -1584,8 +1564,7 @@ InitTouchClassDeviceStruct(DeviceIntPtr device, unsigned int max_touches,
|
||||||
if (num_axes < 2)
|
if (num_axes < 2)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (num_axes > MAX_VALUATORS)
|
if (num_axes > MAX_VALUATORS) {
|
||||||
{
|
|
||||||
LogMessage(X_WARNING,
|
LogMessage(X_WARNING,
|
||||||
"Device '%s' has %d touch axes, only using first %d.\n",
|
"Device '%s' has %d touch axes, only using first %d.\n",
|
||||||
device->name, num_axes, MAX_VALUATORS);
|
device->name, num_axes, MAX_VALUATORS);
|
||||||
|
|
@ -1639,10 +1618,8 @@ BadDeviceMap(BYTE *buff, int length, unsigned low, unsigned high, XID *errval)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < length; i++)
|
for (i = 0; i < length; i++)
|
||||||
if (buff[i]) /* only check non-zero elements */
|
if (buff[i]) { /* only check non-zero elements */
|
||||||
{
|
if ((low > buff[i]) || (high < buff[i])) {
|
||||||
if ((low > buff[i]) || (high < buff[i]))
|
|
||||||
{
|
|
||||||
*errval = buff[i];
|
*errval = buff[i];
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
@ -1655,6 +1632,7 @@ ProcSetModifierMapping(ClientPtr client)
|
||||||
{
|
{
|
||||||
xSetModifierMappingReply rep;
|
xSetModifierMappingReply rep;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
REQUEST(xSetModifierMappingReq);
|
REQUEST(xSetModifierMappingReq);
|
||||||
REQUEST_AT_LEAST_SIZE(xSetModifierMappingReq);
|
REQUEST_AT_LEAST_SIZE(xSetModifierMappingReq);
|
||||||
|
|
||||||
|
|
@ -1686,6 +1664,7 @@ ProcGetModifierMapping(ClientPtr client)
|
||||||
xGetModifierMappingReply rep;
|
xGetModifierMappingReply rep;
|
||||||
int max_keys_per_mod = 0;
|
int max_keys_per_mod = 0;
|
||||||
KeyCode *modkeymap = NULL;
|
KeyCode *modkeymap = NULL;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xReq);
|
REQUEST_SIZE_MATCH(xReq);
|
||||||
|
|
||||||
generate_modkeymap(client, PickKeyboard(client), &modkeymap,
|
generate_modkeymap(client, PickKeyboard(client), &modkeymap,
|
||||||
|
|
@ -1714,6 +1693,7 @@ ProcChangeKeyboardMapping(ClientPtr client)
|
||||||
KeySymsRec keysyms;
|
KeySymsRec keysyms;
|
||||||
DeviceIntPtr pDev, tmp;
|
DeviceIntPtr pDev, tmp;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
REQUEST_AT_LEAST_SIZE(xChangeKeyboardMappingReq);
|
REQUEST_AT_LEAST_SIZE(xChangeKeyboardMappingReq);
|
||||||
|
|
||||||
len = client->req_len - bytes_to_int32(sizeof(xChangeKeyboardMappingReq));
|
len = client->req_len - bytes_to_int32(sizeof(xChangeKeyboardMappingReq));
|
||||||
|
|
@ -1772,6 +1752,7 @@ ProcSetPointerMapping(ClientPtr client)
|
||||||
int i, j;
|
int i, j;
|
||||||
DeviceIntPtr ptr = PickPointer(client);
|
DeviceIntPtr ptr = PickPointer(client);
|
||||||
xSetPointerMappingReply rep;
|
xSetPointerMappingReply rep;
|
||||||
|
|
||||||
REQUEST(xSetPointerMappingReq);
|
REQUEST(xSetPointerMappingReq);
|
||||||
REQUEST_AT_LEAST_SIZE(xSetPointerMappingReq);
|
REQUEST_AT_LEAST_SIZE(xSetPointerMappingReq);
|
||||||
|
|
||||||
|
|
@ -1826,6 +1807,7 @@ ProcGetKeyboardMapping(ClientPtr client)
|
||||||
XkbDescPtr xkb;
|
XkbDescPtr xkb;
|
||||||
KeySymsPtr syms;
|
KeySymsPtr syms;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
REQUEST(xGetKeyboardMappingReq);
|
REQUEST(xGetKeyboardMappingReq);
|
||||||
REQUEST_SIZE_MATCH(xGetKeyboardMappingReq);
|
REQUEST_SIZE_MATCH(xGetKeyboardMappingReq);
|
||||||
|
|
||||||
|
|
@ -1871,11 +1853,13 @@ int
|
||||||
ProcGetPointerMapping(ClientPtr client)
|
ProcGetPointerMapping(ClientPtr client)
|
||||||
{
|
{
|
||||||
xGetPointerMappingReply rep;
|
xGetPointerMappingReply rep;
|
||||||
|
|
||||||
/* Apps may get different values each time they call GetPointerMapping as
|
/* Apps may get different values each time they call GetPointerMapping as
|
||||||
* the ClientPointer could change. */
|
* the ClientPointer could change. */
|
||||||
DeviceIntPtr ptr = PickPointer(client);
|
DeviceIntPtr ptr = PickPointer(client);
|
||||||
ButtonClassPtr butc = ptr->button;
|
ButtonClassPtr butc = ptr->button;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xReq);
|
REQUEST_SIZE_MATCH(xReq);
|
||||||
|
|
||||||
rc = XaceHook(XACE_DEVICE_ACCESS, client, ptr, DixGetAttrAccess);
|
rc = XaceHook(XACE_DEVICE_ACCESS, client, ptr, DixGetAttrAccess);
|
||||||
|
|
@ -1896,6 +1880,7 @@ void
|
||||||
NoteLedState(DeviceIntPtr keybd, int led, Bool on)
|
NoteLedState(DeviceIntPtr keybd, int led, Bool on)
|
||||||
{
|
{
|
||||||
KeybdCtrl *ctrl = &keybd->kbdfeed->ctrl;
|
KeybdCtrl *ctrl = &keybd->kbdfeed->ctrl;
|
||||||
|
|
||||||
if (on)
|
if (on)
|
||||||
ctrl->leds |= ((Leds) 1 << (led - 1));
|
ctrl->leds |= ((Leds) 1 << (led - 1));
|
||||||
else
|
else
|
||||||
|
|
@ -1903,8 +1888,8 @@ NoteLedState(DeviceIntPtr keybd, int led, Bool on)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
Ones(unsigned long mask) /* HACKMEM 169 */
|
Ones(unsigned long mask)
|
||||||
{
|
{ /* HACKMEM 169 */
|
||||||
unsigned long y;
|
unsigned long y;
|
||||||
|
|
||||||
y = (mask >> 1) & 033333333333;
|
y = (mask >> 1) & 033333333333;
|
||||||
|
|
@ -2082,6 +2067,7 @@ ProcChangeKeyboardControl (ClientPtr client)
|
||||||
BITS32 vmask;
|
BITS32 vmask;
|
||||||
int ret = Success, error = Success;
|
int ret = Success, error = Success;
|
||||||
DeviceIntPtr pDev = NULL, keyboard;
|
DeviceIntPtr pDev = NULL, keyboard;
|
||||||
|
|
||||||
REQUEST(xChangeKeyboardControlReq);
|
REQUEST(xChangeKeyboardControlReq);
|
||||||
|
|
||||||
REQUEST_AT_LEAST_SIZE(xChangeKeyboardControlReq);
|
REQUEST_AT_LEAST_SIZE(xChangeKeyboardControlReq);
|
||||||
|
|
@ -2089,7 +2075,8 @@ ProcChangeKeyboardControl (ClientPtr client)
|
||||||
vmask = stuff->mask;
|
vmask = stuff->mask;
|
||||||
vlist = (XID *) &stuff[1];
|
vlist = (XID *) &stuff[1];
|
||||||
|
|
||||||
if (client->req_len != (sizeof(xChangeKeyboardControlReq)>>2)+Ones(vmask))
|
if (client->req_len !=
|
||||||
|
(sizeof(xChangeKeyboardControlReq) >> 2) + Ones(vmask))
|
||||||
return BadLength;
|
return BadLength;
|
||||||
|
|
||||||
keyboard = PickKeyboard(client);
|
keyboard = PickKeyboard(client);
|
||||||
|
|
@ -2124,6 +2111,7 @@ ProcGetKeyboardControl (ClientPtr client)
|
||||||
DeviceIntPtr kbd = PickKeyboard(client);
|
DeviceIntPtr kbd = PickKeyboard(client);
|
||||||
KeybdCtrl *ctrl = &kbd->kbdfeed->ctrl;
|
KeybdCtrl *ctrl = &kbd->kbdfeed->ctrl;
|
||||||
xGetKeyboardControlReply rep;
|
xGetKeyboardControlReply rep;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xReq);
|
REQUEST_SIZE_MATCH(xReq);
|
||||||
|
|
||||||
rc = XaceHook(XACE_DEVICE_ACCESS, client, kbd, DixGetAttrAccess);
|
rc = XaceHook(XACE_DEVICE_ACCESS, client, kbd, DixGetAttrAccess);
|
||||||
|
|
@ -2152,6 +2140,7 @@ ProcBell(ClientPtr client)
|
||||||
int base = keybd->kbdfeed->ctrl.bell;
|
int base = keybd->kbdfeed->ctrl.bell;
|
||||||
int newpercent;
|
int newpercent;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
REQUEST(xBellReq);
|
REQUEST(xBellReq);
|
||||||
REQUEST_SIZE_MATCH(xBellReq);
|
REQUEST_SIZE_MATCH(xBellReq);
|
||||||
|
|
||||||
|
|
@ -2188,6 +2177,7 @@ ProcChangePointerControl(ClientPtr client)
|
||||||
DeviceIntPtr dev, mouse = PickPointer(client);
|
DeviceIntPtr dev, mouse = PickPointer(client);
|
||||||
PtrCtrl ctrl; /* might get BadValue part way through */
|
PtrCtrl ctrl; /* might get BadValue part way through */
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
REQUEST(xChangePointerControlReq);
|
REQUEST(xChangePointerControlReq);
|
||||||
REQUEST_SIZE_MATCH(xChangePointerControlReq);
|
REQUEST_SIZE_MATCH(xChangePointerControlReq);
|
||||||
|
|
||||||
|
|
@ -2264,6 +2254,7 @@ ProcGetPointerControl(ClientPtr client)
|
||||||
PtrCtrl *ctrl = &ptr->ptrfeed->ctrl;
|
PtrCtrl *ctrl = &ptr->ptrfeed->ctrl;
|
||||||
xGetPointerControlReply rep;
|
xGetPointerControlReply rep;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xReq);
|
REQUEST_SIZE_MATCH(xReq);
|
||||||
|
|
||||||
rc = XaceHook(XACE_DEVICE_ACCESS, client, ptr, DixGetAttrAccess);
|
rc = XaceHook(XACE_DEVICE_ACCESS, client, ptr, DixGetAttrAccess);
|
||||||
|
|
@ -2306,6 +2297,7 @@ ProcGetMotionEvents(ClientPtr client)
|
||||||
unsigned long nEvents;
|
unsigned long nEvents;
|
||||||
DeviceIntPtr mouse = PickPointer(client);
|
DeviceIntPtr mouse = PickPointer(client);
|
||||||
TimeStamp start, stop;
|
TimeStamp start, stop;
|
||||||
|
|
||||||
REQUEST(xGetMotionEventsReq);
|
REQUEST(xGetMotionEventsReq);
|
||||||
REQUEST_SIZE_MATCH(xGetMotionEventsReq);
|
REQUEST_SIZE_MATCH(xGetMotionEventsReq);
|
||||||
|
|
||||||
|
|
@ -2325,8 +2317,7 @@ ProcGetMotionEvents(ClientPtr client)
|
||||||
stop = ClientTimeToServerTime(stuff->stop);
|
stop = ClientTimeToServerTime(stuff->stop);
|
||||||
if ((CompareTimeStamps(start, stop) != LATER) &&
|
if ((CompareTimeStamps(start, stop) != LATER) &&
|
||||||
(CompareTimeStamps(start, currentTime) != LATER) &&
|
(CompareTimeStamps(start, currentTime) != LATER) &&
|
||||||
mouse->valuator->numMotionEvents)
|
mouse->valuator->numMotionEvents) {
|
||||||
{
|
|
||||||
if (CompareTimeStamps(stop, currentTime) == LATER)
|
if (CompareTimeStamps(stop, currentTime) == LATER)
|
||||||
stop = currentTime;
|
stop = currentTime;
|
||||||
count = GetMotionHistory(mouse, &coords, start.milliseconds,
|
count = GetMotionHistory(mouse, &coords, start.milliseconds,
|
||||||
|
|
@ -2340,8 +2331,7 @@ ProcGetMotionEvents(ClientPtr client)
|
||||||
wBorderWidth(pWin);
|
wBorderWidth(pWin);
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
if ((xmin <= coords[i].x) && (coords[i].x < xmax) &&
|
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].time = coords[i].time;
|
||||||
coords[nEvents].x = coords[i].x - pWin->drawable.x;
|
coords[nEvents].x = coords[i].x - pWin->drawable.x;
|
||||||
coords[nEvents].y = coords[i].y - pWin->drawable.y;
|
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.length = nEvents * bytes_to_int32(sizeof(xTimecoord));
|
||||||
rep.nEvents = nEvents;
|
rep.nEvents = nEvents;
|
||||||
WriteReplyToClient(client, sizeof(xGetMotionEventsReply), &rep);
|
WriteReplyToClient(client, sizeof(xGetMotionEventsReply), &rep);
|
||||||
if (nEvents)
|
if (nEvents) {
|
||||||
{
|
|
||||||
client->pSwapReplyFunc = (ReplySwapPtr) SwapTimeCoordWrite;
|
client->pSwapReplyFunc = (ReplySwapPtr) SwapTimeCoordWrite;
|
||||||
WriteSwappedDataToClient(client, nEvents * sizeof(xTimecoord),
|
WriteSwappedDataToClient(client, nEvents * sizeof(xTimecoord),
|
||||||
(char *) coords);
|
(char *) coords);
|
||||||
|
|
@ -2389,7 +2378,6 @@ ProcQueryKeymap(ClientPtr client)
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Recalculate the number of buttons for the master device. The number of
|
* 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
|
* buttons on the master device is equal to the number of buttons on the
|
||||||
|
|
@ -2408,18 +2396,15 @@ RecalculateMasterButtons(DeviceIntPtr slave)
|
||||||
if (!master)
|
if (!master)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (dev = inputInfo.devices; dev; dev = dev->next)
|
for (dev = inputInfo.devices; dev; dev = dev->next) {
|
||||||
{
|
|
||||||
if (IsMaster(dev) ||
|
if (IsMaster(dev) ||
|
||||||
GetMaster(dev, MASTER_ATTACHED) != master ||
|
GetMaster(dev, MASTER_ATTACHED) != master || !dev->button)
|
||||||
!dev->button)
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
maxbuttons = max(maxbuttons, dev->button->numButtons);
|
maxbuttons = max(maxbuttons, dev->button->numButtons);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (master->button && master->button->numButtons != maxbuttons)
|
if (master->button && master->button->numButtons != maxbuttons) {
|
||||||
{
|
|
||||||
int i;
|
int i;
|
||||||
DeviceChangedEvent event;
|
DeviceChangedEvent event;
|
||||||
|
|
||||||
|
|
@ -2436,21 +2421,19 @@ RecalculateMasterButtons(DeviceIntPtr slave)
|
||||||
memcpy(&event.buttons.names, master->button->labels, maxbuttons *
|
memcpy(&event.buttons.names, master->button->labels, maxbuttons *
|
||||||
sizeof(Atom));
|
sizeof(Atom));
|
||||||
|
|
||||||
if (master->valuator)
|
if (master->valuator) {
|
||||||
{
|
|
||||||
event.num_valuators = master->valuator->numAxes;
|
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].min = master->valuator->axes[i].min_value;
|
||||||
event.valuators[i].max = master->valuator->axes[i].max_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].mode = master->valuator->axes[i].mode;
|
||||||
event.valuators[i].name = master->valuator->axes[i].label;
|
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.min_keycode = master->key->xkbInfo->desc->min_key_code;
|
||||||
event.keys.max_keycode = master->key->xkbInfo->desc->max_key_code;
|
event.keys.max_keycode = master->key->xkbInfo->desc->max_key_code;
|
||||||
}
|
}
|
||||||
|
|
@ -2475,21 +2458,18 @@ ReleaseButtonsAndKeys(DeviceIntPtr dev)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Release all buttons */
|
/* Release all buttons */
|
||||||
for (i = 0; b && i < b->numButtons; i++)
|
for (i = 0; b && i < b->numButtons; i++) {
|
||||||
{
|
if (BitIsOn(b->down, i)) {
|
||||||
if (BitIsOn(b->down, i))
|
nevents =
|
||||||
{
|
GetPointerEvents(eventlist, dev, ButtonRelease, i, 0, NULL);
|
||||||
nevents = GetPointerEvents(eventlist, dev, ButtonRelease, i, 0, NULL);
|
|
||||||
for (j = 0; j < nevents; j++)
|
for (j = 0; j < nevents; j++)
|
||||||
mieqProcessDeviceEvent(dev, &eventlist[j], NULL);
|
mieqProcessDeviceEvent(dev, &eventlist[j], NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Release all keys */
|
/* Release all keys */
|
||||||
for (i = 0; k && i < MAP_LENGTH; i++)
|
for (i = 0; k && i < MAP_LENGTH; i++) {
|
||||||
{
|
if (BitIsOn(k->down, i)) {
|
||||||
if (BitIsOn(k->down, i))
|
|
||||||
{
|
|
||||||
nevents = GetKeyboardEvents(eventlist, dev, KeyRelease, i, NULL);
|
nevents = GetKeyboardEvents(eventlist, dev, KeyRelease, i, NULL);
|
||||||
for (j = 0; j < nevents; j++)
|
for (j = 0; j < nevents; j++)
|
||||||
mieqProcessDeviceEvent(dev, &eventlist[j], NULL);
|
mieqProcessDeviceEvent(dev, &eventlist[j], NULL);
|
||||||
|
|
@ -2513,6 +2493,7 @@ int
|
||||||
AttachDevice(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr master)
|
AttachDevice(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr master)
|
||||||
{
|
{
|
||||||
ScreenPtr screen;
|
ScreenPtr screen;
|
||||||
|
|
||||||
if (!dev || IsMaster(dev))
|
if (!dev || IsMaster(dev))
|
||||||
return BadDevice;
|
return BadDevice;
|
||||||
|
|
||||||
|
|
@ -2524,8 +2505,7 @@ AttachDevice(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr master)
|
||||||
return Success;
|
return Success;
|
||||||
|
|
||||||
/* free the existing sprite. */
|
/* free the existing sprite. */
|
||||||
if (IsFloating(dev) && dev->spriteInfo->paired == dev)
|
if (IsFloating(dev) && dev->spriteInfo->paired == dev) {
|
||||||
{
|
|
||||||
screen = miPointerGetScreen(dev);
|
screen = miPointerGetScreen(dev);
|
||||||
screen->DeviceCursorCleanup(dev, screen);
|
screen->DeviceCursorCleanup(dev, screen);
|
||||||
free(dev->spriteInfo->sprite);
|
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
|
* Sprite has to be forced to NULL first, otherwise InitializeSprite won't
|
||||||
* alloc new memory but overwrite the previous one.
|
* alloc new memory but overwrite the previous one.
|
||||||
*/
|
*/
|
||||||
if (!master)
|
if (!master) {
|
||||||
{
|
|
||||||
WindowPtr currentRoot;
|
WindowPtr currentRoot;
|
||||||
|
|
||||||
if (dev->spriteInfo->sprite)
|
if (dev->spriteInfo->sprite)
|
||||||
|
|
@ -2555,8 +2534,8 @@ AttachDevice(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr master)
|
||||||
InitializeSprite(dev, currentRoot);
|
InitializeSprite(dev, currentRoot);
|
||||||
dev->spriteInfo->spriteOwner = FALSE;
|
dev->spriteInfo->spriteOwner = FALSE;
|
||||||
dev->spriteInfo->paired = dev;
|
dev->spriteInfo->paired = dev;
|
||||||
} else
|
}
|
||||||
{
|
else {
|
||||||
dev->spriteInfo->sprite = master->spriteInfo->sprite;
|
dev->spriteInfo->sprite = master->spriteInfo->sprite;
|
||||||
dev->spriteInfo->paired = master;
|
dev->spriteInfo->paired = master;
|
||||||
dev->spriteInfo->spriteOwner = FALSE;
|
dev->spriteInfo->spriteOwner = FALSE;
|
||||||
|
|
@ -2587,7 +2566,6 @@ GetPairedDevice(DeviceIntPtr dev)
|
||||||
return dev->spriteInfo->paired;
|
return dev->spriteInfo->paired;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the requested master for this device.
|
* Returns the requested master for this device.
|
||||||
* The return values are:
|
* The return values are:
|
||||||
|
|
@ -2615,18 +2593,17 @@ GetMaster(DeviceIntPtr dev, int which)
|
||||||
master = dev;
|
master = dev;
|
||||||
else {
|
else {
|
||||||
master = dev->master;
|
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;
|
return dev;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (master && which != MASTER_ATTACHED)
|
if (master && which != MASTER_ATTACHED) {
|
||||||
{
|
if (which == MASTER_KEYBOARD || which == KEYBOARD_OR_FLOAT) {
|
||||||
if (which == MASTER_KEYBOARD || which == KEYBOARD_OR_FLOAT)
|
|
||||||
{
|
|
||||||
if (master->type != MASTER_KEYBOARD)
|
if (master->type != MASTER_KEYBOARD)
|
||||||
master = GetPairedDevice(master);
|
master = GetPairedDevice(master);
|
||||||
} else
|
}
|
||||||
{
|
else {
|
||||||
if (master->type != MASTER_POINTER)
|
if (master->type != MASTER_POINTER)
|
||||||
master = GetPairedDevice(master);
|
master = GetPairedDevice(master);
|
||||||
}
|
}
|
||||||
|
|
@ -2646,21 +2623,22 @@ int
|
||||||
AllocDevicePair(ClientPtr client, const char *name,
|
AllocDevicePair(ClientPtr client, const char *name,
|
||||||
DeviceIntPtr *ptr,
|
DeviceIntPtr *ptr,
|
||||||
DeviceIntPtr *keybd,
|
DeviceIntPtr *keybd,
|
||||||
DeviceProc ptr_proc,
|
DeviceProc ptr_proc, DeviceProc keybd_proc, Bool master)
|
||||||
DeviceProc keybd_proc,
|
|
||||||
Bool master)
|
|
||||||
{
|
{
|
||||||
DeviceIntPtr pointer;
|
DeviceIntPtr pointer;
|
||||||
DeviceIntPtr keyboard;
|
DeviceIntPtr keyboard;
|
||||||
|
|
||||||
*ptr = *keybd = NULL;
|
*ptr = *keybd = NULL;
|
||||||
|
|
||||||
pointer = AddInputDevice(client, ptr_proc, TRUE);
|
pointer = AddInputDevice(client, ptr_proc, TRUE);
|
||||||
|
|
||||||
if (!pointer)
|
if (!pointer)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
|
||||||
if (asprintf(&pointer->name, "%s pointer", name) == -1) {
|
if (asprintf(&pointer->name, "%s pointer", name) == -1) {
|
||||||
pointer->name = NULL;
|
pointer->name = NULL;
|
||||||
RemoveDevice(pointer, FALSE);
|
RemoveDevice(pointer, FALSE);
|
||||||
|
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2677,9 +2655,9 @@ AllocDevicePair (ClientPtr client, const char* name,
|
||||||
pointer->type = (master) ? MASTER_POINTER : SLAVE;
|
pointer->type = (master) ? MASTER_POINTER : SLAVE;
|
||||||
|
|
||||||
keyboard = AddInputDevice(client, keybd_proc, TRUE);
|
keyboard = AddInputDevice(client, keybd_proc, TRUE);
|
||||||
if (!keyboard)
|
if (!keyboard) {
|
||||||
{
|
|
||||||
RemoveDevice(pointer, FALSE);
|
RemoveDevice(pointer, FALSE);
|
||||||
|
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2687,6 +2665,7 @@ AllocDevicePair (ClientPtr client, const char* name,
|
||||||
keyboard->name = NULL;
|
keyboard->name = NULL;
|
||||||
RemoveDevice(keyboard, FALSE);
|
RemoveDevice(keyboard, FALSE);
|
||||||
RemoveDevice(pointer, FALSE);
|
RemoveDevice(pointer, FALSE);
|
||||||
|
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2704,9 +2683,11 @@ AllocDevicePair (ClientPtr client, const char* name,
|
||||||
|
|
||||||
/* The ClassesRec stores the device classes currently not used. */
|
/* The ClassesRec stores the device classes currently not used. */
|
||||||
pointer->unused_classes = calloc(1, sizeof(ClassesRec));
|
pointer->unused_classes = calloc(1, sizeof(ClassesRec));
|
||||||
|
|
||||||
keyboard->unused_classes = calloc(1, sizeof(ClassesRec));
|
keyboard->unused_classes = calloc(1, sizeof(ClassesRec));
|
||||||
|
|
||||||
*ptr = pointer;
|
*ptr = pointer;
|
||||||
|
|
||||||
*keybd = keyboard;
|
*keybd = keyboard;
|
||||||
|
|
||||||
return Success;
|
return Success;
|
||||||
|
|
@ -2715,7 +2696,8 @@ AllocDevicePair (ClientPtr client, const char* name,
|
||||||
/**
|
/**
|
||||||
* Return Relative or Absolute for the device.
|
* 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);
|
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 given mode for the axis. If axis is VALUATOR_MODE_ALL_AXES, then
|
||||||
* set the mode for all axes.
|
* 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)
|
if (axis != VALUATOR_MODE_ALL_AXES)
|
||||||
dev->valuator->axes[axis].mode = mode;
|
dev->valuator->axes[axis].mode = mode;
|
||||||
else {
|
else {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < dev->valuator->numAxes; i++)
|
for (i = 0; i < dev->valuator->numAxes; i++)
|
||||||
dev->valuator->axes[i].mode = mode;
|
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
|
used in advertising or otherwise to promote the sale, use or other dealings
|
||||||
in this Software without prior written authorization from The Open Group.
|
in this Software without prior written authorization from The Open Group.
|
||||||
|
|
||||||
|
|
||||||
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
|
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
|
||||||
|
|
||||||
All Rights Reserved
|
All Rights Reserved
|
||||||
|
|
@ -81,7 +80,6 @@ Author: Adobe Systems Incorporated
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_DIX_CONFIG_H
|
#ifdef HAVE_DIX_CONFIG_H
|
||||||
#include <dix-config.h>
|
#include <dix-config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -126,17 +124,16 @@ TimeStamp
|
||||||
ClientTimeToServerTime(CARD32 c)
|
ClientTimeToServerTime(CARD32 c)
|
||||||
{
|
{
|
||||||
TimeStamp ts;
|
TimeStamp ts;
|
||||||
|
|
||||||
if (c == CurrentTime)
|
if (c == CurrentTime)
|
||||||
return currentTime;
|
return currentTime;
|
||||||
ts.months = currentTime.months;
|
ts.months = currentTime.months;
|
||||||
ts.milliseconds = c;
|
ts.milliseconds = c;
|
||||||
if (c > currentTime.milliseconds)
|
if (c > currentTime.milliseconds) {
|
||||||
{
|
|
||||||
if (((unsigned long) c - currentTime.milliseconds) > HALFMONTH)
|
if (((unsigned long) c - currentTime.milliseconds) > HALFMONTH)
|
||||||
ts.months -= 1;
|
ts.months -= 1;
|
||||||
}
|
}
|
||||||
else if (c < currentTime.milliseconds)
|
else if (c < currentTime.milliseconds) {
|
||||||
{
|
|
||||||
if (((unsigned long) currentTime.milliseconds - c) > HALFMONTH)
|
if (((unsigned long) currentTime.milliseconds - c) > HALFMONTH)
|
||||||
ts.months += 1;
|
ts.months += 1;
|
||||||
}
|
}
|
||||||
|
|
@ -154,6 +151,7 @@ static unsigned char
|
||||||
ISOLatin1ToLower(unsigned char source)
|
ISOLatin1ToLower(unsigned char source)
|
||||||
{
|
{
|
||||||
unsigned char dest;
|
unsigned char dest;
|
||||||
|
|
||||||
if ((source >= XK_A) && (source <= XK_Z))
|
if ((source >= XK_A) && (source <= XK_Z))
|
||||||
dest = source + (XK_a - XK_A);
|
dest = source + (XK_a - XK_A);
|
||||||
else if ((source >= XK_Agrave) && (source <= XK_Odiaeresis))
|
else if ((source >= XK_Agrave) && (source <= XK_Odiaeresis))
|
||||||
|
|
@ -165,15 +163,13 @@ ISOLatin1ToLower (unsigned char source)
|
||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
CompareISOLatin1Lowered(const unsigned char *s1, int s1len,
|
CompareISOLatin1Lowered(const unsigned char *s1, int s1len,
|
||||||
const unsigned char *s2, int s2len)
|
const unsigned char *s2, int s2len)
|
||||||
{
|
{
|
||||||
unsigned char c1, c2;
|
unsigned char c1, c2;
|
||||||
|
|
||||||
for (;;)
|
for (;;) {
|
||||||
{
|
|
||||||
/* note -- compare against zero so that -1 ignores len */
|
/* note -- compare against zero so that -1 ignores len */
|
||||||
c1 = s1len-- ? *s1++ : '\0';
|
c1 = s1len-- ? *s1++ : '\0';
|
||||||
c2 = s2len-- ? *s2++ : '\0';
|
c2 = s2len-- ? *s2++ : '\0';
|
||||||
|
|
@ -203,7 +199,8 @@ dixLookupDrawable(DrawablePtr *pDraw, XID id, ClientPtr client,
|
||||||
|
|
||||||
*pDraw = NULL;
|
*pDraw = NULL;
|
||||||
|
|
||||||
rc = dixLookupResourceByClass((pointer *)&pTmp, id, RC_DRAWABLE, client, access);
|
rc = dixLookupResourceByClass((pointer *) &pTmp, id, RC_DRAWABLE, client,
|
||||||
|
access);
|
||||||
|
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
client->errorValue = id;
|
client->errorValue = id;
|
||||||
|
|
@ -223,6 +220,7 @@ int
|
||||||
dixLookupWindow(WindowPtr *pWin, XID id, ClientPtr client, Mask access)
|
dixLookupWindow(WindowPtr *pWin, XID id, ClientPtr client, Mask access)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
rc = dixLookupDrawable((DrawablePtr *) pWin, id, client, M_WINDOW, access);
|
rc = dixLookupDrawable((DrawablePtr *) pWin, id, client, M_WINDOW, access);
|
||||||
/* dixLookupDrawable returns BadMatch iff id is a valid Drawable
|
/* dixLookupDrawable returns BadMatch iff id is a valid Drawable
|
||||||
but is not a Window. Users of dixLookupWindow expect a BadWindow
|
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;
|
int rc;
|
||||||
GC *pGC;
|
GC *pGC;
|
||||||
|
|
||||||
client->errorValue = id; /* EITHER font or gc */
|
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)
|
if (rc != BadFont)
|
||||||
return rc;
|
return rc;
|
||||||
rc = dixLookupResourceByType((pointer *) &pGC, id, RT_GC, client, access);
|
rc = dixLookupResourceByType((pointer *) &pGC, id, RT_GC, client, access);
|
||||||
|
|
@ -294,14 +294,12 @@ AlterSaveSetForClient(ClientPtr client, WindowPtr pWin, unsigned mode,
|
||||||
|
|
||||||
numnow = client->numSaved;
|
numnow = client->numSaved;
|
||||||
j = 0;
|
j = 0;
|
||||||
if (numnow)
|
if (numnow) {
|
||||||
{
|
|
||||||
pTmp = client->saveSet;
|
pTmp = client->saveSet;
|
||||||
while ((j < numnow) && (SaveSetWindow(pTmp[j]) != (pointer) pWin))
|
while ((j < numnow) && (SaveSetWindow(pTmp[j]) != (pointer) pWin))
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
if (mode == SetModeInsert)
|
if (mode == SetModeInsert) {
|
||||||
{
|
|
||||||
if (j < numnow) /* duplicate */
|
if (j < numnow) /* duplicate */
|
||||||
return Success;
|
return Success;
|
||||||
numnow++;
|
numnow++;
|
||||||
|
|
@ -315,22 +313,19 @@ AlterSaveSetForClient(ClientPtr client, WindowPtr pWin, unsigned mode,
|
||||||
SaveSetAssignMap(client->saveSet[numnow - 1], map);
|
SaveSetAssignMap(client->saveSet[numnow - 1], map);
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
else if ((mode == SetModeDelete) && (j < numnow))
|
else if ((mode == SetModeDelete) && (j < numnow)) {
|
||||||
{
|
while (j < numnow - 1) {
|
||||||
while (j < numnow-1)
|
|
||||||
{
|
|
||||||
pTmp[j] = pTmp[j + 1];
|
pTmp[j] = pTmp[j + 1];
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
numnow--;
|
numnow--;
|
||||||
if (numnow)
|
if (numnow) {
|
||||||
{
|
pTmp =
|
||||||
pTmp = (SaveSetElt *)realloc(client->saveSet, sizeof(*pTmp) * numnow);
|
(SaveSetElt *) realloc(client->saveSet, sizeof(*pTmp) * numnow);
|
||||||
if (pTmp)
|
if (pTmp)
|
||||||
client->saveSet = pTmp;
|
client->saveSet = pTmp;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
free(client->saveSet);
|
free(client->saveSet);
|
||||||
client->saveSet = (SaveSetElt *) NULL;
|
client->saveSet = (SaveSetElt *) NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -346,11 +341,11 @@ DeleteWindowFromAnySaveSet(WindowPtr pWin)
|
||||||
int i;
|
int i;
|
||||||
ClientPtr client;
|
ClientPtr client;
|
||||||
|
|
||||||
for (i = 0; i< currentMaxClients; i++)
|
for (i = 0; i < currentMaxClients; i++) {
|
||||||
{
|
|
||||||
client = clients[i];
|
client = clients[i];
|
||||||
if (client && client->numSaved)
|
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;
|
++inHandler;
|
||||||
for (i = 0; i < screenInfo.numScreens; i++)
|
for (i = 0; i < screenInfo.numScreens; i++)
|
||||||
(*screenInfo.screens[i]->BlockHandler) (i,
|
(*screenInfo.screens[i]->BlockHandler) (i,
|
||||||
screenInfo.screens[i]->blockData,
|
screenInfo.screens[i]->
|
||||||
pTimeout, pReadmask);
|
blockData, pTimeout, pReadmask);
|
||||||
for (i = 0; i < numHandlers; i++)
|
for (i = 0; i < numHandlers; i++)
|
||||||
if (!handlers[i].deleted)
|
if (!handlers[i].deleted)
|
||||||
(*handlers[i].BlockHandler) (handlers[i].blockData,
|
(*handlers[i].BlockHandler) (handlers[i].blockData,
|
||||||
pTimeout, pReadmask);
|
pTimeout, pReadmask);
|
||||||
if (handlerDeleted)
|
if (handlerDeleted) {
|
||||||
{
|
|
||||||
for (i = 0; i < numHandlers;)
|
for (i = 0; i < numHandlers;)
|
||||||
if (handlers[i].deleted)
|
if (handlers[i].deleted) {
|
||||||
{
|
|
||||||
for (j = i; j < numHandlers - 1; j++)
|
for (j = i; j < numHandlers - 1; j++)
|
||||||
handlers[j] = handlers[j + 1];
|
handlers[j] = handlers[j + 1];
|
||||||
numHandlers--;
|
numHandlers--;
|
||||||
|
|
@ -429,13 +422,11 @@ WakeupHandler(int result, pointer pReadmask)
|
||||||
result, pReadmask);
|
result, pReadmask);
|
||||||
for (i = 0; i < screenInfo.numScreens; i++)
|
for (i = 0; i < screenInfo.numScreens; i++)
|
||||||
(*screenInfo.screens[i]->WakeupHandler) (i,
|
(*screenInfo.screens[i]->WakeupHandler) (i,
|
||||||
screenInfo.screens[i]->wakeupData,
|
screenInfo.screens[i]->
|
||||||
result, pReadmask);
|
wakeupData, result, pReadmask);
|
||||||
if (handlerDeleted)
|
if (handlerDeleted) {
|
||||||
{
|
|
||||||
for (i = 0; i < numHandlers;)
|
for (i = 0; i < numHandlers;)
|
||||||
if (handlers[i].deleted)
|
if (handlers[i].deleted) {
|
||||||
{
|
|
||||||
for (j = i; j < numHandlers - 1; j++)
|
for (j = i; j < numHandlers - 1; j++)
|
||||||
handlers[j] = handlers[j + 1];
|
handlers[j] = handlers[j + 1];
|
||||||
numHandlers--;
|
numHandlers--;
|
||||||
|
|
@ -458,8 +449,7 @@ RegisterBlockAndWakeupHandlers (BlockHandlerProcPtr blockHandler,
|
||||||
{
|
{
|
||||||
BlockHandlerPtr new;
|
BlockHandlerPtr new;
|
||||||
|
|
||||||
if (numHandlers >= sizeHandlers)
|
if (numHandlers >= sizeHandlers) {
|
||||||
{
|
|
||||||
new = (BlockHandlerPtr) realloc(handlers, (numHandlers + 1) *
|
new = (BlockHandlerPtr) realloc(handlers, (numHandlers + 1) *
|
||||||
sizeof(BlockHandlerRec));
|
sizeof(BlockHandlerRec));
|
||||||
if (!new)
|
if (!new)
|
||||||
|
|
@ -485,15 +475,12 @@ RemoveBlockAndWakeupHandlers (BlockHandlerProcPtr blockHandler,
|
||||||
for (i = 0; i < numHandlers; i++)
|
for (i = 0; i < numHandlers; i++)
|
||||||
if (handlers[i].BlockHandler == blockHandler &&
|
if (handlers[i].BlockHandler == blockHandler &&
|
||||||
handlers[i].WakeupHandler == wakeupHandler &&
|
handlers[i].WakeupHandler == wakeupHandler &&
|
||||||
handlers[i].blockData == blockData)
|
handlers[i].blockData == blockData) {
|
||||||
{
|
if (inHandler) {
|
||||||
if (inHandler)
|
|
||||||
{
|
|
||||||
handlerDeleted = TRUE;
|
handlerDeleted = TRUE;
|
||||||
handlers[i].deleted = TRUE;
|
handlers[i].deleted = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
for (; i < numHandlers - 1; i++)
|
for (; i < numHandlers - 1; i++)
|
||||||
handlers[i] = handlers[i + 1];
|
handlers[i] = handlers[i + 1];
|
||||||
numHandlers--;
|
numHandlers--;
|
||||||
|
|
@ -531,16 +518,13 @@ ProcessWorkQueue(void)
|
||||||
* they will be called again. This must be reentrant with
|
* they will be called again. This must be reentrant with
|
||||||
* QueueWorkProc.
|
* QueueWorkProc.
|
||||||
*/
|
*/
|
||||||
while ((q = *p))
|
while ((q = *p)) {
|
||||||
{
|
if ((*q->function) (q->client, q->closure)) {
|
||||||
if ((*q->function) (q->client, q->closure))
|
|
||||||
{
|
|
||||||
/* remove q from the list */
|
/* remove q from the list */
|
||||||
*p = q->next; /* don't fetch until after func called */
|
*p = q->next; /* don't fetch until after func called */
|
||||||
free(q);
|
free(q);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
p = &q->next; /* don't fetch until after func called */
|
p = &q->next; /* don't fetch until after func called */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -553,17 +537,14 @@ ProcessWorkQueueZombies(void)
|
||||||
WorkQueuePtr q, *p;
|
WorkQueuePtr q, *p;
|
||||||
|
|
||||||
p = &workQueue;
|
p = &workQueue;
|
||||||
while ((q = *p))
|
while ((q = *p)) {
|
||||||
{
|
if (q->client && q->client->clientGone) {
|
||||||
if (q->client && q->client->clientGone)
|
|
||||||
{
|
|
||||||
(void) (*q->function) (q->client, q->closure);
|
(void) (*q->function) (q->client, q->closure);
|
||||||
/* remove q from the list */
|
/* remove q from the list */
|
||||||
*p = q->next; /* don't fetch until after func called */
|
*p = q->next; /* don't fetch until after func called */
|
||||||
free(q);
|
free(q);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
p = &q->next; /* don't fetch until after func called */
|
p = &q->next; /* don't fetch until after func called */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -571,8 +552,8 @@ ProcessWorkQueueZombies(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
QueueWorkProc (
|
QueueWorkProc(Bool (*function)
|
||||||
Bool (*function)(ClientPtr /* pClient */, pointer /* closure */),
|
(ClientPtr /* pClient */ , pointer /* closure */ ),
|
||||||
ClientPtr client, pointer closure)
|
ClientPtr client, pointer closure)
|
||||||
{
|
{
|
||||||
WorkQueuePtr q;
|
WorkQueuePtr q;
|
||||||
|
|
@ -630,8 +611,7 @@ ClientSignal (ClientPtr client)
|
||||||
SleepQueuePtr q;
|
SleepQueuePtr q;
|
||||||
|
|
||||||
for (q = sleepQueue; q; q = q->next)
|
for (q = sleepQueue; q; q = q->next)
|
||||||
if (q->client == client)
|
if (q->client == client) {
|
||||||
{
|
|
||||||
return QueueWorkProc(q->function, q->client, q->closure);
|
return QueueWorkProc(q->function, q->client, q->closure);
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
@ -643,10 +623,8 @@ ClientWakeup (ClientPtr client)
|
||||||
SleepQueuePtr q, *prev;
|
SleepQueuePtr q, *prev;
|
||||||
|
|
||||||
prev = &sleepQueue;
|
prev = &sleepQueue;
|
||||||
while ( (q = *prev) )
|
while ((q = *prev)) {
|
||||||
{
|
if (q->client == client) {
|
||||||
if (q->client == client)
|
|
||||||
{
|
|
||||||
*prev = q->next;
|
*prev = q->next;
|
||||||
free(q);
|
free(q);
|
||||||
if (client->clientGone)
|
if (client->clientGone)
|
||||||
|
|
@ -684,10 +662,7 @@ static int numCallbackListsToCleanup = 0;
|
||||||
static CallbackListPtr **listsToCleanup = NULL;
|
static CallbackListPtr **listsToCleanup = NULL;
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
_AddCallback(
|
_AddCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, pointer data)
|
||||||
CallbackListPtr *pcbl,
|
|
||||||
CallbackProcPtr callback,
|
|
||||||
pointer data)
|
|
||||||
{
|
{
|
||||||
CallbackPtr cbr;
|
CallbackPtr cbr;
|
||||||
|
|
||||||
|
|
@ -703,30 +678,21 @@ _AddCallback(
|
||||||
}
|
}
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
_DeleteCallback(
|
_DeleteCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, pointer data)
|
||||||
CallbackListPtr *pcbl,
|
|
||||||
CallbackProcPtr callback,
|
|
||||||
pointer data)
|
|
||||||
{
|
{
|
||||||
CallbackListPtr cbl = *pcbl;
|
CallbackListPtr cbl = *pcbl;
|
||||||
CallbackPtr cbr, pcbr;
|
CallbackPtr cbr, pcbr;
|
||||||
|
|
||||||
for (pcbr = NULL, cbr = cbl->list;
|
for (pcbr = NULL, cbr = cbl->list; cbr != NULL; pcbr = cbr, cbr = cbr->next) {
|
||||||
cbr != NULL;
|
|
||||||
pcbr = cbr, cbr = cbr->next)
|
|
||||||
{
|
|
||||||
if ((cbr->proc == callback) && (cbr->data == data))
|
if ((cbr->proc == callback) && (cbr->data == data))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (cbr != NULL)
|
if (cbr != NULL) {
|
||||||
{
|
if (cbl->inCallback) {
|
||||||
if (cbl->inCallback)
|
|
||||||
{
|
|
||||||
++(cbl->numDeleted);
|
++(cbl->numDeleted);
|
||||||
cbr->deleted = TRUE;
|
cbr->deleted = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
if (pcbr == NULL)
|
if (pcbr == NULL)
|
||||||
cbl->list = cbr->next;
|
cbl->list = cbr->next;
|
||||||
else
|
else
|
||||||
|
|
@ -739,26 +705,23 @@ _DeleteCallback(
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_CallCallbacks(
|
_CallCallbacks(CallbackListPtr *pcbl, pointer call_data)
|
||||||
CallbackListPtr *pcbl,
|
|
||||||
pointer call_data)
|
|
||||||
{
|
{
|
||||||
CallbackListPtr cbl = *pcbl;
|
CallbackListPtr cbl = *pcbl;
|
||||||
CallbackPtr cbr, pcbr;
|
CallbackPtr cbr, pcbr;
|
||||||
|
|
||||||
++(cbl->inCallback);
|
++(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);
|
(*(cbr->proc)) (pcbl, cbr->data, call_data);
|
||||||
}
|
}
|
||||||
--(cbl->inCallback);
|
--(cbl->inCallback);
|
||||||
|
|
||||||
if (cbl->inCallback) return;
|
if (cbl->inCallback)
|
||||||
|
return;
|
||||||
|
|
||||||
/* Was the entire list marked for deletion? */
|
/* Was the entire list marked for deletion? */
|
||||||
|
|
||||||
if (cbl->deleted)
|
if (cbl->deleted) {
|
||||||
{
|
|
||||||
DeleteCallbackList(pcbl);
|
DeleteCallbackList(pcbl);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -767,27 +730,23 @@ _CallCallbacks(
|
||||||
* If so, do the deletions.
|
* If so, do the deletions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (cbl->numDeleted)
|
if (cbl->numDeleted) {
|
||||||
{
|
for (pcbr = NULL, cbr = cbl->list; (cbr != NULL) && cbl->numDeleted;) {
|
||||||
for (pcbr = NULL, cbr = cbl->list; (cbr != NULL) && cbl->numDeleted; )
|
if (cbr->deleted) {
|
||||||
{
|
if (pcbr) {
|
||||||
if (cbr->deleted)
|
|
||||||
{
|
|
||||||
if (pcbr)
|
|
||||||
{
|
|
||||||
cbr = cbr->next;
|
cbr = cbr->next;
|
||||||
free(pcbr->next);
|
free(pcbr->next);
|
||||||
pcbr->next = cbr;
|
pcbr->next = cbr;
|
||||||
} else
|
}
|
||||||
{
|
else {
|
||||||
cbr = cbr->next;
|
cbr = cbr->next;
|
||||||
free(cbl->list);
|
free(cbl->list);
|
||||||
cbl->list = cbr;
|
cbl->list = cbr;
|
||||||
}
|
}
|
||||||
cbl->numDeleted--;
|
cbl->numDeleted--;
|
||||||
}
|
}
|
||||||
else /* this one wasn't deleted */
|
else { /* this one wasn't deleted */
|
||||||
{
|
|
||||||
pcbr = cbr;
|
pcbr = cbr;
|
||||||
cbr = cbr->next;
|
cbr = cbr->next;
|
||||||
}
|
}
|
||||||
|
|
@ -796,30 +755,25 @@ _CallCallbacks(
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_DeleteCallbackList(
|
_DeleteCallbackList(CallbackListPtr *pcbl)
|
||||||
CallbackListPtr *pcbl)
|
|
||||||
{
|
{
|
||||||
CallbackListPtr cbl = *pcbl;
|
CallbackListPtr cbl = *pcbl;
|
||||||
CallbackPtr cbr, nextcbr;
|
CallbackPtr cbr, nextcbr;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (cbl->inCallback)
|
if (cbl->inCallback) {
|
||||||
{
|
|
||||||
cbl->deleted = TRUE;
|
cbl->deleted = TRUE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < numCallbackListsToCleanup; i++)
|
for (i = 0; i < numCallbackListsToCleanup; i++) {
|
||||||
{
|
if (listsToCleanup[i] == pcbl) {
|
||||||
if (listsToCleanup[i] == pcbl)
|
|
||||||
{
|
|
||||||
listsToCleanup[i] = NULL;
|
listsToCleanup[i] = NULL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (cbr = cbl->list; cbr != NULL; cbr = nextcbr)
|
for (cbr = cbl->list; cbr != NULL; cbr = nextcbr) {
|
||||||
{
|
|
||||||
nextcbr = cbr->next;
|
nextcbr = cbr->next;
|
||||||
free(cbr);
|
free(cbr);
|
||||||
}
|
}
|
||||||
|
|
@ -833,26 +787,28 @@ CreateCallbackList(CallbackListPtr *pcbl)
|
||||||
CallbackListPtr cbl;
|
CallbackListPtr cbl;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!pcbl) return FALSE;
|
if (!pcbl)
|
||||||
|
return FALSE;
|
||||||
cbl = malloc(sizeof(CallbackListRec));
|
cbl = malloc(sizeof(CallbackListRec));
|
||||||
if (!cbl) return FALSE;
|
if (!cbl)
|
||||||
|
return FALSE;
|
||||||
cbl->inCallback = 0;
|
cbl->inCallback = 0;
|
||||||
cbl->deleted = FALSE;
|
cbl->deleted = FALSE;
|
||||||
cbl->numDeleted = 0;
|
cbl->numDeleted = 0;
|
||||||
cbl->list = NULL;
|
cbl->list = NULL;
|
||||||
*pcbl = cbl;
|
*pcbl = cbl;
|
||||||
|
|
||||||
for (i = 0; i < numCallbackListsToCleanup; i++)
|
for (i = 0; i < numCallbackListsToCleanup; i++) {
|
||||||
{
|
if (!listsToCleanup[i]) {
|
||||||
if (!listsToCleanup[i])
|
|
||||||
{
|
|
||||||
listsToCleanup[i] = pcbl;
|
listsToCleanup[i] = pcbl;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
listsToCleanup = (CallbackListPtr **) xnfrealloc(listsToCleanup,
|
listsToCleanup = (CallbackListPtr **) xnfrealloc(listsToCleanup,
|
||||||
sizeof(CallbackListPtr *) * (numCallbackListsToCleanup+1));
|
sizeof(CallbackListPtr *) *
|
||||||
|
(numCallbackListsToCleanup
|
||||||
|
+ 1));
|
||||||
listsToCleanup[numCallbackListsToCleanup] = pcbl;
|
listsToCleanup[numCallbackListsToCleanup] = pcbl;
|
||||||
numCallbackListsToCleanup++;
|
numCallbackListsToCleanup++;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
@ -863,9 +819,9 @@ CreateCallbackList(CallbackListPtr *pcbl)
|
||||||
Bool
|
Bool
|
||||||
AddCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, pointer data)
|
AddCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, pointer data)
|
||||||
{
|
{
|
||||||
if (!pcbl) return FALSE;
|
if (!pcbl)
|
||||||
if (!*pcbl)
|
return FALSE;
|
||||||
{ /* list hasn't been created yet; go create it */
|
if (!*pcbl) { /* list hasn't been created yet; go create it */
|
||||||
if (!CreateCallbackList(pcbl))
|
if (!CreateCallbackList(pcbl))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
@ -875,14 +831,16 @@ AddCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, pointer data)
|
||||||
Bool
|
Bool
|
||||||
DeleteCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, pointer data)
|
DeleteCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, pointer data)
|
||||||
{
|
{
|
||||||
if (!pcbl || !*pcbl) return FALSE;
|
if (!pcbl || !*pcbl)
|
||||||
|
return FALSE;
|
||||||
return _DeleteCallback(pcbl, callback, data);
|
return _DeleteCallback(pcbl, callback, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
DeleteCallbackList(CallbackListPtr *pcbl)
|
DeleteCallbackList(CallbackListPtr *pcbl)
|
||||||
{
|
{
|
||||||
if (!pcbl || !*pcbl) return;
|
if (!pcbl || !*pcbl)
|
||||||
|
return;
|
||||||
_DeleteCallbackList(pcbl);
|
_DeleteCallbackList(pcbl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -891,8 +849,7 @@ InitCallbackManager(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < numCallbackListsToCleanup; i++)
|
for (i = 0; i < numCallbackListsToCleanup; i++) {
|
||||||
{
|
|
||||||
DeleteCallbackList(listsToCleanup[i]);
|
DeleteCallbackList(listsToCleanup[i]);
|
||||||
}
|
}
|
||||||
free(listsToCleanup);
|
free(listsToCleanup);
|
||||||
|
|
|
||||||
433
dix/enterleave.c
433
dix/enterleave.c
|
|
@ -106,6 +106,7 @@ static BOOL
|
||||||
HasFocus(WindowPtr win)
|
HasFocus(WindowPtr win)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < MAXDEVICES; i++)
|
for (i = 0; i < MAXDEVICES; i++)
|
||||||
if (FocusWindows[i] == win)
|
if (FocusWindows[i] == win)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
@ -133,8 +134,8 @@ static WindowPtr
|
||||||
FirstPointerChild(WindowPtr win)
|
FirstPointerChild(WindowPtr win)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < MAXDEVICES; i++)
|
|
||||||
{
|
for (i = 0; i < MAXDEVICES; i++) {
|
||||||
if (PointerWindows[i] && IsParent(win, PointerWindows[i]))
|
if (PointerWindows[i] && IsParent(win, PointerWindows[i]))
|
||||||
return PointerWindows[i];
|
return PointerWindows[i];
|
||||||
}
|
}
|
||||||
|
|
@ -153,8 +154,8 @@ static WindowPtr
|
||||||
FirstFocusChild(WindowPtr win)
|
FirstFocusChild(WindowPtr win)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < MAXDEVICES; i++)
|
|
||||||
{
|
for (i = 0; i < MAXDEVICES; i++) {
|
||||||
if (FocusWindows[i] && FocusWindows[i] != PointerRootWin &&
|
if (FocusWindows[i] && FocusWindows[i] != PointerRootWin &&
|
||||||
IsParent(win, FocusWindows[i]))
|
IsParent(win, FocusWindows[i]))
|
||||||
return FocusWindows[i];
|
return FocusWindows[i];
|
||||||
|
|
@ -199,9 +200,6 @@ SetFocusOut(DeviceIntPtr dev)
|
||||||
FocusWindows[dev->id] = NULL;
|
FocusWindows[dev->id] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the common ancestor of 'a' and 'b' (if one exists).
|
* Return the common ancestor of 'a' and 'b' (if one exists).
|
||||||
* @param a A window with the same ancestor as b.
|
* @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.
|
* NullWindow if they do not have a common ancestor.
|
||||||
*/
|
*/
|
||||||
WindowPtr
|
WindowPtr
|
||||||
CommonAncestor(
|
CommonAncestor(WindowPtr a, WindowPtr b)
|
||||||
WindowPtr a,
|
|
||||||
WindowPtr b)
|
|
||||||
{
|
{
|
||||||
for (b = b->parent; b; b = b->parent)
|
for (b = b->parent; b; b = b->parent)
|
||||||
if (IsParent(b, a)) return b;
|
if (IsParent(b, a))
|
||||||
|
return b;
|
||||||
return NullWindow;
|
return NullWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send enter notifies to all windows between 'ancestor' and 'child' (excluding
|
* Send enter notifies to all windows between 'ancestor' and 'child' (excluding
|
||||||
* both). Events are sent running up the window hierarchy. This function
|
* both). Events are sent running up the window hierarchy. This function
|
||||||
|
|
@ -228,10 +224,7 @@ CommonAncestor(
|
||||||
static void
|
static void
|
||||||
DeviceEnterNotifies(DeviceIntPtr dev,
|
DeviceEnterNotifies(DeviceIntPtr dev,
|
||||||
int sourceid,
|
int sourceid,
|
||||||
WindowPtr ancestor,
|
WindowPtr ancestor, WindowPtr child, int mode, int detail)
|
||||||
WindowPtr child,
|
|
||||||
int mode,
|
|
||||||
int detail)
|
|
||||||
{
|
{
|
||||||
WindowPtr parent = child->parent;
|
WindowPtr parent = child->parent;
|
||||||
|
|
||||||
|
|
@ -249,17 +242,14 @@ DeviceEnterNotifies(DeviceIntPtr dev,
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
CoreEnterNotifies(DeviceIntPtr dev,
|
CoreEnterNotifies(DeviceIntPtr dev,
|
||||||
WindowPtr ancestor,
|
WindowPtr ancestor, WindowPtr child, int mode, int detail)
|
||||||
WindowPtr child,
|
|
||||||
int mode,
|
|
||||||
int detail)
|
|
||||||
{
|
{
|
||||||
WindowPtr parent = child->parent;
|
WindowPtr parent = child->parent;
|
||||||
|
|
||||||
if (ancestor == parent)
|
if (ancestor == parent)
|
||||||
return;
|
return;
|
||||||
CoreEnterNotifies(dev, ancestor, parent, mode, detail);
|
CoreEnterNotifies(dev, ancestor, parent, mode, detail);
|
||||||
|
|
||||||
|
|
||||||
/* Case 3:
|
/* Case 3:
|
||||||
A is above W, B is a descendant
|
A is above W, B is a descendant
|
||||||
|
|
||||||
|
|
@ -286,18 +276,14 @@ CoreEnterNotifies(DeviceIntPtr dev,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
CoreLeaveNotifies(DeviceIntPtr dev,
|
CoreLeaveNotifies(DeviceIntPtr dev,
|
||||||
WindowPtr child,
|
WindowPtr child, WindowPtr ancestor, int mode, int detail)
|
||||||
WindowPtr ancestor,
|
|
||||||
int mode,
|
|
||||||
int detail)
|
|
||||||
{
|
{
|
||||||
WindowPtr win;
|
WindowPtr win;
|
||||||
|
|
||||||
if (ancestor == child)
|
if (ancestor == child)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (win = child->parent; win != ancestor; win = win->parent)
|
for (win = child->parent; win != ancestor; win = win->parent) {
|
||||||
{
|
|
||||||
/*Case 7:
|
/*Case 7:
|
||||||
A is a descendant of W, B is above W
|
A is a descendant of W, B is above W
|
||||||
|
|
||||||
|
|
@ -321,7 +307,8 @@ CoreLeaveNotifies(DeviceIntPtr dev,
|
||||||
if (HasPointer(dev, win) || FirstPointerChild(win))
|
if (HasPointer(dev, win) || FirstPointerChild(win))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CoreEnterLeaveEvent(dev, LeaveNotify, mode, detail, win, child->drawable.id);
|
CoreEnterLeaveEvent(dev, LeaveNotify, mode, detail, win,
|
||||||
|
child->drawable.id);
|
||||||
|
|
||||||
child = win;
|
child = win;
|
||||||
}
|
}
|
||||||
|
|
@ -334,17 +321,13 @@ CoreLeaveNotifies(DeviceIntPtr dev,
|
||||||
static void
|
static void
|
||||||
DeviceLeaveNotifies(DeviceIntPtr dev,
|
DeviceLeaveNotifies(DeviceIntPtr dev,
|
||||||
int sourceid,
|
int sourceid,
|
||||||
WindowPtr child,
|
WindowPtr child, WindowPtr ancestor, int mode, int detail)
|
||||||
WindowPtr ancestor,
|
|
||||||
int mode,
|
|
||||||
int detail)
|
|
||||||
{
|
{
|
||||||
WindowPtr win;
|
WindowPtr win;
|
||||||
|
|
||||||
if (ancestor == child)
|
if (ancestor == child)
|
||||||
return;
|
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,
|
DeviceEnterLeaveEvent(dev, sourceid, XI_Leave, mode, detail, win,
|
||||||
child->drawable.id);
|
child->drawable.id);
|
||||||
child = win;
|
child = win;
|
||||||
|
|
@ -356,12 +339,10 @@ DeviceLeaveNotifies(DeviceIntPtr dev,
|
||||||
* B a descendant of A.
|
* B a descendant of A.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
CoreEnterLeaveNonLinear(DeviceIntPtr dev,
|
CoreEnterLeaveNonLinear(DeviceIntPtr dev, WindowPtr A, WindowPtr B, int mode)
|
||||||
WindowPtr A,
|
|
||||||
WindowPtr B,
|
|
||||||
int mode)
|
|
||||||
{
|
{
|
||||||
WindowPtr X = CommonAncestor(A, B);
|
WindowPtr X = CommonAncestor(A, B);
|
||||||
|
|
||||||
/* Case 4:
|
/* Case 4:
|
||||||
A is W, B is above W
|
A is W, B is above W
|
||||||
|
|
||||||
|
|
@ -382,15 +363,16 @@ CoreEnterLeaveNonLinear(DeviceIntPtr dev,
|
||||||
vice versa depending on the the new P(W)
|
vice versa depending on the the new P(W)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!HasPointer(dev, A))
|
if (!HasPointer(dev, A)) {
|
||||||
{
|
|
||||||
WindowPtr child = FirstPointerChild(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);
|
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
|
MPX: The pointer window stays the same or moves to a different
|
||||||
descendant of W. No events should be generated on W.
|
descendant of W. No events should be generated on W.
|
||||||
|
|
||||||
|
|
||||||
Therefore, no event to X.
|
Therefore, no event to X.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -426,13 +407,15 @@ CoreEnterLeaveNonLinear(DeviceIntPtr dev,
|
||||||
The detail may need to be changed from Ancestor to Nonlinear
|
The detail may need to be changed from Ancestor to Nonlinear
|
||||||
or vice-versa depending on the previous P(W). */
|
or vice-versa depending on the previous P(W). */
|
||||||
|
|
||||||
if (!HasPointer(dev, B))
|
if (!HasPointer(dev, B)) {
|
||||||
{
|
|
||||||
WindowPtr child = FirstPointerChild(B);
|
WindowPtr child = FirstPointerChild(B);
|
||||||
|
|
||||||
if (child)
|
if (child)
|
||||||
CoreEnterLeaveEvent(dev, EnterNotify, mode, NotifyInferior, B, None);
|
CoreEnterLeaveEvent(dev, EnterNotify, mode, NotifyInferior, B,
|
||||||
|
None);
|
||||||
else
|
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.
|
* Pointer dev moves from A to B and A is a descendant of B.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
CoreEnterLeaveToAncestor(DeviceIntPtr dev,
|
CoreEnterLeaveToAncestor(DeviceIntPtr dev, WindowPtr A, WindowPtr B, int mode)
|
||||||
WindowPtr A,
|
|
||||||
WindowPtr B,
|
|
||||||
int mode)
|
|
||||||
{
|
{
|
||||||
/* Case 4:
|
/* Case 4:
|
||||||
A is W, B is above W
|
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
|
The detail may need to be changed from Ancestor to Nonlinear or
|
||||||
vice versa depending on the the new P(W)
|
vice versa depending on the the new P(W)
|
||||||
*/
|
*/
|
||||||
if (!HasPointer(dev, A))
|
if (!HasPointer(dev, A)) {
|
||||||
{
|
|
||||||
WindowPtr child = FirstPointerChild(A);
|
WindowPtr child = FirstPointerChild(A);
|
||||||
|
|
||||||
if (child)
|
if (child)
|
||||||
CoreEnterLeaveEvent(dev, LeaveNotify, mode, NotifyInferior, A, None);
|
CoreEnterLeaveEvent(dev, LeaveNotify, mode, NotifyInferior, A,
|
||||||
|
None);
|
||||||
else
|
else
|
||||||
CoreEnterLeaveEvent(dev, LeaveNotify, mode, NotifyAncestor, A, None);
|
CoreEnterLeaveEvent(dev, LeaveNotify, mode, NotifyAncestor, A,
|
||||||
|
None);
|
||||||
}
|
}
|
||||||
|
|
||||||
CoreLeaveNotifies(dev, A, B, mode, NotifyVirtual);
|
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.
|
* Pointer dev moves from A to B and B is a descendant of A.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
CoreEnterLeaveToDescendant(DeviceIntPtr dev,
|
CoreEnterLeaveToDescendant(DeviceIntPtr dev, WindowPtr A, WindowPtr B, int mode)
|
||||||
WindowPtr A,
|
|
||||||
WindowPtr B,
|
|
||||||
int mode)
|
|
||||||
{
|
{
|
||||||
/* Case 6:
|
/* Case 6:
|
||||||
A is W, B is a descendant of W
|
A is W, B is a descendant of W
|
||||||
|
|
@ -519,7 +497,6 @@ CoreEnterLeaveToDescendant(DeviceIntPtr dev,
|
||||||
if (!HasPointer(dev, A))
|
if (!HasPointer(dev, A))
|
||||||
CoreEnterLeaveEvent(dev, LeaveNotify, mode, NotifyInferior, A, None);
|
CoreEnterLeaveEvent(dev, LeaveNotify, mode, NotifyInferior, A, None);
|
||||||
|
|
||||||
|
|
||||||
CoreEnterNotifies(dev, A, B, mode, NotifyVirtual);
|
CoreEnterNotifies(dev, A, B, mode, NotifyVirtual);
|
||||||
|
|
||||||
/* Case 2:
|
/* Case 2:
|
||||||
|
|
@ -540,21 +517,20 @@ CoreEnterLeaveToDescendant(DeviceIntPtr dev,
|
||||||
The detail may need to be changed from Ancestor to Nonlinear
|
The detail may need to be changed from Ancestor to Nonlinear
|
||||||
or vice-versa depending on the previous P(W). */
|
or vice-versa depending on the previous P(W). */
|
||||||
|
|
||||||
if (!HasPointer(dev, B))
|
if (!HasPointer(dev, B)) {
|
||||||
{
|
|
||||||
WindowPtr child = FirstPointerChild(B);
|
WindowPtr child = FirstPointerChild(B);
|
||||||
|
|
||||||
if (child)
|
if (child)
|
||||||
CoreEnterLeaveEvent(dev, EnterNotify, mode, NotifyInferior, B, None);
|
CoreEnterLeaveEvent(dev, EnterNotify, mode, NotifyInferior, B,
|
||||||
|
None);
|
||||||
else
|
else
|
||||||
CoreEnterLeaveEvent(dev, EnterNotify, mode, NotifyAncestor, B, None);
|
CoreEnterLeaveEvent(dev, EnterNotify, mode, NotifyAncestor, B,
|
||||||
|
None);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
CoreEnterLeaveEvents(DeviceIntPtr dev,
|
CoreEnterLeaveEvents(DeviceIntPtr dev, WindowPtr from, WindowPtr to, int mode)
|
||||||
WindowPtr from,
|
|
||||||
WindowPtr to,
|
|
||||||
int mode)
|
|
||||||
{
|
{
|
||||||
if (!IsMaster(dev))
|
if (!IsMaster(dev))
|
||||||
return;
|
return;
|
||||||
|
|
@ -573,31 +549,34 @@ CoreEnterLeaveEvents(DeviceIntPtr dev,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
DeviceEnterLeaveEvents(DeviceIntPtr dev,
|
DeviceEnterLeaveEvents(DeviceIntPtr dev,
|
||||||
int sourceid,
|
int sourceid, WindowPtr from, WindowPtr to, int mode)
|
||||||
WindowPtr from,
|
|
||||||
WindowPtr to,
|
|
||||||
int mode)
|
|
||||||
{
|
{
|
||||||
if (IsParent(from, to))
|
if (IsParent(from, to)) {
|
||||||
{
|
DeviceEnterLeaveEvent(dev, sourceid, XI_Leave, mode, NotifyInferior,
|
||||||
DeviceEnterLeaveEvent(dev, sourceid, XI_Leave, mode, NotifyInferior, from, None);
|
from, None);
|
||||||
DeviceEnterNotifies(dev, sourceid, from, to, mode, NotifyVirtual);
|
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))
|
else if (IsParent(to, from)) {
|
||||||
{
|
DeviceEnterLeaveEvent(dev, sourceid, XI_Leave, mode, NotifyAncestor,
|
||||||
DeviceEnterLeaveEvent(dev, sourceid, XI_Leave, mode, NotifyAncestor, from, None);
|
from, None);
|
||||||
DeviceLeaveNotifies(dev, sourceid, from, to, mode, NotifyVirtual);
|
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
|
else { /* neither from nor to is descendent of the other */
|
||||||
{ /* neither from nor to is descendent of the other */
|
|
||||||
WindowPtr common = CommonAncestor(to, from);
|
WindowPtr common = CommonAncestor(to, from);
|
||||||
|
|
||||||
/* common == NullWindow ==> different screens */
|
/* common == NullWindow ==> different screens */
|
||||||
DeviceEnterLeaveEvent(dev, sourceid, XI_Leave, mode, NotifyNonlinear, from, None);
|
DeviceEnterLeaveEvent(dev, sourceid, XI_Leave, mode, NotifyNonlinear,
|
||||||
DeviceLeaveNotifies(dev, sourceid, from, common, mode, NotifyNonlinearVirtual);
|
from, None);
|
||||||
DeviceEnterNotifies(dev, sourceid, common, to, mode, NotifyNonlinearVirtual);
|
DeviceLeaveNotifies(dev, sourceid, from, common, mode,
|
||||||
DeviceEnterLeaveEvent(dev, sourceid, XI_Enter, mode, NotifyNonlinear, to, None);
|
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
|
void
|
||||||
DoEnterLeaveEvents(DeviceIntPtr pDev,
|
DoEnterLeaveEvents(DeviceIntPtr pDev,
|
||||||
int sourceid,
|
int sourceid, WindowPtr fromWin, WindowPtr toWin, int mode)
|
||||||
WindowPtr fromWin,
|
|
||||||
WindowPtr toWin,
|
|
||||||
int mode)
|
|
||||||
{
|
{
|
||||||
if (!IsPointerDevice(pDev))
|
if (!IsPointerDevice(pDev))
|
||||||
return;
|
return;
|
||||||
|
|
@ -632,10 +608,7 @@ DoEnterLeaveEvents(DeviceIntPtr pDev,
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
DeviceFocusOutEvents(DeviceIntPtr dev,
|
DeviceFocusOutEvents(DeviceIntPtr dev,
|
||||||
WindowPtr child,
|
WindowPtr child, WindowPtr ancestor, int mode, int detail)
|
||||||
WindowPtr ancestor,
|
|
||||||
int mode,
|
|
||||||
int detail)
|
|
||||||
{
|
{
|
||||||
WindowPtr win;
|
WindowPtr win;
|
||||||
|
|
||||||
|
|
@ -645,7 +618,6 @@ DeviceFocusOutEvents(DeviceIntPtr dev,
|
||||||
DeviceFocusEvent(dev, XI_FocusOut, mode, detail, win);
|
DeviceFocusEvent(dev, XI_FocusOut, mode, detail, win);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send enter notifies to all windows between 'ancestor' and 'child' (excluding
|
* Send enter notifies to all windows between 'ancestor' and 'child' (excluding
|
||||||
* both). Events are sent running up the window hierarchy. This function
|
* both). Events are sent running up the window hierarchy. This function
|
||||||
|
|
@ -653,10 +625,7 @@ DeviceFocusOutEvents(DeviceIntPtr dev,
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
DeviceFocusInEvents(DeviceIntPtr dev,
|
DeviceFocusInEvents(DeviceIntPtr dev,
|
||||||
WindowPtr ancestor,
|
WindowPtr ancestor, WindowPtr child, int mode, int detail)
|
||||||
WindowPtr child,
|
|
||||||
int mode,
|
|
||||||
int detail)
|
|
||||||
{
|
{
|
||||||
WindowPtr parent = child->parent;
|
WindowPtr parent = child->parent;
|
||||||
|
|
||||||
|
|
@ -673,17 +642,14 @@ DeviceFocusInEvents(DeviceIntPtr dev,
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
CoreFocusInEvents(DeviceIntPtr dev,
|
CoreFocusInEvents(DeviceIntPtr dev,
|
||||||
WindowPtr ancestor,
|
WindowPtr ancestor, WindowPtr child, int mode, int detail)
|
||||||
WindowPtr child,
|
|
||||||
int mode,
|
|
||||||
int detail)
|
|
||||||
{
|
{
|
||||||
WindowPtr parent = child->parent;
|
WindowPtr parent = child->parent;
|
||||||
|
|
||||||
if (ancestor == parent)
|
if (ancestor == parent)
|
||||||
return;
|
return;
|
||||||
CoreFocusInEvents(dev, ancestor, parent, mode, detail);
|
CoreFocusInEvents(dev, ancestor, parent, mode, detail);
|
||||||
|
|
||||||
|
|
||||||
/* Case 3:
|
/* Case 3:
|
||||||
A is above W, B is a descendant
|
A is above W, B is a descendant
|
||||||
|
|
||||||
|
|
@ -708,18 +674,14 @@ CoreFocusInEvents(DeviceIntPtr dev,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
CoreFocusOutEvents(DeviceIntPtr dev,
|
CoreFocusOutEvents(DeviceIntPtr dev,
|
||||||
WindowPtr child,
|
WindowPtr child, WindowPtr ancestor, int mode, int detail)
|
||||||
WindowPtr ancestor,
|
|
||||||
int mode,
|
|
||||||
int detail)
|
|
||||||
{
|
{
|
||||||
WindowPtr win;
|
WindowPtr win;
|
||||||
|
|
||||||
if (ancestor == child)
|
if (ancestor == child)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (win = child->parent; win != ancestor; win = win->parent)
|
for (win = child->parent; win != ancestor; win = win->parent) {
|
||||||
{
|
|
||||||
/*Case 7:
|
/*Case 7:
|
||||||
A is a descendant of W, B is above W
|
A is a descendant of W, B is above W
|
||||||
|
|
||||||
|
|
@ -760,9 +722,7 @@ CoreFocusOutEvents(DeviceIntPtr dev,
|
||||||
static void
|
static void
|
||||||
CoreFocusOutNotifyPointerEvents(DeviceIntPtr dev,
|
CoreFocusOutNotifyPointerEvents(DeviceIntPtr dev,
|
||||||
WindowPtr pwin_parent,
|
WindowPtr pwin_parent,
|
||||||
WindowPtr exclude,
|
WindowPtr exclude, int mode, int inclusive)
|
||||||
int mode,
|
|
||||||
int inclusive)
|
|
||||||
{
|
{
|
||||||
WindowPtr P, stopAt;
|
WindowPtr P, stopAt;
|
||||||
|
|
||||||
|
|
@ -790,10 +750,7 @@ CoreFocusOutNotifyPointerEvents(DeviceIntPtr dev,
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
CoreFocusInRecurse(DeviceIntPtr dev,
|
CoreFocusInRecurse(DeviceIntPtr dev,
|
||||||
WindowPtr win,
|
WindowPtr win, WindowPtr stopAt, int mode, int inclusive)
|
||||||
WindowPtr stopAt,
|
|
||||||
int mode,
|
|
||||||
int inclusive)
|
|
||||||
{
|
{
|
||||||
if ((!inclusive && win == stopAt) || !win)
|
if ((!inclusive && win == stopAt) || !win)
|
||||||
return;
|
return;
|
||||||
|
|
@ -802,7 +759,6 @@ CoreFocusInRecurse(DeviceIntPtr dev,
|
||||||
CoreFocusEvent(dev, FocusIn, mode, NotifyPointer, win);
|
CoreFocusEvent(dev, FocusIn, mode, NotifyPointer, win);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send FocusIn(NotifyPointer) events from pwin_parent down to
|
* Send FocusIn(NotifyPointer) events from pwin_parent down to
|
||||||
* including the current pointer window (which is a descendant of pwin_parent).
|
* including the current pointer window (which is a descendant of pwin_parent).
|
||||||
|
|
@ -815,9 +771,7 @@ CoreFocusInRecurse(DeviceIntPtr dev,
|
||||||
static void
|
static void
|
||||||
CoreFocusInNotifyPointerEvents(DeviceIntPtr dev,
|
CoreFocusInNotifyPointerEvents(DeviceIntPtr dev,
|
||||||
WindowPtr pwin_parent,
|
WindowPtr pwin_parent,
|
||||||
WindowPtr exclude,
|
WindowPtr exclude, int mode, int inclusive)
|
||||||
int mode,
|
|
||||||
int inclusive)
|
|
||||||
{
|
{
|
||||||
WindowPtr P;
|
WindowPtr P;
|
||||||
|
|
||||||
|
|
@ -832,16 +786,12 @@ CoreFocusInNotifyPointerEvents(DeviceIntPtr dev,
|
||||||
CoreFocusInRecurse(dev, P, pwin_parent, mode, inclusive);
|
CoreFocusInRecurse(dev, P, pwin_parent, mode, inclusive);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Focus of dev moves from A to B and A neither a descendant of B nor is
|
* Focus of dev moves from A to B and A neither a descendant of B nor is
|
||||||
* B a descendant of A.
|
* B a descendant of A.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
CoreFocusNonLinear(DeviceIntPtr dev,
|
CoreFocusNonLinear(DeviceIntPtr dev, WindowPtr A, WindowPtr B, int mode)
|
||||||
WindowPtr A,
|
|
||||||
WindowPtr B,
|
|
||||||
int mode)
|
|
||||||
{
|
{
|
||||||
WindowPtr X = CommonAncestor(A, B);
|
WindowPtr X = CommonAncestor(A, B);
|
||||||
|
|
||||||
|
|
@ -864,23 +814,21 @@ CoreFocusNonLinear(DeviceIntPtr dev,
|
||||||
vice versa depending on the the new F(W)
|
vice versa depending on the the new F(W)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!HasFocus(A))
|
if (!HasFocus(A)) {
|
||||||
{
|
|
||||||
WindowPtr child = FirstFocusChild(A);
|
WindowPtr child = FirstFocusChild(A);
|
||||||
if (child)
|
|
||||||
{
|
if (child) {
|
||||||
/* NotifyPointer P-A unless P is child or below */
|
/* NotifyPointer P-A unless P is child or below */
|
||||||
CoreFocusOutNotifyPointerEvents(dev, A, child, mode, FALSE);
|
CoreFocusOutNotifyPointerEvents(dev, A, child, mode, FALSE);
|
||||||
CoreFocusEvent(dev, FocusOut, mode, NotifyInferior, A);
|
CoreFocusEvent(dev, FocusOut, mode, NotifyInferior, A);
|
||||||
} else
|
}
|
||||||
{
|
else {
|
||||||
/* NotifyPointer P-A */
|
/* NotifyPointer P-A */
|
||||||
CoreFocusOutNotifyPointerEvents(dev, A, None, mode, FALSE);
|
CoreFocusOutNotifyPointerEvents(dev, A, None, mode, FALSE);
|
||||||
CoreFocusEvent(dev, FocusOut, mode, NotifyNonlinear, A);
|
CoreFocusEvent(dev, FocusOut, mode, NotifyNonlinear, A);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CoreFocusOutEvents(dev, A, X, mode, NotifyNonlinearVirtual);
|
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
|
MPX: The focus window stays the same or moves to a different
|
||||||
descendant of W. No events should be generated on W.
|
descendant of W. No events should be generated on W.
|
||||||
|
|
||||||
|
|
||||||
Therefore, no event to X.
|
Therefore, no event to X.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -914,15 +861,15 @@ CoreFocusNonLinear(DeviceIntPtr dev,
|
||||||
The detail may need to be changed from Ancestor to Nonlinear
|
The detail may need to be changed from Ancestor to Nonlinear
|
||||||
or vice-versa depending on the previous F(W). */
|
or vice-versa depending on the previous F(W). */
|
||||||
|
|
||||||
if (!HasFocus(B))
|
if (!HasFocus(B)) {
|
||||||
{
|
|
||||||
WindowPtr child = FirstFocusChild(B);
|
WindowPtr child = FirstFocusChild(B);
|
||||||
if (child)
|
|
||||||
{
|
if (child) {
|
||||||
CoreFocusEvent(dev, FocusIn, mode, NotifyInferior, B);
|
CoreFocusEvent(dev, FocusIn, mode, NotifyInferior, B);
|
||||||
/* NotifyPointer B-P unless P is child or below. */
|
/* NotifyPointer B-P unless P is child or below. */
|
||||||
CoreFocusInNotifyPointerEvents(dev, B, child, mode, FALSE);
|
CoreFocusInNotifyPointerEvents(dev, B, child, mode, FALSE);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
CoreFocusEvent(dev, FocusIn, mode, NotifyNonlinear, B);
|
CoreFocusEvent(dev, FocusIn, mode, NotifyNonlinear, B);
|
||||||
/* NotifyPointer B-P unless P is child or below. */
|
/* NotifyPointer B-P unless P is child or below. */
|
||||||
CoreFocusInNotifyPointerEvents(dev, B, None, mode, FALSE);
|
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.
|
* Focus of dev moves from A to B and A is a descendant of B.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
CoreFocusToAncestor(DeviceIntPtr dev,
|
CoreFocusToAncestor(DeviceIntPtr dev, WindowPtr A, WindowPtr B, int mode)
|
||||||
WindowPtr A,
|
|
||||||
WindowPtr B,
|
|
||||||
int mode)
|
|
||||||
{
|
{
|
||||||
/* Case 4:
|
/* Case 4:
|
||||||
A is W, B is above W
|
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
|
The detail may need to be changed from Ancestor to Nonlinear or
|
||||||
vice versa depending on the the new F(W)
|
vice versa depending on the the new F(W)
|
||||||
*/
|
*/
|
||||||
if (!HasFocus(A))
|
if (!HasFocus(A)) {
|
||||||
{
|
|
||||||
WindowPtr child = FirstFocusChild(A);
|
WindowPtr child = FirstFocusChild(A);
|
||||||
if (child)
|
|
||||||
{
|
if (child) {
|
||||||
/* NotifyPointer P-A unless P is child or below */
|
/* NotifyPointer P-A unless P is child or below */
|
||||||
CoreFocusOutNotifyPointerEvents(dev, A, child, mode, FALSE);
|
CoreFocusOutNotifyPointerEvents(dev, A, child, mode, FALSE);
|
||||||
CoreFocusEvent(dev, FocusOut, mode, NotifyInferior, A);
|
CoreFocusEvent(dev, FocusOut, mode, NotifyInferior, A);
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
CoreFocusEvent(dev, FocusOut, mode, NotifyAncestor, A);
|
CoreFocusEvent(dev, FocusOut, mode, NotifyAncestor, A);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -984,8 +927,7 @@ CoreFocusToAncestor(DeviceIntPtr dev,
|
||||||
Case 3B: Otherwise:
|
Case 3B: Otherwise:
|
||||||
F(W) changes from a descendant to W itself. */
|
F(W) changes from a descendant to W itself. */
|
||||||
|
|
||||||
if (!HasFocus(B))
|
if (!HasFocus(B)) {
|
||||||
{
|
|
||||||
CoreFocusEvent(dev, FocusIn, mode, NotifyInferior, B);
|
CoreFocusEvent(dev, FocusIn, mode, NotifyInferior, B);
|
||||||
/* NotifyPointer B-P unless P is A or below. */
|
/* NotifyPointer B-P unless P is A or below. */
|
||||||
CoreFocusInNotifyPointerEvents(dev, B, A, mode, FALSE);
|
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.
|
* Focus of dev moves from A to B and B is a descendant of A.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
CoreFocusToDescendant(DeviceIntPtr dev,
|
CoreFocusToDescendant(DeviceIntPtr dev, WindowPtr A, WindowPtr B, int mode)
|
||||||
WindowPtr A,
|
|
||||||
WindowPtr B,
|
|
||||||
int mode)
|
|
||||||
{
|
{
|
||||||
/* Case 6:
|
/* Case 6:
|
||||||
A is W, B is a descendant of W
|
A is W, B is a descendant of W
|
||||||
|
|
@ -1013,14 +952,12 @@ CoreFocusToDescendant(DeviceIntPtr dev,
|
||||||
Case 3B: Otherwise:
|
Case 3B: Otherwise:
|
||||||
F(W) changes from W to a descendant of W. */
|
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 */
|
/* NotifyPointer P-A unless P is B or below */
|
||||||
CoreFocusOutNotifyPointerEvents(dev, A, B, mode, FALSE);
|
CoreFocusOutNotifyPointerEvents(dev, A, B, mode, FALSE);
|
||||||
CoreFocusEvent(dev, FocusOut, mode, NotifyInferior, A);
|
CoreFocusEvent(dev, FocusOut, mode, NotifyInferior, A);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CoreFocusInEvents(dev, A, B, mode, NotifyVirtual);
|
CoreFocusInEvents(dev, A, B, mode, NotifyVirtual);
|
||||||
|
|
||||||
/* Case 2:
|
/* Case 2:
|
||||||
|
|
@ -1040,15 +977,15 @@ CoreFocusToDescendant(DeviceIntPtr dev,
|
||||||
The detail may need to be changed from Ancestor to Nonlinear
|
The detail may need to be changed from Ancestor to Nonlinear
|
||||||
or vice-versa depending on the previous F(W). */
|
or vice-versa depending on the previous F(W). */
|
||||||
|
|
||||||
if (!HasFocus(B))
|
if (!HasFocus(B)) {
|
||||||
{
|
|
||||||
WindowPtr child = FirstFocusChild(B);
|
WindowPtr child = FirstFocusChild(B);
|
||||||
if (child)
|
|
||||||
{
|
if (child) {
|
||||||
CoreFocusEvent(dev, FocusIn, mode, NotifyInferior, B);
|
CoreFocusEvent(dev, FocusIn, mode, NotifyInferior, B);
|
||||||
/* NotifyPointer B-P unless P is child or below. */
|
/* NotifyPointer B-P unless P is child or below. */
|
||||||
CoreFocusInNotifyPointerEvents(dev, B, child, mode, FALSE);
|
CoreFocusInNotifyPointerEvents(dev, B, child, mode, FALSE);
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
CoreFocusEvent(dev, FocusIn, mode, NotifyAncestor, B);
|
CoreFocusEvent(dev, FocusIn, mode, NotifyAncestor, B);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1070,8 +1007,7 @@ HasOtherPointer(WindowPtr win, DeviceIntPtr exclude)
|
||||||
* Assumption: Neither A nor B are valid windows.
|
* Assumption: Neither A nor B are valid windows.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
CoreFocusPointerRootNoneSwitch(DeviceIntPtr dev,
|
CoreFocusPointerRootNoneSwitch(DeviceIntPtr dev, WindowPtr A, /* PointerRootWin or NoneWin */
|
||||||
WindowPtr A, /* PointerRootWin or NoneWin */
|
|
||||||
WindowPtr B, /* NoneWin or PointerRootWin */
|
WindowPtr B, /* NoneWin or PointerRootWin */
|
||||||
int mode)
|
int mode)
|
||||||
{
|
{
|
||||||
|
|
@ -1084,23 +1020,25 @@ CoreFocusPointerRootNoneSwitch(DeviceIntPtr dev,
|
||||||
nscreens = 1;
|
nscreens = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (i = 0; i < nscreens; i++)
|
for (i = 0; i < nscreens; i++) {
|
||||||
{
|
|
||||||
root = screenInfo.screens[i]->root;
|
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
|
/* If pointer was on PointerRootWin and changes to NoneWin, and
|
||||||
* the pointer paired with dev is below the current root window,
|
* the pointer paired with dev is below the current root window,
|
||||||
* do a NotifyPointer run. */
|
* do a NotifyPointer run. */
|
||||||
if (dev->focus && dev->focus->win == PointerRootWin &&
|
if (dev->focus && dev->focus->win == PointerRootWin &&
|
||||||
B != PointerRootWin)
|
B != PointerRootWin) {
|
||||||
{
|
|
||||||
WindowPtr ptrwin = PointerWin(GetMaster(dev, POINTER_OR_FLOAT));
|
WindowPtr ptrwin = PointerWin(GetMaster(dev, POINTER_OR_FLOAT));
|
||||||
|
|
||||||
if (ptrwin && IsParent(root, ptrwin))
|
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, FocusOut, mode,
|
||||||
CoreFocusEvent(dev, FocusIn, mode, B ? NotifyPointerRoot : NotifyDetailNone, root);
|
A ? NotifyPointerRoot : NotifyDetailNone, root);
|
||||||
|
CoreFocusEvent(dev, FocusIn, mode,
|
||||||
|
B ? NotifyPointerRoot : NotifyDetailNone, root);
|
||||||
if (B == PointerRootWin)
|
if (B == PointerRootWin)
|
||||||
CoreFocusInNotifyPointerEvents(dev, root, None, mode, TRUE);
|
CoreFocusInNotifyPointerEvents(dev, root, None, mode, TRUE);
|
||||||
}
|
}
|
||||||
|
|
@ -1113,9 +1051,7 @@ CoreFocusPointerRootNoneSwitch(DeviceIntPtr dev,
|
||||||
* Assumption: A is a valid window and not PointerRoot or None.
|
* Assumption: A is a valid window and not PointerRoot or None.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
CoreFocusToPointerRootOrNone(DeviceIntPtr dev,
|
CoreFocusToPointerRootOrNone(DeviceIntPtr dev, WindowPtr A, WindowPtr B, /* PointerRootWin or NoneWin */
|
||||||
WindowPtr A,
|
|
||||||
WindowPtr B, /* PointerRootWin or NoneWin */
|
|
||||||
int mode)
|
int mode)
|
||||||
{
|
{
|
||||||
WindowPtr root;
|
WindowPtr root;
|
||||||
|
|
@ -1127,15 +1063,15 @@ CoreFocusToPointerRootOrNone(DeviceIntPtr dev,
|
||||||
nscreens = 1;
|
nscreens = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!HasFocus(A))
|
if (!HasFocus(A)) {
|
||||||
{
|
|
||||||
WindowPtr child = FirstFocusChild(A);
|
WindowPtr child = FirstFocusChild(A);
|
||||||
if (child)
|
|
||||||
{
|
if (child) {
|
||||||
/* NotifyPointer P-A unless P is B or below */
|
/* NotifyPointer P-A unless P is B or below */
|
||||||
CoreFocusOutNotifyPointerEvents(dev, A, B, mode, FALSE);
|
CoreFocusOutNotifyPointerEvents(dev, A, B, mode, FALSE);
|
||||||
CoreFocusEvent(dev, FocusOut, mode, NotifyInferior, A);
|
CoreFocusEvent(dev, FocusOut, mode, NotifyInferior, A);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
/* NotifyPointer P-A */
|
/* NotifyPointer P-A */
|
||||||
CoreFocusOutNotifyPointerEvents(dev, A, None, mode, FALSE);
|
CoreFocusOutNotifyPointerEvents(dev, A, None, mode, FALSE);
|
||||||
CoreFocusEvent(dev, FocusOut, mode, NotifyNonlinear, A);
|
CoreFocusEvent(dev, FocusOut, mode, NotifyNonlinear, A);
|
||||||
|
|
@ -1145,12 +1081,11 @@ CoreFocusToPointerRootOrNone(DeviceIntPtr dev,
|
||||||
/* NullWindow means we include the root window */
|
/* NullWindow means we include the root window */
|
||||||
CoreFocusOutEvents(dev, A, NullWindow, mode, NotifyNonlinearVirtual);
|
CoreFocusOutEvents(dev, A, NullWindow, mode, NotifyNonlinearVirtual);
|
||||||
|
|
||||||
for (i = 0; i < nscreens; i++)
|
for (i = 0; i < nscreens; i++) {
|
||||||
{
|
|
||||||
root = screenInfo.screens[i]->root;
|
root = screenInfo.screens[i]->root;
|
||||||
if (!HasFocus(root) && !FirstFocusChild(root))
|
if (!HasFocus(root) && !FirstFocusChild(root)) {
|
||||||
{
|
CoreFocusEvent(dev, FocusIn, mode,
|
||||||
CoreFocusEvent(dev, FocusIn, mode, B ? NotifyPointerRoot : NotifyDetailNone, root);
|
B ? NotifyPointerRoot : NotifyDetailNone, root);
|
||||||
if (B == PointerRootWin)
|
if (B == PointerRootWin)
|
||||||
CoreFocusInNotifyPointerEvents(dev, root, None, mode, TRUE);
|
CoreFocusInNotifyPointerEvents(dev, root, None, mode, TRUE);
|
||||||
}
|
}
|
||||||
|
|
@ -1162,10 +1097,8 @@ CoreFocusToPointerRootOrNone(DeviceIntPtr dev,
|
||||||
* Assumption: B is a valid window and not PointerRoot or None.
|
* Assumption: B is a valid window and not PointerRoot or None.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
CoreFocusFromPointerRootOrNone(DeviceIntPtr dev,
|
CoreFocusFromPointerRootOrNone(DeviceIntPtr dev, WindowPtr A, /* PointerRootWin or NoneWin */
|
||||||
WindowPtr A, /* PointerRootWin or NoneWin */
|
WindowPtr B, int mode)
|
||||||
WindowPtr B,
|
|
||||||
int mode)
|
|
||||||
{
|
{
|
||||||
WindowPtr root;
|
WindowPtr root;
|
||||||
int i;
|
int i;
|
||||||
|
|
@ -1176,22 +1109,22 @@ CoreFocusFromPointerRootOrNone(DeviceIntPtr dev,
|
||||||
nscreens = 1;
|
nscreens = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (i = 0; i < nscreens; i++)
|
for (i = 0; i < nscreens; i++) {
|
||||||
{
|
|
||||||
root = screenInfo.screens[i]->root;
|
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
|
/* If pointer was on PointerRootWin and changes to NoneWin, and
|
||||||
* the pointer paired with dev is below the current root window,
|
* the pointer paired with dev is below the current root window,
|
||||||
* do a NotifyPointer run. */
|
* do a NotifyPointer run. */
|
||||||
if (dev->focus && dev->focus->win == PointerRootWin &&
|
if (dev->focus && dev->focus->win == PointerRootWin &&
|
||||||
B != PointerRootWin)
|
B != PointerRootWin) {
|
||||||
{
|
|
||||||
WindowPtr ptrwin = PointerWin(GetMaster(dev, POINTER_OR_FLOAT));
|
WindowPtr ptrwin = PointerWin(GetMaster(dev, POINTER_OR_FLOAT));
|
||||||
|
|
||||||
if (ptrwin)
|
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)
|
while (root->parent)
|
||||||
root = root->parent;
|
root = root->parent;
|
||||||
|
|
||||||
if (B != root)
|
if (B != root) {
|
||||||
{
|
|
||||||
CoreFocusEvent(dev, FocusIn, mode, NotifyNonlinearVirtual, root);
|
CoreFocusEvent(dev, FocusIn, mode, NotifyNonlinearVirtual, root);
|
||||||
CoreFocusInEvents(dev, root, B, mode, NotifyNonlinearVirtual);
|
CoreFocusInEvents(dev, root, B, mode, NotifyNonlinearVirtual);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!HasFocus(B)) {
|
||||||
if (!HasFocus(B))
|
|
||||||
{
|
|
||||||
WindowPtr child = FirstFocusChild(B);
|
WindowPtr child = FirstFocusChild(B);
|
||||||
if (child)
|
|
||||||
{
|
if (child) {
|
||||||
CoreFocusEvent(dev, FocusIn, mode, NotifyInferior, B);
|
CoreFocusEvent(dev, FocusIn, mode, NotifyInferior, B);
|
||||||
/* NotifyPointer B-P unless P is child or below. */
|
/* NotifyPointer B-P unless P is child or below. */
|
||||||
CoreFocusInNotifyPointerEvents(dev, B, child, mode, FALSE);
|
CoreFocusInNotifyPointerEvents(dev, B, child, mode, FALSE);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
CoreFocusEvent(dev, FocusIn, mode, NotifyNonlinear, B);
|
CoreFocusEvent(dev, FocusIn, mode, NotifyNonlinear, B);
|
||||||
/* NotifyPointer B-P unless P is child or below. */
|
/* NotifyPointer B-P unless P is child or below. */
|
||||||
CoreFocusInNotifyPointerEvents(dev, B, None, mode, FALSE);
|
CoreFocusInNotifyPointerEvents(dev, B, None, mode, FALSE);
|
||||||
|
|
@ -1224,10 +1155,7 @@ CoreFocusFromPointerRootOrNone(DeviceIntPtr dev,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
CoreFocusEvents(DeviceIntPtr dev,
|
CoreFocusEvents(DeviceIntPtr dev, WindowPtr from, WindowPtr to, int mode)
|
||||||
WindowPtr from,
|
|
||||||
WindowPtr to,
|
|
||||||
int mode)
|
|
||||||
{
|
{
|
||||||
if (!IsMaster(dev))
|
if (!IsMaster(dev))
|
||||||
return;
|
return;
|
||||||
|
|
@ -1252,10 +1180,7 @@ CoreFocusEvents(DeviceIntPtr dev,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
DeviceFocusEvents(DeviceIntPtr dev,
|
DeviceFocusEvents(DeviceIntPtr dev, WindowPtr from, WindowPtr to, int mode)
|
||||||
WindowPtr from,
|
|
||||||
WindowPtr to,
|
|
||||||
int mode)
|
|
||||||
{
|
{
|
||||||
int out, in; /* for holding details for to/from
|
int out, in; /* for holding details for to/from
|
||||||
PointerRoot/None */
|
PointerRoot/None */
|
||||||
|
|
@ -1274,19 +1199,18 @@ DeviceFocusEvents(DeviceIntPtr dev,
|
||||||
nscreens = 1;
|
nscreens = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ((to == NullWindow) || (to == PointerRootWin))
|
if ((to == NullWindow) || (to == PointerRootWin)) {
|
||||||
{
|
if ((from == NullWindow) || (from == PointerRootWin)) {
|
||||||
if ((from == NullWindow) || (from == PointerRootWin))
|
|
||||||
{
|
|
||||||
if (from == PointerRootWin)
|
if (from == PointerRootWin)
|
||||||
DeviceFocusOutEvents(dev, sprite->win, GetCurrentRootWindow(dev), mode,
|
DeviceFocusOutEvents(dev, sprite->win,
|
||||||
|
GetCurrentRootWindow(dev), mode,
|
||||||
NotifyPointer);
|
NotifyPointer);
|
||||||
/* Notify all the roots */
|
/* Notify all the roots */
|
||||||
for (i = 0; i < nscreens; i++)
|
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))
|
if (IsParent(from, sprite->win))
|
||||||
DeviceFocusOutEvents(dev, sprite->win, from, mode,
|
DeviceFocusOutEvents(dev, sprite->win, from, mode,
|
||||||
NotifyPointer);
|
NotifyPointer);
|
||||||
|
|
@ -1297,45 +1221,43 @@ DeviceFocusEvents(DeviceIntPtr dev,
|
||||||
}
|
}
|
||||||
/* Notify all the roots */
|
/* Notify all the roots */
|
||||||
for (i = 0; i < nscreens; i++)
|
for (i = 0; i < nscreens; i++)
|
||||||
DeviceFocusEvent(dev, XI_FocusIn, mode, in, screenInfo.screens[i]->root);
|
DeviceFocusEvent(dev, XI_FocusIn, mode, in,
|
||||||
if (to == PointerRootWin)
|
screenInfo.screens[i]->root);
|
||||||
{
|
if (to == PointerRootWin) {
|
||||||
DeviceFocusInEvents(dev, GetCurrentRootWindow(dev), sprite->win, mode, NotifyPointer);
|
DeviceFocusInEvents(dev, GetCurrentRootWindow(dev), sprite->win,
|
||||||
|
mode, NotifyPointer);
|
||||||
DeviceFocusEvent(dev, XI_FocusIn, mode, NotifyPointer, sprite->win);
|
DeviceFocusEvent(dev, XI_FocusIn, mode, NotifyPointer, sprite->win);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
if ((from == NullWindow) || (from == PointerRootWin)) {
|
||||||
if ((from == NullWindow) || (from == PointerRootWin))
|
|
||||||
{
|
|
||||||
if (from == PointerRootWin)
|
if (from == PointerRootWin)
|
||||||
DeviceFocusOutEvents(dev, sprite->win, GetCurrentRootWindow(dev), mode,
|
DeviceFocusOutEvents(dev, sprite->win,
|
||||||
|
GetCurrentRootWindow(dev), mode,
|
||||||
NotifyPointer);
|
NotifyPointer);
|
||||||
for (i = 0; i < nscreens; i++)
|
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)
|
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);
|
DeviceFocusEvent(dev, XI_FocusIn, mode, NotifyNonlinear, to);
|
||||||
if (IsParent(to, sprite->win))
|
if (IsParent(to, sprite->win))
|
||||||
DeviceFocusInEvents(dev, to, sprite->win, mode, NotifyPointer);
|
DeviceFocusInEvents(dev, to, sprite->win, mode, NotifyPointer);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
if (IsParent(to, from)) {
|
||||||
if (IsParent(to, from))
|
|
||||||
{
|
|
||||||
DeviceFocusEvent(dev, XI_FocusOut, mode, NotifyAncestor, from);
|
DeviceFocusEvent(dev, XI_FocusOut, mode, NotifyAncestor, from);
|
||||||
DeviceFocusOutEvents(dev, from, to, mode,
|
DeviceFocusOutEvents(dev, from, to, mode, NotifyVirtual);
|
||||||
NotifyVirtual);
|
|
||||||
DeviceFocusEvent(dev, XI_FocusIn, mode, NotifyInferior, to);
|
DeviceFocusEvent(dev, XI_FocusIn, mode, NotifyInferior, to);
|
||||||
if ((IsParent(to, sprite->win)) &&
|
if ((IsParent(to, sprite->win)) &&
|
||||||
(sprite->win != from) &&
|
(sprite->win != from) &&
|
||||||
(!IsParent(from, sprite->win)) &&
|
(!IsParent(from, sprite->win)) &&
|
||||||
(!IsParent(sprite->win, from)))
|
(!IsParent(sprite->win, from)))
|
||||||
DeviceFocusInEvents(dev, to, sprite->win, mode, NotifyPointer);
|
DeviceFocusInEvents(dev, to, sprite->win, mode,
|
||||||
|
NotifyPointer);
|
||||||
}
|
}
|
||||||
else
|
else if (IsParent(from, to)) {
|
||||||
if (IsParent(from, to))
|
|
||||||
{
|
|
||||||
if ((IsParent(from, sprite->win)) &&
|
if ((IsParent(from, sprite->win)) &&
|
||||||
(sprite->win != from) &&
|
(sprite->win != from) &&
|
||||||
(!IsParent(to, sprite->win)) &&
|
(!IsParent(to, sprite->win)) &&
|
||||||
|
|
@ -1346,10 +1268,10 @@ DeviceFocusEvents(DeviceIntPtr dev,
|
||||||
DeviceFocusInEvents(dev, from, to, mode, NotifyVirtual);
|
DeviceFocusInEvents(dev, from, to, mode, NotifyVirtual);
|
||||||
DeviceFocusEvent(dev, XI_FocusIn, mode, NotifyAncestor, to);
|
DeviceFocusEvent(dev, XI_FocusIn, mode, NotifyAncestor, to);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
/* neither from or to is child of other */
|
/* neither from or to is child of other */
|
||||||
WindowPtr common = CommonAncestor(to, from);
|
WindowPtr common = CommonAncestor(to, from);
|
||||||
|
|
||||||
/* common == NullWindow ==> different screens */
|
/* common == NullWindow ==> different screens */
|
||||||
if (IsParent(from, sprite->win))
|
if (IsParent(from, sprite->win))
|
||||||
DeviceFocusOutEvents(dev, sprite->win, from, mode,
|
DeviceFocusOutEvents(dev, sprite->win, from, mode,
|
||||||
|
|
@ -1359,10 +1281,12 @@ DeviceFocusEvents(DeviceIntPtr dev,
|
||||||
DeviceFocusOutEvents(dev, from, common, mode,
|
DeviceFocusOutEvents(dev, from, common, mode,
|
||||||
NotifyNonlinearVirtual);
|
NotifyNonlinearVirtual);
|
||||||
if (to->parent != NullWindow)
|
if (to->parent != NullWindow)
|
||||||
DeviceFocusInEvents(dev, common, to, mode, NotifyNonlinearVirtual);
|
DeviceFocusInEvents(dev, common, to, mode,
|
||||||
|
NotifyNonlinearVirtual);
|
||||||
DeviceFocusEvent(dev, XI_FocusIn, mode, NotifyNonlinear, to);
|
DeviceFocusEvent(dev, XI_FocusIn, mode, NotifyNonlinear, to);
|
||||||
if (IsParent(to, sprite->win))
|
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.
|
* @param to Window the focus moved into.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
DoFocusEvents(DeviceIntPtr pDev,
|
DoFocusEvents(DeviceIntPtr pDev, WindowPtr from, WindowPtr to, int mode)
|
||||||
WindowPtr from,
|
|
||||||
WindowPtr to,
|
|
||||||
int mode)
|
|
||||||
{
|
{
|
||||||
if (!IsKeyboardDevice(pDev))
|
if (!IsKeyboardDevice(pDev))
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -31,67 +31,40 @@
|
||||||
#ifndef ENTERLEAVE_H
|
#ifndef ENTERLEAVE_H
|
||||||
#define ENTERLEAVE_H
|
#define ENTERLEAVE_H
|
||||||
|
|
||||||
extern void DoEnterLeaveEvents(
|
extern void DoEnterLeaveEvents(DeviceIntPtr pDev,
|
||||||
DeviceIntPtr pDev,
|
|
||||||
int sourceid,
|
int sourceid,
|
||||||
WindowPtr fromWin,
|
WindowPtr fromWin, WindowPtr toWin, int mode);
|
||||||
WindowPtr toWin,
|
|
||||||
int mode
|
|
||||||
);
|
|
||||||
|
|
||||||
extern void DoFocusEvents(
|
extern void DoFocusEvents(DeviceIntPtr pDev,
|
||||||
DeviceIntPtr pDev,
|
WindowPtr fromWin, WindowPtr toWin, int mode);
|
||||||
WindowPtr fromWin,
|
|
||||||
WindowPtr toWin,
|
|
||||||
int mode
|
|
||||||
);
|
|
||||||
|
|
||||||
extern void EnterLeaveEvent(
|
extern void EnterLeaveEvent(DeviceIntPtr mouse,
|
||||||
DeviceIntPtr mouse,
|
|
||||||
int type,
|
int type,
|
||||||
int mode,
|
int mode, int detail, WindowPtr pWin, Window child);
|
||||||
int detail,
|
|
||||||
WindowPtr pWin,
|
|
||||||
Window child);
|
|
||||||
|
|
||||||
extern WindowPtr CommonAncestor(
|
extern WindowPtr CommonAncestor(WindowPtr a, WindowPtr b);
|
||||||
WindowPtr a,
|
|
||||||
WindowPtr b);
|
|
||||||
|
|
||||||
extern void CoreEnterLeaveEvent(DeviceIntPtr mouse,
|
extern void CoreEnterLeaveEvent(DeviceIntPtr mouse,
|
||||||
int type,
|
int type,
|
||||||
int mode,
|
int mode,
|
||||||
int detail,
|
int detail, WindowPtr pWin, Window child);
|
||||||
WindowPtr pWin,
|
|
||||||
Window child);
|
|
||||||
extern void DeviceEnterLeaveEvent(DeviceIntPtr mouse,
|
extern void DeviceEnterLeaveEvent(DeviceIntPtr mouse,
|
||||||
int sourceid,
|
int sourceid,
|
||||||
int type,
|
int type,
|
||||||
int mode,
|
int mode,
|
||||||
int detail,
|
int detail, WindowPtr pWin, Window child);
|
||||||
WindowPtr pWin,
|
|
||||||
Window child);
|
|
||||||
|
|
||||||
extern void EnterWindow(DeviceIntPtr dev,
|
extern void EnterWindow(DeviceIntPtr dev, WindowPtr win, int mode);
|
||||||
WindowPtr win,
|
|
||||||
int mode);
|
|
||||||
|
|
||||||
extern void LeaveWindow(DeviceIntPtr dev);
|
extern void LeaveWindow(DeviceIntPtr dev);
|
||||||
|
|
||||||
extern void CoreFocusEvent(DeviceIntPtr kbd,
|
extern void CoreFocusEvent(DeviceIntPtr kbd,
|
||||||
int type,
|
int type, int mode, int detail, WindowPtr pWin);
|
||||||
int mode,
|
|
||||||
int detail,
|
|
||||||
WindowPtr pWin);
|
|
||||||
|
|
||||||
extern void DeviceFocusEvent(DeviceIntPtr kbd,
|
extern void DeviceFocusEvent(DeviceIntPtr kbd,
|
||||||
int type,
|
int type, int mode, int detail, WindowPtr pWin);
|
||||||
int mode,
|
|
||||||
int detail,
|
|
||||||
WindowPtr pWin);
|
|
||||||
|
|
||||||
extern void SetFocusIn(DeviceIntPtr kbd,
|
extern void SetFocusIn(DeviceIntPtr kbd, WindowPtr win);
|
||||||
WindowPtr win);
|
|
||||||
|
|
||||||
extern void SetFocusOut(DeviceIntPtr dev);
|
extern void SetFocusOut(DeviceIntPtr dev);
|
||||||
#endif /* _ENTERLEAVE_H_ */
|
#endif /* _ENTERLEAVE_H_ */
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,6 @@
|
||||||
#include "xkbsrv.h"
|
#include "xkbsrv.h"
|
||||||
#include "inpututils.h"
|
#include "inpututils.h"
|
||||||
|
|
||||||
|
|
||||||
static int countValuators(DeviceEvent *ev, int *first);
|
static int countValuators(DeviceEvent *ev, int *first);
|
||||||
static int getValuatorEvents(DeviceEvent *ev, deviceValuator * xv);
|
static int getValuatorEvents(DeviceEvent *ev, deviceValuator * xv);
|
||||||
static int eventToKeyButtonPointer(DeviceEvent *ev, xEvent **xi, int *count);
|
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 count = 0;
|
||||||
int ret = BadImplementation;
|
int ret = BadImplementation;
|
||||||
|
|
||||||
switch(event->any.type)
|
switch (event->any.type) {
|
||||||
{
|
|
||||||
case ET_Motion:
|
case ET_Motion:
|
||||||
{
|
{
|
||||||
DeviceEvent *e = &event->device_event;
|
DeviceEvent *e = &event->device_event;
|
||||||
|
|
||||||
/* Don't create core motion event if neither x nor y are
|
/* Don't create core motion event if neither x nor y are
|
||||||
* present */
|
* present */
|
||||||
if (!BitIsOn(e->valuators.mask, 0) &&
|
if (!BitIsOn(e->valuators.mask, 0) && !BitIsOn(e->valuators.mask, 1)) {
|
||||||
!BitIsOn(e->valuators.mask, 1))
|
|
||||||
{
|
|
||||||
ret = BadMatch;
|
ret = BadMatch;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
@ -129,8 +126,7 @@ EventToCore(InternalEvent *event, xEvent **core_out, int *count_out)
|
||||||
{
|
{
|
||||||
DeviceEvent *e = &event->device_event;
|
DeviceEvent *e = &event->device_event;
|
||||||
|
|
||||||
if (e->detail.key > 0xFF)
|
if (e->detail.key > 0xFF) {
|
||||||
{
|
|
||||||
ret = BadMatch;
|
ret = BadMatch;
|
||||||
goto out;
|
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.rootY = e->root_y;
|
||||||
core->u.keyButtonPointer.state = e->corestate;
|
core->u.keyButtonPointer.state = e->corestate;
|
||||||
core->u.keyButtonPointer.root = e->root;
|
core->u.keyButtonPointer.root = e->root;
|
||||||
EventSetKeyRepeatFlag(core,
|
EventSetKeyRepeatFlag(core, (e->type == ET_KeyPress && e->key_repeat));
|
||||||
(e->type == ET_KeyPress &&
|
|
||||||
e->key_repeat));
|
|
||||||
ret = Success;
|
ret = Success;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -200,8 +194,7 @@ out:
|
||||||
int
|
int
|
||||||
EventToXI(InternalEvent *ev, xEvent **xi, int *count)
|
EventToXI(InternalEvent *ev, xEvent **xi, int *count)
|
||||||
{
|
{
|
||||||
switch (ev->any.type)
|
switch (ev->any.type) {
|
||||||
{
|
|
||||||
case ET_Motion:
|
case ET_Motion:
|
||||||
case ET_ButtonPress:
|
case ET_ButtonPress:
|
||||||
case ET_ButtonRelease:
|
case ET_ButtonRelease:
|
||||||
|
|
@ -251,8 +244,7 @@ EventToXI(InternalEvent *ev, xEvent **xi, int *count)
|
||||||
int
|
int
|
||||||
EventToXI2(InternalEvent *ev, xEvent **xi)
|
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
|
/* Enter/FocusIn are for grabs. We don't need an actual event, since
|
||||||
* the real events delivered are triggered elsewhere */
|
* the real events delivered are triggered elsewhere */
|
||||||
case ET_Enter:
|
case ET_Enter:
|
||||||
|
|
@ -301,17 +293,14 @@ eventToKeyButtonPointer(DeviceEvent *ev, xEvent **xi, int *count)
|
||||||
deviceKeyButtonPointer *kbp;
|
deviceKeyButtonPointer *kbp;
|
||||||
|
|
||||||
/* Sorry, XI 1.x protocol restrictions. */
|
/* Sorry, XI 1.x protocol restrictions. */
|
||||||
if (ev->detail.button > 0xFF || ev->deviceid >= 0x80)
|
if (ev->detail.button > 0xFF || ev->deviceid >= 0x80) {
|
||||||
{
|
|
||||||
*count = 0;
|
*count = 0;
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
num_events = (countValuators(ev, &first) + 5) / 6; /* valuator ev */
|
num_events = (countValuators(ev, &first) + 5) / 6; /* valuator ev */
|
||||||
if (num_events <= 0)
|
if (num_events <= 0) {
|
||||||
{
|
switch (ev->type) {
|
||||||
switch (ev->type)
|
|
||||||
{
|
|
||||||
case ET_KeyPress:
|
case ET_KeyPress:
|
||||||
case ET_KeyRelease:
|
case ET_KeyRelease:
|
||||||
case ET_ButtonPress:
|
case ET_ButtonPress:
|
||||||
|
|
@ -332,8 +321,7 @@ eventToKeyButtonPointer(DeviceEvent *ev, xEvent **xi, int *count)
|
||||||
num_events++; /* the actual event event */
|
num_events++; /* the actual event event */
|
||||||
|
|
||||||
*xi = calloc(num_events, sizeof(xEvent));
|
*xi = calloc(num_events, sizeof(xEvent));
|
||||||
if (!(*xi))
|
if (!(*xi)) {
|
||||||
{
|
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -351,21 +339,33 @@ eventToKeyButtonPointer(DeviceEvent *ev, xEvent **xi, int *count)
|
||||||
if (num_events > 1)
|
if (num_events > 1)
|
||||||
kbp->deviceid |= MORE_EVENTS;
|
kbp->deviceid |= MORE_EVENTS;
|
||||||
|
|
||||||
switch(ev->type)
|
switch (ev->type) {
|
||||||
{
|
case ET_Motion:
|
||||||
case ET_Motion: kbp->type = DeviceMotionNotify; break;
|
kbp->type = DeviceMotionNotify;
|
||||||
case ET_ButtonPress: kbp->type = DeviceButtonPress; break;
|
break;
|
||||||
case ET_ButtonRelease: kbp->type = DeviceButtonRelease; break;
|
case ET_ButtonPress:
|
||||||
case ET_KeyPress: kbp->type = DeviceKeyPress; break;
|
kbp->type = DeviceButtonPress;
|
||||||
case ET_KeyRelease: kbp->type = DeviceKeyRelease; break;
|
break;
|
||||||
case ET_ProximityIn: kbp->type = ProximityIn; break;
|
case ET_ButtonRelease:
|
||||||
case ET_ProximityOut: kbp->type = ProximityOut; break;
|
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:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (num_events > 1)
|
if (num_events > 1) {
|
||||||
{
|
|
||||||
getValuatorEvents(ev, (deviceValuator *) (kbp + 1));
|
getValuatorEvents(ev, (deviceValuator *) (kbp + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -373,7 +373,6 @@ eventToKeyButtonPointer(DeviceEvent *ev, xEvent **xi, int *count)
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set first to the first valuator in the event ev and return the number of
|
* Set first to the first valuator in the event ev and return the number of
|
||||||
* valuators from first to the last set valuator.
|
* 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 first_valuator = -1, last_valuator = -1, num_valuators = 0;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < sizeof(ev->valuators.mask) * 8; i++)
|
for (i = 0; i < sizeof(ev->valuators.mask) * 8; i++) {
|
||||||
{
|
if (BitIsOn(ev->valuators.mask, i)) {
|
||||||
if (BitIsOn(ev->valuators.mask, i))
|
|
||||||
{
|
|
||||||
if (first_valuator == -1)
|
if (first_valuator == -1)
|
||||||
first_valuator = i;
|
first_valuator = i;
|
||||||
last_valuator = i;
|
last_valuator = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (first_valuator != -1)
|
if (first_valuator != -1) {
|
||||||
{
|
|
||||||
num_valuators = last_valuator - first_valuator + 1;
|
num_valuators = last_valuator - first_valuator + 1;
|
||||||
*first = first_valuator;
|
*first = first_valuator;
|
||||||
}
|
}
|
||||||
|
|
@ -410,14 +406,15 @@ getValuatorEvents(DeviceEvent *ev, deviceValuator *xv)
|
||||||
int state = 0;
|
int state = 0;
|
||||||
int first_valuator, num_valuators;
|
int first_valuator, num_valuators;
|
||||||
|
|
||||||
|
|
||||||
num_valuators = countValuators(ev, &first_valuator);
|
num_valuators = countValuators(ev, &first_valuator);
|
||||||
if (num_valuators > 0)
|
if (num_valuators > 0) {
|
||||||
{
|
|
||||||
DeviceIntPtr dev = NULL;
|
DeviceIntPtr dev = NULL;
|
||||||
|
|
||||||
dixLookupDevice(&dev, ev->deviceid, serverClient, DixUseAccess);
|
dixLookupDevice(&dev, ev->deviceid, serverClient, DixUseAccess);
|
||||||
/* State needs to be assembled BEFORE the device is updated. */
|
/* 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;
|
state |= (dev && dev->button) ? (dev->button->state) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -443,7 +440,6 @@ getValuatorEvents(DeviceEvent *ev, deviceValuator *xv)
|
||||||
return (num_valuators + 5) / 6;
|
return (num_valuators + 5) / 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
appendKeyInfo(DeviceChangedEvent *dce, xXIKeyInfo * info)
|
appendKeyInfo(DeviceChangedEvent *dce, xXIKeyInfo * info)
|
||||||
{
|
{
|
||||||
|
|
@ -487,7 +483,8 @@ appendButtonInfo(DeviceChangedEvent *dce, xXIButtonInfo *info)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
appendValuatorInfo(DeviceChangedEvent *dce, xXIValuatorInfo *info, int axisnumber)
|
appendValuatorInfo(DeviceChangedEvent *dce, xXIValuatorInfo * info,
|
||||||
|
int axisnumber)
|
||||||
{
|
{
|
||||||
info->type = XIValuatorClass;
|
info->type = XIValuatorClass;
|
||||||
info->length = sizeof(xXIValuatorInfo) / 4;
|
info->length = sizeof(xXIValuatorInfo) / 4;
|
||||||
|
|
@ -516,8 +513,7 @@ appendScrollInfo(DeviceChangedEvent *dce, xXIScrollInfo *info, int axisnumber)
|
||||||
info->type = XIScrollClass;
|
info->type = XIScrollClass;
|
||||||
info->length = sizeof(xXIScrollInfo) / 4;
|
info->length = sizeof(xXIScrollInfo) / 4;
|
||||||
info->number = axisnumber;
|
info->number = axisnumber;
|
||||||
switch(dce->valuators[axisnumber].scroll.type)
|
switch (dce->valuators[axisnumber].scroll.type) {
|
||||||
{
|
|
||||||
case SCROLL_TYPE_VERTICAL:
|
case SCROLL_TYPE_VERTICAL:
|
||||||
info->scroll_type = XIScrollTypeVertical;
|
info->scroll_type = XIScrollTypeVertical;
|
||||||
break;
|
break;
|
||||||
|
|
@ -525,10 +521,12 @@ appendScrollInfo(DeviceChangedEvent *dce, xXIScrollInfo *info, int axisnumber)
|
||||||
info->scroll_type = XIScrollTypeHorizontal;
|
info->scroll_type = XIScrollTypeHorizontal;
|
||||||
break;
|
break;
|
||||||
default:
|
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;
|
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->sourceid = dce->sourceid;
|
||||||
|
|
||||||
info->flags = 0;
|
info->flags = 0;
|
||||||
|
|
@ -549,14 +547,12 @@ eventToDeviceChanged(DeviceChangedEvent *dce, xEvent **xi)
|
||||||
int nkeys;
|
int nkeys;
|
||||||
char *ptr;
|
char *ptr;
|
||||||
|
|
||||||
if (dce->buttons.num_buttons)
|
if (dce->buttons.num_buttons) {
|
||||||
{
|
|
||||||
len += sizeof(xXIButtonInfo);
|
len += sizeof(xXIButtonInfo);
|
||||||
len += dce->buttons.num_buttons * sizeof(Atom); /* button names */
|
len += dce->buttons.num_buttons * sizeof(Atom); /* button names */
|
||||||
len += pad_to_int32(bits_to_bytes(dce->buttons.num_buttons));
|
len += pad_to_int32(bits_to_bytes(dce->buttons.num_buttons));
|
||||||
}
|
}
|
||||||
if (dce->num_valuators)
|
if (dce->num_valuators) {
|
||||||
{
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
len += sizeof(xXIValuatorInfo) * dce->num_valuators;
|
len += sizeof(xXIValuatorInfo) * dce->num_valuators;
|
||||||
|
|
@ -568,15 +564,13 @@ eventToDeviceChanged(DeviceChangedEvent *dce, xEvent **xi)
|
||||||
|
|
||||||
nkeys = (dce->keys.max_keycode > 0) ?
|
nkeys = (dce->keys.max_keycode > 0) ?
|
||||||
dce->keys.max_keycode - dce->keys.min_keycode + 1 : 0;
|
dce->keys.max_keycode - dce->keys.min_keycode + 1 : 0;
|
||||||
if (nkeys > 0)
|
if (nkeys > 0) {
|
||||||
{
|
|
||||||
len += sizeof(xXIKeyInfo);
|
len += sizeof(xXIKeyInfo);
|
||||||
len += sizeof(CARD32) * nkeys; /* keycodes */
|
len += sizeof(CARD32) * nkeys; /* keycodes */
|
||||||
}
|
}
|
||||||
|
|
||||||
dcce = calloc(1, len);
|
dcce = calloc(1, len);
|
||||||
if (!dcce)
|
if (!dcce) {
|
||||||
{
|
|
||||||
ErrorF("[Xi] BadAlloc in SendDeviceChangedEvent.\n");
|
ErrorF("[Xi] BadAlloc in SendDeviceChangedEvent.\n");
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
|
|
@ -587,35 +581,31 @@ eventToDeviceChanged(DeviceChangedEvent *dce, xEvent **xi)
|
||||||
dcce->time = dce->time;
|
dcce->time = dce->time;
|
||||||
dcce->deviceid = dce->deviceid;
|
dcce->deviceid = dce->deviceid;
|
||||||
dcce->sourceid = dce->sourceid;
|
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->num_classes = 0;
|
||||||
dcce->length = bytes_to_int32(len - sizeof(xEvent));
|
dcce->length = bytes_to_int32(len - sizeof(xEvent));
|
||||||
|
|
||||||
ptr = (char *) &dcce[1];
|
ptr = (char *) &dcce[1];
|
||||||
if (dce->buttons.num_buttons)
|
if (dce->buttons.num_buttons) {
|
||||||
{
|
|
||||||
dcce->num_classes++;
|
dcce->num_classes++;
|
||||||
ptr += appendButtonInfo(dce, (xXIButtonInfo *) ptr);
|
ptr += appendButtonInfo(dce, (xXIButtonInfo *) ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nkeys)
|
if (nkeys) {
|
||||||
{
|
|
||||||
dcce->num_classes++;
|
dcce->num_classes++;
|
||||||
ptr += appendKeyInfo(dce, (xXIKeyInfo *) ptr);
|
ptr += appendKeyInfo(dce, (xXIKeyInfo *) ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dce->num_valuators)
|
if (dce->num_valuators) {
|
||||||
{
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
dcce->num_classes += dce->num_valuators;
|
dcce->num_classes += dce->num_valuators;
|
||||||
for (i = 0; i < dce->num_valuators; i++)
|
for (i = 0; i < dce->num_valuators; i++)
|
||||||
ptr += appendValuatorInfo(dce, (xXIValuatorInfo *) ptr, i);
|
ptr += appendValuatorInfo(dce, (xXIValuatorInfo *) ptr, i);
|
||||||
|
|
||||||
for (i = 0; i < dce->num_valuators; i++)
|
for (i = 0; i < dce->num_valuators; i++) {
|
||||||
{
|
if (dce->valuators[i].scroll.type != SCROLL_TYPE_NONE) {
|
||||||
if (dce->valuators[i].scroll.type != SCROLL_TYPE_NONE)
|
|
||||||
{
|
|
||||||
dcce->num_classes++;
|
dcce->num_classes++;
|
||||||
ptr += appendScrollInfo(dce, (xXIScrollInfo *) ptr, i);
|
ptr += appendScrollInfo(dce, (xXIScrollInfo *) ptr, i);
|
||||||
}
|
}
|
||||||
|
|
@ -627,17 +617,16 @@ eventToDeviceChanged(DeviceChangedEvent *dce, xEvent **xi)
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int count_bits(unsigned char* ptr, int len)
|
static int
|
||||||
|
count_bits(unsigned char *ptr, int len)
|
||||||
{
|
{
|
||||||
int bits = 0;
|
int bits = 0;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
unsigned char x;
|
unsigned char x;
|
||||||
|
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++) {
|
||||||
{
|
|
||||||
x = ptr[i];
|
x = ptr[i];
|
||||||
while(x > 0)
|
while (x > 0) {
|
||||||
{
|
|
||||||
bits += (x & 0x1);
|
bits += (x & 0x1);
|
||||||
x >>= 1;
|
x >>= 1;
|
||||||
}
|
}
|
||||||
|
|
@ -660,8 +649,9 @@ eventToDeviceEvent(DeviceEvent *ev, xEvent **xi)
|
||||||
btlen = bytes_to_int32(bits_to_bytes(MAX_BUTTONS));
|
btlen = bytes_to_int32(bits_to_bytes(MAX_BUTTONS));
|
||||||
len += btlen * 4; /* buttonmask len */
|
len += btlen * 4; /* buttonmask len */
|
||||||
|
|
||||||
|
vallen =
|
||||||
vallen = count_bits(ev->valuators.mask, sizeof(ev->valuators.mask)/sizeof(ev->valuators.mask[0]));
|
count_bits(ev->valuators.mask,
|
||||||
|
sizeof(ev->valuators.mask) / sizeof(ev->valuators.mask[0]));
|
||||||
len += vallen * 2 * sizeof(uint32_t); /* axisvalues */
|
len += vallen * 2 * sizeof(uint32_t); /* axisvalues */
|
||||||
vallen = bytes_to_int32(bits_to_bytes(MAX_VALUATORS));
|
vallen = bytes_to_int32(bits_to_bytes(MAX_VALUATORS));
|
||||||
len += vallen * 4; /* valuators mask */
|
len += vallen * 4; /* valuators mask */
|
||||||
|
|
@ -709,18 +699,15 @@ eventToDeviceEvent(DeviceEvent *ev, xEvent **xi)
|
||||||
xde->group.effective_group = ev->group.effective;
|
xde->group.effective_group = ev->group.effective;
|
||||||
|
|
||||||
ptr = (char *) &xde[1];
|
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))
|
if (BitIsOn(ev->buttons, i))
|
||||||
SetBit(ptr, i);
|
SetBit(ptr, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
ptr += xde->buttons_len * 4;
|
ptr += xde->buttons_len * 4;
|
||||||
axisval = (FP3232 *) (ptr + xde->valuators_len * 4);
|
axisval = (FP3232 *) (ptr + xde->valuators_len * 4);
|
||||||
for (i = 0; i < sizeof(ev->valuators.mask) * 8; i++)
|
for (i = 0; i < sizeof(ev->valuators.mask) * 8; i++) {
|
||||||
{
|
if (BitIsOn(ev->valuators.mask, i)) {
|
||||||
if (BitIsOn(ev->valuators.mask, i))
|
|
||||||
{
|
|
||||||
SetBit(ptr, i);
|
SetBit(ptr, i);
|
||||||
*axisval = double_to_fp3232(ev->valuators.data[i]);
|
*axisval = double_to_fp3232(ev->valuators.data[i]);
|
||||||
axisval++;
|
axisval++;
|
||||||
|
|
@ -782,10 +769,8 @@ eventToRawEvent(RawDeviceEvent *ev, xEvent **xi)
|
||||||
ptr = (char *) &raw[1];
|
ptr = (char *) &raw[1];
|
||||||
axisval = (FP3232 *) (ptr + raw->valuators_len * 4);
|
axisval = (FP3232 *) (ptr + raw->valuators_len * 4);
|
||||||
axisval_raw = axisval + nvals;
|
axisval_raw = axisval + nvals;
|
||||||
for (i = 0; i < sizeof(ev->valuators.mask) * 8; i++)
|
for (i = 0; i < sizeof(ev->valuators.mask) * 8; i++) {
|
||||||
{
|
if (BitIsOn(ev->valuators.mask, i)) {
|
||||||
if (BitIsOn(ev->valuators.mask, i))
|
|
||||||
{
|
|
||||||
SetBit(ptr, i);
|
SetBit(ptr, i);
|
||||||
*axisval = double_to_fp3232(ev->valuators.data[i]);
|
*axisval = double_to_fp3232(ev->valuators.data[i]);
|
||||||
*axisval_raw = double_to_fp3232(ev->valuators.data_raw[i]);
|
*axisval_raw = double_to_fp3232(ev->valuators.data_raw[i]);
|
||||||
|
|
@ -805,13 +790,23 @@ int
|
||||||
GetCoreType(enum EventType type)
|
GetCoreType(enum EventType type)
|
||||||
{
|
{
|
||||||
int coretype = 0;
|
int coretype = 0;
|
||||||
switch(type)
|
|
||||||
{
|
switch (type) {
|
||||||
case ET_Motion: coretype = MotionNotify; break;
|
case ET_Motion:
|
||||||
case ET_ButtonPress: coretype = ButtonPress; break;
|
coretype = MotionNotify;
|
||||||
case ET_ButtonRelease: coretype = ButtonRelease; break;
|
break;
|
||||||
case ET_KeyPress: coretype = KeyPress; break;
|
case ET_ButtonPress:
|
||||||
case ET_KeyRelease: coretype = KeyRelease; break;
|
coretype = ButtonPress;
|
||||||
|
break;
|
||||||
|
case ET_ButtonRelease:
|
||||||
|
coretype = ButtonRelease;
|
||||||
|
break;
|
||||||
|
case ET_KeyPress:
|
||||||
|
coretype = KeyPress;
|
||||||
|
break;
|
||||||
|
case ET_KeyRelease:
|
||||||
|
coretype = KeyRelease;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -826,15 +821,29 @@ int
|
||||||
GetXIType(enum EventType type)
|
GetXIType(enum EventType type)
|
||||||
{
|
{
|
||||||
int xitype = 0;
|
int xitype = 0;
|
||||||
switch(type)
|
|
||||||
{
|
switch (type) {
|
||||||
case ET_Motion: xitype = DeviceMotionNotify; break;
|
case ET_Motion:
|
||||||
case ET_ButtonPress: xitype = DeviceButtonPress; break;
|
xitype = DeviceMotionNotify;
|
||||||
case ET_ButtonRelease: xitype = DeviceButtonRelease; break;
|
break;
|
||||||
case ET_KeyPress: xitype = DeviceKeyPress; break;
|
case ET_ButtonPress:
|
||||||
case ET_KeyRelease: xitype = DeviceKeyRelease; break;
|
xitype = DeviceButtonPress;
|
||||||
case ET_ProximityIn: xitype = ProximityIn; break;
|
break;
|
||||||
case ET_ProximityOut: xitype = ProximityOut; 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:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -850,31 +859,76 @@ GetXI2Type(enum EventType type)
|
||||||
{
|
{
|
||||||
int xi2type = 0;
|
int xi2type = 0;
|
||||||
|
|
||||||
switch(type)
|
switch (type) {
|
||||||
{
|
case ET_Motion:
|
||||||
case ET_Motion: xi2type = XI_Motion; break;
|
xi2type = XI_Motion;
|
||||||
case ET_ButtonPress: xi2type = XI_ButtonPress; break;
|
break;
|
||||||
case ET_ButtonRelease: xi2type = XI_ButtonRelease; break;
|
case ET_ButtonPress:
|
||||||
case ET_KeyPress: xi2type = XI_KeyPress; break;
|
xi2type = XI_ButtonPress;
|
||||||
case ET_KeyRelease: xi2type = XI_KeyRelease; break;
|
break;
|
||||||
case ET_Enter: xi2type = XI_Enter; break;
|
case ET_ButtonRelease:
|
||||||
case ET_Leave: xi2type = XI_Leave; break;
|
xi2type = XI_ButtonRelease;
|
||||||
case ET_Hierarchy: xi2type = XI_HierarchyChanged; break;
|
break;
|
||||||
case ET_DeviceChanged: xi2type = XI_DeviceChanged; break;
|
case ET_KeyPress:
|
||||||
case ET_RawKeyPress: xi2type = XI_RawKeyPress; break;
|
xi2type = XI_KeyPress;
|
||||||
case ET_RawKeyRelease: xi2type = XI_RawKeyRelease; break;
|
break;
|
||||||
case ET_RawButtonPress: xi2type = XI_RawButtonPress; break;
|
case ET_KeyRelease:
|
||||||
case ET_RawButtonRelease: xi2type = XI_RawButtonRelease; break;
|
xi2type = XI_KeyRelease;
|
||||||
case ET_RawMotion: xi2type = XI_RawMotion; break;
|
break;
|
||||||
case ET_RawTouchBegin: xi2type = XI_RawTouchBegin; break;
|
case ET_Enter:
|
||||||
case ET_RawTouchUpdate: xi2type = XI_RawTouchUpdate; break;
|
xi2type = XI_Enter;
|
||||||
case ET_RawTouchEnd: xi2type = XI_RawTouchEnd; break;
|
break;
|
||||||
case ET_FocusIn: xi2type = XI_FocusIn; break;
|
case ET_Leave:
|
||||||
case ET_FocusOut: xi2type = XI_FocusOut; break;
|
xi2type = XI_Leave;
|
||||||
case ET_TouchBegin: xi2type = XI_TouchBegin; break;
|
break;
|
||||||
case ET_TouchEnd: xi2type = XI_TouchEnd; break;
|
case ET_Hierarchy:
|
||||||
case ET_TouchUpdate: xi2type = XI_TouchUpdate; break;
|
xi2type = XI_HierarchyChanged;
|
||||||
case ET_TouchOwnership: xi2type = XI_TouchOwnership; break;
|
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:
|
default:
|
||||||
break;
|
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