diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2009-05-16 11:31:03 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-05-16 11:49:34 +1000 |
commit | f4f09d40e0fd94d267b280f2a82385dca1141347 (patch) | |
tree | 164007e047575bdffe576102f86cab406b368618 /XI2.h | |
parent | 0ae6581bc62b3b734c84b12e9a92d945d3e98aa7 (diff) |
XI2.h: remove XI2Mask, add XISetMask and friends.
XISetMask, XIClearMask, XIMaskIsSet serve to set, clear or check a bit in
the provided array.
XIMaskLen is a macro to get the minimum length of a mask for a given event
type.
They are expected to be common ways to deal with event masks, i.e. clients
will do:
unsigned char mask[XIMaskLen(XI_ButtonRelease)] = {0};
XISetMask(mask, XI_ButtonPress)
XISetMask(mask, XI_ButtonRelease)
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'XI2.h')
-rw-r--r-- | XI2.h | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -89,9 +89,13 @@ #define XIButtonClass 1 #define XIValuatorClass 2 -/* XI2 mask macro */ -#define XIMASK(event) (1 << (event)) +/* XI2 event mask macros */ +#define XISetMask(ptr, event) (((unsigned char*)(ptr))[(event)>>3] |= (1 << ((event) & 7))) +#define XIClearMask(ptr, event) (((unsigned char*)(ptr))[(event)>>3] &= ~(1 << ((event) & 7))) +#define XIMaskIsSet(ptr, event) (((unsigned char*)(ptr))[(event)>>3] & (1 << ((event) & 7))) +#define XIMaskLen(event) ((event >> 3)) +/* Fake device ID's for event selection */ #define XIAllDevices 0 #define XIAllMasterDevices 1 |