diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2009-05-04 17:38:02 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-05-06 14:37:33 +1000 |
commit | d220d6907d1d5138d1528c48b739e77f65616225 (patch) | |
tree | caaaa8b401f9de2115f649557afeb74d9917fc87 /xkb | |
parent | 1b593ced171d02f1d00034f0f733060706bb6d41 (diff) |
Xi: add GrabButton and GrabKeysym code.
We don't do keycode grabs in XI2, they're pointless.
Diffstat (limited to 'xkb')
-rw-r--r-- | xkb/xkbUtils.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c index 5ae426dbb..0bd41cd34 100644 --- a/xkb/xkbUtils.c +++ b/xkb/xkbUtils.c @@ -2116,3 +2116,33 @@ XkbCopyDeviceKeymap(DeviceIntPtr dst, DeviceIntPtr src) return ret; } + +int +XkbGetKeysym(DeviceIntPtr dev, DeviceEvent *event) +{ + XkbDescPtr xkb = dev->key->xkbInfo->desc; + XkbKeyTypePtr kt; + int group; + int i, level = 0; + int modmask; + + group = event->group.base + event->group.latched + event->group.locked; + + if (group >= xkb->ctrls->num_groups) + group = XkbAdjustGroup(group, xkb->ctrls); + + modmask = event->mods.base | event->mods.latched; /* don't care about + locked mods */ + kt = XkbKeyKeyType(xkb, event->detail.key, group); + + for (i = 0; i < kt->map_count; i++) + { + if (kt->map[i].mods.mask == modmask) + { + level = kt->map[i].level; + break; + } + } + + return XkbKeySymEntry(xkb, event->detail.key, level, group); +} |