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.
(cherry picked from commit 6334d4e7be
with some
additional compile fixes and non-MPX adaptations)
This commit is contained in:
parent
91077bfc50
commit
99e826e867
|
@ -314,8 +314,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,11 +39,12 @@ 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;
|
int xkbDevicePrivateIndex = -1;
|
||||||
|
|
||||||
static void
|
void
|
||||||
xkbUnwrapProc(DeviceIntPtr device, DeviceHandleProc proc,
|
xkbUnwrapProc(DeviceIntPtr device, DeviceHandleProc proc,
|
||||||
pointer data)
|
pointer data)
|
||||||
{
|
{
|
||||||
|
@ -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>
|
||||||
|
@ -813,7 +814,9 @@ XkbSrvInfoPtr xkbi;
|
||||||
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",
|
||||||
|
@ -832,7 +835,9 @@ XkbSrvInfoPtr xkbi;
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
if ((pXDev->grab != NullGrab) && pXDev->fromPassiveGrab &&
|
if ((pXDev->grab != NullGrab) && pXDev->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;
|
||||||
|
@ -877,10 +882,12 @@ XkbSrvInfoPtr xkbi;
|
||||||
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",
|
||||||
|
@ -900,9 +907,18 @@ XkbSrvInfoPtr xkbi;
|
||||||
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;
|
||||||
|
}
|
||||||
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 &&
|
||||||
|
@ -911,7 +927,14 @@ XkbSrvInfoPtr xkbi;
|
||||||
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"));
|
||||||
|
@ -69,45 +72,69 @@ unsigned ndx;
|
||||||
/* below XKB, such as a key that physically locks. XKB does not */
|
/* below XKB, such as a key that physically locks. XKB does not */
|
||||||
/* 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 */
|
||||||
|
|
||||||
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];
|
||||||
|
@ -121,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;
|
||||||
|
@ -173,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