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

walter harms wharms at bfs.de
Sun Dec 11 04:22:01 PST 2011


looks good for me but not compile tested ntl

Reviewed-by: wharms <wharms at bfs.de>

Am 11.12.2011 03:55, schrieb Peter Hutterer:
> Not including GenericEvents
> 
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
>  dix/events.c         |    6 +++---
>  dix/extension.c      |    3 +--
>  dix/tables.c         |    2 +-
>  include/inpututils.h |    2 +-
>  include/misc.h       |    2 ++
>  5 files changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/dix/events.c b/dix/events.c
> index 5d0499e..9daeb3c 100644
> --- a/dix/events.c
> +++ b/dix/events.c
> @@ -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);
>  }
> diff --git a/dix/extension.c b/dix/extension.c
> index cc516b6..af9ba31 100644
> --- a/dix/extension.c
> +++ b/dix/extension.c
> @@ -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);

are you sure that > MAXEVENTS is ok ? perhaps >= was intended ?

re,
 wh

> diff --git a/dix/tables.c b/dix/tables.c
> index 5bd9ea0..45ae2a9 100644
> --- a/dix/tables.c
> +++ b/dix/tables.c
> @@ -592,7 +592,7 @@ int (* SwappedProcVector[256]) (
>      ProcBadRequest
>  };
>  
> -EventSwapPtr EventSwapVector[128] =
> +EventSwapPtr EventSwapVector[MAXEVENTS] =
>  {
>      (EventSwapPtr)SErrorEvent,
>      NotImplemented,
> diff --git a/include/inpututils.h b/include/inpututils.h
> index 5aa60c2..9e22c5a 100644
> --- a/include/inpututils.h
> +++ b/include/inpututils.h
> @@ -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 */
> diff --git a/include/misc.h b/include/misc.h
> index d9811ca..09f928a 100644
> --- a/include/misc.h
> +++ b/include/misc.h
> @@ -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
>  


More information about the xorg-devel mailing list