parent
d67a94d374
commit
0bb24c2d23
|
@ -61,6 +61,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <X11/extensions/XKB.h>
|
||||
|
||||
typedef uint32_t xkb_keycode_t;
|
||||
typedef uint32_t xkb_keysym_t;
|
||||
|
||||
#define XKB_KEYCODE_MAX (0xffffffff - 1)
|
||||
#define xkb_keycode_is_legal_ext(kc) (kc <= XKB_KEYCODE_MAX)
|
||||
|
@ -227,7 +228,7 @@ struct xkb_key_type {
|
|||
};
|
||||
|
||||
struct xkb_sym_interpret {
|
||||
uint32_t sym;
|
||||
xkb_keysym_t sym;
|
||||
unsigned char flags;
|
||||
unsigned char match;
|
||||
uint8_t mods; /* XXX real or virt? */
|
||||
|
@ -263,7 +264,7 @@ struct xkb_client_map {
|
|||
|
||||
uint32_t size_syms;
|
||||
uint32_t num_syms;
|
||||
uint32_t *syms;
|
||||
xkb_keysym_t *syms;
|
||||
struct xkb_sym_map * key_sym_map;
|
||||
|
||||
unsigned char *modmap;
|
||||
|
@ -576,13 +577,13 @@ xkb_canonicalise_components(struct xkb_component_names * names,
|
|||
* client and server (no, really).
|
||||
*/
|
||||
_X_EXPORT extern void
|
||||
xkb_keysym_to_string(uint32_t ks, char *buffer, size_t size);
|
||||
xkb_keysym_to_string(xkb_keysym_t ks, char *buffer, size_t size);
|
||||
|
||||
/*
|
||||
* See xkb_keysym_to_string comments: this function will accept any string
|
||||
* from that function.
|
||||
*/
|
||||
_X_EXPORT extern uint32_t
|
||||
_X_EXPORT extern xkb_keysym_t
|
||||
xkb_string_to_keysym(const char *s);
|
||||
|
||||
_XFUNCPROTOEND
|
||||
|
|
|
@ -38,7 +38,7 @@ authorization from the authors.
|
|||
#include "ks_tables.h"
|
||||
|
||||
void
|
||||
xkb_keysym_to_string(uint32_t ks, char *buffer, size_t size)
|
||||
xkb_keysym_to_string(xkb_keysym_t ks, char *buffer, size_t size)
|
||||
{
|
||||
int i, n, h, idx;
|
||||
const unsigned char *entry;
|
||||
|
@ -91,7 +91,7 @@ xkb_keysym_to_string(uint32_t ks, char *buffer, size_t size)
|
|||
snprintf(buffer, size, "0x%08x", ks);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
xkb_keysym_t
|
||||
xkb_string_to_keysym(const char *s)
|
||||
{
|
||||
int i, n, h, c, idx;
|
||||
|
@ -99,7 +99,7 @@ xkb_string_to_keysym(const char *s)
|
|||
const char *p = s;
|
||||
const unsigned char *entry;
|
||||
unsigned char sig1, sig2;
|
||||
uint32_t val;
|
||||
xkb_keysym_t val;
|
||||
|
||||
while ((c = *p++))
|
||||
sig = (sig << 1) + c;
|
||||
|
@ -150,7 +150,7 @@ xkb_string_to_keysym(const char *s)
|
|||
* no separating underscore, while some XF86* syms in the latter did.
|
||||
* As a last ditch effort, try without. */
|
||||
if (strncmp(s, "XF86_", 5) == 0) {
|
||||
uint32_t ret;
|
||||
xkb_keysym_t ret;
|
||||
char *tmp = strdup(s);
|
||||
if (!tmp)
|
||||
return NoSymbol;
|
||||
|
|
16
src/malloc.c
16
src/malloc.c
|
@ -85,7 +85,7 @@ XkbcAllocClientMap(struct xkb_desc * xkb, unsigned which, unsigned nTotalTypes)
|
|||
|
||||
if (!map->syms) {
|
||||
map->size_syms = (nKeys * 15) / 10;
|
||||
map->syms = _XkbTypedCalloc(map->size_syms, uint32_t);
|
||||
map->syms = _XkbTypedCalloc(map->size_syms, xkb_keysym_t);
|
||||
if (!map->syms) {
|
||||
map->size_syms = 0;
|
||||
return BadAlloc;
|
||||
|
@ -257,13 +257,13 @@ XkbcCopyKeyType(struct xkb_key_type * from, struct xkb_key_type * into)
|
|||
return Success;
|
||||
}
|
||||
|
||||
uint32_t *
|
||||
xkb_keysym_t *
|
||||
XkbcResizeKeySyms(struct xkb_desc * xkb, xkb_keycode_t key,
|
||||
unsigned int needed)
|
||||
{
|
||||
uint32_t i, nSyms, nKeySyms;
|
||||
uint32_t nOldSyms;
|
||||
uint32_t *newSyms;
|
||||
xkb_keysym_t *newSyms;
|
||||
|
||||
if (needed == 0) {
|
||||
xkb->map->key_sym_map[key].offset = 0;
|
||||
|
@ -277,11 +277,11 @@ XkbcResizeKeySyms(struct xkb_desc * xkb, xkb_keycode_t key,
|
|||
if (xkb->map->size_syms - xkb->map->num_syms >= needed) {
|
||||
if (nOldSyms > 0)
|
||||
memcpy(&xkb->map->syms[xkb->map->num_syms],
|
||||
XkbKeySymsPtr(xkb, key), nOldSyms * sizeof(uint32_t));
|
||||
XkbKeySymsPtr(xkb, key), nOldSyms * sizeof(xkb_keysym_t));
|
||||
|
||||
if ((needed - nOldSyms) > 0)
|
||||
memset(&xkb->map->syms[xkb->map->num_syms + XkbKeyNumSyms(xkb, key)],
|
||||
0, (needed - nOldSyms) * sizeof(uint32_t));
|
||||
0, (needed - nOldSyms) * sizeof(xkb_keysym_t));
|
||||
|
||||
xkb->map->key_sym_map[key].offset = xkb->map->num_syms;
|
||||
xkb->map->num_syms += needed;
|
||||
|
@ -290,7 +290,7 @@ XkbcResizeKeySyms(struct xkb_desc * xkb, xkb_keycode_t key,
|
|||
}
|
||||
|
||||
xkb->map->size_syms += (needed > 32 ? needed : 32);
|
||||
newSyms = _XkbTypedCalloc(xkb->map->size_syms, uint32_t);
|
||||
newSyms = _XkbTypedCalloc(xkb->map->size_syms, xkb_keysym_t);
|
||||
if (!newSyms)
|
||||
return NULL;
|
||||
|
||||
|
@ -307,10 +307,10 @@ XkbcResizeKeySyms(struct xkb_desc * xkb, xkb_keycode_t key,
|
|||
nKeySyms = needed;
|
||||
if (nCopy != 0)
|
||||
memcpy(&newSyms[nSyms], XkbKeySymsPtr(xkb, i),
|
||||
nCopy * sizeof(uint32_t));
|
||||
nCopy * sizeof(xkb_keysym_t));
|
||||
if (nKeySyms > nCopy)
|
||||
memset(&newSyms[nSyms + nCopy], 0,
|
||||
(nKeySyms - nCopy) * sizeof(uint32_t));
|
||||
(nKeySyms - nCopy) * sizeof(xkb_keysym_t));
|
||||
|
||||
xkb->map->key_sym_map[i].offset = nSyms;
|
||||
nSyms += nKeySyms;
|
||||
|
|
|
@ -189,7 +189,7 @@ XkbcEnsureSafeMapName(char *name)
|
|||
}
|
||||
|
||||
unsigned
|
||||
_XkbcKSCheckCase(uint32_t ks)
|
||||
_XkbcKSCheckCase(xkb_keysym_t ks)
|
||||
{
|
||||
unsigned set = (ks & (~0xff)) >> 8;
|
||||
unsigned rtrn = 0;
|
||||
|
|
|
@ -253,7 +253,7 @@ XkbcActionTypeText(unsigned type)
|
|||
}
|
||||
|
||||
const char *
|
||||
XkbcKeysymText(uint32_t sym)
|
||||
XkbcKeysymText(xkb_keysym_t sym)
|
||||
{
|
||||
static char buffer[16];
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ XkbcAllocServerMap(struct xkb_desc * xkb, unsigned which, unsigned nNewActions);
|
|||
extern int
|
||||
XkbcCopyKeyType(struct xkb_key_type * from, struct xkb_key_type *into);
|
||||
|
||||
extern uint32_t *
|
||||
extern xkb_keysym_t *
|
||||
XkbcResizeKeySyms(struct xkb_desc * xkb, xkb_keycode_t key, uint32_t needed);
|
||||
|
||||
extern union xkb_action *
|
||||
|
|
|
@ -1019,7 +1019,7 @@ ExprResolveKeySym(ExprDef * expr,
|
|||
ExprResult * val_rtrn)
|
||||
{
|
||||
int ok = 0;
|
||||
uint32_t sym;
|
||||
xkb_keysym_t sym;
|
||||
|
||||
if (expr->op == ExprIdent)
|
||||
{
|
||||
|
|
|
@ -608,9 +608,9 @@ AppendKeysymList(ExprDef * list, char *sym)
|
|||
}
|
||||
|
||||
int
|
||||
LookupKeysym(char *str, uint32_t * sym_rtrn)
|
||||
LookupKeysym(char *str, xkb_keysym_t * sym_rtrn)
|
||||
{
|
||||
uint32_t sym;
|
||||
xkb_keysym_t sym;
|
||||
|
||||
if ((!str) || (uStrCaseCmp(str, "any") == 0)
|
||||
|| (uStrCaseCmp(str, "nosymbol") == 0))
|
||||
|
|
|
@ -147,7 +147,7 @@ extern ExprDef *AppendKeysymList(ExprDef * /* list */ ,
|
|||
);
|
||||
|
||||
extern int LookupKeysym(char * /* str */ ,
|
||||
uint32_t * /* sym_rtrn */
|
||||
xkb_keysym_t * /* sym_rtrn */
|
||||
);
|
||||
|
||||
extern IncludeStmt *IncludeCreate(char * /* str */ ,
|
||||
|
|
|
@ -64,7 +64,7 @@ typedef struct _KeyInfo
|
|||
unsigned char symsDefined;
|
||||
unsigned char actsDefined;
|
||||
short numLevels[XkbNumKbdGroups];
|
||||
uint32_t *syms[XkbNumKbdGroups];
|
||||
xkb_keysym_t *syms[XkbNumKbdGroups];
|
||||
union xkb_action *acts[XkbNumKbdGroups];
|
||||
uint32_t types[XkbNumKbdGroups];
|
||||
unsigned repeat;
|
||||
|
@ -168,14 +168,14 @@ CopyKeyInfo(KeyInfo * old, KeyInfo * new, Bool clearOld)
|
|||
width = new->numLevels[i];
|
||||
if (old->syms[i] != NULL)
|
||||
{
|
||||
new->syms[i] = uTypedCalloc(width, uint32_t);
|
||||
new->syms[i] = uTypedCalloc(width, xkb_keysym_t);
|
||||
if (!new->syms[i])
|
||||
{
|
||||
new->syms[i] = NULL;
|
||||
new->numLevels[i] = 0;
|
||||
return False;
|
||||
}
|
||||
memcpy(new->syms[i], old->syms[i], width * sizeof(uint32_t));
|
||||
memcpy(new->syms[i], old->syms[i], width * sizeof(xkb_keysym_t));
|
||||
}
|
||||
if (old->acts[i] != NULL)
|
||||
{
|
||||
|
@ -203,7 +203,7 @@ typedef struct _ModMapEntry
|
|||
union
|
||||
{
|
||||
unsigned long keyName;
|
||||
uint32_t keySym;
|
||||
xkb_keysym_t keySym;
|
||||
} u;
|
||||
} ModMapEntry;
|
||||
|
||||
|
@ -288,7 +288,7 @@ ResizeKeyGroup(KeyInfo * key,
|
|||
{
|
||||
key->syms[group] = uTypedRecalloc(key->syms[group],
|
||||
key->numLevels[group], newWidth,
|
||||
uint32_t);
|
||||
xkb_keysym_t);
|
||||
if (!key->syms[group])
|
||||
return False;
|
||||
}
|
||||
|
@ -309,7 +309,7 @@ static Bool
|
|||
MergeKeyGroups(SymbolsInfo * info,
|
||||
KeyInfo * into, KeyInfo * from, unsigned group)
|
||||
{
|
||||
uint32_t *resultSyms;
|
||||
xkb_keysym_t *resultSyms;
|
||||
union xkb_action *resultActs;
|
||||
int resultWidth;
|
||||
int i;
|
||||
|
@ -332,7 +332,7 @@ MergeKeyGroups(SymbolsInfo * info,
|
|||
}
|
||||
if (resultSyms == NULL)
|
||||
{
|
||||
resultSyms = uTypedCalloc(resultWidth, uint32_t);
|
||||
resultSyms = uTypedCalloc(resultWidth, xkb_keysym_t);
|
||||
if (!resultSyms)
|
||||
{
|
||||
WSGO("Could not allocate symbols for group merge\n");
|
||||
|
@ -357,7 +357,7 @@ MergeKeyGroups(SymbolsInfo * info,
|
|||
}
|
||||
for (i = 0; i < resultWidth; i++)
|
||||
{
|
||||
uint32_t fromSym, toSym;
|
||||
xkb_keysym_t fromSym, toSym;
|
||||
if (from->syms[group] && (i < from->numLevels[group]))
|
||||
fromSym = from->syms[group][i];
|
||||
else
|
||||
|
@ -372,7 +372,7 @@ MergeKeyGroups(SymbolsInfo * info,
|
|||
resultSyms[i] = fromSym;
|
||||
else
|
||||
{
|
||||
uint32_t use, ignore;
|
||||
xkb_keysym_t use, ignore;
|
||||
if (clobber)
|
||||
{
|
||||
use = fromSym;
|
||||
|
@ -1638,7 +1638,7 @@ HandleSymbolsFile(XkbFile * file,
|
|||
}
|
||||
|
||||
static Bool
|
||||
FindKeyForSymbol(struct xkb_desc * xkb, uint32_t sym, xkb_keycode_t *kc_rtrn)
|
||||
FindKeyForSymbol(struct xkb_desc * xkb, xkb_keysym_t sym, xkb_keycode_t *kc_rtrn)
|
||||
{
|
||||
int i, j;
|
||||
Bool gotOne;
|
||||
|
@ -1710,7 +1710,7 @@ FindNamedType(struct xkb_desc * xkb, uint32_t atom, unsigned *type_rtrn)
|
|||
* @returns True if a type could be found, False otherwise.
|
||||
*/
|
||||
static Bool
|
||||
FindAutomaticType(int width, uint32_t * syms, uint32_t * typeNameRtrn,
|
||||
FindAutomaticType(int width, xkb_keysym_t * syms, xkb_atom_t * typeNameRtrn,
|
||||
Bool * autoType)
|
||||
{
|
||||
*autoType = False;
|
||||
|
@ -1803,10 +1803,10 @@ PrepareKeyDef(KeyInfo * key)
|
|||
}
|
||||
if ((key->symsDefined & 1) && key->syms[0])
|
||||
{
|
||||
key->syms[i] = uTypedCalloc(width, uint32_t);
|
||||
key->syms[i] = uTypedCalloc(width, xkb_keysym_t);
|
||||
if (key->syms[i] == NULL)
|
||||
continue;
|
||||
memcpy(key->syms[i], key->syms[0], width * sizeof(uint32_t));
|
||||
memcpy(key->syms[i], key->syms[0], width * sizeof(xkb_keysym_t));
|
||||
key->symsDefined |= 1 << i;
|
||||
}
|
||||
if (defined & 1)
|
||||
|
@ -1828,7 +1828,7 @@ PrepareKeyDef(KeyInfo * key)
|
|||
if ((key->syms[i] != key->syms[0]) &&
|
||||
(key->syms[i] == NULL || key->syms[0] == NULL ||
|
||||
memcmp(key->syms[i], key->syms[0],
|
||||
sizeof(uint32_t) * key->numLevels[0])))
|
||||
sizeof(xkb_keysym_t) * key->numLevels[0])))
|
||||
{
|
||||
identical = False;
|
||||
break;
|
||||
|
@ -1872,7 +1872,7 @@ CopySymbolsDef(struct xkb_desc * xkb, KeyInfo *key, int start_from)
|
|||
unsigned width, tmp, nGroups;
|
||||
struct xkb_key_type * type;
|
||||
Bool haveActions, autoType, useAlias;
|
||||
uint32_t *outSyms;
|
||||
xkb_keysym_t *outSyms;
|
||||
union xkb_action *outActs;
|
||||
unsigned types[XkbNumKbdGroups];
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ extern void
|
|||
XkbcEnsureSafeMapName(char *name);
|
||||
|
||||
extern unsigned
|
||||
_XkbcKSCheckCase(uint32_t sym);
|
||||
_XkbcKSCheckCase(xkb_keysym_t sym);
|
||||
|
||||
#define _XkbKSLower (1 << 0)
|
||||
#define _XkbKSUpper (1 << 1)
|
||||
|
@ -97,7 +97,7 @@ extern const char *
|
|||
XkbcActionTypeText(unsigned type);
|
||||
|
||||
extern const char *
|
||||
XkbcKeysymText(uint32_t sym);
|
||||
XkbcKeysymText(xkb_keysym_t sym);
|
||||
|
||||
extern const char *
|
||||
XkbcKeyNameText(char *name);
|
||||
|
|
Loading…
Reference in New Issue