From a233ed27754bb0d373d63569d9a28aeb8fee5b82 Mon Sep 17 00:00:00 2001 From: marha Date: Tue, 15 Sep 2009 10:39:59 +0000 Subject: Checked in xorg-server-1.6.99.901 --- xorg-server/xkb/xkbUtils.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'xorg-server/xkb/xkbUtils.c') 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; +} -- cgit v1.2.3