dix: add a MAXEVENTS define for the number of core + extension events

Not including GenericEvents

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Walter Harms <wharms@bfs.de>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
This commit is contained in:
Peter Hutterer 2011-12-11 07:31:43 +10:00
parent adf8a0d62c
commit f0de5e3990
5 changed files with 8 additions and 7 deletions

View File

@ -367,9 +367,9 @@ extern int DeviceMotionNotify;
* time a button is pressed, the filter is modified to also contain the
* matching ButtonXMotion mask.
*/
Mask event_filters[MAXDEVICES][128];
Mask event_filters[MAXDEVICES][MAXEVENTS];
static const Mask default_filter[128] =
static const Mask default_filter[MAXEVENTS] =
{
NoSuchEvent, /* 0 */
NoSuchEvent, /* 1 */
@ -673,7 +673,7 @@ SetMaskForEvent(int deviceid, Mask mask, int event)
void
SetCriticalEvent(int event)
{
if (event >= 128)
if (event >= MAXEVENTS)
FatalError("SetCriticalEvent: bogus event number");
criticalEvents[event >> 3] |= 1 << (event & 7);
}

View File

@ -61,7 +61,6 @@ SOFTWARE.
#include "registry.h"
#include "xace.h"
#define LAST_EVENT 128
#define LAST_ERROR 255
static ExtensionEntry **extensions = (ExtensionEntry **)NULL;
@ -82,7 +81,7 @@ AddExtension(const char *name, int NumEvents, int NumErrors,
if (!MainProc || !SwappedMainProc || !MinorOpcodeProc)
return((ExtensionEntry *) NULL);
if ((lastEvent + NumEvents > LAST_EVENT) ||
if ((lastEvent + NumEvents > MAXEVENTS) ||
(unsigned)(lastError + NumErrors > LAST_ERROR)) {
LogMessage(X_ERROR, "Not enabling extension %s: maximum number of "
"events or errors exceeded.\n", name);

View File

@ -592,7 +592,7 @@ int (* SwappedProcVector[256]) (
ProcBadRequest
};
EventSwapPtr EventSwapVector[128] =
EventSwapPtr EventSwapVector[MAXEVENTS] =
{
(EventSwapPtr)SErrorEvent,
NotImplemented,

View File

@ -32,7 +32,7 @@
#include "input.h"
#include <X11/extensions/XI2proto.h>
extern Mask filters[MAXDEVICES][128];
extern Mask event_filters[MAXDEVICES][MAXEVENTS];
struct _ValuatorMask {
int8_t last_bit; /* highest bit set in mask */

View File

@ -89,6 +89,8 @@ OF THIS SOFTWARE.
#define MAXFORMATS 8
#define MAXDEVICES 40 /* input devices */
/* 128 event opcodes for core + extension events, excluding GE */
#define MAXEVENTS 128
#define EXTENSION_EVENT_BASE 64
#define EXTENSION_BASE 128