summaryrefslogtreecommitdiff
path: root/xkb
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2010-10-11 16:09:18 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2010-10-20 08:01:54 +1000
commit649293f6b634e6305b6737a841d6e9d0f0065d6c (patch)
tree501fc7031e0b737427e4a67d08795396b4b6db22 /xkb
parentca21a266224b6eff4fd817c2082d2e144f1ea58c (diff)
xkb: always fill the symsPerKey array, regardless of client flags (#30527)
Even if a client does not modify the symbols, symsPerKey and mapWidths must be filled from the current configuration. Both arrays are then passed into other functions (pending the right flag), thus they must contain valid values regardless of the XkbKeySymsMask flag in req->present. X.Org Bug 30527 <http://bugs.freedesktop.org/show_bug.cgi?id=30527> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Diffstat (limited to 'xkb')
-rw-r--r--xkb/xkb.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/xkb/xkb.c b/xkb/xkb.c
index 7d95bc0e3..bbb1d9df8 100644
--- a/xkb/xkb.c
+++ b/xkb/xkb.c
@@ -1677,20 +1677,6 @@ xkbSymMapWireDesc* wire = *wireRtrn;
if (!(XkbKeySymsMask&req->present))
return 1;
CHK_REQ_KEY_RANGE2(0x11,req->firstKeySym,req->nKeySyms,req,(*errorRtrn),0);
- map = &xkb->map->key_sym_map[xkb->min_key_code];
- for (i=xkb->min_key_code;i<(unsigned)req->firstKeySym;i++,map++) {
- register int g,ng,w;
- ng= XkbNumGroups(map->group_info);
- for (w=g=0;g<ng;g++) {
- if (map->kt_index[g]>=(unsigned)nTypes) {
- *errorRtrn = _XkbErrCode4(0x13,i,g,map->kt_index[g]);
- return 0;
- }
- if (mapWidths[map->kt_index[g]]>w)
- w= mapWidths[map->kt_index[g]];
- }
- symsPerKey[i] = w*ng;
- }
for (i=0;i<req->nKeySyms;i++) {
KeySym *pSyms;
register unsigned nG;
@@ -2345,6 +2331,8 @@ _XkbSetMapChecks(ClientPtr client, DeviceIntPtr dev, xkbSetMapReq *req, char* va
int nTypes = 0, nActions;
CARD8 mapWidths[XkbMaxLegalKeyCode + 1] = {0};
CARD16 symsPerKey[XkbMaxLegalKeyCode + 1] = {0};
+ XkbSymMapPtr map;
+ int i;
xkbi= dev->key->xkbInfo;
xkb = xkbi->desc;
@@ -2373,6 +2361,23 @@ _XkbSetMapChecks(ClientPtr client, DeviceIntPtr dev, xkbSetMapReq *req, char* va
client->errorValue = nTypes;
return BadValue;
}
+
+ /* symsPerKey/mapWidths must be filled regardless of client-side flags */
+ map = &xkb->map->key_sym_map[xkb->min_key_code];
+ for (i=xkb->min_key_code;i<xkb->max_key_code;i++,map++) {
+ register int g,ng,w;
+ ng= XkbNumGroups(map->group_info);
+ for (w=g=0;g<ng;g++) {
+ if (map->kt_index[g]>=(unsigned)nTypes) {
+ client->errorValue = _XkbErrCode4(0x13,i,g,map->kt_index[g]);
+ return 0;
+ }
+ if (mapWidths[map->kt_index[g]]>w)
+ w= mapWidths[map->kt_index[g]];
+ }
+ symsPerKey[i] = w*ng;
+ }
+
if ((req->present & XkbKeySymsMask) &&
(!CheckKeySyms(client,xkb,req,nTypes,mapWidths,symsPerKey,
(xkbSymMapWireDesc **)&values,&error))) {