aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/xkb/xkbEvents.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/xkb/xkbEvents.c')
-rw-r--r--xorg-server/xkb/xkbEvents.c77
1 files changed, 52 insertions, 25 deletions
diff --git a/xorg-server/xkb/xkbEvents.c b/xorg-server/xkb/xkbEvents.c
index 49725d065..4d3debba7 100644
--- a/xorg-server/xkb/xkbEvents.c
+++ b/xorg-server/xkb/xkbEvents.c
@@ -37,6 +37,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <X11/extensions/XIproto.h>
#include "inputstr.h"
#include "windowstr.h"
+#include "exevents.h"
#include <xkbsrv.h>
#include "xkb.h"
@@ -109,7 +110,7 @@ Time time;
register CARD16 changed,bState;
interest = kbd->xkb_interest;
- if (!interest)
+ if (!interest || !kbd->key || !kbd->key->xkbInfo)
return;
xkbi = kbd->key->xkbInfo;
state= &xkbi->state;
@@ -168,6 +169,9 @@ XkbSrvInfoPtr xkbi;
unsigned time = 0,initialized;
CARD16 changed;
+ if (!kbd->key || !kbd->key->xkbInfo)
+ return;
+
xkbi = kbd->key->xkbInfo;
initialized= 0;
@@ -291,7 +295,7 @@ XkbInterestPtr interest;
Time time = 0;
interest = kbd->xkb_interest;
- if (!interest)
+ if (!interest || !kbd->key || !kbd->key->xkbInfo)
return;
xkbi = kbd->key->xkbInfo;
@@ -401,6 +405,9 @@ CARD16 pitch,duration;
Time time = 0;
XID winID = 0;
+ if (!kbd->key || !kbd->key->xkbInfo)
+ return;
+
xkbi = kbd->key->xkbInfo;
if ((force||(xkbi->desc->ctrls->enabled_ctrls&XkbAudibleBellMask))&&
@@ -616,11 +623,12 @@ XkbSrvInfoPtr xkbi;
XkbInterestPtr interest;
Time time = 0;
- xkbi = kbd->key->xkbInfo;
interest = kbd->xkb_interest;
- if (!interest)
+ if (!interest || !kbd->key || !kbd->key->xkbInfo)
return;
+ xkbi = kbd->key->xkbInfo;
+
initialized = 0;
pEv->mods= xkbi->state.mods;
pEv->group= xkbi->state.group;
@@ -811,21 +819,29 @@ int i, button_mask;
DeviceIntPtr pXDev = inputInfo.keyboard;
XkbSrvInfoPtr xkbi;
- xkbi= pXDev->key->xkbInfo;
+ if (xE->u.u.type & EXTENSION_EVENT_BASE)
+ {
+ pXDev = XIGetDevice(xE);
+ if (!pXDev)
+ pXDev = inputInfo.keyboard;
+ }
+
+ xkbi= (pXDev->key) ? pXDev->key->xkbInfo : NULL;
+
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("XKbFilterWriteEvents:\n");
- DebugF(" Event state= 0x%04x\n",xE[0].u.keyButtonPointer.state);
- DebugF(" XkbLastRepeatEvent!=xE (0x%p!=0x%p) %s\n",
+ 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(" (xkbClientEventsFlags&XWDA)==0 (0x%x) %s\n",
+ DebugF("[xkb] (xkbClientEventsFlags&XWDA)==0 (0x%x) %s\n",
pClient->xkbClientFlags,
(_XkbWantsDetectableAutoRepeat(pClient)?"True":"False"));
- DebugF(" !IsRelease(%d) %s\n",xE[0].u.u.type,
+ DebugF("[xkb] !IsRelease(%d) %s\n",xE[0].u.u.type,
(!_XkbIsReleaseEvent(xE[0].u.u.type))?"True":"False");
}
if ( (XkbLastRepeatEvent==(pointer)xE) &&
@@ -833,7 +849,12 @@ XkbSrvInfoPtr xkbi;
(_XkbIsReleaseEvent(xE[0].u.u.type)) ) {
return False;
}
- if ((pXDev->grab != NullGrab) && pXDev->fromPassiveGrab &&
+
+ if (!xkbi)
+ return True;
+
+ 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))) {
@@ -868,27 +889,29 @@ XkbSrvInfoPtr xkbi;
* when the mouse is released, the server does not behave properly.
* Faking a release of the button here solves the problem.
*/
- DebugF("Faking release of button %d\n", xE[0].u.u.detail);
- XkbDDXFakePointerButton(ButtonRelease, xE[0].u.u.detail);
+ 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))) {
- XkbStatePtr s= &xkbi->state;
- DebugF("XKbFilterWriteEvents (non-XKB):\n");
- DebugF("event= 0x%04x\n",xE[i].u.keyButtonPointer.state);
- DebugF("lookup= 0x%02x, grab= 0x%02x\n",s->lookup_mods,
- s->grab_mods);
- DebugF("compat lookup= 0x%02x, grab= 0x%02x\n",
- s->compat_lookup_mods,
- s->compat_grab_mods);
+ 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;
@@ -918,13 +941,13 @@ XkbSrvInfoPtr xkbi;
if (type == ButtonPress &&
((xE[i].u.keyButtonPointer.state >> 7) & button_mask) == button_mask &&
(xkbi->lockedPtrButtons & button_mask) == button_mask) {
- DebugF("Faking release of button %d\n", xE[i].u.u.detail);
- XkbDDXFakePointerButton(ButtonRelease, xE[i].u.u.detail);
+ 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("Faking release of button %d\n", ((deviceKeyButtonPointer*)&xE[i])->state);
- XkbDDXFakePointerButton(DeviceButtonRelease, ((deviceKeyButtonPointer*)&xE[i])->state);
+ DebugF("[xkb] Faking release of button %d\n", ((deviceKeyButtonPointer*)&xE[i])->state);
+ XkbDDXFakeDeviceButton(xkbi->device, 0, ((deviceKeyButtonPointer*)&xE[i])->state);
}
}
}
@@ -996,6 +1019,10 @@ unsigned long autoCtrls,autoValues;
ClientPtr client = NULL;
found= False;
+
+ if (!dev->key || !dev->key->xkbInfo)
+ return found;
+
autoCtrls= autoValues= 0;
if ( dev->xkb_interest ) {
interest = dev->xkb_interest;