2009-01-20 08:46:12 -07:00
|
|
|
/*
|
|
|
|
Copyright 1985, 1987, 1990, 1998 The Open Group
|
|
|
|
Copyright 2008 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 _XKBCOMMON_H_
|
|
|
|
#define _XKBCOMMON_H_
|
|
|
|
|
2010-06-16 17:51:49 -06:00
|
|
|
#include <stdint.h>
|
2009-04-10 13:25:51 -06:00
|
|
|
#include <stdio.h>
|
2009-03-17 07:19:56 -06:00
|
|
|
#include <X11/Xfuncproto.h>
|
2009-04-25 02:13:24 -06:00
|
|
|
#include <X11/extensions/XKBstrcommon.h>
|
|
|
|
#include <X11/extensions/XKBrulescommon.h>
|
2009-03-19 18:16:13 -06:00
|
|
|
|
2009-04-05 16:15:20 -06:00
|
|
|
/* Action structures used in the server */
|
2010-06-16 17:51:49 -06:00
|
|
|
|
|
|
|
#define XkbcAnyActionDataSize 18
|
|
|
|
typedef struct _XkbcAnyAction {
|
|
|
|
unsigned char type;
|
|
|
|
unsigned char pad[XkbcAnyActionDataSize];
|
|
|
|
} XkbcAnyAction;
|
|
|
|
|
2009-04-05 16:15:20 -06:00
|
|
|
typedef struct _XkbcModAction {
|
|
|
|
unsigned char type;
|
2010-06-16 17:51:49 -06:00
|
|
|
uint8_t flags;
|
|
|
|
uint32_t mask;
|
|
|
|
uint32_t real_mods;
|
|
|
|
uint32_t vmods;
|
2009-04-05 16:15:20 -06:00
|
|
|
} XkbcModAction;
|
|
|
|
|
2010-06-16 17:51:49 -06:00
|
|
|
typedef struct _XkbcGroupAction {
|
2009-04-05 16:15:20 -06:00
|
|
|
unsigned char type;
|
|
|
|
unsigned char flags;
|
2010-06-16 17:51:49 -06:00
|
|
|
int16_t group;
|
|
|
|
} XkbcGroupAction;
|
2009-04-05 16:15:20 -06:00
|
|
|
|
2010-06-16 17:51:49 -06:00
|
|
|
typedef struct _XkbcISOAction {
|
2009-04-05 16:15:20 -06:00
|
|
|
unsigned char type;
|
2010-06-16 17:51:49 -06:00
|
|
|
uint8_t flags;
|
|
|
|
int16_t group;
|
|
|
|
uint32_t mask;
|
|
|
|
uint32_t vmods;
|
|
|
|
uint32_t real_mods;
|
|
|
|
uint8_t affect;
|
|
|
|
} XkbcISOAction;
|
2009-04-05 16:15:20 -06:00
|
|
|
|
|
|
|
typedef struct _XkbcCtrlsAction {
|
|
|
|
unsigned char type;
|
|
|
|
unsigned char flags;
|
2010-06-16 17:51:49 -06:00
|
|
|
uint32_t ctrls;
|
2009-04-05 16:15:20 -06:00
|
|
|
} XkbcCtrlsAction;
|
|
|
|
|
2010-06-16 17:51:49 -06:00
|
|
|
typedef struct _XkbcDeviceBtnAction {
|
2009-04-05 16:15:20 -06:00
|
|
|
unsigned char type;
|
2010-06-16 17:51:49 -06:00
|
|
|
unsigned char flags;
|
|
|
|
uint16_t device;
|
|
|
|
uint16_t button;
|
|
|
|
uint8_t count;
|
|
|
|
} XkbcDeviceBtnAction;
|
|
|
|
|
|
|
|
typedef struct _XkbcDeviceValuatorAction {
|
|
|
|
unsigned char type;
|
|
|
|
uint8_t v1_what;
|
|
|
|
uint16_t device;
|
|
|
|
uint16_t v1_index;
|
|
|
|
int16_t v1_value;
|
|
|
|
uint16_t v2_index;
|
|
|
|
int16_t v2_value;
|
|
|
|
uint8_t v2_what;
|
|
|
|
} XkbcDeviceValuatorAction;
|
|
|
|
|
|
|
|
typedef struct _XkbcPtrDfltAction {
|
|
|
|
unsigned char type;
|
|
|
|
uint8_t flags;
|
|
|
|
uint8_t affect;
|
|
|
|
uint8_t value;
|
|
|
|
} XkbcPtrDfltAction;
|
|
|
|
|
|
|
|
typedef struct _XkbcSwitchScreenAction {
|
|
|
|
unsigned char type;
|
|
|
|
uint8_t flags;
|
|
|
|
uint8_t screen;
|
|
|
|
} XkbcSwitchScreenAction;
|
2009-04-05 16:15:20 -06:00
|
|
|
|
|
|
|
typedef union _XkbcAction {
|
2010-06-16 17:51:49 -06:00
|
|
|
XkbcAnyAction any;
|
|
|
|
XkbcModAction mods;
|
|
|
|
XkbcGroupAction group;
|
|
|
|
XkbcISOAction iso;
|
|
|
|
XkbcCtrlsAction ctrls;
|
|
|
|
XkbcDeviceBtnAction devbtn;
|
|
|
|
XkbcDeviceValuatorAction devval;
|
|
|
|
XkbcPtrDfltAction dflt;
|
|
|
|
XkbcSwitchScreenAction screen;
|
|
|
|
XkbRedirectKeyAction redirect; /* XXX wholly unnecessary? */
|
|
|
|
XkbPtrAction ptr; /* XXX delete for DeviceValuator */
|
|
|
|
XkbPtrBtnAction btn; /* XXX delete for DeviceBtn */
|
|
|
|
XkbMessageAction msg; /* XXX just delete */
|
2009-04-05 16:15:20 -06:00
|
|
|
unsigned char type;
|
|
|
|
} XkbcAction;
|
|
|
|
|
|
|
|
typedef struct _XkbcServerMapRec {
|
|
|
|
unsigned short num_acts;
|
|
|
|
unsigned short size_acts;
|
|
|
|
|
|
|
|
#if defined(__cplusplus) || defined(c_plusplus)
|
|
|
|
/* explicit is a C++ reserved word */
|
|
|
|
unsigned char * c_explicit;
|
|
|
|
#else
|
|
|
|
unsigned char * explicit;
|
|
|
|
#endif
|
2010-06-16 17:51:49 -06:00
|
|
|
|
|
|
|
XkbcAction *acts;
|
|
|
|
XkbBehavior *behaviors;
|
|
|
|
unsigned short *key_acts;
|
|
|
|
unsigned char *explicits;
|
|
|
|
uint32_t vmods[XkbNumVirtualMods];
|
|
|
|
uint32_t *vmodmap;
|
2009-04-05 16:15:20 -06:00
|
|
|
} XkbcServerMapRec, *XkbcServerMapPtr;
|
|
|
|
|
2009-03-19 18:16:13 -06:00
|
|
|
/* Common keyboard description structure */
|
|
|
|
typedef struct _XkbcDesc {
|
|
|
|
unsigned int defined;
|
|
|
|
unsigned short flags;
|
|
|
|
unsigned short device_spec;
|
|
|
|
KeyCode min_key_code;
|
|
|
|
KeyCode max_key_code;
|
|
|
|
|
|
|
|
XkbControlsPtr ctrls;
|
2009-04-05 16:15:20 -06:00
|
|
|
XkbcServerMapPtr server;
|
2009-03-19 18:16:13 -06:00
|
|
|
XkbClientMapPtr map;
|
|
|
|
XkbIndicatorPtr indicators;
|
|
|
|
XkbNamesPtr names;
|
|
|
|
XkbCompatMapPtr compat;
|
|
|
|
XkbGeometryPtr geom;
|
|
|
|
} XkbcDescRec, *XkbcDescPtr;
|
2009-01-20 08:46:12 -07:00
|
|
|
|
2009-03-17 07:19:56 -06:00
|
|
|
_XFUNCPROTOBEGIN
|
|
|
|
|
2009-04-09 15:29:32 -06:00
|
|
|
extern void
|
|
|
|
XkbcInitAtoms(void);
|
|
|
|
|
2009-03-29 09:55:18 -06:00
|
|
|
extern XkbcDescPtr
|
2009-04-08 18:59:15 -06:00
|
|
|
XkbcCompileKeymapFromRules(const XkbRMLVOSet *rmlvo);
|
2009-03-31 06:36:52 -06:00
|
|
|
|
|
|
|
extern XkbcDescPtr
|
2009-04-08 18:59:15 -06:00
|
|
|
XkbcCompileKeymapFromComponents(const XkbComponentNamesPtr ktcsg);
|
2009-03-29 09:55:18 -06:00
|
|
|
|
2009-04-10 13:25:51 -06:00
|
|
|
extern XkbcDescPtr
|
|
|
|
XkbcCompileKeymapFromFile(FILE *inputFile, const char *mapName);
|
|
|
|
|
2009-04-19 17:30:36 -06:00
|
|
|
extern XkbComponentListPtr
|
2009-04-22 00:22:25 -06:00
|
|
|
XkbcListComponents(XkbComponentNamesPtr ptrns, int *maxMatch);
|
2009-04-19 17:30:36 -06:00
|
|
|
|
2009-04-25 02:13:52 -06:00
|
|
|
/*
|
|
|
|
* Canonicalises component names by prepending the relevant component from
|
|
|
|
* 'old' to the one in 'names' when the latter has a leading '+' or '|', and
|
|
|
|
* by replacing a '%' with the relevant component, e.g.:
|
|
|
|
*
|
|
|
|
* names old output
|
|
|
|
* ------------------------------------------
|
|
|
|
* +bar foo foo+bar
|
|
|
|
* |quux baz baz|quux
|
|
|
|
* foo+%|baz bar foo+bar|baz
|
|
|
|
*
|
|
|
|
* If a component in names needs to be modified, the existing value will be
|
|
|
|
* free()d, and a new one allocated with malloc().
|
|
|
|
*/
|
|
|
|
extern void
|
|
|
|
XkbcCanonicaliseComponents(XkbComponentNamesPtr names,
|
|
|
|
const XkbComponentNamesPtr old);
|
|
|
|
|
2009-04-24 22:55:59 -06:00
|
|
|
/*
|
|
|
|
* Converts a keysym to a string; will return unknown Unicode codepoints
|
|
|
|
* as "Ua1b2", and other unknown keysyms as "0xabcd1234".
|
|
|
|
*
|
|
|
|
* The string returned may become invalidated after the next call to
|
|
|
|
* XkbcKeysymToString: if you need to preserve it, then you must
|
|
|
|
* duplicate it.
|
|
|
|
*/
|
2009-04-24 22:52:51 -06:00
|
|
|
extern char *
|
|
|
|
XkbcKeysymToString(KeySym ks);
|
|
|
|
|
2009-04-24 22:55:59 -06:00
|
|
|
/*
|
|
|
|
* See XkbcKeysymToString comments: this function will accept any string
|
|
|
|
* from that function.
|
|
|
|
*/
|
2009-04-24 22:52:51 -06:00
|
|
|
extern KeySym
|
|
|
|
XkbcStringToKeysym(const char *s);
|
|
|
|
|
2009-03-17 07:19:56 -06:00
|
|
|
_XFUNCPROTOEND
|
|
|
|
|
2009-01-20 08:46:12 -07:00
|
|
|
#endif /* _XKBCOMMON_H_ */
|