dix: SetKeySymMap should alloc the map if dst doesn't have one already.
This commit is contained in:
parent
b40646dc10
commit
53539688ca
|
@ -1046,10 +1046,9 @@ SetKeySymsMap(KeySymsPtr dst, KeySymsPtr src)
|
||||||
KeySym *map;
|
KeySym *map;
|
||||||
int bytes = sizeof(KeySym) * src->mapWidth *
|
int bytes = sizeof(KeySym) * src->mapWidth *
|
||||||
(dst->maxKeyCode - dst->minKeyCode + 1);
|
(dst->maxKeyCode - dst->minKeyCode + 1);
|
||||||
map = (KeySym *)xalloc(bytes);
|
map = (KeySym *)xcalloc(1, bytes);
|
||||||
if (!map)
|
if (!map)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
bzero((char *)map, bytes);
|
|
||||||
if (dst->map)
|
if (dst->map)
|
||||||
{
|
{
|
||||||
for (i = 0; i <= dst->maxKeyCode-dst->minKeyCode; i++)
|
for (i = 0; i <= dst->maxKeyCode-dst->minKeyCode; i++)
|
||||||
|
@ -1060,6 +1059,15 @@ SetKeySymsMap(KeySymsPtr dst, KeySymsPtr src)
|
||||||
}
|
}
|
||||||
dst->mapWidth = src->mapWidth;
|
dst->mapWidth = src->mapWidth;
|
||||||
dst->map = map;
|
dst->map = map;
|
||||||
|
} else if (!dst->map)
|
||||||
|
{
|
||||||
|
KeySym *map;
|
||||||
|
int bytes = sizeof(KeySym) * src->mapWidth *
|
||||||
|
(dst->maxKeyCode - dst->minKeyCode + 1);
|
||||||
|
map = (KeySym *)xcalloc(1, bytes);
|
||||||
|
if (!map)
|
||||||
|
return FALSE;
|
||||||
|
dst->map = map;
|
||||||
}
|
}
|
||||||
memmove((char *)&dst->map[rowDif * dst->mapWidth],
|
memmove((char *)&dst->map[rowDif * dst->mapWidth],
|
||||||
(char *)src->map,
|
(char *)src->map,
|
||||||
|
|
Loading…
Reference in New Issue