diff options
-rw-r--r-- | dix/events.c | 28 | ||||
-rw-r--r-- | dix/inpututils.c | 19 | ||||
-rw-r--r-- | include/input.h | 1 | ||||
-rw-r--r-- | include/inpututils.h | 4 |
4 files changed, 31 insertions, 21 deletions
diff --git a/dix/events.c b/dix/events.c index e98f7b2aa..357b8d1db 100644 --- a/dix/events.c +++ b/dix/events.c @@ -367,7 +367,7 @@ extern int DeviceMotionNotify; * time a button is pressed, the filter is modified to also contain the * matching ButtonXMotion mask. */ -static Mask filters[MAXDEVICES][128]; +Mask event_filters[MAXDEVICES][128]; static const Mask default_filter[128] = { @@ -408,18 +408,6 @@ static const Mask default_filter[128] = CantBeFiltered /* MappingNotify */ }; -static inline Mask -GetEventFilterMask(DeviceIntPtr dev, int evtype) -{ - return filters[dev ? dev->id : 0][evtype]; -} - -inline Mask -GetXI2EventFilterMask(int evtype) -{ - return (1 << (evtype % 8)); -} - /** * For the given event, return the matching event filter. This filter may then * be AND'ed with the selected event mask. @@ -441,9 +429,9 @@ GetEventFilter(DeviceIntPtr dev, xEvent *event) int evtype = 0; if (event->u.u.type != GenericEvent) - return GetEventFilterMask(dev, event->u.u.type); + return event_get_filter_from_type(dev, event->u.u.type); else if ((evtype = xi2_get_type(event))) - return GetXI2EventFilterMask(evtype); + return event_get_filter_from_xi2type(evtype); ErrorF("[dix] Unknown event type %d. No filter\n", event->u.u.type); return 0; } @@ -459,7 +447,7 @@ GetXI2MaskByte(XI2Mask *mask, DeviceIntPtr dev, int event_type) * for this mask anyway. */ if (xi2mask_isset(mask, dev, event_type)) - return GetXI2EventFilterMask(event_type); + return event_get_filter_from_xi2type(event_type); else return 0; } @@ -679,7 +667,7 @@ SetMaskForEvent(int deviceid, Mask mask, int event) { if (deviceid < 0 || deviceid >= MAXDEVICES) FatalError("SetMaskForEvent: bogus device id"); - filters[deviceid][event] = mask; + event_filters[deviceid][event] = mask; } void @@ -2554,7 +2542,7 @@ EventIsDeliverable(DeviceIntPtr dev, int evtype, WindowPtr win) if ((type = GetXIType(evtype)) != 0) { - filter = GetEventFilterMask(dev, type); + filter = event_get_filter_from_type(dev, type); /* Check for XI mask */ if (inputMasks && @@ -2570,7 +2558,7 @@ EventIsDeliverable(DeviceIntPtr dev, int evtype, WindowPtr win) if ((type = GetCoreType(evtype)) != 0) { - filter = GetEventFilterMask(dev, type); + filter = event_get_filter_from_type(dev, type); /* Check for core mask */ if ((win->deliverableEvents & filter) && @@ -5350,7 +5338,7 @@ InitEvents(void) inputInfo.pointer = (DeviceIntPtr)NULL; for (i = 0; i < MAXDEVICES; i++) { - memcpy(&filters[i], default_filter, sizeof(default_filter)); + memcpy(&event_filters[i], default_filter, sizeof(default_filter)); } syncEvents.replayDev = (DeviceIntPtr)NULL; diff --git a/dix/inpututils.c b/dix/inpututils.c index 5844daf9c..9232bdc29 100644 --- a/dix/inpututils.c +++ b/dix/inpututils.c @@ -695,6 +695,25 @@ void event_set_state(DeviceIntPtr mouse, DeviceIntPtr kbd, DeviceEvent *event) } } +/** + * Return the event filter mask for the given device and the given core or + * XI1 protocol type. + */ +Mask +event_get_filter_from_type(DeviceIntPtr dev, int evtype) +{ + return event_filters[dev ? dev->id : 0][evtype]; +} + +/** + * Return the event filter mask for the given device and the given core or + * XI2 protocol type. + */ +Mask +event_get_filter_from_xi2type(int evtype) +{ + return (1 << (evtype % 8)); +} Bool point_on_screen(ScreenPtr pScreen, int x, int y) diff --git a/include/input.h b/include/input.h index fb24fd5ec..bd12f6829 100644 --- a/include/input.h +++ b/include/input.h @@ -544,7 +544,6 @@ extern _X_EXPORT void FreeInputAttributes(InputAttributes *attrs); extern Mask GetEventMask(DeviceIntPtr dev, xEvent* ev, InputClientsPtr clients); extern Mask GetEventFilter(DeviceIntPtr dev, xEvent *event); extern Bool WindowXI2MaskIsset(DeviceIntPtr dev, WindowPtr win, xEvent* ev); -extern Mask GetXI2EventFilterMask(int evtype); extern int GetXI2MaskByte(XI2Mask *mask, DeviceIntPtr dev, int event_type); void FixUpEventFromWindow(SpritePtr pSprite, xEvent *xE, diff --git a/include/inpututils.h b/include/inpututils.h index 96ad6df4d..5aa60c2c1 100644 --- a/include/inpututils.h +++ b/include/inpututils.h @@ -32,6 +32,8 @@ #include "input.h" #include <X11/extensions/XI2proto.h> +extern Mask filters[MAXDEVICES][128]; + struct _ValuatorMask { int8_t last_bit; /* highest bit set in mask */ uint8_t mask[(MAX_VALUATORS + 7)/8]; @@ -42,6 +44,8 @@ extern void verify_internal_event(const InternalEvent *ev); extern void init_device_event(DeviceEvent *event, DeviceIntPtr dev, Time ms); extern int event_get_corestate(DeviceIntPtr mouse, DeviceIntPtr kbd); extern void event_set_state(DeviceIntPtr mouse, DeviceIntPtr kbd, DeviceEvent *event); +extern Mask event_get_filter_from_type(DeviceIntPtr dev, int evtype); +extern Mask event_get_filter_from_xi2type(int evtype); FP3232 double_to_fp3232(double in); FP1616 double_to_fp1616(double in); |