xkb: enable XI event processing for xkb.
XI events can now take the same processing paths as core events, and should do the correct state changes etc. There's some cases where XKB will use KeyPress as type for an event to be delivered to the client. Stuck warnings in, not sure what the correct solution is yet.
This commit is contained in:
parent
49dbe9a757
commit
6334d4e7be
|
@ -311,8 +311,9 @@ extern CARD32 xkbDebugFlags;
|
||||||
#define _XkbErrCode3(a,b,c) _XkbErrCode2(a,(((unsigned int)(b))<<16)|(c))
|
#define _XkbErrCode3(a,b,c) _XkbErrCode2(a,(((unsigned int)(b))<<16)|(c))
|
||||||
#define _XkbErrCode4(a,b,c,d) _XkbErrCode3(a,b,((((unsigned int)(c))<<8)|(d)))
|
#define _XkbErrCode4(a,b,c,d) _XkbErrCode3(a,b,((((unsigned int)(c))<<8)|(d)))
|
||||||
|
|
||||||
extern int DeviceKeyPress,DeviceKeyRelease;
|
extern int DeviceKeyPress,DeviceKeyRelease,DeviceMotionNotify;
|
||||||
extern int DeviceButtonPress,DeviceButtonRelease;
|
extern int DeviceButtonPress,DeviceButtonRelease;
|
||||||
|
extern int DeviceEnterNotify,DeviceLeaveNotify;
|
||||||
|
|
||||||
#ifdef XINPUT
|
#ifdef XINPUT
|
||||||
#define _XkbIsPressEvent(t) (((t)==KeyPress)||((t)==DeviceKeyPress))
|
#define _XkbIsPressEvent(t) (((t)==KeyPress)||((t)==DeviceKeyPress))
|
||||||
|
|
|
@ -39,6 +39,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <xkbsrv.h>
|
#include <xkbsrv.h>
|
||||||
#include "xkb.h"
|
#include "xkb.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#define EXTENSION_EVENT_BASE 64
|
||||||
|
|
||||||
static unsigned int _xkbServerGeneration;
|
static unsigned int _xkbServerGeneration;
|
||||||
static int xkbDevicePrivateIndex = -1;
|
static int xkbDevicePrivateIndex = -1;
|
||||||
|
@ -83,13 +84,11 @@ XkbSetExtension(DeviceIntPtr device, ProcessInputProc proc)
|
||||||
proc,xkbUnwrapProc);
|
proc,xkbUnwrapProc);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef XINPUT
|
|
||||||
extern void ProcessOtherEvent(
|
extern void ProcessOtherEvent(
|
||||||
xEvent * /* xE */,
|
xEvent * /* xE */,
|
||||||
DeviceIntPtr /* dev */,
|
DeviceIntPtr /* dev */,
|
||||||
int /* count */
|
int /* count */
|
||||||
);
|
);
|
||||||
#endif
|
|
||||||
|
|
||||||
/***====================================================================***/
|
/***====================================================================***/
|
||||||
|
|
||||||
|
@ -673,6 +672,7 @@ _XkbFilterPointerBtn( XkbSrvInfoPtr xkbi,
|
||||||
&old,xkbi->desc->ctrls,
|
&old,xkbi->desc->ctrls,
|
||||||
&cn,False)) {
|
&cn,False)) {
|
||||||
cn.keycode = keycode;
|
cn.keycode = keycode;
|
||||||
|
/* XXX: what about DeviceKeyPress? */
|
||||||
cn.eventType = KeyPress;
|
cn.eventType = KeyPress;
|
||||||
cn.requestMajor = 0;
|
cn.requestMajor = 0;
|
||||||
cn.requestMinor = 0;
|
cn.requestMinor = 0;
|
||||||
|
@ -737,6 +737,7 @@ XkbEventCauseRec cause;
|
||||||
ctrls->enabled_ctrls|= change;
|
ctrls->enabled_ctrls|= change;
|
||||||
if (XkbComputeControlsNotify(kbd,&old,ctrls,&cn,False)) {
|
if (XkbComputeControlsNotify(kbd,&old,ctrls,&cn,False)) {
|
||||||
cn.keycode = keycode;
|
cn.keycode = keycode;
|
||||||
|
/* XXX: what about DeviceKeyPress? */
|
||||||
cn.eventType = KeyPress;
|
cn.eventType = KeyPress;
|
||||||
cn.requestMajor = 0;
|
cn.requestMajor = 0;
|
||||||
cn.requestMinor = 0;
|
cn.requestMinor = 0;
|
||||||
|
@ -878,6 +879,7 @@ ProcessInputProc backupproc;
|
||||||
filter->filter = _XkbFilterRedirectKey;
|
filter->filter = _XkbFilterRedirectKey;
|
||||||
filter->upAction = *pAction;
|
filter->upAction = *pAction;
|
||||||
|
|
||||||
|
/* XXX: what about DeviceKeyPress */
|
||||||
ev.u.u.type = KeyPress;
|
ev.u.u.type = KeyPress;
|
||||||
ev.u.u.detail = pAction->redirect.new_key;
|
ev.u.u.detail = pAction->redirect.new_key;
|
||||||
|
|
||||||
|
@ -905,6 +907,10 @@ ProcessInputProc backupproc;
|
||||||
|
|
||||||
realMods = xkbi->device->key->modifierMap[ev.u.u.detail];
|
realMods = xkbi->device->key->modifierMap[ev.u.u.detail];
|
||||||
xkbi->device->key->modifierMap[ev.u.u.detail] = 0;
|
xkbi->device->key->modifierMap[ev.u.u.detail] = 0;
|
||||||
|
/* XXX: Bad! Since the switch to XI devices xkbi->device will be the
|
||||||
|
* XI device. Sending a core event through ProcessOtherEvent will
|
||||||
|
* cause trouble. Somebody should fix this.
|
||||||
|
*/
|
||||||
UNWRAP_PROCESS_INPUT_PROC(xkbi->device,xkbPrivPtr, backupproc);
|
UNWRAP_PROCESS_INPUT_PROC(xkbi->device,xkbPrivPtr, backupproc);
|
||||||
xkbi->device->public.processInputProc(&ev,xkbi->device,1);
|
xkbi->device->public.processInputProc(&ev,xkbi->device,1);
|
||||||
COND_WRAP_PROCESS_INPUT_PROC(xkbi->device, xkbPrivPtr,
|
COND_WRAP_PROCESS_INPUT_PROC(xkbi->device, xkbPrivPtr,
|
||||||
|
@ -919,6 +925,7 @@ ProcessInputProc backupproc;
|
||||||
}
|
}
|
||||||
else if (filter->keycode==keycode) {
|
else if (filter->keycode==keycode) {
|
||||||
|
|
||||||
|
/* XXX: what about DeviceKeyRelease */
|
||||||
ev.u.u.type = KeyRelease;
|
ev.u.u.type = KeyRelease;
|
||||||
ev.u.u.detail = filter->upAction.redirect.new_key;
|
ev.u.u.detail = filter->upAction.redirect.new_key;
|
||||||
|
|
||||||
|
@ -946,6 +953,10 @@ ProcessInputProc backupproc;
|
||||||
|
|
||||||
realMods = xkbi->device->key->modifierMap[ev.u.u.detail];
|
realMods = xkbi->device->key->modifierMap[ev.u.u.detail];
|
||||||
xkbi->device->key->modifierMap[ev.u.u.detail] = 0;
|
xkbi->device->key->modifierMap[ev.u.u.detail] = 0;
|
||||||
|
/* XXX: Bad! Since the switch to XI devices xkbi->device will be the
|
||||||
|
* XI device. Sending a core event through ProcessOtherEvent will
|
||||||
|
* cause trouble. Somebody should fix this.
|
||||||
|
*/
|
||||||
UNWRAP_PROCESS_INPUT_PROC(xkbi->device,xkbPrivPtr, backupproc);
|
UNWRAP_PROCESS_INPUT_PROC(xkbi->device,xkbPrivPtr, backupproc);
|
||||||
xkbi->device->public.processInputProc(&ev,xkbi->device,1);
|
xkbi->device->public.processInputProc(&ev,xkbi->device,1);
|
||||||
COND_WRAP_PROCESS_INPUT_PROC(xkbi->device, xkbPrivPtr,
|
COND_WRAP_PROCESS_INPUT_PROC(xkbi->device, xkbPrivPtr,
|
||||||
|
@ -1009,7 +1020,6 @@ _XkbFilterXF86Private( XkbSrvInfoPtr xkbi,
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef XINPUT
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_XkbFilterDeviceBtn( XkbSrvInfoPtr xkbi,
|
_XkbFilterDeviceBtn( XkbSrvInfoPtr xkbi,
|
||||||
|
@ -1081,7 +1091,6 @@ int button;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static XkbFilterPtr
|
static XkbFilterPtr
|
||||||
_XkbNextFreeFilter(
|
_XkbNextFreeFilter(
|
||||||
|
@ -1139,9 +1148,7 @@ XkbAction act;
|
||||||
XkbFilterPtr filter;
|
XkbFilterPtr filter;
|
||||||
Bool keyEvent;
|
Bool keyEvent;
|
||||||
Bool pressEvent;
|
Bool pressEvent;
|
||||||
#ifdef XINPUT
|
|
||||||
Bool xiEvent;
|
Bool xiEvent;
|
||||||
#endif
|
|
||||||
ProcessInputProc backupproc;
|
ProcessInputProc backupproc;
|
||||||
|
|
||||||
xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(dev);
|
xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(dev);
|
||||||
|
@ -1162,7 +1169,6 @@ xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(dev);
|
||||||
xkbi->groupChange = 0;
|
xkbi->groupChange = 0;
|
||||||
|
|
||||||
sendEvent = 1;
|
sendEvent = 1;
|
||||||
#ifdef XINPUT
|
|
||||||
keyEvent= ((xE->u.u.type==KeyPress)||(xE->u.u.type==DeviceKeyPress)||
|
keyEvent= ((xE->u.u.type==KeyPress)||(xE->u.u.type==DeviceKeyPress)||
|
||||||
(xE->u.u.type==KeyRelease)||(xE->u.u.type==DeviceKeyRelease));
|
(xE->u.u.type==KeyRelease)||(xE->u.u.type==DeviceKeyRelease));
|
||||||
pressEvent= (xE->u.u.type==KeyPress)||(xE->u.u.type==DeviceKeyPress)||
|
pressEvent= (xE->u.u.type==KeyPress)||(xE->u.u.type==DeviceKeyPress)||
|
||||||
|
@ -1170,10 +1176,6 @@ xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(dev);
|
||||||
xiEvent= (xE->u.u.type==DeviceKeyPress)||(xE->u.u.type==DeviceKeyRelease)||
|
xiEvent= (xE->u.u.type==DeviceKeyPress)||(xE->u.u.type==DeviceKeyRelease)||
|
||||||
(xE->u.u.type==DeviceButtonPress)||
|
(xE->u.u.type==DeviceButtonPress)||
|
||||||
(xE->u.u.type==DeviceButtonRelease);
|
(xE->u.u.type==DeviceButtonRelease);
|
||||||
#else
|
|
||||||
keyEvent= (xE->u.u.type==KeyPress)||(xE->u.u.type==KeyRelease);
|
|
||||||
pressEvent= (xE->u.u.type==KeyPress)||(xE->u.u.type==ButtonPress);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (pressEvent) {
|
if (pressEvent) {
|
||||||
if (keyEvent)
|
if (keyEvent)
|
||||||
|
@ -1234,13 +1236,11 @@ xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(dev);
|
||||||
filter = _XkbNextFreeFilter(xkbi);
|
filter = _XkbNextFreeFilter(xkbi);
|
||||||
sendEvent= _XkbFilterRedirectKey(xkbi,filter,key,&act);
|
sendEvent= _XkbFilterRedirectKey(xkbi,filter,key,&act);
|
||||||
break;
|
break;
|
||||||
#ifdef XINPUT
|
|
||||||
case XkbSA_DeviceBtn:
|
case XkbSA_DeviceBtn:
|
||||||
case XkbSA_LockDeviceBtn:
|
case XkbSA_LockDeviceBtn:
|
||||||
filter = _XkbNextFreeFilter(xkbi);
|
filter = _XkbNextFreeFilter(xkbi);
|
||||||
sendEvent= _XkbFilterDeviceBtn(xkbi,filter,key,&act);
|
sendEvent= _XkbFilterDeviceBtn(xkbi,filter,key,&act);
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
case XkbSA_XFree86Private:
|
case XkbSA_XFree86Private:
|
||||||
filter = _XkbNextFreeFilter(xkbi);
|
filter = _XkbNextFreeFilter(xkbi);
|
||||||
sendEvent= _XkbFilterXF86Private(xkbi,filter,key,&act);
|
sendEvent= _XkbFilterXF86Private(xkbi,filter,key,&act);
|
||||||
|
@ -1279,11 +1279,6 @@ xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sendEvent) {
|
if (sendEvent) {
|
||||||
#ifdef XINPUT
|
|
||||||
if (xiEvent)
|
|
||||||
ProcessOtherEvent(xE,dev,count);
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
if (keyEvent) {
|
if (keyEvent) {
|
||||||
realMods = keyc->modifierMap[key];
|
realMods = keyc->modifierMap[key];
|
||||||
keyc->modifierMap[key] = 0;
|
keyc->modifierMap[key] = 0;
|
||||||
|
@ -1293,7 +1288,14 @@ xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(dev);
|
||||||
backupproc,xkbUnwrapProc);
|
backupproc,xkbUnwrapProc);
|
||||||
keyc->modifierMap[key] = realMods;
|
keyc->modifierMap[key] = realMods;
|
||||||
}
|
}
|
||||||
else CoreProcessPointerEvent(xE,dev,count);
|
else
|
||||||
|
{
|
||||||
|
if (xE->u.u.type & EXTENSION_EVENT_BASE)
|
||||||
|
ProcessOtherEvent(xE, dev, count);
|
||||||
|
else
|
||||||
|
CoreProcessPointerEvent(xE,dev,count);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (keyEvent)
|
else if (keyEvent)
|
||||||
FixKeyState(xE,dev);
|
FixKeyState(xE,dev);
|
||||||
|
|
|
@ -34,6 +34,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <X11/Xproto.h>
|
#include <X11/Xproto.h>
|
||||||
#include <X11/keysym.h>
|
#include <X11/keysym.h>
|
||||||
#include <X11/extensions/XI.h>
|
#include <X11/extensions/XI.h>
|
||||||
|
#include <X11/extensions/XIproto.h>
|
||||||
#include "inputstr.h"
|
#include "inputstr.h"
|
||||||
#include "windowstr.h"
|
#include "windowstr.h"
|
||||||
#include <xkbsrv.h>
|
#include <xkbsrv.h>
|
||||||
|
@ -814,7 +815,9 @@ GrabInfoPtr grabinfo;
|
||||||
if ( pClient->xkbClientFlags & _XkbClientInitialized ) {
|
if ( pClient->xkbClientFlags & _XkbClientInitialized ) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if ((xkbDebugFlags&0x10)&&
|
if ((xkbDebugFlags&0x10)&&
|
||||||
((xE[0].u.u.type==KeyPress)||(xE[0].u.u.type==KeyRelease))) {
|
((xE[0].u.u.type==KeyPress)||(xE[0].u.u.type==KeyRelease)||
|
||||||
|
(xE[0].u.u.type==DeviceKeyPress)||
|
||||||
|
(xE[0].u.u.type == DeviceKeyRelease))) {
|
||||||
ErrorF("XKbFilterWriteEvents:\n");
|
ErrorF("XKbFilterWriteEvents:\n");
|
||||||
ErrorF(" Event state= 0x%04x\n",xE[0].u.keyButtonPointer.state);
|
ErrorF(" Event state= 0x%04x\n",xE[0].u.keyButtonPointer.state);
|
||||||
ErrorF(" XkbLastRepeatEvent!=xE (0x%p!=0x%p) %s\n",
|
ErrorF(" XkbLastRepeatEvent!=xE (0x%p!=0x%p) %s\n",
|
||||||
|
@ -834,7 +837,9 @@ GrabInfoPtr grabinfo;
|
||||||
}
|
}
|
||||||
if ((pXDev->deviceGrab.grab != NullGrab)
|
if ((pXDev->deviceGrab.grab != NullGrab)
|
||||||
&& pXDev->deviceGrab.fromPassiveGrab &&
|
&& pXDev->deviceGrab.fromPassiveGrab &&
|
||||||
((xE[0].u.u.type==KeyPress)||(xE[0].u.u.type==KeyRelease))) {
|
((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;
|
register unsigned state,flags;
|
||||||
|
|
||||||
flags= pClient->xkbClientFlags;
|
flags= pClient->xkbClientFlags;
|
||||||
|
@ -879,10 +884,12 @@ GrabInfoPtr grabinfo;
|
||||||
type= xE[i].u.u.type;
|
type= xE[i].u.u.type;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if ((xkbDebugFlags&0x4)&&
|
if ((xkbDebugFlags&0x4)&&
|
||||||
((xE[0].u.u.type==KeyPress)||(xE[0].u.u.type==KeyRelease))) {
|
((xE[i].u.u.type==KeyPress)||(xE[i].u.u.type==KeyRelease)||
|
||||||
|
(xE[i].u.u.type==DeviceKeyPress)||
|
||||||
|
(xE[i].u.u.type == DeviceKeyRelease))) {
|
||||||
XkbStatePtr s= &xkbi->state;
|
XkbStatePtr s= &xkbi->state;
|
||||||
ErrorF("XKbFilterWriteEvents (non-XKB):\n");
|
ErrorF("XKbFilterWriteEvents (non-XKB):\n");
|
||||||
ErrorF("event= 0x%04x\n",xE[0].u.keyButtonPointer.state);
|
ErrorF("event= 0x%04x\n",xE[i].u.keyButtonPointer.state);
|
||||||
ErrorF("lookup= 0x%02x, grab= 0x%02x\n",s->lookup_mods,
|
ErrorF("lookup= 0x%02x, grab= 0x%02x\n",s->lookup_mods,
|
||||||
s->grab_mods);
|
s->grab_mods);
|
||||||
ErrorF("compat lookup= 0x%02x, grab= 0x%02x\n",
|
ErrorF("compat lookup= 0x%02x, grab= 0x%02x\n",
|
||||||
|
@ -902,9 +909,22 @@ GrabInfoPtr grabinfo;
|
||||||
xE[i].u.keyButtonPointer.state= new;
|
xE[i].u.keyButtonPointer.state= new;
|
||||||
}
|
}
|
||||||
else if ((type==EnterNotify)||(type==LeaveNotify)) {
|
else if ((type==EnterNotify)||(type==LeaveNotify)) {
|
||||||
xE->u.enterLeave.state&= 0x1F00;
|
xE[i].u.enterLeave.state&= 0x1F00;
|
||||||
xE->u.enterLeave.state|= xkbi->state.compat_grab_mods;
|
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;
|
||||||
|
} else if ((type==DeviceEnterNotify)||(type==DeviceLeaveNotify)) {
|
||||||
|
deviceEnterNotify *del = (deviceEnterNotify*)&xE[i];
|
||||||
|
del->state&=0x1F00;
|
||||||
|
del->state|= xkbi->state.compat_grab_mods;
|
||||||
|
}
|
||||||
button_mask = 1 << xE[i].u.u.detail;
|
button_mask = 1 << xE[i].u.u.detail;
|
||||||
if (type == ButtonPress &&
|
if (type == ButtonPress &&
|
||||||
((xE[i].u.keyButtonPointer.state >> 7) & button_mask) == button_mask &&
|
((xE[i].u.keyButtonPointer.state >> 7) & button_mask) == button_mask &&
|
||||||
|
@ -913,7 +933,14 @@ GrabInfoPtr grabinfo;
|
||||||
ErrorF("Faking release of button %d\n", xE[i].u.u.detail);
|
ErrorF("Faking release of button %d\n", xE[i].u.u.detail);
|
||||||
#endif
|
#endif
|
||||||
XkbDDXFakePointerButton(ButtonRelease, xE[i].u.u.detail);
|
XkbDDXFakePointerButton(ButtonRelease, xE[i].u.u.detail);
|
||||||
}
|
} else if (type == DeviceButtonPress &&
|
||||||
|
((((deviceKeyButtonPointer*)&xE[i])->state >> 7) & button_mask) == button_mask &&
|
||||||
|
(xkbi->lockedPtrButtons & button_mask) == button_mask) {
|
||||||
|
#ifdef DEBUG
|
||||||
|
ErrorF("Faking release of button %d\n", ((deviceKeyButtonPointer*)&xE[i])->state)
|
||||||
|
#endif
|
||||||
|
XkbDDXFakePointerButton(DeviceButtonRelease, ((deviceKeyButtonPointer*)&xE[i])->state);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return True;
|
return True;
|
||||||
|
|
|
@ -38,6 +38,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include "inputstr.h"
|
#include "inputstr.h"
|
||||||
#include <xkbsrv.h>
|
#include <xkbsrv.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#define EXTENSION_EVENT_BASE 64
|
||||||
|
|
||||||
|
|
||||||
/***====================================================================***/
|
/***====================================================================***/
|
||||||
|
@ -50,9 +51,11 @@ XkbSrvInfoPtr xkbi;
|
||||||
int key;
|
int key;
|
||||||
XkbBehavior behavior;
|
XkbBehavior behavior;
|
||||||
unsigned ndx;
|
unsigned ndx;
|
||||||
|
int xiEvent;
|
||||||
|
|
||||||
xkbi= keyc->xkbInfo;
|
xkbi= keyc->xkbInfo;
|
||||||
key= xE->u.u.detail;
|
key= xE->u.u.detail;
|
||||||
|
xiEvent= (xE->u.u.type & EXTENSION_EVENT_BASE);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (xkbDebugFlags&0x8) {
|
if (xkbDebugFlags&0x8) {
|
||||||
ErrorF("XkbPKE: Key %d %s\n",key,(xE->u.u.type==KeyPress?"down":"up"));
|
ErrorF("XkbPKE: Key %d %s\n",key,(xE->u.u.type==KeyPress?"down":"up"));
|
||||||
|
@ -70,51 +73,68 @@ unsigned ndx;
|
||||||
/* do anything to implement the behavior, but it *does* report that */
|
/* do anything to implement the behavior, but it *does* report that */
|
||||||
/* key is hardwired */
|
/* key is hardwired */
|
||||||
|
|
||||||
/* FIXME: this is bad. The down mask is set during ProcessOtherEvent. When
|
|
||||||
* we start processing the core event (and eventually arrive here), the
|
|
||||||
* down mask is already set and Xkb thinks it's a repeat event. We just
|
|
||||||
* silently ignore it for now.
|
|
||||||
*/
|
|
||||||
#if 0
|
|
||||||
if ((behavior.type&XkbKB_Permanent)==0) {
|
if ((behavior.type&XkbKB_Permanent)==0) {
|
||||||
switch (behavior.type) {
|
switch (behavior.type) {
|
||||||
case XkbKB_Default:
|
case XkbKB_Default:
|
||||||
if (( xE->u.u.type == KeyPress ) &&
|
if (( xE->u.u.type == KeyPress ||
|
||||||
|
xE->u.u.type == DeviceKeyPress) &&
|
||||||
(keyc->down[key>>3] & (1<<(key&7)))) {
|
(keyc->down[key>>3] & (1<<(key&7)))) {
|
||||||
XkbLastRepeatEvent= (pointer)xE;
|
XkbLastRepeatEvent= (pointer)xE;
|
||||||
xE->u.u.type = KeyRelease;
|
|
||||||
|
if (xiEvent)
|
||||||
|
xE->u.u.type = DeviceKeyRelease;
|
||||||
|
else
|
||||||
|
xE->u.u.type = KeyRelease;
|
||||||
XkbHandleActions(keybd,keybd,xE,count);
|
XkbHandleActions(keybd,keybd,xE,count);
|
||||||
xE->u.u.type = KeyPress;
|
|
||||||
|
if (xiEvent)
|
||||||
|
xE->u.u.type = DeviceKeyPress;
|
||||||
|
else
|
||||||
|
xE->u.u.type = KeyPress;
|
||||||
XkbHandleActions(keybd,keybd,xE,count);
|
XkbHandleActions(keybd,keybd,xE,count);
|
||||||
XkbLastRepeatEvent= NULL;
|
XkbLastRepeatEvent= NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if ((xE->u.u.type==KeyRelease) &&
|
else if ((xE->u.u.type==KeyRelease ||
|
||||||
|
xE->u.u.type == DeviceKeyRelease) &&
|
||||||
(!(keyc->down[key>>3]&(1<<(key&7))))) {
|
(!(keyc->down[key>>3]&(1<<(key&7))))) {
|
||||||
XkbLastRepeatEvent= (pointer)&xE;
|
XkbLastRepeatEvent= (pointer)&xE;
|
||||||
xE->u.u.type = KeyPress;
|
if (xiEvent)
|
||||||
|
xE->u.u.type = DeviceKeyPress;
|
||||||
|
else
|
||||||
|
xE->u.u.type = KeyPress;
|
||||||
XkbHandleActions(keybd,keybd,xE,count);
|
XkbHandleActions(keybd,keybd,xE,count);
|
||||||
xE->u.u.type = KeyRelease;
|
if (xiEvent)
|
||||||
|
xE->u.u.type = DeviceKeyRelease;
|
||||||
|
else
|
||||||
|
xE->u.u.type = KeyRelease;
|
||||||
XkbHandleActions(keybd,keybd,xE,count);
|
XkbHandleActions(keybd,keybd,xE,count);
|
||||||
XkbLastRepeatEvent= NULL;
|
XkbLastRepeatEvent= NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case XkbKB_Lock:
|
case XkbKB_Lock:
|
||||||
if ( xE->u.u.type == KeyRelease )
|
if ( xE->u.u.type == KeyRelease ||
|
||||||
|
xE->u.u.type == DeviceKeyRelease)
|
||||||
return;
|
return;
|
||||||
else {
|
else {
|
||||||
int bit= 1<<(key&7);
|
int bit= 1<<(key&7);
|
||||||
if ( keyc->down[key>>3]&bit )
|
if ( keyc->down[key>>3]&bit )
|
||||||
xE->u.u.type= KeyRelease;
|
{
|
||||||
}
|
if (xiEvent)
|
||||||
|
xE->u.u.type = DeviceKeyRelease;
|
||||||
|
else
|
||||||
|
xE->u.u.type= KeyRelease;
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case XkbKB_RadioGroup:
|
case XkbKB_RadioGroup:
|
||||||
ndx= (behavior.data&(~XkbKB_RGAllowNone));
|
ndx= (behavior.data&(~XkbKB_RGAllowNone));
|
||||||
if ( ndx<xkbi->nRadioGroups ) {
|
if ( ndx<xkbi->nRadioGroups ) {
|
||||||
XkbRadioGroupPtr rg;
|
XkbRadioGroupPtr rg;
|
||||||
|
|
||||||
if ( xE->u.u.type == KeyRelease )
|
if ( xE->u.u.type == KeyRelease ||
|
||||||
|
xE->u.u.type == DeviceKeyRelease)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
rg = &xkbi->radioGroups[ndx];
|
rg = &xkbi->radioGroups[ndx];
|
||||||
|
@ -128,10 +148,16 @@ unsigned ndx;
|
||||||
}
|
}
|
||||||
if ( rg->currentDown!=0 ) {
|
if ( rg->currentDown!=0 ) {
|
||||||
int key = xE->u.u.detail;
|
int key = xE->u.u.detail;
|
||||||
xE->u.u.type= KeyRelease;
|
if (xiEvent)
|
||||||
|
xE->u.u.type = DeviceKeyRelease;
|
||||||
|
else
|
||||||
|
xE->u.u.type= KeyRelease;
|
||||||
xE->u.u.detail= rg->currentDown;
|
xE->u.u.detail= rg->currentDown;
|
||||||
XkbHandleActions(keybd,keybd,xE,count);
|
XkbHandleActions(keybd,keybd,xE,count);
|
||||||
xE->u.u.type= KeyPress;
|
if (xiEvent)
|
||||||
|
xE->u.u.type = DeviceKeyPress;
|
||||||
|
else
|
||||||
|
xE->u.u.type= KeyPress;
|
||||||
xE->u.u.detail= key;
|
xE->u.u.detail= key;
|
||||||
}
|
}
|
||||||
rg->currentDown= key;
|
rg->currentDown= key;
|
||||||
|
@ -160,7 +186,6 @@ unsigned ndx;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
XkbHandleActions(keybd,keybd,xE,count);
|
XkbHandleActions(keybd,keybd,xE,count);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -181,9 +206,9 @@ XkbSrvInfoPtr xkbi;
|
||||||
#endif
|
#endif
|
||||||
if ((xkbi->desc->ctrls->enabled_ctrls&XkbAllFilteredEventsMask)==0)
|
if ((xkbi->desc->ctrls->enabled_ctrls&XkbAllFilteredEventsMask)==0)
|
||||||
XkbProcessKeyboardEvent(xE,keybd,count);
|
XkbProcessKeyboardEvent(xE,keybd,count);
|
||||||
else if (xE->u.u.type==KeyPress)
|
else if (xE->u.u.type==KeyPress || xE->u.u.type==DeviceKeyPress)
|
||||||
AccessXFilterPressEvent(xE,keybd,count);
|
AccessXFilterPressEvent(xE,keybd,count);
|
||||||
else if (xE->u.u.type==KeyRelease)
|
else if (xE->u.u.type==KeyRelease || xE->u.u.type==DeviceKeyRelease)
|
||||||
AccessXFilterReleaseEvent(xE,keybd,count);
|
AccessXFilterReleaseEvent(xE,keybd,count);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user