summaryrefslogtreecommitdiff
path: root/xkb
diff options
context:
space:
mode:
Diffstat (limited to 'xkb')
-rw-r--r--xkb/XKBMisc.c8
-rw-r--r--xkb/ddxDevBtn.c107
-rw-r--r--xkb/xkb.c15
-rw-r--r--xkb/xkb.h2
-rw-r--r--xkb/xkbAccessX.c12
-rw-r--r--xkb/xkbActions.c19
-rw-r--r--xkb/xkbEvents.c190
-rw-r--r--xkb/xkbInit.c2
-rw-r--r--xkb/xkbPrKeyEv.c68
-rw-r--r--xkb/xkbUtils.c34
-rw-r--r--xkb/xkbfmisc.c1
-rw-r--r--xkb/xkbout.c1
-rw-r--r--xkb/xkbtext.c15
-rw-r--r--xkb/xkmread.c29
14 files changed, 183 insertions, 320 deletions
diff --git a/xkb/XKBMisc.c b/xkb/XKBMisc.c
index 9cb7061f3..867906046 100644
--- a/xkb/XKBMisc.c
+++ b/xkb/XKBMisc.c
@@ -343,7 +343,7 @@ unsigned tmp;
case XkbSA_SetMods: case XkbSA_LatchMods: case XkbSA_LockMods:
if (act->mods.flags&XkbSA_UseModMapMods)
act->mods.real_mods= act->mods.mask= mods;
- if ((tmp= act->mods.vmods)!=0) {
+ if ((tmp= XkbModActionVMods(&act->mods))!=0) {
XkbVirtualModsToReal(xkb,tmp,&tmp);
act->mods.mask|= tmp;
}
@@ -351,7 +351,7 @@ unsigned tmp;
case XkbSA_ISOLock:
if (act->iso.flags&XkbSA_UseModMapMods)
act->iso.real_mods= act->iso.mask= mods;
- if ((tmp= act->iso.vmods)!=0) {
+ if ((tmp= XkbModActionVMods(&act->iso))!=0) {
XkbVirtualModsToReal(xkb,tmp,&tmp);
act->iso.mask|= tmp;
}
@@ -666,7 +666,7 @@ unsigned int tmp;
switch (act->type) {
case XkbSA_SetMods: case XkbSA_LatchMods: case XkbSA_LockMods:
- if (((tmp= act->mods.vmods)&changed)!=0) {
+ if (((tmp= XkbModActionVMods(&act->mods))&changed)!=0) {
XkbVirtualModsToReal(xkb,tmp,&tmp);
act->mods.mask= act->mods.real_mods;
act->mods.mask|= tmp;
@@ -674,7 +674,7 @@ unsigned int tmp;
}
break;
case XkbSA_ISOLock:
- if ((((tmp= act->iso.vmods)!=0)&changed)!=0) {
+ if ((((tmp= XkbModActionVMods(&act->iso))!=0)&changed)!=0) {
XkbVirtualModsToReal(xkb,tmp,&tmp);
act->iso.mask= act->iso.real_mods;
act->iso.mask|= tmp;
diff --git a/xkb/ddxDevBtn.c b/xkb/ddxDevBtn.c
index e735fdec8..94630d1c9 100644
--- a/xkb/ddxDevBtn.c
+++ b/xkb/ddxDevBtn.c
@@ -35,98 +35,43 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "inputstr.h"
#include "scrnintstr.h"
#include "windowstr.h"
+#include "eventstr.h"
#include <xkbsrv.h>
+#include "mi.h"
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
-extern int DeviceValuator;
-
-static EventListPtr masterEvents = NULL;
-
void
XkbDDXFakeDeviceButton(DeviceIntPtr dev,Bool press,int button)
{
-int * devVal;
-INT32 * evVal;
-xEvent events[2];
-deviceKeyButtonPointer *btn;
-deviceValuator * val;
-int x,y;
-int nAxes, i, count;
-DeviceIntPtr master = NULL;
-
- if (dev == inputInfo.pointer || !dev->public.on)
- return;
-
- ErrorF("[xkb] XkbDDXFakeDeviceButton. If you read this message in your "
- "log file, Please file a bug on bugs.freedesktop.org.\n");
-#if 0
- nAxes = (dev->valuator?dev->valuator->numAxes:0);
- if (nAxes > 6)
- nAxes = 6;
-
- GetSpritePosition(dev, &x,&y);
- btn= (deviceKeyButtonPointer *) &events[0];
- val= (deviceValuator *) &events[1];
- if (press) btn->type= DeviceButtonPress;
- else btn->type= DeviceButtonRelease;
- btn->detail= button;
- btn->time= GetTimeInMillis();
- btn->root_x= x;
- btn->root_y= y;
- btn->deviceid= dev->id;
- count= 1;
- if (nAxes>0) {
- btn->deviceid|= 0x80;
- val->type = DeviceValuator;
- val->deviceid = dev->id;
- val->first_valuator = 0;
+ EventListPtr events;
+ int nevents, i;
+ DeviceIntPtr ptr;
- evVal= &val->valuator0;
- devVal= dev->valuator->axisVal;
- for (i=nAxes;i>0;i--) {
- *evVal++ = *devVal++;
- if (evVal > &val->valuator5) {
- int tmp = val->first_valuator+6;
- val->num_valuators = 6;
- val++;
- evVal= &val->valuator0;
- val->first_valuator= tmp;
- }
- }
- if ((nAxes % 6) != 0) {
- val->num_valuators = (nAxes % 6);
- }
- count= 1+((nAxes+5)/6);
- }
-
- /* XXX: This is obnoxious. ProcessOtherEvent updates the DIX device state,
- * but may not do anything if the device state is invalid. This happens if
- * we post a mouse event from a pure keyboard device. So we need to hack
- * around that by getting the master, then posting the event for the
- * pointer paired with the master.
+ /* If dev is a slave device, and the SD is attached, do nothing. If we'd
+ * post through the attached master pointer we'd get duplicate events.
+ *
+ * if dev is a master keyboard, post through the master pointer.
*
- * Note:the DeviceButtonEvent on the SD itself will do nothing in most
- * cases, unless dev is both a keyboard and a mouse.
+ * if dev is a floating slave, post through the device itself.
*/
- if (!dev->isMaster && dev->u.master) {
- if (!masterEvents)
- {
- masterEvents = InitEventList(1);
- SetMinimumEventSize(masterEvents, 1, (1 + MAX_VALUATOR_EVENTS) * sizeof(xEvent));
- }
- master = dev->u.master;
- if (!IsPointerDevice(master))
- master = GetPairedDevice(dev->u.master);
- CopyGetMasterEvent(master, dev, events, masterEvents, count);
- }
+ if (IsMaster(dev))
+ ptr = GetMaster(dev, MASTER_POINTER);
+ else if (!dev->u.master)
+ ptr = dev;
+ else
+ return;
- (*dev->public.processInputProc)((xEventPtr)btn, dev, count);
+ events = InitEventList(GetMaximumEventsNum());
+ nevents = GetPointerEvents(events, ptr,
+ press ? ButtonPress : ButtonRelease, button,
+ 0 /* flags */, 0 /* first */,
+ 0 /* num_val */, NULL);
- if (master) {
- (*master->public.processInputProc)(masterEvents->event, master, count);
- }
- return;
-#endif
+
+ for (i = 0; i < nevents; i++)
+ mieqProcessDeviceEvent(ptr, (InternalEvent*)events[i].event, NULL);
+
+ FreeEventList(events, GetMaximumEventsNum());
}
diff --git a/xkb/xkb.c b/xkb/xkb.c
index e4e84ceb8..0b54a2ec9 100644
--- a/xkb/xkb.c
+++ b/xkb/xkb.c
@@ -40,6 +40,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "xkb.h"
#include <X11/extensions/XI.h>
+#include <X11/extensions/XKMformat.h>
int XkbEventBase;
static int XkbErrorBase;
@@ -667,8 +668,8 @@ ProcXkbGetControls(ClientPtr client)
xkb = dev->key->xkbInfo->desc->ctrls;
rep.type = X_Reply;
- rep.length = (SIZEOF(xkbGetControlsReply)-
- SIZEOF(xGenericReply)) >> 2;
+ rep.length = bytes_to_int32(SIZEOF(xkbGetControlsReply)-
+ SIZEOF(xGenericReply));
rep.sequenceNumber = client->sequence;
rep.deviceID = ((DeviceIntPtr)dev)->id;
rep.numGroups = xkb->num_groups;
@@ -5866,6 +5867,16 @@ ProcXkbGetKbdByName(ClientPtr client)
if (geom_changed)
nkn.changed|= XkbNKN_GeometryMask;
XkbSendNewKeyboardNotify(dev,&nkn);
+
+ if (!IsMaster(dev) && dev->u.master)
+ {
+ DeviceIntPtr master = dev->u.master;
+ if (master->u.lastSlave == dev)
+ {
+ XkbCopyDeviceKeymap(dev->u.master, dev);
+ XkbSendNewKeyboardNotify(dev,&nkn);
+ }
+ }
}
if ((new!=NULL)&&(new!=xkb)) {
XkbFreeKeyboard(new,XkbAllComponentsMask,True);
diff --git a/xkb/xkb.h b/xkb/xkb.h
index 45d9b3d7a..a526356a9 100644
--- a/xkb/xkb.h
+++ b/xkb/xkb.h
@@ -29,6 +29,4 @@ extern int ProcXkbSetDeviceInfo(ClientPtr client);
extern int ProcXkbSetDebuggingFlags(ClientPtr client);
extern void XkbExtensionInit(void);
-
-extern Bool XkbFilterEvents(ClientPtr pClient, int nEvents, xEvent *xE);
#endif
diff --git a/xkb/xkbAccessX.c b/xkb/xkbAccessX.c
index f0f757818..47023c048 100644
--- a/xkb/xkbAccessX.c
+++ b/xkb/xkbAccessX.c
@@ -36,6 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "exglobals.h"
#include <X11/extensions/XIproto.h>
#include "inputstr.h"
+#include "eventstr.h"
#include <xkbsrv.h>
#if !defined(WIN32)
#include <sys/time.h>
@@ -43,7 +44,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
int XkbDfltRepeatDelay= 660;
int XkbDfltRepeatInterval= 40;
-pointer XkbLastRepeatEvent= NULL;
#define DFLT_TIMEOUT_CTRLS (XkbAX_KRGMask|XkbStickyKeysMask|XkbMouseKeysMask)
#define DFLT_TIMEOUT_OPTS (XkbAX_IndicatorFBMask)
@@ -130,18 +130,15 @@ AccessXKeyboardEvent(DeviceIntPtr keybd,
event.detail.key = keyCode;
event.time = GetTimeInMillis();
event.length = sizeof(DeviceEvent);
+ event.key_repeat = isRepeat;
if (xkbDebugFlags&0x8) {
DebugF("[xkb] AXKE: Key %d %s\n", keyCode,
(event.type == ET_KeyPress ? "down" : "up"));
}
- if (!_XkbIsPressEvent(type) && isRepeat)
- XkbLastRepeatEvent= (pointer)&event;
XkbProcessKeyboardEvent(&event, keybd);
- XkbLastRepeatEvent= NULL;
return;
-
} /* AccessXKeyboardEvent */
/************************************************************************/
@@ -308,14 +305,11 @@ AccessXRepeatKeyExpire(OsTimerPtr timer,CARD32 now,pointer arg)
{
DeviceIntPtr dev = (DeviceIntPtr) arg;
XkbSrvInfoPtr xkbi = dev->key->xkbInfo;
-KeyCode key;
if (xkbi->repeatKey == 0)
return 0;
- key = xkbi->repeatKey;
- AccessXKeyboardEvent(dev, ET_KeyRelease, key, True);
- AccessXKeyboardEvent(dev, ET_KeyPress, key, True);
+ AccessXKeyboardEvent(dev, ET_KeyPress, xkbi->repeatKey, True);
return xkbi->desc->ctrls->repeat_interval;
}
diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c
index 417c6171c..9c3184a83 100644
--- a/xkb/xkbActions.c
+++ b/xkb/xkbActions.c
@@ -36,6 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "misc.h"
#include "inputstr.h"
#include "exevents.h"
+#include "eventstr.h"
#include <xkbsrv.h>
#include "xkb.h"
#include <ctype.h>
@@ -523,15 +524,15 @@ Bool accel;
xkbi->mouseKeysCounter= 0;
xkbi->mouseKey= keycode;
accel= ((pAction->ptr.flags&XkbSA_NoAcceleration)==0);
- x= pAction->ptr.x;
- y= pAction->ptr.y;
+ x= XkbPtrActionX(&pAction->ptr);
+ y= XkbPtrActionY(&pAction->ptr);
XkbDDXFakePointerMotion(pAction->ptr.flags,x,y);
AccessXCancelRepeatKey(xkbi,keycode);
xkbi->mouseKeysAccel= accel&&
(xkbi->desc->ctrls->enabled_ctrls&XkbMouseKeysAccelMask);
xkbi->mouseKeysFlags= pAction->ptr.flags;
- xkbi->mouseKeysDX= x;
- xkbi->mouseKeysDY= y;
+ xkbi->mouseKeysDX= XkbPtrActionX(&pAction->ptr);
+ xkbi->mouseKeysDY= XkbPtrActionY(&pAction->ptr);
xkbi->mouseKeyTimer= TimerSet(xkbi->mouseKeyTimer, 0,
xkbi->desc->ctrls->mk_delay,
_XkbPtrAccelExpire,(pointer)xkbi);
@@ -671,7 +672,7 @@ XkbEventCauseRec cause;
filter->keycode = keycode;
filter->active = 1;
filter->filterOthers = 0;
- change= pAction->ctrls.ctrls;
+ change= XkbActionCtrls(&pAction->ctrls);
filter->priv = change;
filter->filter = _XkbFilterControls;
filter->upAction = *pAction;
@@ -834,8 +835,8 @@ ProcessInputProc backupproc;
ev.type = ET_KeyPress;
ev.detail.key = pAction->redirect.new_key;
- mask= pAction->redirect.vmods_mask;
- mods= pAction->redirect.vmods;
+ mask= XkbSARedirectVModsMask(&pAction->redirect);
+ mods= XkbSARedirectVMods(&pAction->redirect);
if (mask) XkbVirtualModsToReal(xkbi->desc,mask,&mask);
if (mods) XkbVirtualModsToReal(xkbi->desc,mods,&mods);
mask|= pAction->redirect.mods_mask;
@@ -865,8 +866,8 @@ ProcessInputProc backupproc;
ev.type = ET_KeyRelease;
ev.detail.key = filter->upAction.redirect.new_key;
- mask= filter->upAction.redirect.vmods_mask;
- mods= filter->upAction.redirect.vmods;
+ mask= XkbSARedirectVModsMask(&filter->upAction.redirect);
+ mods= XkbSARedirectVMods(&filter->upAction.redirect);
if (mask) XkbVirtualModsToReal(xkbi->desc,mask,&mask);
if (mods) XkbVirtualModsToReal(xkbi->desc,mods,&mods);
mask|= filter->upAction.redirect.mods_mask;
diff --git a/xkb/xkbEvents.c b/xkb/xkbEvents.c
index e56694dbf..8fb49c1d8 100644
--- a/xkb/xkbEvents.c
+++ b/xkb/xkbEvents.c
@@ -914,145 +914,99 @@ XkbSrvLedInfoPtr sli;
/***====================================================================***/
-Bool
-XkbFilterEvents(ClientPtr pClient,int nEvents,xEvent *xE)
+void
+XkbFilterEvents(ClientPtr client,int nEvents,xEvent *xE)
{
-int i, button_mask;
-DeviceIntPtr pXDev = NULL;
-XkbSrvInfoPtr xkbi;
+ DeviceIntPtr dev = NULL;
+ XkbSrvInfoPtr xkbi;
+ CARD8 type = xE[0].u.u.type;
if (xE->u.u.type & EXTENSION_EVENT_BASE)
- pXDev = XIGetDevice(xE);
-
- if (!pXDev)
- pXDev = PickKeyboard(pClient);
+ dev = XIGetDevice(xE);
- xkbi= (pXDev->key) ? pXDev->key->xkbInfo : NULL;
+ if (!dev)
+ dev = PickKeyboard(client);
- if ( pClient->xkbClientFlags & _XkbClientInitialized ) {
- if ((xkbDebugFlags&0x10)&&
- ((xE[0].u.u.type==KeyPress)||(xE[0].u.u.type==KeyRelease)||
- (xE[0].u.u.type==DeviceKeyPress)||
- (xE[0].u.u.type == DeviceKeyRelease))) {
- DebugF("[xkb] XKbFilterWriteEvents:\n");
- DebugF("[xkb] Event state= 0x%04x\n",xE[0].u.keyButtonPointer.state);
- DebugF("[xkb] XkbLastRepeatEvent!=xE (0x%p!=0x%p) %s\n",
- XkbLastRepeatEvent,xE,
- ((XkbLastRepeatEvent!=(pointer)xE)?"True":"False"));
- DebugF("[xkb] (xkbClientEventsFlags&XWDA)==0 (0x%x) %s\n",
- pClient->xkbClientFlags,
- (_XkbWantsDetectableAutoRepeat(pClient)?"True":"False"));
- DebugF("[xkb] !IsRelease(%d) %s\n",xE[0].u.u.type,
- (!_XkbIsReleaseEvent(xE[0].u.u.type))?"True":"False");
- }
- if ( (XkbLastRepeatEvent==(pointer)xE) &&
- (_XkbWantsDetectableAutoRepeat(pClient)) &&
- (_XkbIsReleaseEvent(xE[0].u.u.type)) ) {
- return False;
- }
-
- if (!xkbi)
- return True;
+ if (!dev->key)
+ return;
- if ((pXDev->deviceGrab.grab != NullGrab)
- && pXDev->deviceGrab.fromPassiveGrab &&
- ((xE[0].u.u.type==KeyPress)||(xE[0].u.u.type==KeyRelease)||
- (xE[0].u.u.type==DeviceKeyPress)||
- (xE[0].u.u.type == DeviceKeyRelease))) {
- register unsigned state,flags;
+ xkbi = dev->key->xkbInfo;
- flags= pClient->xkbClientFlags;
- state= xkbi->state.compat_grab_mods;
+ if (client->xkbClientFlags & _XkbClientInitialized) {
+ if ((xkbDebugFlags&0x10)&&
+ (type == KeyPress || type == KeyRelease ||
+ type == DeviceKeyPress || type == DeviceKeyRelease))
+ DebugF("[xkb] XkbFilterWriteEvents (XKB client): state 0x%04x\n",
+ xE[0].u.keyButtonPointer.state);
+
+ if (dev->deviceGrab.grab != NullGrab && dev->deviceGrab.fromPassiveGrab &&
+ (type == KeyPress || type == KeyRelease ||
+ type == DeviceKeyPress || type == DeviceKeyRelease)) {
+ unsigned int state, flags;
+
+ flags = client->xkbClientFlags;
+ state = xkbi->state.compat_grab_mods;
if (flags & XkbPCF_GrabsUseXKBStateMask) {
int group;
- if (flags&XkbPCF_LookupStateWhenGrabbed) {
- group= xkbi->state.group;
- state= xkbi->state.lookup_mods;
+ if (flags & XkbPCF_LookupStateWhenGrabbed) {
+ group = xkbi->state.group;
+ state = xkbi->state.lookup_mods;
}
else {
- state= xkbi->state.grab_mods;
- group= xkbi->state.base_group+xkbi->state.latched_group;
- if ((group<0)||(group>=xkbi->desc->ctrls->num_groups)) {
- group= XkbAdjustGroup(group,xkbi->desc->ctrls);
- }
+ state = xkbi->state.grab_mods;
+ group = xkbi->state.base_group + xkbi->state.latched_group;
+ if (group < 0 || group >= xkbi->desc->ctrls->num_groups)
+ group = XkbAdjustGroup(group, xkbi->desc->ctrls);
}
state = XkbBuildCoreState(state, group);
}
- else if (flags&XkbPCF_LookupStateWhenGrabbed)
- state= xkbi->state.compat_lookup_mods;
- xE[0].u.keyButtonPointer.state= state;
+ else if (flags & XkbPCF_LookupStateWhenGrabbed) {
+ state = xkbi->state.compat_lookup_mods;
+ }
+ xE[0].u.keyButtonPointer.state = state;
}
- button_mask = 1 << xE[0].u.u.detail;
- if (xE[0].u.u.type == ButtonPress &&
- ((xE[0].u.keyButtonPointer.state >> 7) & button_mask) == button_mask &&
- (xkbi->lockedPtrButtons & button_mask) == button_mask) {
- /* If the MouseKeys is pressed, and the "real" mouse is also pressed
- * when the mouse is released, the server does not behave properly.
- * Faking a release of the button here solves the problem.
- */
- DebugF("[xkb] Faking release of button %d\n", xE[0].u.u.detail);
- XkbDDXFakeDeviceButton(xkbi->device, 0, xE[0].u.u.detail);
- }
}
else {
- register CARD8 type;
-
- if (!xkbi)
- return True;
-
- for (i=0;i<nEvents;i++) {
- type= xE[i].u.u.type;
- if ((xkbDebugFlags&0x4)&&
- ((xE[i].u.u.type==KeyPress)||(xE[i].u.u.type==KeyRelease)||
- (xE[i].u.u.type==DeviceKeyPress)||
- (xE[i].u.u.type == DeviceKeyRelease))) {
- DebugF("[xkb] XKbFilterWriteEvents (non-XKB):\n");
- DebugF("[xkb] event= 0x%04x\n",xE[i].u.keyButtonPointer.state);
- DebugF("[xkb] lookup= 0x%02x, grab= 0x%02x\n",xkbi->state.lookup_mods,
- xkbi->state.grab_mods);
- DebugF("[xkb] compat lookup= 0x%02x, grab= 0x%02x\n",
- xkbi->state.compat_lookup_mods,
- xkbi->state.compat_grab_mods);
- }
- if ( (type>=KeyPress)&&(type<=MotionNotify) ) {
- CARD16 old,new;
+ if ((xkbDebugFlags & 0x4) &&
+ (xE[0].u.u.type == KeyPress || xE[0].u.u.type==KeyRelease ||
+ xE[0].u.u.type == DeviceKeyPress ||
+ xE[0].u.u.type == DeviceKeyRelease)) {
+ DebugF("[xkb] XKbFilterWriteEvents (non-XKB):\n");
+ DebugF("[xkb] event= 0x%04x\n",xE[0].u.keyButtonPointer.state);
+ DebugF("[xkb] lookup= 0x%02x, grab= 0x%02x\n",
+ xkbi->state.lookup_mods, xkbi->state.grab_mods);
+ DebugF("[xkb] compat lookup= 0x%02x, grab= 0x%02x\n",
+ xkbi->state.compat_lookup_mods, xkbi->state.compat_grab_mods);
+ }
+ if (type >= KeyPress && type <= MotionNotify) {
+ CARD16 old, new;
- old= xE[i].u.keyButtonPointer.state&(~0x1f00);
- new= xE[i].u.keyButtonPointer.state&0x1F00;
+ old = xE[0].u.keyButtonPointer.state & ~0x1f00;
+ new = xE[0].u.keyButtonPointer.state & 0x1F00;
- if (old==XkbStateFieldFromRec(&xkbi->state))
- new|= xkbi->state.compat_lookup_mods;
- else new|= xkbi->state.compat_grab_mods;
- xE[i].u.keyButtonPointer.state= new;
- }
- else if ((type==EnterNotify)||(type==LeaveNotify)) {
- xE[i].u.enterLeave.state&= 0x1F00;
- xE[i].u.enterLeave.state|= xkbi->state.compat_grab_mods;
- } else if ((type>=DeviceKeyPress)&&(type<=DeviceMotionNotify)) {
- CARD16 old, new;
- deviceKeyButtonPointer *kbp = (deviceKeyButtonPointer*)&xE[i];
- old= kbp->state&(~0x1F00);
- new= kbp->state&0x1F00;
- if (old==XkbStateFieldFromRec(&xkbi->state))
- new|= xkbi->state.compat_lookup_mods;
- else new|= xkbi->state.compat_grab_mods;
- kbp->state= new;
- }
- button_mask = 1 << xE[i].u.u.detail;
- if (type == ButtonPress &&
- ((xE[i].u.keyButtonPointer.state >> 7) & button_mask) == button_mask &&
- (xkbi->lockedPtrButtons & button_mask) == button_mask) {
- DebugF("[xkb] Faking release of button %d\n", xE[i].u.u.detail);
- XkbDDXFakeDeviceButton(xkbi->device, 0, xE[i].u.u.detail);
- } else if (type == DeviceButtonPress &&
- ((((deviceKeyButtonPointer*)&xE[i])->state >> 7) & button_mask) == button_mask &&
- (xkbi->lockedPtrButtons & button_mask) == button_mask) {
- DebugF("[xkb] Faking release of button %d\n", ((deviceKeyButtonPointer*)&xE[i])->state);
- XkbDDXFakeDeviceButton(xkbi->device, 0, ((deviceKeyButtonPointer*)&xE[i])->state);
- }
+ if (old == XkbStateFieldFromRec(&xkbi->state))
+ new |= xkbi->state.compat_lookup_mods;
+ else
+ new |= xkbi->state.compat_grab_mods;
+ xE[0].u.keyButtonPointer.state = new;
}
+ else if (type == EnterNotify || type == LeaveNotify) {
+ xE[0].u.enterLeave.state &= 0x1F00;
+ xE[0].u.enterLeave.state |= xkbi->state.compat_grab_mods;
+ }
+ else if (type >= DeviceKeyPress && type <= DeviceMotionNotify) {
+ CARD16 old, new;
+ deviceKeyButtonPointer *kbp = (deviceKeyButtonPointer*) &xE[0];
+
+ old = kbp->state & ~0x1F00;
+ new = kbp->state & 0x1F00;
+ if (old == XkbStateFieldFromRec(&xkbi->state))
+ new |= xkbi->state.compat_lookup_mods;
+ else
+ new |= xkbi->state.compat_grab_mods;
+ kbp->state = new;
+ }
}
- return True;
}
/***====================================================================***/
diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c
index 86a7a115b..747c913f3 100644
--- a/xkb/xkbInit.c
+++ b/xkb/xkbInit.c
@@ -505,7 +505,7 @@ InitKeyboardDeviceStruct(DeviceIntPtr dev, XkbRMLVOSet *rmlvo,
XkbRMLVOSet rmlvo_dflts = { NULL };
if (dev->key || dev->kbdfeed)
- return False;
+ return FALSE;
if (!rmlvo)
{
diff --git a/xkb/xkbPrKeyEv.c b/xkb/xkbPrKeyEv.c
index effb0ea3a..8f6705f9f 100644
--- a/xkb/xkbPrKeyEv.c
+++ b/xkb/xkbPrKeyEv.c
@@ -36,6 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "misc.h"
#include "inputstr.h"
#include "exevents.h"
+#include "eventstr.h"
#include <xkbsrv.h>
#include <ctype.h>
#include "events.h"
@@ -51,59 +52,38 @@ int key;
XkbBehavior behavior;
unsigned ndx;
- xkbi= keyc->xkbInfo;
- key= event->detail.key;
- if (xkbDebugFlags&0x8) {
+ xkbi = keyc->xkbInfo;
+ key = event->detail.key;
+ if (xkbDebugFlags & 0x8)
DebugF("[xkb] XkbPKE: Key %d %s\n",key,(event->type == ET_KeyPress?"down":"up"));
- }
- if ( (xkbi->repeatKey==key) && (event->type== ET_KeyRelease) &&
- ((xkbi->desc->ctrls->enabled_ctrls&XkbRepeatKeysMask)==0) ) {
- AccessXCancelRepeatKey(xkbi,key);
- }
+ if (xkbi->repeatKey == key && event->type== ET_KeyRelease &&
+ !(xkbi->desc->ctrls->enabled_ctrls & XkbRepeatKeysMask))
+ AccessXCancelRepeatKey(xkbi, key);
- behavior= xkbi->desc->server->behaviors[key];
+ behavior = xkbi->desc->server->behaviors[key];
/* The "permanent" flag indicates a hard-wired behavior that occurs */
/* below XKB, such as a key that physically locks. XKB does not */
/* do anything to implement the behavior, but it *does* report that */
/* key is hardwired */
- if ((behavior.type&XkbKB_Permanent)==0) {
+ if (!(behavior.type & XkbKB_Permanent)) {
switch (behavior.type) {
case XkbKB_Default:
- if (event->type == ET_KeyPress &&
- (keyc->down[key>>3] & (1<<(key&7)))) {
- XkbLastRepeatEvent= (pointer)event;
-
- event->type = ET_KeyRelease;
- XkbHandleActions(keybd, keybd, event);
-
- event->type = ET_KeyPress;
- XkbHandleActions(keybd, keybd, event);
- XkbLastRepeatEvent= NULL;
- return;
- }
+ /* Neither of these should happen in practice, but ignore them
+ anyway. */
+ if (event->type == ET_KeyPress && !event->key_repeat &&
+ key_is_down(keybd, key, KEY_PROCESSED))
+ return;
else if (event->type == ET_KeyRelease &&
- (!(keyc->down[key>>3]&(1<<(key&7))))) {
- XkbLastRepeatEvent= (pointer)event;
- event->type = ET_KeyPress;
- XkbHandleActions(keybd, keybd, event);
- event->type = ET_KeyRelease;
- XkbHandleActions(keybd, keybd, event);
- XkbLastRepeatEvent= NULL;
- return;
- }
+ !key_is_down(keybd, key, KEY_PROCESSED))
+ return;
break;
case XkbKB_Lock:
- if (event->type == ET_KeyRelease) {
+ if (event->type == ET_KeyRelease)
return;
- }
- else {
- int bit= 1<<(key&7);
- if ( keyc->down[key>>3]&bit ) {
- event->type = ET_KeyRelease;
- }
- }
+ else if (key_is_down(keybd, key, KEY_PROCESSED))
+ event->type = ET_KeyRelease;
break;
case XkbKB_RadioGroup:
ndx= (behavior.data&(~XkbKB_RGAllowNone));
@@ -172,9 +152,6 @@ ProcessKeyboardEvent(InternalEvent *ev, DeviceIntPtr keybd)
int is_press = (event->type == ET_KeyPress);
int is_release = (event->type == ET_KeyRelease);
- if (keyc)
- xkbi = keyc->xkbInfo;
-
/* We're only interested in key events. */
if (!is_press && !is_release) {
UNWRAP_PROCESS_INPUT_PROC(keybd, xkb_priv, backup_proc);
@@ -184,6 +161,8 @@ ProcessKeyboardEvent(InternalEvent *ev, DeviceIntPtr keybd)
return;
}
+ xkbi = keyc->xkbInfo;
+
/* If AccessX filters are active, then pass it through to
* AccessXFilter{Press,Release}Event; else, punt to
* XkbProcessKeyboardEvent.
@@ -195,8 +174,9 @@ ProcessKeyboardEvent(InternalEvent *ev, DeviceIntPtr keybd)
AccessXFilterPressEvent(event, keybd);
else if (is_release)
AccessXFilterReleaseEvent(event, keybd);
-
- } else {
+ return;
+ }
+ else {
XkbProcessKeyboardEvent(event, keybd);
}
diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c
index 0bd41cd34..63b1e31c7 100644
--- a/xkb/xkbUtils.c
+++ b/xkb/xkbUtils.c
@@ -62,6 +62,7 @@ DEALINGS IN THE SOFTWARE.
#include <X11/keysym.h>
#include "misc.h"
#include "inputstr.h"
+#include "eventstr.h"
#define XKBSRV_NEED_FILE_FUNCS
#include <xkbsrv.h>
@@ -183,13 +184,13 @@ register unsigned tmp;
case XkbSA_SetMods: case XkbSA_LatchMods: case XkbSA_LockMods:
if (act->mods.flags&XkbSA_UseModMapMods)
act->mods.real_mods= act->mods.mask= mods;
- if ((tmp= act->mods.vmods)!=0)
+ if ((tmp= XkbModActionVMods(&act->mods))!=0)
act->mods.mask|= XkbMaskForVMask(xkb,tmp);
break;
case XkbSA_ISOLock:
if (act->iso.flags&XkbSA_UseModMapMods)
act->iso.real_mods= act->iso.mask= mods;
- if ((tmp= act->iso.vmods)!=0)
+ if ((tmp= XkbModActionVMods(&act->iso))!=0)
act->iso.mask|= XkbMaskForVMask(xkb,tmp);
break;
}
@@ -2117,32 +2118,3 @@ XkbCopyDeviceKeymap(DeviceIntPtr dst, DeviceIntPtr src)
return ret;
}
-int
-XkbGetKeysym(DeviceIntPtr dev, DeviceEvent *event)
-{
- XkbDescPtr xkb = dev->key->xkbInfo->desc;
- XkbKeyTypePtr kt;
- int group;
- int i, level = 0;
- int modmask;
-
- group = event->group.base + event->group.latched + event->group.locked;
-
- if (group >= xkb->ctrls->num_groups)
- group = XkbAdjustGroup(group, xkb->ctrls);
-
- modmask = event->mods.base | event->mods.latched; /* don't care about
- locked mods */
- kt = XkbKeyKeyType(xkb, event->detail.key, group);
-
- for (i = 0; i < kt->map_count; i++)
- {
- if (kt->map[i].mods.mask == modmask)
- {
- level = kt->map[i].level;
- break;
- }
- }
-
- return XkbKeySymEntry(xkb, event->detail.key, level, group);
-}
diff --git a/xkb/xkbfmisc.c b/xkb/xkbfmisc.c
index aa660dfbe..52ef6362c 100644
--- a/xkb/xkbfmisc.c
+++ b/xkb/xkbfmisc.c
@@ -34,6 +34,7 @@
#include <X11/Xos.h>
#include <X11/Xfuncs.h>
+#include <X11/extensions/XKMformat.h>
#include <X11/X.h>
#include <X11/keysym.h>
diff --git a/xkb/xkbout.c b/xkb/xkbout.c
index 8913d8ed2..b1c30d052 100644
--- a/xkb/xkbout.c
+++ b/xkb/xkbout.c
@@ -36,6 +36,7 @@
#include <X11/X.h>
#include <X11/keysym.h>
#include <X11/Xproto.h>
+#include <X11/extensions/XKMformat.h>
#include "misc.h"
#include "inputstr.h"
#include "dix.h"
diff --git a/xkb/xkbtext.c b/xkb/xkbtext.c
index 836d47e28..95ad01378 100644
--- a/xkb/xkbtext.c
+++ b/xkb/xkbtext.c
@@ -36,6 +36,7 @@
#include <X11/X.h>
#include <X11/Xproto.h>
+#include <X11/extensions/XKMformat.h>
#include "misc.h"
#include "inputstr.h"
#include "dix.h"
@@ -682,7 +683,7 @@ XkbModAction * act;
unsigned tmp;
act= &action->mods;
- tmp= act->vmods;
+ tmp= XkbModActionVMods(act);
TryCopyStr(buf,"modifiers=",sz);
if (act->flags&XkbSA_UseModMapMods)
TryCopyStr(buf,"modMapMods",sz);
@@ -735,8 +736,8 @@ int x,y;
char tbuf[32];
act= &action->ptr;
- x= act->x;
- y= act->y;
+ x= XkbPtrActionX(act);
+ y= XkbPtrActionY(act);
if ((act->flags&XkbSA_MoveAbsoluteX)||(x<0))
sprintf(tbuf,"x=%d",x);
else sprintf(tbuf,"x=+%d",x);
@@ -822,7 +823,7 @@ char tbuf[64];
}
else {
unsigned tmp;
- tmp= act->vmods;
+ tmp= XkbModActionVMods(act);
TryCopyStr(buf,"modifiers=",sz);
if (act->flags&XkbSA_UseModMapMods)
TryCopyStr(buf,"modMapMods",sz);
@@ -894,7 +895,7 @@ unsigned tmp;
char tbuf[32];
act= &action->ctrls;
- tmp= act->ctrls;
+ tmp= XkbActionCtrls(act);
TryCopyStr(buf,"controls=",sz);
if (tmp==0)
TryCopyStr(buf,"none",sz);
@@ -1010,8 +1011,8 @@ unsigned vmods,vmods_mask;
act= &action->redirect;
kc= act->new_key;
- vmods= act->vmods;
- vmods_mask= act->vmods_mask;
+ vmods= XkbSARedirectVMods(act);
+ vmods_mask= XkbSARedirectVModsMask(act);
if (xkb && xkb->names && xkb->names->keys && (kc<=xkb->max_key_code) &&
(xkb->names->keys[kc].name[0]!='\0')) {
char *kn;
diff --git a/xkb/xkmread.c b/xkb/xkmread.c
index 206c40382..6623d1bf0 100644
--- a/xkb/xkmread.c
+++ b/xkb/xkmread.c
@@ -36,6 +36,7 @@
#include <X11/X.h>
#include <X11/Xproto.h>
#include <X11/keysym.h>
+#include <X11/extensions/XKMformat.h>
#include "misc.h"
#include "inputstr.h"
#include "xkbstr.h"
@@ -457,7 +458,8 @@ XkbAction *act;
act->mods.flags = wire.actionData[0];
act->mods.mask = wire.actionData[1];
act->mods.real_mods = wire.actionData[2];
- act->mods.vmods = (wire.actionData[3] << 8) | wire.actionData[4];
+ act->mods.vmods1 = wire.actionData[3];
+ act->mods.vmods2 = wire.actionData[4];
break;
case XkbSA_SetGroup:
case XkbSA_LatchGroup:
@@ -467,8 +469,10 @@ XkbAction *act;
break;
case XkbSA_MovePtr:
act->ptr.flags = wire.actionData[0];
- act->ptr.x = (wire.actionData[1] << 8) | wire.actionData[2];
- act->ptr.y = (wire.actionData[3] << 8) | wire.actionData[4];
+ 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:
@@ -494,7 +498,8 @@ XkbAction *act;
act->iso.real_mods = wire.actionData[2];
act->iso.group_XXX = wire.actionData[3];
act->iso.affect = wire.actionData[4];
- act->iso.vmods = (wire.actionData[5] << 8) | wire.actionData[6];
+ act->iso.vmods1 = wire.actionData[5];
+ act->iso.vmods2 = wire.actionData[6];
break;
case XkbSA_SwitchScreen:
act->screen.flags = wire.actionData[0];
@@ -503,19 +508,19 @@ XkbAction *act;
case XkbSA_SetControls:
case XkbSA_LockControls:
act->ctrls.flags = wire.actionData[0];
- act->ctrls.ctrls = (wire.actionData[1] << 24) | \
- (wire.actionData[2] << 16) | \
- (wire.actionData[3] << 8) | \
- wire.actionData[4];
+ 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_mask = (wire.actionData[3] << 8) | \
- wire.actionData[4];
- act->redirect.vmods = (wire.actionData[5] << 8) | \
- wire.actionData[6];
+ 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];