-I$(top_srcdir)/include \
-I$(top_srcdir)/src \
-I$(top_srcdir)/src/xkbcomp \
- -Isrc/xkbcomp/ \
-include $(top_srcdir)/src/config.h
AM_CFLAGS = \
src/xkbcomp/xkbcomp.h \
src/xkbcomp/xkbcomp-priv.h \
src/alloc.c \
+ src/alloc.h \
src/atom.c \
+ src/atom.h \
src/context.c \
src/keysym.c \
src/map.c \
- src/maprules.c \
src/misc.c \
+ src/rules.c \
+ src/rules.h \
src/state.c \
src/text.c \
+ src/text.h \
src/utils.c \
src/utils.h \
src/xkb.c \
- src/xkballoc.h \
- src/xkbmisc.h \
- src/xkbrules.h \
- src/XKBcommonint.h
+ src/xkb-priv.h
BUILT_SOURCES = \
src/xkbcomp/parser.c \
THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include "utils.h"
-#include "xkballoc.h"
-#include "xkbcommon/xkbcommon.h"
-#include "XKBcommonint.h"
+#include "xkb-priv.h"
+#include "alloc.h"
int
XkbcAllocClientMap(struct xkb_keymap * xkb, unsigned which, unsigned nTotalTypes)
authorization from the authors.
*/
-#ifndef _XKBALLOC_H_
-#define _XKBALLOC_H_
+#ifndef ALLOC_H
+#define ALLOC_H
-#include <X11/X.h>
-#include "xkbcommon/xkbcommon.h"
-#include "XKBcommonint.h"
+#include "xkb-priv.h"
extern int
XkbcAllocCompatMap(struct xkb_keymap *xkb, unsigned nSI);
extern void
XkbcFreeServerMap(struct xkb_keymap * xkb);
-extern unsigned int
-xkb_key_get_syms_by_level(struct xkb_keymap *xkb, xkb_keycode_t key,
- unsigned int group, unsigned int level,
- const xkb_keysym_t **syms_out);
-
-#endif /* _XKBALLOC_H_ */
+#endif /* ALLOC_H */
********************************************************/
-#include "xkbmisc.h"
-#include "xkbcommon/xkbcommon.h"
-#include "XKBcommonint.h"
+#include "atom.h"
#define InitialTableSize 100
--- /dev/null
+/*
+Copyright 2009 Dan Nicholson
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the authors or their
+institutions shall not be used in advertising or otherwise to promote the
+sale, use or other dealings in this Software without prior written
+authorization from the authors.
+*/
+
+#ifndef ATOM_H
+#define ATOM_H
+
+#include "xkb-priv.h"
+
+typedef uint32_t xkb_atom_t;
+
+#define XKB_ATOM_NONE 0
+
+extern xkb_atom_t
+xkb_intern_atom(const char *string);
+
+extern char *
+XkbcAtomGetString(xkb_atom_t atom);
+
+extern const char *
+XkbcAtomText(xkb_atom_t atm);
+
+extern void
+XkbcFreeAllAtoms(void);
+
+#endif /* ATOM_H */
#include <stdio.h>
#include <unistd.h>
-#include "xkbcommon/xkbcommon.h"
-#include "XKBcommonint.h"
-#include "utils.h"
+#include "xkb-priv.h"
struct xkb_context {
int refcnt;
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <X11/keysymdef.h>
+#include <X11/keysym.h>
+#include "xkb-priv.h"
#include "ks_tables.h"
-#include "xkbmisc.h"
-#include "xkbcommon/xkbcommon.h"
_X_EXPORT void
xkb_keysym_to_string(xkb_keysym_t ks, char *buffer, size_t size)
*
* ********************************************************/
-#include "utils.h"
-#include "xkbcommon/xkbcommon.h"
-#include "XKBcommonint.h"
-#include "xkballoc.h"
+#include "xkb-priv.h"
/**
* Returns the total number of modifiers active in the keymap.
/**
* As below, but takes an explicit group/level rather than state.
*/
-_X_EXPORT unsigned int
+unsigned int
xkb_key_get_syms_by_level(struct xkb_keymap *xkb, xkb_keycode_t key, unsigned int group,
unsigned int level, const xkb_keysym_t **syms_out)
{
********************************************************/
-#include "xkballoc.h"
-#include "xkbmisc.h"
-#include "xkbcommon/xkbcommon.h"
-#include "XKBcommonint.h"
#include <X11/keysym.h>
+#include "xkb-priv.h"
+#include "alloc.h"
+
#define mapSize(m) (sizeof(m) / sizeof(struct xkb_kt_map_entry))
static struct xkb_kt_map_entry map2Level[]= {
{ true, ShiftMask, {1, ShiftMask, 0} }
return Success;
}
-bool
-XkbcVirtualModsToReal(struct xkb_keymap * xkb, unsigned virtual_mask,
- unsigned *mask_rtrn)
-{
- int i, bit;
- unsigned mask;
-
- if (!xkb)
- return false;
- if (virtual_mask == 0) {
- *mask_rtrn = 0;
- return true;
- }
- if (!xkb->server)
- return false;
-
- for (i = mask = 0, bit = 1; i < XkbNumVirtualMods; i++, bit <<= 1) {
- if (virtual_mask & bit)
- mask |= xkb->server->vmods[i];
- }
-
- *mask_rtrn = mask;
- return true;
-}
-
-/*
- * All latin-1 alphanumerics, plus parens, slash, minus, underscore and
- * wildcards.
- */
-static const unsigned char componentSpecLegal[] = {
- 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
-};
-
-void
-XkbcEnsureSafeMapName(char *name)
-{
- if (!name)
- return;
-
- while (*name!='\0') {
- if ((componentSpecLegal[(*name) / 8] & (1 << ((*name) % 8))) == 0)
- *name= '_';
- name++;
- }
-}
-
unsigned
_XkbcKSCheckCase(xkb_keysym_t ks)
{
********************************************************/
-#include "utils.h"
-#include "xkbrules.h"
-#include "xkbcommon/xkbcommon.h"
-#include "XKBcommonint.h"
-
#include <stdio.h>
#include <ctype.h>
-#include <stdlib.h>
+
+#include "rules.h"
#ifdef DEBUG
#define PR_DEBUG(s) fprintf(stderr,s)
if (names->keycodes)
names->keycodes= XkbRF_SubstituteVars(names->keycodes, &mdefs);
- if (names->symbols)
+ if (names->symbols)
names->symbols= XkbRF_SubstituteVars(names->symbols, &mdefs);
if (names->types)
names->types= XkbRF_SubstituteVars(names->types, &mdefs);
if (names->compat)
names->compat= XkbRF_SubstituteVars(names->compat, &mdefs);
- if (names->keymap)
+ if (names->keymap)
names->keymap= XkbRF_SubstituteVars(names->keymap, &mdefs);
FreeMultiDefs(&mdefs);
authorization from the authors.
*/
-#ifndef _XKBRULES_H_
-#define _XKBRULES_H_
+#ifndef RULES_H
+#define RULES_H
-#include <stdbool.h>
#include <stdio.h>
-#include "xkbcommon/xkbcommon.h"
+#include "xkb-priv.h"
/* From filecommon */
XkbRF_GroupPtr groups;
} XkbRF_RulesRec, *XkbRF_RulesPtr;
-/* Action structures used in the server */
-
extern bool
XkbcRF_GetComponents(XkbRF_RulesPtr rules, XkbRF_VarDefsPtr defs,
struct xkb_component_names * names);
extern void
XkbcRF_Free(XkbRF_RulesPtr rules);
-#endif /* _XKBRULES_H_ */
+#endif /* RULES_H */
#include <assert.h>
-#include "xkbcommon/xkbcommon.h"
-#include "XKBcommonint.h"
-#include "xkbmisc.h"
+#include "xkb-priv.h"
struct xkb_filter {
struct xkb_state *state;
********************************************************/
-#include "xkbmisc.h"
-#include "xkbcommon/xkbcommon.h"
-#include "XKBcommonint.h"
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
+#include "text.h"
#define BUFFER_SIZE 1024
static char textBuffer[BUFFER_SIZE];
authorization from the authors.
*/
-#ifndef _XKBMISC_H_
-#define _XKBMISC_H_
+#ifndef TEXT_H
+#define TEXT_H
-#include <stdbool.h>
-#include <X11/Xfuncproto.h>
-
-#include "XKBcommonint.h"
-
-typedef uint32_t xkb_atom_t;
-
-#define XKB_ATOM_NONE 0
-
-/***====================================================================***/
-
-extern bool
-XkbcComputeEffectiveMap(struct xkb_keymap * xkb, struct xkb_key_type * type,
- unsigned char *map_rtrn);
-
-/***====================================================================***/
-
-extern int
-XkbcInitCanonicalKeyTypes(struct xkb_keymap * xkb, unsigned which, int keypadVMod);
-
-extern bool
-XkbcVirtualModsToReal(struct xkb_keymap * xkb, unsigned virtual_mask,
- unsigned *mask_rtrn);
-
-extern void
-XkbcEnsureSafeMapName(char *name);
-
-extern unsigned
-_XkbcKSCheckCase(xkb_keysym_t sym);
-
-#define _XkbKSLower (1 << 0)
-#define _XkbKSUpper (1 << 1)
-
-#define XkbcKSIsLower(k) (_XkbcKSCheckCase(k) & _XkbKSLower)
-#define XkbcKSIsUpper(k) (_XkbcKSCheckCase(k) & _XkbKSUpper)
-
-#define XkbKSIsKeypad(k) (((k) >= XK_KP_Space) && ((k) <= XK_KP_Equal))
-
-/***====================================================================***/
-
-extern xkb_atom_t
-xkb_intern_atom(const char *string);
-
-extern char *
-XkbcAtomGetString(xkb_atom_t atom);
-
-extern void
-XkbcFreeAllAtoms(void);
-
-/***====================================================================***/
-
-extern const char *
-XkbcAtomText(xkb_atom_t atm);
+#include "xkb-priv.h"
extern const char *
XkbcVModMaskText(struct xkb_keymap * xkb, unsigned modMask, unsigned mask);
extern const char *
XkbcSIMatchText(unsigned type);
-#endif /* _XKBMISC_H_ */
+#endif /* TEXT_H */
* software without specific, written prior permission.
\*/
-#include "utils.h"
-#include "XKBcommonint.h"
-
#include <ctype.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
+#include "utils.h"
+
void *
recalloc(void *ptr, size_t old_size, size_t new_size)
{
#include <stdbool.h>
#include <stdio.h>
+#include <stdlib.h>
#include <X11/Xfuncproto.h>
* Author: Daniel Stone <daniel@fooishbar.org>
*/
-#ifndef _XKBCOMMONINT_H_
-#define _XKBCOMMONINT_H_
+#ifndef XKB_PRIV_H
+#define XKB_PRIV_H
#include <stdbool.h>
-#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <X11/extensions/XKB.h>
+#include <X11/X.h>
#include "xkbcommon/xkbcommon.h"
+#include "utils.h"
/* From XKM.h */
#define XkmSemanticsFile 20
#define XkmKeymapOptional ((XkmSemanticsOptional|XkmLayoutOptional)&(~XkmKeymapRequired))
#define XkmKeymapLegal (XkmKeymapRequired|XkmKeymapOptional)
-extern unsigned int xkb_key_get_group(struct xkb_state *state,
- xkb_keycode_t key);
-extern unsigned int xkb_key_get_level(struct xkb_state *state,
- xkb_keycode_t key,
- unsigned int group);
-
struct xkb_any_action {
uint8_t type;
uint8_t data[7];
struct xkb_keymap *xkb;
};
-#endif /* _XKBCOMMONINT_H_ */
+extern unsigned int
+xkb_key_get_group(struct xkb_state *state, xkb_keycode_t key);
+
+extern unsigned int
+xkb_key_get_level(struct xkb_state *state, xkb_keycode_t key,
+ unsigned int group);
+
+extern unsigned int
+xkb_key_get_syms_by_level(struct xkb_keymap *xkb, xkb_keycode_t key,
+ unsigned int group, unsigned int level,
+ const xkb_keysym_t **syms_out);
+extern bool
+XkbcComputeEffectiveMap(struct xkb_keymap * xkb, struct xkb_key_type * type,
+ unsigned char *map_rtrn);
+
+extern int
+XkbcInitCanonicalKeyTypes(struct xkb_keymap * xkb, unsigned which,
+ int keypadVMod);
+
+extern unsigned
+_XkbcKSCheckCase(xkb_keysym_t sym);
+
+#define _XkbKSLower (1 << 0)
+#define _XkbKSUpper (1 << 1)
+
+#define XkbcKSIsLower(k) (_XkbcKSCheckCase(k) & _XkbKSLower)
+#define XkbcKSIsUpper(k) (_XkbcKSCheckCase(k) & _XkbKSUpper)
+
+#define XkbKSIsKeypad(k) (((k) >= XK_KP_Space) && ((k) <= XK_KP_Equal))
+
+#endif /* XKB_PRIV_H */
********************************************************/
-#include <stdio.h>
-
-#include "xkbmisc.h"
-#include "xkbcommon/xkbcommon.h"
-#include "XKBcommonint.h"
+#include "xkb-priv.h"
static char *
XkbcCanonicaliseComponent(char *name, const char *old)
old ? old->types : NULL);
}
+static bool
+VirtualModsToReal(struct xkb_keymap *xkb, unsigned virtual_mask,
+ unsigned *mask_rtrn)
+{
+ int i, bit;
+ unsigned mask;
+
+ if (!xkb)
+ return false;
+ if (virtual_mask == 0) {
+ *mask_rtrn = 0;
+ return true;
+ }
+ if (!xkb->server)
+ return false;
+
+ for (i = mask = 0, bit = 1; i < XkbNumVirtualMods; i++, bit <<= 1) {
+ if (virtual_mask & bit)
+ mask |= xkb->server->vmods[i];
+ }
+
+ *mask_rtrn = mask;
+ return true;
+}
+
bool
XkbcComputeEffectiveMap(struct xkb_keymap * xkb, struct xkb_key_type * type,
unsigned char *map_rtrn)
return false;
if (type->mods.vmods != 0) {
- if (!XkbcVirtualModsToReal(xkb, type->mods.vmods, &tmp))
+ if (!VirtualModsToReal(xkb, type->mods.vmods, &tmp))
return false;
type->mods.mask = tmp | type->mods.real_mods;
for (i = 0; i < type->map_count; i++, entry++) {
tmp = 0;
if (entry->mods.vmods != 0) {
- if (!XkbcVirtualModsToReal(xkb, entry->mods.vmods, &tmp))
+ if (!VirtualModsToReal(xkb, entry->mods.vmods, &tmp))
return false;
if (tmp == 0) {
entry->active = false;
}
}
+/*
+ * All latin-1 alphanumerics, plus parens, slash, minus, underscore and
+ * wildcards.
+ */
+static const unsigned char componentSpecLegal[] = {
+ 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
+};
+
+static void
+EnsureSafeMapName(char *name)
+{
+ if (!name)
+ return;
+
+ while (*name!='\0') {
+ if ((componentSpecLegal[(*name) / 8] & (1 << ((*name) % 8))) == 0)
+ *name= '_';
+ name++;
+ }
+}
+
XkbFile *
CreateXKBFile(int type, char *name, ParseCommon * defs, unsigned flags)
{
file = uTypedAlloc(XkbFile);
if (file)
{
- XkbcEnsureSafeMapName(name);
+ EnsureSafeMapName(name);
memset(file, 0, sizeof(XkbFile));
file->type = type;
file->topName = uDupString(name);
#define XKBCOMP_PRIV_H
#include "xkbcomp.h"
-#include "xkballoc.h"
+#include "alloc.h"
+#include "text.h"
#include "utils.h"
typedef struct _CommonInfo
*/
#include "xkbcomp-priv.h"
-#include "xkbrules.h"
+#include "rules.h"
#include "parseutils.h"
/* Global warning level */
#ifndef XKBCOMP_H
#define XKBCOMP_H 1
-#include "XKBcommonint.h"
-#include "xkbmisc.h"
+#include "xkb-priv.h"
+#include "atom.h"
#define TypeUnknown 0
#define TypeBoolean 1
#include <linux/input.h>
#include "xkbcommon/xkbcommon.h"
-#include "XKBcommonint.h"
+#include "xkb-priv.h"
/* Offset between evdev keycodes (where KEY_ESCAPE is 1), and the evdev XKB
* keycode set (where ESC is 9). */