keymap: move XkbEscapeMapName() to keymap.c.
So we can use it outside src/xkbcomp; it is not really specific to it. Signed-off-by: Ran Benita <ran234@gmail.com>master
parent
d63e0ab838
commit
4884a8e636
24
src/keymap.c
24
src/keymap.c
|
@ -574,3 +574,27 @@ XkbResolveKeyAlias(struct xkb_keymap *keymap, xkb_atom_t name)
|
|||
|
||||
return XKB_ATOM_NONE;
|
||||
}
|
||||
|
||||
void
|
||||
XkbEscapeMapName(char *name)
|
||||
{
|
||||
/*
|
||||
* All latin-1 alphanumerics, plus parens, slash, minus, underscore and
|
||||
* wildcards.
|
||||
*/
|
||||
static const unsigned char legal[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xa7, 0xff, 0x83,
|
||||
0xfe, 0xff, 0xff, 0x87, 0xfe, 0xff, 0xff, 0x07,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0x7f, 0xff
|
||||
};
|
||||
|
||||
if (!name)
|
||||
return;
|
||||
|
||||
while (*name) {
|
||||
if (!(legal[*name / 8] & (1 << (*name % 8))))
|
||||
*name = '_';
|
||||
name++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -418,6 +418,9 @@ XkbKeyByName(struct xkb_keymap *keymap, xkb_atom_t name, bool use_aliases);
|
|||
xkb_atom_t
|
||||
XkbResolveKeyAlias(struct xkb_keymap *keymap, xkb_atom_t name);
|
||||
|
||||
void
|
||||
XkbEscapeMapName(char *name);
|
||||
|
||||
xkb_layout_index_t
|
||||
wrap_group_into_range(int32_t group,
|
||||
xkb_layout_index_t num_groups,
|
||||
|
|
|
@ -495,30 +495,6 @@ err:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
XkbEscapeMapName(char *name)
|
||||
{
|
||||
/*
|
||||
* All latin-1 alphanumerics, plus parens, slash, minus, underscore and
|
||||
* wildcards.
|
||||
*/
|
||||
static const unsigned char legal[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xa7, 0xff, 0x83,
|
||||
0xfe, 0xff, 0xff, 0x87, 0xfe, 0xff, 0xff, 0x07,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0x7f, 0xff
|
||||
};
|
||||
|
||||
if (!name)
|
||||
return;
|
||||
|
||||
while (*name) {
|
||||
if (!(legal[*name / 8] & (1 << (*name % 8))))
|
||||
*name = '_';
|
||||
name++;
|
||||
}
|
||||
}
|
||||
|
||||
XkbFile *
|
||||
XkbFileCreate(struct xkb_context *ctx, enum xkb_file_type type, char *name,
|
||||
ParseCommon *defs, enum xkb_map_flags flags)
|
||||
|
|
|
@ -56,9 +56,6 @@ XkbFile *
|
|||
XkbFileFromComponents(struct xkb_context *ctx,
|
||||
const struct xkb_component_names *kkctgs);
|
||||
|
||||
void
|
||||
XkbEscapeMapName(char *name);
|
||||
|
||||
bool
|
||||
CompileKeycodes(XkbFile *file, struct xkb_keymap *keymap,
|
||||
enum merge_mode merge);
|
||||
|
|
Loading…
Reference in New Issue