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 <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2009-06-10 14:41:11 +10:00
parent 77cc816da4
commit aa2babf11c
4 changed files with 12 additions and 6 deletions

View File

@ -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;

View File

@ -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;

View File

@ -53,6 +53,7 @@ SOFTWARE.
#include <X11/X.h>
#include "misc.h"
#include <X11/Xproto.h>
#include <X11/extensions/XI2.h>
#include "windowstr.h"
#include "inputstr.h"
#include "cursorstr.h"

View File

@ -55,7 +55,6 @@ SOFTWARE.
#include "cursorstr.h"
#include "geext.h"
#include "privates.h"
#include <X11/extensions/XI2proto.h>
#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