diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2018-07-03 16:32:11 +0200 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2018-07-03 16:32:11 +0200 |
commit | c86a119da96c73914de91935db1daff04edf3b0b (patch) | |
tree | 5a97c8adfeb3d829b6bcdc301106d8d9cfb24b5d /nx-X11 | |
parent | b1e4d6e849c54b61fe1c7de0cde58394225d20bf (diff) | |
parent | b82a6a1077c72670f03213fc2513a68d2ce8d3b1 (diff) | |
download | nx-libs-c86a119da96c73914de91935db1daff04edf3b0b.tar.gz nx-libs-c86a119da96c73914de91935db1daff04edf3b0b.tar.bz2 nx-libs-c86a119da96c73914de91935db1daff04edf3b0b.zip |
Merge branch 'uli42-gh-sunweaver/pr/xserver-xkb-cleanup' into 3.6.x
Attributes GH PR #706: https://github.com/ArcticaProject/nx-libs/pull/706
Diffstat (limited to 'nx-X11')
20 files changed, 198 insertions, 2595 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c index 51a11b4f4..6a146676e 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c @@ -884,11 +884,6 @@ XkbError: #ifdef XKB } else { /* if (noXkbExtension) */ - FILE *file; - XkbConfigRtrnRec config; - - char *nxagentXkbConfigFilePath; - XkbComponentNamesRec names = {0}; char *rules, *variants, *options; @@ -971,17 +966,6 @@ XkbError: options = XKB_DFLT_KB_OPTIONS; #ifdef TEST - fprintf(stderr, "nxagentKeyboardProc: XkbInitialMap (option -xkbmap) is [%s]\n", XkbInitialMap ? XkbInitialMap : "NULL"); - #endif - - if (XkbInitialMap) { - if ((names.keymap = strchr(XkbInitialMap, '/')) != NULL) - ++names.keymap; - else - names.keymap = XkbInitialMap; - } - - #ifdef TEST fprintf(stderr, "nxagentKeyboardProc: Init XKB extension.\n"); #endif @@ -1035,108 +1019,23 @@ XkbError: XkbGetControls(nxagentDisplay, XkbAllControlsMask, xkb); - if (nxagentX2go) - nxagentXkbConfigFilePath = strdup(XKB_CONFIG_FILE_X2GO); - else - nxagentXkbConfigFilePath = strdup(XKB_CONFIG_FILE_NX); - - if (!nxagentXkbConfigFilePath) - { - FatalError("nxagentKeyboardProc: malloc failed."); - } - - #ifdef TEST - fprintf(stderr, "nxagentKeyboardProc: nxagentXkbConfigFilePath [%s].\n", - nxagentXkbConfigFilePath); - #endif - - if ((file = fopen(nxagentXkbConfigFilePath, "r"))) { - - #ifdef TEST - fprintf(stderr, "nxagentKeyboardProc: Going to parse config file.\n"); - #endif - - if (XkbCFParse(file, XkbCFDflts, xkb, &config) == 0) { - ErrorF("Error parsing config file.\n"); - - free(nxagentXkbConfigFilePath); - nxagentXkbConfigFilePath = NULL; - - fclose(file); - goto XkbError; - } - if (config.rules_file) - rules = config.rules_file; - if (config.model) - { - if (free_model) - { - free_model = 0; - free(model); - } - model = config.model; - } - if (config.layout) - { - if (free_layout) - { - free_layout = 0; - free(layout); - } - layout = config.layout; - } - if (config.variant) - variants = config.variant; - if (config.options) - options = config.options; - - free(nxagentXkbConfigFilePath); - nxagentXkbConfigFilePath = NULL; - - fclose(file); - } - else - { - #ifdef TEST - fprintf(stderr, "nxagentKeyboardProc: No config file, going to set rules and init device.\n"); - #endif - #ifdef DEBUG - fprintf(stderr, "nxagentKeyboardProc: Going to set rules and init device: " - "[rules='%s',model='%s',layout='%s',variants='%s',options='%s'].\n", - rules, model, layout, variants, options); - #endif - - XkbSetRulesDflts(rules, model, layout, variants, options); - XkbInitKeyboardDeviceStruct((void *)pDev, &names, &keySyms, modmap, - nxagentBell, nxagentChangeKeyboardControl); - - free(nxagentXkbConfigFilePath); - nxagentXkbConfigFilePath = NULL; - - if (!nxagentKeyboard || strcmp(nxagentKeyboard, "query") == 0) - { - goto XkbError; - } - - goto XkbEnd; - } - - #ifdef TEST - fprintf(stderr, "nxagentKeyboardProc: Going to set rules and init device.\n"); - #endif #ifdef DEBUG fprintf(stderr, "nxagentKeyboardProc: Going to set rules and init device: " "[rules='%s',model='%s',layout='%s',variants='%s',options='%s'].\n", - rules, model, layout, variants, options); + rules, model, layout, variants, options); #endif XkbSetRulesDflts(rules, model, layout, variants, options); XkbInitKeyboardDeviceStruct((void *)pDev, &names, &keySyms, modmap, nxagentBell, nxagentChangeKeyboardControl); - XkbDDXChangeControls((void *)pDev, xkb->ctrls, xkb->ctrls); -XkbEnd: + if (!nxagentKeyboard || + (nxagentKeyboard && (strcmp(nxagentKeyboard, "query") == 0))) + { + goto XkbError; + } +XkbEnd: if (nxagentOption(Shadow) == 1 && pDev && pDev->key) { NXShadowInitKeymap(&(pDev->key->curKeySyms)); diff --git a/nx-X11/programs/Xserver/include/xkbsrv.h b/nx-X11/programs/Xserver/include/xkbsrv.h index 533a30930..9f9ccc5c3 100644 --- a/nx-X11/programs/Xserver/include/xkbsrv.h +++ b/nx-X11/programs/Xserver/include/xkbsrv.h @@ -30,15 +30,11 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #define XkbAllocClientMap SrvXkbAllocClientMap #define XkbAllocServerMap SrvXkbAllocServerMap #define XkbChangeTypesOfKey SrvXkbChangeTypesOfKey -#define XkbAddKeyType SrvXkbAddKeyType -#define XkbCopyKeyType SrvXkbCopyKeyType #define XkbCopyKeyTypes SrvXkbCopyKeyTypes #define XkbFreeClientMap SrvXkbFreeClientMap #define XkbFreeServerMap SrvXkbFreeServerMap -#define XkbInitCanonicalKeyTypes SrvXkbInitCanonicalKeyTypes #define XkbKeyTypesForCoreSymbols SrvXkbKeyTypesForCoreSymbols #define XkbApplyCompatMapToKey SrvXkbApplyCompatMapToKey -#define XkbUpdateMapFromCore SrvXkbUpdateMapFromCore #define XkbResizeKeyActions SrvXkbResizeKeyActions #define XkbResizeKeySyms SrvXkbResizeKeySyms #define XkbResizeKeyType SrvXkbResizeKeyType @@ -48,21 +44,13 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #define XkbAllocKeyboard SrvXkbAllocKeyboard #define XkbAllocNames SrvXkbAllocNames #define XkbFreeCompatMap SrvXkbFreeCompatMap -#define XkbFreeControls SrvXkbFreeControls -#define XkbFreeIndicatorMaps SrvXkbFreeIndicatorMaps #define XkbFreeKeyboard SrvXkbFreeKeyboard #define XkbFreeNames SrvXkbFreeNames -#define XkbAddDeviceLedInfo SrvXkbAddDeviceLedInfo -#define XkbAllocDeviceInfo SrvXkbAllocDeviceInfo -#define XkbFreeDeviceInfo SrvXkbFreeDeviceInfo -#define XkbResizeDeviceButtonActions SrvXkbResizeDeviceButtonActions #define XkbLatchModifiers SrvXkbLatchModifiers #define XkbLatchGroup SrvXkbLatchGroup #define XkbVirtualModsToReal SrvXkbVirtualModsToReal #define XkbChangeKeycodeRange SrvXkbChangeKeycodeRange #define XkbApplyVirtualModChanges SrvXkbApplyVirtualModChanges -#define XkbUpdateActionVirtualMods SrvXkbUpdateActionVirtualMods -#define XkbUpdateKeyTypeVirtualMods SrvXkbUpdateKeyTypeVirtualMods #include <nx-X11/extensions/XKBproto.h> #include "xkbstr.h" @@ -276,23 +264,17 @@ typedef struct extern int XkbReqCode; extern int XkbEventBase; -extern int XkbKeyboardErrorCode; extern int XkbDisableLockActions; extern char * XkbBaseDirectory; extern char * XkbBinDirectory; extern char * XkbInitialMap; -extern int _XkbClientMajor; -extern int _XkbClientMinor; extern unsigned int XkbXIUnsupported; -extern char * XkbModelUsed,*XkbLayoutUsed,*XkbVariantUsed,*XkbOptionsUsed; extern Bool noXkbExtension; -extern Bool XkbWantRulesProp; extern void * XkbLastRepeatEvent; extern CARD32 xkbDebugFlags; -extern CARD32 xkbDebugCtrls; #define _XkbAlloc(s) malloc((s)) @@ -450,11 +432,6 @@ extern Status XkbAllocControls( unsigned int /* which*/ ); -extern Status XkbCopyKeyType( - XkbKeyTypePtr /* from */, - XkbKeyTypePtr /* into */ -); - extern Status XkbCopyKeyTypes( XkbKeyTypePtr /* from */, XkbKeyTypePtr /* into */, @@ -622,15 +599,6 @@ extern void XkbApplyLedStateChanges( XkbEventCausePtr /* cause */ ); -extern void XkbUpdateLedAutoState( - DeviceIntPtr /* dev */, - XkbSrvLedInfoPtr /* sli */, - unsigned int /* maps_to_check */, - xkbExtensionDeviceNotify * /* ed */, - XkbChangesPtr /* changes */, - XkbEventCausePtr /* cause */ -); - extern void XkbFlushLedEvents( DeviceIntPtr /* dev */, DeviceIntPtr /* kbd */, @@ -640,11 +608,6 @@ extern void XkbFlushLedEvents( XkbEventCausePtr /* cause */ ); -extern void XkbUpdateAllDeviceIndicators( - XkbChangesPtr /* changes */, - XkbEventCausePtr /* cause */ -); - extern unsigned int XkbIndicatorsToUpdate( DeviceIntPtr /* dev */, unsigned long /* state_changes */, @@ -701,12 +664,6 @@ extern void XkbSendCompatMapNotify( xkbCompatMapNotify * /* ev */ ); -extern void XkbSendIndicatorNotify( - DeviceIntPtr /* kbd */, - int /* xkbType */, - xkbIndicatorNotify * /* ev */ -); - extern void XkbHandleBell( BOOL /* force */, BOOL /* eventOnly */, @@ -879,11 +836,6 @@ extern void XkbDDXChangeControls( XkbControlsPtr /* new */ ); -extern void XkbDDXUpdateIndicators( - DeviceIntPtr /* keybd */, - CARD32 /* newState */ -); - extern void XkbDDXUpdateDeviceIndicators( DeviceIntPtr /* dev */, XkbSrvLedInfoPtr /* sli */, @@ -1057,35 +1009,12 @@ extern Bool XkbUpdateMapFromCore( XkbChangesPtr /* changes */ ); -extern void XkbFreeControls( - XkbDescPtr /* xkb */, - unsigned int /* which */, - Bool /* freeMap */ -); - -extern void XkbFreeIndicatorMaps( - XkbDescPtr /* xkb */ -); - extern Bool XkbApplyVirtualModChanges( XkbDescPtr /* xkb */, unsigned int /* changed */, XkbChangesPtr /* changes */ ); -extern Bool XkbUpdateActionVirtualMods( - XkbDescPtr /* xkb */, - XkbAction * /* act */, - unsigned int /* changed */ -); - -extern void XkbUpdateKeyTypeVirtualMods( - XkbDescPtr /* xkb */, - XkbKeyTypePtr /* type */, - unsigned int /* changed */, - XkbChangesPtr /* changes */ -); - extern void XkbSendNewKeyboardNotify( DeviceIntPtr /* kbd */, xkbNewKeyboardNotify * /* pNKN */ @@ -1116,16 +1045,6 @@ typedef struct _XkbSrvListInfo { int nFound[_XkbListNumComponents]; } XkbSrvListInfoRec,*XkbSrvListInfoPtr; -char * -XkbGetRulesDflts( - XkbRF_VarDefsPtr /* defs */ -); - -extern void XkbSetRulesUsed( - XkbRF_VarDefsPtr /* defs */ -); - - extern Status XkbDDXList( DeviceIntPtr /* dev */, XkbSrvListInfoPtr /* listing */, @@ -1149,11 +1068,6 @@ extern Bool XkbDDXNamesFromRules( XkbComponentNamesPtr /* names */ ); -extern FILE *XkbDDXOpenConfigFile( - char * /* mapName */, - char * /* fileNameRtrn */, - int /* fileNameRtrnLen */ -); extern Bool XkbDDXApplyConfig( XPointer /* cfg_in */, diff --git a/nx-X11/programs/Xserver/xkb/Imakefile b/nx-X11/programs/Xserver/xkb/Imakefile index 61ec8eec0..5acd977f0 100644 --- a/nx-X11/programs/Xserver/xkb/Imakefile +++ b/nx-X11/programs/Xserver/xkb/Imakefile @@ -20,10 +20,10 @@ XKB_DDXDEFS = XkbServerDefines DDX_SRCS = ddxBeep.c ddxCtrls.c ddxFakeBtn.c ddxFakeMtn.c ddxInit.c \ ddxKeyClick.c ddxKillSrv.c ddxLEDs.c ddxVT.c ddxLoad.c \ - ddxList.c ddxDevBtn.c ddxPrivate.c xkbconfig.c + ddxList.c ddxDevBtn.c ddxPrivate.c DDX_OBJS = ddxBeep.o ddxCtrls.o ddxFakeBtn.o ddxFakeMtn.o ddxInit.o \ ddxKeyClick.o ddxKillSrv.o ddxLEDs.o ddxVT.o ddxLoad.o \ - ddxList.o ddxDevBtn.o ddxPrivate.o xkbconfig.o + ddxList.o ddxDevBtn.o ddxPrivate.o SRCS = xkb.c xkbUtils.c xkbEvents.c xkbAccessX.c xkbSwap.c \ xkbLEDs.c xkbInit.c xkbActions.c xkbPrKeyEv.c \ xkmread.c xkbfmisc.c xkberrs.c maprules.c \ diff --git a/nx-X11/programs/Xserver/xkb/XKBAlloc.c b/nx-X11/programs/Xserver/xkb/XKBAlloc.c index 4fe4960a3..b55918f88 100644 --- a/nx-X11/programs/Xserver/xkb/XKBAlloc.c +++ b/nx-X11/programs/Xserver/xkb/XKBAlloc.c @@ -257,7 +257,7 @@ XkbAllocControls(XkbDescPtr xkb,unsigned which) } /*ARGSUSED*/ -void +static void XkbFreeControls(XkbDescPtr xkb,unsigned which,Bool freeMap) { if (freeMap && (xkb!=NULL) && (xkb->ctrls!=NULL)) { @@ -282,7 +282,7 @@ XkbAllocIndicatorMaps(XkbDescPtr xkb) return Success; } -void +static void XkbFreeIndicatorMaps(XkbDescPtr xkb) { if ((xkb!=NULL)&&(xkb->indicators!=NULL)) { @@ -330,154 +330,3 @@ XkbFreeKeyboard(XkbDescPtr xkb,unsigned which,Bool freeAll) _XkbFree(xkb); return; } - -/***====================================================================***/ - -XkbDeviceLedInfoPtr -XkbAddDeviceLedInfo(XkbDeviceInfoPtr devi,unsigned ledClass,unsigned ledId) -{ -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 -XkbResizeDeviceButtonActions(XkbDeviceInfoPtr devi,unsigned newTotal) -{ - 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 -XkbAllocDeviceInfo(unsigned deviceSpec,unsigned nButtons,unsigned szLeds) -{ -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 -XkbFreeDeviceInfo(XkbDeviceInfoPtr devi,unsigned which,Bool freeDevI) -{ - 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; -} diff --git a/nx-X11/programs/Xserver/xkb/XKBMAlloc.c b/nx-X11/programs/Xserver/xkb/XKBMAlloc.c index dbd9b25a0..100e827b9 100644 --- a/nx-X11/programs/Xserver/xkb/XKBMAlloc.c +++ b/nx-X11/programs/Xserver/xkb/XKBMAlloc.c @@ -217,7 +217,7 @@ XkbServerMapPtr map; /***====================================================================***/ -Status +static Status XkbCopyKeyType(XkbKeyTypePtr from,XkbKeyTypePtr into) { if ((!from)||(!into)) @@ -272,81 +272,6 @@ register int i,rtrn; return Success; } -XkbKeyTypePtr -XkbAddKeyType( XkbDescPtr xkb, - Atom name, - int map_count, - Bool want_preserve, - int num_lvls) -{ -register int i; -unsigned tmp; -XkbKeyTypePtr type; -XkbClientMapPtr map; - - if ((!xkb)||(num_lvls<1)) - return NULL; - map= xkb->map; - if ((map)&&(map->types)) { - for (i=0;i<map->num_types;i++) { - if (map->types[i].name==name) { - Status status; - status=XkbResizeKeyType(xkb,i,map_count,want_preserve,num_lvls); - return (status==Success?&map->types[i]:NULL); - } - } - } - if ((!map)||(!map->types)||(!(map->num_types<XkbNumRequiredTypes))) { - tmp= XkbNumRequiredTypes+1; - if (XkbAllocClientMap(xkb,XkbKeyTypesMask,tmp)!=Success) - return NULL; - tmp= 0; - if (map->num_types<=XkbKeypadIndex) - tmp|= XkbKeypadMask; - if (map->num_types<=XkbAlphabeticIndex) - tmp|= XkbAlphabeticMask; - if (map->num_types<=XkbTwoLevelIndex) - tmp|= XkbTwoLevelMask; - if (map->num_types<=XkbOneLevelIndex) - tmp|= XkbOneLevelMask; - if (XkbInitCanonicalKeyTypes(xkb,tmp,XkbNoModifier)==Success) { - for (i=0;i<map->num_types;i++) { - Status status; - if (map->types[i].name!=name) - continue; - status=XkbResizeKeyType(xkb,i,map_count,want_preserve,num_lvls); - return (status==Success?&map->types[i]:NULL); - } - } - } - if ((map->num_types<=map->size_types)&& - (XkbAllocClientMap(xkb,XkbKeyTypesMask,map->num_types+1)!=Success)) { - return NULL; - } - type= &map->types[map->num_types]; - map->num_types++; - bzero((char *)type,sizeof(XkbKeyTypeRec)); - type->num_levels= num_lvls; - type->map_count= map_count; - type->name= name; - if (map_count>0) { - type->map= _XkbTypedCalloc(map_count,XkbKTMapEntryRec); - if (!type->map) { - map->num_types--; - return NULL; - } - if (want_preserve) { - type->preserve= _XkbTypedCalloc(map_count,XkbModsRec); - if (!type->preserve) { - _XkbFree(type->map); - map->num_types--; - return NULL; - } - } - } - return type; -} - Status XkbResizeKeyType( XkbDescPtr xkb, int type_ndx, diff --git a/nx-X11/programs/Xserver/xkb/XKBMisc.c b/nx-X11/programs/Xserver/xkb/XKBMisc.c index 8e184256e..98f11a2be 100644 --- a/nx-X11/programs/Xserver/xkb/XKBMisc.c +++ b/nx-X11/programs/Xserver/xkb/XKBMisc.c @@ -40,101 +40,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. /***====================================================================***/ -#define mapSize(m) (sizeof(m)/sizeof(XkbKTMapEntryRec)) -static XkbKTMapEntryRec map2Level[]= { - { True, ShiftMask, {1, ShiftMask, 0} } -}; - -static XkbKTMapEntryRec mapAlpha[]= { - { True, ShiftMask, { 1, ShiftMask, 0 } }, - { True, LockMask, { 0, LockMask, 0 } } -}; - -static XkbModsRec preAlpha[]= { - { 0, 0, 0 }, - { LockMask, LockMask, 0 } -}; - -#define NL_VMOD_MASK 0 -static XkbKTMapEntryRec mapKeypad[]= { - { True, ShiftMask, { 1, ShiftMask, 0 } }, - { False, 0, { 1, 0, NL_VMOD_MASK } } -}; - -static XkbKeyTypeRec canonicalTypes[XkbNumRequiredTypes] = { - { { 0, 0, 0 }, - 1, /* num_levels */ - 0, /* map_count */ - NULL, NULL, - None, NULL - }, - { { ShiftMask, ShiftMask, 0 }, - 2, /* num_levels */ - mapSize(map2Level), /* map_count */ - map2Level, NULL, - None, NULL - }, - { { ShiftMask|LockMask, ShiftMask|LockMask, 0 }, - 2, /* num_levels */ - mapSize(mapAlpha), /* map_count */ - mapAlpha, preAlpha, - None, NULL - }, - { { ShiftMask, ShiftMask, NL_VMOD_MASK }, - 2, /* num_levels */ - mapSize(mapKeypad), /* map_count */ - mapKeypad, NULL, - None, NULL - } -}; - -Status -XkbInitCanonicalKeyTypes(XkbDescPtr xkb,unsigned which,int keypadVMod) -{ -XkbClientMapPtr map; -XkbKeyTypePtr from,to; -Status rtrn; - - if (!xkb) - return BadMatch; - rtrn= XkbAllocClientMap(xkb,XkbKeyTypesMask,XkbNumRequiredTypes); - if (rtrn!=Success) - return rtrn; - map= xkb->map; - if ((which&XkbAllRequiredTypes)==0) - return Success; - rtrn= Success; - from= canonicalTypes; - to= map->types; - if (which&XkbOneLevelMask) - rtrn= XkbCopyKeyType(&from[XkbOneLevelIndex],&to[XkbOneLevelIndex]); - if ((which&XkbTwoLevelMask)&&(rtrn==Success)) - rtrn= XkbCopyKeyType(&from[XkbTwoLevelIndex],&to[XkbTwoLevelIndex]); - if ((which&XkbAlphabeticMask)&&(rtrn==Success)) - rtrn= XkbCopyKeyType(&from[XkbAlphabeticIndex],&to[XkbAlphabeticIndex]); - if ((which&XkbKeypadMask)&&(rtrn==Success)) { - XkbKeyTypePtr type; - rtrn= XkbCopyKeyType(&from[XkbKeypadIndex],&to[XkbKeypadIndex]); - type= &to[XkbKeypadIndex]; - if ((keypadVMod>=0)&&(keypadVMod<XkbNumVirtualMods)&&(rtrn==Success)) { - type->mods.vmods= (1<<keypadVMod); - type->map[0].active= True; - type->map[0].mods.mask= ShiftMask; - type->map[0].mods.real_mods= ShiftMask; - type->map[0].mods.vmods= 0; - type->map[0].level= 1; - type->map[1].active= False; - type->map[1].mods.mask= 0; - type->map[1].mods.real_mods= 0; - type->map[1].mods.vmods= (1<<keypadVMod); - type->map[1].level= 1; - } - } - return Success; -} - -/***====================================================================***/ - #define CORE_SYM(i) (i<map_width?core_syms[i]:NoSymbol) #define XKB_OFFSET(g,l) (((g)*groupsWidth)+(l)) @@ -552,88 +457,6 @@ unsigned changed,tmp; return True; } -Bool -XkbUpdateMapFromCore( XkbDescPtr xkb, - KeyCode first_key, - int num_keys, - int map_width, - KeySym * core_keysyms, - XkbChangesPtr changes) -{ -register int key,last_key; -KeySym * syms; - - syms= &core_keysyms[(first_key-xkb->min_key_code)*map_width]; - if (changes) { - if (changes->map.changed&XkbKeySymsMask) { - _XkbAddKeyChange(&changes->map.first_key_sym, - &changes->map.num_key_syms,first_key); - if (num_keys>1) { - _XkbAddKeyChange(&changes->map.first_key_sym, - &changes->map.num_key_syms, - first_key+num_keys-1); - } - } - else { - changes->map.changed|= XkbKeySymsMask; - changes->map.first_key_sym= first_key; - changes->map.num_key_syms= num_keys; - } - } - last_key= first_key+num_keys-1; - for (key=first_key;key<=last_key;key++,syms+= map_width) { - XkbMapChangesPtr mc; - unsigned explicit; - KeySym tsyms[XkbMaxSymsPerKey]; - int types[XkbNumKbdGroups]; - int nG; - - explicit= xkb->server->explicit[key]&XkbExplicitKeyTypesMask; - types[XkbGroup1Index]= XkbKeyKeyTypeIndex(xkb,key,XkbGroup1Index); - types[XkbGroup2Index]= XkbKeyKeyTypeIndex(xkb,key,XkbGroup2Index); - types[XkbGroup3Index]= XkbKeyKeyTypeIndex(xkb,key,XkbGroup3Index); - types[XkbGroup4Index]= XkbKeyKeyTypeIndex(xkb,key,XkbGroup4Index); - nG= XkbKeyTypesForCoreSymbols(xkb,map_width,syms,explicit,types,tsyms); - if (changes) - mc= &changes->map; - else mc= NULL; - XkbChangeTypesOfKey(xkb,key,nG,XkbAllGroupsMask,types,mc); - memcpy((char *)XkbKeySymsPtr(xkb,key),(char *)tsyms, - XkbKeyNumSyms(xkb,key)*sizeof(KeySym)); - XkbApplyCompatMapToKey(xkb,key,changes); - } - - if ((xkb->server->vmods!=NULL)&&(xkb->map->modmap!=NULL)&&(changes)&& - (changes->map.changed&(XkbVirtualModMapMask|XkbModifierMapMask))) { - unsigned char newVMods[XkbNumVirtualMods]; - register unsigned bit,i; - unsigned present; - - bzero(newVMods,XkbNumVirtualMods); - present= 0; - for (key=xkb->min_key_code;key<=xkb->max_key_code;key++) { - if (xkb->server->vmodmap[key]==0) - continue; - for (i=0,bit=1;i<XkbNumVirtualMods;i++,bit<<=1) { - if (bit&xkb->server->vmodmap[key]) { - present|= bit; - newVMods[i]|= xkb->map->modmap[key]; - } - } - } - for (i=0,bit=1;i<XkbNumVirtualMods;i++,bit<<=1) { - if ((bit&present)&&(newVMods[i]!=xkb->server->vmods[i])) { - changes->map.changed|= XkbVirtualModsMask; - changes->map.vmods|= bit; - xkb->server->vmods[i]= newVMods[i]; - } - } - } - if (changes && (changes->map.changed&XkbVirtualModsMask)) - XkbApplyVirtualModChanges(xkb,changes->map.vmods,changes); - return True; -} - Status XkbChangeTypesOfKey( XkbDescPtr xkb, int key, @@ -782,7 +605,7 @@ register unsigned mask; /***====================================================================***/ -Bool +static Bool XkbUpdateActionVirtualMods(XkbDescPtr xkb,XkbAction *act,unsigned changed) { unsigned int tmp; @@ -808,7 +631,7 @@ unsigned int tmp; return False; } -void +static void XkbUpdateKeyTypeVirtualMods( XkbDescPtr xkb, XkbKeyTypePtr type, unsigned int changed, diff --git a/nx-X11/programs/Xserver/xkb/ddxLEDs.c b/nx-X11/programs/Xserver/xkb/ddxLEDs.c index 4fe74bbd6..dca2fd16d 100644 --- a/nx-X11/programs/Xserver/xkb/ddxLEDs.c +++ b/nx-X11/programs/Xserver/xkb/ddxLEDs.c @@ -38,7 +38,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <xkbsrv.h> #include <nx-X11/extensions/XI.h> -void +static void XkbDDXUpdateIndicators(DeviceIntPtr dev,CARD32 new) { dev->kbdfeed->ctrl.leds= new; diff --git a/nx-X11/programs/Xserver/xkb/ddxLoad.c b/nx-X11/programs/Xserver/xkb/ddxLoad.c index 5f24e9ccc..83db4350c 100644 --- a/nx-X11/programs/Xserver/xkb/ddxLoad.c +++ b/nx-X11/programs/Xserver/xkb/ddxLoad.c @@ -520,7 +520,7 @@ OutputDirectory( } } -Bool +static Bool XkbDDXCompileNamedKeymap( XkbDescPtr xkb, XkbComponentNamesPtr names, char * nameRtrn, @@ -610,7 +610,7 @@ char *cmd = NULL,file[PATH_MAX],xkm_output_dir[PATH_MAX],*map,*outFile; return False; } -Bool +static Bool XkbDDXCompileKeymapByNames( XkbDescPtr xkb, XkbComponentNamesPtr names, unsigned want, @@ -762,7 +762,7 @@ char tmpname[PATH_MAX]; return False; } -FILE * +static FILE * XkbDDXOpenConfigFile(char *mapName,char *fileNameRtrn,int fileNameRtrnLen) { char buf[PATH_MAX],xkm_output_dir[PATH_MAX]; diff --git a/nx-X11/programs/Xserver/xkb/xkb.c b/nx-X11/programs/Xserver/xkb/xkb.c index 987ebcd7b..2138497b7 100644 --- a/nx-X11/programs/Xserver/xkb/xkb.c +++ b/nx-X11/programs/Xserver/xkb/xkb.c @@ -41,14 +41,12 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <nx-X11/extensions/XI.h> int XkbEventBase; - int XkbErrorBase; +static int XkbErrorBase; int XkbReqCode; - int XkbKeyboardErrorCode; -Atom xkbONE_LEVEL; -Atom xkbTWO_LEVEL; -Atom xkbKEYPAD; +static int XkbKeyboardErrorCode; CARD32 xkbDebugFlags = 0; -CARD32 xkbDebugCtrls = 0; +static CARD32 xkbDebugCtrls = 0; + #ifndef XKB_SRV_UNSUPPORTED_XI_FEATURES #define XKB_SRV_UNSUPPORTED_XI_FEATURES XkbXI_KeyboardsMask @@ -56,7 +54,7 @@ CARD32 xkbDebugCtrls = 0; unsigned XkbXIUnsupported= XKB_SRV_UNSUPPORTED_XI_FEATURES; -RESTYPE RT_XKBCLIENT; +static RESTYPE RT_XKBCLIENT; /***====================================================================***/ @@ -837,51 +835,6 @@ ProcXkbSetControls(ClientPtr client) return client->noClientException; } -int -XkbSetRepeatRate(DeviceIntPtr dev,int timeout,int interval,int major,int minor) -{ -int changed= 0; -XkbControlsRec old,*xkb; - - if ((!dev)||(!dev->key)||(!dev->key->xkbInfo)) - return 0; - xkb= dev->key->xkbInfo->desc->ctrls; - old= *xkb; - if ((timeout!=0) && (xkb->repeat_delay!=timeout)) { - xkb->repeat_delay= timeout; - changed++; - } - if ((interval!=0) && (xkb->repeat_interval!=interval)) { - xkb->repeat_interval= interval; - changed++; - } - if (changed) { - xkbControlsNotify cn; - XkbDDXChangeControls(dev,&old,xkb); - if (XkbComputeControlsNotify(dev,&old,xkb,&cn,False)) { - cn.keycode= 0; - cn.eventType = 0; - cn.requestMajor = major; - cn.requestMinor = minor; - XkbSendControlsNotify(dev,&cn); - } - } - return 1; -} - -int -XkbGetRepeatRate(DeviceIntPtr dev,int *timeout,int *interval) -{ -XkbControlsPtr xkb; - - if ((!dev)||(!dev->key)||(!dev->key->xkbInfo)) - return 0; - xkb= dev->key->xkbInfo->desc->ctrls; - if (timeout) *timeout= xkb->repeat_delay; - if (interval) *interval= xkb->repeat_interval; - return 1; -} - /***====================================================================***/ static int @@ -2748,7 +2701,7 @@ ProcXkbGetIndicatorState(ClientPtr client) /***====================================================================***/ -Status +static Status XkbComputeGetIndicatorMapReplySize( XkbIndicatorPtr indicators, xkbGetIndicatorMapReply *rep) @@ -2765,7 +2718,7 @@ int nIndicators; return Success; } -int +static int XkbSendIndicatorMap( ClientPtr client, XkbIndicatorPtr indicators, xkbGetIndicatorMapReply * rep) diff --git a/nx-X11/programs/Xserver/xkb/xkb.h b/nx-X11/programs/Xserver/xkb/xkb.h index 7bf3a9c61..19a93b20e 100644 --- a/nx-X11/programs/Xserver/xkb/xkb.h +++ b/nx-X11/programs/Xserver/xkb/xkb.h @@ -25,46 +25,7 @@ extern int ProcXkbGetDeviceInfo(ClientPtr client); extern int ProcXkbSetDeviceInfo(ClientPtr client); extern int ProcXkbSetDebuggingFlags(ClientPtr client); -extern int XkbSetRepeatRate(DeviceIntPtr dev, int timeout, int interval, int major, int minor); -extern int XkbGetRepeatRate(DeviceIntPtr dev, int *timeout, int *interval); extern void XkbExtensionInit(void); -extern Status XkbComputeGetIndicatorMapReplySize( - XkbIndicatorPtr indicators, - xkbGetIndicatorMapReply *rep); -extern int XkbSendIndicatorMap( - ClientPtr client, - XkbIndicatorPtr indicators, - xkbGetIndicatorMapReply *rep); - -extern void XkbComputeCompatState(XkbSrvInfoPtr xkbi); -extern void XkbSetPhysicalLockingKey(DeviceIntPtr dev, unsigned key); - extern Bool XkbFilterEvents(ClientPtr pClient, int nEvents, xEvent *xE); - -extern Bool XkbApplyLEDChangeToKeyboard( - XkbSrvInfoPtr xkbi, - XkbIndicatorMapPtr map, - Bool on, - XkbChangesPtr change); - -extern Bool XkbWriteRulesProp(ClientPtr client, void * closure); - -extern XkbAction XkbGetButtonAction(DeviceIntPtr kbd, DeviceIntPtr dev, int button); - -/* extern Status XkbMergeFile(XkbDescPtr xkb, XkbFileInfo finfo); */ - -extern Bool XkbDDXCompileNamedKeymap( - XkbDescPtr xkb, - XkbComponentNamesPtr names, - char * nameRtrn, - int nameRtrnLen); - -extern Bool XkbDDXCompileKeymapByNames( - XkbDescPtr xkb, - XkbComponentNamesPtr names, - unsigned want, - unsigned need, - char * nameRtrn, - int nameRtrnLen); diff --git a/nx-X11/programs/Xserver/xkb/xkbAccessX.c b/nx-X11/programs/Xserver/xkb/xkbAccessX.c index 4069ac209..cfd42334c 100644 --- a/nx-X11/programs/Xserver/xkb/xkbAccessX.c +++ b/nx-X11/programs/Xserver/xkb/xkbAccessX.c @@ -48,9 +48,9 @@ void * XkbLastRepeatEvent= NULL; unsigned short XkbDfltAccessXTimeout= 120; unsigned int XkbDfltAccessXTimeoutMask= DFLT_TIMEOUT_CTRLS; -unsigned int XkbDfltAccessXTimeoutValues= 0; -unsigned int XkbDfltAccessXTimeoutOptionsMask= DFLT_TIMEOUT_OPTS; -unsigned int XkbDfltAccessXTimeoutOptionsValues= 0; +static unsigned int XkbDfltAccessXTimeoutValues= 0; +static unsigned int XkbDfltAccessXTimeoutOptionsMask= DFLT_TIMEOUT_OPTS; +static unsigned int XkbDfltAccessXTimeoutOptionsValues= 0; unsigned int XkbDfltAccessXFeedback= XkbAccessXFeedbackMask; unsigned short XkbDfltAccessXOptions= XkbAX_AllOptionsMask & ~(XkbAX_IndicatorFBMask|XkbAX_SKReleaseFBMask|XkbAX_SKRejectFBMask); diff --git a/nx-X11/programs/Xserver/xkb/xkbActions.c b/nx-X11/programs/Xserver/xkb/xkbActions.c index 3dd09e08d..2bb41b928 100644 --- a/nx-X11/programs/Xserver/xkb/xkbActions.c +++ b/nx-X11/programs/Xserver/xkb/xkbActions.c @@ -40,9 +40,9 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <ctype.h> static unsigned int _xkbServerGeneration; -int xkbDevicePrivateIndex = -1; +static int xkbDevicePrivateIndex = -1; -void +static void xkbUnwrapProc(DeviceIntPtr device, DeviceHandleProc proc, void * data) { @@ -215,7 +215,7 @@ static XkbAction fake; return fake; } -XkbAction +static XkbAction XkbGetButtonAction(DeviceIntPtr kbd,DeviceIntPtr dev,int button) { XkbAction fake; diff --git a/nx-X11/programs/Xserver/xkb/xkbDflts.h b/nx-X11/programs/Xserver/xkb/xkbDflts.h index c3c28524b..575814baa 100644 --- a/nx-X11/programs/Xserver/xkb/xkbDflts.h +++ b/nx-X11/programs/Xserver/xkb/xkbDflts.h @@ -467,43 +467,6 @@ static XkbCompatMapRec compatMap= { 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 initIndicatorNames(DPYTYPE dpy,XkbDescPtr xkb) { diff --git a/nx-X11/programs/Xserver/xkb/xkbEvents.c b/nx-X11/programs/Xserver/xkb/xkbEvents.c index 60c26ff1f..d6408a699 100644 --- a/nx-X11/programs/Xserver/xkb/xkbEvents.c +++ b/nx-X11/programs/Xserver/xkb/xkbEvents.c @@ -321,7 +321,7 @@ Time time = 0; return; } -void +static void XkbSendIndicatorNotify(DeviceIntPtr kbd,int xkbType,xkbIndicatorNotify *pEv) { int initialized; @@ -961,48 +961,6 @@ XkbInterestPtr interest; } int -XkbRemoveClient(DevicePtr inDev,ClientPtr client) -{ -XkbSrvInfoPtr xkbi; -DeviceIntPtr dev = (DeviceIntPtr)inDev; -XkbInterestPtr interest; -unsigned long autoCtrls,autoValues; -Bool found; - - found= False; - autoCtrls= autoValues= 0; - if ( dev->xkb_interest ) { - interest = dev->xkb_interest; - if (interest && (interest->client==client)){ - dev->xkb_interest = interest->next; - autoCtrls= interest->autoCtrls; - autoValues= interest->autoCtrlValues; - _XkbFree(interest); - found= True; - } - while ((!found)&&(interest->next)) { - if (interest->next->client==client) { - XkbInterestPtr victim = interest->next; - interest->next = victim->next; - autoCtrls= victim->autoCtrls; - autoValues= victim->autoCtrlValues; - _XkbFree(victim); - found= True; - } - interest = interest->next; - } - } - if (found && autoCtrls && dev->key && dev->key->xkbInfo ) { - XkbEventCauseRec cause; - - xkbi= dev->key->xkbInfo; - XkbSetCauseXkbReq(&cause,X_kbPerClientFlags,client); - XkbEnableDisableControls(xkbi,autoCtrls,autoValues,NULL,&cause); - } - return found; -} - -int XkbRemoveResourceClient(DevicePtr inDev,XID id) { XkbSrvInfoPtr xkbi; diff --git a/nx-X11/programs/Xserver/xkb/xkbInit.c b/nx-X11/programs/Xserver/xkb/xkbInit.c index a6417afc4..f39e47a87 100644 --- a/nx-X11/programs/Xserver/xkb/xkbInit.c +++ b/nx-X11/programs/Xserver/xkb/xkbInit.c @@ -115,8 +115,7 @@ typedef struct _SrvXkmInfo { char * XkbBaseDirectory= XKB_BASE_DIRECTORY; char * XkbBinDirectory= XKB_BIN_DIRECTORY; -char * XkbInitialMap= NULL; -int XkbWantAccessX= 0; +static int XkbWantAccessX= 0; static XkbFileInfo * _XkbInitFileInfo= NULL; static Bool rulesDefined= False; @@ -126,20 +125,17 @@ static char * XkbLayoutDflt= NULL; static char * XkbVariantDflt= NULL; static char * XkbOptionsDflt= NULL; -char * XkbModelUsed= NULL; -char * XkbLayoutUsed= NULL; -char * XkbVariantUsed= NULL; -char * XkbOptionsUsed= NULL; +static char * XkbModelUsed= NULL; +static char * XkbLayoutUsed= NULL; +static char * XkbVariantUsed= NULL; +static char * XkbOptionsUsed= NULL; -int _XkbClientMajor= XkbMajorVersion; -int _XkbClientMinor= XkbMinorVersion; - -Bool noXkbExtension= XKB_DFLT_DISABLED; -Bool XkbWantRulesProp= XKB_DFLT_RULES_PROP; +Bool noXkbExtension= XKB_DFLT_DISABLED; +static Bool XkbWantRulesProp= XKB_DFLT_RULES_PROP; /***====================================================================***/ -char * +static char * XkbGetRulesDflts(XkbRF_VarDefsPtr defs) { if (XkbModelDflt) defs->model= XkbModelDflt; @@ -153,7 +149,7 @@ XkbGetRulesDflts(XkbRF_VarDefsPtr defs) return (rulesDefined?XkbRulesFile:XKB_DFLT_RULES_FILE); } -Bool +static Bool XkbWriteRulesProp(ClientPtr client, void * closure) { int len,out; @@ -222,7 +218,7 @@ char * pval; return True; } -void +static void XkbSetRulesUsed(XkbRF_VarDefsPtr defs) { if (XkbModelUsed) @@ -301,9 +297,6 @@ XkbSetRulesDflts(char *rulesFile,char *model,char *layout, #include "xkbDflts.h" -/* A dummy to keep the compiler quiet */ -void * xkbBogus = &indicators; - static Bool XkbInitKeyTypes(XkbDescPtr xkb,SrvXkmInfo *file) { @@ -503,35 +496,6 @@ XkbEventCauseRec cause; file.file=NULL; bzero(&file.xkbinfo,sizeof(XkbFileInfo)); bzero(&changes,sizeof(XkbChangesRec)); - if (XkbInitialMap!=NULL) { - if ((file.file=XkbDDXOpenConfigFile(XkbInitialMap,NULL,0))!=NULL) { - XkmReadFile(file.file,0,XkmKeymapLegal,&file.xkbinfo); - if (file.xkbinfo.xkb==NULL) { - LogMessage(X_ERROR, - "Error loading keymap file %s (%s in %s)\n" - "\treverting to defaults\n", - XkbInitialMap, _XkbErrMessages[_XkbErrCode], - (_XkbErrLocation?_XkbErrLocation:"unknown")); - 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 { - LogMessage(X_ERROR, "Error opening keymap file %s, reverting to defaults\n", - XkbInitialMap); - } - } pXDev->key->xkbInfo= xkbi= _XkbTypedCalloc(1,XkbSrvInfoRec); if ( xkbi ) { XkbDescPtr xkb; @@ -914,20 +878,6 @@ XkbProcessArguments(int argc,char *argv[],int i) return -1; } } - else if (strncmp(argv[i], "-xkbmap", 7) == 0) { - if(++i < argc) { - if (strlen(argv[i]) < PATH_MAX) { - XkbInitialMap= argv[i]; - return 2; - } else { - LogMessage(X_ERROR, "-xkbmap pathname too long\n"); - return -1; - } - } - else { - return -1; - } - } else if ((strncmp(argv[i],"-accessx",8)==0)|| (strncmp(argv[i],"+accessx",8)==0)) { int j=1; @@ -990,5 +940,4 @@ XkbUseMsg(void) ErrorF(" enable/disable accessx key sequences\n"); ErrorF("-ardelay set XKB autorepeat delay\n"); ErrorF("-arinterval set XKB autorepeat interval\n"); - ErrorF("-xkbmap XKB keyboard description to load on startup\n"); } diff --git a/nx-X11/programs/Xserver/xkb/xkbLEDs.c b/nx-X11/programs/Xserver/xkb/xkbLEDs.c index a93d69f3f..75e8ef3ff 100644 --- a/nx-X11/programs/Xserver/xkb/xkbLEDs.c +++ b/nx-X11/programs/Xserver/xkb/xkbLEDs.c @@ -90,7 +90,7 @@ XkbSrvLedInfoPtr sli; * when the indicator described by 'map' is turned on or off. The * extent of the changes is reported in change, which must be defined. */ -Bool +static Bool XkbApplyLEDChangeToKeyboard( XkbSrvInfoPtr xkbi, XkbIndicatorMapPtr map, Bool on, @@ -166,6 +166,161 @@ XkbStatePtr state; return (stateChange || ctrlChange); } + /* + * Bool + * ComputeAutoState(map,state,ctrls) + * + * This function reports the effect of applying the specified + * indicator map given the specified state and controls, as + * described in section 9.2 of the XKB protocol specification. + */ + +static Bool +ComputeAutoState( XkbIndicatorMapPtr map, + XkbStatePtr state, + XkbControlsPtr ctrls) +{ +Bool on; +CARD8 mods,group; + + on= False; + mods= group= 0; + if (map->which_mods&XkbIM_UseAnyMods) { + if (map->which_mods&XkbIM_UseBase) + mods|= state->base_mods; + if (map->which_mods&XkbIM_UseLatched) + mods|= state->latched_mods; + if (map->which_mods&XkbIM_UseLocked) + mods|= state->locked_mods; + if (map->which_mods&XkbIM_UseEffective) + mods|= state->mods; + if (map->which_mods&XkbIM_UseCompat) + mods|= state->compat_state; + on = ((map->mods.mask&mods)!=0); + on = on||((mods==0)&&(map->mods.mask==0)&&(map->mods.vmods==0)); + } + if (map->which_groups&XkbIM_UseAnyGroup) { + if (map->which_groups&XkbIM_UseBase) + group|= (1L << state->base_group); + if (map->which_groups&XkbIM_UseLatched) + group|= (1L << state->latched_group); + if (map->which_groups&XkbIM_UseLocked) + group|= (1L << state->locked_group); + if (map->which_groups&XkbIM_UseEffective) + group|= (1L << state->group); + on = on||(((map->groups&group)!=0)||(map->groups==0)); + } + if (map->ctrls) + on = on||(ctrls->enabled_ctrls&map->ctrls); + return on; +} + +static void +XkbUpdateLedAutoState( DeviceIntPtr dev, + XkbSrvLedInfoPtr sli, + unsigned maps_to_check, + xkbExtensionDeviceNotify * ed, + XkbChangesPtr changes, + XkbEventCausePtr cause) +{ +DeviceIntPtr kbd; +XkbStatePtr state; +XkbControlsPtr ctrls; +XkbChangesRec my_changes; +xkbExtensionDeviceNotify my_ed; +register unsigned i,bit,affected; +register XkbIndicatorMapPtr map; +unsigned oldState; + + if ((maps_to_check==0)||(sli->maps==NULL)||(sli->mapsPresent==0)) + return; + + if (dev->key && dev->key->xkbInfo) + kbd= dev; + else kbd= (DeviceIntPtr)LookupKeyboardDevice(); + + state= &kbd->key->xkbInfo->state; + ctrls= kbd->key->xkbInfo->desc->ctrls; + affected= maps_to_check; + oldState= sli->effectiveState; + sli->autoState&= ~affected; + for (i=0,bit=1;(i<XkbNumIndicators)&&(affected);i++,bit<<=1) { + if ((affected&bit)==0) + continue; + affected&= ~bit; + map= &sli->maps[i]; + if((!(map->flags&XkbIM_NoAutomatic))&&ComputeAutoState(map,state,ctrls)) + sli->autoState|= bit; + } + sli->effectiveState= (sli->autoState|sli->explicitState); + affected= sli->effectiveState^oldState; + if (affected==0) + return; + + if (ed==NULL) { + ed= &my_ed; + bzero((char *)ed,sizeof(xkbExtensionDeviceNotify)); + } + else if ((ed->reason&XkbXI_IndicatorsMask)&& + ((ed->ledClass!=sli->class)||(ed->ledID!=sli->id))) { + XkbFlushLedEvents(dev,kbd,sli,ed,changes,cause); + } + + if ((kbd==dev)&&(sli->flags&XkbSLI_IsDefault)) { + if (changes==NULL) { + changes= &my_changes; + bzero((char *)changes,sizeof(XkbChangesRec)); + } + changes->indicators.state_changes|= affected; + } + + ed->reason|= (XkbXI_IndicatorStateMask&(~XkbXIUnsupported)); + ed->ledClass= sli->class; + ed->ledID= sli->id; + ed->ledsDefined= sli->namesPresent|sli->mapsPresent; + ed->ledState= sli->effectiveState; + ed->unsupported|= XkbXIUnsupported&XkbXI_IndicatorStateMask; + ed->supported= XkbXI_AllFeaturesMask&(~XkbXIUnsupported); + + if (changes!=&my_changes) changes= NULL; + if (ed!=&my_ed) ed= NULL; + if (changes || ed) + XkbFlushLedEvents(dev,kbd,sli,ed,changes,cause); + return; +} + +static void +XkbUpdateAllDeviceIndicators(XkbChangesPtr changes,XkbEventCausePtr cause) +{ +DeviceIntPtr edev; +XkbSrvLedInfoPtr sli; + + for (edev=inputInfo.devices;edev!=NULL;edev=edev->next) { + if (edev->kbdfeed) { + KbdFeedbackPtr kf; + for (kf=edev->kbdfeed;kf!=NULL;kf=kf->next) { + if ((kf->xkb_sli==NULL)||(kf->xkb_sli->maps==NULL)) + continue; + sli= kf->xkb_sli; + XkbUpdateLedAutoState(edev,sli,sli->mapsPresent,NULL, + changes,cause); + } + } + if (edev->leds) { + LedFeedbackPtr lf; + for (lf=edev->leds;lf!=NULL;lf=lf->next) { + if ((lf->xkb_sli==NULL)||(lf->xkb_sli->maps==NULL)) + continue; + sli= lf->xkb_sli; + XkbUpdateLedAutoState(edev,sli,sli->mapsPresent,NULL, + changes,cause); + } + } + } + return; +} + + /***====================================================================***/ /* @@ -228,57 +383,6 @@ unsigned side_affected; /***====================================================================***/ /* - * Bool - * ComputeAutoState(map,state,ctrls) - * - * This function reports the effect of applying the specified - * indicator map given the specified state and controls, as - * described in section 9.2 of the XKB protocol specification. - */ - -static Bool -ComputeAutoState( XkbIndicatorMapPtr map, - XkbStatePtr state, - XkbControlsPtr ctrls) -{ -Bool on; -CARD8 mods,group; - - on= False; - mods= group= 0; - if (map->which_mods&XkbIM_UseAnyMods) { - if (map->which_mods&XkbIM_UseBase) - mods|= state->base_mods; - if (map->which_mods&XkbIM_UseLatched) - mods|= state->latched_mods; - if (map->which_mods&XkbIM_UseLocked) - mods|= state->locked_mods; - if (map->which_mods&XkbIM_UseEffective) - mods|= state->mods; - if (map->which_mods&XkbIM_UseCompat) - mods|= state->compat_state; - on = ((map->mods.mask&mods)!=0); - on = on||((mods==0)&&(map->mods.mask==0)&&(map->mods.vmods==0)); - } - if (map->which_groups&XkbIM_UseAnyGroup) { - if (map->which_groups&XkbIM_UseBase) - group|= (1L << state->base_group); - if (map->which_groups&XkbIM_UseLatched) - group|= (1L << state->latched_group); - if (map->which_groups&XkbIM_UseLocked) - group|= (1L << state->locked_group); - if (map->which_groups&XkbIM_UseEffective) - group|= (1L << state->group); - on = on||(((map->groups&group)!=0)||(map->groups==0)); - } - if (map->ctrls) - on = on||(ctrls->enabled_ctrls&map->ctrls); - return on; -} - -/***====================================================================***/ - - /* * void * XkbUpdateIndicators(dev,update,check_edevs,changes,cause) * @@ -313,39 +417,6 @@ XkbSrvLedInfoPtr sli; /***====================================================================***/ -void -XkbUpdateAllDeviceIndicators(XkbChangesPtr changes,XkbEventCausePtr cause) -{ -DeviceIntPtr edev; -XkbSrvLedInfoPtr sli; - - for (edev=inputInfo.devices;edev!=NULL;edev=edev->next) { - if (edev->kbdfeed) { - KbdFeedbackPtr kf; - for (kf=edev->kbdfeed;kf!=NULL;kf=kf->next) { - if ((kf->xkb_sli==NULL)||(kf->xkb_sli->maps==NULL)) - continue; - sli= kf->xkb_sli; - XkbUpdateLedAutoState(edev,sli,sli->mapsPresent,NULL, - changes,cause); - - } - } - if (edev->leds) { - LedFeedbackPtr lf; - for (lf=edev->leds;lf!=NULL;lf=lf->next) { - if ((lf->xkb_sli==NULL)||(lf->xkb_sli->maps==NULL)) - continue; - sli= lf->xkb_sli; - XkbUpdateLedAutoState(edev,sli,sli->mapsPresent,NULL, - changes,cause); - - } - } - } - return; -} - /***====================================================================***/ /* @@ -857,208 +928,3 @@ Bool kb_changed; } /***====================================================================***/ - -void -XkbUpdateLedAutoState( DeviceIntPtr dev, - XkbSrvLedInfoPtr sli, - unsigned maps_to_check, - xkbExtensionDeviceNotify * ed, - XkbChangesPtr changes, - XkbEventCausePtr cause) -{ -DeviceIntPtr kbd; -XkbStatePtr state; -XkbControlsPtr ctrls; -XkbChangesRec my_changes; -xkbExtensionDeviceNotify my_ed; -register unsigned i,bit,affected; -register XkbIndicatorMapPtr map; -unsigned oldState; - - if ((maps_to_check==0)||(sli->maps==NULL)||(sli->mapsPresent==0)) - return; - - if (dev->key && dev->key->xkbInfo) - kbd= dev; - else kbd= (DeviceIntPtr)LookupKeyboardDevice(); - - state= &kbd->key->xkbInfo->state; - ctrls= kbd->key->xkbInfo->desc->ctrls; - affected= maps_to_check; - oldState= sli->effectiveState; - sli->autoState&= ~affected; - for (i=0,bit=1;(i<XkbNumIndicators)&&(affected);i++,bit<<=1) { - if ((affected&bit)==0) - continue; - affected&= ~bit; - map= &sli->maps[i]; - if((!(map->flags&XkbIM_NoAutomatic))&&ComputeAutoState(map,state,ctrls)) - sli->autoState|= bit; - } - sli->effectiveState= (sli->autoState|sli->explicitState); - affected= sli->effectiveState^oldState; - if (affected==0) - return; - - if (ed==NULL) { - ed= &my_ed; - bzero((char *)ed,sizeof(xkbExtensionDeviceNotify)); - } - else if ((ed->reason&XkbXI_IndicatorsMask)&& - ((ed->ledClass!=sli->class)||(ed->ledID!=sli->id))) { - XkbFlushLedEvents(dev,kbd,sli,ed,changes,cause); - } - - if ((kbd==dev)&&(sli->flags&XkbSLI_IsDefault)) { - if (changes==NULL) { - changes= &my_changes; - bzero((char *)changes,sizeof(XkbChangesRec)); - } - changes->indicators.state_changes|= affected; - } - - ed->reason|= (XkbXI_IndicatorStateMask&(~XkbXIUnsupported)); - ed->ledClass= sli->class; - ed->ledID= sli->id; - ed->ledsDefined= sli->namesPresent|sli->mapsPresent; - ed->ledState= sli->effectiveState; - ed->unsupported|= XkbXIUnsupported&XkbXI_IndicatorStateMask; - ed->supported= XkbXI_AllFeaturesMask&(~XkbXIUnsupported); - - if (changes!=&my_changes) changes= NULL; - if (ed!=&my_ed) ed= NULL; - if (changes || ed) - XkbFlushLedEvents(dev,kbd,sli,ed,changes,cause); - return; -} - -/***====================================================================***/ - -static void -_UpdateButtonVMods( XkbDescPtr xkb, - unsigned num_btns, - XkbAction * acts, - unsigned changed, - xkbExtensionDeviceNotify * ed_inout) -{ -register int i; - - for (i=0;i<num_btns;i++,acts++) { - if ((acts->any.type!=XkbSA_NoAction)&& - XkbUpdateActionVirtualMods(xkb,acts,changed)) { - if ((ed_inout->reason&XkbXI_ButtonActionsMask)==0) { - ed_inout->reason|= XkbXI_ButtonActionsMask; - ed_inout->firstBtn= i; - ed_inout->nBtns= 1; - } - else { - ed_inout->nBtns= (i-ed_inout->firstBtn)+1; - } - } - } - return; -} - -static void -_UpdateMapVMods( XkbDescPtr xkb, - register XkbIndicatorMapPtr map, - unsigned changed_vmods, - unsigned * changed_maps_rtrn) -{ -register int i; - - *changed_maps_rtrn= 0; - for (i=0;i<XkbNumIndicators;i++,map++) { - if (map->mods.vmods&changed_vmods) { - map->mods.mask= map->mods.real_mods; - map->mods.mask|= XkbMaskForVMask(xkb,map->mods.vmods); - *changed_maps_rtrn|= (1L<<i); - } - } - return; -} - -static void -_UpdateDeviceVMods( DeviceIntPtr dev, - XkbDescPtr xkb, - unsigned changed, - XkbEventCausePtr cause) -{ -xkbExtensionDeviceNotify ed; -XkbSrvLedInfoPtr sli; -unsigned changed_maps; - - bzero((char *)&ed,sizeof(xkbExtensionDeviceNotify)); - ed.deviceID= dev->id; - if ((dev->button)&&(dev->button->xkb_acts)) { - _UpdateButtonVMods(xkb,dev->button->numButtons, - dev->button->xkb_acts,changed,&ed); - } - if (dev->kbdfeed) { - KbdFeedbackPtr kf; - for (kf=dev->kbdfeed;kf!=NULL;kf=kf->next) { - if ((kf->xkb_sli==NULL)||(kf->xkb_sli->maps==NULL)) - continue; - sli= kf->xkb_sli; - _UpdateMapVMods(xkb,sli->maps,changed,&changed_maps); - if (changed_maps) { - if (ed.reason&XkbXI_IndicatorsMask) { - XkbSendExtensionDeviceNotify(dev,NULL,&ed); - ed.reason= 0; - ed.firstBtn= ed.nBtns; - } - ed.ledClass= sli->class; - ed.ledID= sli->id; - ed.ledsDefined= sli->namesPresent|sli->mapsPresent; - ed.reason|= XkbXI_IndicatorMapsMask; - XkbUpdateLedAutoState(dev,sli,changed_maps,&ed,NULL,cause); - } - } - } - if (dev->leds) { - LedFeedbackPtr lf; - for (lf=dev->leds;lf!=NULL;lf=lf->next) { - if ((lf->xkb_sli==NULL)||(lf->xkb_sli->maps==NULL)) - continue; - sli= lf->xkb_sli; - _UpdateMapVMods(xkb,sli->maps,changed,&changed_maps); - if (changed_maps) { - if (ed.reason&XkbXI_IndicatorsMask) { - XkbSendExtensionDeviceNotify(dev,NULL,&ed); - ed.reason= 0; - ed.firstBtn= ed.nBtns; - } - ed.ledClass= sli->class; - ed.ledID= sli->id; - ed.ledsDefined= sli->namesPresent|sli->mapsPresent; - ed.reason|= XkbXI_IndicatorMapsMask; - XkbUpdateLedAutoState(dev,sli,changed_maps,&ed,NULL,cause); - } - } - } - if (ed.reason!=0) - XkbSendExtensionDeviceNotify(dev,NULL,&ed); - return; -} - -void -XkbApplyVModChangesToAllDevices( DeviceIntPtr dev, - XkbDescPtr xkb, - unsigned changed, - XkbEventCausePtr cause) -{ -DeviceIntPtr edev; - if (dev!=(DeviceIntPtr)LookupKeyboardDevice()) - return; - for (edev=inputInfo.devices;edev!=NULL;edev=edev->next) { - if (edev->key) - continue; - _UpdateDeviceVMods(edev,xkb,changed,cause); - } - for (edev=inputInfo.off_devices;edev!=NULL;edev=edev->next) { - if (edev->key) - continue; - _UpdateDeviceVMods(edev,xkb,changed,cause); - } - return; -} diff --git a/nx-X11/programs/Xserver/xkb/xkbUtils.c b/nx-X11/programs/Xserver/xkb/xkbUtils.c index 4adcc878d..bf88458be 100644 --- a/nx-X11/programs/Xserver/xkb/xkbUtils.c +++ b/nx-X11/programs/Xserver/xkb/xkbUtils.c @@ -175,44 +175,6 @@ register unsigned mask; return mask; } - -Bool -XkbApplyVModChanges( XkbSrvInfoPtr xkbi, - unsigned changed, - XkbChangesPtr changes, - unsigned * needChecksRtrn, - XkbEventCausePtr cause) -{ -XkbDescPtr xkb; -Bool check; - - xkb= xkbi->desc; -#ifdef DEBUG -{ -register unsigned i,bit; - for (i=0,bit=1;i<XkbNumVirtualMods;i++,bit<<=1) { - if ((changed&bit)==0) - continue; - if (xkbDebugFlags) - ErrorF("Should be applying: change vmod %d to 0x%x\n",i, - xkb->server->vmods[i]); - } -} -#endif - check= XkbApplyVirtualModChanges(xkb,changed,changes); - XkbApplyVModChangesToAllDevices(xkbi->device,xkb,changed,cause); - - if (needChecksRtrn!=NULL) { - if (check) - *needChecksRtrn= XkbStateNotifyMask|XkbIndicatorStateNotifyMask; - else *needChecksRtrn= 0; - } - else if (check) { - /* 7/12/95 (ef) -- XXX check compatibility and/or indicator state */ - } - return 1; -} - /***====================================================================***/ void @@ -781,21 +743,6 @@ XkbCheckSecondaryEffects( XkbSrvInfoPtr xkbi, /***====================================================================***/ -void -XkbSetPhysicalLockingKey(DeviceIntPtr dev,unsigned key) -{ -XkbDescPtr xkb; - - xkb= dev->key->xkbInfo->desc; - if ((key>=xkb->min_key_code) && (key<=xkb->max_key_code)) { - xkb->server->behaviors[key].type= XkbKB_Lock|XkbKB_Permanent; - } - else ErrorF("Internal Error! Bad XKB info in SetPhysicalLockingKey\n"); - return; -} - -/***====================================================================***/ - Bool XkbEnableDisableControls( XkbSrvInfoPtr xkbi, unsigned long change, @@ -859,26 +806,6 @@ XkbDescPtr xkb= xkbi->desc; } if ((xkb->geom!=NULL)&&(xkb->geom->name==name)) return xkb->geom; - else if ((name==xkb->names->geometry)&&(xkb->geom==NULL)) { - FILE *file= XkbDDXOpenConfigFile(XkbInitialMap,NULL,0); - if (file!=NULL) { - XkbFileInfo xkbFInfo; - xkmFileInfo finfo; - xkmSectionInfo toc[MAX_TOC],*entry; - bzero(&xkbFInfo,sizeof(xkbFInfo)); - xkbFInfo.xkb= xkb; - if (XkmReadTOC(file,&finfo,MAX_TOC,toc)) { - entry= XkmFindTOCEntry(&finfo,toc,XkmGeometryIndex); - if (entry!=NULL) - XkmReadFileSection(file,entry,&xkbFInfo,NULL); - } - fclose(file); - if (xkb->geom) { - *shouldFree= 0; - return xkb->geom; - } - } - } *shouldFree= 1; return NULL; } diff --git a/nx-X11/programs/Xserver/xkb/xkbconfig.c b/nx-X11/programs/Xserver/xkb/xkbconfig.c deleted file mode 100644 index 0e320ca20..000000000 --- a/nx-X11/programs/Xserver/xkb/xkbconfig.c +++ /dev/null @@ -1,1341 +0,0 @@ -/************************************************************ - 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. - - ********************************************************/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#elif defined(HAVE_CONFIG_H) -#include <config.h> -#endif - -#include <stdio.h> -#include <ctype.h> -#include <stdlib.h> - -#include <nx-X11/Xfuncs.h> - -#include <nx-X11/Xfuncs.h> - - -#include <nx-X11/X.h> -#include <nx-X11/keysym.h> -#include <nx-X11/Xproto.h> -#include "misc.h" -#include "inputstr.h" -#include "dix.h" -#include <xkbsrv.h> - -#include <nx-X11/extensions/XKBconfig.h> - -#ifdef NEED_STRCASECMP -extern int _XkbStrCaseCmp(char *s1, char *s2); -#else -#define _XkbStrCaseCmp strcasecmp -#endif - -/***====================================================================***/ - -#define XKBCF_MAX_STR_LEN 100 -static char _XkbCF_rtrn[XKBCF_MAX_STR_LEN+1]; - -static int -ScanIdent(FILE *file,int ch,XkbCFScanResultPtr val_rtrn) -{ -register int i; -char * str; - - val_rtrn->str= str= _XkbCF_rtrn; - for (i=0;(isalpha(ch)||isdigit(ch)||(ch=='_'));ch=getc(file)) { - if (i<XKBCF_MAX_STR_LEN) - str[i++]= ch; - } - if ((ch!=EOF)&&(ch!=' ')&&(ch!='\t')) - ungetc(ch,file); - str[i]= '\0'; - return XkbCF_Ident; -} - -static int -ScanString(FILE *file,int quote,XkbCFScanResultPtr val_rtrn) -{ -int ch,nInBuf; - - nInBuf = 0; - while ( ((ch=getc(file))!=EOF) && (ch!='\n') && (ch!=quote) ) { - if ( ch == '\\' ) { - if ((ch = getc(file))!=EOF) { - if ( ch=='n' ) ch = '\n'; - else if ( ch == 't' ) ch = '\t'; - else if ( ch == 'v' ) ch = '\v'; - else if ( ch == 'b' ) ch = '\b'; - else if ( ch == 'r' ) ch = '\r'; - else if ( ch == 'f' ) ch = '\f'; - else if ( ch == 'e' ) ch = '\033'; - else if ( ch == '0' ) { - int tmp,stop; - ch = stop = 0; - if (((tmp=getc(file))!=EOF) && (isdigit(tmp)) && - (tmp!='8') && (tmp!='9')) { - ch= (ch*8)+(tmp-'0'); - } - else { - stop= 1; - ungetc(tmp,file); - } - if ((!stop) && ((tmp=getc(file))!=EOF) && (isdigit(tmp)) && - (tmp!='8') && (tmp!='9')) { - ch= (ch*8)+(tmp-'0'); - } - else { - stop= 1; - ungetc(tmp,file); - } - if ((!stop) && ((tmp=getc(file))!=EOF) && (isdigit(tmp)) && - (tmp!='8') && (tmp!='9')) { - ch= (ch*8)+(tmp-'0'); - } - else { - stop= 1; - ungetc(tmp,file); - } - } - } - else return XkbCF_EOF; - } - - if ( nInBuf < XKBCF_MAX_STR_LEN-1 ) - _XkbCF_rtrn[nInBuf++] = ch; - } - if ( ch == quote ) { - _XkbCF_rtrn[nInBuf++] = '\0'; - val_rtrn->str= _XkbCF_rtrn; - return XkbCF_String; - } - return XkbCF_UnterminatedString; -} - -static int -ScanInteger(FILE *file,int ch,XkbCFScanResultPtr val_rtrn) -{ -int i; - - if (isdigit(ch)) - ungetc(ch,file); - if (fscanf(file,"%i",&i)==1) { - val_rtrn->ival= i; - return XkbCF_Integer; - } - return XkbCF_Unknown; -} - -int -XkbCFScan(FILE *file,XkbCFScanResultPtr val_rtrn,XkbConfigRtrnPtr rtrn) -{ -int ch; - - do { - ch= getc(file); - } while ((ch=='\t')||(ch==' ')); - if (isalpha(ch)) - return ScanIdent(file,ch,val_rtrn); - else if (isdigit(ch)) - return ScanInteger(file,ch,val_rtrn); - else if (ch=='"') - return ScanString(file,ch,val_rtrn); - else if (ch=='\n') { - rtrn->line++; - return XkbCF_EOL; - } - else if (ch==';') - return XkbCF_Semi; - else if (ch=='=') - return XkbCF_Equals; - else if (ch=='+') { - ch= getc(file); - if (ch=='=') - return XkbCF_PlusEquals; - if ((ch!=EOF)&&(ch!=' ')&&(ch!='\t')) - ungetc(ch,file); - return XkbCF_Plus; - } - else if (ch=='-') { - ch= getc(file); - if (ch=='=') - return XkbCF_MinusEquals; - if ((ch!=EOF)&&(ch!=' ')&&(ch!='\t')) - ungetc(ch,file); - return XkbCF_Minus; - } - else if (ch==EOF) - return XkbCF_EOF; - else if ((ch=='#')||((ch=='/')&&(getc(file)=='/'))) { - while ((ch!='\n')&&(ch!=EOF)) - ch= getc(file); - rtrn->line++; - return XkbCF_EOL; - } - return XkbCF_Unknown; -} - -/***====================================================================***/ - -#define _XkbCF_Illegal 0 -#define _XkbCF_Keymap 1 -#define _XkbCF_Keycodes 2 -#define _XkbCF_Geometry 3 -#define _XkbCF_PhysSymbols 4 -#define _XkbCF_Symbols 5 -#define _XkbCF_Types 6 -#define _XkbCF_CompatMap 7 - -#define _XkbCF_RulesFile 8 -#define _XkbCF_Model 9 -#define _XkbCF_Layout 10 -#define _XkbCF_Variant 11 -#define _XkbCF_Options 12 - -#define _XkbCF_InitialMods 13 -#define _XkbCF_InitialCtrls 14 - -#define _XkbCF_ClickVolume 15 -#define _XkbCF_BellVolume 16 -#define _XkbCF_BellPitch 17 -#define _XkbCF_BellDuration 18 -#define _XkbCF_RepeatDelay 19 -#define _XkbCF_RepeatInterval 20 -#define _XkbCF_SlowKeysDelay 21 -#define _XkbCF_DebounceDelay 22 -#define _XkbCF_MouseKeysDelay 23 -#define _XkbCF_MouseKeysInterval 24 -#define _XkbCF_MouseKeysTimeToMax 25 -#define _XkbCF_MouseKeysMaxSpeed 26 -#define _XkbCF_MouseKeysCurve 27 -#define _XkbCF_AccessXTimeout 28 -#define _XkbCF_AccessXTimeoutCtrlsOn 29 -#define _XkbCF_AccessXTimeoutCtrlsOff 30 -#define _XkbCF_AccessXTimeoutOptsOn 31 -#define _XkbCF_AccessXTimeoutOptsOff 32 - -#define _XkbCF_IgnoreLockMods 33 -#define _XkbCF_IgnoreGroupLock 34 -#define _XkbCF_InternalMods 35 - -#define _XkbCF_GroupsWrap 36 -#define _XkbCF_InitialFeedback 37 - -static Bool -AddCtrlByName(XkbConfigRtrnPtr rtrn,char *name,unsigned long *ctrls_rtrn) -{ - if ((_XkbStrCaseCmp(name,"repeat")==0)|| - (_XkbStrCaseCmp(name,"repeatkeys")==0)) - *ctrls_rtrn= XkbRepeatKeysMask; - else if (_XkbStrCaseCmp(name,"slowkeys")==0) - *ctrls_rtrn= XkbSlowKeysMask; - else if (_XkbStrCaseCmp(name,"bouncekeys")==0) - *ctrls_rtrn= XkbBounceKeysMask; - else if (_XkbStrCaseCmp(name,"stickykeys")==0) - *ctrls_rtrn= XkbStickyKeysMask; - else if (_XkbStrCaseCmp(name,"mousekeys")==0) - *ctrls_rtrn= XkbMouseKeysMask; - else if (_XkbStrCaseCmp(name,"mousekeysaccel")==0) - *ctrls_rtrn= XkbMouseKeysAccelMask; - else if (_XkbStrCaseCmp(name,"accessxkeys")==0) - *ctrls_rtrn= XkbAccessXKeysMask; - else if (_XkbStrCaseCmp(name,"accessxtimeout")==0) - *ctrls_rtrn= XkbAccessXTimeoutMask; - else if (_XkbStrCaseCmp(name,"accessxfeedback")==0) - *ctrls_rtrn= XkbAccessXFeedbackMask; - else if (_XkbStrCaseCmp(name,"audiblebell")==0) - *ctrls_rtrn= XkbAudibleBellMask; - else if (_XkbStrCaseCmp(name,"overlay1")==0) - *ctrls_rtrn= XkbOverlay1Mask; - else if (_XkbStrCaseCmp(name,"overlay2")==0) - *ctrls_rtrn= XkbOverlay2Mask; - else if (_XkbStrCaseCmp(name,"ignoregrouplock")==0) - *ctrls_rtrn= XkbIgnoreGroupLockMask; - else { - rtrn->error= XkbCF_ExpectedControl; - return False; - } - return True; -} - -static Bool -AddAXTimeoutOptByName( XkbConfigRtrnPtr rtrn, - char * name, - unsigned short * opts_rtrn) -{ - if (_XkbStrCaseCmp(name,"slowkeyspress")==0) - *opts_rtrn= XkbAX_SKPressFBMask; - else if (_XkbStrCaseCmp(name,"slowkeysaccept")==0) - *opts_rtrn= XkbAX_SKAcceptFBMask; - else if (_XkbStrCaseCmp(name,"feature")==0) - *opts_rtrn= XkbAX_FeatureFBMask; - else if (_XkbStrCaseCmp(name,"slowwarn")==0) - *opts_rtrn= XkbAX_SlowWarnFBMask; - else if (_XkbStrCaseCmp(name,"indicator")==0) - *opts_rtrn= XkbAX_IndicatorFBMask; - else if (_XkbStrCaseCmp(name,"stickykeys")==0) - *opts_rtrn= XkbAX_StickyKeysFBMask; - else if (_XkbStrCaseCmp(name,"twokeys")==0) - *opts_rtrn= XkbAX_TwoKeysMask; - else if (_XkbStrCaseCmp(name,"latchtolock")==0) - *opts_rtrn= XkbAX_LatchToLockMask; - else if (_XkbStrCaseCmp(name,"slowkeysrelease")==0) - *opts_rtrn= XkbAX_SKReleaseFBMask; - else if (_XkbStrCaseCmp(name,"slowkeysreject")==0) - *opts_rtrn= XkbAX_SKRejectFBMask; - else if (_XkbStrCaseCmp(name,"bouncekeysreject")==0) - *opts_rtrn= XkbAX_BKRejectFBMask; - else if (_XkbStrCaseCmp(name,"dumbbell")==0) - *opts_rtrn= XkbAX_DumbBellFBMask; - else { - rtrn->error= XkbCF_ExpectedControl; - return False; - } - return True; -} - -XkbConfigUnboundModPtr -XkbCFAddModByName( XkbConfigRtrnPtr rtrn, - int what, - char * name, - Bool merge, - XkbConfigUnboundModPtr last) -{ - if (rtrn->num_unbound_mods>=rtrn->sz_unbound_mods) { - rtrn->sz_unbound_mods+= 5; - rtrn->unbound_mods= _XkbTypedRealloc(rtrn->unbound_mods, - rtrn->sz_unbound_mods, - XkbConfigUnboundModRec); - if (rtrn->unbound_mods==NULL) { - rtrn->error= XkbCF_BadAlloc; - return False; - } - } - if (last==NULL) { - last= &rtrn->unbound_mods[rtrn->num_unbound_mods++]; - last->what= what; - last->mods= 0; - last->vmods= 0; - last->merge= merge; - last->name= NULL; - } - if (_XkbStrCaseCmp(name,"shift")==0) - last->mods|= ShiftMask; - else if (_XkbStrCaseCmp(name,"lock")==0) - last->mods|= LockMask; - else if ((_XkbStrCaseCmp(name,"control")==0)|| - (_XkbStrCaseCmp(name,"ctrl")==0)) - last->mods|= ControlMask; - else if (_XkbStrCaseCmp(name,"mod1")==0) - last->mods|= Mod1Mask; - else if (_XkbStrCaseCmp(name,"mod2")==0) - last->mods|= Mod2Mask; - else if (_XkbStrCaseCmp(name,"mod3")==0) - last->mods|= Mod3Mask; - else if (_XkbStrCaseCmp(name,"mod4")==0) - last->mods|= Mod4Mask; - else if (_XkbStrCaseCmp(name,"mod5")==0) - last->mods|= Mod5Mask; - else { - if (last->name!=NULL) { - last= &rtrn->unbound_mods[rtrn->num_unbound_mods++]; - last->what= what; - last->mods= 0; - last->vmods= 0; - last->merge= merge; - last->name= NULL; - } - last->name= Xstrdup(name); - } - return last; -} - -int -XkbCFBindMods(XkbConfigRtrnPtr rtrn,XkbDescPtr xkb) -{ -register int n,v; -Atom name; -XkbConfigUnboundModPtr mod; -int missing; - - if (rtrn->num_unbound_mods<1) - return 0; - if ((xkb==NULL) || (xkb->names==NULL)) - return -1; - - missing= 0; - for (n=0,mod=rtrn->unbound_mods;n<rtrn->num_unbound_mods;n++,mod++) { - if (mod->name!=NULL) { - name= XkbInternAtom(xkb->dpy,mod->name,True); - if (name==None) - continue; - for (v=0;v<XkbNumVirtualMods;v++) { - if (xkb->names->vmods[v]==name) { - mod->vmods= (1<<v); - _XkbFree(mod->name); - mod->name= NULL; - break; - } - } - if (mod->name!=NULL) - missing++; - } - } - return missing; -} - -Bool -XkbCFApplyMods(XkbConfigRtrnPtr rtrn,int what,XkbConfigModInfoPtr info) -{ -register int n; -XkbConfigUnboundModPtr mod; - - if (rtrn->num_unbound_mods<1) - return True; - - for (n=0,mod=rtrn->unbound_mods;n<rtrn->num_unbound_mods;n++,mod++) { - if (mod->what!=what) - continue; - if (mod->merge==XkbCF_MergeRemove) { - info->mods_clear|= mod->mods; - info->vmods_clear|= mod->vmods; - } - else { - if (mod->merge==XkbCF_MergeSet) - info->replace= True; - info->mods|= mod->mods; - info->vmods|= mod->vmods; - } - if (mod->name==NULL) { - mod->what= _XkbCF_Illegal; - } - else { - mod->mods= 0; - mod->vmods= 0; - } - } - return True; -} - -/*ARGSUSED*/ -static Bool -DefaultParser( FILE * file, - XkbConfigFieldsPtr fields, - XkbConfigFieldPtr field, - XkbDescPtr xkb, - XkbConfigRtrnPtr rtrn) -{ -int tok; -XkbCFScanResultRec val; -char ** str; -int merge; -unsigned long * ctrls, ctrls_mask; -unsigned short * opts, opts_mask; -int * pival, sign; -int onoff; -XkbConfigUnboundModPtr last; -unsigned what; - - tok= XkbCFScan(file,&val,rtrn); - str= NULL; - onoff= 0; - pival= NULL; - switch (field->field_id) { - case _XkbCF_RulesFile: if (!str) str= &rtrn->rules_file; - case _XkbCF_Model: if (!str) str= &rtrn->model; - case _XkbCF_Layout: if (!str) str= &rtrn->layout; - case _XkbCF_Variant: if (!str) str= &rtrn->variant; - case _XkbCF_Options: if (!str) str= &rtrn->options; - case _XkbCF_Keymap: if (!str) str= &rtrn->keymap; - case _XkbCF_Keycodes: if (!str) str= &rtrn->keycodes; - case _XkbCF_Geometry: if (!str) str= &rtrn->geometry; - case _XkbCF_PhysSymbols:if (!str) str= &rtrn->phys_symbols; - case _XkbCF_Symbols: if (!str) str= &rtrn->symbols; - case _XkbCF_Types: if (!str) str= &rtrn->types; - case _XkbCF_CompatMap: if (!str) str= &rtrn->compat; - if (tok!=XkbCF_Equals) { - rtrn->error= XkbCF_MissingEquals; - goto BAILOUT; - } - tok= XkbCFScan(file,&val,rtrn); - if ((tok!=XkbCF_String)&&(tok!=XkbCF_Ident)) { - rtrn->error= XkbCF_ExpectedString; - return False; - } - tok= XkbCFScan(file,&val,rtrn); - if ((tok!=XkbCF_EOL)&&(tok!=XkbCF_Semi)&&(tok!=XkbCF_EOF)) { - rtrn->error= XkbCF_ExpectedEOS; - return False; - } - if (*str!=NULL) - _XkbFree(*str); - *str= Xstrdup(val.str); - break; - case _XkbCF_InitialMods: - case _XkbCF_IgnoreLockMods: - case _XkbCF_InternalMods: - what= XkbCF_InitialMods; - if (field->field_id==_XkbCF_InitialMods) - rtrn->defined|= (what=XkbCF_InitialMods); - else if (field->field_id==_XkbCF_InternalMods) - rtrn->defined|= (what=XkbCF_InternalMods); - else if (field->field_id==_XkbCF_IgnoreLockMods) - rtrn->defined|= (what=XkbCF_IgnoreLockMods); - if (tok==XkbCF_Equals) merge= XkbCF_MergeSet; - else if (tok==XkbCF_MinusEquals) merge= XkbCF_MergeRemove; - else if (tok==XkbCF_PlusEquals) merge= XkbCF_MergeAdd; - else { - rtrn->error= XkbCF_MissingEquals; - goto BAILOUT; - } - tok= XkbCFScan(file,&val,rtrn); - if ((tok==XkbCF_EOL)||(tok==XkbCF_Semi)||(tok==XkbCF_EOF)) { - rtrn->error= XkbCF_ExpectedModifier; - return False; - } - last= NULL; - while ((tok!=XkbCF_EOL)&&(tok!=XkbCF_Semi)&&(tok!=XkbCF_EOF)) { - if ((tok!=XkbCF_Ident)&&(tok!=XkbCF_String)) { - rtrn->error= XkbCF_ExpectedModifier; - return False; - } - last=XkbCFAddModByName(rtrn,what,val.str,merge,last); - if (last==NULL) - return False; - if (merge==XkbCF_MergeSet) - merge= XkbCF_MergeAdd; - tok= XkbCFScan(file,&val,rtrn); - if ((tok!=XkbCF_EOL)&&(tok!=XkbCF_EOF)&&(tok!=XkbCF_Semi)) { - if (tok!=XkbCF_Plus) { - rtrn->error= XkbCF_ExpectedOperator; - return False; - } - tok= XkbCFScan(file,&val,rtrn); - } - } - break; - case _XkbCF_InitialCtrls: - rtrn->defined|= XkbCF_InitialCtrls; - ctrls= NULL; - if (tok==XkbCF_PlusEquals) - ctrls= &rtrn->initial_ctrls; - else if (tok==XkbCF_MinusEquals) - ctrls= &rtrn->initial_ctrls_clear; - else if (tok==XkbCF_Equals) { - ctrls= &rtrn->initial_ctrls; - rtrn->replace_initial_ctrls= True; - *ctrls= 0; - } - else { - rtrn->error= XkbCF_MissingEquals; - goto BAILOUT; - } - tok= XkbCFScan(file,&val,rtrn); - if ((tok==XkbCF_EOL)||(tok==XkbCF_Semi)||(tok==XkbCF_EOF)) { - rtrn->error= XkbCF_ExpectedControl; - return False; - } - while ((tok!=XkbCF_EOL)&&(tok!=XkbCF_Semi)&&(tok!=XkbCF_EOF)) { - if ((tok!=XkbCF_Ident)&&(tok!=XkbCF_String)) { - rtrn->error= XkbCF_ExpectedControl; - return False; - } - if (!AddCtrlByName(rtrn,val.str,&ctrls_mask)) { - return False; - } - *ctrls |= ctrls_mask; - tok= XkbCFScan(file,&val,rtrn); - if ((tok!=XkbCF_EOL)&&(tok!=XkbCF_EOF)&&(tok!=XkbCF_Semi)) { - if (tok!=XkbCF_Plus) { - rtrn->error= XkbCF_ExpectedOperator; - return False; - } - tok= XkbCFScan(file,&val,rtrn); - } - } - break; - case _XkbCF_AccessXTimeoutCtrlsOn: - case _XkbCF_AccessXTimeoutCtrlsOff: - opts= NULL; - if (tok==XkbCF_MinusEquals) { - ctrls= &rtrn->axt_ctrls_ignore; - opts= &rtrn->axt_opts_ignore; - } - else if ((tok==XkbCF_PlusEquals)||(tok==XkbCF_Equals)) { - if (field->field_id==_XkbCF_AccessXTimeoutCtrlsOff) { - ctrls= &rtrn->axt_ctrls_off; - opts= &rtrn->axt_opts_off; - if (tok==XkbCF_Equals) - rtrn->replace_axt_ctrls_off= True; - } - else { - ctrls= &rtrn->axt_ctrls_on; - opts= &rtrn->axt_opts_on; - if (tok==XkbCF_Equals) - rtrn->replace_axt_ctrls_on= True; - } - *ctrls= 0; - } - else { - rtrn->error= XkbCF_MissingEquals; - goto BAILOUT; - } - tok= XkbCFScan(file,&val,rtrn); - if ((tok==XkbCF_EOL)||(tok==XkbCF_Semi)||(tok==XkbCF_EOF)) { - rtrn->error= XkbCF_ExpectedControl; - return False; - } - while ((tok!=XkbCF_EOL)&&(tok!=XkbCF_Semi)&&(tok!=XkbCF_EOF)) { - if ((tok!=XkbCF_Ident)&&(tok!=XkbCF_String)) { - rtrn->error= XkbCF_ExpectedControl; - return False; - } - if (!AddCtrlByName(rtrn,val.str,&ctrls_mask)) { - if (!AddAXTimeoutOptByName(rtrn,val.str,&opts_mask)) - return False; - *opts |= opts_mask; - if (field->field_id==_XkbCF_AccessXTimeoutCtrlsOff) { - rtrn->defined|= XkbCF_AccessXTimeoutOptsOff; - if (rtrn->replace_axt_ctrls_off) - rtrn->replace_axt_opts_off= True; - } - else { - rtrn->defined|= XkbCF_AccessXTimeoutOptsOn; - if (rtrn->replace_axt_ctrls_on) - rtrn->replace_axt_opts_on= True; - } - } - else - *ctrls |= ctrls_mask; - tok= XkbCFScan(file,&val,rtrn); - if ((tok!=XkbCF_EOL)&&(tok!=XkbCF_EOF)&&(tok!=XkbCF_Semi)) { - if (tok!=XkbCF_Plus) { - rtrn->error= XkbCF_ExpectedOperator; - return False; - } - tok= XkbCFScan(file,&val,rtrn); - } - } - break; - case _XkbCF_InitialFeedback: - rtrn->defined|= XkbCF_InitialOpts; - opts= NULL; - if (tok==XkbCF_PlusEquals) - opts= &rtrn->initial_opts; - else if (tok==XkbCF_MinusEquals) - opts= &rtrn->initial_opts_clear; - else if (tok==XkbCF_Equals) { - opts= &rtrn->initial_opts; - rtrn->replace_initial_opts= True; - *opts= 0; - } - else { - rtrn->error= XkbCF_MissingEquals; - goto BAILOUT; - } - tok= XkbCFScan(file,&val,rtrn); - if ((tok==XkbCF_EOL)||(tok==XkbCF_Semi)||(tok==XkbCF_EOF)) { - rtrn->error= XkbCF_ExpectedAXOption; - return False; - } - while ((tok!=XkbCF_EOL)&&(tok!=XkbCF_Semi)&&(tok!=XkbCF_EOF)) { - if ((tok!=XkbCF_Ident)&&(tok!=XkbCF_String)) { - rtrn->error= XkbCF_ExpectedAXOption; - return False; - } - if (!AddAXTimeoutOptByName(rtrn,val.str,&opts_mask)) { - return False; - } - *opts |= opts_mask; - tok= XkbCFScan(file,&val,rtrn); - if ((tok!=XkbCF_EOL)&&(tok!=XkbCF_EOF)&&(tok!=XkbCF_Semi)) { - if (tok!=XkbCF_Plus) { - rtrn->error= XkbCF_ExpectedOperator; - return False; - } - tok= XkbCFScan(file,&val,rtrn); - } - } - break; - case _XkbCF_AccessXTimeoutOptsOff: - case _XkbCF_AccessXTimeoutOptsOn: - opts= NULL; - if (tok==XkbCF_MinusEquals) - opts= &rtrn->axt_opts_ignore; - else if ((tok==XkbCF_PlusEquals)||(tok==XkbCF_Equals)) { - if (field->field_id==_XkbCF_AccessXTimeoutOptsOff) { - opts= &rtrn->axt_opts_off; - if (tok==XkbCF_Equals) - rtrn->replace_axt_opts_off= True; - } - else { - opts= &rtrn->axt_opts_on; - if (tok==XkbCF_Equals) - rtrn->replace_axt_opts_on= True; - } - *opts = 0; - } - else { - rtrn->error= XkbCF_MissingEquals; - goto BAILOUT; - } - tok= XkbCFScan(file,&val,rtrn); - if ((tok==XkbCF_EOL)||(tok==XkbCF_Semi)||(tok==XkbCF_EOF)) { - rtrn->error= XkbCF_ExpectedControl; - return False; - } - while ((tok!=XkbCF_EOL)&&(tok!=XkbCF_Semi)&&(tok!=XkbCF_EOF)) { - if ((tok!=XkbCF_Ident)&&(tok!=XkbCF_String)) { - rtrn->error= XkbCF_ExpectedControl; - return False; - } - if (!AddAXTimeoutOptByName(rtrn,val.str,&opts_mask)) - return False; - *opts |= opts_mask; - - tok= XkbCFScan(file,&val,rtrn); - if ((tok!=XkbCF_EOL)&&(tok!=XkbCF_EOF)&&(tok!=XkbCF_Semi)) { - if (tok!=XkbCF_Plus) { - rtrn->error= XkbCF_ExpectedOperator; - return False; - } - tok= XkbCFScan(file,&val,rtrn); - } - } - break; - case _XkbCF_ClickVolume: - if (!pival) { - pival= &rtrn->click_volume; - onoff= 100; - } - case _XkbCF_BellVolume: - if (!pival) { - pival= &rtrn->bell_volume; - onoff= 100; - } - case _XkbCF_BellPitch: - if (!pival) - pival= &rtrn->bell_pitch; - case _XkbCF_BellDuration: - if (!pival) - pival= &rtrn->bell_duration; - case _XkbCF_RepeatDelay: - if (!pival) - pival= &rtrn->repeat_delay; - case _XkbCF_RepeatInterval: - if (!pival) - pival= &rtrn->repeat_interval; - case _XkbCF_SlowKeysDelay: - if (!pival) - pival= &rtrn->slow_keys_delay; - case _XkbCF_DebounceDelay: - if (!pival) - pival= &rtrn->debounce_delay; - case _XkbCF_MouseKeysDelay: - if (!pival) - pival= &rtrn->mk_delay; - case _XkbCF_MouseKeysInterval: - if (!pival) - pival= &rtrn->mk_interval; - case _XkbCF_MouseKeysTimeToMax: - if (!pival) - pival= &rtrn->mk_time_to_max; - case _XkbCF_MouseKeysMaxSpeed: - if (!pival) - pival= &rtrn->mk_max_speed; - case _XkbCF_MouseKeysCurve: - if (!pival) - pival= &rtrn->mk_curve; - case _XkbCF_AccessXTimeout: - if (!pival) - pival= &rtrn->ax_timeout; - if (tok!=XkbCF_Equals) { - rtrn->error= XkbCF_MissingEquals; - goto BAILOUT; - } - tok= XkbCFScan(file,&val,rtrn); - if (tok == XkbCF_Minus && field->field_id == _XkbCF_MouseKeysCurve) { - /* This can be a negative value */ - tok = XkbCFScan(file,&val,rtrn); - sign = -1; - } - else - sign = 1; - if (tok!=XkbCF_Integer) { - Bool ok= False; - if ((onoff)&&(tok==XkbCF_Ident)&&(val.str!=NULL)) { - if (_XkbStrCaseCmp(val.str,"on")) { - val.ival= onoff; - ok= True; - } - else if (_XkbStrCaseCmp(val.str,"off")) { - val.ival= 0; - ok= True; - } - } - if (!ok) { - rtrn->error= XkbCF_ExpectedInteger; - goto BAILOUT; - } - } - *pival= val.ival * sign; - if (field->field_id == _XkbCF_AccessXTimeout) - rtrn->defined|=XkbCF_AccessXTimeout; - tok= XkbCFScan(file,&val,rtrn); - if ((tok!=XkbCF_EOL)&&(tok!=XkbCF_Semi)&&(tok!=XkbCF_EOF)) { - rtrn->error= XkbCF_ExpectedEOS; - return False; - } - break; - case _XkbCF_GroupsWrap: - if (tok!=XkbCF_Equals) { - rtrn->error= XkbCF_MissingEquals; - goto BAILOUT; - } - tok= XkbCFScan(file,&val,rtrn); - if (tok==XkbCF_Ident) { - if (_XkbStrCaseCmp(val.str,"wrap")==0) { - rtrn->groups_wrap= XkbSetGroupInfo(0,XkbWrapIntoRange,0); - } - else if (_XkbStrCaseCmp(val.str,"clamp")==0) { - rtrn->groups_wrap= XkbSetGroupInfo(0,XkbClampIntoRange,0); - } - else { - rtrn->error= XkbCF_ExpectedOORGroupBehavior; - return False; - } - } - else if ((tok==XkbCF_Integer)&&(XkbIsLegalGroup(val.ival-1))) { - rtrn->groups_wrap= XkbSetGroupInfo(0,XkbRedirectIntoRange, - val.ival-1); - } - else { - rtrn->error= XkbCF_ExpectedOORGroupBehavior; - return False; - } - rtrn->defined|= XkbCF_GroupsWrap; - tok= XkbCFScan(file,&val,rtrn); - if ((tok!=XkbCF_EOL)&&(tok!=XkbCF_Semi)&&(tok!=XkbCF_EOF)) { - rtrn->error= XkbCF_ExpectedEOS; - return False; - } - break; - default: - rtrn->error= XkbCF_ExpectedInteger; - goto BAILOUT; - - } - return True; -BAILOUT: - return False; -} - -static Bool -DefaultCleanUp(XkbConfigRtrnPtr rtrn) -{ - if (rtrn->keymap) _XkbFree(rtrn->keymap); - if (rtrn->keycodes) _XkbFree(rtrn->keycodes); - if (rtrn->geometry) _XkbFree(rtrn->geometry); - if (rtrn->phys_symbols) _XkbFree(rtrn->phys_symbols); - if (rtrn->symbols) _XkbFree(rtrn->symbols); - if (rtrn->types) _XkbFree(rtrn->types); - if (rtrn->compat) _XkbFree(rtrn->compat); - rtrn->keycodes= rtrn->geometry= NULL; - rtrn->symbols= rtrn->phys_symbols= NULL; - rtrn->types= rtrn->compat= NULL; - if ((rtrn->unbound_mods!=NULL)&&(rtrn->num_unbound_mods>0)) { - register int i; - for (i=0;i<rtrn->num_unbound_mods;i++) { - if (rtrn->unbound_mods[i].name!=NULL) { - _XkbFree(rtrn->unbound_mods[i].name); - rtrn->unbound_mods[i].name= NULL; - } - } - _XkbFree(rtrn->unbound_mods); - rtrn->sz_unbound_mods= 0; - rtrn->num_unbound_mods= 0; - rtrn->unbound_mods= NULL; - } - return True; -} - -static Bool -DefaultApplyNames(XkbConfigRtrnPtr rtrn,XkbDescPtr xkb) -{ -char *str; - - if (XkbAllocNames(xkb,XkbComponentNamesMask,0,0)!=Success) - return False; - if ((str=rtrn->keycodes)!=NULL) { - xkb->names->keycodes= XkbInternAtom(xkb->dpy,str,False); - _XkbFree(str); - rtrn->keycodes= NULL; - } - if ((str=rtrn->geometry)!=NULL) { - xkb->names->geometry= XkbInternAtom(xkb->dpy,str,False); - _XkbFree(str); - rtrn->geometry= NULL; - } - if ((str=rtrn->symbols)!=NULL) { - xkb->names->symbols= XkbInternAtom(xkb->dpy,str,False); - _XkbFree(str); - rtrn->symbols= NULL; - } - if ((str=rtrn->phys_symbols)!=NULL) { - xkb->names->phys_symbols= XkbInternAtom(xkb->dpy,str,False); - _XkbFree(str); - rtrn->phys_symbols= NULL; - } - if ((str=rtrn->types)!=NULL) { - xkb->names->types= XkbInternAtom(xkb->dpy,str,False); - _XkbFree(str); - rtrn->types= NULL; - } - if ((str=rtrn->compat)!=NULL) { - xkb->names->compat= XkbInternAtom(xkb->dpy,str,False); - _XkbFree(str); - rtrn->compat= NULL; - } - return True; -} - -static Bool -DefaultApplyControls(XkbConfigRtrnPtr rtrn,XkbDescPtr xkb) -{ -unsigned on,off; -XkbControlsPtr ctrls; -unsigned int mask; - - if (XkbAllocControls(xkb,XkbAllControlsMask)!=Success) - return False; - ctrls= xkb->ctrls; - if (rtrn->replace_initial_ctrls) - ctrls->enabled_ctrls= rtrn->initial_ctrls; - else ctrls->enabled_ctrls|= rtrn->initial_ctrls; - ctrls->enabled_ctrls&= ~rtrn->initial_ctrls_clear; - if (rtrn->internal_mods.replace) { - ctrls->internal.real_mods= rtrn->internal_mods.mods; - ctrls->internal.vmods= rtrn->internal_mods.vmods; - } - else { - ctrls->internal.real_mods&= ~rtrn->internal_mods.mods_clear; - ctrls->internal.vmods&= ~rtrn->internal_mods.vmods_clear; - ctrls->internal.real_mods|= rtrn->internal_mods.mods; - ctrls->internal.vmods|= rtrn->internal_mods.vmods; - } - mask= 0; - (void)XkbVirtualModsToReal(xkb,ctrls->internal.vmods,&mask); - ctrls->internal.mask= (ctrls->internal.real_mods|mask); - - if (rtrn->ignore_lock_mods.replace) { - ctrls->ignore_lock.real_mods= rtrn->ignore_lock_mods.mods; - ctrls->ignore_lock.vmods= rtrn->ignore_lock_mods.vmods; - } - else { - ctrls->ignore_lock.real_mods&= ~rtrn->ignore_lock_mods.mods_clear; - ctrls->ignore_lock.vmods&= ~rtrn->ignore_lock_mods.vmods_clear; - ctrls->ignore_lock.real_mods|= rtrn->ignore_lock_mods.mods; - ctrls->ignore_lock.vmods|= rtrn->ignore_lock_mods.vmods; - } - mask= 0; - (void)XkbVirtualModsToReal(xkb,ctrls->ignore_lock.vmods,&mask); - ctrls->ignore_lock.mask= (ctrls->ignore_lock.real_mods|mask); - - if (rtrn->repeat_delay>0) - ctrls->repeat_delay= rtrn->repeat_delay; - if (rtrn->repeat_interval>0) - ctrls->repeat_interval= rtrn->repeat_interval; - if (rtrn->slow_keys_delay>0) - ctrls->slow_keys_delay= rtrn->slow_keys_delay; - if (rtrn->debounce_delay>0) - ctrls->debounce_delay= rtrn->debounce_delay; - if (rtrn->mk_delay>0) - ctrls->mk_delay= rtrn->mk_delay; - if (rtrn->mk_interval>0) - ctrls->mk_interval= rtrn->mk_interval; - if (rtrn->mk_time_to_max>0) - ctrls->mk_time_to_max= rtrn->mk_time_to_max; - if (rtrn->mk_max_speed>0) - ctrls->mk_max_speed= rtrn->mk_max_speed; - if (rtrn->mk_curve>0) - ctrls->mk_curve= rtrn->mk_curve; - if (rtrn->defined&XkbCF_AccessXTimeout && rtrn->ax_timeout > 0) - ctrls->ax_timeout= rtrn->ax_timeout; - - /* any value set to both off and on is reset to ignore */ - if ((off=(rtrn->axt_ctrls_on&rtrn->axt_ctrls_off))!=0) - rtrn->axt_ctrls_ignore|= off; - - /* ignore takes priority over on and off */ - rtrn->axt_ctrls_on&= ~rtrn->axt_ctrls_ignore; - rtrn->axt_ctrls_off&= ~rtrn->axt_ctrls_ignore; - - if (!rtrn->replace_axt_ctrls_off) { - off= (ctrls->axt_ctrls_mask&(~ctrls->axt_ctrls_values)); - off&= ~rtrn->axt_ctrls_on; - off|= rtrn->axt_ctrls_off; - } - else off= rtrn->axt_ctrls_off; - if (!rtrn->replace_axt_ctrls_on) { - on= (ctrls->axt_ctrls_mask&ctrls->axt_ctrls_values); - on&= ~rtrn->axt_ctrls_off; - on|= rtrn->axt_ctrls_on; - } - else on= rtrn->axt_ctrls_on; - ctrls->axt_ctrls_mask= (on|off)&~rtrn->axt_ctrls_ignore; - ctrls->axt_ctrls_values= on&~rtrn->axt_ctrls_ignore; - - /* any value set to both off and on is reset to ignore */ - if ((off=(rtrn->axt_opts_on&rtrn->axt_opts_off))!=0) - rtrn->axt_opts_ignore|= off; - - /* ignore takes priority over on and off */ - rtrn->axt_opts_on&= ~rtrn->axt_opts_ignore; - rtrn->axt_opts_off&= ~rtrn->axt_opts_ignore; - - if (rtrn->replace_axt_opts_off) { - off= (ctrls->axt_opts_mask&(~ctrls->axt_opts_values)); - off&= ~rtrn->axt_opts_on; - off|= rtrn->axt_opts_off; - } - else off= rtrn->axt_opts_off; - if (!rtrn->replace_axt_opts_on) { - on= (ctrls->axt_opts_mask&ctrls->axt_opts_values); - on&= ~rtrn->axt_opts_off; - on|= rtrn->axt_opts_on; - } - else on= rtrn->axt_opts_on; - ctrls->axt_opts_mask= (unsigned short)((on|off)&~rtrn->axt_ctrls_ignore); - ctrls->axt_opts_values= (unsigned short)(on&~rtrn->axt_ctrls_ignore); - - if (rtrn->defined&XkbCF_GroupsWrap) { - int n; - n= XkbNumGroups(ctrls->groups_wrap); - rtrn->groups_wrap= XkbSetNumGroups(rtrn->groups_wrap,n); - ctrls->groups_wrap= rtrn->groups_wrap; - } - return True; -} - -/*ARGSUSED*/ -static Bool -DefaultFinish( XkbConfigFieldsPtr fields, - XkbDescPtr xkb, - XkbConfigRtrnPtr rtrn, - int what) -{ - if ((what==XkbCF_Destroy)||(what==XkbCF_CleanUp)) - return DefaultCleanUp(rtrn); - if (what==XkbCF_Check) { - if ((rtrn->symbols==NULL)&&(rtrn->phys_symbols!=NULL)) - rtrn->symbols= Xstrdup(rtrn->phys_symbols); - } - if ((what==XkbCF_Apply)||(what==XkbCF_Check)) { - if (xkb && xkb->names && (rtrn->num_unbound_mods>0)) - XkbCFBindMods(rtrn,xkb); - XkbCFApplyMods(rtrn,XkbCF_InitialMods,&rtrn->initial_mods); - XkbCFApplyMods(rtrn,XkbCF_InternalMods,&rtrn->internal_mods); - XkbCFApplyMods(rtrn,XkbCF_IgnoreLockMods,&rtrn->ignore_lock_mods); - } - if (what==XkbCF_Apply) { - if (xkb!=NULL) { - DefaultApplyNames(rtrn,xkb); - DefaultApplyControls(rtrn,xkb); - XkbCFBindMods(rtrn,xkb); - } - } - return True; -} - -static XkbConfigFieldRec _XkbCFDfltFields[] = { - { "rules", _XkbCF_RulesFile }, - { "model", _XkbCF_Model }, - { "layout", _XkbCF_Layout }, - { "variant", _XkbCF_Variant }, - { "options", _XkbCF_Options }, - { "keymap", _XkbCF_Keymap }, - { "keycodes", _XkbCF_Keycodes }, - { "geometry", _XkbCF_Geometry }, - { "realsymbols",_XkbCF_PhysSymbols }, - { "actualsymbols",_XkbCF_PhysSymbols }, - { "symbols", _XkbCF_Symbols }, - { "symbolstouse",_XkbCF_Symbols }, - { "types", _XkbCF_Types }, - { "compat", _XkbCF_CompatMap }, - { "modifiers", _XkbCF_InitialMods }, - { "controls", _XkbCF_InitialCtrls }, - { "click", _XkbCF_ClickVolume }, - { "clickvolume",_XkbCF_ClickVolume }, - { "bell", _XkbCF_BellVolume }, - { "bellvolume", _XkbCF_BellVolume }, - { "bellpitch", _XkbCF_BellPitch }, - { "bellduration",_XkbCF_BellDuration }, - { "repeatdelay",_XkbCF_RepeatDelay }, - { "repeatinterval",_XkbCF_RepeatInterval }, - { "slowkeysdelay",_XkbCF_SlowKeysDelay }, - { "debouncedelay",_XkbCF_DebounceDelay }, - { "mousekeysdelay",_XkbCF_MouseKeysDelay }, - { "mousekeysinterval",_XkbCF_MouseKeysInterval }, - { "mousekeystimetomax",_XkbCF_MouseKeysTimeToMax }, - { "mousekeysmaxspeed",_XkbCF_MouseKeysMaxSpeed }, - { "mousekeyscurve",_XkbCF_MouseKeysCurve }, - { "accessxtimeout",_XkbCF_AccessXTimeout }, - { "axtimeout",_XkbCF_AccessXTimeout }, - { "accessxtimeoutctrlson",_XkbCF_AccessXTimeoutCtrlsOn }, - { "axtctrlson", _XkbCF_AccessXTimeoutCtrlsOn }, - { "accessxtimeoutctrlsoff",_XkbCF_AccessXTimeoutCtrlsOff }, - { "axtctrlsoff",_XkbCF_AccessXTimeoutCtrlsOff }, - { "accessxtimeoutfeedbackon", _XkbCF_AccessXTimeoutOptsOn }, - { "axtfeedbackon", _XkbCF_AccessXTimeoutOptsOn }, - { "accessxtimeoutfeedbackoff", _XkbCF_AccessXTimeoutOptsOff }, - { "axtfeedbackoff", _XkbCF_AccessXTimeoutOptsOff }, - { "ignorelockmods",_XkbCF_IgnoreLockMods }, - { "ignorelockmodifiers",_XkbCF_IgnoreLockMods }, - { "ignoregrouplock",_XkbCF_IgnoreGroupLock }, - { "internalmods",_XkbCF_InternalMods }, - { "internalmodifiers",_XkbCF_InternalMods }, - { "outofrangegroups",_XkbCF_GroupsWrap }, - { "groups", _XkbCF_GroupsWrap }, - { "feedback", _XkbCF_InitialFeedback }, -}; -#define _XkbCFNumDfltFields (sizeof(_XkbCFDfltFields)/sizeof(XkbConfigFieldRec)) - -static XkbConfigFieldsRec _XkbCFDflts = { - 0, /* cfg_id */ - _XkbCFNumDfltFields, /* num_fields */ - _XkbCFDfltFields, /* fields */ - DefaultParser, /* parser */ - DefaultFinish, /* finish */ - NULL, /* priv */ - NULL /* next */ -}; - -XkbConfigFieldsPtr XkbCFDflts= &_XkbCFDflts; - -/***====================================================================***/ - -XkbConfigFieldsPtr -XkbCFDup(XkbConfigFieldsPtr fields) -{ -XkbConfigFieldsPtr pNew; - - pNew= _XkbTypedAlloc(XkbConfigFieldsRec); - if (pNew!=NULL) { - memcpy(pNew,fields,sizeof(XkbConfigFieldsRec)); - if ((pNew->fields!=NULL)&&(pNew->num_fields>0)) { - pNew->fields= _XkbTypedCalloc(pNew->num_fields,XkbConfigFieldRec); - if (pNew->fields) { - memcpy(fields->fields,pNew->fields, - (pNew->num_fields*sizeof(XkbConfigFieldRec))); - } - else { - _XkbFree(pNew); - return NULL; - } - } - else { - pNew->num_fields= 0; - pNew->fields= NULL; - } - pNew->next= NULL; - } - return pNew; -} - -XkbConfigFieldsPtr -XkbCFFree(XkbConfigFieldsPtr fields,Bool all) -{ -XkbConfigFieldsPtr next; - - next= NULL; - while (fields!=NULL) { - next= fields->next; - if (fields!=XkbCFDflts) { - if (fields->fields) { - _XkbFree(fields->fields); - fields->fields= NULL; - fields->num_fields= 0; - } - _XkbFree(fields); - } - fields= (all?next:NULL); - } - return next; -} - -Bool -XkbCFApplyRtrnValues( XkbConfigRtrnPtr rtrn, - XkbConfigFieldsPtr fields, - XkbDescPtr xkb) -{ -Bool ok; - - if ((fields==NULL)||(rtrn==NULL)||(xkb==NULL)) - return False; - for (ok=True;fields!=NULL;fields=fields->next) { - if (fields->finish!=NULL) - ok= (*fields->finish)(fields,xkb,rtrn,XkbCF_Apply)&&ok; - } - return ok; -} - -XkbConfigRtrnPrivPtr -XkbCFAddPrivate( XkbConfigRtrnPtr rtrn, - XkbConfigFieldsPtr fields, - XPointer ptr) -{ -XkbConfigRtrnPrivPtr priv; - - if ((rtrn==NULL)||(fields==NULL)) - return NULL; - priv= _XkbTypedAlloc(XkbConfigRtrnPrivRec); - if (priv!=NULL) { - priv->cfg_id= fields->cfg_id; - priv->priv= ptr; - priv->next= rtrn->priv; - rtrn->priv= priv; - } - return priv; -} - -void -XkbCFFreeRtrn( XkbConfigRtrnPtr rtrn, - XkbConfigFieldsPtr fields, - XkbDescPtr xkb) -{ -XkbConfigRtrnPrivPtr tmp,next; - - if ((fields==NULL)||(rtrn==NULL)) - return; - while (fields!=NULL) { - if (fields->finish!=NULL) - (*fields->finish)(fields,xkb,rtrn,XkbCF_Destroy); - fields= fields->next; - } - for (tmp=rtrn->priv;tmp!=NULL;tmp=next) { - next= tmp->next; - bzero((char *)tmp,sizeof(XkbConfigRtrnPrivRec)); - _XkbFree(tmp); - } - bzero((char *)rtrn,sizeof(XkbConfigRtrnRec)); - return; -} - -Bool -XkbCFParse( FILE * file, - XkbConfigFieldsPtr fields, - XkbDescPtr xkb, - XkbConfigRtrnPtr rtrn) -{ -int tok; -XkbCFScanResultRec val; -XkbConfigFieldsPtr tmp; - - if ((file==NULL)||(fields==NULL)||(rtrn==NULL)) - return False; - for (tok=0,tmp=fields;tmp!=NULL;tmp=tmp->next,tok++) { - fields->cfg_id= tok; - } - bzero((char *)rtrn,sizeof(XkbConfigRtrnRec)); - rtrn->line= 1; - rtrn->click_volume= -1; - rtrn->bell_volume= -1; - while ((tok=XkbCFScan(file,&val,rtrn))!=XkbCF_EOF) { - if (tok==XkbCF_Ident) { - Bool done; - for (tmp=fields,done=False;(tmp!=NULL)&&(!done);tmp=tmp->next) { - register int i; - XkbConfigFieldPtr f; - - for (i=0,f=tmp->fields;(i<tmp->num_fields)&&(!done);i++,f++) { - if (_XkbStrCaseCmp(val.str,f->field)!=0) - continue; - if ((*tmp->parser)(file,tmp,f,xkb,rtrn)) - done= True; - else goto BAILOUT; - } - } - } - else if ((tok!=XkbCF_EOL)&&(tok!=XkbCF_Semi)) { - rtrn->error= XkbCF_MissingIdent; - goto BAILOUT; - } - } - for (tmp=fields;tmp!=NULL;tmp=tmp->next) { - if ((tmp->finish)&&(!(*tmp->finish)(tmp,xkb,rtrn,XkbCF_Check))) - goto BAILOUT; - } - return True; -BAILOUT: - for (tmp=fields;tmp!=NULL;tmp=tmp->next) { - if (tmp->finish) - (*tmp->finish)(tmp,xkb,rtrn,XkbCF_CleanUp); - } - return False; -} - -/*ARGSUSED*/ -void -XkbCFReportError(FILE *file,char *name,int error,int line) -{ -char * msg; - - switch(error) { - case XkbCF_BadAlloc: - msg= "allocation failed\n"; break; - case XkbCF_UnterminatedString: - msg= "unterminated string on line %d"; break; - case XkbCF_MissingIdent: - msg= "expected identifier on line %d"; break; - case XkbCF_MissingEquals: - msg= "expected '=' on line %d"; break; - case XkbCF_ExpectedEOS: - msg= "expected ';' or newline on line %d"; break; - case XkbCF_ExpectedBoolean: - msg= "expected a boolean value on line %d"; break; - case XkbCF_ExpectedInteger: - msg= "expected a numeric value on line %d"; break; - case XkbCF_ExpectedString: - msg= "expected a string on line %d"; break; - case XkbCF_ExpectedModifier: - msg= "expected a modifier name on line %d"; break; - case XkbCF_ExpectedControl: - msg= "expected a control name on line %d"; break; - case XkbCF_ExpectedAXOption: - msg= "expected an AccessX option on line %d"; break; - case XkbCF_ExpectedOperator: - msg= "expected '+' or '-' on line %d"; break; - case XkbCF_ExpectedOORGroupBehavior: - msg= "expected wrap, clamp or group number on line %d"; break; - default: - msg= "unknown error on line %d"; break; - } - ErrorF(msg,line); - if (name) ErrorF(" of %s\n",name); - else ErrorF("\n"); - return; -} diff --git a/nx-X11/programs/Xserver/xkb/xkberrs.c b/nx-X11/programs/Xserver/xkb/xkberrs.c index 095d573ea..3534356c6 100644 --- a/nx-X11/programs/Xserver/xkb/xkberrs.c +++ b/nx-X11/programs/Xserver/xkb/xkberrs.c @@ -32,37 +32,6 @@ #include <ctype.h> #include <stdlib.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; - diff --git a/nx-X11/programs/Xserver/xkb/xkmread.c b/nx-X11/programs/Xserver/xkb/xkmread.c index dca095518..e81835cf0 100644 --- a/nx-X11/programs/Xserver/xkb/xkmread.c +++ b/nx-X11/programs/Xserver/xkb/xkmread.c @@ -1167,18 +1167,6 @@ unsigned i,size_toc; return 1; } -xkmSectionInfo * -XkmFindTOCEntry(xkmFileInfo *finfo,xkmSectionInfo *toc,unsigned type) -{ -register int i; - - for (i=0;i<finfo->num_toc;i++) { - if (toc[i].type==type) - return &toc[i]; - } - return NULL; -} - Bool XkmReadFileSection( FILE * file, xkmSectionInfo * toc, |