mirror of
https://github.com/X11Libre/xserver.git
synced 2026-09-16 19:32:26 +00:00
R6.6 is the Xorg base-line
This commit is contained in:
parent
cb6ef07bf0
commit
ded6147bfb
609 changed files with 262690 additions and 0 deletions
13
xkb/README.compiled
Normal file
13
xkb/README.compiled
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
|
||||
The X server uses this directory to store the compiled version of the
|
||||
current keymap and/or any scratch keymaps used by clients. The X server
|
||||
or some other tool might destroy or replace the files in this directory,
|
||||
so it is not a safe place to store compiled keymaps for long periods of
|
||||
time. The default keymap for any server is usually stored in:
|
||||
X<num>-default.xkm
|
||||
where <num> is the display number of the server in question, which makes
|
||||
it possible for several servers *on the same host* to share the same
|
||||
directory.
|
||||
|
||||
Unless the X server is modified, sharing this directory between servers on
|
||||
different hosts could cause problems.
|
||||
587
xkb/XKBAlloc.c
Normal file
587
xkb/XKBAlloc.c
Normal file
|
|
@ -0,0 +1,587 @@
|
|||
/* $Xorg: XKBAlloc.c,v 1.4 2000/08/17 19:44:59 cpqbld Exp $ */
|
||||
/************************************************************
|
||||
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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
#ifndef XKB_IN_SERVER
|
||||
|
||||
#include <stdio.h>
|
||||
#define NEED_REPLIES
|
||||
#define NEED_EVENTS
|
||||
#include "Xlibint.h"
|
||||
#include "XKBlibint.h"
|
||||
#include <X11/extensions/XKBgeom.h>
|
||||
#include <X11/extensions/XKBproto.h>
|
||||
#include "XKBlibint.h"
|
||||
|
||||
#else
|
||||
|
||||
#include <stdio.h>
|
||||
#include "X.h"
|
||||
#define NEED_EVENTS
|
||||
#define NEED_REPLIES
|
||||
#include "Xproto.h"
|
||||
#include "misc.h"
|
||||
#include "inputstr.h"
|
||||
#include "XKBsrv.h"
|
||||
#include "XKBgeom.h"
|
||||
|
||||
#endif /* XKB_IN_SERVER */
|
||||
|
||||
/***===================================================================***/
|
||||
|
||||
/*ARGSUSED*/
|
||||
Status
|
||||
#if NeedFunctionPrototypes
|
||||
XkbAllocCompatMap(XkbDescPtr xkb,unsigned which,unsigned nSI)
|
||||
#else
|
||||
XkbAllocCompatMap(xkb,which,nSI)
|
||||
XkbDescPtr xkb;
|
||||
unsigned which;
|
||||
unsigned nSI;
|
||||
#endif
|
||||
{
|
||||
XkbCompatMapPtr compat;
|
||||
XkbSymInterpretRec *prev_interpret;
|
||||
|
||||
if (!xkb)
|
||||
return BadMatch;
|
||||
if (xkb->compat) {
|
||||
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= _XkbTypedRealloc(compat->sym_interpret,
|
||||
nSI,XkbSymInterpretRec);
|
||||
if (compat->sym_interpret==NULL) {
|
||||
_XkbFree(prev_interpret);
|
||||
compat->size_si= compat->num_si= 0;
|
||||
return BadAlloc;
|
||||
}
|
||||
if (compat->num_si!=0) {
|
||||
_XkbClearElems(compat->sym_interpret,compat->num_si,
|
||||
compat->size_si-1,XkbSymInterpretRec);
|
||||
}
|
||||
return Success;
|
||||
}
|
||||
compat= _XkbTypedCalloc(1,XkbCompatMapRec);
|
||||
if (compat==NULL)
|
||||
return BadAlloc;
|
||||
if (nSI>0) {
|
||||
compat->sym_interpret= _XkbTypedCalloc(nSI,XkbSymInterpretRec);
|
||||
if (!compat->sym_interpret) {
|
||||
_XkbFree(compat);
|
||||
return BadAlloc;
|
||||
}
|
||||
}
|
||||
compat->size_si= nSI;
|
||||
compat->num_si= 0;
|
||||
bzero((char *)&compat->groups[0],XkbNumKbdGroups*sizeof(XkbModsRec));
|
||||
xkb->compat= compat;
|
||||
return Success;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
#if NeedFunctionPrototypes
|
||||
XkbFreeCompatMap(XkbDescPtr xkb,unsigned which,Bool freeMap)
|
||||
#else
|
||||
XkbFreeCompatMap(xkb,which,freeMap)
|
||||
XkbDescPtr xkb;
|
||||
unsigned which;
|
||||
Bool freeMap;
|
||||
#endif
|
||||
{
|
||||
register XkbCompatMapPtr compat;
|
||||
|
||||
if ((xkb==NULL)||(xkb->compat==NULL))
|
||||
return;
|
||||
compat= xkb->compat;
|
||||
if (freeMap)
|
||||
which= XkbAllCompatMask;
|
||||
if (which&XkbGroupCompatMask)
|
||||
bzero((char *)&compat->groups[0],XkbNumKbdGroups*sizeof(XkbModsRec));
|
||||
if (which&XkbSymInterpMask) {
|
||||
if ((compat->sym_interpret)&&(compat->size_si>0))
|
||||
_XkbFree(compat->sym_interpret);
|
||||
compat->size_si= compat->num_si= 0;
|
||||
compat->sym_interpret= NULL;
|
||||
}
|
||||
if (freeMap) {
|
||||
_XkbFree(compat);
|
||||
xkb->compat= NULL;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/***===================================================================***/
|
||||
|
||||
Status
|
||||
#if NeedFunctionPrototypes
|
||||
XkbAllocNames(XkbDescPtr xkb,unsigned which,int nTotalRG,int nTotalAliases)
|
||||
#else
|
||||
XkbAllocNames(xkb,which,nTotalRG,nTotalAliases)
|
||||
XkbDescPtr xkb;
|
||||
unsigned which;
|
||||
int nTotalRG;
|
||||
int nTotalAliases;
|
||||
#endif
|
||||
{
|
||||
XkbNamesPtr names;
|
||||
|
||||
if (xkb==NULL)
|
||||
return BadMatch;
|
||||
if (xkb->names==NULL) {
|
||||
xkb->names = _XkbTypedCalloc(1,XkbNamesRec);
|
||||
if (xkb->names==NULL)
|
||||
return BadAlloc;
|
||||
}
|
||||
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= _XkbTypedCalloc(type->num_levels,Atom);
|
||||
if (type->level_names==NULL)
|
||||
return BadAlloc;
|
||||
}
|
||||
}
|
||||
}
|
||||
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= _XkbTypedCalloc((xkb->max_key_code+1),XkbKeyNameRec);
|
||||
if (names->keys==NULL)
|
||||
return BadAlloc;
|
||||
}
|
||||
if ((which&XkbKeyAliasesMask)&&(nTotalAliases>0)) {
|
||||
if (names->key_aliases==NULL) {
|
||||
names->key_aliases= _XkbTypedCalloc(nTotalAliases,XkbKeyAliasRec);
|
||||
}
|
||||
else if (nTotalAliases>names->num_key_aliases) {
|
||||
XkbKeyAliasRec *prev_aliases = names->key_aliases;
|
||||
|
||||
names->key_aliases= _XkbTypedRealloc(names->key_aliases,
|
||||
nTotalAliases,XkbKeyAliasRec);
|
||||
if (names->key_aliases!=NULL) {
|
||||
_XkbClearElems(names->key_aliases,names->num_key_aliases,
|
||||
nTotalAliases-1,XkbKeyAliasRec);
|
||||
} else {
|
||||
_XkbFree(prev_aliases);
|
||||
}
|
||||
}
|
||||
if (names->key_aliases==NULL) {
|
||||
names->num_key_aliases= 0;
|
||||
return BadAlloc;
|
||||
}
|
||||
names->num_key_aliases= nTotalAliases;
|
||||
}
|
||||
if ((which&XkbRGNamesMask)&&(nTotalRG>0)) {
|
||||
if (names->radio_groups==NULL) {
|
||||
names->radio_groups= _XkbTypedCalloc(nTotalRG,Atom);
|
||||
}
|
||||
else if (nTotalRG>names->num_rg) {
|
||||
Atom *prev_radio_groups = names->radio_groups;
|
||||
|
||||
names->radio_groups= _XkbTypedRealloc(names->radio_groups,nTotalRG,
|
||||
Atom);
|
||||
if (names->radio_groups!=NULL) {
|
||||
_XkbClearElems(names->radio_groups,names->num_rg,nTotalRG-1,
|
||||
Atom);
|
||||
} else {
|
||||
_XkbFree(prev_radio_groups);
|
||||
}
|
||||
}
|
||||
if (names->radio_groups==NULL)
|
||||
return BadAlloc;
|
||||
names->num_rg= nTotalRG;
|
||||
}
|
||||
return Success;
|
||||
}
|
||||
|
||||
void
|
||||
#if NeedFunctionPrototypes
|
||||
XkbFreeNames(XkbDescPtr xkb,unsigned which,Bool freeMap)
|
||||
#else
|
||||
XkbFreeNames(xkb,which,freeMap)
|
||||
XkbDescPtr xkb;
|
||||
unsigned which;
|
||||
Bool freeMap;
|
||||
#endif
|
||||
{
|
||||
XkbNamesPtr names;
|
||||
|
||||
if ((xkb==NULL)||(xkb->names==NULL))
|
||||
return;
|
||||
names= xkb->names;
|
||||
if (freeMap)
|
||||
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++) {
|
||||
if (type->level_names!=NULL) {
|
||||
_XkbFree(type->level_names);
|
||||
type->level_names= NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((which&XkbKeyNamesMask)&&(names->keys!=NULL)) {
|
||||
_XkbFree(names->keys);
|
||||
names->keys= NULL;
|
||||
names->num_keys= 0;
|
||||
}
|
||||
if ((which&XkbKeyAliasesMask)&&(names->key_aliases)){
|
||||
_XkbFree(names->key_aliases);
|
||||
names->key_aliases=NULL;
|
||||
names->num_key_aliases=0;
|
||||
}
|
||||
if ((which&XkbRGNamesMask)&&(names->radio_groups)) {
|
||||
_XkbFree(names->radio_groups);
|
||||
names->radio_groups= NULL;
|
||||
names->num_rg= 0;
|
||||
}
|
||||
if (freeMap) {
|
||||
_XkbFree(names);
|
||||
xkb->names= NULL;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/***===================================================================***/
|
||||
|
||||
/*ARGSUSED*/
|
||||
Status
|
||||
#if NeedFunctionPrototypes
|
||||
XkbAllocControls(XkbDescPtr xkb,unsigned which)
|
||||
#else
|
||||
XkbAllocControls(xkb,which)
|
||||
XkbDescPtr xkb;
|
||||
unsigned which;
|
||||
#endif
|
||||
{
|
||||
if (xkb==NULL)
|
||||
return BadMatch;
|
||||
|
||||
if (xkb->ctrls==NULL) {
|
||||
xkb->ctrls= _XkbTypedCalloc(1,XkbControlsRec);
|
||||
if (!xkb->ctrls)
|
||||
return BadAlloc;
|
||||
}
|
||||
return Success;
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
#if NeedFunctionPrototypes
|
||||
XkbFreeControls(XkbDescPtr xkb,unsigned which,Bool freeMap)
|
||||
#else
|
||||
XkbFreeControls(xkb,which,freeMap)
|
||||
XkbDescPtr xkb;
|
||||
unsigned which;
|
||||
Bool freeMap;
|
||||
#endif
|
||||
{
|
||||
if (freeMap && (xkb!=NULL) && (xkb->ctrls!=NULL)) {
|
||||
_XkbFree(xkb->ctrls);
|
||||
xkb->ctrls= NULL;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/***===================================================================***/
|
||||
|
||||
Status
|
||||
#if NeedFunctionPrototypes
|
||||
XkbAllocIndicatorMaps(XkbDescPtr xkb)
|
||||
#else
|
||||
XkbAllocIndicatorMaps(xkb)
|
||||
XkbDescPtr xkb;
|
||||
#endif
|
||||
{
|
||||
if (xkb==NULL)
|
||||
return BadMatch;
|
||||
if (xkb->indicators==NULL) {
|
||||
xkb->indicators= _XkbTypedCalloc(1,XkbIndicatorRec);
|
||||
if (!xkb->indicators)
|
||||
return BadAlloc;
|
||||
}
|
||||
return Success;
|
||||
}
|
||||
|
||||
void
|
||||
#if NeedFunctionPrototypes
|
||||
XkbFreeIndicatorMaps(XkbDescPtr xkb)
|
||||
#else
|
||||
XkbFreeIndicatorMaps(xkb)
|
||||
XkbDescPtr xkb;
|
||||
#endif
|
||||
{
|
||||
if ((xkb!=NULL)&&(xkb->indicators!=NULL)) {
|
||||
_XkbFree(xkb->indicators);
|
||||
xkb->indicators= NULL;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/***====================================================================***/
|
||||
|
||||
XkbDescRec *
|
||||
#if NeedFunctionPrototypes
|
||||
XkbAllocKeyboard(void)
|
||||
#else
|
||||
XkbAllocKeyboard()
|
||||
#endif
|
||||
{
|
||||
XkbDescRec *xkb;
|
||||
|
||||
xkb = _XkbTypedCalloc(1,XkbDescRec);
|
||||
if (xkb)
|
||||
xkb->device_spec= XkbUseCoreKbd;
|
||||
return xkb;
|
||||
}
|
||||
|
||||
void
|
||||
#if NeedFunctionPrototypes
|
||||
XkbFreeKeyboard(XkbDescPtr xkb,unsigned which,Bool freeAll)
|
||||
#else
|
||||
XkbFreeKeyboard(xkb,which,freeAll)
|
||||
XkbDescPtr xkb;
|
||||
unsigned which;
|
||||
Bool freeAll;
|
||||
#endif
|
||||
{
|
||||
if (xkb==NULL)
|
||||
return;
|
||||
if (freeAll)
|
||||
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);
|
||||
if (which&XkbControlsMask)
|
||||
XkbFreeControls(xkb,XkbAllControlsMask,True);
|
||||
if (freeAll)
|
||||
_XkbFree(xkb);
|
||||
return;
|
||||
}
|
||||
|
||||
/***====================================================================***/
|
||||
|
||||
XkbDeviceLedInfoPtr
|
||||
#if NeedFunctionPrototypes
|
||||
XkbAddDeviceLedInfo(XkbDeviceInfoPtr devi,unsigned ledClass,unsigned ledId)
|
||||
#else
|
||||
XkbAddDeviceLedInfo(devi,ledClass,ledId)
|
||||
XkbDeviceInfoPtr devi;
|
||||
unsigned ledClass;
|
||||
unsigned ledId;
|
||||
#endif
|
||||
{
|
||||
XkbDeviceLedInfoPtr devli;
|
||||
register int i;
|
||||
|
||||
if ((!devi)||(!XkbSingleXIClass(ledClass))||(!XkbSingleXIId(ledId)))
|
||||
return NULL;
|
||||
for (i=0,devli=devi->leds;i<devi->num_leds;i++,devli++) {
|
||||
if ((devli->led_class==ledClass)&&(devli->led_id==ledId))
|
||||
return devli;
|
||||
}
|
||||
if (devi->num_leds>=devi->sz_leds) {
|
||||
XkbDeviceLedInfoRec *prev_leds = devi->leds;
|
||||
|
||||
if (devi->sz_leds>0) devi->sz_leds*= 2;
|
||||
else devi->sz_leds= 1;
|
||||
devi->leds= _XkbTypedRealloc(devi->leds,devi->sz_leds,
|
||||
XkbDeviceLedInfoRec);
|
||||
if (!devi->leds) {
|
||||
_XkbFree(prev_leds);
|
||||
devi->sz_leds= devi->num_leds= 0;
|
||||
return NULL;
|
||||
}
|
||||
i= devi->num_leds;
|
||||
for (devli=&devi->leds[i];i<devi->sz_leds;i++,devli++) {
|
||||
bzero(devli,sizeof(XkbDeviceLedInfoRec));
|
||||
devli->led_class= XkbXINone;
|
||||
devli->led_id= XkbXINone;
|
||||
}
|
||||
}
|
||||
devli= &devi->leds[devi->num_leds++];
|
||||
bzero(devli,sizeof(XkbDeviceLedInfoRec));
|
||||
devli->led_class= ledClass;
|
||||
devli->led_id= ledId;
|
||||
return devli;
|
||||
}
|
||||
|
||||
Status
|
||||
#if NeedFunctionPrototypes
|
||||
XkbResizeDeviceButtonActions(XkbDeviceInfoPtr devi,unsigned newTotal)
|
||||
#else
|
||||
XkbResizeDeviceButtonActions(devi,newTotal)
|
||||
XkbDeviceInfoPtr devi;
|
||||
unsigned newTotal;
|
||||
#endif
|
||||
{
|
||||
XkbAction *prev_btn_acts;
|
||||
|
||||
if ((!devi)||(newTotal>255))
|
||||
return BadValue;
|
||||
if ((devi->btn_acts!=NULL)&&(newTotal==devi->num_btns))
|
||||
return Success;
|
||||
if (newTotal==0) {
|
||||
if (devi->btn_acts!=NULL) {
|
||||
_XkbFree(devi->btn_acts);
|
||||
devi->btn_acts= NULL;
|
||||
}
|
||||
devi->num_btns= 0;
|
||||
return Success;
|
||||
}
|
||||
prev_btn_acts = devi->btn_acts;
|
||||
devi->btn_acts= _XkbTypedRealloc(devi->btn_acts,newTotal,XkbAction);
|
||||
if (devi->btn_acts==NULL) {
|
||||
_XkbFree(prev_btn_acts);
|
||||
devi->num_btns= 0;
|
||||
return BadAlloc;
|
||||
}
|
||||
if (newTotal>devi->num_btns) {
|
||||
XkbAction *act;
|
||||
act= &devi->btn_acts[devi->num_btns];
|
||||
bzero((char *)act,(newTotal-devi->num_btns)*sizeof(XkbAction));
|
||||
}
|
||||
devi->num_btns= newTotal;
|
||||
return Success;
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
XkbDeviceInfoPtr
|
||||
#if NeedFunctionPrototypes
|
||||
XkbAllocDeviceInfo(unsigned deviceSpec,unsigned nButtons,unsigned szLeds)
|
||||
#else
|
||||
XkbAllocDeviceInfo(deviceSpec,nButtons,szLeds)
|
||||
unsigned deviceSpec;
|
||||
unsigned nButtons;
|
||||
unsigned szLeds;
|
||||
#endif
|
||||
{
|
||||
XkbDeviceInfoPtr devi;
|
||||
|
||||
devi= _XkbTypedCalloc(1,XkbDeviceInfoRec);
|
||||
if (devi!=NULL) {
|
||||
devi->device_spec= deviceSpec;
|
||||
devi->has_own_state= False;
|
||||
devi->num_btns= 0;
|
||||
devi->btn_acts= NULL;
|
||||
if (nButtons>0) {
|
||||
devi->num_btns= nButtons;
|
||||
devi->btn_acts= _XkbTypedCalloc(nButtons,XkbAction);
|
||||
if (!devi->btn_acts) {
|
||||
_XkbFree(devi);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
devi->dflt_kbd_fb= XkbXINone;
|
||||
devi->dflt_led_fb= XkbXINone;
|
||||
devi->num_leds= 0;
|
||||
devi->sz_leds= 0;
|
||||
devi->leds= NULL;
|
||||
if (szLeds>0) {
|
||||
devi->sz_leds= szLeds;
|
||||
devi->leds= _XkbTypedCalloc(szLeds,XkbDeviceLedInfoRec);
|
||||
if (!devi->leds) {
|
||||
if (devi->btn_acts)
|
||||
_XkbFree(devi->btn_acts);
|
||||
_XkbFree(devi);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
return devi;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
#if NeedFunctionPrototypes
|
||||
XkbFreeDeviceInfo(XkbDeviceInfoPtr devi,unsigned which,Bool freeDevI)
|
||||
#else
|
||||
XkbFreeDeviceInfo(devi,which,freeDevI)
|
||||
XkbDeviceInfoPtr devi;
|
||||
unsigned which;
|
||||
Bool freeDevI;
|
||||
#endif
|
||||
{
|
||||
if (devi) {
|
||||
if (freeDevI) {
|
||||
which= XkbXI_AllDeviceFeaturesMask;
|
||||
if (devi->name) {
|
||||
_XkbFree(devi->name);
|
||||
devi->name= NULL;
|
||||
}
|
||||
}
|
||||
if ((which&XkbXI_ButtonActionsMask)&&(devi->btn_acts)) {
|
||||
_XkbFree(devi->btn_acts);
|
||||
devi->num_btns= 0;
|
||||
devi->btn_acts= NULL;
|
||||
}
|
||||
if ((which&XkbXI_IndicatorsMask)&&(devi->leds)) {
|
||||
register int i;
|
||||
if ((which&XkbXI_IndicatorsMask)==XkbXI_IndicatorsMask) {
|
||||
_XkbFree(devi->leds);
|
||||
devi->sz_leds= devi->num_leds= 0;
|
||||
devi->leds= NULL;
|
||||
}
|
||||
else {
|
||||
XkbDeviceLedInfoPtr devli;
|
||||
for (i=0,devli=devi->leds;i<devi->num_leds;i++,devli++) {
|
||||
if (which&XkbXI_IndicatorMapsMask)
|
||||
bzero((char *)&devli->maps[0],sizeof(devli->maps));
|
||||
else bzero((char *)&devli->names[0],sizeof(devli->names));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (freeDevI)
|
||||
_XkbFree(devi);
|
||||
}
|
||||
return;
|
||||
}
|
||||
1377
xkb/XKBGAlloc.c
Normal file
1377
xkb/XKBGAlloc.c
Normal file
File diff suppressed because it is too large
Load diff
1077
xkb/XKBMAlloc.c
Normal file
1077
xkb/XKBMAlloc.c
Normal file
File diff suppressed because it is too large
Load diff
1071
xkb/XKBMisc.c
Normal file
1071
xkb/XKBMisc.c
Normal file
File diff suppressed because it is too large
Load diff
359
xkb/ddxBeep.c
Normal file
359
xkb/ddxBeep.c
Normal file
|
|
@ -0,0 +1,359 @@
|
|||
/* $Xorg: ddxBeep.c,v 1.3 2000/08/17 19:53:45 cpqbld Exp $ */
|
||||
/************************************************************
|
||||
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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#define NEED_EVENTS 1
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include <X11/keysym.h>
|
||||
#include "inputstr.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "windowstr.h"
|
||||
#include "XKBsrv.h"
|
||||
#include "XI.h"
|
||||
|
||||
#if (defined(__osf__) && defined(__alpha))
|
||||
#include <sys/sysinfo.h>
|
||||
#include <alpha/hal_sysinfo.h>
|
||||
#include <alpha/prom.h>
|
||||
#endif
|
||||
|
||||
/*#define FALLING_TONE 1*/
|
||||
/*#define RISING_TONE 1*/
|
||||
#define FALLING_TONE 10
|
||||
#define RISING_TONE 10
|
||||
#define SHORT_TONE 50
|
||||
#define SHORT_DELAY 60
|
||||
#define LONG_TONE 75
|
||||
#define VERY_LONG_TONE 100
|
||||
#define LONG_DELAY 85
|
||||
#define CLICK_DURATION 1
|
||||
|
||||
#define DEEP_PITCH 250
|
||||
#define LOW_PITCH 500
|
||||
#define MID_PITCH 1000
|
||||
#define HIGH_PITCH 2000
|
||||
#define CLICK_PITCH 1500
|
||||
|
||||
static unsigned long atomGeneration= -1;
|
||||
static Atom featureOn;
|
||||
static Atom featureOff;
|
||||
static Atom featureChange;
|
||||
static Atom ledOn;
|
||||
static Atom ledOff;
|
||||
static Atom ledChange;
|
||||
static Atom slowWarn;
|
||||
static Atom slowPress;
|
||||
static Atom slowReject;
|
||||
static Atom slowAccept;
|
||||
static Atom slowRelease;
|
||||
static Atom stickyLatch;
|
||||
static Atom stickyLock;
|
||||
static Atom stickyUnlock;
|
||||
static Atom bounceReject;
|
||||
static char doesPitch = 1;
|
||||
|
||||
#define FEATURE_ON "AX_FeatureOn"
|
||||
#define FEATURE_OFF "AX_FeatureOff"
|
||||
#define FEATURE_CHANGE "AX_FeatureChange"
|
||||
#define LED_ON "AX_IndicatorOn"
|
||||
#define LED_OFF "AX_IndicatorOff"
|
||||
#define LED_CHANGE "AX_IndicatorChange"
|
||||
#define SLOW_WARN "AX_SlowKeysWarning"
|
||||
#define SLOW_PRESS "AX_SlowKeyPress"
|
||||
#define SLOW_REJECT "AX_SlowKeyReject"
|
||||
#define SLOW_ACCEPT "AX_SlowKeyAccept"
|
||||
#define SLOW_RELEASE "AX_SlowKeyRelease"
|
||||
#define STICKY_LATCH "AX_StickyLatch"
|
||||
#define STICKY_LOCK "AX_StickyLock"
|
||||
#define STICKY_UNLOCK "AX_StickyUnlock"
|
||||
#define BOUNCE_REJECT "AX_BounceKeyReject"
|
||||
|
||||
#define MAKE_ATOM(a) MakeAtom(a,sizeof(a)-1,True)
|
||||
|
||||
static void
|
||||
#if NeedFunctionPrototypes
|
||||
_XkbDDXBeepInitAtoms(void)
|
||||
#else
|
||||
_XkbDDXBeepInitAtoms()
|
||||
#endif
|
||||
{
|
||||
featureOn= MAKE_ATOM(FEATURE_ON);
|
||||
featureOff= MAKE_ATOM(FEATURE_OFF);
|
||||
featureChange= MAKE_ATOM(FEATURE_CHANGE);
|
||||
ledOn= MAKE_ATOM(LED_ON);
|
||||
ledOff= MAKE_ATOM(LED_OFF);
|
||||
ledChange= MAKE_ATOM(LED_CHANGE);
|
||||
slowWarn= MAKE_ATOM(SLOW_WARN);
|
||||
slowPress= MAKE_ATOM(SLOW_PRESS);
|
||||
slowReject= MAKE_ATOM(SLOW_REJECT);
|
||||
slowAccept= MAKE_ATOM(SLOW_ACCEPT);
|
||||
slowRelease= MAKE_ATOM(SLOW_RELEASE);
|
||||
stickyLatch= MAKE_ATOM(STICKY_LATCH);
|
||||
stickyLock= MAKE_ATOM(STICKY_LOCK);
|
||||
stickyUnlock= MAKE_ATOM(STICKY_UNLOCK);
|
||||
bounceReject= MAKE_ATOM(BOUNCE_REJECT);
|
||||
#if (defined(__osf__) && defined(__alpha))
|
||||
/* [[[ WDW - Some bells do not allow for pitch changes.
|
||||
* Maybe this could become part of the keymap? ]]]
|
||||
*/
|
||||
{
|
||||
char keyboard[8];
|
||||
|
||||
/* Find the class of keyboard being used.
|
||||
*/
|
||||
keyboard[0] = '\0';
|
||||
if (-1 == getsysinfo(GSI_KEYBOARD,
|
||||
keyboard, sizeof(keyboard),
|
||||
0, NULL))
|
||||
keyboard[0] = '\0';
|
||||
|
||||
if ((strcmp(keyboard,"LK201") == 0) ||
|
||||
(strcmp(keyboard,"LK401") == 0) ||
|
||||
(strcmp(keyboard,"LK421") == 0) ||
|
||||
(strcmp(keyboard,"LK443") == 0))
|
||||
doesPitch = 0;
|
||||
}
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
static CARD32
|
||||
#if NeedFunctionPrototypes
|
||||
_XkbDDXBeepExpire(OsTimerPtr timer,CARD32 now,pointer arg)
|
||||
#else
|
||||
_XkbDDXBeepExpire(timer,now,arg)
|
||||
OsTimerPtr timer;
|
||||
CARD32 now;
|
||||
pointer arg;
|
||||
#endif
|
||||
{
|
||||
DeviceIntPtr dev= (DeviceIntPtr)arg;
|
||||
KbdFeedbackPtr feed;
|
||||
KeybdCtrl * ctrl;
|
||||
XkbSrvInfoPtr xkbInfo;
|
||||
CARD32 next;
|
||||
int pitch,duration;
|
||||
int oldPitch,oldDuration;
|
||||
Atom name;
|
||||
|
||||
if ((dev==NULL)||(dev->key==NULL)||(dev->key->xkbInfo==NULL)||
|
||||
(dev->kbdfeed==NULL))
|
||||
return 0;
|
||||
if (atomGeneration!=serverGeneration) {
|
||||
_XkbDDXBeepInitAtoms();
|
||||
atomGeneration= serverGeneration;
|
||||
}
|
||||
|
||||
feed= dev->kbdfeed;
|
||||
ctrl= &feed->ctrl;
|
||||
xkbInfo= dev->key->xkbInfo;
|
||||
next= 0;
|
||||
pitch= oldPitch= ctrl->bell_pitch;
|
||||
duration= oldDuration= ctrl->bell_duration;
|
||||
#ifdef DEBUG
|
||||
if (xkbDebugFlags>1)
|
||||
ErrorF("beep: %d (count= %d)\n",xkbInfo->beepType,xkbInfo->beepCount);
|
||||
#endif
|
||||
name= None;
|
||||
switch (xkbInfo->beepType) {
|
||||
default:
|
||||
ErrorF("Unknown beep type %d\n",xkbInfo->beepType);
|
||||
case _BEEP_NONE:
|
||||
duration= 0;
|
||||
break;
|
||||
|
||||
/* When an LED is turned on, we want a high-pitched beep.
|
||||
* When the LED it turned off, we want a low-pitched beep.
|
||||
* If we cannot do pitch, we want a single beep for on and two
|
||||
* beeps for off.
|
||||
*/
|
||||
case _BEEP_LED_ON:
|
||||
if (name==None) name= ledOn;
|
||||
duration= SHORT_TONE;
|
||||
pitch= HIGH_PITCH;
|
||||
break;
|
||||
case _BEEP_LED_OFF:
|
||||
if (name==None) name= ledOff;
|
||||
duration= SHORT_TONE;
|
||||
pitch= LOW_PITCH;
|
||||
if (!doesPitch && xkbInfo->beepCount<1)
|
||||
next = SHORT_DELAY;
|
||||
break;
|
||||
|
||||
/* When a Feature is turned on, we want an up-siren.
|
||||
* When a Feature is turned off, we want a down-siren.
|
||||
* If we cannot do pitch, we want a single beep for on and two
|
||||
* beeps for off.
|
||||
*/
|
||||
case _BEEP_FEATURE_ON:
|
||||
if (name==None) name= featureOn;
|
||||
if (xkbInfo->beepCount<1) {
|
||||
pitch= LOW_PITCH;
|
||||
duration= VERY_LONG_TONE;
|
||||
if (doesPitch)
|
||||
next= SHORT_DELAY;
|
||||
}
|
||||
else {
|
||||
pitch= MID_PITCH;
|
||||
duration= SHORT_TONE;
|
||||
}
|
||||
break;
|
||||
|
||||
case _BEEP_FEATURE_OFF:
|
||||
if (name==None) name= featureOff;
|
||||
if (xkbInfo->beepCount<1) {
|
||||
pitch= MID_PITCH;
|
||||
if (doesPitch)
|
||||
duration= VERY_LONG_TONE;
|
||||
else duration= SHORT_TONE;
|
||||
next= SHORT_DELAY;
|
||||
}
|
||||
else {
|
||||
pitch= LOW_PITCH;
|
||||
duration= SHORT_TONE;
|
||||
}
|
||||
break;
|
||||
|
||||
/* Two high beeps indicate an LED or Feature changed
|
||||
* state, but that another LED or Feature is also on.
|
||||
* [[[WDW - This is not in AccessDOS ]]]
|
||||
*/
|
||||
case _BEEP_LED_CHANGE:
|
||||
if (name==None) name= ledChange;
|
||||
case _BEEP_FEATURE_CHANGE:
|
||||
if (name==None) name= featureChange;
|
||||
duration= SHORT_TONE;
|
||||
pitch= HIGH_PITCH;
|
||||
if (xkbInfo->beepCount<1) {
|
||||
next= SHORT_DELAY;
|
||||
}
|
||||
break;
|
||||
|
||||
/* Three high-pitched beeps are the warning that SlowKeys
|
||||
* is going to be turned on or off.
|
||||
*/
|
||||
case _BEEP_SLOW_WARN:
|
||||
if (name==None) name= slowWarn;
|
||||
duration= SHORT_TONE;
|
||||
pitch= HIGH_PITCH;
|
||||
if (xkbInfo->beepCount<2)
|
||||
next= SHORT_DELAY;
|
||||
break;
|
||||
|
||||
/* Click on SlowKeys press and accept.
|
||||
* Deep pitch when a SlowKey or BounceKey is rejected.
|
||||
* [[[WDW - Rejects are not in AccessDOS ]]]
|
||||
* If we cannot do pitch, we want single beeps.
|
||||
*/
|
||||
case _BEEP_SLOW_PRESS:
|
||||
if (name==None) name= slowPress;
|
||||
case _BEEP_SLOW_ACCEPT:
|
||||
if (name==None) name= slowAccept;
|
||||
case _BEEP_SLOW_RELEASE:
|
||||
if (name==None) name= slowRelease;
|
||||
duration= CLICK_DURATION;
|
||||
pitch= CLICK_PITCH;
|
||||
break;
|
||||
case _BEEP_BOUNCE_REJECT:
|
||||
if (name==None) name= bounceReject;
|
||||
case _BEEP_SLOW_REJECT:
|
||||
if (name==None) name= slowReject;
|
||||
duration= SHORT_TONE;
|
||||
pitch= DEEP_PITCH;
|
||||
break;
|
||||
|
||||
/* Low followed by high pitch when a StickyKey is latched.
|
||||
* High pitch when a StickyKey is locked.
|
||||
* Low pitch when unlocked.
|
||||
* If we cannot do pitch, two beeps for latch, nothing for
|
||||
* lock, and two for unlock.
|
||||
*/
|
||||
case _BEEP_STICKY_LATCH:
|
||||
if (name==None) name= stickyLatch;
|
||||
duration= SHORT_TONE;
|
||||
if (xkbInfo->beepCount<1) {
|
||||
next= SHORT_DELAY;
|
||||
pitch= LOW_PITCH;
|
||||
}
|
||||
else pitch= HIGH_PITCH;
|
||||
break;
|
||||
case _BEEP_STICKY_LOCK:
|
||||
if (name==None) name= stickyLock;
|
||||
if (doesPitch) {
|
||||
duration= SHORT_TONE;
|
||||
pitch= HIGH_PITCH;
|
||||
}
|
||||
break;
|
||||
case _BEEP_STICKY_UNLOCK:
|
||||
if (name==None) name= stickyUnlock;
|
||||
duration= SHORT_TONE;
|
||||
pitch= LOW_PITCH;
|
||||
if (!doesPitch && xkbInfo->beepCount<1)
|
||||
next = SHORT_DELAY;
|
||||
break;
|
||||
}
|
||||
if (duration>0) {
|
||||
ctrl->bell_duration= duration;
|
||||
ctrl->bell_pitch= pitch;
|
||||
if (xkbInfo->beepCount==0) {
|
||||
XkbHandleBell(0,0,dev,ctrl->bell,(pointer)ctrl,KbdFeedbackClass,name,None,
|
||||
NULL);
|
||||
}
|
||||
else if (xkbInfo->desc->ctrls->enabled_ctrls&XkbAudibleBellMask) {
|
||||
(*dev->kbdfeed->BellProc)(ctrl->bell,dev,(pointer)ctrl,KbdFeedbackClass);
|
||||
}
|
||||
ctrl->bell_duration= oldDuration;
|
||||
ctrl->bell_pitch= oldPitch;
|
||||
xkbInfo->beepCount++;
|
||||
}
|
||||
return next;
|
||||
}
|
||||
|
||||
int
|
||||
#if NeedFunctionPrototypes
|
||||
XkbDDXAccessXBeep(DeviceIntPtr dev,unsigned what,unsigned which)
|
||||
#else
|
||||
XkbDDXAccessXBeep(dev,what,which)
|
||||
DeviceIntPtr dev;
|
||||
unsigned what;
|
||||
unsigned which;
|
||||
#endif
|
||||
{
|
||||
XkbSrvInfoRec *xkbInfo= dev->key->xkbInfo;
|
||||
CARD32 next;
|
||||
|
||||
xkbInfo->beepType= what;
|
||||
xkbInfo->beepCount= 0;
|
||||
next= _XkbDDXBeepExpire(NULL,0,(pointer)dev);
|
||||
if (next>0) {
|
||||
xkbInfo->beepTimer= TimerSet(xkbInfo->beepTimer,
|
||||
0, next,
|
||||
_XkbDDXBeepExpire, (pointer)dev);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
217
xkb/ddxConfig.c
Normal file
217
xkb/ddxConfig.c
Normal file
|
|
@ -0,0 +1,217 @@
|
|||
/* $Xorg: ddxConfig.c,v 1.3 2000/08/17 19:53:45 cpqbld Exp $ */
|
||||
/************************************************************
|
||||
Copyright (c) 1995 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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#define NEED_EVENTS 1
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include <X11/keysym.h>
|
||||
#include "inputstr.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "windowstr.h"
|
||||
#include "os.h"
|
||||
#define XKBSRV_NEED_FILE_FUNCS
|
||||
#include "XKBsrv.h"
|
||||
#include <X11/extensions/XKBconfig.h>
|
||||
|
||||
Bool
|
||||
#if NeedFunctionPrototypes
|
||||
XkbDDXApplyConfig(XPointer cfg_in,XkbSrvInfoPtr info)
|
||||
#else
|
||||
XkbDDXApplyConfig(cfg_in,info)
|
||||
XPointer cfg_in;
|
||||
XkbSrvInfoPtr info;
|
||||
#endif
|
||||
{
|
||||
XkbConfigRtrnPtr rtrn;
|
||||
XkbDescPtr xkb;
|
||||
Bool ok;
|
||||
XkbEventCauseRec cause;
|
||||
|
||||
xkb= info->desc;
|
||||
rtrn= (XkbConfigRtrnPtr)cfg_in;
|
||||
if (rtrn==NULL)
|
||||
return True;
|
||||
ok= XkbCFApplyRtrnValues(rtrn,XkbCFDflts,xkb);
|
||||
if (rtrn->initial_mods.replace) {
|
||||
info->state.locked_mods= rtrn->initial_mods.mods;
|
||||
}
|
||||
else {
|
||||
info->state.locked_mods|= rtrn->initial_mods.mods;
|
||||
if (rtrn->initial_mods.mods_clear)
|
||||
info->state.locked_mods&= ~rtrn->initial_mods.mods_clear;
|
||||
}
|
||||
XkbComputeDerivedState(info);
|
||||
XkbSetCauseUnknown(&cause);
|
||||
XkbUpdateIndicators(info->device,XkbAllIndicatorsMask,False,NULL,&cause);
|
||||
if (info->device && info->device->kbdfeed) {
|
||||
DeviceIntPtr dev;
|
||||
KeybdCtrl newCtrl;
|
||||
dev= info->device;
|
||||
newCtrl= dev->kbdfeed->ctrl;
|
||||
if (rtrn->click_volume>=0)
|
||||
newCtrl.click= rtrn->click_volume;
|
||||
if (rtrn->bell_volume>=0)
|
||||
newCtrl.bell= rtrn->bell_volume;
|
||||
if (rtrn->bell_pitch>0)
|
||||
newCtrl.bell_pitch= rtrn->bell_pitch;
|
||||
if (rtrn->bell_duration>0)
|
||||
newCtrl.bell_duration= rtrn->bell_duration;
|
||||
if (dev->kbdfeed->CtrlProc)
|
||||
(*dev->kbdfeed->CtrlProc)(dev,&newCtrl);
|
||||
}
|
||||
XkbCFFreeRtrn(rtrn,XkbCFDflts,xkb);
|
||||
return ok;
|
||||
}
|
||||
|
||||
XPointer
|
||||
#if NeedFunctionPrototypes
|
||||
XkbDDXPreloadConfig( char ** rulesRtrn,
|
||||
XkbRF_VarDefsPtr defs,
|
||||
XkbComponentNamesPtr names,
|
||||
DeviceIntPtr dev)
|
||||
#else
|
||||
XkbDDXPreloadConfig(rulesRtrn,defs,names,dev)
|
||||
char ** rulesRtrn;
|
||||
XkbRF_VarDefsPtr defs;
|
||||
XkbComponentNamesPtr names;
|
||||
DeviceIntPtr dev;
|
||||
#endif
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
char * dName;
|
||||
FILE * file;
|
||||
XkbConfigRtrnPtr rtrn;
|
||||
extern char * display;
|
||||
|
||||
#if defined(MetroLink)
|
||||
if (dev && dev->name)
|
||||
dName= dev->name;
|
||||
else dName= "";
|
||||
/* It doesn't appear that XkbBaseDirectory could ever get set to NULL */
|
||||
sprintf(buf,"%s/X%s-config%s%s",XkbBaseDirectory,display,
|
||||
(dName[0]?".":""),dName);
|
||||
#else
|
||||
if (dev && dev->name)
|
||||
dName= dev->name;
|
||||
else dName= "";
|
||||
if (XkbBaseDirectory!=NULL) {
|
||||
if (strlen(XkbBaseDirectory)+strlen(display)
|
||||
+strlen(dName)+10+(dName[0]?1:0) > PATH_MAX)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
ErrorF("path exceeds max length\n");
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
sprintf(buf,"%s/X%s-config%s%s",XkbBaseDirectory,display,
|
||||
(dName[0]?".":""),dName);
|
||||
}
|
||||
else {
|
||||
if (strlen(display)+strlen(dName)+10+(dName[0]?1:0) > PATH_MAX)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
ErrorF("path exceeds max length\n");
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
sprintf(buf,"X%s-config%s%s",display,(dName[0]?".":""),dName);
|
||||
}
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
ErrorF("Looking for keyboard configuration in %s...",buf);
|
||||
#endif
|
||||
file= fopen(buf,"r");
|
||||
if (file==NULL) {
|
||||
#ifdef DEBUG
|
||||
ErrorF("file not found\n");
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
rtrn= _XkbTypedCalloc(1,XkbConfigRtrnRec);
|
||||
if (rtrn!=NULL) {
|
||||
if (!XkbCFParse(file,XkbCFDflts,NULL,rtrn)) {
|
||||
#ifdef DEBUG
|
||||
ErrorF("error\n");
|
||||
#endif
|
||||
ErrorF("Error parsing config file: ");
|
||||
XkbCFReportError(stderr,buf,rtrn->error,rtrn->line);
|
||||
_XkbFree(rtrn);
|
||||
fclose(file);
|
||||
return NULL;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
ErrorF("found it\n");
|
||||
#endif
|
||||
if (rtrn->rules_file) {
|
||||
*rulesRtrn= rtrn->rules_file;
|
||||
rtrn->rules_file= NULL;
|
||||
}
|
||||
if (rtrn->model) {
|
||||
defs->model= rtrn->model;
|
||||
rtrn->model= NULL;
|
||||
}
|
||||
if (rtrn->layout) {
|
||||
defs->layout= rtrn->layout;
|
||||
rtrn->layout= NULL;
|
||||
}
|
||||
if (rtrn->variant) {
|
||||
defs->variant= rtrn->variant;
|
||||
rtrn->variant= NULL;
|
||||
}
|
||||
if (rtrn->options) {
|
||||
defs->options= rtrn->options;
|
||||
rtrn->options= NULL;
|
||||
}
|
||||
XkbSetRulesUsed(defs);
|
||||
|
||||
if (rtrn->keycodes!=NULL) {
|
||||
names->keycodes= rtrn->keycodes;
|
||||
rtrn->keycodes= NULL;
|
||||
}
|
||||
if (rtrn->geometry!=NULL) {
|
||||
names->geometry= rtrn->geometry;
|
||||
rtrn->geometry= NULL;
|
||||
}
|
||||
if (rtrn->symbols!=NULL) {
|
||||
if (rtrn->phys_symbols==NULL)
|
||||
rtrn->phys_symbols= _XkbDupString(names->symbols);
|
||||
names->symbols= rtrn->symbols;
|
||||
rtrn->symbols= NULL;
|
||||
}
|
||||
if (rtrn->types!=NULL) {
|
||||
names->types= rtrn->types;
|
||||
rtrn->types= NULL;
|
||||
}
|
||||
if (rtrn->compat!=NULL) {
|
||||
names->compat= rtrn->compat;
|
||||
rtrn->compat= NULL;
|
||||
}
|
||||
}
|
||||
fclose(file);
|
||||
return (XPointer)rtrn;
|
||||
}
|
||||
133
xkb/ddxCtrls.c
Normal file
133
xkb/ddxCtrls.c
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
/* $Xorg: ddxCtrls.c,v 1.3 2000/08/17 19:53:45 cpqbld Exp $ */
|
||||
/************************************************************
|
||||
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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#define NEED_EVENTS 1
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include <X11/keysym.h>
|
||||
#include "inputstr.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "windowstr.h"
|
||||
#include "XKBsrv.h"
|
||||
#include "XI.h"
|
||||
|
||||
void
|
||||
#if NeedFunctionPrototypes
|
||||
XkbDDXKeybdCtrlProc(DeviceIntPtr dev,KeybdCtrl *ctrl)
|
||||
#else
|
||||
XkbDDXKeybdCtrlProc(dev,ctrl)
|
||||
DeviceIntPtr dev;
|
||||
KeybdCtrl * ctrl;
|
||||
#endif
|
||||
{
|
||||
int realRepeat;
|
||||
|
||||
realRepeat= ctrl->autoRepeat;
|
||||
if ((dev->kbdfeed)&&(XkbDDXUsesSoftRepeat(dev)))
|
||||
ctrl->autoRepeat= 0;
|
||||
#ifdef DEBUG
|
||||
if (xkbDebugFlags&0x4) {
|
||||
ErrorF("XkbDDXKeybdCtrlProc: setting repeat to %d (real repeat is %d)\n",
|
||||
ctrl->autoRepeat,realRepeat);
|
||||
}
|
||||
#endif
|
||||
if (dev->key && dev->key->xkbInfo && dev->key->xkbInfo->kbdProc)
|
||||
(*dev->key->xkbInfo->kbdProc)(dev,ctrl);
|
||||
ctrl->autoRepeat= realRepeat;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
#if NeedFunctionPrototypes
|
||||
XkbDDXUsesSoftRepeat(DeviceIntPtr pXDev)
|
||||
#else
|
||||
XkbDDXUsesSoftRepeat(pXDev)
|
||||
DeviceIntPtr pXDev;
|
||||
#endif
|
||||
{
|
||||
#ifndef XKB_ALWAYS_USES_SOFT_REPEAT
|
||||
if (pXDev && pXDev->kbdfeed ) {
|
||||
if (pXDev->kbdfeed->ctrl.autoRepeat) {
|
||||
if (pXDev->key && pXDev->key->xkbInfo) {
|
||||
XkbDescPtr xkb;
|
||||
xkb= pXDev->key->xkbInfo->desc;
|
||||
if ((xkb->ctrls->repeat_delay == 660) &&
|
||||
(xkb->ctrls->repeat_interval == 40) &&
|
||||
((xkb->ctrls->enabled_ctrls&(XkbSlowKeysMask|
|
||||
XkbBounceKeysMask|
|
||||
XkbMouseKeysMask))==0)) {
|
||||
return 0;
|
||||
}
|
||||
return ((xkb->ctrls->enabled_ctrls&XkbRepeatKeysMask)!=0);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
#else
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
#if NeedFunctionPrototypes
|
||||
XkbDDXChangeControls(DeviceIntPtr dev,XkbControlsPtr old,XkbControlsPtr new)
|
||||
#else
|
||||
XkbDDXChangeControls(dev,old,new)
|
||||
DeviceIntPtr dev;
|
||||
XkbControlsPtr old;
|
||||
XkbControlsPtr new;
|
||||
#endif
|
||||
{
|
||||
unsigned changed;
|
||||
|
||||
changed= new->enabled_ctrls^old->enabled_ctrls;
|
||||
#ifdef NOTDEF
|
||||
if (changed&XkbRepeatKeysMask) {
|
||||
if (dev->kbdfeed) {
|
||||
int realRepeat;
|
||||
|
||||
if (new->enabled_ctrls&XkbRepeatKeysMask)
|
||||
dev->kbdfeed->ctrl.autoRepeat= realRepeat= 1;
|
||||
else dev->kbdfeed->ctrl.autoRepeat= realRepeat= 0;
|
||||
|
||||
if (XkbDDXUsesSoftRepeat(dev))
|
||||
dev->kbdfeed->ctrl.autoRepeat= FALSE;
|
||||
if (dev->kbdfeed->CtrlProc)
|
||||
(*dev->kbdfeed->CtrlProc)(dev,&dev->kbdfeed->ctrl);
|
||||
dev->kbdfeed->ctrl.autoRepeat= realRepeat;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (changed&XkbPerKeyRepeatMask) {
|
||||
if (dev->kbdfeed->CtrlProc)
|
||||
(*dev->kbdfeed->CtrlProc)(dev,&dev->kbdfeed->ctrl);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
104
xkb/ddxDevBtn.c
Normal file
104
xkb/ddxDevBtn.c
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
/* $Xorg: ddxDevBtn.c,v 1.3 2000/08/17 19:53:45 cpqbld Exp $ */
|
||||
/************************************************************
|
||||
Copyright (c) 1995 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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#define NEED_EVENTS 1
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include <X11/keysym.h>
|
||||
#include "inputstr.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "windowstr.h"
|
||||
#include "XKBsrv.h"
|
||||
#include "XI.h"
|
||||
#include "XIproto.h"
|
||||
|
||||
extern int DeviceButtonPress,DeviceButtonRelease,DeviceValuator;
|
||||
|
||||
void
|
||||
#if NeedFunctionPrototypes
|
||||
XkbDDXFakeDeviceButton(DeviceIntPtr dev,Bool press,int button)
|
||||
#else
|
||||
XkbDDXFakeDeviceButton(dev,press,button)
|
||||
DeviceIntPtr dev;
|
||||
Bool press;
|
||||
int button;
|
||||
#endif
|
||||
{
|
||||
int * devVal;
|
||||
INT32 * evVal;
|
||||
xEvent events[2];
|
||||
deviceKeyButtonPointer *btn;
|
||||
deviceValuator * val;
|
||||
int x,y;
|
||||
int nAxes, i, count;
|
||||
|
||||
if ((dev==(DeviceIntPtr)LookupPointerDevice())||(!dev->public.on))
|
||||
return;
|
||||
|
||||
nAxes = (dev->valuator?dev->valuator->numAxes:0);
|
||||
if (nAxes > 6)
|
||||
nAxes = 6;
|
||||
|
||||
GetSpritePosition(&x,&y);
|
||||
btn= (deviceKeyButtonPointer *) &events[0];
|
||||
val= (deviceValuator *) &events[1];
|
||||
if (press) btn->type= DeviceButtonPress;
|
||||
else btn->type= DeviceButtonRelease;
|
||||
btn->detail= button;
|
||||
btn->time= GetTimeInMillis();
|
||||
btn->root_x= x;
|
||||
btn->root_y= y;
|
||||
btn->deviceid= dev->id;
|
||||
count= 1;
|
||||
if (nAxes>0) {
|
||||
btn->deviceid|= 0x80;
|
||||
val->type = DeviceValuator;
|
||||
val->deviceid = dev->id;
|
||||
val->first_valuator = 0;
|
||||
|
||||
evVal= &val->valuator0;
|
||||
devVal= dev->valuator->axisVal;
|
||||
for (i=nAxes;i>0;i--) {
|
||||
*evVal++ = *devVal++;
|
||||
if (evVal > &val->valuator5) {
|
||||
int tmp = val->first_valuator+6;
|
||||
val->num_valuators = 6;
|
||||
val++;
|
||||
evVal= &val->valuator0;
|
||||
val->first_valuator= tmp;
|
||||
}
|
||||
}
|
||||
if ((nAxes % 6) != 0) {
|
||||
val->num_valuators = (nAxes % 6);
|
||||
}
|
||||
count= 1+((nAxes+5)/6);
|
||||
}
|
||||
|
||||
(*dev->public.processInputProc)((xEventPtr)btn, dev, count);
|
||||
return;
|
||||
}
|
||||
62
xkb/ddxFakeBtn.c
Normal file
62
xkb/ddxFakeBtn.c
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
/* $Xorg: ddxFakeBtn.c,v 1.3 2000/08/17 19:53:45 cpqbld Exp $ */
|
||||
/************************************************************
|
||||
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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#define NEED_EVENTS 1
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include <X11/keysym.h>
|
||||
#include "inputstr.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "windowstr.h"
|
||||
#include "XKBsrv.h"
|
||||
#include "XI.h"
|
||||
|
||||
void
|
||||
#if NeedFunctionPrototypes
|
||||
XkbDDXFakePointerButton(int event,int button)
|
||||
#else
|
||||
XkbDDXFakePointerButton(event,button)
|
||||
int event;
|
||||
int button;
|
||||
#endif
|
||||
{
|
||||
xEvent ev;
|
||||
int x,y;
|
||||
DevicePtr ptr;
|
||||
|
||||
if ((ptr = LookupPointerDevice())==NULL)
|
||||
return;
|
||||
GetSpritePosition(&x,&y);
|
||||
ev.u.u.type = event;
|
||||
ev.u.u.detail = button;
|
||||
ev.u.keyButtonPointer.time = GetTimeInMillis();
|
||||
ev.u.keyButtonPointer.rootX = x;
|
||||
ev.u.keyButtonPointer.rootY = y;
|
||||
(*ptr->processInputProc)( &ev, (DeviceIntPtr)ptr, 1 );
|
||||
return;
|
||||
}
|
||||
76
xkb/ddxFakeMtn.c
Normal file
76
xkb/ddxFakeMtn.c
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
/* $Xorg: ddxFakeMtn.c,v 1.3 2000/08/17 19:53:45 cpqbld Exp $ */
|
||||
/************************************************************
|
||||
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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#define NEED_EVENTS 1
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include <X11/keysym.h>
|
||||
#include "inputstr.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "windowstr.h"
|
||||
#include "XKBsrv.h"
|
||||
#include "XI.h"
|
||||
|
||||
extern WindowPtr GetSpriteWindow(
|
||||
#if NeedFunctionPrototypes
|
||||
void
|
||||
#endif
|
||||
);
|
||||
|
||||
void
|
||||
#if NeedFunctionPrototypes
|
||||
XkbDDXFakePointerMotion(unsigned flags,int x,int y)
|
||||
#else
|
||||
XkbDDXFakePointerMotion(flags,x,y)
|
||||
unsigned flags;
|
||||
int x;
|
||||
int y;
|
||||
#endif
|
||||
{
|
||||
ScreenPtr pScreen;
|
||||
int oldX,oldY;
|
||||
|
||||
pScreen= GetSpriteWindow()->drawable.pScreen;
|
||||
GetSpritePosition(&oldX,&oldY);
|
||||
if (flags&XkbSA_MoveAbsoluteX)
|
||||
oldX= x;
|
||||
else oldX+= x;
|
||||
if (flags&XkbSA_MoveAbsoluteY)
|
||||
oldY= y;
|
||||
else oldY+= y;
|
||||
|
||||
if (oldX<0) oldX= 0;
|
||||
else if (oldX>=pScreen->width) oldX= pScreen->width-1;
|
||||
if (oldY<0) oldY= 0;
|
||||
else if (oldY>=pScreen->height) oldY= pScreen->height-1;
|
||||
|
||||
if (pScreen->SetCursorPosition)
|
||||
(*pScreen->SetCursorPosition)(pScreen, oldX, oldY, TRUE);
|
||||
return;
|
||||
}
|
||||
|
||||
48
xkb/ddxInit.c
Normal file
48
xkb/ddxInit.c
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
/* $Xorg: ddxInit.c,v 1.3 2000/08/17 19:53:45 cpqbld Exp $ */
|
||||
/************************************************************
|
||||
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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#define NEED_EVENTS 1
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include <X11/keysym.h>
|
||||
#include "inputstr.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "windowstr.h"
|
||||
#include "XKBsrv.h"
|
||||
#include "XI.h"
|
||||
|
||||
int
|
||||
#if NeedFunctionPrototypes
|
||||
XkbDDXInitDevice(DeviceIntPtr dev)
|
||||
#else
|
||||
XkbDDXInitDevice(dev)
|
||||
DeviceIntPtr dev;
|
||||
#endif
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
54
xkb/ddxKeyClick.c
Normal file
54
xkb/ddxKeyClick.c
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
/* $Xorg: ddxKeyClick.c,v 1.3 2000/08/17 19:53:46 cpqbld Exp $ */
|
||||
/************************************************************
|
||||
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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#define NEED_EVENTS 1
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include <X11/keysym.h>
|
||||
#include "inputstr.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "windowstr.h"
|
||||
#include "XKBsrv.h"
|
||||
#include "XI.h"
|
||||
|
||||
void
|
||||
#if NeedFunctionPrototypes
|
||||
XkbDDXKeyClick(DeviceIntPtr pXDev,int keycode,int synthetic)
|
||||
#else
|
||||
XkbDDXKeyClick(pXDev,keycode,synthetic)
|
||||
DeviceIntPtr pXDev;
|
||||
int keycode;
|
||||
int synthetic;
|
||||
#endif
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if (xkbDebugFlags)
|
||||
ErrorF("Click.\n");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
51
xkb/ddxKillSrv.c
Normal file
51
xkb/ddxKillSrv.c
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
/* $Xorg: ddxKillSrv.c,v 1.3 2000/08/17 19:53:46 cpqbld Exp $ */
|
||||
/************************************************************
|
||||
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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#define NEED_EVENTS 1
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include <X11/keysym.h>
|
||||
#include "inputstr.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "windowstr.h"
|
||||
#include "XKBsrv.h"
|
||||
#include "XI.h"
|
||||
|
||||
int
|
||||
#if NeedFunctionPrototypes
|
||||
XkbDDXTerminateServer(DeviceIntPtr dev,KeyCode key,XkbAction *act)
|
||||
#else
|
||||
XkbDDXTerminateServer(dev,key,act)
|
||||
DeviceIntPtr dev;
|
||||
KeyCode key;
|
||||
XkbAction *act;
|
||||
#endif
|
||||
{
|
||||
GiveUp(1);
|
||||
return 0;
|
||||
}
|
||||
82
xkb/ddxLEDs.c
Normal file
82
xkb/ddxLEDs.c
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
/* $Xorg: ddxLEDs.c,v 1.3 2000/08/17 19:53:46 cpqbld Exp $ */
|
||||
/************************************************************
|
||||
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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#define NEED_EVENTS 1
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include <X11/keysym.h>
|
||||
#include "inputstr.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "windowstr.h"
|
||||
#include "XKBsrv.h"
|
||||
#include "XI.h"
|
||||
|
||||
void
|
||||
#if NeedFunctionPrototypes
|
||||
XkbDDXUpdateIndicators(DeviceIntPtr dev,CARD32 new)
|
||||
#else
|
||||
XkbDDXUpdateIndicators(dev,new)
|
||||
DeviceIntPtr dev;
|
||||
CARD32 new;
|
||||
#endif
|
||||
{
|
||||
dev->kbdfeed->ctrl.leds= new;
|
||||
(*dev->kbdfeed->CtrlProc)(dev,&dev->kbdfeed->ctrl);
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
#if NeedFunctionPrototypes
|
||||
XkbDDXUpdateDeviceIndicators( DeviceIntPtr dev,
|
||||
XkbSrvLedInfoPtr sli,
|
||||
CARD32 new)
|
||||
#else
|
||||
XkbDDXUpdateDeviceIndicators(dev,sli,new)
|
||||
DeviceIntPtr dev;
|
||||
XkbSrvLedInfoPtr sli;
|
||||
CARD32 new;
|
||||
#endif
|
||||
{
|
||||
if (sli->fb.kf==dev->kbdfeed)
|
||||
XkbDDXUpdateIndicators(dev,new);
|
||||
else if (sli->class==KbdFeedbackClass) {
|
||||
KbdFeedbackPtr kf;
|
||||
kf= sli->fb.kf;
|
||||
if (kf && kf->CtrlProc) {
|
||||
(*kf->CtrlProc)(dev,&kf->ctrl);
|
||||
}
|
||||
}
|
||||
else if (sli->class==LedFeedbackClass) {
|
||||
LedFeedbackPtr lf;
|
||||
lf= sli->fb.lf;
|
||||
if (lf && lf->CtrlProc) {
|
||||
(*lf->CtrlProc)(dev,&lf->ctrl);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
309
xkb/ddxList.c
Normal file
309
xkb/ddxList.c
Normal file
|
|
@ -0,0 +1,309 @@
|
|||
/* $Xorg: ddxList.c,v 1.3 2000/08/17 19:53:46 cpqbld Exp $ */
|
||||
/************************************************************
|
||||
Copyright (c) 1995 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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#define NEED_EVENTS 1
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xos.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include <X11/keysym.h>
|
||||
#include <X11/extensions/XKM.h>
|
||||
#include "inputstr.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "windowstr.h"
|
||||
#define XKBSRV_NEED_FILE_FUNCS
|
||||
#include "XKBsrv.h"
|
||||
#include "XI.h"
|
||||
|
||||
#ifndef PATH_MAX
|
||||
#ifdef MAXPATHLEN
|
||||
#define PATH_MAX MAXPATHLEN
|
||||
#else
|
||||
#define PATH_MAX 1024
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/***====================================================================***/
|
||||
|
||||
static char *componentDirs[_XkbListNumComponents] = {
|
||||
"keymap", "keycodes", "types", "compat", "symbols", "geometry"
|
||||
};
|
||||
|
||||
/***====================================================================***/
|
||||
|
||||
Status
|
||||
#if NeedFunctionPrototypes
|
||||
_AddListComponent( XkbSrvListInfoPtr list,
|
||||
int what,
|
||||
unsigned flags,
|
||||
char * str,
|
||||
ClientPtr client)
|
||||
#else
|
||||
_AddListComponent(list,what,flags,str,client)
|
||||
XkbSrvListInfoPtr list;
|
||||
int what;
|
||||
unsigned flags;
|
||||
char * str;
|
||||
ClientPtr client;
|
||||
#endif
|
||||
{
|
||||
int slen,wlen;
|
||||
unsigned char * wire8;
|
||||
unsigned short *wire16;
|
||||
char * tmp;
|
||||
|
||||
if (list->nTotal>=list->maxRtrn) {
|
||||
list->nTotal++;
|
||||
return Success;
|
||||
}
|
||||
tmp= strchr(str,')');
|
||||
if ((tmp==NULL)&&((tmp=strchr(str,'('))==NULL)) {
|
||||
slen= strlen(str);
|
||||
while ((slen>0) && isspace(str[slen-1])) {
|
||||
slen--;
|
||||
}
|
||||
}
|
||||
else {
|
||||
slen= (tmp-str+1);
|
||||
}
|
||||
wlen= (((slen+1)/2)*2)+4; /* four bytes for flags and length, pad to */
|
||||
/* 2-byte boundary */
|
||||
if ((list->szPool-list->nPool)<wlen) {
|
||||
if (wlen>1024) list->szPool+= XkbPaddedSize(wlen*2);
|
||||
else list->szPool+= 1024;
|
||||
list->pool= _XkbTypedRealloc(list->pool,list->szPool,char);
|
||||
if (!list->pool)
|
||||
return BadAlloc;
|
||||
}
|
||||
wire16= (unsigned short *)&list->pool[list->nPool];
|
||||
wire8= (unsigned char *)&wire16[2];
|
||||
wire16[0]= flags;
|
||||
wire16[1]= slen;
|
||||
memcpy(wire8,str,slen);
|
||||
if (client->swapped) {
|
||||
register int n;
|
||||
swaps(&wire16[0],n);
|
||||
swaps(&wire16[1],n);
|
||||
}
|
||||
list->nPool+= wlen;
|
||||
list->nFound[what]++;
|
||||
list->nTotal++;
|
||||
return Success;
|
||||
}
|
||||
|
||||
/***====================================================================***/
|
||||
static Status
|
||||
#if NeedFunctionPrototypes
|
||||
XkbDDXListComponent( DeviceIntPtr dev,
|
||||
int what,
|
||||
XkbSrvListInfoPtr list,
|
||||
ClientPtr client)
|
||||
#else
|
||||
XkbDDXListComponent(dev,what,list,client)
|
||||
DeviceIntPtr dev;
|
||||
int what;
|
||||
XkbSrvListInfoPtr list;
|
||||
ClientPtr client;
|
||||
#endif
|
||||
{
|
||||
char *file,*map,*tmp,buf[PATH_MAX];
|
||||
FILE *in;
|
||||
Status status;
|
||||
int rval;
|
||||
Bool haveDir;
|
||||
#ifdef WIN32
|
||||
char tmpname[32];
|
||||
#endif
|
||||
|
||||
if ((list->pattern[what]==NULL)||(list->pattern[what][0]=='\0'))
|
||||
return Success;
|
||||
file= list->pattern[what];
|
||||
map= strrchr(file,'(');
|
||||
if (map!=NULL) {
|
||||
char *tmp;
|
||||
map++;
|
||||
tmp= strrchr(map,')');
|
||||
if ((tmp==NULL)||(tmp[1]!='\0')) {
|
||||
/* illegal pattern. No error, but no match */
|
||||
return Success;
|
||||
}
|
||||
}
|
||||
|
||||
in= NULL;
|
||||
haveDir= True;
|
||||
#ifdef WIN32
|
||||
strcpy(tmpname, "\\temp\\xkb_XXXXXX");
|
||||
(void) mktemp(tmpname);
|
||||
#endif
|
||||
if (XkbBaseDirectory!=NULL) {
|
||||
if (strlen(XkbBaseDirectory)+strlen(componentDirs[what])+6 > PATH_MAX)
|
||||
return BadImplementation;
|
||||
if ((list->pattern[what][0]=='*')&&(list->pattern[what][1]=='\0')) {
|
||||
sprintf(buf,"%s/%s.dir",XkbBaseDirectory,componentDirs[what]);
|
||||
in= fopen(buf,"r");
|
||||
}
|
||||
if (!in) {
|
||||
haveDir= False;
|
||||
if (strlen(XkbBaseDirectory)*2+strlen(componentDirs[what])
|
||||
+(xkbDebugFlags>9?2:1)+strlen(file)+31 > PATH_MAX)
|
||||
return BadImplementation;
|
||||
#ifndef WIN32
|
||||
sprintf(buf,"%s/xkbcomp -R%s/%s -w %d -l -vlfhpR '%s'",
|
||||
XkbBaseDirectory,XkbBaseDirectory,componentDirs[what],
|
||||
((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:xkbDebugFlags)),
|
||||
file);
|
||||
#else
|
||||
sprintf(buf,"%s/xkbcomp -R%s/%s -w %d -l -vlfhpR '%s' %s",
|
||||
XkbBaseDirectory,XkbBaseDirectory,componentDirs[what],
|
||||
((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:xkbDebugFlags)),
|
||||
file, tmpname);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (strlen(XkbBaseDirectory)+strlen(componentDirs[what])+6 > PATH_MAX)
|
||||
return BadImplementation;
|
||||
if ((list->pattern[what][0]=='*')&&(list->pattern[what][1]=='\0')) {
|
||||
sprintf(buf,"%s.dir",componentDirs[what]);
|
||||
in= fopen(buf,"r");
|
||||
}
|
||||
if (!in) {
|
||||
haveDir= False;
|
||||
if (strlen(componentDirs[what])
|
||||
+(xkbDebugFlags>9?2:1)+strlen(file)+29 > PATH_MAX)
|
||||
return BadImplementation;
|
||||
#ifndef WIN32
|
||||
sprintf(buf,"xkbcomp -R%s -w %d -l -vlfhpR '%s'",
|
||||
componentDirs[what],
|
||||
((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:xkbDebugFlags)),
|
||||
file);
|
||||
#else
|
||||
sprintf(buf,"xkbcomp -R%s -w %d -l -vlfhpR '%s' %s",
|
||||
componentDirs[what],
|
||||
((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:xkbDebugFlags)),
|
||||
file, tmpname);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
status= Success;
|
||||
if (!haveDir)
|
||||
#ifndef WIN32
|
||||
in= popen(buf,"r");
|
||||
#else
|
||||
{
|
||||
if (system(buf) < 0)
|
||||
ErrorF("Could not invoke keymap compiler\n");
|
||||
else
|
||||
in= fopen(tmpname, "r");
|
||||
}
|
||||
#endif
|
||||
if (!in)
|
||||
return BadImplementation;
|
||||
list->nFound[what]= 0;
|
||||
while ((status==Success)&&((tmp=fgets(buf,PATH_MAX,in))!=NULL)) {
|
||||
unsigned flags;
|
||||
register unsigned int i;
|
||||
if (*tmp=='#') /* comment, skip it */
|
||||
continue;
|
||||
if (!strncmp(tmp, "Warning:", 8) || !strncmp(tmp, " ", 8))
|
||||
/* skip warnings too */
|
||||
continue;
|
||||
flags= 0;
|
||||
/* each line in the listing is supposed to start with two */
|
||||
/* groups of eight characters, which specify the general */
|
||||
/* flags and the flags that are specific to the component */
|
||||
/* if they're missing, fail with BadImplementation */
|
||||
for (i=0;(i<8)&&(status==Success);i++) { /* read the general flags */
|
||||
if (isalpha(*tmp)) flags|= (1L<<i);
|
||||
else if (*tmp!='-') status= BadImplementation;
|
||||
tmp++;
|
||||
}
|
||||
if (status != Success) break;
|
||||
if (!isspace(*tmp)) {
|
||||
status= BadImplementation;
|
||||
break;
|
||||
}
|
||||
else tmp++;
|
||||
for (i=0;(i<8)&&(status==Success);i++) { /* read the component flags */
|
||||
if (isalpha(*tmp)) flags|= (1L<<(i+8));
|
||||
else if (*tmp!='-') status= BadImplementation;
|
||||
tmp++;
|
||||
}
|
||||
if (status != Success) break;
|
||||
if (isspace(*tmp)) {
|
||||
while (isspace(*tmp)) {
|
||||
tmp++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
status= BadImplementation;
|
||||
break;
|
||||
}
|
||||
status= _AddListComponent(list,what,flags,tmp,client);
|
||||
}
|
||||
#ifndef WIN32
|
||||
if (haveDir)
|
||||
fclose(in);
|
||||
else if ((rval=pclose(in))!=0) {
|
||||
if (xkbDebugFlags)
|
||||
ErrorF("xkbcomp returned exit code %d\n",rval);
|
||||
}
|
||||
#else
|
||||
fclose(in);
|
||||
#endif
|
||||
return status;
|
||||
}
|
||||
|
||||
/***====================================================================***/
|
||||
|
||||
/* ARGSUSED */
|
||||
Status
|
||||
#if NeedFunctionPrototypes
|
||||
XkbDDXList(DeviceIntPtr dev,XkbSrvListInfoPtr list,ClientPtr client)
|
||||
#else
|
||||
XkbDDXList(dev,list,client)
|
||||
DeviceIntPtr dev;
|
||||
XkbSrvListInfoPtr list;
|
||||
ClientPtr client;
|
||||
#endif
|
||||
{
|
||||
Status status;
|
||||
|
||||
status= XkbDDXListComponent(dev,_XkbListKeymaps,list,client);
|
||||
if (status==Success)
|
||||
status= XkbDDXListComponent(dev,_XkbListKeycodes,list,client);
|
||||
if (status==Success)
|
||||
status= XkbDDXListComponent(dev,_XkbListTypes,list,client);
|
||||
if (status==Success)
|
||||
status= XkbDDXListComponent(dev,_XkbListCompat,list,client);
|
||||
if (status==Success)
|
||||
status= XkbDDXListComponent(dev,_XkbListSymbols,list,client);
|
||||
if (status==Success)
|
||||
status= XkbDDXListComponent(dev,_XkbListGeometry,list,client);
|
||||
return status;
|
||||
}
|
||||
495
xkb/ddxLoad.c
Normal file
495
xkb/ddxLoad.c
Normal file
|
|
@ -0,0 +1,495 @@
|
|||
/* $Xorg: ddxLoad.c,v 1.3 2000/08/17 19:53:46 cpqbld Exp $ */
|
||||
/************************************************************
|
||||
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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#define NEED_EVENTS 1
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xos.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include <X11/keysym.h>
|
||||
#include <X11/extensions/XKM.h>
|
||||
#include "inputstr.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "windowstr.h"
|
||||
#define XKBSRV_NEED_FILE_FUNCS
|
||||
#include "XKBsrv.h"
|
||||
#include "XI.h"
|
||||
|
||||
#if defined(CSRG_BASED) || defined(linux) || defined(__sgi) || defined(AIXV3) || defined(__osf__)
|
||||
#include <paths.h>
|
||||
#endif
|
||||
|
||||
#ifndef PATH_MAX
|
||||
#ifdef MAXPATHLEN
|
||||
#define PATH_MAX MAXPATHLEN
|
||||
#else
|
||||
#define PATH_MAX 1024
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If XKM_OUTPUT_DIR specifies a path without a leading slash, it is
|
||||
* relative to the top-level XKB configuration directory.
|
||||
* Making the server write to a subdirectory of that directory
|
||||
* requires some work in the general case (install procedure
|
||||
* has to create links to /var or somesuch on many machines),
|
||||
* so we just compile into /usr/tmp for now.
|
||||
*/
|
||||
#ifndef XKM_OUTPUT_DIR
|
||||
#define XKM_OUTPUT_DIR "compiled/"
|
||||
#endif
|
||||
|
||||
#define PRE_ERROR_MSG "\"The XKEYBOARD keymap compiler (xkbcomp) reports:\""
|
||||
#define ERROR_PREFIX "\"> \""
|
||||
#define POST_ERROR_MSG1 "\"Errors from xkbcomp are not fatal to the X server\""
|
||||
#define POST_ERROR_MSG2 "\"End of messages from xkbcomp\""
|
||||
|
||||
static void
|
||||
OutputDirectory (outdir)
|
||||
char* outdir;
|
||||
{
|
||||
#ifndef WIN32
|
||||
if (getuid() == 0 || geteuid() == 0) {
|
||||
/* if server running as root it'll be able to write */
|
||||
(void) strcpy (outdir, XKM_OUTPUT_DIR);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
#ifdef _PATH_VARTMP
|
||||
(void) strcpy (outdir, _PATH_VARTMP);
|
||||
if (outdir[strlen(outdir) - 1] != '/') /* Hi IBM, Digital */
|
||||
(void) strcat (outdir, "/");
|
||||
#else
|
||||
(void) strcpy (outdir, "/tmp/");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
Bool
|
||||
#if NeedFunctionPrototypes
|
||||
XkbDDXCompileNamedKeymap( XkbDescPtr xkb,
|
||||
XkbComponentNamesPtr names,
|
||||
char * nameRtrn,
|
||||
int nameRtrnLen)
|
||||
#else
|
||||
XkbDDXCompileNamedKeymap(xkb,names,nameRtrn,nameRtrnLen)
|
||||
XkbDescPtr xkb;
|
||||
XkbComponentNamesPtr names;
|
||||
char * nameRtrn;
|
||||
int nameRtrnLen;
|
||||
#endif
|
||||
{
|
||||
char cmd[PATH_MAX],file[PATH_MAX],xkm_output_dir[PATH_MAX],*map,*outFile;
|
||||
|
||||
if (names->keymap==NULL)
|
||||
return False;
|
||||
strncpy(file,names->keymap,PATH_MAX); file[PATH_MAX-1]= '\0';
|
||||
if ((map= strrchr(file,'('))!=NULL) {
|
||||
char *tmp;
|
||||
if ((tmp= strrchr(map,')'))!=NULL) {
|
||||
*map++= '\0';
|
||||
*tmp= '\0';
|
||||
}
|
||||
else {
|
||||
map= NULL;
|
||||
}
|
||||
}
|
||||
if ((outFile= strrchr(file,'/'))!=NULL)
|
||||
outFile= _XkbDupString(&outFile[1]);
|
||||
else outFile= _XkbDupString(file);
|
||||
XkbEnsureSafeMapName(outFile);
|
||||
OutputDirectory(xkm_output_dir);
|
||||
if (XkbBaseDirectory!=NULL) {
|
||||
if (strlen(XkbBaseDirectory)*2+(xkbDebugFlags>9?2:1)
|
||||
+(map?strlen(map)+3:0)+strlen(PRE_ERROR_MSG)
|
||||
+strlen(ERROR_PREFIX)+strlen(POST_ERROR_MSG1)
|
||||
+strlen(file)+strlen(xkm_output_dir)
|
||||
+strlen(outFile)+53 > PATH_MAX)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
ErrorF("compiler command for keymap (%s) exceeds max length\n",
|
||||
names->keymap);
|
||||
#endif
|
||||
return False;
|
||||
}
|
||||
sprintf(cmd,"%s/xkbcomp -w %d -R%s -xkm %s%s -em1 %s -emp %s -eml %s keymap/%s %s%s.xkm",
|
||||
XkbBaseDirectory,
|
||||
((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:xkbDebugFlags)),
|
||||
XkbBaseDirectory,(map?"-m ":""),(map?map:""),
|
||||
PRE_ERROR_MSG,ERROR_PREFIX,POST_ERROR_MSG1,file,
|
||||
xkm_output_dir,outFile);
|
||||
}
|
||||
else {
|
||||
if ((xkbDebugFlags>9?2:1)+(map?strlen(map)+3:0)+strlen(PRE_ERROR_MSG)
|
||||
+strlen(ERROR_PREFIX)+strlen(POST_ERROR_MSG1)
|
||||
+strlen(file)+strlen(xkm_output_dir)
|
||||
+strlen(outFile)+49 > PATH_MAX)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
ErrorF("compiler command for keymap (%s) exceeds max length\n",
|
||||
names->keymap);
|
||||
#endif
|
||||
return False;
|
||||
}
|
||||
sprintf(cmd,"xkbcomp -w %d -xkm %s%s -em1 %s -emp %s -eml %s keymap/%s %s%s.xkm",
|
||||
((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:xkbDebugFlags)),
|
||||
(map?"-m ":""),(map?map:""),
|
||||
PRE_ERROR_MSG,ERROR_PREFIX,POST_ERROR_MSG1,file,
|
||||
xkm_output_dir,outFile);
|
||||
}
|
||||
#ifdef DEBUG
|
||||
if (xkbDebugFlags) {
|
||||
ErrorF("XkbDDXCompileNamedKeymap compiling keymap using:\n");
|
||||
ErrorF(" \"cmd\"\n");
|
||||
}
|
||||
#endif
|
||||
if (system(cmd)==0) {
|
||||
if (nameRtrn) {
|
||||
strncpy(nameRtrn,outFile,nameRtrnLen);
|
||||
nameRtrn[nameRtrnLen-1]= '\0';
|
||||
}
|
||||
if (outFile!=NULL)
|
||||
Xfree(outFile);
|
||||
return True;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
ErrorF("Error compiling keymap (%s)\n",names->keymap);
|
||||
#endif
|
||||
if (outFile!=NULL)
|
||||
Xfree(outFile);
|
||||
return False;
|
||||
}
|
||||
|
||||
Bool
|
||||
#if NeedFunctionPrototypes
|
||||
XkbDDXCompileKeymapByNames( XkbDescPtr xkb,
|
||||
XkbComponentNamesPtr names,
|
||||
unsigned want,
|
||||
unsigned need,
|
||||
char * nameRtrn,
|
||||
int nameRtrnLen)
|
||||
#else
|
||||
XkbDDXCompileKeymapByNames(xkb,names,want,need,nameRtrn,nameRtrnLen)
|
||||
XkbDescPtr xkb;
|
||||
XkbComponentNamesPtr names;
|
||||
unsigned want;
|
||||
unsigned need;
|
||||
char * nameRtrn;
|
||||
int nameRtrnLen;
|
||||
#endif
|
||||
{
|
||||
FILE * out;
|
||||
char buf[PATH_MAX],keymap[PATH_MAX],xkm_output_dir[PATH_MAX];
|
||||
#ifdef WIN32
|
||||
char tmpname[32];
|
||||
#endif
|
||||
if ((names->keymap==NULL)||(names->keymap[0]=='\0')) {
|
||||
extern char *display;
|
||||
sprintf(keymap,"server-%s",display);
|
||||
}
|
||||
else {
|
||||
strcpy(keymap,names->keymap);
|
||||
}
|
||||
|
||||
XkbEnsureSafeMapName(keymap);
|
||||
OutputDirectory(xkm_output_dir);
|
||||
#ifdef WIN32
|
||||
strcpy(tmpname, "\\temp\\xkb_XXXXXX");
|
||||
(void) mktemp(tmpname);
|
||||
#endif
|
||||
if (XkbBaseDirectory!=NULL) {
|
||||
if (strlen(XkbBaseDirectory)*2+(xkbDebugFlags>9?2:1)
|
||||
+strlen(PRE_ERROR_MSG)+strlen(ERROR_PREFIX)
|
||||
+strlen(POST_ERROR_MSG1)+strlen(xkm_output_dir)
|
||||
+strlen(keymap)+48 > PATH_MAX)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
ErrorF("compiler command for keymap (%s) exceeds max length\n",
|
||||
names->keymap);
|
||||
#endif
|
||||
return False;
|
||||
}
|
||||
#ifndef WIN32
|
||||
sprintf(buf,
|
||||
"%s/xkbcomp -w %d -R%s -xkm - -em1 %s -emp %s -eml %s \"%s%s.xkm\"",
|
||||
XkbBaseDirectory,
|
||||
((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:xkbDebugFlags)),
|
||||
XkbBaseDirectory,
|
||||
PRE_ERROR_MSG,ERROR_PREFIX,POST_ERROR_MSG1,
|
||||
xkm_output_dir,keymap);
|
||||
#else
|
||||
sprintf(buf,
|
||||
"%s/xkbcomp -w %d -R%s -xkm - -em1 %s -emp %s -eml %s \"%s%s.xkm\" < %s",
|
||||
XkbBaseDirectory,
|
||||
((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:xkbDebugFlags)),
|
||||
XkbBaseDirectory,
|
||||
PRE_ERROR_MSG,ERROR_PREFIX,POST_ERROR_MSG1,
|
||||
xkm_output_dir,keymap,tmpname);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
if ((xkbDebugFlags>9?2:1)+strlen(PRE_ERROR_MSG)
|
||||
+strlen(ERROR_PREFIX)+strlen(POST_ERROR_MSG1)
|
||||
+strlen(xkm_output_dir)+strlen(keymap)+44 > PATH_MAX)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
ErrorF("compiler command for keymap (%s) exceeds max length\n",
|
||||
names->keymap);
|
||||
#endif
|
||||
return False;
|
||||
}
|
||||
#ifndef WIN32
|
||||
sprintf(buf,
|
||||
"xkbcomp -w %d -xkm - -em1 %s -emp %s -eml %s \"%s%s.xkm\"",
|
||||
((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:xkbDebugFlags)),
|
||||
PRE_ERROR_MSG,ERROR_PREFIX,POST_ERROR_MSG1,
|
||||
xkm_output_dir,keymap);
|
||||
#else
|
||||
sprintf(buf,
|
||||
"xkbcomp -w %d -xkm - -em1 %s -emp %s -eml %s \"%s%s.xkm\" < %s",
|
||||
((xkbDebugFlags<2)?1:((xkbDebugFlags>10)?10:xkbDebugFlags)),
|
||||
PRE_ERROR_MSG,ERROR_PREFIX,POST_ERROR_MSG1,
|
||||
xkm_output_dir,keymap,tmpname);
|
||||
#endif
|
||||
}
|
||||
#ifndef WIN32
|
||||
out= popen(buf,"w");
|
||||
#else
|
||||
out= fopen(tmpname, "w");
|
||||
#endif
|
||||
if (out!=NULL) {
|
||||
#ifdef DEBUG
|
||||
if (xkbDebugFlags) {
|
||||
ErrorF("XkbDDXCompileKeymapByNames compiling keymap:\n");
|
||||
XkbWriteXKBKeymapForNames(stderr,names,NULL,xkb,want,need);
|
||||
}
|
||||
#endif
|
||||
XkbWriteXKBKeymapForNames(out,names,NULL,xkb,want,need);
|
||||
#ifndef WIN32
|
||||
if (pclose(out)==0)
|
||||
#else
|
||||
if (fclose(out)==0)
|
||||
#endif
|
||||
{
|
||||
#ifdef WIN32
|
||||
if (system(buf) < 0)
|
||||
ErrorF("Could not invoke keymap compiler\n");
|
||||
else {
|
||||
#endif
|
||||
if (nameRtrn) {
|
||||
strncpy(nameRtrn,keymap,nameRtrnLen);
|
||||
nameRtrn[nameRtrnLen-1]= '\0';
|
||||
}
|
||||
return True;
|
||||
#ifdef WIN32
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#ifdef DEBUG
|
||||
else
|
||||
ErrorF("Error compiling keymap (%s)\n",keymap);
|
||||
#endif
|
||||
}
|
||||
#ifdef DEBUG
|
||||
else {
|
||||
#ifndef WIN32
|
||||
ErrorF("Could not invoke keymap compiler\n");
|
||||
#else
|
||||
ErrorF("Could not open file %s\n", tmpname);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
if (nameRtrn)
|
||||
nameRtrn[0]= '\0';
|
||||
return False;
|
||||
}
|
||||
|
||||
FILE *
|
||||
#if NeedFunctionPrototypes
|
||||
XkbDDXOpenConfigFile(char *mapName,char *fileNameRtrn,int fileNameRtrnLen)
|
||||
#else
|
||||
XkbDDXOpenConfigFile(mapName,fileNameRtrn,fileNameRtrnLen)
|
||||
char * mapName;
|
||||
char * fileNameRtrn;
|
||||
int fileNameRtrnLen;
|
||||
#endif
|
||||
{
|
||||
char buf[PATH_MAX],xkm_output_dir[PATH_MAX];
|
||||
FILE * file;
|
||||
|
||||
buf[0]= '\0';
|
||||
if (mapName!=NULL) {
|
||||
OutputDirectory(xkm_output_dir);
|
||||
if ((XkbBaseDirectory!=NULL)&&(xkm_output_dir[0]!='/')) {
|
||||
if (strlen(XkbBaseDirectory)+strlen(xkm_output_dir)
|
||||
+strlen(mapName)+6 <= PATH_MAX)
|
||||
{
|
||||
sprintf(buf,"%s/%s%s.xkm",XkbBaseDirectory,
|
||||
xkm_output_dir,mapName);
|
||||
}
|
||||
}
|
||||
else if (strlen(xkm_output_dir)+strlen(mapName)+5 <= PATH_MAX)
|
||||
sprintf(buf,"%s%s.xkm",xkm_output_dir,mapName);
|
||||
if (buf[0] != '\0')
|
||||
file= fopen(buf,"r");
|
||||
else file= NULL;
|
||||
}
|
||||
else file= NULL;
|
||||
if ((fileNameRtrn!=NULL)&&(fileNameRtrnLen>0)) {
|
||||
strncpy(fileNameRtrn,buf,fileNameRtrnLen);
|
||||
buf[fileNameRtrnLen-1]= '\0';
|
||||
}
|
||||
return file;
|
||||
}
|
||||
|
||||
unsigned
|
||||
#if NeedFunctionPrototypes
|
||||
XkbDDXLoadKeymapByNames( DeviceIntPtr keybd,
|
||||
XkbComponentNamesPtr names,
|
||||
unsigned want,
|
||||
unsigned need,
|
||||
XkbFileInfo * finfoRtrn,
|
||||
char * nameRtrn,
|
||||
int nameRtrnLen)
|
||||
#else
|
||||
XkbDDXLoadKeymapByNames(keybd,names,want,need,finfoRtrn,nameRtrn,nameRtrnLen)
|
||||
DeviceIntPtr keybd;
|
||||
XkbComponentNamesPtr names;
|
||||
unsigned want;
|
||||
unsigned need;
|
||||
XkbFileInfo * finfoRtrn;
|
||||
char * nameRtrn;
|
||||
int nameRtrnLen;
|
||||
#endif
|
||||
{
|
||||
XkbDescPtr xkb;
|
||||
FILE * file;
|
||||
char fileName[PATH_MAX];
|
||||
unsigned missing;
|
||||
|
||||
bzero(finfoRtrn,sizeof(XkbFileInfo));
|
||||
if ((keybd==NULL)||(keybd->key==NULL)||(keybd->key->xkbInfo==NULL))
|
||||
xkb= NULL;
|
||||
else xkb= keybd->key->xkbInfo->desc;
|
||||
if ((names->keycodes==NULL)&&(names->types==NULL)&&
|
||||
(names->compat==NULL)&&(names->symbols==NULL)&&
|
||||
(names->geometry==NULL)) {
|
||||
if (names->keymap==NULL) {
|
||||
bzero(finfoRtrn,sizeof(XkbFileInfo));
|
||||
if (xkb && XkbDetermineFileType(finfoRtrn,XkbXKMFile,NULL) &&
|
||||
((finfoRtrn->defined&need)==need) ) {
|
||||
finfoRtrn->xkb= xkb;
|
||||
nameRtrn[0]= '\0';
|
||||
return finfoRtrn->defined;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
else if (!XkbDDXCompileNamedKeymap(xkb,names,nameRtrn,nameRtrnLen)) {
|
||||
#ifdef NOISY
|
||||
ErrorF("Couldn't compile keymap file\n");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else if (!XkbDDXCompileKeymapByNames(xkb,names,want,need,
|
||||
nameRtrn,nameRtrnLen)){
|
||||
#ifdef NOISY
|
||||
ErrorF("Couldn't compile keymap file\n");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
file= XkbDDXOpenConfigFile(nameRtrn,fileName,PATH_MAX);
|
||||
if (file==NULL) {
|
||||
ErrorF("Couldn't open compiled keymap file %s\n",fileName);
|
||||
return 0;
|
||||
}
|
||||
missing= XkmReadFile(file,need,want,finfoRtrn);
|
||||
if (finfoRtrn->xkb==NULL) {
|
||||
ErrorF("Error loading keymap %s\n",fileName);
|
||||
fclose(file);
|
||||
(void) unlink (fileName);
|
||||
return 0;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
else if (xkbDebugFlags) {
|
||||
ErrorF("Loaded %s, defined=0x%x\n",fileName,finfoRtrn->defined);
|
||||
}
|
||||
#endif
|
||||
fclose(file);
|
||||
(void) unlink (fileName);
|
||||
return (need|want)&(~missing);
|
||||
}
|
||||
|
||||
Bool
|
||||
#if NeedFunctionPrototypes
|
||||
XkbDDXNamesFromRules( DeviceIntPtr keybd,
|
||||
char * rules_name,
|
||||
XkbRF_VarDefsPtr defs,
|
||||
XkbComponentNamesPtr names)
|
||||
#else
|
||||
XkbDDXNamesFromRules(keybd,rules_name,defs,names)
|
||||
DeviceIntPtr keybd;
|
||||
char * rules_name;
|
||||
XkbRF_VarDefsPtr defs;
|
||||
XkbComponentNamesPtr names;
|
||||
#endif
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
FILE * file;
|
||||
Bool complete;
|
||||
XkbRF_RulesPtr rules;
|
||||
|
||||
if (!rules_name)
|
||||
return False;
|
||||
if (XkbBaseDirectory==NULL) {
|
||||
if (strlen(rules_name)+7 > PATH_MAX)
|
||||
return False;
|
||||
sprintf(buf,"rules/%s",rules_name);
|
||||
}
|
||||
else {
|
||||
if (strlen(XkbBaseDirectory)+strlen(rules_name)+8 > PATH_MAX)
|
||||
return False;
|
||||
sprintf(buf,"%s/rules/%s",XkbBaseDirectory,rules_name);
|
||||
}
|
||||
if ((file= fopen(buf,"r"))==NULL)
|
||||
return False;
|
||||
if ((rules= XkbRF_Create(0,0))==NULL) {
|
||||
fclose(file);
|
||||
return False;
|
||||
}
|
||||
if (!XkbRF_LoadRules(file,rules)) {
|
||||
fclose(file);
|
||||
XkbRF_Free(rules,True);
|
||||
return False;
|
||||
}
|
||||
bzero((char *)names,sizeof(XkbComponentNamesRec));
|
||||
complete= XkbRF_GetComponents(rules,defs,names);
|
||||
fclose(file);
|
||||
XkbRF_Free(rules,True);
|
||||
return complete;
|
||||
}
|
||||
50
xkb/ddxVT.c
Normal file
50
xkb/ddxVT.c
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
/* $Xorg: ddxVT.c,v 1.3 2000/08/17 19:53:46 cpqbld Exp $ */
|
||||
/************************************************************
|
||||
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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#define NEED_EVENTS 1
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include <X11/keysym.h>
|
||||
#include "inputstr.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "windowstr.h"
|
||||
#include "XKBsrv.h"
|
||||
#include "XI.h"
|
||||
|
||||
int
|
||||
#if NeedFunctionPrototypes
|
||||
XkbDDXSwitchScreen(DeviceIntPtr dev,KeyCode key,XkbAction *act)
|
||||
#else
|
||||
XkbDDXSwitchScreen(dev,key,act)
|
||||
DeviceIntPtr dev;
|
||||
KeyCode key;
|
||||
XkbAction *act;
|
||||
#endif
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
1382
xkb/maprules.c
Normal file
1382
xkb/maprules.c
Normal file
File diff suppressed because it is too large
Load diff
856
xkb/xkbAccessX.c
Normal file
856
xkb/xkbAccessX.c
Normal file
|
|
@ -0,0 +1,856 @@
|
|||
/* $Xorg: xkbAccessX.c,v 1.4 2001/02/05 18:50:20 coskrey Exp $ */
|
||||
/************************************************************
|
||||
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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#define NEED_EVENTS 1
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include <X11/keysym.h>
|
||||
#include "inputstr.h"
|
||||
#include "XKBsrv.h"
|
||||
#ifndef WIN32
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
int XkbDfltRepeatDelay= 660;
|
||||
int XkbDfltRepeatInterval= 40;
|
||||
pointer XkbLastRepeatEvent= NULL;
|
||||
|
||||
#define DFLT_TIMEOUT_CTRLS (XkbAX_KRGMask|XkbStickyKeysMask|XkbMouseKeysMask)
|
||||
#define DFLT_TIMEOUT_OPTS (XkbAX_IndicatorFBMask)
|
||||
|
||||
unsigned short XkbDfltAccessXTimeout= 120;
|
||||
unsigned int XkbDfltAccessXTimeoutMask= DFLT_TIMEOUT_CTRLS;
|
||||
unsigned int XkbDfltAccessXTimeoutValues= 0;
|
||||
unsigned int XkbDfltAccessXTimeoutOptionsMask= DFLT_TIMEOUT_OPTS;
|
||||
unsigned int XkbDfltAccessXTimeoutOptionsValues= 0;
|
||||
unsigned int XkbDfltAccessXFeedback= XkbAccessXFeedbackMask;
|
||||
unsigned short XkbDfltAccessXOptions= XkbAX_AllOptionsMask & ~(XkbAX_IndicatorFBMask|XkbAX_SKReleaseFBMask|XkbAX_SKRejectFBMask);
|
||||
|
||||
void
|
||||
#if NeedFunctionPrototypes
|
||||
AccessXComputeCurveFactor(XkbSrvInfoPtr xkbi,XkbControlsPtr ctrls)
|
||||
#else
|
||||
AccessXComputeCurveFactor(xkbi,ctrls)
|
||||
XkbSrvInfoPtr xkbi;
|
||||
XkbControlsPtr ctrls;
|
||||
#endif
|
||||
{
|
||||
xkbi->mouseKeysCurve= 1.0+(((double)ctrls->mk_curve)*0.001);
|
||||
xkbi->mouseKeysCurveFactor= ( ((double)ctrls->mk_max_speed)/
|
||||
pow((double)ctrls->mk_time_to_max,xkbi->mouseKeysCurve));
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
#if NeedFunctionPrototypes
|
||||
AccessXInit(DeviceIntPtr keybd)
|
||||
#else
|
||||
AccessXInit(keybd)
|
||||
DeviceIntPtr keybd;
|
||||
#endif
|
||||
{
|
||||
XkbSrvInfoPtr xkbi = keybd->key->xkbInfo;
|
||||
XkbControlsPtr ctrls = xkbi->desc->ctrls;
|
||||
|
||||
xkbi->shiftKeyCount= 0;
|
||||
xkbi->mouseKeysCounter= 0;
|
||||
xkbi->inactiveKey= 0;
|
||||
xkbi->slowKey= 0;
|
||||
xkbi->repeatKey= 0;
|
||||
xkbi->krgTimerActive= _OFF_TIMER;
|
||||
xkbi->beepType= _BEEP_NONE;
|
||||
xkbi->beepCount= 0;
|
||||
xkbi->mouseKeyTimer= NULL;
|
||||
xkbi->slowKeysTimer= NULL;
|
||||
xkbi->bounceKeysTimer= NULL;
|
||||
xkbi->repeatKeyTimer= NULL;
|
||||
xkbi->krgTimer= NULL;
|
||||
xkbi->beepTimer= NULL;
|
||||
ctrls->repeat_delay = XkbDfltRepeatDelay;
|
||||
ctrls->repeat_interval = XkbDfltRepeatInterval;
|
||||
ctrls->debounce_delay = 300;
|
||||
ctrls->slow_keys_delay = 300;
|
||||
ctrls->mk_delay = 160;
|
||||
ctrls->mk_interval = 40;
|
||||
ctrls->mk_time_to_max = 30;
|
||||
ctrls->mk_max_speed = 30;
|
||||
ctrls->mk_curve = 500;
|
||||
ctrls->mk_dflt_btn = 1;
|
||||
ctrls->ax_timeout = XkbDfltAccessXTimeout;
|
||||
ctrls->axt_ctrls_mask = XkbDfltAccessXTimeoutMask;
|
||||
ctrls->axt_ctrls_values = XkbDfltAccessXTimeoutValues;
|
||||
ctrls->axt_opts_mask = XkbDfltAccessXTimeoutOptionsMask;
|
||||
ctrls->axt_opts_values = XkbDfltAccessXTimeoutOptionsValues;
|
||||
if (XkbDfltAccessXTimeout)
|
||||
ctrls->enabled_ctrls |= XkbAccessXTimeoutMask;
|
||||
else
|
||||
ctrls->enabled_ctrls &= ~XkbAccessXTimeoutMask;
|
||||
ctrls->enabled_ctrls |= XkbDfltAccessXFeedback;
|
||||
ctrls->ax_options = XkbDfltAccessXOptions;
|
||||
AccessXComputeCurveFactor(xkbi,ctrls);
|
||||
return;
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* AccessXKeyboardEvent */
|
||||
/* */
|
||||
/* Generate a synthetic keyboard event. */
|
||||
/* */
|
||||
/************************************************************************/
|
||||
static void
|
||||
#if NeedFunctionPrototypes
|
||||
AccessXKeyboardEvent(DeviceIntPtr keybd,
|
||||
BYTE type,
|
||||
BYTE keyCode,
|
||||
Bool isRepeat)
|
||||
#else
|
||||
AccessXKeyboardEvent(keybd,type,keyCode,isRepeat)
|
||||
DeviceIntPtr keybd;
|
||||
BYTE type;
|
||||
BYTE keyCode;
|
||||
Bool isRepeat;
|
||||
#endif
|
||||
{
|
||||
xEvent xE;
|
||||
#ifdef XINPUT
|
||||
extern int DeviceKeyPress;
|
||||
#endif
|
||||
|
||||
xE.u.u.type = type;
|
||||
xE.u.u.detail = keyCode;
|
||||
xE.u.keyButtonPointer.time = GetTimeInMillis();
|
||||
#ifdef DEBUG
|
||||
if (xkbDebugFlags&0x8) {
|
||||
ErrorF("AXKE: Key %d %s\n",keyCode,(xE.u.u.type==KeyPress?"down":"up"));
|
||||
}
|
||||
#endif
|
||||
|
||||
if (_XkbIsPressEvent(type))
|
||||
XkbDDXKeyClick(keybd,keyCode,TRUE);
|
||||
else if (isRepeat)
|
||||
XkbLastRepeatEvent= (pointer)&xE;
|
||||
XkbProcessKeyboardEvent(&xE,keybd,1L);
|
||||
XkbLastRepeatEvent= NULL;
|
||||
return;
|
||||
|
||||
} /* AccessXKeyboardEvent */
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* AccessXKRGTurnOn */
|
||||
/* */
|
||||
/* Turn the keyboard response group on. */
|
||||
/* */
|
||||
/************************************************************************/
|
||||
static void
|
||||
#if NeedFunctionPrototypes
|
||||
AccessXKRGTurnOn(DeviceIntPtr dev,CARD16 KRGControl,xkbControlsNotify *pCN)
|
||||
#else
|
||||
AccessXKRGTurnOn(dev,KRGControl,pCN)
|
||||
DeviceIntPtr dev;
|
||||
CARD16 KRGControl;
|
||||
xkbControlsNotify *pCN;
|
||||
#endif
|
||||
{
|
||||
XkbSrvInfoPtr xkbi = dev->key->xkbInfo;
|
||||
XkbControlsPtr ctrls = xkbi->desc->ctrls;
|
||||
XkbControlsRec old;
|
||||
XkbEventCauseRec cause;
|
||||
XkbSrvLedInfoPtr sli;
|
||||
|
||||
old= *ctrls;
|
||||
ctrls->enabled_ctrls |= (KRGControl&XkbAX_KRGMask);
|
||||
if (XkbComputeControlsNotify(dev,&old,ctrls,pCN,False))
|
||||
XkbSendControlsNotify(dev,pCN);
|
||||
cause.kc= pCN->keycode;
|
||||
cause.event= pCN->eventType;
|
||||
cause.mjr= pCN->requestMajor;
|
||||
cause.mnr= pCN->requestMinor;
|
||||
sli= XkbFindSrvLedInfo(dev,XkbDfltXIClass,XkbDfltXIId,0);
|
||||
XkbUpdateIndicators(dev,sli->usesControls,True,NULL,&cause);
|
||||
if (XkbAX_NeedFeedback(ctrls,XkbAX_FeatureFBMask))
|
||||
XkbDDXAccessXBeep(dev,_BEEP_FEATURE_ON,KRGControl);
|
||||
return;
|
||||
|
||||
} /* AccessXKRGTurnOn */
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* AccessXKRGTurnOff */
|
||||
/* */
|
||||
/* Turn the keyboard response group off. */
|
||||
/* */
|
||||
/************************************************************************/
|
||||
static void
|
||||
#if NeedFunctionPrototypes
|
||||
AccessXKRGTurnOff(DeviceIntPtr dev,xkbControlsNotify *pCN)
|
||||
#else
|
||||
AccessXKRGTurnOff(dev,pCN)
|
||||
DeviceIntPtr dev;
|
||||
xkbControlsNotify *pCN;
|
||||
#endif
|
||||
{
|
||||
XkbSrvInfoPtr xkbi = dev->key->xkbInfo;
|
||||
XkbControlsPtr ctrls = xkbi->desc->ctrls;
|
||||
XkbControlsRec old;
|
||||
XkbEventCauseRec cause;
|
||||
XkbSrvLedInfoPtr sli;
|
||||
|
||||
old = *ctrls;
|
||||
ctrls->enabled_ctrls &= ~XkbAX_KRGMask;
|
||||
if (XkbComputeControlsNotify(dev,&old,ctrls,pCN,False))
|
||||
XkbSendControlsNotify(dev,pCN);
|
||||
cause.kc= pCN->keycode;
|
||||
cause.event= pCN->eventType;
|
||||
cause.mjr= pCN->requestMajor;
|
||||
cause.mnr= pCN->requestMinor;
|
||||
sli= XkbFindSrvLedInfo(dev,XkbDfltXIClass,XkbDfltXIId,0);
|
||||
XkbUpdateIndicators(dev,sli->usesControls,True,NULL,&cause);
|
||||
if (XkbAX_NeedFeedback(ctrls,XkbAX_FeatureFBMask)) {
|
||||
unsigned changes= old.enabled_ctrls^ctrls->enabled_ctrls;
|
||||
XkbDDXAccessXBeep(dev,_BEEP_FEATURE_OFF,changes);
|
||||
}
|
||||
return;
|
||||
|
||||
} /* AccessXKRGTurnOff */
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* AccessXStickyKeysTurnOn */
|
||||
/* */
|
||||
/* Turn StickyKeys on. */
|
||||
/* */
|
||||
/************************************************************************/
|
||||
static void
|
||||
#if NeedFunctionPrototypes
|
||||
AccessXStickyKeysTurnOn(DeviceIntPtr dev,xkbControlsNotify *pCN)
|
||||
#else
|
||||
AccessXStickyKeysTurnOn(dev,pCN)
|
||||
DeviceIntPtr dev;
|
||||
xkbControlsNotify *pCN;
|
||||
#endif
|
||||
{
|
||||
XkbSrvInfoPtr xkbi = dev->key->xkbInfo;
|
||||
XkbControlsPtr ctrls = xkbi->desc->ctrls;
|
||||
XkbControlsRec old;
|
||||
XkbEventCauseRec cause;
|
||||
XkbSrvLedInfoPtr sli;
|
||||
|
||||
old = *ctrls;
|
||||
ctrls->enabled_ctrls |= XkbStickyKeysMask;
|
||||
xkbi->shiftKeyCount = 0;
|
||||
if (XkbComputeControlsNotify(dev,&old,ctrls,pCN,False))
|
||||
XkbSendControlsNotify(dev,pCN);
|
||||
cause.kc= pCN->keycode;
|
||||
cause.event= pCN->eventType;
|
||||
cause.mjr= pCN->requestMajor;
|
||||
cause.mnr= pCN->requestMinor;
|
||||
sli= XkbFindSrvLedInfo(dev,XkbDfltXIClass,XkbDfltXIId,0);
|
||||
XkbUpdateIndicators(dev,sli->usesControls,True,NULL,&cause);
|
||||
if (XkbAX_NeedFeedback(ctrls,XkbAX_FeatureFBMask)) {
|
||||
XkbDDXAccessXBeep(dev,_BEEP_FEATURE_ON,XkbStickyKeysMask);
|
||||
}
|
||||
return;
|
||||
|
||||
} /* AccessXStickyKeysTurnOn */
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* AccessXStickyKeysTurnOff */
|
||||
/* */
|
||||
/* Turn StickyKeys off. */
|
||||
/* */
|
||||
/************************************************************************/
|
||||
static void
|
||||
#if NeedFunctionPrototypes
|
||||
AccessXStickyKeysTurnOff(DeviceIntPtr dev,xkbControlsNotify *pCN)
|
||||
#else
|
||||
AccessXStickyKeysTurnOff(dev,pCN)
|
||||
DeviceIntPtr dev;
|
||||
xkbControlsNotify *pCN;
|
||||
#endif
|
||||
{
|
||||
XkbSrvInfoPtr xkbi = dev->key->xkbInfo;
|
||||
XkbControlsPtr ctrls = xkbi->desc->ctrls;
|
||||
XkbControlsRec old;
|
||||
XkbEventCauseRec cause;
|
||||
XkbSrvLedInfoPtr sli;
|
||||
|
||||
old = *ctrls;
|
||||
ctrls->enabled_ctrls &= ~XkbStickyKeysMask;
|
||||
xkbi->shiftKeyCount = 0;
|
||||
if (XkbComputeControlsNotify(dev,&old,ctrls,pCN,False))
|
||||
XkbSendControlsNotify(dev,pCN);
|
||||
|
||||
cause.kc= pCN->keycode;
|
||||
cause.event= pCN->eventType;
|
||||
cause.mjr= pCN->requestMajor;
|
||||
cause.mnr= pCN->requestMinor;
|
||||
sli= XkbFindSrvLedInfo(dev,XkbDfltXIClass,XkbDfltXIId,0);
|
||||
XkbUpdateIndicators(dev,sli->usesControls,True,NULL,&cause);
|
||||
if (XkbAX_NeedFeedback(ctrls,XkbAX_FeatureFBMask)) {
|
||||
XkbDDXAccessXBeep(dev,_BEEP_FEATURE_OFF,XkbStickyKeysMask);
|
||||
}
|
||||
#ifndef NO_CLEAR_LATCHES_FOR_STICKY_KEYS_OFF
|
||||
XkbClearAllLatchesAndLocks(dev,xkbi,False,&cause);
|
||||
#endif
|
||||
return;
|
||||
} /* AccessXStickyKeysTurnOff */
|
||||
|
||||
static CARD32
|
||||
#if NeedFunctionPrototypes
|
||||
AccessXKRGExpire(OsTimerPtr timer,CARD32 now,pointer arg)
|
||||
#else
|
||||
AccessXKRGExpire(timer,now,arg)
|
||||
OsTimerPtr timer;
|
||||
CARD32 now;
|
||||
pointer arg;
|
||||
#endif
|
||||
{
|
||||
XkbSrvInfoPtr xkbi= ((DeviceIntPtr)arg)->key->xkbInfo;
|
||||
xkbControlsNotify cn;
|
||||
|
||||
if (xkbi->krgTimerActive==_KRG_WARN_TIMER) {
|
||||
XkbDDXAccessXBeep((DeviceIntPtr)arg,_BEEP_SLOW_WARN,XkbStickyKeysMask);
|
||||
xkbi->krgTimerActive= _KRG_TIMER;
|
||||
return 4000;
|
||||
}
|
||||
xkbi->krgTimerActive= _OFF_TIMER;
|
||||
cn.keycode = 0;
|
||||
cn.eventType = 0;
|
||||
cn.requestMajor = 0;
|
||||
cn.requestMinor = 0;
|
||||
if (xkbi->desc->ctrls->enabled_ctrls&XkbSlowKeysMask)
|
||||
AccessXKRGTurnOff((DeviceIntPtr)arg,&cn);
|
||||
else AccessXKRGTurnOn((DeviceIntPtr)arg,XkbSlowKeysMask,&cn);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static CARD32
|
||||
#if NeedFunctionPrototypes
|
||||
AccessXRepeatKeyExpire(OsTimerPtr timer,CARD32 now,pointer arg)
|
||||
#else
|
||||
AccessXRepeatKeyExpire(timer,now,arg)
|
||||
OsTimerPtr timer;
|
||||
CARD32 now;
|
||||
pointer arg;
|
||||
#endif
|
||||
{
|
||||
XkbSrvInfoPtr xkbi= ((DeviceIntPtr)arg)->key->xkbInfo;
|
||||
KeyCode key;
|
||||
|
||||
if (xkbi->repeatKey==0)
|
||||
return 0;
|
||||
key= xkbi->repeatKey;
|
||||
AccessXKeyboardEvent((DeviceIntPtr)arg,KeyRelease,key,True);
|
||||
AccessXKeyboardEvent((DeviceIntPtr)arg,KeyPress,key,True);
|
||||
return xkbi->desc->ctrls->repeat_interval;
|
||||
}
|
||||
|
||||
void
|
||||
#if NeedFunctionPrototypes
|
||||
AccessXCancelRepeatKey(XkbSrvInfoPtr xkbi,KeyCode key)
|
||||
#else
|
||||
AccessXCancelRepeatKey(xkbi,key)
|
||||
XkbSrvInfoPtr xkbi;
|
||||
KeyCode key;
|
||||
#endif
|
||||
{
|
||||
if (xkbi->repeatKey==key)
|
||||
xkbi->repeatKey= 0;
|
||||
return;
|
||||
}
|
||||
|
||||
static CARD32
|
||||
#if NeedFunctionPrototypes
|
||||
AccessXSlowKeyExpire(OsTimerPtr timer,CARD32 now,pointer arg)
|
||||
#else
|
||||
AccessXSlowKeyExpire(timer,now,arg)
|
||||
OsTimerPtr timer;
|
||||
CARD32 now;
|
||||
pointer arg;
|
||||
#endif
|
||||
{
|
||||
DeviceIntPtr keybd;
|
||||
XkbSrvInfoPtr xkbi;
|
||||
XkbDescPtr xkb;
|
||||
XkbControlsPtr ctrls;
|
||||
|
||||
keybd= (DeviceIntPtr)arg;
|
||||
xkbi= keybd->key->xkbInfo;
|
||||
xkb= xkbi->desc;
|
||||
ctrls= xkb->ctrls;
|
||||
if (xkbi->slowKey!=0) {
|
||||
xkbAccessXNotify ev;
|
||||
KeySym *sym= XkbKeySymsPtr(xkb,xkbi->slowKey);
|
||||
ev.detail= XkbAXN_SKAccept;
|
||||
ev.keycode= xkbi->slowKey;
|
||||
ev.slowKeysDelay= ctrls->slow_keys_delay;
|
||||
ev.debounceDelay= ctrls->debounce_delay;
|
||||
XkbSendAccessXNotify(keybd,&ev);
|
||||
if (XkbAX_NeedFeedback(ctrls,XkbAX_SKAcceptFBMask))
|
||||
XkbDDXAccessXBeep(keybd,_BEEP_SLOW_ACCEPT,XkbSlowKeysMask);
|
||||
AccessXKeyboardEvent(keybd,KeyPress,xkbi->slowKey,False);
|
||||
/* check for magic sequences */
|
||||
if ((ctrls->enabled_ctrls&XkbAccessXKeysMask) &&
|
||||
((sym[0]==XK_Shift_R)||(sym[0]==XK_Shift_L)))
|
||||
xkbi->shiftKeyCount++;
|
||||
|
||||
/* Start repeating if necessary. Stop autorepeating if the user
|
||||
* presses a non-modifier key that doesn't autorepeat.
|
||||
*/
|
||||
if (keybd->kbdfeed->ctrl.autoRepeat &&
|
||||
((xkbi->slowKey != xkbi->mouseKey) || (!xkbi->mouseKeysAccel)) &&
|
||||
(ctrls->enabled_ctrls&XkbRepeatKeysMask)) {
|
||||
#ifndef AIXV3
|
||||
if (BitIsOn(keybd->kbdfeed->ctrl.autoRepeats,xkbi->slowKey))
|
||||
#endif
|
||||
{
|
||||
xkbi->repeatKey = xkbi->slowKey;
|
||||
xkbi->repeatKeyTimer= TimerSet(xkbi->repeatKeyTimer,
|
||||
0, ctrls->repeat_delay,
|
||||
AccessXRepeatKeyExpire, (pointer)keybd);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static CARD32
|
||||
#if NeedFunctionPrototypes
|
||||
AccessXBounceKeyExpire(OsTimerPtr timer,CARD32 now,pointer arg)
|
||||
#else
|
||||
AccessXBounceKeyExpire(timer,now,arg)
|
||||
OsTimerPtr timer;
|
||||
CARD32 now;
|
||||
pointer arg;
|
||||
#endif
|
||||
{
|
||||
XkbSrvInfoPtr xkbi= ((DeviceIntPtr)arg)->key->xkbInfo;
|
||||
|
||||
xkbi->inactiveKey= 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static CARD32
|
||||
#if NeedFunctionPrototypes
|
||||
AccessXTimeoutExpire(OsTimerPtr timer,CARD32 now,pointer arg)
|
||||
#else
|
||||
AccessXTimeoutExpire(timer,now,arg)
|
||||
OsTimerPtr timer;
|
||||
CARD32 now;
|
||||
pointer arg;
|
||||
#endif
|
||||
{
|
||||
DeviceIntPtr dev = (DeviceIntPtr)arg;
|
||||
XkbSrvInfoPtr xkbi= dev->key->xkbInfo;
|
||||
XkbControlsPtr ctrls= xkbi->desc->ctrls;
|
||||
XkbControlsRec old;
|
||||
xkbControlsNotify cn;
|
||||
XkbEventCauseRec cause;
|
||||
XkbSrvLedInfoPtr sli;
|
||||
|
||||
if (xkbi->lastPtrEventTime) {
|
||||
unsigned timeToWait = (ctrls->ax_timeout*1000);
|
||||
unsigned timeElapsed = (now-xkbi->lastPtrEventTime);
|
||||
|
||||
if (timeToWait > timeElapsed)
|
||||
return (timeToWait - timeElapsed);
|
||||
}
|
||||
old= *ctrls;
|
||||
xkbi->shiftKeyCount= 0;
|
||||
ctrls->enabled_ctrls&= ~ctrls->axt_ctrls_mask;
|
||||
ctrls->enabled_ctrls|=
|
||||
(ctrls->axt_ctrls_values&ctrls->axt_ctrls_mask);
|
||||
if (ctrls->axt_opts_mask) {
|
||||
ctrls->ax_options&= ~ctrls->axt_opts_mask;
|
||||
ctrls->ax_options|= (ctrls->axt_opts_values&ctrls->axt_opts_mask);
|
||||
}
|
||||
if (XkbComputeControlsNotify(dev,&old,ctrls,&cn,False)) {
|
||||
cn.keycode = 0;
|
||||
cn.eventType = 0;
|
||||
cn.requestMajor = 0;
|
||||
cn.requestMinor = 0;
|
||||
XkbSendControlsNotify(dev,&cn);
|
||||
}
|
||||
XkbSetCauseUnknown(&cause);
|
||||
sli= XkbFindSrvLedInfo(dev,XkbDfltXIClass,XkbDfltXIId,0);
|
||||
XkbUpdateIndicators(dev,sli->usesControls,True,NULL,&cause);
|
||||
if (ctrls->ax_options!=old.ax_options) {
|
||||
unsigned set,cleared,bell;
|
||||
set= ctrls->ax_options&(~old.ax_options);
|
||||
cleared= (~ctrls->ax_options)&old.ax_options;
|
||||
if (set && cleared) bell= _BEEP_FEATURE_CHANGE;
|
||||
else if (set) bell= _BEEP_FEATURE_ON;
|
||||
else bell= _BEEP_FEATURE_OFF;
|
||||
XkbDDXAccessXBeep(dev,bell,XkbAccessXTimeoutMask);
|
||||
}
|
||||
xkbi->krgTimerActive= _OFF_TIMER;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* AccessXFilterPressEvent */
|
||||
/* */
|
||||
/* Filter events before they get any further if SlowKeys is turned on. */
|
||||
/* In addition, this routine handles the ever so popular magic key */
|
||||
/* acts for turning various accessibility features on/off. */
|
||||
/* */
|
||||
/* Returns TRUE if this routine has discarded the event. */
|
||||
/* Returns FALSE if the event needs further processing. */
|
||||
/* */
|
||||
/************************************************************************/
|
||||
Bool
|
||||
#if NeedFunctionPrototypes
|
||||
AccessXFilterPressEvent( register xEvent * xE,
|
||||
register DeviceIntPtr keybd,
|
||||
int count)
|
||||
#else
|
||||
AccessXFilterPressEvent(xE,keybd,count)
|
||||
register xEvent *xE;
|
||||
register DeviceIntPtr keybd;
|
||||
int count;
|
||||
#endif
|
||||
{
|
||||
XkbSrvInfoPtr xkbi = keybd->key->xkbInfo;
|
||||
XkbControlsPtr ctrls = xkbi->desc->ctrls;
|
||||
Bool ignoreKeyEvent = FALSE;
|
||||
KeyCode key = xE->u.u.detail;
|
||||
KeySym * sym = XkbKeySymsPtr(xkbi->desc,key);
|
||||
|
||||
if (ctrls->enabled_ctrls&XkbAccessXKeysMask) {
|
||||
/* check for magic sequences */
|
||||
if ((sym[0]==XK_Shift_R)||(sym[0]==XK_Shift_L)) {
|
||||
if (XkbAX_NeedFeedback(ctrls,XkbAX_SlowWarnFBMask)) {
|
||||
xkbi->krgTimerActive = _KRG_WARN_TIMER;
|
||||
xkbi->krgTimer= TimerSet(xkbi->krgTimer, 0, 4000,
|
||||
AccessXKRGExpire, (pointer)keybd);
|
||||
}
|
||||
else {
|
||||
xkbi->krgTimerActive = _KRG_TIMER;
|
||||
xkbi->krgTimer= TimerSet(xkbi->krgTimer, 0, 8000,
|
||||
AccessXKRGExpire, (pointer)keybd);
|
||||
}
|
||||
if (!(ctrls->enabled_ctrls & XkbSlowKeysMask)) {
|
||||
CARD32 now= GetTimeInMillis();
|
||||
if ((now-xkbi->lastShiftEventTime)>15000)
|
||||
xkbi->shiftKeyCount= 1;
|
||||
else xkbi->shiftKeyCount++;
|
||||
xkbi->lastShiftEventTime= now;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (xkbi->krgTimerActive) {
|
||||
xkbi->krgTimer= TimerSet(xkbi->krgTimer,0, 0, NULL, NULL);
|
||||
xkbi->krgTimerActive= _OFF_TIMER;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Don't transmit the KeyPress if SlowKeys is turned on;
|
||||
* The wakeup handler will synthesize one for us if the user
|
||||
* has held the key long enough.
|
||||
*/
|
||||
if (ctrls->enabled_ctrls & XkbSlowKeysMask) {
|
||||
xkbAccessXNotify ev;
|
||||
/* If key was already pressed, ignore subsequent press events
|
||||
* from the server's autorepeat
|
||||
*/
|
||||
if(xkbi->slowKey == key)
|
||||
return TRUE;
|
||||
|
||||
ev.detail= XkbAXN_SKPress;
|
||||
ev.keycode= key;
|
||||
ev.slowKeysDelay= ctrls->slow_keys_delay;
|
||||
ev.debounceDelay= ctrls->debounce_delay;
|
||||
XkbSendAccessXNotify(keybd,&ev);
|
||||
if (XkbAX_NeedFeedback(ctrls,XkbAX_SKPressFBMask))
|
||||
XkbDDXAccessXBeep(keybd,_BEEP_SLOW_PRESS,XkbSlowKeysMask);
|
||||
xkbi->slowKey= key;
|
||||
xkbi->slowKeysTimer = TimerSet(xkbi->slowKeysTimer,
|
||||
0, ctrls->slow_keys_delay,
|
||||
AccessXSlowKeyExpire, (pointer)keybd);
|
||||
ignoreKeyEvent = TRUE;
|
||||
}
|
||||
|
||||
/* Don't transmit the KeyPress if BounceKeys is turned on
|
||||
* and the user pressed the same key within a given time period
|
||||
* from the last release.
|
||||
*/
|
||||
else if ((ctrls->enabled_ctrls & XkbBounceKeysMask) &&
|
||||
(key == xkbi->inactiveKey)) {
|
||||
if (XkbAX_NeedFeedback(ctrls,XkbAX_BKRejectFBMask))
|
||||
XkbDDXAccessXBeep(keybd,_BEEP_BOUNCE_REJECT,XkbBounceKeysMask);
|
||||
ignoreKeyEvent = TRUE;
|
||||
}
|
||||
|
||||
/* Start repeating if necessary. Stop autorepeating if the user
|
||||
* presses a non-modifier key that doesn't autorepeat.
|
||||
*/
|
||||
if (XkbDDXUsesSoftRepeat(keybd)) {
|
||||
if ((keybd->kbdfeed->ctrl.autoRepeat) &&
|
||||
((ctrls->enabled_ctrls&(XkbSlowKeysMask|XkbRepeatKeysMask))==
|
||||
XkbRepeatKeysMask)) {
|
||||
#ifndef AIXV3
|
||||
if (BitIsOn(keybd->kbdfeed->ctrl.autoRepeats,key))
|
||||
#endif
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if (xkbDebugFlags&0x10)
|
||||
ErrorF("Starting software autorepeat...\n");
|
||||
#endif
|
||||
xkbi->repeatKey = key;
|
||||
xkbi->repeatKeyTimer= TimerSet(xkbi->repeatKeyTimer,
|
||||
0, ctrls->repeat_delay,
|
||||
AccessXRepeatKeyExpire, (pointer)keybd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Check for two keys being pressed at the same time. This section
|
||||
* essentially says the following:
|
||||
*
|
||||
* If StickyKeys is on, and a modifier is currently being held down,
|
||||
* and one of the following is true: the current key is not a modifier
|
||||
* or the currentKey is a modifier, but not the only modifier being
|
||||
* held down, turn StickyKeys off if the TwoKeys off ctrl is set.
|
||||
*/
|
||||
if ((ctrls->enabled_ctrls & XkbStickyKeysMask) &&
|
||||
(xkbi->state.base_mods!=0) &&
|
||||
(XkbAX_NeedOption(ctrls,XkbAX_TwoKeysMask))) {
|
||||
xkbControlsNotify cn;
|
||||
cn.keycode = key;
|
||||
cn.eventType = KeyPress;
|
||||
cn.requestMajor = 0;
|
||||
cn.requestMinor = 0;
|
||||
AccessXStickyKeysTurnOff(keybd,&cn);
|
||||
}
|
||||
|
||||
if (!ignoreKeyEvent)
|
||||
XkbProcessKeyboardEvent(xE,keybd,count);
|
||||
return ignoreKeyEvent;
|
||||
} /* AccessXFilterPressEvent */
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* AccessXFilterReleaseEvent */
|
||||
/* */
|
||||
/* Filter events before they get any further if SlowKeys is turned on. */
|
||||
/* In addition, this routine handles the ever so popular magic key */
|
||||
/* acts for turning various accessibility features on/off. */
|
||||
/* */
|
||||
/* Returns TRUE if this routine has discarded the event. */
|
||||
/* Returns FALSE if the event needs further processing. */
|
||||
/* */
|
||||
/************************************************************************/
|
||||
Bool
|
||||
#if NeedFunctionPrototypes
|
||||
AccessXFilterReleaseEvent( register xEvent * xE,
|
||||
register DeviceIntPtr keybd,
|
||||
int count)
|
||||
#else
|
||||
AccessXFilterReleaseEvent(xE,keybd,count)
|
||||
register xEvent *xE;
|
||||
register DeviceIntPtr keybd;
|
||||
int count;
|
||||
#endif
|
||||
{
|
||||
XkbSrvInfoPtr xkbi = keybd->key->xkbInfo;
|
||||
XkbControlsPtr ctrls = xkbi->desc->ctrls;
|
||||
KeyCode key = xE->u.u.detail;
|
||||
Bool ignoreKeyEvent = FALSE;
|
||||
|
||||
/* Don't transmit the KeyRelease if BounceKeys is on and
|
||||
* this is the release of a key that was ignored due to
|
||||
* BounceKeys.
|
||||
*/
|
||||
if (ctrls->enabled_ctrls & XkbBounceKeysMask) {
|
||||
if ((key!=xkbi->mouseKey)&&(!BitIsOn(keybd->key->down,key)))
|
||||
ignoreKeyEvent = TRUE;
|
||||
xkbi->inactiveKey= key;
|
||||
xkbi->bounceKeysTimer= TimerSet(xkbi->bounceKeysTimer, 0,
|
||||
ctrls->debounce_delay,
|
||||
AccessXBounceKeyExpire, (pointer)keybd);
|
||||
}
|
||||
|
||||
/* Don't transmit the KeyRelease if SlowKeys is turned on and
|
||||
* the user didn't hold the key long enough. We know we passed
|
||||
* the key if the down bit was set by CoreProcessKeyboadEvent.
|
||||
*/
|
||||
if (ctrls->enabled_ctrls & XkbSlowKeysMask) {
|
||||
xkbAccessXNotify ev;
|
||||
unsigned beep_type;
|
||||
ev.keycode= key;
|
||||
ev.slowKeysDelay= ctrls->slow_keys_delay;
|
||||
ev.debounceDelay= ctrls->debounce_delay;
|
||||
if (BitIsOn(keybd->key->down,key) | (xkbi->mouseKey == key)) {
|
||||
ev.detail= XkbAXN_SKRelease;
|
||||
beep_type= _BEEP_SLOW_RELEASE;
|
||||
}
|
||||
else {
|
||||
ev.detail= XkbAXN_SKReject;
|
||||
beep_type= _BEEP_SLOW_REJECT;
|
||||
ignoreKeyEvent = TRUE;
|
||||
}
|
||||
XkbSendAccessXNotify(keybd,&ev);
|
||||
if (XkbAX_NeedFeedback(ctrls,XkbAX_SKRejectFBMask)) {
|
||||
XkbDDXAccessXBeep(keybd,beep_type,XkbSlowKeysMask);
|
||||
}
|
||||
if (xkbi->slowKey==key)
|
||||
xkbi->slowKey= 0;
|
||||
}
|
||||
|
||||
/* Stop Repeating if the user releases the key that is currently
|
||||
* repeating.
|
||||
*/
|
||||
if (xkbi->repeatKey==key) {
|
||||
xkbi->repeatKey= 0;
|
||||
}
|
||||
|
||||
if ((ctrls->enabled_ctrls&XkbAccessXTimeoutMask)&&(ctrls->ax_timeout>0)) {
|
||||
xkbi->lastPtrEventTime= 0;
|
||||
xkbi->krgTimer= TimerSet(xkbi->krgTimer, 0,
|
||||
ctrls->ax_timeout*1000,
|
||||
AccessXTimeoutExpire, (pointer)keybd);
|
||||
xkbi->krgTimerActive= _ALL_TIMEOUT_TIMER;
|
||||
}
|
||||
else if (xkbi->krgTimerActive!=_OFF_TIMER) {
|
||||
xkbi->krgTimer= TimerSet(xkbi->krgTimer, 0, 0, NULL, NULL);
|
||||
xkbi->krgTimerActive= _OFF_TIMER;
|
||||
}
|
||||
|
||||
/* Keep track of how many times the Shift key has been pressed.
|
||||
* If it has been pressed and released 5 times in a row, toggle
|
||||
* the state of StickyKeys.
|
||||
*/
|
||||
if ((!ignoreKeyEvent)&&(xkbi->shiftKeyCount)) {
|
||||
KeySym *pSym= XkbKeySymsPtr(xkbi->desc,key);
|
||||
if ((pSym[0]!=XK_Shift_L)&&(pSym[0]!=XK_Shift_R)) {
|
||||
xkbi->shiftKeyCount= 0;
|
||||
}
|
||||
else if (xkbi->shiftKeyCount>=5) {
|
||||
xkbControlsNotify cn;
|
||||
cn.keycode = key;
|
||||
cn.eventType = KeyPress;
|
||||
cn.requestMajor = 0;
|
||||
cn.requestMinor = 0;
|
||||
if (ctrls->enabled_ctrls & XkbStickyKeysMask)
|
||||
AccessXStickyKeysTurnOff(keybd,&cn);
|
||||
else
|
||||
AccessXStickyKeysTurnOn(keybd,&cn);
|
||||
xkbi->shiftKeyCount= 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ignoreKeyEvent)
|
||||
XkbProcessKeyboardEvent(xE,keybd,count);
|
||||
return ignoreKeyEvent;
|
||||
|
||||
} /* AccessXFilterReleaseEvent */
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* ProcessPointerEvent */
|
||||
/* */
|
||||
/* This routine merely sets the shiftKeyCount and clears the keyboard */
|
||||
/* response group timer (if necessary) on a mouse event. This is so */
|
||||
/* multiple shifts with just the mouse and shift-drags with the mouse */
|
||||
/* don't accidentally turn on StickyKeys or the Keyboard Response Group.*/
|
||||
/* */
|
||||
/************************************************************************/
|
||||
void
|
||||
#if NeedFunctionPrototypes
|
||||
ProcessPointerEvent( register xEvent * xE,
|
||||
register DeviceIntPtr mouse,
|
||||
int count)
|
||||
#else
|
||||
ProcessPointerEvent(xE,mouse,count)
|
||||
register xEvent *xE;
|
||||
register DeviceIntPtr mouse;
|
||||
int count;
|
||||
#endif
|
||||
{
|
||||
DeviceIntPtr dev = (DeviceIntPtr)LookupKeyboardDevice();
|
||||
XkbSrvInfoPtr xkbi = dev->key->xkbInfo;
|
||||
unsigned changed = 0;
|
||||
|
||||
xkbi->shiftKeyCount = 0;
|
||||
xkbi->lastPtrEventTime= xE->u.keyButtonPointer.time;
|
||||
|
||||
if (xE->u.u.type==ButtonPress) {
|
||||
changed |= XkbPointerButtonMask;
|
||||
}
|
||||
else if (xE->u.u.type==ButtonRelease) {
|
||||
xkbi->lockedPtrButtons&= ~(1<<(xE->u.u.detail&0x7));
|
||||
changed |= XkbPointerButtonMask;
|
||||
}
|
||||
CoreProcessPointerEvent(xE,mouse,count);
|
||||
|
||||
xkbi->state.ptr_buttons = mouse->button->state;
|
||||
|
||||
/* clear any latched modifiers */
|
||||
if ( xkbi->state.latched_mods && (xE->u.u.type==ButtonRelease) ) {
|
||||
unsigned changed_leds;
|
||||
XkbStateRec oldState;
|
||||
XkbSrvLedInfoPtr sli;
|
||||
|
||||
sli= XkbFindSrvLedInfo(dev,XkbDfltXIClass,XkbDfltXIId,0);
|
||||
oldState= xkbi->state;
|
||||
XkbLatchModifiers(dev,0xFF,0x00);
|
||||
|
||||
XkbComputeDerivedState(xkbi);
|
||||
changed |= XkbStateChangedFlags(&oldState,&xkbi->state);
|
||||
if (changed&sli->usedComponents) {
|
||||
changed_leds= XkbIndicatorsToUpdate(dev,changed,False);
|
||||
if (changed_leds) {
|
||||
XkbEventCauseRec cause;
|
||||
XkbSetCauseKey(&cause,(xE->u.u.detail&0x7),xE->u.u.type);
|
||||
XkbUpdateIndicators(dev,changed_leds,True,NULL,&cause);
|
||||
}
|
||||
}
|
||||
dev->key->state= XkbStateFieldFromRec(&xkbi->state);
|
||||
}
|
||||
|
||||
if (((xkbi->flags&_XkbStateNotifyInProgress)==0)&&(changed!=0)) {
|
||||
xkbStateNotify sn;
|
||||
sn.keycode= xE->u.u.detail;
|
||||
sn.eventType= xE->u.u.type;
|
||||
sn.requestMajor = sn.requestMinor = 0;
|
||||
sn.changed= changed;
|
||||
XkbSendStateNotify(dev,&sn);
|
||||
}
|
||||
|
||||
} /* ProcessPointerEvent */
|
||||
|
||||
|
||||
|
||||
|
||||
1462
xkb/xkbActions.c
Normal file
1462
xkb/xkbActions.c
Normal file
File diff suppressed because it is too large
Load diff
519
xkb/xkbDflts.h
Normal file
519
xkb/xkbDflts.h
Normal file
|
|
@ -0,0 +1,519 @@
|
|||
/* $Xorg: xkbDflts.h,v 1.3 2000/08/17 19:53:47 cpqbld Exp $ */
|
||||
/* This file generated automatically by xkbcomp */
|
||||
/* DO NOT EDIT */
|
||||
#ifndef DEFAULT_H
|
||||
#define DEFAULT_H 1
|
||||
|
||||
#ifndef XKB_IN_SERVER
|
||||
#define GET_ATOM(d,s) XInternAtom(d,s,0)
|
||||
#define DPYTYPE Display *
|
||||
#else
|
||||
#define GET_ATOM(d,s) MakeAtom(s,strlen(s),1)
|
||||
#define DPYTYPE char *
|
||||
#endif
|
||||
#define NUM_KEYS 1
|
||||
|
||||
#define vmod_NumLock 0
|
||||
#define vmod_Alt 1
|
||||
#define vmod_LevelThree 2
|
||||
#define vmod_AltGr 3
|
||||
#define vmod_ScrollLock 4
|
||||
|
||||
#define vmod_NumLockMask (1<<0)
|
||||
#define vmod_AltMask (1<<1)
|
||||
#define vmod_LevelThreeMask (1<<2)
|
||||
#define vmod_AltGrMask (1<<3)
|
||||
#define vmod_ScrollLockMask (1<<4)
|
||||
|
||||
/* types name is "default" */
|
||||
static Atom lnames_ONE_LEVEL[1];
|
||||
|
||||
static XkbKTMapEntryRec map_TWO_LEVEL[1]= {
|
||||
{ 1, 1, { ShiftMask, ShiftMask, 0 } }
|
||||
};
|
||||
static Atom lnames_TWO_LEVEL[2];
|
||||
|
||||
static XkbKTMapEntryRec map_ALPHABETIC[2]= {
|
||||
{ 1, 1, { ShiftMask, ShiftMask, 0 } },
|
||||
{ 1, 0, { LockMask, LockMask, 0 } }
|
||||
};
|
||||
static XkbModsRec preserve_ALPHABETIC[2]= {
|
||||
{ 0, 0, 0 },
|
||||
{ LockMask, LockMask, 0 }
|
||||
};
|
||||
static Atom lnames_ALPHABETIC[2];
|
||||
|
||||
static XkbKTMapEntryRec map_KEYPAD[2]= {
|
||||
{ 1, 1, { ShiftMask, ShiftMask, 0 } },
|
||||
{ 0, 1, { 0, 0, vmod_NumLockMask } }
|
||||
};
|
||||
static Atom lnames_KEYPAD[2];
|
||||
|
||||
static XkbKTMapEntryRec map_PC_BREAK[1]= {
|
||||
{ 1, 1, { ControlMask, ControlMask, 0 } }
|
||||
};
|
||||
static Atom lnames_PC_BREAK[2];
|
||||
|
||||
static XkbKTMapEntryRec map_PC_SYSRQ[1]= {
|
||||
{ 0, 1, { 0, 0, vmod_AltMask } }
|
||||
};
|
||||
static Atom lnames_PC_SYSRQ[2];
|
||||
|
||||
static XkbKTMapEntryRec map_CTRL_ALT[1]= {
|
||||
{ 0, 1, { ControlMask, ControlMask, vmod_AltMask } }
|
||||
};
|
||||
static Atom lnames_CTRL_ALT[2];
|
||||
|
||||
static XkbKTMapEntryRec map_THREE_LEVEL[3]= {
|
||||
{ 1, 1, { ShiftMask, ShiftMask, 0 } },
|
||||
{ 0, 2, { 0, 0, vmod_LevelThreeMask } },
|
||||
{ 0, 2, { ShiftMask, ShiftMask, vmod_LevelThreeMask } }
|
||||
};
|
||||
static Atom lnames_THREE_LEVEL[3];
|
||||
|
||||
static XkbKTMapEntryRec map_SHIFT_ALT[1]= {
|
||||
{ 0, 1, { ShiftMask, ShiftMask, vmod_AltMask } }
|
||||
};
|
||||
static Atom lnames_SHIFT_ALT[2];
|
||||
|
||||
static XkbKeyTypeRec dflt_types[]= {
|
||||
{
|
||||
{ 0, 0, 0 },
|
||||
1,
|
||||
0, NULL, NULL,
|
||||
None, lnames_ONE_LEVEL
|
||||
},
|
||||
{
|
||||
{ ShiftMask, ShiftMask, 0 },
|
||||
2,
|
||||
1, map_TWO_LEVEL, NULL,
|
||||
None, lnames_TWO_LEVEL
|
||||
},
|
||||
{
|
||||
{ ShiftMask|LockMask, ShiftMask|LockMask, 0 },
|
||||
2,
|
||||
2, map_ALPHABETIC, preserve_ALPHABETIC,
|
||||
None, lnames_ALPHABETIC
|
||||
},
|
||||
{
|
||||
{ ShiftMask, ShiftMask, vmod_NumLockMask },
|
||||
2,
|
||||
2, map_KEYPAD, NULL,
|
||||
None, lnames_KEYPAD
|
||||
},
|
||||
{
|
||||
{ ControlMask, ControlMask, 0 },
|
||||
2,
|
||||
1, map_PC_BREAK, NULL,
|
||||
None, lnames_PC_BREAK
|
||||
},
|
||||
{
|
||||
{ 0, 0, vmod_AltMask },
|
||||
2,
|
||||
1, map_PC_SYSRQ, NULL,
|
||||
None, lnames_PC_SYSRQ
|
||||
},
|
||||
{
|
||||
{ ControlMask, ControlMask, vmod_AltMask },
|
||||
2,
|
||||
1, map_CTRL_ALT, NULL,
|
||||
None, lnames_CTRL_ALT
|
||||
},
|
||||
{
|
||||
{ ShiftMask, ShiftMask, vmod_LevelThreeMask },
|
||||
3,
|
||||
3, map_THREE_LEVEL, NULL,
|
||||
None, lnames_THREE_LEVEL
|
||||
},
|
||||
{
|
||||
{ ShiftMask, ShiftMask, vmod_AltMask },
|
||||
2,
|
||||
1, map_SHIFT_ALT, NULL,
|
||||
None, lnames_SHIFT_ALT
|
||||
}
|
||||
};
|
||||
#define num_dflt_types (sizeof(dflt_types)/sizeof(XkbKeyTypeRec))
|
||||
|
||||
|
||||
static void
|
||||
#if NeedFunctionPrototypes
|
||||
initTypeNames(DPYTYPE dpy)
|
||||
#else
|
||||
initTypeNames(dpy)
|
||||
DPYTYPE dpy;
|
||||
#endif
|
||||
{
|
||||
dflt_types[0].name= GET_ATOM(dpy,"ONE_LEVEL");
|
||||
lnames_ONE_LEVEL[0]= GET_ATOM(dpy,"Any");
|
||||
dflt_types[1].name= GET_ATOM(dpy,"TWO_LEVEL");
|
||||
lnames_TWO_LEVEL[0]= GET_ATOM(dpy,"Base");
|
||||
lnames_TWO_LEVEL[1]= GET_ATOM(dpy,"Shift");
|
||||
dflt_types[2].name= GET_ATOM(dpy,"ALPHABETIC");
|
||||
lnames_ALPHABETIC[0]= GET_ATOM(dpy,"Base");
|
||||
lnames_ALPHABETIC[1]= GET_ATOM(dpy,"Caps");
|
||||
dflt_types[3].name= GET_ATOM(dpy,"KEYPAD");
|
||||
lnames_KEYPAD[0]= GET_ATOM(dpy,"Base");
|
||||
lnames_KEYPAD[1]= GET_ATOM(dpy,"Number");
|
||||
dflt_types[4].name= GET_ATOM(dpy,"PC_BREAK");
|
||||
lnames_PC_BREAK[0]= GET_ATOM(dpy,"Base");
|
||||
lnames_PC_BREAK[1]= GET_ATOM(dpy,"Control");
|
||||
dflt_types[5].name= GET_ATOM(dpy,"PC_SYSRQ");
|
||||
lnames_PC_SYSRQ[0]= GET_ATOM(dpy,"Base");
|
||||
lnames_PC_SYSRQ[1]= GET_ATOM(dpy,"Alt");
|
||||
dflt_types[6].name= GET_ATOM(dpy,"CTRL+ALT");
|
||||
lnames_CTRL_ALT[0]= GET_ATOM(dpy,"Base");
|
||||
lnames_CTRL_ALT[1]= GET_ATOM(dpy,"Ctrl+Alt");
|
||||
dflt_types[7].name= GET_ATOM(dpy,"THREE_LEVEL");
|
||||
lnames_THREE_LEVEL[0]= GET_ATOM(dpy,"Base");
|
||||
lnames_THREE_LEVEL[1]= GET_ATOM(dpy,"Shift");
|
||||
lnames_THREE_LEVEL[2]= GET_ATOM(dpy,"Level3");
|
||||
dflt_types[8].name= GET_ATOM(dpy,"SHIFT+ALT");
|
||||
lnames_SHIFT_ALT[0]= GET_ATOM(dpy,"Base");
|
||||
lnames_SHIFT_ALT[1]= GET_ATOM(dpy,"Shift+Alt");
|
||||
}
|
||||
/* compat name is "default" */
|
||||
static XkbSymInterpretRec dfltSI[69]= {
|
||||
{ XK_ISO_Level2_Latch, 0x0000,
|
||||
XkbSI_LevelOneOnly|XkbSI_Exactly, ShiftMask,
|
||||
255,
|
||||
{ XkbSA_LatchMods, 0x03, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00 } },
|
||||
{ XK_Eisu_Shift, 0x0000,
|
||||
XkbSI_Exactly, LockMask,
|
||||
255,
|
||||
{ XkbSA_NoAction, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } },
|
||||
{ XK_Eisu_toggle, 0x0000,
|
||||
XkbSI_Exactly, LockMask,
|
||||
255,
|
||||
{ XkbSA_NoAction, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } },
|
||||
{ XK_Kana_Shift, 0x0000,
|
||||
XkbSI_Exactly, LockMask,
|
||||
255,
|
||||
{ XkbSA_NoAction, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } },
|
||||
{ XK_Kana_Lock, 0x0000,
|
||||
XkbSI_Exactly, LockMask,
|
||||
255,
|
||||
{ XkbSA_NoAction, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } },
|
||||
{ XK_Shift_Lock, 0x0000,
|
||||
XkbSI_AnyOf, ShiftMask|LockMask,
|
||||
255,
|
||||
{ XkbSA_LockMods, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00 } },
|
||||
{ XK_Num_Lock, 0x0000,
|
||||
XkbSI_AnyOf, 0xff,
|
||||
0,
|
||||
{ XkbSA_LockMods, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00 } },
|
||||
{ XK_Alt_L, 0x0000,
|
||||
XkbSI_AnyOf, 0xff,
|
||||
1,
|
||||
{ XkbSA_SetMods, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } },
|
||||
{ XK_Alt_R, 0x0000,
|
||||
XkbSI_AnyOf, 0xff,
|
||||
1,
|
||||
{ XkbSA_SetMods, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } },
|
||||
{ XK_Scroll_Lock, 0x0000,
|
||||
XkbSI_AnyOf, 0xff,
|
||||
4,
|
||||
{ XkbSA_LockMods, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } },
|
||||
{ XK_ISO_Lock, 0x0000,
|
||||
XkbSI_AnyOf, 0xff,
|
||||
255,
|
||||
{ XkbSA_ISOLock, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } },
|
||||
{ XK_ISO_Level3_Shift, 0x0000,
|
||||
XkbSI_LevelOneOnly|XkbSI_AnyOf, 0xff,
|
||||
2,
|
||||
{ XkbSA_SetMods, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00 } },
|
||||
{ XK_ISO_Level3_Latch, 0x0000,
|
||||
XkbSI_LevelOneOnly|XkbSI_AnyOf, 0xff,
|
||||
2,
|
||||
{ XkbSA_LatchMods, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00 } },
|
||||
{ XK_Mode_switch, 0x0000,
|
||||
XkbSI_LevelOneOnly|XkbSI_AnyOfOrNone, 0xff,
|
||||
3,
|
||||
{ XkbSA_SetGroup, 0x05, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 } },
|
||||
{ XK_KP_1, 0x0001,
|
||||
XkbSI_AnyOfOrNone, 0xff,
|
||||
255,
|
||||
{ XkbSA_MovePtr, 0x00, 0xff, 0xff, 0x00, 0x01, 0x00, 0x00 } },
|
||||
{ XK_KP_End, 0x0001,
|
||||
XkbSI_AnyOfOrNone, 0xff,
|
||||
255,
|
||||
{ XkbSA_MovePtr, 0x00, 0xff, 0xff, 0x00, 0x01, 0x00, 0x00 } },
|
||||
{ XK_KP_2, 0x0001,
|
||||
XkbSI_AnyOfOrNone, 0xff,
|
||||
255,
|
||||
{ XkbSA_MovePtr, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00 } },
|
||||
{ XK_KP_Down, 0x0001,
|
||||
XkbSI_AnyOfOrNone, 0xff,
|
||||
255,
|
||||
{ XkbSA_MovePtr, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00 } },
|
||||
{ XK_KP_3, 0x0001,
|
||||
XkbSI_AnyOfOrNone, 0xff,
|
||||
255,
|
||||
{ XkbSA_MovePtr, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00 } },
|
||||
{ XK_KP_Next, 0x0001,
|
||||
XkbSI_AnyOfOrNone, 0xff,
|
||||
255,
|
||||
{ XkbSA_MovePtr, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00 } },
|
||||
{ XK_KP_4, 0x0001,
|
||||
XkbSI_AnyOfOrNone, 0xff,
|
||||
255,
|
||||
{ XkbSA_MovePtr, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 } },
|
||||
{ XK_KP_Left, 0x0001,
|
||||
XkbSI_AnyOfOrNone, 0xff,
|
||||
255,
|
||||
{ XkbSA_MovePtr, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 } },
|
||||
{ XK_KP_6, 0x0001,
|
||||
XkbSI_AnyOfOrNone, 0xff,
|
||||
255,
|
||||
{ XkbSA_MovePtr, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 } },
|
||||
{ XK_KP_Right, 0x0001,
|
||||
XkbSI_AnyOfOrNone, 0xff,
|
||||
255,
|
||||
{ XkbSA_MovePtr, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 } },
|
||||
{ XK_KP_7, 0x0001,
|
||||
XkbSI_AnyOfOrNone, 0xff,
|
||||
255,
|
||||
{ XkbSA_MovePtr, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00 } },
|
||||
{ XK_KP_Home, 0x0001,
|
||||
XkbSI_AnyOfOrNone, 0xff,
|
||||
255,
|
||||
{ XkbSA_MovePtr, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00 } },
|
||||
{ XK_KP_8, 0x0001,
|
||||
XkbSI_AnyOfOrNone, 0xff,
|
||||
255,
|
||||
{ XkbSA_MovePtr, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00 } },
|
||||
{ XK_KP_Up, 0x0001,
|
||||
XkbSI_AnyOfOrNone, 0xff,
|
||||
255,
|
||||
{ XkbSA_MovePtr, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00 } },
|
||||
{ XK_KP_9, 0x0001,
|
||||
XkbSI_AnyOfOrNone, 0xff,
|
||||
255,
|
||||
{ XkbSA_MovePtr, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00 } },
|
||||
{ XK_KP_Prior, 0x0001,
|
||||
XkbSI_AnyOfOrNone, 0xff,
|
||||
255,
|
||||
{ XkbSA_MovePtr, 0x00, 0x00, 0x01, 0xff, 0xff, 0x00, 0x00 } },
|
||||
{ XK_KP_5, 0x0001,
|
||||
XkbSI_AnyOfOrNone, 0xff,
|
||||
255,
|
||||
{ XkbSA_PtrBtn, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } },
|
||||
{ XK_KP_Begin, 0x0001,
|
||||
XkbSI_AnyOfOrNone, 0xff,
|
||||
255,
|
||||
{ XkbSA_PtrBtn, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } },
|
||||
{ XK_KP_F1, 0x0001,
|
||||
XkbSI_AnyOfOrNone, 0xff,
|
||||
255,
|
||||
{ XkbSA_SetPtrDflt, 0x04, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00 } },
|
||||
{ XK_KP_Divide, 0x0001,
|
||||
XkbSI_AnyOfOrNone, 0xff,
|
||||
255,
|
||||
{ XkbSA_SetPtrDflt, 0x04, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00 } },
|
||||
{ XK_KP_F2, 0x0001,
|
||||
XkbSI_AnyOfOrNone, 0xff,
|
||||
255,
|
||||
{ XkbSA_SetPtrDflt, 0x04, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00 } },
|
||||
{ XK_KP_Multiply, 0x0001,
|
||||
XkbSI_AnyOfOrNone, 0xff,
|
||||
255,
|
||||
{ XkbSA_SetPtrDflt, 0x04, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00 } },
|
||||
{ XK_KP_F3, 0x0001,
|
||||
XkbSI_AnyOfOrNone, 0xff,
|
||||
255,
|
||||
{ XkbSA_SetPtrDflt, 0x04, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00 } },
|
||||
{ XK_KP_Subtract, 0x0001,
|
||||
XkbSI_AnyOfOrNone, 0xff,
|
||||
255,
|
||||
{ XkbSA_SetPtrDflt, 0x04, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00 } },
|
||||
{ XK_KP_Separator, 0x0001,
|
||||
XkbSI_AnyOfOrNone, 0xff,
|
||||
255,
|
||||
{ XkbSA_PtrBtn, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00 } },
|
||||
{ XK_KP_Add, 0x0001,
|
||||
XkbSI_AnyOfOrNone, 0xff,
|
||||
255,
|
||||
{ XkbSA_PtrBtn, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00 } },
|
||||
{ XK_KP_0, 0x0001,
|
||||
XkbSI_AnyOfOrNone, 0xff,
|
||||
255,
|
||||
{ XkbSA_LockPtrBtn, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } },
|
||||
{ XK_KP_Insert, 0x0001,
|
||||
XkbSI_AnyOfOrNone, 0xff,
|
||||
255,
|
||||
{ XkbSA_LockPtrBtn, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } },
|
||||
{ XK_KP_Decimal, 0x0001,
|
||||
XkbSI_AnyOfOrNone, 0xff,
|
||||
255,
|
||||
{ XkbSA_LockPtrBtn, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } },
|
||||
{ XK_KP_Delete, 0x0001,
|
||||
XkbSI_AnyOfOrNone, 0xff,
|
||||
255,
|
||||
{ XkbSA_LockPtrBtn, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } },
|
||||
{ XK_Pointer_Button_Dflt, 0x0000,
|
||||
XkbSI_AnyOfOrNone, 0xff,
|
||||
255,
|
||||
{ XkbSA_PtrBtn, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } },
|
||||
{ XK_Pointer_Button1, 0x0000,
|
||||
XkbSI_AnyOfOrNone, 0xff,
|
||||
255,
|
||||
{ XkbSA_PtrBtn, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 } },
|
||||
{ XK_Pointer_Button2, 0x0000,
|
||||
XkbSI_AnyOfOrNone, 0xff,
|
||||
255,
|
||||
{ XkbSA_PtrBtn, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00 } },
|
||||
{ XK_Pointer_Button3, 0x0000,
|
||||
XkbSI_AnyOfOrNone, 0xff,
|
||||
255,
|
||||
{ XkbSA_PtrBtn, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00 } },
|
||||
{ XK_Pointer_DblClick_Dflt, 0x0000,
|
||||
XkbSI_AnyOfOrNone, 0xff,
|
||||
255,
|
||||
{ XkbSA_PtrBtn, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00 } },
|
||||
{ XK_Pointer_DblClick1, 0x0000,
|
||||
XkbSI_AnyOfOrNone, 0xff,
|
||||
255,
|
||||
{ XkbSA_PtrBtn, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00 } },
|
||||
{ XK_Pointer_DblClick2, 0x0000,
|
||||
XkbSI_AnyOfOrNone, 0xff,
|
||||
255,
|
||||
{ XkbSA_PtrBtn, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00 } },
|
||||
{ XK_Pointer_DblClick3, 0x0000,
|
||||
XkbSI_AnyOfOrNone, 0xff,
|
||||
255,
|
||||
{ XkbSA_PtrBtn, 0x00, 0x02, 0x03, 0x00, 0x00, 0x00, 0x00 } },
|
||||
{ XK_Pointer_Drag_Dflt, 0x0000,
|
||||
XkbSI_AnyOfOrNone, 0xff,
|
||||
255,
|
||||
{ XkbSA_LockPtrBtn, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } },
|
||||
{ XK_Pointer_Drag1, 0x0000,
|
||||
XkbSI_AnyOfOrNone, 0xff,
|
||||
255,
|
||||
{ XkbSA_LockPtrBtn, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 } },
|
||||
{ XK_Pointer_Drag2, 0x0000,
|
||||
XkbSI_AnyOfOrNone, 0xff,
|
||||
255,
|
||||
{ XkbSA_LockPtrBtn, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00 } },
|
||||
{ XK_Pointer_Drag3, 0x0000,
|
||||
XkbSI_AnyOfOrNone, 0xff,
|
||||
255,
|
||||
{ XkbSA_LockPtrBtn, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00 } },
|
||||
{ XK_Pointer_EnableKeys, 0x0000,
|
||||
XkbSI_AnyOfOrNone, 0xff,
|
||||
255,
|
||||
{ XkbSA_LockControls, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00 } },
|
||||
{ XK_Pointer_Accelerate, 0x0000,
|
||||
XkbSI_AnyOfOrNone, 0xff,
|
||||
255,
|
||||
{ XkbSA_LockControls, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00 } },
|
||||
{ XK_Pointer_DfltBtnNext, 0x0000,
|
||||
XkbSI_AnyOfOrNone, 0xff,
|
||||
255,
|
||||
{ XkbSA_SetPtrDflt, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00 } },
|
||||
{ XK_Pointer_DfltBtnPrev, 0x0000,
|
||||
XkbSI_AnyOfOrNone, 0xff,
|
||||
255,
|
||||
{ XkbSA_SetPtrDflt, 0x00, 0x01, 0xff, 0x00, 0x00, 0x00, 0x00 } },
|
||||
{ XK_AccessX_Enable, 0x0000,
|
||||
XkbSI_AnyOfOrNone, 0xff,
|
||||
255,
|
||||
{ XkbSA_LockControls, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00 } },
|
||||
{ XK_Terminate_Server, 0x0000,
|
||||
XkbSI_AnyOfOrNone, 0xff,
|
||||
255,
|
||||
{ XkbSA_Terminate, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } },
|
||||
{ XK_ISO_Group_Latch, 0x0000,
|
||||
XkbSI_LevelOneOnly|XkbSI_AnyOfOrNone, 0xff,
|
||||
3,
|
||||
{ XkbSA_LatchGroup, 0x04, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 } },
|
||||
{ XK_ISO_Next_Group, 0x0000,
|
||||
XkbSI_LevelOneOnly|XkbSI_AnyOfOrNone, 0xff,
|
||||
3,
|
||||
{ XkbSA_LockGroup, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 } },
|
||||
{ XK_ISO_Prev_Group, 0x0000,
|
||||
XkbSI_LevelOneOnly|XkbSI_AnyOfOrNone, 0xff,
|
||||
3,
|
||||
{ XkbSA_LockGroup, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 } },
|
||||
{ XK_ISO_First_Group, 0x0000,
|
||||
XkbSI_AnyOfOrNone, 0xff,
|
||||
255,
|
||||
{ XkbSA_LockGroup, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } },
|
||||
{ XK_ISO_Last_Group, 0x0000,
|
||||
XkbSI_AnyOfOrNone, 0xff,
|
||||
255,
|
||||
{ XkbSA_LockGroup, 0x04, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 } },
|
||||
{ NoSymbol, 0x0000,
|
||||
XkbSI_Exactly, LockMask,
|
||||
255,
|
||||
{ XkbSA_LockMods, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00 } },
|
||||
{ NoSymbol, 0x0000,
|
||||
XkbSI_AnyOf, 0xff,
|
||||
255,
|
||||
{ XkbSA_SetMods, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }
|
||||
};
|
||||
#define num_dfltSI (sizeof(dfltSI)/sizeof(XkbSymInterpretRec))
|
||||
|
||||
static XkbCompatMapRec compatMap= {
|
||||
dfltSI,
|
||||
{ /* group compatibility */
|
||||
{ 0, 0, 0 },
|
||||
{ 0, 0, vmod_AltGrMask },
|
||||
{ 0, 0, vmod_AltGrMask },
|
||||
{ 0, 0, vmod_AltGrMask }
|
||||
},
|
||||
num_dfltSI, num_dfltSI
|
||||
};
|
||||
|
||||
static XkbIndicatorRec indicators= {
|
||||
0x0,
|
||||
{
|
||||
{ 0x80, 0, 0x00, XkbIM_UseEffective, LockMask, LockMask, 0, 0 },
|
||||
{ 0x80, 0, 0x00, XkbIM_UseEffective, 0, 0, vmod_NumLockMask, 0 },
|
||||
{ 0x80, 0, 0x00, XkbIM_UseLocked, ShiftMask, ShiftMask, 0, 0 },
|
||||
{ 0x80, 0, 0x00, 0, 0, 0, 0, XkbMouseKeysMask },
|
||||
{ 0x80, 0, 0x00, XkbIM_UseLocked, 0, 0, vmod_ScrollLockMask, 0 },
|
||||
{ 0x80, XkbIM_UseEffective, 0xfe, 0, 0, 0, 0, 0 },
|
||||
{ 0x00, 0, 0x00, 0, 0, 0, 0, 0 },
|
||||
{ 0x00, 0, 0x00, 0, 0, 0, 0, 0 },
|
||||
{ 0x00, 0, 0x00, 0, 0, 0, 0, 0 },
|
||||
{ 0x00, 0, 0x00, 0, 0, 0, 0, 0 },
|
||||
{ 0x00, 0, 0x00, 0, 0, 0, 0, 0 },
|
||||
{ 0x00, 0, 0x00, 0, 0, 0, 0, 0 },
|
||||
{ 0x00, 0, 0x00, 0, 0, 0, 0, 0 },
|
||||
{ 0x00, 0, 0x00, 0, 0, 0, 0, 0 },
|
||||
{ 0x00, 0, 0x00, 0, 0, 0, 0, 0 },
|
||||
{ 0x00, 0, 0x00, 0, 0, 0, 0, 0 },
|
||||
{ 0x00, 0, 0x00, 0, 0, 0, 0, 0 },
|
||||
{ 0x00, 0, 0x00, 0, 0, 0, 0, 0 },
|
||||
{ 0x00, 0, 0x00, 0, 0, 0, 0, 0 },
|
||||
{ 0x00, 0, 0x00, 0, 0, 0, 0, 0 },
|
||||
{ 0x00, 0, 0x00, 0, 0, 0, 0, 0 },
|
||||
{ 0x00, 0, 0x00, 0, 0, 0, 0, 0 },
|
||||
{ 0x00, 0, 0x00, 0, 0, 0, 0, 0 },
|
||||
{ 0x00, 0, 0x00, 0, 0, 0, 0, 0 },
|
||||
{ 0x00, 0, 0x00, 0, 0, 0, 0, 0 },
|
||||
{ 0x00, 0, 0x00, 0, 0, 0, 0, 0 },
|
||||
{ 0x00, 0, 0x00, 0, 0, 0, 0, 0 },
|
||||
{ 0x00, 0, 0x00, 0, 0, 0, 0, 0 },
|
||||
{ 0x00, 0, 0x00, 0, 0, 0, 0, 0 },
|
||||
{ 0x00, 0, 0x00, 0, 0, 0, 0, 0 },
|
||||
{ 0x00, 0, 0x00, 0, 0, 0, 0, 0 },
|
||||
{ 0x00, 0, 0x00, 0, 0, 0, 0, 0 }
|
||||
}
|
||||
};
|
||||
static void
|
||||
#if NeedFunctionPrototypes
|
||||
initIndicatorNames(DPYTYPE dpy,XkbDescPtr xkb)
|
||||
#else
|
||||
initIndicatorNames(dpy,xkb)
|
||||
DPYTYPE dpy;
|
||||
XkbDescPtr xkb;
|
||||
#endif
|
||||
{
|
||||
xkb->names->indicators[ 0]= GET_ATOM(dpy,"Caps Lock");
|
||||
xkb->names->indicators[ 1]= GET_ATOM(dpy,"Num Lock");
|
||||
xkb->names->indicators[ 2]= GET_ATOM(dpy,"Shift Lock");
|
||||
xkb->names->indicators[ 3]= GET_ATOM(dpy,"Mouse Keys");
|
||||
xkb->names->indicators[ 4]= GET_ATOM(dpy,"Scroll Lock");
|
||||
xkb->names->indicators[ 5]= GET_ATOM(dpy,"Group 2");
|
||||
}
|
||||
#endif /* DEFAULT_H */
|
||||
1154
xkb/xkbEvents.c
Normal file
1154
xkb/xkbEvents.c
Normal file
File diff suppressed because it is too large
Load diff
994
xkb/xkbInit.c
Normal file
994
xkb/xkbInit.c
Normal file
|
|
@ -0,0 +1,994 @@
|
|||
/*
|
||||
* @(#)$RCSfile$ $Revision$ (DEC) $Date$
|
||||
*/
|
||||
/* $Xorg: xkbInit.c,v 1.3 2000/08/17 19:53:47 cpqbld Exp $ */
|
||||
/************************************************************
|
||||
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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <math.h>
|
||||
#define NEED_EVENTS 1
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include <X11/keysym.h>
|
||||
#include <X11/Xatom.h>
|
||||
#include "misc.h"
|
||||
#include "inputstr.h"
|
||||
#include "property.h"
|
||||
#define XKBSRV_NEED_FILE_FUNCS
|
||||
#include "XKBsrv.h"
|
||||
#include "XKBgeom.h"
|
||||
#include <X11/extensions/XKMformat.h>
|
||||
#include <X11/extensions/XKBfile.h>
|
||||
|
||||
|
||||
#define CREATE_ATOM(s) MakeAtom(s,sizeof(s)-1,1)
|
||||
|
||||
#ifdef sgi
|
||||
#define LED_CAPS 5
|
||||
#define LED_NUM 6
|
||||
#define LED_SCROLL 7
|
||||
#define PHYS_LEDS 0x7f
|
||||
#define LED_COMPOSE 8
|
||||
#else
|
||||
#if defined(ultrix) || defined(__osf__) || defined(__alpha)
|
||||
#define LED_COMPOSE 2
|
||||
#define LED_CAPS 3
|
||||
#define LED_SCROLL 4
|
||||
#define LED_NUM 5
|
||||
#define PHYS_LEDS 0x1f
|
||||
#else
|
||||
#ifdef sun
|
||||
#define LED_NUM 1
|
||||
#define LED_SCROLL 2
|
||||
#define LED_COMPOSE 3
|
||||
#define LED_CAPS 4
|
||||
#define PHYS_LEDS 0x0f
|
||||
#else
|
||||
#define LED_CAPS 1
|
||||
#define LED_NUM 2
|
||||
#define LED_SCROLL 3
|
||||
#define PHYS_LEDS 0x07
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define MAX_TOC 16
|
||||
typedef struct _SrvXkmInfo {
|
||||
DeviceIntPtr dev;
|
||||
FILE * file;
|
||||
XkbFileInfo xkbinfo;
|
||||
} SrvXkmInfo;
|
||||
|
||||
|
||||
/***====================================================================***/
|
||||
|
||||
#ifndef XKB_BASE_DIRECTORY
|
||||
#define XKB_BASE_DIRECTORY "/usr/lib/X11/xkb"
|
||||
#endif
|
||||
#ifndef XKB_DFLT_RULES_FILE
|
||||
#define XKB_DFLT_RULES_FILE "rules"
|
||||
#endif
|
||||
#ifndef XKB_DFLT_KB_LAYOUT
|
||||
#define XKB_DFLT_KB_LAYOUT "us"
|
||||
#endif
|
||||
#ifndef XKB_DFLT_KB_MODEL
|
||||
#define XKB_DFLT_KB_MODEL "dflt"
|
||||
#endif
|
||||
#ifndef XKB_DFLT_KB_VARIANT
|
||||
#define XKB_DFLT_KB_VARIANT NULL
|
||||
#endif
|
||||
#ifndef XKB_DFLT_KB_OPTIONS
|
||||
#define XKB_DFLT_KB_OPTIONS NULL
|
||||
#endif
|
||||
#ifndef XKB_DFLT_DISABLED
|
||||
#define XKB_DFLT_DISABLED True
|
||||
#endif
|
||||
#ifndef XKB_DFLT_RULES_PROP
|
||||
#define XKB_DFLT_RULES_PROP True
|
||||
#endif
|
||||
|
||||
char * XkbBaseDirectory= XKB_BASE_DIRECTORY;
|
||||
char * XkbInitialMap= NULL;
|
||||
int XkbWantAccessX= 0;
|
||||
static XkbFileInfo * _XkbInitFileInfo= NULL;
|
||||
char * XkbDB= NULL;
|
||||
int XkbAutoLoad= 1;
|
||||
|
||||
static Bool rulesDefined= False;
|
||||
static char * XkbRulesFile= NULL;
|
||||
static char * XkbModelDflt= NULL;
|
||||
static char * XkbLayoutDflt= NULL;
|
||||
static char * XkbVariantDflt= NULL;
|
||||
static char * XkbOptionsDflt= NULL;
|
||||
|
||||
char * XkbModelUsed= NULL;
|
||||
char * XkbLayoutUsed= NULL;
|
||||
char * XkbVariantUsed= NULL;
|
||||
char * XkbOptionsUsed= NULL;
|
||||
|
||||
int _XkbClientMajor= XkbMajorVersion;
|
||||
int _XkbClientMinor= XkbMinorVersion;
|
||||
|
||||
Bool noXkbExtension= XKB_DFLT_DISABLED;
|
||||
Bool XkbWantRulesProp= XKB_DFLT_RULES_PROP;
|
||||
|
||||
/***====================================================================***/
|
||||
|
||||
char *
|
||||
#if NeedFunctionPrototypes
|
||||
XkbGetRulesDflts(XkbRF_VarDefsPtr defs)
|
||||
#else
|
||||
XkbGetRulesDflts(defs)
|
||||
XkbRF_VarDefsPtr defs;
|
||||
#endif
|
||||
{
|
||||
if (XkbModelDflt) defs->model= XkbModelDflt;
|
||||
else defs->model= XKB_DFLT_KB_MODEL;
|
||||
if (XkbLayoutDflt) defs->layout= XkbLayoutDflt;
|
||||
else defs->layout= XKB_DFLT_KB_LAYOUT;
|
||||
if (XkbVariantDflt) defs->variant= XkbVariantDflt;
|
||||
else defs->variant= XKB_DFLT_KB_VARIANT;
|
||||
if (XkbOptionsDflt) defs->options= XkbOptionsDflt;
|
||||
else defs->options= XKB_DFLT_KB_OPTIONS;
|
||||
return (rulesDefined?XkbRulesFile:XKB_DFLT_RULES_FILE);
|
||||
}
|
||||
|
||||
Bool
|
||||
#if NeedFunctionPrototypes
|
||||
XkbWriteRulesProp(ClientPtr client, pointer closure)
|
||||
#else
|
||||
XkbWriteRulesProp(client, closure)
|
||||
ClientPtr client;
|
||||
pointer closure;
|
||||
#endif
|
||||
{
|
||||
int len,out;
|
||||
extern WindowPtr * WindowTable;
|
||||
Atom name;
|
||||
char * pval;
|
||||
|
||||
if (rulesDefined && (!XkbRulesFile))
|
||||
return False;
|
||||
len= (XkbRulesFile?strlen(XkbRulesFile):strlen(XKB_DFLT_RULES_FILE));
|
||||
len+= (XkbModelUsed?strlen(XkbModelUsed):0);
|
||||
len+= (XkbLayoutUsed?strlen(XkbLayoutUsed):0);
|
||||
len+= (XkbVariantUsed?strlen(XkbVariantUsed):0);
|
||||
len+= (XkbOptionsUsed?strlen(XkbOptionsUsed):0);
|
||||
if (len<1)
|
||||
return True;
|
||||
|
||||
len+= 5; /* trailing NULs */
|
||||
|
||||
name= MakeAtom(_XKB_RF_NAMES_PROP_ATOM,strlen(_XKB_RF_NAMES_PROP_ATOM),1);
|
||||
if (name==None) {
|
||||
ErrorF("Atom error: %s not created\n",_XKB_RF_NAMES_PROP_ATOM);
|
||||
return True;
|
||||
}
|
||||
pval= (char*) ALLOCATE_LOCAL(len);
|
||||
if (!pval) {
|
||||
ErrorF("Allocation error: %s proprerty not created\n",
|
||||
_XKB_RF_NAMES_PROP_ATOM);
|
||||
return True;
|
||||
}
|
||||
out= 0;
|
||||
if (XkbRulesFile) {
|
||||
strcpy(&pval[out],XkbRulesFile);
|
||||
out+= strlen(XkbRulesFile);
|
||||
}
|
||||
pval[out++]= '\0';
|
||||
if (XkbModelUsed) {
|
||||
strcpy(&pval[out],XkbModelUsed);
|
||||
out+= strlen(XkbModelUsed);
|
||||
}
|
||||
pval[out++]= '\0';
|
||||
if (XkbLayoutUsed) {
|
||||
strcpy(&pval[out],XkbLayoutUsed);
|
||||
out+= strlen(XkbLayoutUsed);
|
||||
}
|
||||
pval[out++]= '\0';
|
||||
if (XkbVariantUsed) {
|
||||
strcpy(&pval[out],XkbVariantUsed);
|
||||
out+= strlen(XkbVariantUsed);
|
||||
}
|
||||
pval[out++]= '\0';
|
||||
if (XkbOptionsUsed) {
|
||||
strcpy(&pval[out],XkbOptionsUsed);
|
||||
out+= strlen(XkbOptionsUsed);
|
||||
}
|
||||
pval[out++]= '\0';
|
||||
if (out!=len) {
|
||||
ErrorF("Internal Error! bad size (%d!=%d) for _XKB_RULES_NAMES\n",
|
||||
out,len);
|
||||
}
|
||||
ChangeWindowProperty(WindowTable[0],name,XA_STRING,8,PropModeReplace,
|
||||
len,pval,True);
|
||||
DEALLOCATE_LOCAL(pval);
|
||||
return True;
|
||||
}
|
||||
|
||||
void
|
||||
#if NeedFunctionPrototypes
|
||||
XkbSetRulesUsed(XkbRF_VarDefsPtr defs)
|
||||
#else
|
||||
XkbSetRulesUsed(defs)
|
||||
XkbRF_VarDefsPtr defs;
|
||||
#endif
|
||||
{
|
||||
if (XkbModelUsed)
|
||||
_XkbFree(XkbModelUsed);
|
||||
XkbModelUsed= (defs->model?_XkbDupString(defs->model):NULL);
|
||||
if (XkbLayoutUsed)
|
||||
_XkbFree(XkbLayoutUsed);
|
||||
XkbLayoutUsed= (defs->layout?_XkbDupString(defs->layout):NULL);
|
||||
if (XkbVariantUsed)
|
||||
_XkbFree(XkbVariantUsed);
|
||||
XkbVariantUsed= (defs->variant?_XkbDupString(defs->variant):NULL);
|
||||
if (XkbOptionsUsed)
|
||||
_XkbFree(XkbOptionsUsed);
|
||||
XkbOptionsUsed= (defs->options?_XkbDupString(defs->options):NULL);
|
||||
if (XkbWantRulesProp)
|
||||
QueueWorkProc(XkbWriteRulesProp,NULL,NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
#if NeedFunctionPrototypes
|
||||
XkbSetRulesDflts(char *rulesFile,char *model,char *layout,
|
||||
char *variant,char *options)
|
||||
#else
|
||||
XkbSetRulesDflts(rulesFile,model,layout,variant,options)
|
||||
char * rulesFile;
|
||||
char * model;
|
||||
char * layout;
|
||||
char * variant;
|
||||
char * options;
|
||||
#endif
|
||||
{
|
||||
if (XkbRulesFile)
|
||||
_XkbFree(XkbRulesFile);
|
||||
XkbRulesFile= _XkbDupString(rulesFile);
|
||||
rulesDefined= True;
|
||||
if (model) {
|
||||
if (XkbModelDflt)
|
||||
_XkbFree(XkbModelDflt);
|
||||
XkbModelDflt= _XkbDupString(model);
|
||||
}
|
||||
if (layout) {
|
||||
if (XkbLayoutDflt)
|
||||
_XkbFree(XkbLayoutDflt);
|
||||
XkbLayoutDflt= _XkbDupString(layout);
|
||||
}
|
||||
if (variant) {
|
||||
if (XkbVariantDflt)
|
||||
_XkbFree(XkbVariantDflt);
|
||||
XkbVariantDflt= _XkbDupString(variant);
|
||||
}
|
||||
if (options) {
|
||||
if (XkbOptionsDflt)
|
||||
_XkbFree(XkbOptionsDflt);
|
||||
XkbOptionsDflt= _XkbDupString(options);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/***====================================================================***/
|
||||
|
||||
#if defined(luna)
|
||||
#define XKB_DDX_PERMANENT_LOCK 1
|
||||
#endif
|
||||
|
||||
#include "xkbDflts.h"
|
||||
|
||||
static Bool
|
||||
#if NeedFunctionPrototypes
|
||||
XkbInitKeyTypes(XkbDescPtr xkb,SrvXkmInfo *file)
|
||||
#else
|
||||
XkbInitKeyTypes(xkb,file)
|
||||
XkbDescPtr xkb;
|
||||
SrvXkmInfo * file;
|
||||
#endif
|
||||
{
|
||||
if (file->xkbinfo.defined&XkmTypesMask)
|
||||
return True;
|
||||
initTypeNames(NULL);
|
||||
if (XkbAllocClientMap(xkb,XkbKeyTypesMask,num_dflt_types)!=Success)
|
||||
return False;
|
||||
if (XkbCopyKeyTypes(dflt_types,xkb->map->types,num_dflt_types)!=
|
||||
Success) {
|
||||
return False;
|
||||
}
|
||||
xkb->map->size_types= xkb->map->num_types= num_dflt_types;
|
||||
return True;
|
||||
}
|
||||
|
||||
static void
|
||||
#if NeedFunctionPrototypes
|
||||
XkbInitRadioGroups(XkbSrvInfoPtr xkbi,SrvXkmInfo *file)
|
||||
#else
|
||||
XkbInitRadioGroups(xkbi,file)
|
||||
XkbSrvInfoPtr xkbi;
|
||||
SrvXkmInfo * file;
|
||||
#endif
|
||||
{
|
||||
xkbi->nRadioGroups = 0;
|
||||
xkbi->radioGroups = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
static Status
|
||||
#if NeedFunctionPrototypes
|
||||
XkbInitCompatStructs(XkbDescPtr xkb,SrvXkmInfo *file)
|
||||
#else
|
||||
XkbInitCompatStructs(xkb,file)
|
||||
XkbDescPtr xkb;
|
||||
SrvXkmInfo * file;
|
||||
#endif
|
||||
{
|
||||
register int i;
|
||||
XkbCompatMapPtr compat;
|
||||
|
||||
if (file->xkbinfo.defined&XkmCompatMapMask)
|
||||
return Success;
|
||||
if (XkbAllocCompatMap(xkb,XkbAllCompatMask,num_dfltSI)!=Success)
|
||||
return BadAlloc;
|
||||
compat = xkb->compat;
|
||||
if (compat->sym_interpret) {
|
||||
compat->num_si = num_dfltSI;
|
||||
memcpy((char *)compat->sym_interpret,(char *)dfltSI,sizeof(dfltSI));
|
||||
}
|
||||
for (i=0;i<XkbNumKbdGroups;i++) {
|
||||
compat->groups[i]= compatMap.groups[i];
|
||||
if (compat->groups[i].vmods!=0) {
|
||||
unsigned mask;
|
||||
mask= XkbMaskForVMask(xkb,compat->groups[i].vmods);
|
||||
compat->groups[i].mask= compat->groups[i].real_mods|mask;
|
||||
}
|
||||
else compat->groups[i].mask= compat->groups[i].real_mods;
|
||||
}
|
||||
return Success;
|
||||
}
|
||||
|
||||
static void
|
||||
#if NeedFunctionPrototypes
|
||||
XkbInitSemantics(XkbDescPtr xkb,SrvXkmInfo *file)
|
||||
#else
|
||||
XkbInitSemantics(xkb,file)
|
||||
XkbDescPtr xkb;
|
||||
SrvXkmInfo * file;
|
||||
#endif
|
||||
{
|
||||
XkbInitKeyTypes(xkb,file);
|
||||
XkbInitCompatStructs(xkb,file);
|
||||
return;
|
||||
}
|
||||
|
||||
/***====================================================================***/
|
||||
|
||||
static Status
|
||||
#if NeedFunctionPrototypes
|
||||
XkbInitNames(XkbSrvInfoPtr xkbi,SrvXkmInfo *file)
|
||||
#else
|
||||
XkbInitNames(xkbi,file)
|
||||
XkbSrvInfoPtr xkbi;
|
||||
SrvXkmInfo * file;
|
||||
#endif
|
||||
{
|
||||
XkbDescPtr xkb;
|
||||
XkbNamesPtr names;
|
||||
Status rtrn;
|
||||
Atom unknown;
|
||||
|
||||
xkb= xkbi->desc;
|
||||
if ((rtrn=XkbAllocNames(xkb,XkbAllNamesMask,0,0))!=Success)
|
||||
return rtrn;
|
||||
unknown= CREATE_ATOM("unknown");
|
||||
names = xkb->names;
|
||||
if (names->keycodes==None) names->keycodes= unknown;
|
||||
if (names->geometry==None) names->geometry= unknown;
|
||||
if (names->phys_symbols==None) names->phys_symbols= unknown;
|
||||
if (names->symbols==None) names->symbols= unknown;
|
||||
if (names->types==None) names->types= unknown;
|
||||
if (names->compat==None) names->compat= unknown;
|
||||
if ((file->xkbinfo.defined&XkmVirtualModsMask)==0) {
|
||||
if (names->vmods[vmod_NumLock]==None)
|
||||
names->vmods[vmod_NumLock]= CREATE_ATOM("NumLock");
|
||||
if (names->vmods[vmod_Alt]==None)
|
||||
names->vmods[vmod_Alt]= CREATE_ATOM("Alt");
|
||||
if (names->vmods[vmod_AltGr]==None)
|
||||
names->vmods[vmod_AltGr]= CREATE_ATOM("ModeSwitch");
|
||||
}
|
||||
|
||||
if (((file->xkbinfo.defined&XkmIndicatorsMask)==0)||
|
||||
((file->xkbinfo.defined&XkmGeometryMask)==0)) {
|
||||
initIndicatorNames(NULL,xkb);
|
||||
if (names->indicators[LED_CAPS-1]==None)
|
||||
names->indicators[LED_CAPS-1] = CREATE_ATOM("Caps Lock");
|
||||
if (names->indicators[LED_NUM-1]==None)
|
||||
names->indicators[LED_NUM-1] = CREATE_ATOM("Num Lock");
|
||||
if (names->indicators[LED_SCROLL-1]==None)
|
||||
names->indicators[LED_SCROLL-1] = CREATE_ATOM("Scroll Lock");
|
||||
#ifdef LED_COMPOSE
|
||||
if (names->indicators[LED_COMPOSE-1]==None)
|
||||
names->indicators[LED_COMPOSE-1] = CREATE_ATOM("Compose");
|
||||
#endif
|
||||
}
|
||||
#ifdef DEBUG_RADIO_GROUPS
|
||||
if (names->num_rg<1) {
|
||||
names->radio_groups= (Atom *)Xcalloc(RG_COUNT*sizeof(Atom));
|
||||
if (names->radio_groups) {
|
||||
names->num_rg = RG_COUNT;
|
||||
names->radio_groups[RG_BOGUS_FUNCTION_GROUP]= CREATE_ATOM("BOGUS");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (xkb->geom!=NULL)
|
||||
names->geometry= xkb->geom->name;
|
||||
else names->geometry= unknown;
|
||||
return Success;
|
||||
}
|
||||
|
||||
static Status
|
||||
#if NeedFunctionPrototypes
|
||||
XkbInitIndicatorMap(XkbSrvInfoPtr xkbi,SrvXkmInfo *file)
|
||||
#else
|
||||
XkbInitIndicatorMap(xkbi,file)
|
||||
XkbSrvInfoPtr xkbi;
|
||||
SrvXkmInfo * file;
|
||||
#endif
|
||||
{
|
||||
XkbDescPtr xkb;
|
||||
XkbIndicatorPtr map;
|
||||
XkbSrvLedInfoPtr sli;
|
||||
|
||||
xkb= xkbi->desc;
|
||||
if (XkbAllocIndicatorMaps(xkb)!=Success)
|
||||
return BadAlloc;
|
||||
if ((file->xkbinfo.defined&XkmIndicatorsMask)==0) {
|
||||
map= xkb->indicators;
|
||||
map->phys_indicators = PHYS_LEDS;
|
||||
map->maps[LED_CAPS-1].flags= XkbIM_NoExplicit;
|
||||
map->maps[LED_CAPS-1].which_mods= XkbIM_UseLocked;
|
||||
map->maps[LED_CAPS-1].mods.mask= LockMask;
|
||||
map->maps[LED_CAPS-1].mods.real_mods= LockMask;
|
||||
|
||||
map->maps[LED_NUM-1].flags= XkbIM_NoExplicit;
|
||||
map->maps[LED_NUM-1].which_mods= XkbIM_UseLocked;
|
||||
map->maps[LED_NUM-1].mods.mask= 0;
|
||||
map->maps[LED_NUM-1].mods.real_mods= 0;
|
||||
map->maps[LED_NUM-1].mods.vmods= vmod_NumLockMask;
|
||||
}
|
||||
sli= XkbFindSrvLedInfo(xkbi->device,XkbDfltXIClass,XkbDfltXIId,0);
|
||||
if (sli)
|
||||
XkbCheckIndicatorMaps(xkbi->device,sli,XkbAllIndicatorsMask);
|
||||
return Success;
|
||||
}
|
||||
|
||||
static Status
|
||||
#if NeedFunctionPrototypes
|
||||
XkbInitControls(DeviceIntPtr pXDev,XkbSrvInfoPtr xkbi,SrvXkmInfo *file)
|
||||
#else
|
||||
XkbInitControls(pXDev,xkbi,file)
|
||||
DeviceIntPtr pXDev;
|
||||
XkbSrvInfoPtr xkbi;
|
||||
SrvXkmInfo * file;
|
||||
#endif
|
||||
{
|
||||
XkbDescPtr xkb;
|
||||
XkbControlsPtr ctrls;
|
||||
|
||||
xkb= xkbi->desc;
|
||||
/* 12/31/94 (ef) -- XXX! Should check if controls loaded from file */
|
||||
if (XkbAllocControls(xkb,XkbAllControlsMask)!=Success)
|
||||
FatalError("Couldn't allocate keyboard controls\n");
|
||||
ctrls= xkb->ctrls;
|
||||
if ((file->xkbinfo.defined&XkmSymbolsMask)==0)
|
||||
ctrls->num_groups = 1;
|
||||
ctrls->groups_wrap = XkbSetGroupInfo(1,XkbWrapIntoRange,0);
|
||||
ctrls->internal.mask = 0;
|
||||
ctrls->internal.real_mods = 0;
|
||||
ctrls->internal.vmods = 0;
|
||||
ctrls->ignore_lock.mask = 0;
|
||||
ctrls->ignore_lock.real_mods = 0;
|
||||
ctrls->ignore_lock.vmods = 0;
|
||||
ctrls->enabled_ctrls = XkbAccessXTimeoutMask|XkbRepeatKeysMask|
|
||||
XkbMouseKeysAccelMask|XkbAudibleBellMask|
|
||||
XkbIgnoreGroupLockMask;
|
||||
if (XkbWantAccessX)
|
||||
ctrls->enabled_ctrls|= XkbAccessXKeysMask;
|
||||
AccessXInit(pXDev);
|
||||
return Success;
|
||||
}
|
||||
|
||||
void
|
||||
#if NeedFunctionPrototypes
|
||||
XkbInitDevice(DeviceIntPtr pXDev)
|
||||
#else
|
||||
XkbInitDevice(pXDev)
|
||||
DeviceIntPtr pXDev;
|
||||
#endif
|
||||
{
|
||||
int i;
|
||||
XkbSrvInfoPtr xkbi;
|
||||
XkbChangesRec changes;
|
||||
SrvXkmInfo file;
|
||||
unsigned check;
|
||||
XkbEventCauseRec cause;
|
||||
|
||||
file.dev= pXDev;
|
||||
file.file=NULL;
|
||||
bzero(&file.xkbinfo,sizeof(XkbFileInfo));
|
||||
bzero(&changes,sizeof(XkbChangesRec));
|
||||
if (XkbAutoLoad && (XkbInitialMap!=NULL)) {
|
||||
if ((file.file=XkbDDXOpenConfigFile(XkbInitialMap,NULL,0))!=NULL) {
|
||||
XkmReadFile(file.file,0,XkmKeymapLegal,&file.xkbinfo);
|
||||
if (file.xkbinfo.xkb==NULL) {
|
||||
ErrorF("Error loading keymap file %s (%s in %s)\n",
|
||||
XkbInitialMap, _XkbErrMessages[_XkbErrCode],
|
||||
(_XkbErrLocation?_XkbErrLocation:"unknown"));
|
||||
ErrorF(" reverting to defaults\n");
|
||||
fclose(file.file);
|
||||
file.file= NULL;
|
||||
bzero(&file.xkbinfo,sizeof(XkbFileInfo));
|
||||
}
|
||||
else {
|
||||
if (_XkbInitFileInfo!=NULL) {
|
||||
XkbDescPtr tmp;
|
||||
if ((tmp=_XkbInitFileInfo->xkb)!=NULL) {
|
||||
XkbFreeKeyboard(tmp,XkbAllComponentsMask,True);
|
||||
_XkbInitFileInfo->xkb= NULL;
|
||||
}
|
||||
}
|
||||
_XkbInitFileInfo= &file.xkbinfo;
|
||||
}
|
||||
}
|
||||
else {
|
||||
ErrorF("Error opening keymap file %s, reverting to defaults\n",
|
||||
XkbInitialMap);
|
||||
}
|
||||
}
|
||||
pXDev->key->xkbInfo= xkbi= _XkbTypedCalloc(1,XkbSrvInfoRec);
|
||||
if ( xkbi ) {
|
||||
XkbDescPtr xkb;
|
||||
if ((_XkbInitFileInfo!=NULL)&&(_XkbInitFileInfo->xkb!=NULL)) {
|
||||
file.xkbinfo= *_XkbInitFileInfo;
|
||||
xkbi->desc= _XkbInitFileInfo->xkb;
|
||||
_XkbInitFileInfo= NULL;
|
||||
}
|
||||
else {
|
||||
xkbi->desc= XkbAllocKeyboard();
|
||||
if (!xkbi->desc)
|
||||
FatalError("Couldn't allocate keyboard description\n");
|
||||
xkbi->desc->min_key_code = pXDev->key->curKeySyms.minKeyCode;
|
||||
xkbi->desc->max_key_code = pXDev->key->curKeySyms.maxKeyCode;
|
||||
}
|
||||
xkb= xkbi->desc;
|
||||
if (xkb->min_key_code == 0)
|
||||
xkb->min_key_code = pXDev->key->curKeySyms.minKeyCode;
|
||||
if (xkb->max_key_code == 0)
|
||||
xkb->max_key_code = pXDev->key->curKeySyms.maxKeyCode;
|
||||
if ((pXDev->key->curKeySyms.minKeyCode!=xkbi->desc->min_key_code)||
|
||||
(pXDev->key->curKeySyms.maxKeyCode!=xkbi->desc->max_key_code)) {
|
||||
/* 12/9/95 (ef) -- XXX! Maybe we should try to fix up one or */
|
||||
/* the other here, but for now just complain */
|
||||
/* can't just update the core range without */
|
||||
/* reallocating the KeySymsRec (pain) */
|
||||
ErrorF("Internal Error!! XKB and core keymap have different range\n");
|
||||
}
|
||||
if (XkbAllocClientMap(xkb,XkbAllClientInfoMask,0)!=Success)
|
||||
FatalError("Couldn't allocate client map in XkbInitDevice\n");
|
||||
i= XkbNumKeys(xkb)/3+1;
|
||||
if (XkbAllocServerMap(xkb,XkbAllServerInfoMask,i)!=Success)
|
||||
FatalError("Couldn't allocate server map in XkbInitDevice\n");
|
||||
|
||||
xkbi->dfltPtrDelta=1;
|
||||
xkbi->device = pXDev;
|
||||
|
||||
file.xkbinfo.xkb= xkb;
|
||||
XkbInitSemantics(xkb,&file);
|
||||
XkbInitNames(xkbi,&file);
|
||||
XkbInitRadioGroups(xkbi,&file);
|
||||
|
||||
/* 12/31/94 (ef) -- XXX! Should check if state loaded from file */
|
||||
bzero(&xkbi->state,sizeof(XkbStateRec));
|
||||
|
||||
XkbInitControls(pXDev,xkbi,&file);
|
||||
|
||||
if (file.xkbinfo.defined&XkmSymbolsMask)
|
||||
memcpy(pXDev->key->modifierMap,xkb->map->modmap,xkb->max_key_code+1);
|
||||
else
|
||||
memcpy(xkb->map->modmap,pXDev->key->modifierMap,xkb->max_key_code+1);
|
||||
|
||||
XkbInitIndicatorMap(xkbi,&file);
|
||||
|
||||
XkbDDXInitDevice(pXDev);
|
||||
|
||||
if (!(file.xkbinfo.defined&XkmSymbolsMask)) {
|
||||
XkbUpdateKeyTypesFromCore(pXDev,xkb->min_key_code,XkbNumKeys(xkb),
|
||||
&changes);
|
||||
}
|
||||
else {
|
||||
XkbUpdateCoreDescription(pXDev,True);
|
||||
}
|
||||
XkbSetCauseUnknown(&cause);
|
||||
XkbUpdateActions(pXDev,xkb->min_key_code, XkbNumKeys(xkb),&changes,
|
||||
&check,&cause);
|
||||
/* For sanity. The first time the connection
|
||||
* is opened, the client side min and max are set
|
||||
* using QueryMinMaxKeyCodes() which grabs them
|
||||
* from pXDev.
|
||||
*/
|
||||
pXDev->key->curKeySyms.minKeyCode = xkb->min_key_code;
|
||||
pXDev->key->curKeySyms.maxKeyCode = xkb->max_key_code;
|
||||
}
|
||||
if (file.file!=NULL)
|
||||
fclose(file.file);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Bool
|
||||
#if NeedFunctionPrototypes
|
||||
XkbInitKeyboardDeviceStruct( DeviceIntPtr dev,
|
||||
XkbComponentNamesPtr names,
|
||||
KeySymsPtr pSymsIn,
|
||||
CARD8 pModsIn[],
|
||||
void (*bellProc)(),
|
||||
void (*ctrlProc)())
|
||||
#else
|
||||
XkbInitKeyboardDeviceStruct( dev,names,pSymsIn,pModsIn,bellProc,ctrlProc )
|
||||
DeviceIntPtr dev;
|
||||
XkbComponentNamesPtr names;
|
||||
KeySymsPtr pSymsIn;
|
||||
CARD8 pModsIn[];
|
||||
void (*bellProc)();
|
||||
void (*ctrlProc)();
|
||||
#endif
|
||||
{
|
||||
XkbFileInfo finfo;
|
||||
KeySymsRec tmpSyms,*pSyms;
|
||||
CARD8 tmpMods[XkbMaxLegalKeyCode+1],*pMods;
|
||||
char name[PATH_MAX],*rules;
|
||||
Bool ok;
|
||||
XPointer config;
|
||||
XkbComponentNamesRec cfgNames;
|
||||
XkbRF_VarDefsRec defs;
|
||||
|
||||
if ((dev->key!=NULL)||(dev->kbdfeed!=NULL))
|
||||
return False;
|
||||
pSyms= pSymsIn;
|
||||
pMods= pModsIn;
|
||||
bzero(&defs,sizeof(XkbRF_VarDefsRec));
|
||||
bzero(&cfgNames,sizeof(XkbComponentNamesRec));
|
||||
rules= XkbGetRulesDflts(&defs);
|
||||
config= XkbDDXPreloadConfig(&rules,&defs,&cfgNames,dev);
|
||||
|
||||
if (defs.model && defs.layout && rules) {
|
||||
XkbComponentNamesRec rNames;
|
||||
bzero(&rNames,sizeof(XkbComponentNamesRec));
|
||||
if (XkbDDXNamesFromRules(dev,rules,&defs,&rNames)) {
|
||||
if (rNames.keymap) names->keymap= rNames.keymap;
|
||||
if (rNames.keycodes) names->keycodes= rNames.keycodes;
|
||||
if (rNames.types) names->types= rNames.types;
|
||||
if (rNames.compat) names->compat= rNames.compat;
|
||||
if (rNames.symbols) names->symbols= rNames.symbols;
|
||||
if (rNames.geometry) names->geometry= rNames.geometry;
|
||||
XkbSetRulesUsed(&defs);
|
||||
}
|
||||
}
|
||||
if (cfgNames.keymap) names->keymap= cfgNames.keymap;
|
||||
if (cfgNames.keycodes) names->keycodes= cfgNames.keycodes;
|
||||
if (cfgNames.types) names->types= cfgNames.types;
|
||||
if (cfgNames.compat) names->compat= cfgNames.compat;
|
||||
if (cfgNames.symbols) names->symbols= cfgNames.symbols;
|
||||
if (cfgNames.geometry) names->geometry= cfgNames.geometry;
|
||||
|
||||
if ((XkbDDXLoadKeymapByNames(dev,names,XkmAllIndicesMask,0,
|
||||
&finfo,name,PATH_MAX))&&
|
||||
(finfo.xkb!=NULL)) {
|
||||
XkbDescPtr xkb;
|
||||
int minKC,maxKC;
|
||||
|
||||
xkb= finfo.xkb;
|
||||
minKC= xkb->min_key_code;
|
||||
maxKC= xkb->max_key_code;
|
||||
if (XkbIsLegalKeycode(minKC)&&XkbIsLegalKeycode(maxKC)&&(minKC<=maxKC)&&
|
||||
((minKC!=pSyms->minKeyCode)||(maxKC!=pSyms->maxKeyCode))) {
|
||||
if (xkb->map!=NULL) {
|
||||
KeySym *inSym,*outSym;
|
||||
int width= pSymsIn->mapWidth;
|
||||
|
||||
tmpSyms.minKeyCode= minKC;
|
||||
tmpSyms.maxKeyCode= maxKC;
|
||||
|
||||
if (minKC<pSymsIn->minKeyCode)
|
||||
minKC= pSymsIn->minKeyCode;
|
||||
if (maxKC>pSymsIn->maxKeyCode)
|
||||
maxKC= pSymsIn->maxKeyCode;
|
||||
|
||||
tmpSyms.mapWidth= width;
|
||||
tmpSyms.map= _XkbTypedCalloc(width*XkbNumKeys(xkb),KeySym);
|
||||
inSym= &pSymsIn->map[(minKC-pSymsIn->minKeyCode)*width];
|
||||
outSym= &tmpSyms.map[(minKC-tmpSyms.minKeyCode)*width];
|
||||
memcpy(outSym,inSym,((maxKC-minKC+1)*width)*sizeof(KeySym));
|
||||
pSyms= &tmpSyms;
|
||||
}
|
||||
if ((xkb->map!=NULL)&&(xkb->map->modmap!=NULL)) {
|
||||
bzero(tmpMods,XkbMaxKeyCount);
|
||||
memcpy(tmpMods,xkb->map->modmap,maxKC+1);
|
||||
pMods= tmpMods;
|
||||
}
|
||||
}
|
||||
_XkbInitFileInfo= &finfo;
|
||||
}
|
||||
else {
|
||||
ErrorF("Couldn't load XKB keymap, falling back to pre-XKB keymap\n");
|
||||
}
|
||||
ok= InitKeyboardDeviceStruct((DevicePtr)dev,pSyms,pMods,bellProc,ctrlProc);
|
||||
if ((config!=NULL)&&(dev && dev->key && dev->key->xkbInfo))
|
||||
XkbDDXApplyConfig(config,dev->key->xkbInfo);
|
||||
_XkbInitFileInfo= NULL;
|
||||
if ((pSyms==&tmpSyms)&&(pSyms->map!=NULL)) {
|
||||
_XkbFree(pSyms->map);
|
||||
pSyms->map= NULL;
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
/***====================================================================***/
|
||||
|
||||
/*
|
||||
* InitKeyClassDeviceStruct initializes the key class before it
|
||||
* initializes the keyboard feedback class for a device.
|
||||
* UpdateActions can't set up the correct autorepeat for keyboard
|
||||
* initialization because the keyboard feedback isn't created yet.
|
||||
* Instead, UpdateActions notes the "correct" autorepeat in the
|
||||
* SrvInfo structure and InitKbdFeedbackClass calls UpdateAutoRepeat
|
||||
* to apply the computed autorepeat once the feedback class exists.
|
||||
*
|
||||
* DIX will apply the changed autorepeat, so there's no need to
|
||||
* do so here. This function returns True if both RepeatKeys and
|
||||
* the core protocol autorepeat ctrls are set (i.e. should use
|
||||
* software autorepeat), false otherwise.
|
||||
*
|
||||
* This function also computes the autorepeat accelerators for the
|
||||
* default indicator feedback.
|
||||
*/
|
||||
int
|
||||
#if NeedFunctionPrototypes
|
||||
XkbFinishDeviceInit(DeviceIntPtr pXDev)
|
||||
#else
|
||||
XkbFinishDeviceInit(pXDev)
|
||||
DeviceIntPtr pXDev;
|
||||
#endif
|
||||
{
|
||||
XkbSrvInfoPtr xkbi;
|
||||
XkbDescPtr xkb;
|
||||
int softRepeat;
|
||||
XkbSrvLedInfoPtr sli;
|
||||
|
||||
xkbi = NULL;
|
||||
if (pXDev && pXDev->key && pXDev->key->xkbInfo && pXDev->kbdfeed) {
|
||||
xkbi= pXDev->key->xkbInfo;
|
||||
xkb= xkbi->desc;
|
||||
if (pXDev->kbdfeed) {
|
||||
xkbi->kbdProc= pXDev->kbdfeed->CtrlProc;
|
||||
pXDev->kbdfeed->CtrlProc= XkbDDXKeybdCtrlProc;
|
||||
}
|
||||
if (pXDev->kbdfeed->ctrl.autoRepeat)
|
||||
xkb->ctrls->enabled_ctrls|= XkbRepeatKeysMask;
|
||||
softRepeat= (xkb->ctrls->enabled_ctrls&XkbRepeatKeysMask)!=0;
|
||||
if (pXDev->kbdfeed) {
|
||||
memcpy(pXDev->kbdfeed->ctrl.autoRepeats,
|
||||
xkb->ctrls->per_key_repeat,XkbPerKeyBitArraySize);
|
||||
softRepeat= softRepeat&&pXDev->kbdfeed->ctrl.autoRepeat;
|
||||
}
|
||||
}
|
||||
else softRepeat= 0;
|
||||
sli= XkbFindSrvLedInfo(pXDev,XkbDfltXIClass,XkbDfltXIId,0);
|
||||
if (sli && xkbi)
|
||||
XkbCheckIndicatorMaps(xkbi->device,sli,XkbAllIndicatorsMask);
|
||||
#ifdef DEBUG
|
||||
else ErrorF("No indicator feedback in XkbFinishInit (shouldn't happen)!\n");
|
||||
#endif
|
||||
return softRepeat;
|
||||
}
|
||||
|
||||
/*
|
||||
* Be very careful about what does and doesn't get freed by this
|
||||
* function. To reduce fragmentation, XkbInitDevice allocates a
|
||||
* single huge block per device and divides it up into most of the
|
||||
* fixed-size structures for the device. Don't free anything that
|
||||
* is part of this larger block.
|
||||
*/
|
||||
void
|
||||
#if NeedFunctionPrototypes
|
||||
XkbFreeInfo(XkbSrvInfoPtr xkbi)
|
||||
#else
|
||||
XkbFreeInfo(xkbi)
|
||||
XkbSrvInfoPtr xkbi;
|
||||
#endif
|
||||
{
|
||||
if (xkbi->radioGroups) {
|
||||
Xfree(xkbi->radioGroups);
|
||||
xkbi->radioGroups= NULL;
|
||||
}
|
||||
if (xkbi->mouseKeyTimer) {
|
||||
TimerFree(xkbi->mouseKeyTimer);
|
||||
xkbi->mouseKeyTimer= NULL;
|
||||
}
|
||||
if (xkbi->slowKeysTimer) {
|
||||
TimerFree(xkbi->slowKeysTimer);
|
||||
xkbi->slowKeysTimer= NULL;
|
||||
}
|
||||
if (xkbi->bounceKeysTimer) {
|
||||
TimerFree(xkbi->bounceKeysTimer);
|
||||
xkbi->bounceKeysTimer= NULL;
|
||||
}
|
||||
if (xkbi->repeatKeyTimer) {
|
||||
TimerFree(xkbi->repeatKeyTimer);
|
||||
xkbi->repeatKeyTimer= NULL;
|
||||
}
|
||||
if (xkbi->krgTimer) {
|
||||
TimerFree(xkbi->krgTimer);
|
||||
xkbi->krgTimer= NULL;
|
||||
}
|
||||
xkbi->beepType= _BEEP_NONE;
|
||||
if (xkbi->beepTimer) {
|
||||
TimerFree(xkbi->beepTimer);
|
||||
xkbi->beepTimer= NULL;
|
||||
}
|
||||
if (xkbi->desc) {
|
||||
XkbFreeKeyboard(xkbi->desc,XkbAllComponentsMask,True);
|
||||
xkbi->desc= NULL;
|
||||
}
|
||||
Xfree(xkbi);
|
||||
return;
|
||||
}
|
||||
|
||||
/***====================================================================***/
|
||||
|
||||
extern int XkbDfltRepeatDelay;
|
||||
extern int XkbDfltRepeatInterval;
|
||||
|
||||
extern unsigned short XkbDfltAccessXTimeout;
|
||||
extern unsigned int XkbDfltAccessXTimeoutMask;
|
||||
extern unsigned int XkbDfltAccessXFeedback;
|
||||
extern unsigned char XkbDfltAccessXOptions;
|
||||
|
||||
int
|
||||
#if NeedFunctionPrototypes
|
||||
XkbProcessArguments(int argc,char *argv[],int i)
|
||||
#else
|
||||
XkbProcessArguments(argc,argv,i)
|
||||
int argc;
|
||||
char * argv[];
|
||||
int i;
|
||||
#endif
|
||||
{
|
||||
if (strcmp(argv[i],"-kb")==0) {
|
||||
noXkbExtension= True;
|
||||
return 1;
|
||||
}
|
||||
else if (strcmp(argv[i],"+kb")==0) {
|
||||
noXkbExtension= False;
|
||||
return 1;
|
||||
}
|
||||
else if (strncmp(argv[i], "-xkbmap", 7) == 0) {
|
||||
if(++i < argc) {
|
||||
XkbInitialMap= argv[i];
|
||||
return 2;
|
||||
}
|
||||
else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else if (strncmp(argv[i], "-xkbdb", 7) == 0) {
|
||||
if(++i < argc) {
|
||||
XkbDB= argv[i];
|
||||
return 2;
|
||||
}
|
||||
else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else if (strncmp(argv[i], "-noloadxkb", 7) == 0) {
|
||||
XkbAutoLoad= 0;
|
||||
return 1;
|
||||
}
|
||||
else if ((strncmp(argv[i],"-accessx",8)==0)||
|
||||
(strncmp(argv[i],"+accessx",8)==0)) {
|
||||
int j=1;
|
||||
if (argv[i][0]=='-')
|
||||
XkbWantAccessX= 0;
|
||||
else {
|
||||
XkbWantAccessX= 1;
|
||||
|
||||
if ( ((i+1)<argc) && (isdigit(argv[i+1][0])) ) {
|
||||
XkbDfltAccessXTimeout = atoi(argv[++i]);
|
||||
j++;
|
||||
|
||||
if ( ((i+1)<argc) && (isdigit(argv[i+1][0])) ) {
|
||||
/*
|
||||
* presumption that the reasonably useful range of
|
||||
* values fits in 0..MAXINT since SunOS 4 doesn't
|
||||
* have strtoul.
|
||||
*/
|
||||
XkbDfltAccessXTimeoutMask=(unsigned int)
|
||||
strtol(argv[++i],NULL,16);
|
||||
j++;
|
||||
}
|
||||
if ( ((i+1)<argc) && (isdigit(argv[i+1][0])) ) {
|
||||
if (argv[++i][0] == '1' )
|
||||
XkbDfltAccessXFeedback=XkbAccessXFeedbackMask;
|
||||
else
|
||||
XkbDfltAccessXFeedback=0;
|
||||
j++;
|
||||
}
|
||||
if ( ((i+1)<argc) && (isdigit(argv[i+1][0])) ) {
|
||||
XkbDfltAccessXOptions=(unsigned char)
|
||||
strtol(argv[++i],NULL,16);
|
||||
j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return j;
|
||||
}
|
||||
if (strcmp (argv[i], "-ar1") == 0) { /* -ar1 int */
|
||||
if (++i >= argc) UseMsg ();
|
||||
XkbDfltRepeatDelay = (long)atoi(argv[i]);
|
||||
return 2;
|
||||
}
|
||||
if (strcmp (argv[i], "-ar2") == 0) { /* -ar2 int */
|
||||
if (++i >= argc) UseMsg ();
|
||||
XkbDfltRepeatInterval = (long)atoi(argv[i]);
|
||||
return 2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
#if NeedFunctionPrototypes
|
||||
XkbUseMsg(void)
|
||||
#else
|
||||
XkbUseMsg()
|
||||
#endif
|
||||
{
|
||||
ErrorF("The X Keyboard Extension adds the following arguments:\n");
|
||||
ErrorF("-kb disable the X Keyboard Extension\n");
|
||||
ErrorF("+kb enable the X Keyboard Extension\n");
|
||||
ErrorF("[+-]accessx [ timeout [ timeout_mask [ feedback [ options_mask] ] ] ]\n");
|
||||
ErrorF(" enable/disable accessx key sequences\n");
|
||||
ErrorF("-ar1 set XKB autorepeat delay\n");
|
||||
ErrorF("-ar2 set XKB autorepeat interval\n");
|
||||
ErrorF("-noloadxkb don't load XKB keymap description\n");
|
||||
ErrorF("-xkbcomp default keymap compiler\n");
|
||||
ErrorF("-xkbdb file that contains default XKB keymaps\n");
|
||||
ErrorF("-xkbmap XKB keyboard description to load on startup\n");
|
||||
}
|
||||
1212
xkb/xkbLEDs.c
Normal file
1212
xkb/xkbLEDs.c
Normal file
File diff suppressed because it is too large
Load diff
193
xkb/xkbPrKeyEv.c
Normal file
193
xkb/xkbPrKeyEv.c
Normal file
|
|
@ -0,0 +1,193 @@
|
|||
/* $Xorg: xkbPrKeyEv.c,v 1.3 2000/08/17 19:53:48 cpqbld Exp $ */
|
||||
/************************************************************
|
||||
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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#define NEED_EVENTS 1
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include <X11/keysym.h>
|
||||
#include "misc.h"
|
||||
#include "inputstr.h"
|
||||
#include "XKBsrv.h"
|
||||
#include <ctype.h>
|
||||
|
||||
|
||||
/***====================================================================***/
|
||||
|
||||
void
|
||||
#if NeedFunctionPrototypes
|
||||
XkbProcessKeyboardEvent(xEvent *xE,DeviceIntPtr keybd,int count)
|
||||
#else
|
||||
XkbProcessKeyboardEvent(xE,keybd,count)
|
||||
xEvent * xE;
|
||||
DeviceIntPtr keybd;
|
||||
int count;
|
||||
#endif
|
||||
{
|
||||
KeyClassPtr keyc = keybd->key;
|
||||
XkbSrvInfoPtr xkbi;
|
||||
int key;
|
||||
XkbBehavior behavior;
|
||||
|
||||
xkbi= keyc->xkbInfo;
|
||||
key= xE->u.u.detail;
|
||||
#ifdef DEBUG
|
||||
if (xkbDebugFlags&0x8) {
|
||||
ErrorF("XkbPKE: Key %d %s\n",key,(xE->u.u.type==KeyPress?"down":"up"));
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( (xkbi->repeatKey==key) && (xE->u.u.type==KeyRelease) &&
|
||||
((xkbi->desc->ctrls->enabled_ctrls&XkbRepeatKeysMask)==0) ) {
|
||||
AccessXCancelRepeatKey(xkbi,key);
|
||||
}
|
||||
|
||||
behavior= xkbi->desc->server->behaviors[key];
|
||||
/* The "permanent" flag indicates a hard-wired behavior that occurs */
|
||||
/* below XKB, such as a key that physically locks. XKB does not */
|
||||
/* do anything to implement the behavior, but it *does* report that */
|
||||
/* key is hardwired */
|
||||
if ((behavior.type&XkbKB_Permanent)==0) {
|
||||
switch (behavior.type) {
|
||||
case XkbKB_Default:
|
||||
if (( xE->u.u.type == KeyPress ) &&
|
||||
(keyc->down[key>>3] & (1<<(key&7)))) {
|
||||
XkbLastRepeatEvent= (pointer)xE;
|
||||
xE->u.u.type = KeyRelease;
|
||||
XkbHandleActions(keybd,keybd,xE,count);
|
||||
xE->u.u.type = KeyPress;
|
||||
XkbHandleActions(keybd,keybd,xE,count);
|
||||
XkbLastRepeatEvent= NULL;
|
||||
return;
|
||||
}
|
||||
else if ((xE->u.u.type==KeyRelease) &&
|
||||
(!(keyc->down[key>>3]&(1<<(key&7))))) {
|
||||
XkbLastRepeatEvent= (pointer)&xE;
|
||||
xE->u.u.type = KeyPress;
|
||||
XkbHandleActions(keybd,keybd,xE,count);
|
||||
xE->u.u.type = KeyRelease;
|
||||
XkbHandleActions(keybd,keybd,xE,count);
|
||||
XkbLastRepeatEvent= NULL;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case XkbKB_Lock:
|
||||
if ( xE->u.u.type == KeyRelease )
|
||||
return;
|
||||
else {
|
||||
int bit= 1<<(key&7);
|
||||
if ( keyc->down[key>>3]&bit )
|
||||
xE->u.u.type= KeyRelease;
|
||||
}
|
||||
break;
|
||||
case XkbKB_RadioGroup:
|
||||
if ( xE->u.u.type == KeyRelease )
|
||||
return;
|
||||
else {
|
||||
unsigned ndx= (behavior.data&(~XkbKB_RGAllowNone));
|
||||
if ( ndx<xkbi->nRadioGroups ) {
|
||||
XkbRadioGroupPtr rg;
|
||||
|
||||
rg = &xkbi->radioGroups[ndx];
|
||||
if ( rg->currentDown == xE->u.u.detail ) {
|
||||
if (behavior.data&XkbKB_RGAllowNone) {
|
||||
xE->u.u.type = KeyRelease;
|
||||
XkbHandleActions(keybd,keybd,xE,count);
|
||||
rg->currentDown= 0;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if ( rg->currentDown!=0 ) {
|
||||
int key = xE->u.u.detail;
|
||||
xE->u.u.type= KeyRelease;
|
||||
xE->u.u.detail= rg->currentDown;
|
||||
XkbHandleActions(keybd,keybd,xE,count);
|
||||
xE->u.u.type= KeyPress;
|
||||
xE->u.u.detail= key;
|
||||
}
|
||||
rg->currentDown= key;
|
||||
}
|
||||
else ErrorF("InternalError! Illegal radio group %d\n",ndx);
|
||||
}
|
||||
break;
|
||||
case XkbKB_Overlay1: case XkbKB_Overlay2:
|
||||
{
|
||||
unsigned which;
|
||||
if (behavior.type==XkbKB_Overlay1) which= XkbOverlay1Mask;
|
||||
else which= XkbOverlay2Mask;
|
||||
if ( (xkbi->desc->ctrls->enabled_ctrls&which)==0 )
|
||||
break;
|
||||
if ((behavior.data>=xkbi->desc->min_key_code)&&
|
||||
(behavior.data<=xkbi->desc->max_key_code)) {
|
||||
xE->u.u.detail= behavior.data;
|
||||
/* 9/11/94 (ef) -- XXX! need to match release with */
|
||||
/* press even if the state of the */
|
||||
/* corresponding overlay control */
|
||||
/* changes while the key is down */
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ErrorF("unknown key behavior 0x%04x\n",behavior.type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
XkbHandleActions(keybd,keybd,xE,count);
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
#if NeedFunctionPrototypes
|
||||
ProcessKeyboardEvent(xEvent *xE,DeviceIntPtr keybd,int count)
|
||||
#else
|
||||
ProcessKeyboardEvent(xE,keybd,count)
|
||||
xEvent * xE;
|
||||
DeviceIntPtr keybd;
|
||||
int count;
|
||||
#endif
|
||||
{
|
||||
KeyClassPtr keyc = keybd->key;
|
||||
XkbSrvInfoPtr xkbi;
|
||||
|
||||
xkbi= keyc->xkbInfo;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (xkbDebugFlags&0x8) {
|
||||
int key= xE->u.u.detail;
|
||||
ErrorF("PKE: Key %d %s\n",key,(xE->u.u.type==KeyPress?"down":"up"));
|
||||
}
|
||||
#endif
|
||||
if ((xkbi->desc->ctrls->enabled_ctrls&XkbAllFilteredEventsMask)==0)
|
||||
XkbProcessKeyboardEvent(xE,keybd,count);
|
||||
else if (xE->u.u.type==KeyPress)
|
||||
AccessXFilterPressEvent(xE,keybd,count);
|
||||
else if (xE->u.u.type==KeyRelease)
|
||||
AccessXFilterReleaseEvent(xE,keybd,count);
|
||||
return;
|
||||
}
|
||||
|
||||
88
xkb/xkbPrOtherEv.c
Normal file
88
xkb/xkbPrOtherEv.c
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
/* $Xorg: xkbPrOtherEv.c,v 1.3 2000/08/17 19:53:48 cpqbld Exp $ */
|
||||
/************************************************************
|
||||
Copyright (c) 1995 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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#define NEED_EVENTS 1
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xproto.h>
|
||||
#include <X11/keysym.h>
|
||||
#include "misc.h"
|
||||
#include "inputstr.h"
|
||||
#include "XKBsrv.h"
|
||||
|
||||
#include "XI.h"
|
||||
#include "XIproto.h"
|
||||
|
||||
extern void ProcessOtherEvent(
|
||||
#if NeedFunctionPrototypes
|
||||
xEvent * /* xE */,
|
||||
DeviceIntPtr /* dev */,
|
||||
int /* count */
|
||||
#endif
|
||||
);
|
||||
|
||||
/***====================================================================***/
|
||||
|
||||
void
|
||||
#if NeedFunctionPrototypes
|
||||
XkbProcessOtherEvent(xEvent *xE,DeviceIntPtr dev,int count)
|
||||
#else
|
||||
XkbProcessOtherEvent(xE,dev,count)
|
||||
xEvent * xE;
|
||||
DeviceIntPtr dev;
|
||||
int count;
|
||||
#endif
|
||||
{
|
||||
Bool xkbCares,isBtn;
|
||||
|
||||
xkbCares= True;
|
||||
isBtn= False;
|
||||
switch ( xE->u.u.type ) {
|
||||
case KeyPress: xE->u.u.type= DeviceKeyPress; break;
|
||||
case KeyRelease: xE->u.u.type= DeviceKeyRelease; break;
|
||||
case ButtonPress: xE->u.u.type= DeviceButtonPress;
|
||||
isBtn= True;
|
||||
break;
|
||||
case ButtonRelease: xE->u.u.type= DeviceButtonRelease;
|
||||
isBtn= True;
|
||||
break;
|
||||
default: xkbCares= False; break;
|
||||
}
|
||||
if (xkbCares) {
|
||||
if ((!isBtn)||((dev->button)&&(dev->button->xkb_acts))) {
|
||||
DeviceIntPtr kbd;
|
||||
if (dev->key) kbd= dev;
|
||||
else kbd= (DeviceIntPtr)LookupKeyboardDevice();
|
||||
XkbHandleActions(dev,kbd,xE,count);
|
||||
return;
|
||||
}
|
||||
}
|
||||
ProcessOtherEvent(xE,dev,count);
|
||||
return;
|
||||
}
|
||||
|
||||
759
xkb/xkbSwap.c
Normal file
759
xkb/xkbSwap.c
Normal file
|
|
@ -0,0 +1,759 @@
|
|||
/* $Xorg: xkbSwap.c,v 1.3 2000/08/17 19:53:48 cpqbld Exp $ */
|
||||
/************************************************************
|
||||
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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
#include "stdio.h"
|
||||
#include "X.h"
|
||||
#define NEED_EVENTS
|
||||
#define NEED_REPLIES
|
||||
#include "Xproto.h"
|
||||
#include "misc.h"
|
||||
#include "inputstr.h"
|
||||
#include "XKBsrv.h"
|
||||
#include "XKBstr.h"
|
||||
#include "extnsionst.h"
|
||||
|
||||
#if NeedFunctionPrototypes
|
||||
#define PROC_EXTERN(pfunc) extern int pfunc(ClientPtr)
|
||||
#else
|
||||
#define PROC_EXTERN(pfunc) extern int pfunc()
|
||||
#endif
|
||||
|
||||
PROC_EXTERN(ProcXkbUseExtension);
|
||||
PROC_EXTERN(ProcXkbSelectEvents);
|
||||
PROC_EXTERN(ProcXkbBell);
|
||||
PROC_EXTERN(ProcXkbGetState);
|
||||
PROC_EXTERN(ProcXkbLatchLockState);
|
||||
PROC_EXTERN(ProcXkbGetControls);
|
||||
PROC_EXTERN(ProcXkbSetControls);
|
||||
PROC_EXTERN(ProcXkbGetMap);
|
||||
PROC_EXTERN(ProcXkbSetMap);
|
||||
PROC_EXTERN(ProcXkbGetCompatMap);
|
||||
PROC_EXTERN(ProcXkbSetCompatMap);
|
||||
PROC_EXTERN(ProcXkbGetIndicatorState);
|
||||
PROC_EXTERN(ProcXkbGetIndicatorMap);
|
||||
PROC_EXTERN(ProcXkbSetIndicatorMap);
|
||||
PROC_EXTERN(ProcXkbGetNamedIndicator);
|
||||
PROC_EXTERN(ProcXkbSetNamedIndicator);
|
||||
PROC_EXTERN(ProcXkbGetNames);
|
||||
PROC_EXTERN(ProcXkbSetNames);
|
||||
PROC_EXTERN(ProcXkbGetGeometry);
|
||||
PROC_EXTERN(ProcXkbSetGeometry);
|
||||
PROC_EXTERN(ProcXkbPerClientFlags);
|
||||
PROC_EXTERN(ProcXkbListComponents);
|
||||
PROC_EXTERN(ProcXkbGetKbdByName);
|
||||
PROC_EXTERN(ProcXkbGetDeviceInfo);
|
||||
PROC_EXTERN(ProcXkbSetDeviceInfo);
|
||||
PROC_EXTERN(ProcXkbSetDebuggingFlags);
|
||||
|
||||
/*
|
||||
* REQUEST SWAPPING
|
||||
*/
|
||||
static int
|
||||
#if NeedFunctionPrototypes
|
||||
SProcXkbUseExtension(ClientPtr client)
|
||||
#else
|
||||
SProcXkbUseExtension(client)
|
||||
ClientPtr client;
|
||||
#endif
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xkbUseExtensionReq);
|
||||
|
||||
swaps(&stuff->length,n);
|
||||
REQUEST_SIZE_MATCH(xkbUseExtensionReq);
|
||||
swaps(&stuff->wantedMajor,n);
|
||||
swaps(&stuff->wantedMinor,n);
|
||||
return ProcXkbUseExtension(client);
|
||||
}
|
||||
|
||||
static int
|
||||
#if NeedFunctionPrototypes
|
||||
SProcXkbSelectEvents(ClientPtr client)
|
||||
#else
|
||||
SProcXkbSelectEvents(client)
|
||||
ClientPtr client;
|
||||
#endif
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xkbSelectEventsReq);
|
||||
|
||||
swaps(&stuff->length,n);
|
||||
REQUEST_AT_LEAST_SIZE(xkbSelectEventsReq);
|
||||
swaps(&stuff->deviceSpec,n);
|
||||
swaps(&stuff->affectWhich,n);
|
||||
swaps(&stuff->clear,n);
|
||||
swaps(&stuff->selectAll,n);
|
||||
swaps(&stuff->affectMap,n);
|
||||
swaps(&stuff->map,n);
|
||||
if (stuff->affectWhich&(~XkbMapNotifyMask)!=0) {
|
||||
union {
|
||||
BOOL *b;
|
||||
CARD8 *c8;
|
||||
CARD16 *c16;
|
||||
CARD32 *c32;
|
||||
} from;
|
||||
register unsigned bit,ndx,maskLeft,dataLeft,size;
|
||||
|
||||
from.c8= (CARD8 *)&stuff[1];
|
||||
dataLeft= (stuff->length*4)-SIZEOF(xkbSelectEventsReq);
|
||||
maskLeft= (stuff->affectWhich&(~XkbMapNotifyMask));
|
||||
for (ndx=0,bit=1; (maskLeft!=0); ndx++, bit<<=1) {
|
||||
if (((bit&maskLeft)==0)||(ndx==XkbMapNotify))
|
||||
continue;
|
||||
maskLeft&= ~bit;
|
||||
if ((stuff->selectAll&bit)||(stuff->clear&bit))
|
||||
continue;
|
||||
switch (ndx) {
|
||||
case XkbNewKeyboardNotify:
|
||||
case XkbStateNotify:
|
||||
case XkbNamesNotify:
|
||||
case XkbAccessXNotify:
|
||||
case XkbExtensionDeviceNotify:
|
||||
size= 2;
|
||||
break;
|
||||
case XkbControlsNotify:
|
||||
case XkbIndicatorStateNotify:
|
||||
case XkbIndicatorMapNotify:
|
||||
size= 4;
|
||||
break;
|
||||
case XkbBellNotify:
|
||||
case XkbActionMessage:
|
||||
case XkbCompatMapNotify:
|
||||
size= 1;
|
||||
break;
|
||||
default:
|
||||
client->errorValue = _XkbErrCode2(0x1,bit);
|
||||
return BadValue;
|
||||
}
|
||||
if (dataLeft<(size*2))
|
||||
return BadLength;
|
||||
if (size==2) {
|
||||
swaps(&from.c16[0],n);
|
||||
swaps(&from.c16[1],n);
|
||||
}
|
||||
else if (size==4) {
|
||||
swapl(from.c32[0],n);
|
||||
swapl(from.c32[1],n);
|
||||
}
|
||||
else {
|
||||
size= 2;
|
||||
}
|
||||
from.c8+= (size*2);
|
||||
dataLeft-= (size*2);
|
||||
}
|
||||
if (dataLeft>2) {
|
||||
ErrorF("Extra data (%d bytes) after SelectEvents\n",dataLeft);
|
||||
return BadLength;
|
||||
}
|
||||
}
|
||||
return ProcXkbSelectEvents(client);
|
||||
}
|
||||
|
||||
static int
|
||||
#if NeedFunctionPrototypes
|
||||
SProcXkbBell(ClientPtr client)
|
||||
#else
|
||||
SProcXkbBell(client)
|
||||
ClientPtr client;
|
||||
#endif
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xkbBellReq);
|
||||
|
||||
swaps(&stuff->length,n);
|
||||
REQUEST_SIZE_MATCH(xkbBellReq);
|
||||
swaps(&stuff->deviceSpec,n);
|
||||
swaps(&stuff->bellClass,n);
|
||||
swaps(&stuff->bellID,n);
|
||||
swapl(&stuff->name,n);
|
||||
swapl(&stuff->window,n);
|
||||
swaps(&stuff->pitch,n);
|
||||
swaps(&stuff->duration,n);
|
||||
return ProcXkbBell(client);
|
||||
}
|
||||
|
||||
static int
|
||||
#if NeedFunctionPrototypes
|
||||
SProcXkbGetState(ClientPtr client)
|
||||
#else
|
||||
SProcXkbGetState(client)
|
||||
ClientPtr client;
|
||||
#endif
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xkbGetStateReq);
|
||||
|
||||
swaps(&stuff->length,n);
|
||||
REQUEST_SIZE_MATCH(xkbGetStateReq);
|
||||
swaps(&stuff->deviceSpec,n);
|
||||
return ProcXkbGetState(client);
|
||||
}
|
||||
|
||||
static int
|
||||
#if NeedFunctionPrototypes
|
||||
SProcXkbLatchLockState(ClientPtr client)
|
||||
#else
|
||||
SProcXkbLatchLockState(client)
|
||||
ClientPtr client;
|
||||
#endif
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xkbLatchLockStateReq);
|
||||
|
||||
swaps(&stuff->length,n);
|
||||
REQUEST_SIZE_MATCH(xkbLatchLockStateReq);
|
||||
swaps(&stuff->deviceSpec,n);
|
||||
swaps(&stuff->groupLatch,n);
|
||||
return ProcXkbLatchLockState(client);
|
||||
}
|
||||
|
||||
static int
|
||||
#if NeedFunctionPrototypes
|
||||
SProcXkbGetControls(ClientPtr client)
|
||||
#else
|
||||
SProcXkbGetControls(client)
|
||||
ClientPtr client;
|
||||
#endif
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xkbGetControlsReq);
|
||||
|
||||
swaps(&stuff->length,n);
|
||||
REQUEST_SIZE_MATCH(xkbGetControlsReq);
|
||||
swaps(&stuff->deviceSpec,n);
|
||||
return ProcXkbGetControls(client);
|
||||
}
|
||||
|
||||
static int
|
||||
#if NeedFunctionPrototypes
|
||||
SProcXkbSetControls(ClientPtr client)
|
||||
#else
|
||||
SProcXkbSetControls(client)
|
||||
ClientPtr client;
|
||||
#endif
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xkbSetControlsReq);
|
||||
|
||||
swaps(&stuff->length,n);
|
||||
REQUEST_SIZE_MATCH(xkbSetControlsReq);
|
||||
swaps(&stuff->deviceSpec,n);
|
||||
swaps(&stuff->affectInternalVMods,n);
|
||||
swaps(&stuff->internalVMods,n);
|
||||
swaps(&stuff->affectIgnoreLockVMods,n);
|
||||
swaps(&stuff->ignoreLockVMods,n);
|
||||
swaps(&stuff->axOptions,n);
|
||||
swapl(&stuff->affectEnabledCtrls,n);
|
||||
swapl(&stuff->enabledCtrls,n);
|
||||
swapl(&stuff->changeCtrls,n);
|
||||
swaps(&stuff->repeatDelay,n);
|
||||
swaps(&stuff->repeatInterval,n);
|
||||
swaps(&stuff->slowKeysDelay,n);
|
||||
swaps(&stuff->debounceDelay,n);
|
||||
swaps(&stuff->mkDelay,n);
|
||||
swaps(&stuff->mkInterval,n);
|
||||
swaps(&stuff->mkTimeToMax,n);
|
||||
swaps(&stuff->mkMaxSpeed,n);
|
||||
swaps(&stuff->mkCurve,n);
|
||||
swaps(&stuff->axTimeout,n);
|
||||
swapl(&stuff->axtCtrlsMask,n);
|
||||
swapl(&stuff->axtCtrlsValues,n);
|
||||
swaps(&stuff->axtOptsMask,n);
|
||||
swaps(&stuff->axtOptsValues,n);
|
||||
return ProcXkbSetControls(client);
|
||||
}
|
||||
|
||||
static int
|
||||
#if NeedFunctionPrototypes
|
||||
SProcXkbGetMap(ClientPtr client)
|
||||
#else
|
||||
SProcXkbGetMap(client)
|
||||
ClientPtr client;
|
||||
#endif
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xkbGetMapReq);
|
||||
|
||||
swaps(&stuff->length,n);
|
||||
REQUEST_SIZE_MATCH(xkbGetMapReq);
|
||||
swaps(&stuff->deviceSpec,n);
|
||||
swaps(&stuff->full,n);
|
||||
swaps(&stuff->partial,n);
|
||||
swaps(&stuff->virtualMods,n);
|
||||
return ProcXkbGetMap(client);
|
||||
}
|
||||
|
||||
static int
|
||||
#if NeedFunctionPrototypes
|
||||
SProcXkbSetMap(ClientPtr client)
|
||||
#else
|
||||
SProcXkbSetMap(client)
|
||||
ClientPtr client;
|
||||
#endif
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xkbSetMapReq);
|
||||
|
||||
swaps(&stuff->length,n);
|
||||
REQUEST_AT_LEAST_SIZE(xkbSetMapReq);
|
||||
swaps(&stuff->deviceSpec,n);
|
||||
swaps(&stuff->present,n);
|
||||
swaps(&stuff->flags,n);
|
||||
swaps(&stuff->totalSyms,n);
|
||||
swaps(&stuff->totalActs,n);
|
||||
swaps(&stuff->virtualMods,n);
|
||||
return ProcXkbSetMap(client);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
#if NeedFunctionPrototypes
|
||||
SProcXkbGetCompatMap(ClientPtr client)
|
||||
#else
|
||||
SProcXkbGetCompatMap(client)
|
||||
ClientPtr client;
|
||||
#endif
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xkbGetCompatMapReq);
|
||||
|
||||
swaps(&stuff->length,n);
|
||||
REQUEST_SIZE_MATCH(xkbGetCompatMapReq);
|
||||
swaps(&stuff->deviceSpec,n);
|
||||
swaps(&stuff->firstSI,n);
|
||||
swaps(&stuff->nSI,n);
|
||||
return ProcXkbGetCompatMap(client);
|
||||
}
|
||||
|
||||
static int
|
||||
#if NeedFunctionPrototypes
|
||||
SProcXkbSetCompatMap(ClientPtr client)
|
||||
#else
|
||||
SProcXkbSetCompatMap(client)
|
||||
ClientPtr client;
|
||||
#endif
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xkbSetCompatMapReq);
|
||||
|
||||
swaps(&stuff->length,n);
|
||||
REQUEST_AT_LEAST_SIZE(xkbSetCompatMapReq);
|
||||
swaps(&stuff->deviceSpec,n);
|
||||
swaps(&stuff->firstSI,n);
|
||||
swaps(&stuff->nSI,n);
|
||||
return ProcXkbSetCompatMap(client);
|
||||
}
|
||||
|
||||
static int
|
||||
#if NeedFunctionPrototypes
|
||||
SProcXkbGetIndicatorState(ClientPtr client)
|
||||
#else
|
||||
SProcXkbGetIndicatorState(client)
|
||||
ClientPtr client;
|
||||
#endif
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xkbGetIndicatorStateReq);
|
||||
|
||||
swaps(&stuff->length,n);
|
||||
REQUEST_SIZE_MATCH(xkbGetIndicatorStateReq);
|
||||
swaps(&stuff->deviceSpec,n);
|
||||
return ProcXkbGetIndicatorState(client);
|
||||
}
|
||||
|
||||
static int
|
||||
#if NeedFunctionPrototypes
|
||||
SProcXkbGetIndicatorMap(ClientPtr client)
|
||||
#else
|
||||
SProcXkbGetIndicatorMap(client)
|
||||
ClientPtr client;
|
||||
#endif
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xkbGetIndicatorMapReq);
|
||||
|
||||
swaps(&stuff->length,n);
|
||||
REQUEST_SIZE_MATCH(xkbGetIndicatorMapReq);
|
||||
swaps(&stuff->deviceSpec,n);
|
||||
swapl(&stuff->which,n);
|
||||
return ProcXkbGetIndicatorMap(client);
|
||||
}
|
||||
|
||||
static int
|
||||
#if NeedFunctionPrototypes
|
||||
SProcXkbSetIndicatorMap(ClientPtr client)
|
||||
#else
|
||||
SProcXkbSetIndicatorMap(client)
|
||||
ClientPtr client;
|
||||
#endif
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xkbSetIndicatorMapReq);
|
||||
|
||||
swaps(&stuff->length,n);
|
||||
REQUEST_AT_LEAST_SIZE(xkbSetIndicatorMapReq);
|
||||
swaps(&stuff->deviceSpec,n);
|
||||
swapl(&stuff->which,n);
|
||||
return ProcXkbSetIndicatorMap(client);
|
||||
}
|
||||
|
||||
static int
|
||||
#if NeedFunctionPrototypes
|
||||
SProcXkbGetNamedIndicator(ClientPtr client)
|
||||
#else
|
||||
SProcXkbGetNamedIndicator(client)
|
||||
ClientPtr client;
|
||||
#endif
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xkbGetNamedIndicatorReq);
|
||||
|
||||
swaps(&stuff->length,n);
|
||||
REQUEST_SIZE_MATCH(xkbGetNamedIndicatorReq);
|
||||
swaps(&stuff->deviceSpec,n);
|
||||
swaps(&stuff->ledClass,n);
|
||||
swaps(&stuff->ledID,n);
|
||||
swapl(&stuff->indicator,n);
|
||||
return ProcXkbGetNamedIndicator(client);
|
||||
}
|
||||
|
||||
static int
|
||||
#if NeedFunctionPrototypes
|
||||
SProcXkbSetNamedIndicator(ClientPtr client)
|
||||
#else
|
||||
SProcXkbSetNamedIndicator(client)
|
||||
ClientPtr client;
|
||||
#endif
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xkbSetNamedIndicatorReq);
|
||||
|
||||
swaps(&stuff->length,n);
|
||||
REQUEST_SIZE_MATCH(xkbSetNamedIndicatorReq);
|
||||
swaps(&stuff->deviceSpec,n);
|
||||
swaps(&stuff->ledClass,n);
|
||||
swaps(&stuff->ledID,n);
|
||||
swapl(&stuff->indicator,n);
|
||||
swaps(&stuff->virtualMods,n);
|
||||
swapl(&stuff->ctrls,n);
|
||||
return ProcXkbSetNamedIndicator(client);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
#if NeedFunctionPrototypes
|
||||
SProcXkbGetNames(ClientPtr client)
|
||||
#else
|
||||
SProcXkbGetNames(client)
|
||||
ClientPtr client;
|
||||
#endif
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xkbGetNamesReq);
|
||||
|
||||
swaps(&stuff->length,n);
|
||||
REQUEST_SIZE_MATCH(xkbGetNamesReq);
|
||||
swaps(&stuff->deviceSpec,n);
|
||||
swapl(&stuff->which,n);
|
||||
return ProcXkbGetNames(client);
|
||||
}
|
||||
|
||||
static int
|
||||
#if NeedFunctionPrototypes
|
||||
SProcXkbSetNames(ClientPtr client)
|
||||
#else
|
||||
SProcXkbSetNames(client)
|
||||
ClientPtr client;
|
||||
#endif
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xkbSetNamesReq);
|
||||
|
||||
swaps(&stuff->length,n);
|
||||
REQUEST_AT_LEAST_SIZE(xkbSetNamesReq);
|
||||
swaps(&stuff->deviceSpec,n);
|
||||
swaps(&stuff->virtualMods,n);
|
||||
swapl(&stuff->which,n);
|
||||
swapl(&stuff->indicators,n);
|
||||
swaps(&stuff->totalKTLevelNames,n);
|
||||
return ProcXkbSetNames(client);
|
||||
}
|
||||
|
||||
static int
|
||||
#if NeedFunctionPrototypes
|
||||
SProcXkbGetGeometry(ClientPtr client)
|
||||
#else
|
||||
SProcXkbGetGeometry(client)
|
||||
ClientPtr client;
|
||||
#endif
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xkbGetGeometryReq);
|
||||
|
||||
swaps(&stuff->length,n);
|
||||
REQUEST_SIZE_MATCH(xkbGetGeometryReq);
|
||||
swaps(&stuff->deviceSpec,n);
|
||||
swapl(&stuff->name,n);
|
||||
return ProcXkbGetGeometry(client);
|
||||
}
|
||||
|
||||
static int
|
||||
#if NeedFunctionPrototypes
|
||||
SProcXkbSetGeometry(ClientPtr client)
|
||||
#else
|
||||
SProcXkbSetGeometry(client)
|
||||
ClientPtr client;
|
||||
#endif
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xkbSetGeometryReq);
|
||||
|
||||
swaps(&stuff->length,n);
|
||||
REQUEST_AT_LEAST_SIZE(xkbSetGeometryReq);
|
||||
swaps(&stuff->deviceSpec,n);
|
||||
swapl(&stuff->name,n);
|
||||
swaps(&stuff->widthMM,n);
|
||||
swaps(&stuff->heightMM,n);
|
||||
swaps(&stuff->nProperties,n);
|
||||
swaps(&stuff->nColors,n);
|
||||
swaps(&stuff->nDoodads,n);
|
||||
swaps(&stuff->nKeyAliases,n);
|
||||
return ProcXkbSetGeometry(client);
|
||||
}
|
||||
|
||||
static int
|
||||
#if NeedFunctionPrototypes
|
||||
SProcXkbPerClientFlags(ClientPtr client)
|
||||
#else
|
||||
SProcXkbPerClientFlags(client)
|
||||
ClientPtr client;
|
||||
#endif
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xkbPerClientFlagsReq);
|
||||
|
||||
swaps(&stuff->length,n);
|
||||
REQUEST_SIZE_MATCH(xkbPerClientFlagsReq);
|
||||
swaps(&stuff->deviceSpec,n);
|
||||
swapl(&stuff->change,n);
|
||||
swapl(&stuff->value,n);
|
||||
swapl(&stuff->ctrlsToChange,n);
|
||||
swapl(&stuff->autoCtrls,n);
|
||||
swapl(&stuff->autoCtrlValues,n);
|
||||
return ProcXkbPerClientFlags(client);
|
||||
}
|
||||
|
||||
static int
|
||||
#if NeedFunctionPrototypes
|
||||
SProcXkbListComponents(ClientPtr client)
|
||||
#else
|
||||
SProcXkbListComponents(client)
|
||||
ClientPtr client;
|
||||
#endif
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xkbListComponentsReq);
|
||||
|
||||
swaps(&stuff->length,n);
|
||||
REQUEST_AT_LEAST_SIZE(xkbListComponentsReq);
|
||||
swaps(&stuff->deviceSpec,n);
|
||||
swaps(&stuff->maxNames,n);
|
||||
return ProcXkbListComponents(client);
|
||||
}
|
||||
|
||||
static int
|
||||
#if NeedFunctionPrototypes
|
||||
SProcXkbGetKbdByName(ClientPtr client)
|
||||
#else
|
||||
SProcXkbGetKbdByName(client)
|
||||
ClientPtr client;
|
||||
#endif
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xkbGetKbdByNameReq);
|
||||
|
||||
swaps(&stuff->length,n);
|
||||
REQUEST_AT_LEAST_SIZE(xkbGetKbdByNameReq);
|
||||
swaps(&stuff->deviceSpec,n);
|
||||
swaps(&stuff->want,n);
|
||||
swaps(&stuff->need,n);
|
||||
return ProcXkbGetKbdByName(client);
|
||||
}
|
||||
|
||||
static int
|
||||
#if NeedFunctionPrototypes
|
||||
SProcXkbGetDeviceInfo(ClientPtr client)
|
||||
#else
|
||||
SProcXkbGetDeviceInfo(client)
|
||||
ClientPtr client;
|
||||
#endif
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xkbGetDeviceInfoReq);
|
||||
|
||||
swaps(&stuff->length,n);
|
||||
REQUEST_SIZE_MATCH(xkbGetDeviceInfoReq);
|
||||
swaps(&stuff->deviceSpec,n);
|
||||
swaps(&stuff->wanted,n);
|
||||
swaps(&stuff->ledClass,n);
|
||||
swaps(&stuff->ledID,n);
|
||||
return ProcXkbGetDeviceInfo(client);
|
||||
}
|
||||
|
||||
static int
|
||||
#if NeedFunctionPrototypes
|
||||
SProcXkbSetDeviceInfo(ClientPtr client)
|
||||
#else
|
||||
SProcXkbSetDeviceInfo(client)
|
||||
ClientPtr client;
|
||||
#endif
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xkbSetDeviceInfoReq);
|
||||
|
||||
swaps(&stuff->length,n);
|
||||
REQUEST_AT_LEAST_SIZE(xkbSetDeviceInfoReq);
|
||||
swaps(&stuff->deviceSpec,n);
|
||||
swaps(&stuff->change,n);
|
||||
swaps(&stuff->nDeviceLedFBs,n);
|
||||
return ProcXkbSetDeviceInfo(client);
|
||||
}
|
||||
|
||||
static int
|
||||
#if NeedFunctionPrototypes
|
||||
SProcXkbSetDebuggingFlags(ClientPtr client)
|
||||
#else
|
||||
SProcXkbSetDebuggingFlags(client)
|
||||
ClientPtr client;
|
||||
#endif
|
||||
{
|
||||
register int n;
|
||||
|
||||
REQUEST(xkbSetDebuggingFlagsReq);
|
||||
|
||||
swaps(&stuff->length,n);
|
||||
REQUEST_AT_LEAST_SIZE(xkbSetDebuggingFlagsReq);
|
||||
swapl(&stuff->affectFlags,n);
|
||||
swapl(&stuff->flags,n);
|
||||
swapl(&stuff->affectCtrls,n);
|
||||
swapl(&stuff->ctrls,n);
|
||||
swaps(&stuff->msgLength,n);
|
||||
return ProcXkbSetDebuggingFlags(client);
|
||||
}
|
||||
|
||||
int
|
||||
#if NeedFunctionPrototypes
|
||||
SProcXkbDispatch (ClientPtr client)
|
||||
#else
|
||||
SProcXkbDispatch (client)
|
||||
ClientPtr client;
|
||||
#endif
|
||||
{
|
||||
REQUEST(xReq);
|
||||
switch (stuff->data)
|
||||
{
|
||||
case X_kbUseExtension:
|
||||
return SProcXkbUseExtension(client);
|
||||
case X_kbSelectEvents:
|
||||
return SProcXkbSelectEvents(client);
|
||||
case X_kbBell:
|
||||
return SProcXkbBell(client);
|
||||
case X_kbGetState:
|
||||
return SProcXkbGetState(client);
|
||||
case X_kbLatchLockState:
|
||||
return SProcXkbLatchLockState(client);
|
||||
case X_kbGetControls:
|
||||
return SProcXkbGetControls(client);
|
||||
case X_kbSetControls:
|
||||
return SProcXkbSetControls(client);
|
||||
case X_kbGetMap:
|
||||
return SProcXkbGetMap(client);
|
||||
case X_kbSetMap:
|
||||
return SProcXkbSetMap(client);
|
||||
case X_kbGetCompatMap:
|
||||
return SProcXkbGetCompatMap(client);
|
||||
case X_kbSetCompatMap:
|
||||
return SProcXkbSetCompatMap(client);
|
||||
case X_kbGetIndicatorState:
|
||||
return SProcXkbGetIndicatorState(client);
|
||||
case X_kbGetIndicatorMap:
|
||||
return SProcXkbGetIndicatorMap(client);
|
||||
case X_kbSetIndicatorMap:
|
||||
return SProcXkbSetIndicatorMap(client);
|
||||
case X_kbGetNamedIndicator:
|
||||
return SProcXkbGetNamedIndicator(client);
|
||||
case X_kbSetNamedIndicator:
|
||||
return SProcXkbSetNamedIndicator(client);
|
||||
case X_kbGetNames:
|
||||
return SProcXkbGetNames(client);
|
||||
case X_kbSetNames:
|
||||
return SProcXkbSetNames(client);
|
||||
case X_kbGetGeometry:
|
||||
return SProcXkbGetGeometry(client);
|
||||
case X_kbSetGeometry:
|
||||
return SProcXkbSetGeometry(client);
|
||||
case X_kbPerClientFlags:
|
||||
return SProcXkbPerClientFlags(client);
|
||||
case X_kbListComponents:
|
||||
return SProcXkbListComponents(client);
|
||||
case X_kbGetKbdByName:
|
||||
return SProcXkbGetKbdByName(client);
|
||||
case X_kbGetDeviceInfo:
|
||||
return SProcXkbGetDeviceInfo(client);
|
||||
case X_kbSetDeviceInfo:
|
||||
return SProcXkbSetDeviceInfo(client);
|
||||
case X_kbSetDebuggingFlags:
|
||||
return SProcXkbSetDebuggingFlags(client);
|
||||
default:
|
||||
return BadRequest;
|
||||
}
|
||||
}
|
||||
1141
xkb/xkbUtils.c
Normal file
1141
xkb/xkbUtils.c
Normal file
File diff suppressed because it is too large
Load diff
1394
xkb/xkbconfig.c
Normal file
1394
xkb/xkbconfig.c
Normal file
File diff suppressed because it is too large
Load diff
70
xkb/xkberrs.c
Normal file
70
xkb/xkberrs.c
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
/* $Xorg: xkberrs.c,v 1.3 2000/08/17 19:46:44 cpqbld Exp $ */
|
||||
/************************************************************
|
||||
Copyright (c) 1994 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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#ifndef X_NOT_STDC_ENV
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/XKBlib.h>
|
||||
#include <X11/extensions/XKBfile.h>
|
||||
|
||||
char * _XkbErrMessages[] = {
|
||||
"success", /* _XkbSuccess */
|
||||
"key names not defined", /* _XkbErrMissingNames */
|
||||
"key types not defined", /* _XkbErrMissingTypes */
|
||||
"required key types not present", /* _XkbErrMissingReqTypes */
|
||||
"symbols not defined", /* _XkbErrMissingSymbols */
|
||||
"virtual modifier bindings not defined",/* _XkbErrMissingVMods */
|
||||
"indicators not defined", /* _XkbErrMissingIndicators */
|
||||
"compatibility map not defined", /* _XkbErrMissingCompatMap */
|
||||
"symbol interpretations not defined", /* _XkbErrMissingSymInterps */
|
||||
"geometry not defined", /* _XkbErrMissingGeometry */
|
||||
"illegal doodad type", /* _XkbErrIllegalDoodad */
|
||||
"illegal TOC type", /* _XkbErrIllegalTOCType */
|
||||
"illegal contents", /* _XkbErrIllegalContents */
|
||||
"empty file", /* _XkbErrEmptyFile */
|
||||
"file not found", /* _XkbErrFileNotFound */
|
||||
"cannot open", /* _XkbErrFileCannotOpen */
|
||||
"bad value", /* _XkbErrBadValue */
|
||||
"bad match", /* _XkbErrBadMatch */
|
||||
"illegal name for type", /* _XkbErrBadTypeName */
|
||||
"illegal width for type", /* _XkbErrBadTypeWidth */
|
||||
"bad file type", /* _XkbErrBadFileType */
|
||||
"bad file version", /* _XkbErrBadFileVersion */
|
||||
"error in Xkm file", /* _XkbErrBadFileFormat */
|
||||
"allocation failed", /* _XkbErrBadAlloc */
|
||||
"bad length", /* _XkbErrBadLength */
|
||||
"X request failed", /* _XkbErrXReqFailure */
|
||||
"not implemented" /* _XkbErrBadImplementation */
|
||||
};
|
||||
|
||||
unsigned _XkbErrCode;
|
||||
char * _XkbErrLocation= NULL;
|
||||
unsigned _XkbErrData;
|
||||
|
||||
716
xkb/xkbfmisc.c
Normal file
716
xkb/xkbfmisc.c
Normal file
|
|
@ -0,0 +1,716 @@
|
|||
/* $Xorg: xkbmisc.c,v 1.4 2000/08/17 19:46:44 cpqbld Exp $ */
|
||||
/************************************************************
|
||||
Copyright (c) 1995 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.
|
||||
|
||||
********************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#ifndef X_NOT_STDC_ENV
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#define XK_CYRILLIC
|
||||
|
||||
#include <X11/Xos.h>
|
||||
#include <X11/Xfuncs.h>
|
||||
|
||||
#ifndef XKB_IN_SERVER
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/keysym.h>
|
||||
#include <X11/XKBlib.h>
|
||||
#include <X11/extensions/XKBgeom.h>
|
||||
#include "XKMformat.h"
|
||||
#include "XKBfileInt.h"
|
||||
|
||||
#else
|
||||
|
||||
#include "X.h"
|
||||
#define NEED_EVENTS
|
||||
#include <X11/keysym.h>
|
||||
#include "Xproto.h"
|
||||
#include "misc.h"
|
||||
#include "inputstr.h"
|
||||
#include "dix.h"
|
||||
#include "XKBstr.h"
|
||||
#define XKBSRV_NEED_FILE_FUNCS 1
|
||||
#include "XKBsrv.h"
|
||||
#include <X11/extensions/XKBgeom.h>
|
||||
|
||||
#endif
|
||||
|
||||
unsigned
|
||||
#if NeedFunctionPrototypes
|
||||
_XkbKSCheckCase(KeySym ks)
|
||||
#else
|
||||
_XkbKSCheckCase(ks)
|
||||
KeySym ks;
|
||||
#endif
|
||||
{
|
||||
unsigned set,rtrn;
|
||||
unsigned char ch;
|
||||
|
||||
set= (ks & (~0xff));
|
||||
ch= (char)(ks&0xff);
|
||||
rtrn= 0;
|
||||
switch (set) {
|
||||
case 0: /* latin 1 */
|
||||
if (((ch>=XK_A)&&(ch<=XK_Z))||
|
||||
((ch>=XK_Agrave)&&(ch<=XK_THORN)&&(ch!=XK_multiply))) {
|
||||
rtrn|= _XkbKSUpper;
|
||||
}
|
||||
if (((ch>=XK_a)&&(ch<=XK_z))||
|
||||
((ch>=XK_agrave)&&(ch<=XK_ydiaeresis))) {
|
||||
rtrn|= _XkbKSLower;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return rtrn;
|
||||
}
|
||||
|
||||
/***===================================================================***/
|
||||
|
||||
int
|
||||
#if NeedFunctionPrototypes
|
||||
_XkbStrCaseCmp(char *str1,char *str2)
|
||||
#else
|
||||
_XkbStrCaseCmp(str1,str2)
|
||||
char * str1;
|
||||
char * str2;
|
||||
#endif
|
||||
{
|
||||
char buf1[512],buf2[512];
|
||||
char c, *s;
|
||||
register int n;
|
||||
|
||||
for (n=0, s = buf1; (c = *str1++); n++) {
|
||||
if (isupper(c))
|
||||
c = tolower(c);
|
||||
if (n>510)
|
||||
break;
|
||||
*s++ = c;
|
||||
}
|
||||
*s = '\0';
|
||||
for (n=0, s = buf2; (c = *str2++); n++) {
|
||||
if (isupper(c))
|
||||
c = tolower(c);
|
||||
if (n>510)
|
||||
break;
|
||||
*s++ = c;
|
||||
}
|
||||
*s = '\0';
|
||||
return (strcmp(buf1, buf2));
|
||||
}
|
||||
|
||||
/***===================================================================***/
|
||||
|
||||
Bool
|
||||
#if NeedFunctionPrototypes
|
||||
XkbLookupGroupAndLevel( XkbDescPtr xkb,
|
||||
int key,
|
||||
int * mods_inout,
|
||||
int * grp_inout,
|
||||
int * lvl_rtrn)
|
||||
#else
|
||||
XkbLookupGroupAndLevel(xkb,key,mods_inout,grp_inout,lvl_rtrn)
|
||||
XkbDescPtr xkb;
|
||||
int key;
|
||||
int * mods_inout;
|
||||
int * grp_inout;
|
||||
int * lvl_rtrn;
|
||||
#endif
|
||||
{
|
||||
int nG,eG;
|
||||
|
||||
if ((!xkb)||(!XkbKeycodeInRange(xkb,key))||(!grp_inout))
|
||||
return False;
|
||||
|
||||
nG= XkbKeyNumGroups(xkb,key);
|
||||
eG= *grp_inout;
|
||||
|
||||
if ( nG==0 ) {
|
||||
*grp_inout= 0;
|
||||
if (lvl_rtrn!=NULL)
|
||||
*lvl_rtrn= 0;
|
||||
return False;
|
||||
}
|
||||
else if ( nG==1 ) {
|
||||
eG= 0;
|
||||
}
|
||||
else if ( eG>=nG ) {
|
||||
unsigned gI= XkbKeyGroupInfo(xkb,key);
|
||||
switch (XkbOutOfRangeGroupAction(gI)) {
|
||||
default:
|
||||
eG %= nG;
|
||||
break;
|
||||
case XkbClampIntoRange:
|
||||
eG = nG-1;
|
||||
break;
|
||||
case XkbRedirectIntoRange:
|
||||
eG = XkbOutOfRangeGroupNumber(gI);
|
||||
if (eG>=nG)
|
||||
eG= 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
*grp_inout= eG;
|
||||
if (mods_inout!=NULL) {
|
||||
XkbKeyTypePtr type;
|
||||
int preserve;
|
||||
|
||||
type = XkbKeyKeyType(xkb,key,eG);
|
||||
if (lvl_rtrn!=NULL)
|
||||
*lvl_rtrn= 0;
|
||||
preserve= 0;
|
||||
if (type->map) { /* find the shift level */
|
||||
register int i;
|
||||
register XkbKTMapEntryPtr entry;
|
||||
for (i=0,entry=type->map;i<type->map_count;i++,entry++) {
|
||||
if ((entry->active)&&
|
||||
(((*mods_inout)&type->mods.mask)==entry->mods.mask)){
|
||||
if (lvl_rtrn!=NULL)
|
||||
*lvl_rtrn= entry->level;
|
||||
if (type->preserve)
|
||||
preserve= type->preserve[i].mask;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
(*mods_inout)&= ~(type->mods.mask&(~preserve));
|
||||
}
|
||||
return True;
|
||||
}
|
||||
|
||||
/***===================================================================***/
|
||||
|
||||
static Bool
|
||||
#if NeedFunctionPrototypes
|
||||
XkbWriteSectionFromName(FILE *file,char *sectionName,char *name)
|
||||
#else
|
||||
XkbWriteSectionFromName(file,sectionName,name)
|
||||
FILE * file;
|
||||
char * sectionName;
|
||||
char * name;
|
||||
#endif
|
||||
{
|
||||
fprintf(file," xkb_%-20s { include \"%s\" };\n",sectionName,name);
|
||||
return True;
|
||||
}
|
||||
|
||||
#define NEED_DESC(n) ((!n)||((n)[0]=='+')||((n)[0]=='|')||(strchr((n),'%')))
|
||||
#define COMPLETE(n) ((n)&&(!NEED_DESC(n)))
|
||||
|
||||
/* ARGSUSED */
|
||||
static void
|
||||
#if NeedFunctionPrototypes
|
||||
_AddIncl( FILE * file,
|
||||
XkbFileInfo * result,
|
||||
Bool topLevel,
|
||||
Bool showImplicit,
|
||||
int index,
|
||||
void * priv)
|
||||
#else
|
||||
_AddIncl(file,result,topLevel,showImplicit,index,priv)
|
||||
FILE * file;
|
||||
XkbFileInfo * result;
|
||||
Bool topLevel;
|
||||
Bool showImplicit;
|
||||
int index;
|
||||
void * priv;
|
||||
#endif
|
||||
{
|
||||
if ((priv)&&(strcmp(priv,"%")!=0))
|
||||
fprintf(file," include \"%s\"\n",(char *)priv);
|
||||
return;
|
||||
}
|
||||
|
||||
Bool
|
||||
#if NeedFunctionPrototypes
|
||||
XkbWriteXKBKeymapForNames( FILE * file,
|
||||
XkbComponentNamesPtr names,
|
||||
Display * dpy,
|
||||
XkbDescPtr xkb,
|
||||
unsigned want,
|
||||
unsigned need)
|
||||
#else
|
||||
XkbWriteXKBKeymapForNames(file,names,dpy,xkb,want,need)
|
||||
FILE * file;
|
||||
XkbComponentNamesPtr names;
|
||||
Display * dpy;
|
||||
XkbDescPtr xkb;
|
||||
unsigned want;
|
||||
unsigned need;
|
||||
#endif
|
||||
{
|
||||
char * name,*tmp;
|
||||
unsigned complete;
|
||||
XkbNamesPtr old_names;
|
||||
int multi_section;
|
||||
unsigned wantNames,wantConfig,wantDflts;
|
||||
XkbFileInfo finfo;
|
||||
|
||||
bzero(&finfo,sizeof(XkbFileInfo));
|
||||
|
||||
complete= 0;
|
||||
if ((name=names->keymap)==NULL) name= "default";
|
||||
if (COMPLETE(names->keycodes)) complete|= XkmKeyNamesMask;
|
||||
if (COMPLETE(names->types)) complete|= XkmTypesMask;
|
||||
if (COMPLETE(names->compat)) complete|= XkmCompatMapMask;
|
||||
if (COMPLETE(names->symbols)) complete|= XkmSymbolsMask;
|
||||
if (COMPLETE(names->geometry)) complete|= XkmGeometryMask;
|
||||
want|= (complete|need);
|
||||
if (want&XkmSymbolsMask)
|
||||
want|= XkmKeyNamesMask|XkmTypesMask;
|
||||
|
||||
if (want==0)
|
||||
return False;
|
||||
|
||||
if (xkb!=NULL) {
|
||||
old_names= xkb->names;
|
||||
finfo.type= 0;
|
||||
finfo.defined= 0;
|
||||
finfo.xkb= xkb;
|
||||
if (!XkbDetermineFileType(&finfo,XkbXKBFile,NULL))
|
||||
return False;
|
||||
}
|
||||
else old_names= NULL;
|
||||
|
||||
wantConfig= want&(~complete);
|
||||
if (xkb!=NULL) {
|
||||
if (wantConfig&XkmTypesMask) {
|
||||
if ((!xkb->map) || (xkb->map->num_types<XkbNumRequiredTypes))
|
||||
wantConfig&= ~XkmTypesMask;
|
||||
}
|
||||
if (wantConfig&XkmCompatMapMask) {
|
||||
if ((!xkb->compat) || (xkb->compat->num_si<1))
|
||||
wantConfig&= ~XkmCompatMapMask;
|
||||
}
|
||||
if (wantConfig&XkmSymbolsMask) {
|
||||
if ((!xkb->map) || (!xkb->map->key_sym_map))
|
||||
wantConfig&= ~XkmSymbolsMask;
|
||||
}
|
||||
if (wantConfig&XkmIndicatorsMask) {
|
||||
if (!xkb->indicators)
|
||||
wantConfig&= ~XkmIndicatorsMask;
|
||||
}
|
||||
if (wantConfig&XkmKeyNamesMask) {
|
||||
if ((!xkb->names)||(!xkb->names->keys))
|
||||
wantConfig&= ~XkmKeyNamesMask;
|
||||
}
|
||||
if ((wantConfig&XkmGeometryMask)&&(!xkb->geom))
|
||||
wantConfig&= ~XkmGeometryMask;
|
||||
}
|
||||
else {
|
||||
wantConfig= 0;
|
||||
}
|
||||
complete|= wantConfig;
|
||||
|
||||
wantDflts= 0;
|
||||
wantNames= want&(~complete);
|
||||
if ((xkb!=NULL) && (old_names!=NULL)) {
|
||||
if (wantNames&XkmTypesMask) {
|
||||
if (old_names->types!=None) {
|
||||
tmp= XkbAtomGetString(dpy,old_names->types);
|
||||
names->types= _XkbDupString(tmp);
|
||||
}
|
||||
else {
|
||||
wantDflts|= XkmTypesMask;
|
||||
}
|
||||
complete|= XkmTypesMask;
|
||||
}
|
||||
if (wantNames&XkmCompatMapMask) {
|
||||
if (old_names->compat!=None) {
|
||||
tmp= XkbAtomGetString(dpy,old_names->compat);
|
||||
names->compat= _XkbDupString(tmp);
|
||||
}
|
||||
else wantDflts|= XkmCompatMapMask;
|
||||
complete|= XkmCompatMapMask;
|
||||
}
|
||||
if (wantNames&XkmSymbolsMask) {
|
||||
if (old_names->symbols==None)
|
||||
return False;
|
||||
tmp= XkbAtomGetString(dpy,old_names->symbols);
|
||||
names->symbols= _XkbDupString(tmp);
|
||||
complete|= XkmSymbolsMask;
|
||||
}
|
||||
if (wantNames&XkmKeyNamesMask) {
|
||||
if (old_names->keycodes!=None) {
|
||||
tmp= XkbAtomGetString(dpy,old_names->keycodes);
|
||||
names->keycodes= _XkbDupString(tmp);
|
||||
}
|
||||
else wantDflts|= XkmKeyNamesMask;
|
||||
complete|= XkmKeyNamesMask;
|
||||
}
|
||||
if (wantNames&XkmGeometryMask) {
|
||||
if (old_names->geometry==None)
|
||||
return False;
|
||||
tmp= XkbAtomGetString(dpy,old_names->geometry);
|
||||
names->geometry= _XkbDupString(tmp);
|
||||
complete|= XkmGeometryMask;
|
||||
wantNames&= ~XkmGeometryMask;
|
||||
}
|
||||
}
|
||||
if (complete&XkmCompatMapMask)
|
||||
complete|= XkmIndicatorsMask|XkmVirtualModsMask;
|
||||
else if (complete&(XkmSymbolsMask|XkmTypesMask))
|
||||
complete|= XkmVirtualModsMask;
|
||||
if (need & (~complete))
|
||||
return False;
|
||||
if ((complete&XkmSymbolsMask)&&((XkmKeyNamesMask|XkmTypesMask)&(~complete)))
|
||||
return False;
|
||||
|
||||
multi_section= 1;
|
||||
if (((complete&XkmKeymapRequired)==XkmKeymapRequired)&&
|
||||
((complete&(~XkmKeymapLegal))==0)) {
|
||||
fprintf(file,"xkb_keymap \"%s\" {\n",name);
|
||||
}
|
||||
else if (((complete&XkmSemanticsRequired)==XkmSemanticsRequired)&&
|
||||
((complete&(~XkmSemanticsLegal))==0)) {
|
||||
fprintf(file,"xkb_semantics \"%s\" {\n",name);
|
||||
}
|
||||
else if (((complete&XkmLayoutRequired)==XkmLayoutRequired)&&
|
||||
((complete&(~XkmLayoutLegal))==0)) {
|
||||
fprintf(file,"xkb_layout \"%s\" {\n",name);
|
||||
}
|
||||
else if (XkmSingleSection(complete&(~XkmVirtualModsMask))) {
|
||||
multi_section= 0;
|
||||
}
|
||||
else {
|
||||
return False;
|
||||
}
|
||||
|
||||
wantNames= complete&(~(wantConfig|wantDflts));
|
||||
name= names->keycodes;
|
||||
if (wantConfig&XkmKeyNamesMask)
|
||||
XkbWriteXKBKeycodes(file,&finfo,False,False,_AddIncl,name);
|
||||
else if (wantDflts&XkmKeyNamesMask)
|
||||
fprintf(stderr,"Default symbols not implemented yet!\n");
|
||||
else if (wantNames&XkmKeyNamesMask)
|
||||
XkbWriteSectionFromName(file,"keycodes",name);
|
||||
|
||||
name= names->types;
|
||||
if (wantConfig&XkmTypesMask)
|
||||
XkbWriteXKBKeyTypes(file,&finfo,False,False,_AddIncl,name);
|
||||
else if (wantDflts&XkmTypesMask)
|
||||
fprintf(stderr,"Default types not implemented yet!\n");
|
||||
else if (wantNames&XkmTypesMask)
|
||||
XkbWriteSectionFromName(file,"types",name);
|
||||
|
||||
name= names->compat;
|
||||
if (wantConfig&XkmCompatMapMask)
|
||||
XkbWriteXKBCompatMap(file,&finfo,False,False,_AddIncl,name);
|
||||
else if (wantDflts&XkmCompatMapMask)
|
||||
fprintf(stderr,"Default interps not implemented yet!\n");
|
||||
else if (wantNames&XkmCompatMapMask)
|
||||
XkbWriteSectionFromName(file,"compatibility",name);
|
||||
|
||||
name= names->symbols;
|
||||
if (wantConfig&XkmSymbolsMask)
|
||||
XkbWriteXKBSymbols(file,&finfo,False,False,_AddIncl,name);
|
||||
else if (wantNames&XkmSymbolsMask)
|
||||
XkbWriteSectionFromName(file,"symbols",name);
|
||||
|
||||
name= names->geometry;
|
||||
if (wantConfig&XkmGeometryMask)
|
||||
XkbWriteXKBGeometry(file,&finfo,False,False,_AddIncl,name);
|
||||
else if (wantNames&XkmGeometryMask)
|
||||
XkbWriteSectionFromName(file,"geometry",name);
|
||||
|
||||
if (multi_section)
|
||||
fprintf(file,"};\n");
|
||||
return True;
|
||||
}
|
||||
|
||||
/***====================================================================***/
|
||||
|
||||
/*ARGSUSED*/
|
||||
Status
|
||||
#if NeedFunctionPrototypes
|
||||
XkbMergeFile(XkbDescPtr xkb,XkbFileInfo finfo)
|
||||
#else
|
||||
XkbMergeFile(xkb,finfo)
|
||||
XkbDescPtr xkb;
|
||||
XkbFileInfo *finfo;
|
||||
#endif
|
||||
{
|
||||
return BadImplementation;
|
||||
}
|
||||
|
||||
/***====================================================================***/
|
||||
|
||||
int
|
||||
#if NeedFunctionPrototypes
|
||||
XkbFindKeycodeByName(XkbDescPtr xkb,char *name,Bool use_aliases)
|
||||
#else
|
||||
XkbFindKeycodeByName(xkb,name,use_aliases)
|
||||
XkbDescPtr xkb;
|
||||
char * name;
|
||||
Bool use_aliases;
|
||||
#endif
|
||||
{
|
||||
register int i;
|
||||
|
||||
if ((!xkb)||(!xkb->names)||(!xkb->names->keys))
|
||||
return 0;
|
||||
for (i=xkb->min_key_code;i<=xkb->max_key_code;i++) {
|
||||
if (strncmp(xkb->names->keys[i].name,name,XkbKeyNameLength)==0)
|
||||
return i;
|
||||
}
|
||||
if (!use_aliases)
|
||||
return 0;
|
||||
if (xkb->geom && xkb->geom->key_aliases) {
|
||||
XkbKeyAliasPtr a;
|
||||
a= xkb->geom->key_aliases;
|
||||
for (i=0;i<xkb->geom->num_key_aliases;i++,a++) {
|
||||
if (strncmp(name,a->alias,XkbKeyNameLength)==0)
|
||||
return XkbFindKeycodeByName(xkb,a->real,False);
|
||||
}
|
||||
}
|
||||
if (xkb->names && xkb->names->key_aliases) {
|
||||
XkbKeyAliasPtr a;
|
||||
a= xkb->names->key_aliases;
|
||||
for (i=0;i<xkb->names->num_key_aliases;i++,a++) {
|
||||
if (strncmp(name,a->alias,XkbKeyNameLength)==0)
|
||||
return XkbFindKeycodeByName(xkb,a->real,False);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
unsigned
|
||||
#if NeedFunctionPrototypes
|
||||
XkbConvertGetByNameComponents(Bool toXkm,unsigned orig)
|
||||
#else
|
||||
XkbConvertGetByNameComponents(toXkm,orig)
|
||||
Bool toXkm;
|
||||
unsigned orig;
|
||||
#endif
|
||||
{
|
||||
unsigned rtrn;
|
||||
|
||||
rtrn= 0;
|
||||
if (toXkm) {
|
||||
if (orig&XkbGBN_TypesMask) rtrn|= XkmTypesMask;
|
||||
if (orig&XkbGBN_CompatMapMask) rtrn|= XkmCompatMapMask;
|
||||
if (orig&XkbGBN_SymbolsMask) rtrn|= XkmSymbolsMask;
|
||||
if (orig&XkbGBN_IndicatorMapMask) rtrn|= XkmIndicatorsMask;
|
||||
if (orig&XkbGBN_KeyNamesMask) rtrn|= XkmKeyNamesMask;
|
||||
if (orig&XkbGBN_GeometryMask) rtrn|= XkmGeometryMask;
|
||||
}
|
||||
else {
|
||||
if (orig&XkmTypesMask) rtrn|= XkbGBN_TypesMask;
|
||||
if (orig&XkmCompatMapMask) rtrn|= XkbGBN_CompatMapMask;
|
||||
if (orig&XkmSymbolsMask) rtrn|= XkbGBN_SymbolsMask;
|
||||
if (orig&XkmIndicatorsMask) rtrn|= XkbGBN_IndicatorMapMask;
|
||||
if (orig&XkmKeyNamesMask) rtrn|= XkbGBN_KeyNamesMask;
|
||||
if (orig&XkmGeometryMask) rtrn|= XkbGBN_GeometryMask;
|
||||
if (orig!=0) rtrn|= XkbGBN_OtherNamesMask;
|
||||
}
|
||||
return rtrn;
|
||||
}
|
||||
|
||||
unsigned
|
||||
#if NeedFunctionPrototypes
|
||||
XkbConvertXkbComponents(Bool toXkm,unsigned orig)
|
||||
#else
|
||||
XkbConvertXkbComponents(toXkm,orig)
|
||||
Bool toXkm;
|
||||
unsigned orig;
|
||||
#endif
|
||||
{
|
||||
unsigned rtrn;
|
||||
|
||||
rtrn= 0;
|
||||
if (toXkm) {
|
||||
if (orig&XkbClientMapMask) rtrn|= XkmTypesMask|XkmSymbolsMask;
|
||||
if (orig&XkbServerMapMask) rtrn|= XkmTypesMask|XkmSymbolsMask;
|
||||
if (orig&XkbCompatMapMask) rtrn|= XkmCompatMapMask;
|
||||
if (orig&XkbIndicatorMapMask) rtrn|= XkmIndicatorsMask;
|
||||
if (orig&XkbNamesMask) rtrn|= XkmKeyNamesMask;
|
||||
if (orig&XkbGeometryMask) rtrn|= XkmGeometryMask;
|
||||
}
|
||||
else {
|
||||
if (orig!=0) rtrn|= XkbNamesMask;
|
||||
if (orig&XkmTypesMask) rtrn|= XkbClientMapMask;
|
||||
if (orig&XkmCompatMapMask)
|
||||
rtrn|= XkbCompatMapMask|XkbIndicatorMapMask;
|
||||
if (orig&XkmSymbolsMask) rtrn|=XkbClientMapMask|XkbServerMapMask;
|
||||
if (orig&XkmIndicatorsMask) rtrn|= XkbIndicatorMapMask;
|
||||
if (orig&XkmKeyNamesMask)
|
||||
rtrn|= XkbNamesMask|XkbIndicatorMapMask;
|
||||
if (orig&XkmGeometryMask) rtrn|= XkbGeometryMask;
|
||||
}
|
||||
return rtrn;
|
||||
}
|
||||
|
||||
Bool
|
||||
#if NeedFunctionPrototypes
|
||||
XkbDetermineFileType(XkbFileInfoPtr finfo,int format,int *opts_missing)
|
||||
#else
|
||||
XkbDetermineFileType(finfo,format,opts_missing)
|
||||
XkbFileInfoPtr finfo;
|
||||
int format;
|
||||
int * opts_missing;
|
||||
#endif
|
||||
{
|
||||
unsigned present;
|
||||
XkbDescPtr xkb;
|
||||
|
||||
if ((!finfo)||(!finfo->xkb))
|
||||
return False;
|
||||
if (opts_missing)
|
||||
*opts_missing= 0;
|
||||
xkb= finfo->xkb;
|
||||
present= 0;
|
||||
if ((xkb->names)&&(xkb->names->keys)) present|= XkmKeyNamesMask;
|
||||
if ((xkb->map)&&(xkb->map->types)) present|= XkmTypesMask;
|
||||
if (xkb->compat) present|= XkmCompatMapMask;
|
||||
if ((xkb->map)&&(xkb->map->num_syms>1)) present|= XkmSymbolsMask;
|
||||
if (xkb->indicators) present|= XkmIndicatorsMask;
|
||||
if (xkb->geom) present|= XkmGeometryMask;
|
||||
if (!present)
|
||||
return False;
|
||||
else switch (present) {
|
||||
case XkmKeyNamesMask:
|
||||
finfo->type= XkmKeyNamesIndex;
|
||||
finfo->defined= present;
|
||||
return True;
|
||||
case XkmTypesMask:
|
||||
finfo->type= XkmTypesIndex;
|
||||
finfo->defined= present;
|
||||
return True;
|
||||
case XkmCompatMapMask:
|
||||
finfo->type= XkmCompatMapIndex;
|
||||
finfo->defined= present;
|
||||
return True;
|
||||
case XkmSymbolsMask:
|
||||
if (format!=XkbXKMFile) {
|
||||
finfo->type= XkmSymbolsIndex;
|
||||
finfo->defined= present;
|
||||
return True;
|
||||
}
|
||||
break;
|
||||
case XkmGeometryMask:
|
||||
finfo->type= XkmGeometryIndex;
|
||||
finfo->defined= present;
|
||||
return True;
|
||||
}
|
||||
if ((present&(~XkmSemanticsLegal))==0) {
|
||||
if ((XkmSemanticsRequired&present)==XkmSemanticsRequired) {
|
||||
if (opts_missing)
|
||||
*opts_missing= XkmSemanticsOptional&(~present);
|
||||
finfo->type= XkmSemanticsFile;
|
||||
finfo->defined= present;
|
||||
return True;
|
||||
}
|
||||
}
|
||||
else if ((present&(~XkmLayoutLegal))==0) {
|
||||
if ((XkmLayoutRequired&present)==XkmLayoutRequired) {
|
||||
if (opts_missing)
|
||||
*opts_missing= XkmLayoutOptional&(~present);
|
||||
finfo->type= XkmLayoutFile;
|
||||
finfo->defined= present;
|
||||
return True;
|
||||
}
|
||||
}
|
||||
else if ((present&(~XkmKeymapLegal))==0) {
|
||||
if ((XkmKeymapRequired&present)==XkmKeymapRequired) {
|
||||
if (opts_missing)
|
||||
*opts_missing= XkmKeymapOptional&(~present);
|
||||
finfo->type= XkmKeymapFile;
|
||||
finfo->defined= present;
|
||||
return True;
|
||||
}
|
||||
}
|
||||
return False;
|
||||
}
|
||||
|
||||
/* all latin-1 alphanumerics, plus parens, slash, minus, underscore and */
|
||||
/* wildcards */
|
||||
|
||||
static 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
|
||||
#if NeedFunctionPrototypes
|
||||
XkbEnsureSafeMapName(char *name)
|
||||
#else
|
||||
XkbEnsureSafeMapName(name)
|
||||
char *name;
|
||||
#endif
|
||||
{
|
||||
if (name==NULL)
|
||||
return;
|
||||
while (*name!='\0') {
|
||||
if ((componentSpecLegal[(*name)/8]&(1<<((*name)%8)))==0)
|
||||
*name= '_';
|
||||
name++;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/***====================================================================***/
|
||||
|
||||
#define UNMATCHABLE(c) (((c)=='(')||((c)==')')||((c)=='/'))
|
||||
|
||||
Bool
|
||||
#if NeedFunctionPrototypes
|
||||
XkbNameMatchesPattern(char *name,char *ptrn)
|
||||
#else
|
||||
XkbNameMatchesPattern(name,ptrn)
|
||||
char * name;
|
||||
char * ptrn;
|
||||
#endif
|
||||
{
|
||||
while (ptrn[0]!='\0') {
|
||||
if (name[0]=='\0') {
|
||||
if (ptrn[0]=='*') {
|
||||
ptrn++;
|
||||
continue;
|
||||
}
|
||||
return False;
|
||||
}
|
||||
if (ptrn[0]=='?') {
|
||||
if (UNMATCHABLE(name[0]))
|
||||
return False;
|
||||
}
|
||||
else if (ptrn[0]=='*') {
|
||||
if ((!UNMATCHABLE(name[0]))&&XkbNameMatchesPattern(name+1,ptrn))
|
||||
return True;
|
||||
return XkbNameMatchesPattern(name,ptrn+1);
|
||||
}
|
||||
else if (ptrn[0]!=name[0])
|
||||
return False;
|
||||
name++;
|
||||
ptrn++;
|
||||
}
|
||||
/* if we get here, the pattern is exhausted (-:just like me:-) */
|
||||
return (name[0]=='\0');
|
||||
}
|
||||
1216
xkb/xkbout.c
Normal file
1216
xkb/xkbout.c
Normal file
File diff suppressed because it is too large
Load diff
1700
xkb/xkbtext.c
Normal file
1700
xkb/xkbtext.c
Normal file
File diff suppressed because it is too large
Load diff
1481
xkb/xkmread.c
Normal file
1481
xkb/xkmread.c
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue