diff options
author | marha <marha@users.sourceforge.net> | 2009-09-15 10:39:59 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2009-09-15 10:39:59 +0000 |
commit | a233ed27754bb0d373d63569d9a28aeb8fee5b82 (patch) | |
tree | 2732a9434bbc102653dc22df9887d94e19570836 /xorg-server/xkb/xkbUtils.c | |
parent | a915739887477b28d924ecc8417ee107d125bd6c (diff) | |
download | vcxsrv-a233ed27754bb0d373d63569d9a28aeb8fee5b82.tar.gz vcxsrv-a233ed27754bb0d373d63569d9a28aeb8fee5b82.tar.bz2 vcxsrv-a233ed27754bb0d373d63569d9a28aeb8fee5b82.zip |
Checked in xorg-server-1.6.99.901
Diffstat (limited to 'xorg-server/xkb/xkbUtils.c')
-rw-r--r-- | xorg-server/xkb/xkbUtils.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/xorg-server/xkb/xkbUtils.c b/xorg-server/xkb/xkbUtils.c index 63b1e31c7..75e243ca5 100644 --- a/xorg-server/xkb/xkbUtils.c +++ b/xorg-server/xkb/xkbUtils.c @@ -2118,3 +2118,38 @@ XkbCopyDeviceKeymap(DeviceIntPtr dst, DeviceIntPtr src) return ret; } +int +XkbGetEffectiveGroup(XkbSrvInfoPtr xkbi, XkbStatePtr xkbState, CARD8 keycode) +{ + XkbDescPtr xkb = xkbi->desc; + int effectiveGroup = xkbState->group; + + if (!XkbKeycodeInRange(xkb, keycode)) + return -1; + + if (effectiveGroup == XkbGroup1Index) + return effectiveGroup; + + if (XkbKeyNumGroups(xkb,keycode) > 1U) { + if (effectiveGroup >= XkbKeyNumGroups(xkb,keycode)) { + unsigned int gi = XkbKeyGroupInfo(xkb,keycode); + switch (XkbOutOfRangeGroupAction(gi)) { + default: + case XkbWrapIntoRange: + effectiveGroup %= XkbKeyNumGroups(xkb, keycode); + break; + case XkbClampIntoRange: + effectiveGroup = XkbKeyNumGroups(xkb, keycode) - 1; + break; + case XkbRedirectIntoRange: + effectiveGroup = XkbOutOfRangeGroupInfo(gi); + if (effectiveGroup >= XkbKeyNumGroups(xkb, keycode)) + effectiveGroup = 0; + break; + } + } + } + else effectiveGroup = XkbGroup1Index; + + return effectiveGroup; +} |