From aa2babf11c30be4d289b58212dc330b84efb4053 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 10 Jun 2009 14:41:11 +1000 Subject: [PATCH] input: remove dependency on XI2 protocol for XI_LASTEVENT. inputstr includes XI2proto.h for the sole purpose of XI_LASTEVENT. However, using XI_LASTEVENT in the server is prone to errors, if the server is recompiled against a newer version of the protocol it would bump this variable and associates bits, including potential ABI. This patch defines an XI2LASTEVENT for use in the server and removes the XI2proto.h require. XI2LASTEVENT is the current value of XI_LASTEVENT. This patch is required by components that require access to inputInfo (currently xf86-video-geode and xf86-video-cirrus) but should not have a require for the XI2 protocol. Signed-off-by: Peter Hutterer --- Xi/xipassivegrab.c | 4 ++-- Xi/xiselectev.c | 4 ++-- dix/grabs.c | 1 + include/inputstr.h | 9 +++++++-- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Xi/xipassivegrab.c b/Xi/xipassivegrab.c index 25ecc035ca..a5a9570383 100644 --- a/Xi/xipassivegrab.c +++ b/Xi/xipassivegrab.c @@ -120,10 +120,10 @@ ProcXIPassiveGrabDevice(ClientPtr client) return BadValue; } - if ((stuff->mask_len * 4) > XI_LASTEVENT) + if ((stuff->mask_len * 4) > XI2LASTEVENT) { unsigned char *bits = (unsigned char*)&stuff[1]; - for (i = XI_LASTEVENT; i < stuff->mask_len * 4; i++) + for (i = XI2LASTEVENT; i < stuff->mask_len * 4; i++) { if (BitIsOn(bits, i)) return BadValue; diff --git a/Xi/xiselectev.c b/Xi/xiselectev.c index e6f36a7620..6498d8677a 100644 --- a/Xi/xiselectev.c +++ b/Xi/xiselectev.c @@ -108,10 +108,10 @@ ProcXISelectEvents(ClientPtr client) return BadValue; } - if ((evmask->mask_len * 4) >= (XI_LASTEVENT + 8)/8) + if ((evmask->mask_len * 4) >= (XI2LASTEVENT + 8)/8) { unsigned char *bits = (unsigned char*)&evmask[1]; - for (i = XI_LASTEVENT + 1; i < evmask->mask_len * 4; i++) + for (i = XI2LASTEVENT + 1; i < evmask->mask_len * 4; i++) { if (BitIsOn(bits, i)) return BadValue; diff --git a/dix/grabs.c b/dix/grabs.c index cc77477147..06d6d037c2 100644 --- a/dix/grabs.c +++ b/dix/grabs.c @@ -53,6 +53,7 @@ SOFTWARE. #include #include "misc.h" #include +#include #include "windowstr.h" #include "inputstr.h" #include "cursorstr.h" diff --git a/include/inputstr.h b/include/inputstr.h index f233034b03..ffeedb1fa1 100644 --- a/include/inputstr.h +++ b/include/inputstr.h @@ -55,7 +55,6 @@ SOFTWARE. #include "cursorstr.h" #include "geext.h" #include "privates.h" -#include #define BitIsOn(ptr, bit) (((BYTE *) (ptr))[(bit)>>3] & (1 << ((bit) & 7))) #define SetBit(ptr, bit) (((BYTE *) (ptr))[(bit)>>3] |= (1 << ((bit) & 7))) @@ -65,7 +64,13 @@ SOFTWARE. (CLIENT_BITS((obj)->resource) == (client)->clientAsMask) #define EMASKSIZE MAXDEVICES + 2 -#define XI2MASKSIZE ((XI_LASTEVENT + 7)/8) /* no of bits for masks */ + +/* This is the last XI2 event supported by the server. If you add + * events to the protocol, the server will not support these events until + * this number here is bumped. + */ +#define XI2LASTEVENT 13 /* XI_PropertyEvent */ +#define XI2MASKSIZE ((XI2LASTEVENT + 7)/8) /* no of bits for masks */ /** * This struct stores the core event mask for each client except the client