2003-11-14 16:54:54 +01:00
|
|
|
/************************************************************
|
|
|
|
Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc.
|
|
|
|
|
|
|
|
Permission to use, copy, modify, and distribute this
|
|
|
|
software and its documentation for any purpose and without
|
|
|
|
fee is hereby granted, provided that the above copyright
|
|
|
|
notice appear in all copies and that both that copyright
|
|
|
|
notice and this permission notice appear in supporting
|
|
|
|
documentation, and that the name of Silicon Graphics not be
|
|
|
|
used in advertising or publicity pertaining to distribution
|
|
|
|
of the software without specific prior written permission.
|
|
|
|
Silicon Graphics makes no representation about the suitability
|
|
|
|
of this software for any purpose. It is provided "as is"
|
|
|
|
without any express or implied warranty.
|
|
|
|
|
|
|
|
SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
|
|
|
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
|
|
AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
|
|
|
|
GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
|
|
|
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
|
|
|
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
|
|
|
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
|
|
|
|
THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
|
|
|
|
********************************************************/
|
|
|
|
|
2005-07-03 09:02:09 +02:00
|
|
|
#ifdef HAVE_DIX_CONFIG_H
|
|
|
|
#include <dix-config.h>
|
|
|
|
#endif
|
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
#include <stdio.h>
|
2005-07-03 09:37:35 +02:00
|
|
|
#include <X11/X.h>
|
|
|
|
#include <X11/Xproto.h>
|
2003-11-14 16:54:54 +01:00
|
|
|
#include "misc.h"
|
|
|
|
#include "inputstr.h"
|
2007-03-18 21:31:19 +01:00
|
|
|
#include <xkbsrv.h>
|
2008-02-03 13:12:15 +01:00
|
|
|
#include "xkbgeom.h"
|
2010-01-15 06:32:09 +01:00
|
|
|
#include <os.h>
|
2010-01-15 06:32:10 +01:00
|
|
|
#include <string.h>
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
/***===================================================================***/
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
/*ARGSUSED*/ Status
|
|
|
|
XkbAllocCompatMap(XkbDescPtr xkb, unsigned which, unsigned nSI)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
XkbCompatMapPtr compat;
|
|
|
|
XkbSymInterpretRec *prev_interpret;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
if (!xkb)
|
2012-03-21 20:55:09 +01:00
|
|
|
return BadMatch;
|
2003-11-14 16:54:54 +01:00
|
|
|
if (xkb->compat) {
|
2012-03-21 20:55:09 +01:00
|
|
|
if (xkb->compat->size_si >= nSI)
|
|
|
|
return Success;
|
|
|
|
compat = xkb->compat;
|
|
|
|
compat->size_si = nSI;
|
|
|
|
if (compat->sym_interpret == NULL)
|
|
|
|
compat->num_si = 0;
|
|
|
|
prev_interpret = compat->sym_interpret;
|
|
|
|
compat->sym_interpret = realloc(compat->sym_interpret,
|
|
|
|
nSI * sizeof(XkbSymInterpretRec));
|
|
|
|
if (compat->sym_interpret == NULL) {
|
|
|
|
free(prev_interpret);
|
|
|
|
compat->size_si = compat->num_si = 0;
|
|
|
|
return BadAlloc;
|
|
|
|
}
|
|
|
|
if (compat->num_si != 0) {
|
|
|
|
memset(&compat->sym_interpret[compat->num_si], 0,
|
|
|
|
(compat->size_si -
|
|
|
|
compat->num_si) * sizeof(XkbSymInterpretRec));
|
|
|
|
}
|
|
|
|
return Success;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
compat = calloc(1, sizeof(XkbCompatMapRec));
|
|
|
|
if (compat == NULL)
|
|
|
|
return BadAlloc;
|
|
|
|
if (nSI > 0) {
|
|
|
|
compat->sym_interpret = calloc(nSI, sizeof(XkbSymInterpretRec));
|
|
|
|
if (!compat->sym_interpret) {
|
|
|
|
free(compat);
|
|
|
|
return BadAlloc;
|
|
|
|
}
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
compat->size_si = nSI;
|
|
|
|
compat->num_si = 0;
|
|
|
|
memset((char *) &compat->groups[0], 0,
|
|
|
|
XkbNumKbdGroups * sizeof(XkbModsRec));
|
|
|
|
xkb->compat = compat;
|
2003-11-14 16:54:54 +01:00
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2012-03-21 20:55:09 +01:00
|
|
|
XkbFreeCompatMap(XkbDescPtr xkb, unsigned which, Bool freeMap)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
register XkbCompatMapPtr compat;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
if ((xkb == NULL) || (xkb->compat == NULL))
|
|
|
|
return;
|
|
|
|
compat = xkb->compat;
|
2003-11-14 16:54:54 +01:00
|
|
|
if (freeMap)
|
2012-03-21 20:55:09 +01:00
|
|
|
which = XkbAllCompatMask;
|
|
|
|
if (which & XkbGroupCompatMask)
|
|
|
|
memset((char *) &compat->groups[0], 0,
|
|
|
|
XkbNumKbdGroups * sizeof(XkbModsRec));
|
|
|
|
if (which & XkbSymInterpMask) {
|
|
|
|
if ((compat->sym_interpret) && (compat->size_si > 0))
|
|
|
|
free(compat->sym_interpret);
|
|
|
|
compat->size_si = compat->num_si = 0;
|
|
|
|
compat->sym_interpret = NULL;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
if (freeMap) {
|
2012-03-21 20:55:09 +01:00
|
|
|
free(compat);
|
|
|
|
xkb->compat = NULL;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***===================================================================***/
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
Status
|
2012-03-21 20:55:09 +01:00
|
|
|
XkbAllocNames(XkbDescPtr xkb, unsigned which, int nTotalRG, int nTotalAliases)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
XkbNamesPtr names;
|
|
|
|
|
|
|
|
if (xkb == NULL)
|
|
|
|
return BadMatch;
|
|
|
|
if (xkb->names == NULL) {
|
|
|
|
xkb->names = calloc(1, sizeof(XkbNamesRec));
|
|
|
|
if (xkb->names == NULL)
|
|
|
|
return BadAlloc;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
names = xkb->names;
|
|
|
|
if ((which & XkbKTLevelNamesMask) && (xkb->map != NULL) &&
|
|
|
|
(xkb->map->types != NULL)) {
|
|
|
|
register int i;
|
|
|
|
XkbKeyTypePtr type;
|
|
|
|
|
|
|
|
type = xkb->map->types;
|
|
|
|
for (i = 0; i < xkb->map->num_types; i++, type++) {
|
|
|
|
if (type->level_names == NULL) {
|
|
|
|
type->level_names = calloc(type->num_levels, sizeof(Atom));
|
|
|
|
if (type->level_names == NULL)
|
|
|
|
return BadAlloc;
|
|
|
|
}
|
|
|
|
}
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
if ((which & XkbKeyNamesMask) && (names->keys == NULL)) {
|
|
|
|
if ((!XkbIsLegalKeycode(xkb->min_key_code)) ||
|
|
|
|
(!XkbIsLegalKeycode(xkb->max_key_code)) ||
|
|
|
|
(xkb->max_key_code < xkb->min_key_code))
|
|
|
|
return BadValue;
|
|
|
|
names->keys = calloc((xkb->max_key_code + 1), sizeof(XkbKeyNameRec));
|
|
|
|
if (names->keys == NULL)
|
|
|
|
return BadAlloc;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
if ((which & XkbKeyAliasesMask) && (nTotalAliases > 0)) {
|
|
|
|
if (names->key_aliases == NULL) {
|
|
|
|
names->key_aliases = calloc(nTotalAliases, sizeof(XkbKeyAliasRec));
|
|
|
|
}
|
|
|
|
else if (nTotalAliases > names->num_key_aliases) {
|
|
|
|
XkbKeyAliasRec *prev_aliases = names->key_aliases;
|
|
|
|
|
|
|
|
names->key_aliases = realloc(names->key_aliases,
|
|
|
|
nTotalAliases *
|
|
|
|
sizeof(XkbKeyAliasRec));
|
|
|
|
if (names->key_aliases != NULL) {
|
|
|
|
memset(&names->key_aliases[names->num_key_aliases], 0,
|
|
|
|
(nTotalAliases -
|
|
|
|
names->num_key_aliases) * sizeof(XkbKeyAliasRec));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
free(prev_aliases);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (names->key_aliases == NULL) {
|
|
|
|
names->num_key_aliases = 0;
|
|
|
|
return BadAlloc;
|
|
|
|
}
|
|
|
|
names->num_key_aliases = nTotalAliases;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
if ((which & XkbRGNamesMask) && (nTotalRG > 0)) {
|
|
|
|
if (names->radio_groups == NULL) {
|
|
|
|
names->radio_groups = calloc(nTotalRG, sizeof(Atom));
|
|
|
|
}
|
|
|
|
else if (nTotalRG > names->num_rg) {
|
|
|
|
Atom *prev_radio_groups = names->radio_groups;
|
|
|
|
|
|
|
|
names->radio_groups = realloc(names->radio_groups,
|
|
|
|
nTotalRG * sizeof(Atom));
|
|
|
|
if (names->radio_groups != NULL) {
|
|
|
|
memset(&names->radio_groups[names->num_rg], 0,
|
|
|
|
(nTotalRG - names->num_rg) * sizeof(Atom));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
free(prev_radio_groups);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (names->radio_groups == NULL)
|
|
|
|
return BadAlloc;
|
|
|
|
names->num_rg = nTotalRG;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2012-03-21 20:55:09 +01:00
|
|
|
XkbFreeNames(XkbDescPtr xkb, unsigned which, Bool freeMap)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
XkbNamesPtr names;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
if ((xkb == NULL) || (xkb->names == NULL))
|
|
|
|
return;
|
|
|
|
names = xkb->names;
|
2003-11-14 16:54:54 +01:00
|
|
|
if (freeMap)
|
2012-03-21 20:55:09 +01:00
|
|
|
which = XkbAllNamesMask;
|
|
|
|
if (which & XkbKTLevelNamesMask) {
|
|
|
|
XkbClientMapPtr map = xkb->map;
|
|
|
|
|
|
|
|
if ((map != NULL) && (map->types != NULL)) {
|
|
|
|
register int i;
|
|
|
|
register XkbKeyTypePtr type;
|
|
|
|
|
|
|
|
type = map->types;
|
|
|
|
for (i = 0; i < map->num_types; i++, type++) {
|
|
|
|
free(type->level_names);
|
|
|
|
type->level_names = NULL;
|
|
|
|
}
|
|
|
|
}
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
if ((which & XkbKeyNamesMask) && (names->keys != NULL)) {
|
|
|
|
free(names->keys);
|
|
|
|
names->keys = NULL;
|
|
|
|
names->num_keys = 0;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
if ((which & XkbKeyAliasesMask) && (names->key_aliases)) {
|
|
|
|
free(names->key_aliases);
|
|
|
|
names->key_aliases = NULL;
|
|
|
|
names->num_key_aliases = 0;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
if ((which & XkbRGNamesMask) && (names->radio_groups)) {
|
|
|
|
free(names->radio_groups);
|
|
|
|
names->radio_groups = NULL;
|
|
|
|
names->num_rg = 0;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
if (freeMap) {
|
2012-03-21 20:55:09 +01:00
|
|
|
free(names);
|
|
|
|
xkb->names = NULL;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***===================================================================***/
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
/*ARGSUSED*/ Status
|
|
|
|
XkbAllocControls(XkbDescPtr xkb, unsigned which)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
if (xkb == NULL)
|
|
|
|
return BadMatch;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
if (xkb->ctrls == NULL) {
|
|
|
|
xkb->ctrls = calloc(1, sizeof(XkbControlsRec));
|
|
|
|
if (!xkb->ctrls)
|
|
|
|
return BadAlloc;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
/*ARGSUSED*/ static void
|
|
|
|
XkbFreeControls(XkbDescPtr xkb, unsigned which, Bool freeMap)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
if (freeMap && (xkb != NULL) && (xkb->ctrls != NULL)) {
|
|
|
|
free(xkb->ctrls);
|
|
|
|
xkb->ctrls = NULL;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***===================================================================***/
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
Status
|
2003-11-14 16:54:54 +01:00
|
|
|
XkbAllocIndicatorMaps(XkbDescPtr xkb)
|
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
if (xkb == NULL)
|
|
|
|
return BadMatch;
|
|
|
|
if (xkb->indicators == NULL) {
|
|
|
|
xkb->indicators = calloc(1, sizeof(XkbIndicatorRec));
|
|
|
|
if (!xkb->indicators)
|
|
|
|
return BadAlloc;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
2007-03-18 21:31:19 +01:00
|
|
|
static void
|
2003-11-14 16:54:54 +01:00
|
|
|
XkbFreeIndicatorMaps(XkbDescPtr xkb)
|
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
if ((xkb != NULL) && (xkb->indicators != NULL)) {
|
|
|
|
free(xkb->indicators);
|
|
|
|
xkb->indicators = NULL;
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***====================================================================***/
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
XkbDescRec *
|
2003-11-14 16:54:54 +01:00
|
|
|
XkbAllocKeyboard(void)
|
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
XkbDescRec *xkb;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2010-05-05 20:44:06 +02:00
|
|
|
xkb = calloc(1, sizeof(XkbDescRec));
|
2003-11-14 16:54:54 +01:00
|
|
|
if (xkb)
|
2012-03-21 20:55:09 +01:00
|
|
|
xkb->device_spec = XkbUseCoreKbd;
|
2003-11-14 16:54:54 +01:00
|
|
|
return xkb;
|
|
|
|
}
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
void
|
2012-03-21 20:55:09 +01:00
|
|
|
XkbFreeKeyboard(XkbDescPtr xkb, unsigned which, Bool freeAll)
|
2003-11-14 16:54:54 +01:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
if (xkb == NULL)
|
|
|
|
return;
|
2003-11-14 16:54:54 +01:00
|
|
|
if (freeAll)
|
2012-03-21 20:55:09 +01:00
|
|
|
which = XkbAllComponentsMask;
|
|
|
|
if (which & XkbClientMapMask)
|
|
|
|
XkbFreeClientMap(xkb, XkbAllClientInfoMask, TRUE);
|
|
|
|
if (which & XkbServerMapMask)
|
|
|
|
XkbFreeServerMap(xkb, XkbAllServerInfoMask, TRUE);
|
|
|
|
if (which & XkbCompatMapMask)
|
|
|
|
XkbFreeCompatMap(xkb, XkbAllCompatMask, TRUE);
|
|
|
|
if (which & XkbIndicatorMapMask)
|
|
|
|
XkbFreeIndicatorMaps(xkb);
|
|
|
|
if (which & XkbNamesMask)
|
|
|
|
XkbFreeNames(xkb, XkbAllNamesMask, TRUE);
|
|
|
|
if ((which & XkbGeometryMask) && (xkb->geom != NULL)) {
|
|
|
|
XkbFreeGeometry(xkb->geom, XkbGeomAllMask, TRUE);
|
2006-09-07 14:17:04 +02:00
|
|
|
/* PERHAPS BONGHITS etc */
|
|
|
|
xkb->geom = NULL;
|
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
if (which & XkbControlsMask)
|
|
|
|
XkbFreeControls(xkb, XkbAllControlsMask, TRUE);
|
2003-11-14 16:54:54 +01:00
|
|
|
if (freeAll)
|
2012-03-21 20:55:09 +01:00
|
|
|
free(xkb);
|
2003-11-14 16:54:54 +01:00
|
|
|
return;
|
|
|
|
}
|
2011-03-11 13:30:49 +01:00
|
|
|
|
|
|
|
/***====================================================================***/
|
|
|
|
|
|
|
|
void
|
|
|
|
XkbFreeComponentNames(XkbComponentNamesPtr names, Bool freeNames)
|
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
if (names) {
|
2011-03-11 13:30:49 +01:00
|
|
|
free(names->keycodes);
|
|
|
|
free(names->types);
|
|
|
|
free(names->compat);
|
|
|
|
free(names->symbols);
|
|
|
|
free(names->geometry);
|
|
|
|
memset(names, 0, sizeof(XkbComponentNamesRec));
|
|
|
|
}
|
|
|
|
if (freeNames)
|
|
|
|
free(names);
|
|
|
|
}
|