diff options
Diffstat (limited to 'xorg-server/xkb/xkmread.c')
-rw-r--r-- | xorg-server/xkb/xkmread.c | 108 |
1 files changed, 96 insertions, 12 deletions
diff --git a/xorg-server/xkb/xkmread.c b/xorg-server/xkb/xkmread.c index b14a5beda..6623d1bf0 100644 --- a/xorg-server/xkb/xkmread.c +++ b/xorg-server/xkb/xkmread.c @@ -34,9 +34,9 @@ #include <X11/Xfuncs.h> #include <X11/X.h> -#define NEED_EVENTS #include <X11/Xproto.h> #include <X11/keysym.h> +#include <X11/extensions/XKMformat.h> #include "misc.h" #include "inputstr.h" #include "xkbstr.h" @@ -52,13 +52,13 @@ XkbInternAtom(char *str,Bool only_if_exists) } char * -_XkbDupString(char *str) +_XkbDupString(const char *str) { char *new; if (str==NULL) return NULL; - new= (char *)_XkbCalloc(strlen(str)+1,sizeof(char)); + new= xcalloc(strlen(str)+1,sizeof(char)); if (new) strcpy(new,str); return new; @@ -74,10 +74,10 @@ int newCount= *newCountRtrn; if (oldPtr==NULL) { if (newCount==0) return NULL; - oldPtr= _XkbCalloc(newCount,elemSize); + oldPtr= xcalloc(newCount,elemSize); } else if (oldCount<newCount) { - oldPtr= _XkbRealloc(oldPtr,newCount*elemSize); + oldPtr= xrealloc(oldPtr,newCount*elemSize); if (oldPtr!=NULL) { char *tmp= (char *)oldPtr; bzero(&tmp[oldCount*elemSize],(newCount-oldCount)*elemSize); @@ -418,6 +418,7 @@ xkmSymInterpretDesc wire; unsigned tmp; int nRead=0; XkbCompatMapPtr compat; +XkbAction *act; if ((tmp= XkmGetCountedString(file,name,100))<1) { _XkbLibError(_XkbErrBadLength,"ReadXkmCompatMap",0); @@ -448,13 +449,96 @@ XkbCompatMapPtr compat; interp->virtual_mod= wire.virtualMod; interp->flags= wire.flags; interp->act.type= wire.actionType; - interp->act.data[0]= wire.actionData[0]; - interp->act.data[1]= wire.actionData[1]; - interp->act.data[2]= wire.actionData[2]; - interp->act.data[3]= wire.actionData[3]; - interp->act.data[4]= wire.actionData[4]; - interp->act.data[5]= wire.actionData[5]; - interp->act.data[6]= wire.actionData[6]; + act = (XkbAction *) &interp->act; + + switch (interp->act.type) { + case XkbSA_SetMods: + case XkbSA_LatchMods: + case XkbSA_LockMods: + act->mods.flags = wire.actionData[0]; + act->mods.mask = wire.actionData[1]; + act->mods.real_mods = wire.actionData[2]; + act->mods.vmods1 = wire.actionData[3]; + act->mods.vmods2 = wire.actionData[4]; + break; + case XkbSA_SetGroup: + case XkbSA_LatchGroup: + case XkbSA_LockGroup: + act->group.flags = wire.actionData[0]; + act->group.group_XXX = wire.actionData[1]; + break; + case XkbSA_MovePtr: + act->ptr.flags = wire.actionData[0]; + act->ptr.high_XXX = wire.actionData[1]; + act->ptr.low_XXX = wire.actionData[2]; + act->ptr.high_YYY = wire.actionData[3]; + act->ptr.low_YYY = wire.actionData[4]; + break; + case XkbSA_PtrBtn: + case XkbSA_LockPtrBtn: + act->btn.flags = wire.actionData[0]; + act->btn.count = wire.actionData[1]; + act->btn.button = wire.actionData[2]; + break; + case XkbSA_DeviceBtn: + case XkbSA_LockDeviceBtn: + act->devbtn.flags = wire.actionData[0]; + act->devbtn.count = wire.actionData[1]; + act->devbtn.button = wire.actionData[2]; + act->devbtn.device = wire.actionData[3]; + break; + case XkbSA_SetPtrDflt: + act->dflt.flags = wire.actionData[0]; + act->dflt.affect = wire.actionData[1]; + act->dflt.valueXXX = wire.actionData[2]; + break; + case XkbSA_ISOLock: + act->iso.flags = wire.actionData[0]; + act->iso.mask = wire.actionData[1]; + act->iso.real_mods = wire.actionData[2]; + act->iso.group_XXX = wire.actionData[3]; + act->iso.affect = wire.actionData[4]; + act->iso.vmods1 = wire.actionData[5]; + act->iso.vmods2 = wire.actionData[6]; + break; + case XkbSA_SwitchScreen: + act->screen.flags = wire.actionData[0]; + act->screen.screenXXX = wire.actionData[1]; + break; + case XkbSA_SetControls: + case XkbSA_LockControls: + act->ctrls.flags = wire.actionData[0]; + act->ctrls.ctrls3 = wire.actionData[1]; + act->ctrls.ctrls2 = wire.actionData[2]; + act->ctrls.ctrls1 = wire.actionData[3]; + act->ctrls.ctrls0 = wire.actionData[4]; + break; + case XkbSA_RedirectKey: + act->redirect.new_key = wire.actionData[0]; + act->redirect.mods_mask = wire.actionData[1]; + act->redirect.mods = wire.actionData[2]; + act->redirect.vmods_mask0 = wire.actionData[3]; + act->redirect.vmods_mask1 = wire.actionData[4]; + act->redirect.vmods0 = wire.actionData[4]; + act->redirect.vmods1 = wire.actionData[5]; + break; + case XkbSA_DeviceValuator: + act->devval.device = wire.actionData[0]; + act->devval.v1_what = wire.actionData[1]; + act->devval.v1_ndx = wire.actionData[2]; + act->devval.v1_value = wire.actionData[3]; + act->devval.v2_what = wire.actionData[4]; + act->devval.v2_ndx = wire.actionData[5]; + act->devval.v2_what = wire.actionData[6]; + break; + case XkbSA_XFree86Private: + case XkbSA_Terminate: + /* no args, kinda (note: untrue for xfree86). */ + break; + case XkbSA_ActionMessage: + /* unsupported. */ + break; + } } if ((num_si>0)&&(changes)) { changes->compat.first_si= 0; |