diff options
author | marha <marha@users.sourceforge.net> | 2013-08-26 09:04:58 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2013-08-26 09:04:58 +0200 |
commit | 5ee5b91b019005aa27273dff01388a68c12be293 (patch) | |
tree | d2db8b0d1533d2eea8bfe77f8a6b3d52fa3f633e /libX11/src/xkb/XKBGetMap.c | |
parent | 854ec4da20ddff9b830be0a7d5b81d8cb4774132 (diff) | |
download | vcxsrv-5ee5b91b019005aa27273dff01388a68c12be293.tar.gz vcxsrv-5ee5b91b019005aa27273dff01388a68c12be293.tar.bz2 vcxsrv-5ee5b91b019005aa27273dff01388a68c12be293.zip |
xserver mesa fontconfig libX11 libxcb libxcb/xcb-proto xkeyboard-config git update 26 Aug 2013
xserver commit e01a3f65d3e6d92f92ef2992b338cc9625bde082
libxcb commit c52f2891b43ae77008f63700982f800371458f4d
libxcb/xcb-proto commit bd7708ac1037e647b094fa7440ebb6171b9bc75f
xkeyboard-config commit 77026e8c59cc64856180452c5f89be86928fea7c
libX11 commit e9b14d10d0258bfcc273ff8bc84cd349dccda62c
libXdmcp commit 66514a4af7eaa47e8718434356d7efce95e570cf
libXext commit 7378d4bdbd33ed49ed6cfa5c4f73d7527982aab4
libfontenc commit 3acba630d8b57084f7e92c15732408711ed5137a
libXinerama commit 6e1d1dc328ba8162bba2f4694e7f3c706a1491ff
libXau commit 899790011304c4029e15abf410e49ce7cec17e0a
xkbcomp commit 0ebdf47fd4bc434ac3d2339544c022a869510738
pixman commit 3518a0dafa63098d41e466f73d105b7e3e4b12de
xextproto commit f27fcc99d1cf935cc289933326f7d3baacd5107a
randrproto commit ca7cc541c2e43e6c784df19b4583ac35829d2f72
glproto commit 8e3407e02980d088e20041e79bdcdd3737e7827e
mkfontscale commit f48de13423c7300f4da9f61993b624426b38ddc0
xwininfo commit ba0d1b0da21d2dbdd81098ed5778f3792b472e13
libXft commit c5e760a239afc62a1c75e0509868e35957c8df52
libXmu commit d5dac08d65c4865f311cb62c161dbb1300eecd11
libxtrans commit f6a161f2a003f4da0a2e414b4faa0ee0de0c01f0
fontconfig commit fba9efecd2ef3aca84e0a4806899c09ba95f4c19
mesa commit 7fa18774bd9d0e97a82ee9b7dfce8fc5a1041c3a
Diffstat (limited to 'libX11/src/xkb/XKBGetMap.c')
-rw-r--r-- | libX11/src/xkb/XKBGetMap.c | 1101 |
1 files changed, 565 insertions, 536 deletions
diff --git a/libX11/src/xkb/XKBGetMap.c b/libX11/src/xkb/XKBGetMap.c index c73e655ae..2278c7519 100644 --- a/libX11/src/xkb/XKBGetMap.c +++ b/libX11/src/xkb/XKBGetMap.c @@ -33,429 +33,445 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "XKBlibint.h" static Status -_XkbReadKeyTypes(XkbReadBufferPtr buf,XkbDescPtr xkb,xkbGetMapReply *rep) +_XkbReadKeyTypes(XkbReadBufferPtr buf, XkbDescPtr xkb, xkbGetMapReply *rep) { -int i,n,lastMapCount; -XkbKeyTypePtr type; - - if ( rep->nTypes>0 ) { - n = rep->firstType+rep->nTypes; - if (xkb->map->num_types>=n) - n= xkb->map->num_types; - else if (XkbAllocClientMap(xkb,XkbKeyTypesMask,n)!=Success) - return BadAlloc; - - type = &xkb->map->types[rep->firstType]; - for (i=0;i<(int)rep->nTypes;i++,type++) { - xkbKeyTypeWireDesc *desc; - register int ndx; - - ndx= i+rep->firstType; - if (ndx>=xkb->map->num_types) - xkb->map->num_types= ndx+1; - - desc= (xkbKeyTypeWireDesc *)_XkbGetReadBufferPtr(buf, - SIZEOF(xkbKeyTypeWireDesc)); - if (desc==NULL) - return BadLength; - - lastMapCount= type->map_count; - if ( desc->nMapEntries>0 ) { - if ((type->map==NULL)||(desc->nMapEntries>type->map_count)) { - XkbKTMapEntryRec *prev_map = type->map; - - type->map= _XkbTypedRealloc(type->map,desc->nMapEntries, - XkbKTMapEntryRec); - if (type->map==NULL) { - _XkbFree(prev_map); - return BadAlloc; - } - } - } - else if (type->map!=NULL) { - Xfree(type->map); - type->map_count= 0; - type->map= NULL; - } - - if ( desc->preserve && (desc->nMapEntries>0) ) { - if ((!type->preserve)|| - (desc->nMapEntries>lastMapCount)) { - XkbModsRec *prev_preserve = type->preserve; - - type->preserve= _XkbTypedRealloc(type->preserve, - desc->nMapEntries, - XkbModsRec); - if (type->preserve==NULL) { - _XkbFree(prev_preserve); - return BadAlloc; - } - } - } - else if (type->preserve!=NULL) { - Xfree(type->preserve); - type->preserve= NULL; - } - - type->mods.mask = desc->mask; - type->mods.real_mods = desc->realMods; - type->mods.vmods = desc->virtualMods; - type->num_levels = desc->numLevels; - type->map_count = desc->nMapEntries; - if (desc->nMapEntries>0) { - register xkbKTMapEntryWireDesc *wire; - register XkbKTMapEntryPtr entry; - register int size; - - size= type->map_count*SIZEOF(xkbKTMapEntryWireDesc); - wire= (xkbKTMapEntryWireDesc *)_XkbGetReadBufferPtr(buf,size); - if (wire==NULL) - return BadLength; - entry= type->map; - for (n=0;n<type->map_count;n++,wire++,entry++) { - entry->active= wire->active; - entry->level= wire->level; - entry->mods.mask= wire->mask; - entry->mods.real_mods= wire->realMods; - entry->mods.vmods= wire->virtualMods; - } - - if (desc->preserve) { - register xkbModsWireDesc * pwire; - register XkbModsPtr preserve; - register int sz; - - sz= desc->nMapEntries*SIZEOF(xkbModsWireDesc); - pwire=(xkbModsWireDesc *)_XkbGetReadBufferPtr(buf,sz); - if (pwire==NULL) - return BadLength; - preserve= type->preserve; - for (n=0;n<desc->nMapEntries;n++,pwire++,preserve++) { - preserve->mask= pwire->mask; - preserve->vmods= pwire->virtualMods; - preserve->real_mods= pwire->realMods; - } - } - } - } + int i, n, lastMapCount; + XkbKeyTypePtr type; + + if (rep->nTypes > 0) { + n = rep->firstType + rep->nTypes; + if (xkb->map->num_types >= n) + n = xkb->map->num_types; + else if (XkbAllocClientMap(xkb, XkbKeyTypesMask, n) != Success) + return BadAlloc; + + type = &xkb->map->types[rep->firstType]; + for (i = 0; i < (int) rep->nTypes; i++, type++) { + xkbKeyTypeWireDesc *desc; + register int ndx; + + ndx = i + rep->firstType; + if (ndx >= xkb->map->num_types) + xkb->map->num_types = ndx + 1; + + desc = (xkbKeyTypeWireDesc *) + _XkbGetReadBufferPtr(buf, SIZEOF(xkbKeyTypeWireDesc)); + if (desc == NULL) + return BadLength; + + lastMapCount = type->map_count; + if (desc->nMapEntries > 0) { + if ((type->map == NULL) || + (desc->nMapEntries > type->map_count)) { + XkbKTMapEntryRec *prev_map = type->map; + + type->map = _XkbTypedRealloc(type->map, desc->nMapEntries, + XkbKTMapEntryRec); + if (type->map == NULL) { + _XkbFree(prev_map); + return BadAlloc; + } + } + } + else if (type->map != NULL) { + Xfree(type->map); + type->map_count = 0; + type->map = NULL; + } + + if (desc->preserve && (desc->nMapEntries > 0)) { + if ((!type->preserve) || (desc->nMapEntries > lastMapCount)) { + XkbModsRec *prev_preserve = type->preserve; + + type->preserve = _XkbTypedRealloc(type->preserve, + desc->nMapEntries, + XkbModsRec); + if (type->preserve == NULL) { + _XkbFree(prev_preserve); + return BadAlloc; + } + } + } + else if (type->preserve != NULL) { + Xfree(type->preserve); + type->preserve = NULL; + } + + type->mods.mask = desc->mask; + type->mods.real_mods = desc->realMods; + type->mods.vmods = desc->virtualMods; + type->num_levels = desc->numLevels; + type->map_count = desc->nMapEntries; + if (desc->nMapEntries > 0) { + register xkbKTMapEntryWireDesc *wire; + register XkbKTMapEntryPtr entry; + register int size; + + size = type->map_count * SIZEOF(xkbKTMapEntryWireDesc); + wire = + (xkbKTMapEntryWireDesc *) _XkbGetReadBufferPtr(buf, size); + if (wire == NULL) + return BadLength; + entry = type->map; + for (n = 0; n < type->map_count; n++, wire++, entry++) { + entry->active = wire->active; + entry->level = wire->level; + entry->mods.mask = wire->mask; + entry->mods.real_mods = wire->realMods; + entry->mods.vmods = wire->virtualMods; + } + + if (desc->preserve) { + register xkbModsWireDesc *pwire; + register XkbModsPtr preserve; + register int sz; + + sz = desc->nMapEntries * SIZEOF(xkbModsWireDesc); + pwire = (xkbModsWireDesc *) _XkbGetReadBufferPtr(buf, sz); + if (pwire == NULL) + return BadLength; + preserve = type->preserve; + for (n = 0; n < desc->nMapEntries; n++, pwire++, preserve++) { + preserve->mask = pwire->mask; + preserve->vmods = pwire->virtualMods; + preserve->real_mods = pwire->realMods; + } + } + } + } } return Success; } static Status -_XkbReadKeySyms(XkbReadBufferPtr buf,XkbDescPtr xkb,xkbGetMapReply *rep) +_XkbReadKeySyms(XkbReadBufferPtr buf, XkbDescPtr xkb, xkbGetMapReply *rep) { -register int i; -XkbClientMapPtr map; - - map= xkb->map; - if (map->key_sym_map==NULL) { - register int offset; - int size = xkb->max_key_code + 1; - XkbSymMapPtr oldMap; - xkbSymMapWireDesc *newMap; - if (((unsigned short)rep->firstKeySym + rep->nKeySyms) > size) - return BadLength; - map->key_sym_map= _XkbTypedCalloc(size,XkbSymMapRec); - if (map->key_sym_map==NULL) - return BadAlloc; - if (map->syms==NULL) { - int sz; - sz= (rep->totalSyms*12)/10; - sz= ((sz+(unsigned)128)/128)*128; - map->syms = _XkbTypedCalloc(sz,KeySym); - if (map->syms==NULL) - return BadAlloc; - map->size_syms = sz; - } - offset = 1; - oldMap = &map->key_sym_map[rep->firstKeySym]; - for (i=0;i<(int)rep->nKeySyms;i++,oldMap++) { - newMap= (xkbSymMapWireDesc *) - _XkbGetReadBufferPtr(buf,SIZEOF(xkbSymMapWireDesc)); - if (newMap==NULL) - return BadLength; - oldMap->kt_index[0]= newMap->ktIndex[0]; - oldMap->kt_index[1]= newMap->ktIndex[1]; - oldMap->kt_index[2]= newMap->ktIndex[2]; - oldMap->kt_index[3]= newMap->ktIndex[3]; - oldMap->group_info= newMap->groupInfo; - oldMap->width= newMap->width; - oldMap->offset= offset; - if (offset+newMap->nSyms>=map->size_syms) { - register int sz; - KeySym *prev_syms = map->syms; - - sz= map->size_syms+128; - map->syms= _XkbTypedRealloc(map->syms,sz,KeySym); - if (map->syms==NULL) { - _XkbFree(prev_syms); - map->size_syms= 0; - return BadAlloc; - } - map->size_syms= sz; - } - if (newMap->nSyms>0) { - _XkbReadBufferCopyKeySyms(buf,(KeySym *)&map->syms[offset], - newMap->nSyms); - offset+= newMap->nSyms; - } - else { - map->syms[offset]= 0; - } - } - map->num_syms= offset; + register int i; + XkbClientMapPtr map; + int size = xkb->max_key_code + 1; + + if (((unsigned short) rep->firstKeySym + rep->nKeySyms) > size) + return BadLength; + + map = xkb->map; + if (map->key_sym_map == NULL) { + register int offset; + XkbSymMapPtr oldMap; + xkbSymMapWireDesc *newMap; + + map->key_sym_map = _XkbTypedCalloc(size, XkbSymMapRec); + if (map->key_sym_map == NULL) + return BadAlloc; + if (map->syms == NULL) { + int sz; + + sz = (rep->totalSyms * 12) / 10; + sz = ((sz + (unsigned) 128) / 128) * 128; + map->syms = _XkbTypedCalloc(sz, KeySym); + if (map->syms == NULL) + return BadAlloc; + map->size_syms = sz; + } + offset = 1; + oldMap = &map->key_sym_map[rep->firstKeySym]; + for (i = 0; i < (int) rep->nKeySyms; i++, oldMap++) { + newMap = (xkbSymMapWireDesc *) + _XkbGetReadBufferPtr(buf, SIZEOF(xkbSymMapWireDesc)); + if (newMap == NULL) + return BadLength; + oldMap->kt_index[0] = newMap->ktIndex[0]; + oldMap->kt_index[1] = newMap->ktIndex[1]; + oldMap->kt_index[2] = newMap->ktIndex[2]; + oldMap->kt_index[3] = newMap->ktIndex[3]; + oldMap->group_info = newMap->groupInfo; + oldMap->width = newMap->width; + oldMap->offset = offset; + if (offset + newMap->nSyms >= map->size_syms) { + register int sz; + KeySym *prev_syms = map->syms; + + sz = map->size_syms + 128; + map->syms = _XkbTypedRealloc(map->syms, sz, KeySym); + if (map->syms == NULL) { + _XkbFree(prev_syms); + map->size_syms = 0; + return BadAlloc; + } + map->size_syms = sz; + } + if (newMap->nSyms > 0) { + _XkbReadBufferCopyKeySyms(buf, (KeySym *) &map->syms[offset], + newMap->nSyms); + offset += newMap->nSyms; + } + else { + map->syms[offset] = 0; + } + } + map->num_syms = offset; } else { - xkbSymMapWireDesc * newMap; - XkbSymMapPtr oldMap; - KeySym * newSyms; - int tmp; - - if (((unsigned short)rep->firstKeySym + rep->nKeySyms) > map->num_syms) - return BadLength; - oldMap = &map->key_sym_map[rep->firstKeySym]; - for (i=0;i<(int)rep->nKeySyms;i++,oldMap++) { - newMap= (xkbSymMapWireDesc *) - _XkbGetReadBufferPtr(buf,SIZEOF(xkbSymMapWireDesc)); - if (newMap==NULL) - return BadLength; - - if (newMap->nSyms>0) - tmp= newMap->nSyms; - else tmp= 0; - - newSyms = XkbResizeKeySyms(xkb,i+rep->firstKeySym,tmp); - if (newSyms==NULL) - return BadAlloc; - if (newMap->nSyms>0) - _XkbReadBufferCopyKeySyms(buf,newSyms,newMap->nSyms); - else newSyms[0]= NoSymbol; - oldMap->kt_index[0] = newMap->ktIndex[0]; - oldMap->kt_index[1] = newMap->ktIndex[1]; - oldMap->kt_index[2] = newMap->ktIndex[2]; - oldMap->kt_index[3] = newMap->ktIndex[3]; - oldMap->group_info = newMap->groupInfo; - oldMap->width = newMap->width; - } + XkbSymMapPtr oldMap = &map->key_sym_map[rep->firstKeySym]; + + for (i = 0; i < (int) rep->nKeySyms; i++, oldMap++) { + xkbSymMapWireDesc *newMap; + KeySym *newSyms; + int tmp; + + newMap = (xkbSymMapWireDesc *) + _XkbGetReadBufferPtr(buf, SIZEOF(xkbSymMapWireDesc)); + if (newMap == NULL) + return BadLength; + + if (newMap->nSyms > 0) + tmp = newMap->nSyms; + else + tmp = 0; + + newSyms = XkbResizeKeySyms(xkb, i + rep->firstKeySym, tmp); + if (newSyms == NULL) + return BadAlloc; + if (newMap->nSyms > 0) + _XkbReadBufferCopyKeySyms(buf, newSyms, newMap->nSyms); + else + newSyms[0] = NoSymbol; + oldMap->kt_index[0] = newMap->ktIndex[0]; + oldMap->kt_index[1] = newMap->ktIndex[1]; + oldMap->kt_index[2] = newMap->ktIndex[2]; + oldMap->kt_index[3] = newMap->ktIndex[3]; + oldMap->group_info = newMap->groupInfo; + oldMap->width = newMap->width; + } } return Success; } static Status -_XkbReadKeyActions(XkbReadBufferPtr buf,XkbDescPtr info,xkbGetMapReply *rep) +_XkbReadKeyActions(XkbReadBufferPtr buf, XkbDescPtr info, xkbGetMapReply *rep) { -int i; -CARD8 numDescBuf[248]; -CARD8* numDesc = NULL; -register int nKeyActs; -Status ret = Success; - - if ( (nKeyActs=rep->nKeyActs)>0 ) { - XkbSymMapPtr symMap; - - if (nKeyActs < sizeof numDescBuf) numDesc = numDescBuf; - else numDesc = Xmalloc (nKeyActs * sizeof(CARD8)); - - if (!_XkbCopyFromReadBuffer(buf, (char *)numDesc, nKeyActs)) { - ret = BadLength; - goto done; - } - i= XkbPaddedSize(nKeyActs)-nKeyActs; - if ((i>0)&&(!_XkbSkipReadBufferData(buf,i))) { - ret = BadLength; - goto done; - } - symMap = &info->map->key_sym_map[rep->firstKeyAct]; - for (i=0;i<(int)rep->nKeyActs;i++,symMap++) { - if (numDesc[i]==0) { - if ((i + rep->firstKeyAct) > (info->max_key_code + 1)) { - ret = BadLength; - goto done; - } - info->server->key_acts[i+rep->firstKeyAct]= 0; - } - else { - XkbAction *newActs; - /* 8/16/93 (ef) -- XXX! Verify size here (numdesc must be */ - /* either zero or XkbKeyNumSyms(info,key) */ - newActs=XkbResizeKeyActions(info,i+rep->firstKeyAct, - numDesc[i]); - if (newActs==NULL) { - ret = BadAlloc; - goto done; - } - if (!_XkbCopyFromReadBuffer(buf,(char *)newActs, - (int)(numDesc[i]*sizeof(XkbAction)))) { - ret = BadLength; - goto done; - } - } - } + int i; + CARD8 numDescBuf[248]; + CARD8 *numDesc = NULL; + register int nKeyActs; + Status ret = Success; + + if ((nKeyActs = rep->nKeyActs) > 0) { + XkbSymMapPtr symMap; + + if (nKeyActs < sizeof numDescBuf) + numDesc = numDescBuf; + else + numDesc = Xmalloc(nKeyActs * sizeof(CARD8)); + + if (!_XkbCopyFromReadBuffer(buf, (char *) numDesc, nKeyActs)) { + ret = BadLength; + goto done; + } + i = XkbPaddedSize(nKeyActs) - nKeyActs; + if ((i > 0) && (!_XkbSkipReadBufferData(buf, i))) { + ret = BadLength; + goto done; + } + symMap = &info->map->key_sym_map[rep->firstKeyAct]; + for (i = 0; i < (int) rep->nKeyActs; i++, symMap++) { + if (numDesc[i] == 0) { + if ((i + rep->firstKeyAct) > (info->max_key_code + 1)) { + ret = BadLength; + goto done; + } + info->server->key_acts[i + rep->firstKeyAct] = 0; + } + else { + XkbAction *newActs; + + /* 8/16/93 (ef) -- XXX! Verify size here (numdesc must be */ + /* either zero or XkbKeyNumSyms(info,key) */ + newActs = XkbResizeKeyActions(info, i + rep->firstKeyAct, + numDesc[i]); + if (newActs == NULL) { + ret = BadAlloc; + goto done; + } + if (!_XkbCopyFromReadBuffer(buf, (char *) newActs, + (int) (numDesc[i] * sizeof(XkbAction)))) { + ret = BadLength; + goto done; + } + } + } } -done: - if (numDesc != NULL && numDesc != numDescBuf) Xfree (numDesc); + done: + if (numDesc != NULL && numDesc != numDescBuf) + Xfree(numDesc); return ret; } static Status -_XkbReadKeyBehaviors(XkbReadBufferPtr buf,XkbDescPtr xkb,xkbGetMapReply *rep) +_XkbReadKeyBehaviors(XkbReadBufferPtr buf, XkbDescPtr xkb, xkbGetMapReply *rep) { -register int i; -xkbBehaviorWireDesc *wire; - - if ( rep->totalKeyBehaviors>0 ) { - int size = xkb->max_key_code + 1; - if ( ((int) rep->firstKeyBehavior + rep->nKeyBehaviors) > size) - return BadLength; - if ( xkb->server->behaviors == NULL ) { - xkb->server->behaviors = _XkbTypedCalloc(size,XkbBehavior); - if (xkb->server->behaviors==NULL) - return BadAlloc; - } - else { - bzero(&xkb->server->behaviors[rep->firstKeyBehavior], - (rep->nKeyBehaviors*sizeof(XkbBehavior))); - } - for (i=0;i<rep->totalKeyBehaviors;i++) { - wire= (xkbBehaviorWireDesc *)_XkbGetReadBufferPtr(buf, - SIZEOF(xkbBehaviorWireDesc)); - if (wire==NULL || wire->key >= size) - return BadLength; - xkb->server->behaviors[wire->key].type= wire->type; - xkb->server->behaviors[wire->key].data= wire->data; - } + register int i; + + if (rep->totalKeyBehaviors > 0) { + int size = xkb->max_key_code + 1; + + if (((int) rep->firstKeyBehavior + rep->nKeyBehaviors) > size) + return BadLength; + if (xkb->server->behaviors == NULL) { + xkb->server->behaviors = _XkbTypedCalloc(size, XkbBehavior); + if (xkb->server->behaviors == NULL) + return BadAlloc; + } + else { + bzero(&xkb->server->behaviors[rep->firstKeyBehavior], + (rep->nKeyBehaviors * sizeof(XkbBehavior))); + } + for (i = 0; i < rep->totalKeyBehaviors; i++) { + xkbBehaviorWireDesc *wire; + + wire = (xkbBehaviorWireDesc *) _XkbGetReadBufferPtr(buf, + SIZEOF(xkbBehaviorWireDesc)); + if (wire == NULL || wire->key >= size) + return BadLength; + xkb->server->behaviors[wire->key].type = wire->type; + xkb->server->behaviors[wire->key].data = wire->data; + } } return Success; } static Status -_XkbReadVirtualMods(XkbReadBufferPtr buf,XkbDescPtr xkb,xkbGetMapReply *rep) +_XkbReadVirtualMods(XkbReadBufferPtr buf, XkbDescPtr xkb, xkbGetMapReply *rep) { - if ( rep->virtualMods ) { - register int i,bit,nVMods; - register char *data; - - for (i=nVMods=0,bit=1;i<XkbNumVirtualMods;i++,bit<<=1) { - if (rep->virtualMods&bit) - nVMods++; - } - data= _XkbGetReadBufferPtr(buf,XkbPaddedSize(nVMods)); - if (data==NULL) - return BadLength; - for (i=0,bit=1;(i<XkbNumVirtualMods)&&(nVMods>0);i++,bit<<=1) { - if (rep->virtualMods&bit) { - xkb->server->vmods[i]= *data++; - nVMods--; - } - } + if (rep->virtualMods) { + register int i, bit, nVMods; + register char *data; + + for (i = nVMods = 0, bit = 1; i < XkbNumVirtualMods; i++, bit <<= 1) { + if (rep->virtualMods & bit) + nVMods++; + } + data = _XkbGetReadBufferPtr(buf, XkbPaddedSize(nVMods)); + if (data == NULL) + return BadLength; + for (i = 0, bit = 1; (i < XkbNumVirtualMods) && (nVMods > 0); + i++, bit <<= 1) { + if (rep->virtualMods & bit) { + xkb->server->vmods[i] = *data++; + nVMods--; + } + } } return Success; } static Status -_XkbReadExplicitComponents( XkbReadBufferPtr buf, - XkbDescPtr xkb, - xkbGetMapReply * rep) +_XkbReadExplicitComponents(XkbReadBufferPtr buf, + XkbDescPtr xkb, + xkbGetMapReply *rep) { -register int i; -unsigned char *wire; - - if ( rep->totalKeyExplicit>0 ) { - int size = xkb->max_key_code + 1; - if ( ((int) rep->firstKeyExplicit + rep->nKeyExplicit) > size) - return BadLength; - if ( xkb->server->explicit == NULL ) { - xkb->server->explicit = _XkbTypedCalloc(size,unsigned char); - if (xkb->server->explicit==NULL) - return BadAlloc; - } - else { - bzero(&xkb->server->explicit[rep->firstKeyExplicit], - rep->nKeyExplicit); - } - i= XkbPaddedSize(2*rep->totalKeyExplicit); - wire=(unsigned char *)_XkbGetReadBufferPtr(buf,i); - if (!wire) - return BadLength; - for (i=0;i<rep->totalKeyExplicit;i++,wire+=2) { - if (wire[0] > xkb->max_key_code || wire[1] > xkb->max_key_code) - return BadLength; - xkb->server->explicit[wire[0]]= wire[1]; - } + register int i; + unsigned char *wire; + + if (rep->totalKeyExplicit > 0) { + int size = xkb->max_key_code + 1; + + if (((int) rep->firstKeyExplicit + rep->nKeyExplicit) > size) + return BadLength; + if (xkb->server->explicit == NULL) { + xkb->server->explicit = _XkbTypedCalloc(size, unsigned char); + + if (xkb->server->explicit == NULL) + return BadAlloc; + } + else { + bzero(&xkb->server->explicit[rep->firstKeyExplicit], + rep->nKeyExplicit); + } + i = XkbPaddedSize(2 * rep->totalKeyExplicit); + wire = (unsigned char *) _XkbGetReadBufferPtr(buf, i); + if (!wire) + return BadLength; + for (i = 0; i < rep->totalKeyExplicit; i++, wire += 2) { + if (wire[0] > xkb->max_key_code || wire[1] > xkb->max_key_code) + return BadLength; + xkb->server->explicit[wire[0]] = wire[1]; + } } return Success; } static Status -_XkbReadModifierMap(XkbReadBufferPtr buf,XkbDescPtr xkb,xkbGetMapReply *rep) +_XkbReadModifierMap(XkbReadBufferPtr buf, XkbDescPtr xkb, xkbGetMapReply *rep) { -register int i; -unsigned char *wire; - - if ( rep->totalModMapKeys>0 ) { - if ( ((int)rep->firstModMapKey + rep->nModMapKeys) > - (xkb->max_key_code + 1)) - return BadLength; - if ((xkb->map->modmap==NULL)&& - (XkbAllocClientMap(xkb,XkbModifierMapMask,0)!=Success)) { - return BadAlloc; - } - else { - bzero(&xkb->map->modmap[rep->firstModMapKey],rep->nModMapKeys); - } - i= XkbPaddedSize(2*rep->totalModMapKeys); - wire=(unsigned char *)_XkbGetReadBufferPtr(buf,i); - if (!wire) - return BadLength; - for (i=0;i<rep->totalModMapKeys;i++,wire+=2) { - if (wire[0] > xkb->max_key_code || wire[1] > xkb->max_key_code) - return BadLength; - xkb->map->modmap[wire[0]]= wire[1]; - } + register int i; + unsigned char *wire; + + if (rep->totalModMapKeys > 0) { + if (((int) rep->firstModMapKey + rep->nModMapKeys) > + (xkb->max_key_code + 1)) + return BadLength; + if ((xkb->map->modmap == NULL) && + (XkbAllocClientMap(xkb, XkbModifierMapMask, 0) != Success)) { + return BadAlloc; + } + else { + bzero(&xkb->map->modmap[rep->firstModMapKey], rep->nModMapKeys); + } + i = XkbPaddedSize(2 * rep->totalModMapKeys); + wire = (unsigned char *) _XkbGetReadBufferPtr(buf, i); + if (!wire) + return BadLength; + for (i = 0; i < rep->totalModMapKeys; i++, wire += 2) { + if (wire[0] > xkb->max_key_code || wire[1] > xkb->max_key_code) + return BadLength; + xkb->map->modmap[wire[0]] = wire[1]; + } } return Success; } static Status -_XkbReadVirtualModMap(XkbReadBufferPtr buf,XkbDescPtr xkb,xkbGetMapReply *rep) +_XkbReadVirtualModMap(XkbReadBufferPtr buf, + XkbDescPtr xkb, + xkbGetMapReply *rep) { -register int i; -xkbVModMapWireDesc * wire; -XkbServerMapPtr srv; - - if ( rep->totalVModMapKeys>0 ) { - if (((int) rep->firstVModMapKey + rep->nVModMapKeys) - > xkb->max_key_code + 1) - return BadLength; - if (((xkb->server==NULL)||(xkb->server->vmodmap==NULL))&& - (XkbAllocServerMap(xkb,XkbVirtualModMapMask,0)!=Success)) { - return BadAlloc; - } - else { - srv= xkb->server; - if (rep->nVModMapKeys > rep->firstVModMapKey) - bzero((char *)&srv->vmodmap[rep->firstVModMapKey], - (rep->nVModMapKeys - rep->firstVModMapKey) * - sizeof(unsigned short)); - } - srv= xkb->server; - i= rep->totalVModMapKeys*SIZEOF(xkbVModMapWireDesc); - wire=(xkbVModMapWireDesc *)_XkbGetReadBufferPtr(buf,i); - if (!wire) - return BadLength; - for (i=0;i<rep->totalVModMapKeys;i++,wire++) { - if ((wire->key>=xkb->min_key_code)&&(wire->key<=xkb->max_key_code)) - srv->vmodmap[wire->key]= wire->vmods; - } + register int i; + xkbVModMapWireDesc *wire; + XkbServerMapPtr srv; + + if (rep->totalVModMapKeys > 0) { + if (((int) rep->firstVModMapKey + rep->nVModMapKeys) + > xkb->max_key_code + 1) + return BadLength; + if (((xkb->server == NULL) || (xkb->server->vmodmap == NULL)) && + (XkbAllocServerMap(xkb, XkbVirtualModMapMask, 0) != Success)) { + return BadAlloc; + } + else { + srv = xkb->server; + if (rep->nVModMapKeys > rep->firstVModMapKey) + bzero((char *) &srv->vmodmap[rep->firstVModMapKey], + (rep->nVModMapKeys - rep->firstVModMapKey) * + sizeof(unsigned short)); + } + srv = xkb->server; + i = rep->totalVModMapKeys * SIZEOF(xkbVModMapWireDesc); + wire = (xkbVModMapWireDesc *) _XkbGetReadBufferPtr(buf, i); + if (!wire) + return BadLength; + for (i = 0; i < rep->totalVModMapKeys; i++, wire++) { + if ((wire->key >= xkb->min_key_code) && + (wire->key <= xkb->max_key_code)) + srv->vmodmap[wire->key] = wire->vmods; + } } return Success; } static xkbGetMapReq * -_XkbGetGetMapReq(Display *dpy,XkbDescPtr xkb) +_XkbGetGetMapReq(Display *dpy, XkbDescPtr xkb) { -xkbGetMapReq *req; + xkbGetMapReq *req; GetReq(kbGetMap, req); req->reqType = dpy->xkb_info->codes->major_opcode; @@ -474,142 +490,147 @@ xkbGetMapReq *req; } Status -_XkbReadGetMapReply( Display * dpy, - xkbGetMapReply *rep, - XkbDescPtr xkb, - int * nread_rtrn) +_XkbReadGetMapReply(Display *dpy, + xkbGetMapReply *rep, + XkbDescPtr xkb, + int *nread_rtrn) { -int extraData; -unsigned mask; + int extraData; + unsigned mask; - if ( xkb->device_spec == XkbUseCoreKbd ) - xkb->device_spec= rep->deviceID; - if ( rep->maxKeyCode < rep->minKeyCode ) - return BadImplementation; + if (xkb->device_spec == XkbUseCoreKbd) + xkb->device_spec = rep->deviceID; + if (rep->maxKeyCode < rep->minKeyCode) + return BadImplementation; xkb->min_key_code = rep->minKeyCode; xkb->max_key_code = rep->maxKeyCode; if (!xkb->map) { - mask= rep->present&XkbAllClientInfoMask; - if (mask&&(XkbAllocClientMap(xkb,mask,rep->nTypes)!=Success)) - return BadAlloc; + mask = rep->present & XkbAllClientInfoMask; + if (mask && (XkbAllocClientMap(xkb, mask, rep->nTypes) != Success)) + return BadAlloc; } if (!xkb->server) { - mask= rep->present&XkbAllServerInfoMask; - if (mask&&(XkbAllocServerMap(xkb,mask,rep->totalActs)!=Success)) - return BadAlloc; + mask = rep->present & XkbAllServerInfoMask; + if (mask && (XkbAllocServerMap(xkb, mask, rep->totalActs) != Success)) + return BadAlloc; } - extraData= (int)(rep->length*4); - extraData-= (SIZEOF(xkbGetMapReply)-SIZEOF(xGenericReply)); + extraData = (int) (rep->length * 4); + extraData -= (SIZEOF(xkbGetMapReply) - SIZEOF(xGenericReply)); if (rep->length) { - XkbReadBufferRec buf; - int left; - if (_XkbInitReadBuffer(dpy,&buf,extraData)) { - Status status= Success; - if (nread_rtrn!=NULL) - *nread_rtrn= extraData; - if (status==Success) - status= _XkbReadKeyTypes(&buf,xkb,rep); - if (status==Success) - status= _XkbReadKeySyms(&buf,xkb,rep); - if (status==Success) - status= _XkbReadKeyActions(&buf,xkb,rep); - if (status==Success) - status= _XkbReadKeyBehaviors(&buf,xkb,rep); - if (status==Success) - status= _XkbReadVirtualMods(&buf,xkb,rep); - if (status==Success) - status= _XkbReadExplicitComponents(&buf,xkb,rep); - if (status==Success) - status= _XkbReadModifierMap(&buf,xkb,rep); - if (status==Success) - status= _XkbReadVirtualModMap(&buf,xkb,rep); - left= _XkbFreeReadBuffer(&buf); - if (status!=Success) return status; - else if ( left || buf.error ) return BadLength; - } - else return BadAlloc; + XkbReadBufferRec buf; + int left; + + if (_XkbInitReadBuffer(dpy, &buf, extraData)) { + Status status = Success; + + if (nread_rtrn != NULL) + *nread_rtrn = extraData; + if (status == Success) + status = _XkbReadKeyTypes(&buf, xkb, rep); + if (status == Success) + status = _XkbReadKeySyms(&buf, xkb, rep); + if (status == Success) + status = _XkbReadKeyActions(&buf, xkb, rep); + if (status == Success) + status = _XkbReadKeyBehaviors(&buf, xkb, rep); + if (status == Success) + status = _XkbReadVirtualMods(&buf, xkb, rep); + if (status == Success) + status = _XkbReadExplicitComponents(&buf, xkb, rep); + if (status == Success) + status = _XkbReadModifierMap(&buf, xkb, rep); + if (status == Success) + status = _XkbReadVirtualModMap(&buf, xkb, rep); + left = _XkbFreeReadBuffer(&buf); + if (status != Success) + return status; + else if (left || buf.error) + return BadLength; + } + else + return BadAlloc; } return Success; } static Status -_XkbHandleGetMapReply(Display *dpy,XkbDescPtr xkb) +_XkbHandleGetMapReply(Display *dpy, XkbDescPtr xkb) { -xkbGetMapReply rep; + xkbGetMapReply rep; - if (!_XReply(dpy, (xReply *)&rep, - ( (SIZEOF(xkbGetMapReply)-SIZEOF(xGenericReply)) >> 2 ), - xFalse)) { - return BadImplementation; + if (!_XReply(dpy, (xReply *) &rep, + ((SIZEOF(xkbGetMapReply) - SIZEOF(xGenericReply)) >> 2), + xFalse)) { + return BadImplementation; } - return _XkbReadGetMapReply(dpy,&rep,xkb,NULL); + return _XkbReadGetMapReply(dpy, &rep, xkb, NULL); } Status -XkbGetUpdatedMap(Display *dpy,unsigned which,XkbDescPtr xkb) +XkbGetUpdatedMap(Display *dpy, unsigned which, XkbDescPtr xkb) { if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL))) - return BadAccess; + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return BadAccess; if (which) { - register xkbGetMapReq *req; - Status status; + register xkbGetMapReq *req; + Status status; - LockDisplay(dpy); + LockDisplay(dpy); - req = _XkbGetGetMapReq(dpy, xkb); - req->full = which; - status= _XkbHandleGetMapReply(dpy, xkb); + req = _XkbGetGetMapReq(dpy, xkb); + req->full = which; + status = _XkbHandleGetMapReply(dpy, xkb); - UnlockDisplay(dpy); - SyncHandle(); - return status; + UnlockDisplay(dpy); + SyncHandle(); + return status; } return Success; } XkbDescPtr -XkbGetMap(Display *dpy,unsigned which,unsigned deviceSpec) +XkbGetMap(Display *dpy, unsigned which, unsigned deviceSpec) { -XkbDescPtr xkb; + XkbDescPtr xkb; - xkb = _XkbTypedCalloc(1,XkbDescRec); + xkb = _XkbTypedCalloc(1, XkbDescRec); if (xkb) { - xkb->device_spec = deviceSpec; - xkb->map = _XkbTypedCalloc(1,XkbClientMapRec); - if ((xkb->map==NULL)|| - ((which)&&(XkbGetUpdatedMap(dpy,which,xkb)!=Success))) { - if (xkb->map) { - Xfree(xkb->map); - xkb->map= NULL; - } - Xfree(xkb); - return NULL; - } - xkb->dpy= dpy; + xkb->device_spec = deviceSpec; + xkb->map = _XkbTypedCalloc(1, XkbClientMapRec); + if ((xkb->map == NULL) || + ((which) && (XkbGetUpdatedMap(dpy, which, xkb) != Success))) { + if (xkb->map) { + Xfree(xkb->map); + xkb->map = NULL; + } + Xfree(xkb); + return NULL; + } + xkb->dpy = dpy; } return xkb; } Status -XkbGetKeyTypes(Display *dpy,unsigned first,unsigned num,XkbDescPtr xkb) +XkbGetKeyTypes(Display *dpy, unsigned first, unsigned num, XkbDescPtr xkb) { register xkbGetMapReq *req; Status status; if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL))) - return BadAccess; - if ((num<1)||(num>XkbMaxKeyTypes)) - return BadValue; + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return BadAccess; + if ((num < 1) || (num > XkbMaxKeyTypes)) + return BadValue; LockDisplay(dpy); req = _XkbGetGetMapReq(dpy, xkb); req->firstType = first; req->nTypes = num; - status= _XkbHandleGetMapReply(dpy, xkb); + status = _XkbHandleGetMapReply(dpy, xkb); UnlockDisplay(dpy); SyncHandle(); @@ -617,24 +638,24 @@ XkbGetKeyTypes(Display *dpy,unsigned first,unsigned num,XkbDescPtr xkb) } Status -XkbGetKeyActions(Display *dpy,unsigned first,unsigned num,XkbDescPtr xkb) +XkbGetKeyActions(Display *dpy, unsigned first, unsigned num, XkbDescPtr xkb) { register xkbGetMapReq *req; Status status; if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL))) - return BadAccess; + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return BadAccess; - if ((num<1)||(num>XkbMaxKeyCount)) - return BadValue; + if ((num < 1) || (num > XkbMaxKeyCount)) + return BadValue; LockDisplay(dpy); req = _XkbGetGetMapReq(dpy, xkb); req->firstKeyAct = first; req->nKeyActs = num; - status= _XkbHandleGetMapReply(dpy, xkb); + status = _XkbHandleGetMapReply(dpy, xkb); UnlockDisplay(dpy); SyncHandle(); @@ -642,24 +663,24 @@ XkbGetKeyActions(Display *dpy,unsigned first,unsigned num,XkbDescPtr xkb) } Status -XkbGetKeySyms(Display *dpy,unsigned first,unsigned num,XkbDescPtr xkb) +XkbGetKeySyms(Display *dpy, unsigned first, unsigned num, XkbDescPtr xkb) { register xkbGetMapReq *req; Status status; if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL))) - return BadAccess; + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return BadAccess; - if ((num<1)||(num>XkbMaxKeyCount)) - return BadValue; + if ((num < 1) || (num > XkbMaxKeyCount)) + return BadValue; LockDisplay(dpy); req = _XkbGetGetMapReq(dpy, xkb); req->firstKeySym = first; req->nKeySyms = num; - status= _XkbHandleGetMapReply(dpy, xkb); + status = _XkbHandleGetMapReply(dpy, xkb); UnlockDisplay(dpy); SyncHandle(); @@ -668,24 +689,24 @@ XkbGetKeySyms(Display *dpy,unsigned first,unsigned num,XkbDescPtr xkb) } Status -XkbGetKeyBehaviors(Display *dpy,unsigned first,unsigned num,XkbDescPtr xkb) +XkbGetKeyBehaviors(Display *dpy, unsigned first, unsigned num, XkbDescPtr xkb) { register xkbGetMapReq *req; Status status; if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL))) - return BadAccess; + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return BadAccess; - if ((num<1)||(num>XkbMaxKeyCount)) - return BadValue; + if ((num < 1) || (num > XkbMaxKeyCount)) + return BadValue; LockDisplay(dpy); req = _XkbGetGetMapReq(dpy, xkb); req->firstKeyBehavior = first; req->nKeyBehaviors = num; - status= _XkbHandleGetMapReply(dpy, xkb); + status = _XkbHandleGetMapReply(dpy, xkb); UnlockDisplay(dpy); SyncHandle(); @@ -693,20 +714,20 @@ XkbGetKeyBehaviors(Display *dpy,unsigned first,unsigned num,XkbDescPtr xkb) } Status -XkbGetVirtualMods(Display *dpy,unsigned which,XkbDescPtr xkb) +XkbGetVirtualMods(Display *dpy, unsigned which, XkbDescPtr xkb) { register xkbGetMapReq *req; Status status; if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL))) - return BadAccess; + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return BadAccess; LockDisplay(dpy); req = _XkbGetGetMapReq(dpy, xkb); req->virtualMods = which; - status= _XkbHandleGetMapReply(dpy, xkb); + status = _XkbHandleGetMapReply(dpy, xkb); UnlockDisplay(dpy); SyncHandle(); @@ -714,32 +735,34 @@ XkbGetVirtualMods(Display *dpy,unsigned which,XkbDescPtr xkb) } Status -XkbGetKeyExplicitComponents( Display * dpy, - unsigned first, - unsigned num, - XkbDescPtr xkb) +XkbGetKeyExplicitComponents(Display *dpy, + unsigned first, + unsigned num, + XkbDescPtr xkb) { register xkbGetMapReq *req; Status status; if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL))) - return BadAccess; + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return BadAccess; - if ((num<1)||(num>XkbMaxKeyCount)) - return BadValue; + if ((num < 1) || (num > XkbMaxKeyCount)) + return BadValue; LockDisplay(dpy); req = _XkbGetGetMapReq(dpy, xkb); req->firstKeyExplicit = first; req->nKeyExplicit = num; - if ((xkb!=NULL) && (xkb->server!=NULL) && (xkb->server->explicit!=NULL)) { - if ((num>0)&&(first>=xkb->min_key_code)&&(first+num<=xkb->max_key_code)) - bzero(&xkb->server->explicit[first],num); + if ((xkb != NULL) && (xkb->server != NULL) && + (xkb->server->explicit != NULL)) { + if ((num > 0) && (first >= xkb->min_key_code) && + (first + num <= xkb->max_key_code)) + bzero(&xkb->server->explicit[first], num); } if (xkb) - status= _XkbHandleGetMapReply(dpy, xkb); + status = _XkbHandleGetMapReply(dpy, xkb); else status = BadMatch; @@ -749,29 +772,33 @@ XkbGetKeyExplicitComponents( Display * dpy, } Status -XkbGetKeyModifierMap(Display *dpy,unsigned first,unsigned num,XkbDescPtr xkb) +XkbGetKeyModifierMap(Display *dpy, + unsigned first, + unsigned num, + XkbDescPtr xkb) { register xkbGetMapReq *req; Status status; if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL))) - return BadAccess; + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return BadAccess; - if ((num<1)||(num>XkbMaxKeyCount)) - return BadValue; + if ((num < 1) || (num > XkbMaxKeyCount)) + return BadValue; LockDisplay(dpy); req = _XkbGetGetMapReq(dpy, xkb); req->firstModMapKey = first; req->nModMapKeys = num; - if ((xkb!=NULL) && (xkb->map!=NULL) && (xkb->map->modmap!=NULL)) { - if ((num>0)&&(first>=xkb->min_key_code)&&(first+num<=xkb->max_key_code)) - bzero(&xkb->map->modmap[first],num); + if ((xkb != NULL) && (xkb->map != NULL) && (xkb->map->modmap != NULL)) { + if ((num > 0) && (first >= xkb->min_key_code) && + (first + num <= xkb->max_key_code)) + bzero(&xkb->map->modmap[first], num); } if (xkb) - status= _XkbHandleGetMapReply(dpy, xkb); + status = _XkbHandleGetMapReply(dpy, xkb); else status = BadMatch; @@ -781,30 +808,32 @@ XkbGetKeyModifierMap(Display *dpy,unsigned first,unsigned num,XkbDescPtr xkb) } Status -XkbGetKeyVirtualModMap(Display *dpy,unsigned first,unsigned num,XkbDescPtr xkb) +XkbGetKeyVirtualModMap(Display *dpy, unsigned first, unsigned num, + XkbDescPtr xkb) { register xkbGetMapReq *req; Status status; if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL))) - return BadAccess; + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return BadAccess; - if ((num<1)||(num>XkbMaxKeyCount)) - return BadValue; + if ((num < 1) || (num > XkbMaxKeyCount)) + return BadValue; LockDisplay(dpy); req = _XkbGetGetMapReq(dpy, xkb); req->firstVModMapKey = first; req->nVModMapKeys = num; - if ((xkb!=NULL) && (xkb->map!=NULL) && (xkb->map->modmap!=NULL)) { - if ((num>0)&&(first>=xkb->min_key_code)&&(first+num<=xkb->max_key_code)) - bzero(&xkb->server->vmodmap[first],num*sizeof(unsigned short)); + if ((xkb != NULL) && (xkb->map != NULL) && (xkb->map->modmap != NULL)) { + if ((num > 0) && (first >= xkb->min_key_code) && + (first + num <= xkb->max_key_code)) + bzero(&xkb->server->vmodmap[first], num * sizeof(unsigned short)); } if (xkb) - status= _XkbHandleGetMapReply(dpy, xkb); + status = _XkbHandleGetMapReply(dpy, xkb); else status = BadMatch; @@ -814,40 +843,40 @@ XkbGetKeyVirtualModMap(Display *dpy,unsigned first,unsigned num,XkbDescPtr xkb) } Status -XkbGetMapChanges(Display *dpy,XkbDescPtr xkb,XkbMapChangesPtr changes) +XkbGetMapChanges(Display *dpy, XkbDescPtr xkb, XkbMapChangesPtr changes) { xkbGetMapReq *req; if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL))) - return BadAccess; + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return BadAccess; LockDisplay(dpy); if (changes->changed) { - Status status= Success; - req = _XkbGetGetMapReq(dpy, xkb); - req->full = 0; - req->partial = changes->changed; - req->firstType = changes->first_type; - req->nTypes = changes->num_types; - req->firstKeySym = changes->first_key_sym; - req->nKeySyms = changes->num_key_syms; - req->firstKeyAct = changes->first_key_act; - req->nKeyActs = changes->num_key_acts; - req->firstKeyBehavior = changes->first_key_behavior; - req->nKeyBehaviors = changes->num_key_behaviors; - req->virtualMods = changes->vmods; - req->firstKeyExplicit = changes->first_key_explicit; - req->nKeyExplicit = changes->num_key_explicit; - req->firstModMapKey = changes->first_modmap_key; - req->nModMapKeys = changes->num_modmap_keys; - req->firstVModMapKey = changes->first_vmodmap_key; - req->nVModMapKeys = changes->num_vmodmap_keys; - status= _XkbHandleGetMapReply(dpy, xkb); - UnlockDisplay(dpy); - SyncHandle(); - return status; + Status status = Success; + + req = _XkbGetGetMapReq(dpy, xkb); + req->full = 0; + req->partial = changes->changed; + req->firstType = changes->first_type; + req->nTypes = changes->num_types; + req->firstKeySym = changes->first_key_sym; + req->nKeySyms = changes->num_key_syms; + req->firstKeyAct = changes->first_key_act; + req->nKeyActs = changes->num_key_acts; + req->firstKeyBehavior = changes->first_key_behavior; + req->nKeyBehaviors = changes->num_key_behaviors; + req->virtualMods = changes->vmods; + req->firstKeyExplicit = changes->first_key_explicit; + req->nKeyExplicit = changes->num_key_explicit; + req->firstModMapKey = changes->first_modmap_key; + req->nModMapKeys = changes->num_modmap_keys; + req->firstVModMapKey = changes->first_vmodmap_key; + req->nVModMapKeys = changes->num_vmodmap_keys; + status = _XkbHandleGetMapReply(dpy, xkb); + UnlockDisplay(dpy); + SyncHandle(); + return status; } UnlockDisplay(dpy); return Success; } - |