diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2009-02-01 09:57:27 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-02-23 17:52:38 +1000 |
commit | 269d4d9f2e86fde8c6a28ef0293fb0e44b577886 (patch) | |
tree | 93046415968614892a06e0af6e362edf6d499026 /dix/eventconvert.c | |
parent | 656491921e17b2371057041f4551ad6165067551 (diff) |
dix: add GetCoreType and GetXIType.
Convert from an InternalEvent type to the matching core/XI type. Currently
only for a few events, those we actually need in the server.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'dix/eventconvert.c')
-rw-r--r-- | dix/eventconvert.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/dix/eventconvert.c b/dix/eventconvert.c index c3658112d..2ade378f8 100644 --- a/dix/eventconvert.c +++ b/dix/eventconvert.c @@ -288,3 +288,43 @@ eventToClassesChanged(DeviceChangedEvent *ev, EventListPtr events, int *count) *count = 1; return Success; } + +/** + * Return the corresponding core type for the given @event or 0 if no core + * equivalent exists. + */ +int +GetCoreType(InternalEvent *event) +{ + int coretype = 0; + switch(event->u.any.type) + { + case ET_Motion: coretype = MotionNotify; break; + case ET_ButtonPress: coretype = ButtonPress; break; + case ET_ButtonRelease: coretype = ButtonRelease; break; + case ET_KeyPress: coretype = KeyPress; break; + case ET_KeyRelease: coretype = KeyRelease; break; + } + return coretype; +} + +/** + * Return the corresponding XI 1.x type for the given @event or 0 if no + * equivalent exists. + */ +int +GetXIType(InternalEvent *event) +{ + int xitype = 0; + switch(event->u.any.type) + { + case ET_Motion: xitype = DeviceMotionNotify; break; + case ET_ButtonPress: xitype = DeviceButtonPress; break; + case ET_ButtonRelease: xitype = DeviceButtonRelease; break; + case ET_KeyPress: xitype = DeviceKeyPress; break; + case ET_KeyRelease: xitype = DeviceKeyRelease; break; + case ET_ProximityIn: xitype = ProximityIn; break; + case ET_ProximityOut: xitype = ProximityOut; break; + } + return xitype; +} |