summaryrefslogtreecommitdiff
path: root/xkb
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2009-01-30 14:35:22 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2009-02-23 17:52:39 +1000
commit007e93c869325cafcc29d975b356dbb8e7cd2ac1 (patch)
treea824cb5c60f36c5167e3881b31f12eb62987cae2 /xkb
parent64ea6078105f73d1b727619fc123920bc7e4a06c (diff)
xkb: Switch the xkb event processing path over to InternalEvents.
Before dropping down into the DIX, convert back into XI events. This is a temporary solution only, until the DIX is capable of handling InternalEvents anyway. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'xkb')
-rw-r--r--xkb/xkbAccessX.c76
-rw-r--r--xkb/xkbActions.c28
-rw-r--r--xkb/xkbPrKeyEv.c80
3 files changed, 106 insertions, 78 deletions
diff --git a/xkb/xkbAccessX.c b/xkb/xkbAccessX.c
index c7f7439c2..8a520c6d3 100644
--- a/xkb/xkbAccessX.c
+++ b/xkb/xkbAccessX.c
@@ -119,22 +119,26 @@ XkbControlsPtr ctrls = xkbi->desc->ctrls;
/************************************************************************/
static void
AccessXKeyboardEvent(DeviceIntPtr keybd,
- BYTE type,
+ int type,
BYTE keyCode,
Bool isRepeat)
{
-xEvent xE;
-
- xE.u.u.type = type;
- xE.u.u.detail = keyCode;
- xE.u.keyButtonPointer.time = GetTimeInMillis();
+ DeviceEvent event;
+ memset(&event, 0, sizeof(DeviceEvent));
+ event.header = ET_Internal;
+ event.type = type;
+ event.detail.key = keyCode;
+ event.time = GetTimeInMillis();
+ event.length = sizeof(DeviceEvent);
+
if (xkbDebugFlags&0x8) {
- DebugF("[xkb] AXKE: Key %d %s\n",keyCode,(xE.u.u.type==KeyPress?"down":"up"));
+ DebugF("[xkb] AXKE: Key %d %s\n", keyCode,
+ (event->type == ET_KeyPress ? "down" : "up"));
}
if (!_XkbIsPressEvent(type) && isRepeat)
- XkbLastRepeatEvent= (pointer)&xE;
- XkbProcessKeyboardEvent(&xE,keybd,1L);
+ XkbLastRepeatEvent= (pointer)&event;
+ XkbProcessKeyboardEvent(&event, keybd);
XkbLastRepeatEvent= NULL;
return;
@@ -310,8 +314,8 @@ KeyCode key;
return 0;
key = xkbi->repeatKey;
- AccessXKeyboardEvent(dev, DeviceKeyRelease, key, True);
- AccessXKeyboardEvent(dev, DeviceKeyPress, key, True);
+ AccessXKeyboardEvent(dev, ET_KeyRelease, key, True);
+ AccessXKeyboardEvent(dev, ET_KeyPress, key, True);
return xkbi->desc->ctrls->repeat_interval;
}
@@ -346,7 +350,7 @@ XkbControlsPtr ctrls;
XkbSendAccessXNotify(keybd,&ev);
if (XkbAX_NeedFeedback(ctrls,XkbAX_SKAcceptFBMask))
XkbDDXAccessXBeep(keybd,_BEEP_SLOW_ACCEPT,XkbSlowKeysMask);
- AccessXKeyboardEvent(keybd,DeviceKeyPress,xkbi->slowKey,False);
+ AccessXKeyboardEvent(keybd, ET_KeyPress,xkbi->slowKey,False);
/* check for magic sequences */
if ((ctrls->enabled_ctrls&XkbAccessXKeysMask) &&
((sym[0]==XK_Shift_R)||(sym[0]==XK_Shift_L)))
@@ -442,14 +446,13 @@ XkbSrvLedInfoPtr sli;
/* */
/************************************************************************/
Bool
-AccessXFilterPressEvent( register xEvent * xE,
- register DeviceIntPtr keybd,
- int count)
+AccessXFilterPressEvent( DeviceEvent* event,
+ DeviceIntPtr keybd)
{
XkbSrvInfoPtr xkbi = keybd->key->xkbInfo;
XkbControlsPtr ctrls = xkbi->desc->ctrls;
Bool ignoreKeyEvent = FALSE;
-KeyCode key = xE->u.u.detail;
+KeyCode key = event->detail.key;
KeySym * sym = XkbKeySymsPtr(xkbi->desc,key);
if (ctrls->enabled_ctrls&XkbAccessXKeysMask) {
@@ -555,7 +558,7 @@ KeySym * sym = XkbKeySymsPtr(xkbi->desc,key);
}
if (!ignoreKeyEvent)
- XkbProcessKeyboardEvent(xE,keybd,count);
+ XkbProcessKeyboardEvent(event, keybd);
return ignoreKeyEvent;
} /* AccessXFilterPressEvent */
@@ -572,13 +575,12 @@ KeySym * sym = XkbKeySymsPtr(xkbi->desc,key);
/* */
/************************************************************************/
Bool
-AccessXFilterReleaseEvent( register xEvent * xE,
- register DeviceIntPtr keybd,
- int count)
+AccessXFilterReleaseEvent( DeviceEvent* event,
+ DeviceIntPtr keybd)
{
XkbSrvInfoPtr xkbi = keybd->key->xkbInfo;
XkbControlsPtr ctrls = xkbi->desc->ctrls;
-KeyCode key = xE->u.u.detail;
+KeyCode key = event->detail.key;
Bool ignoreKeyEvent = FALSE;
/* Don't transmit the KeyRelease if BounceKeys is on and
@@ -664,7 +666,7 @@ Bool ignoreKeyEvent = FALSE;
}
if (!ignoreKeyEvent)
- XkbProcessKeyboardEvent(xE,keybd,count);
+ XkbProcessKeyboardEvent(event, keybd);
return ignoreKeyEvent;
} /* AccessXFilterReleaseEvent */
@@ -691,16 +693,16 @@ XkbSrvInfoPtr xkbi = dev->key->xkbInfo;
unsigned changed = 0;
ProcessInputProc backupproc;
xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(mouse);
-deviceKeyButtonPointer *kbp = xE;
+DeviceEvent *event = (DeviceEvent*)xE;
xkbi->shiftKeyCount = 0;
- xkbi->lastPtrEventTime= kbp->time;
+ xkbi->lastPtrEventTime= event->time;
- if (xE->u.u.type==DeviceButtonPress) {
+ if (event->type == ET_ButtonPress) {
changed |= XkbPointerButtonMask;
}
- else if (xE->u.u.type==DeviceButtonRelease) {
- xkbi->lockedPtrButtons&= ~(1<<(kbp->detail&0x7));
+ else if (event->type == ET_ButtonRelease) {
+ xkbi->lockedPtrButtons&= ~(1 << (event->detail.key & 0x7));
changed |= XkbPointerButtonMask;
}
@@ -719,15 +721,25 @@ deviceKeyButtonPointer *kbp = xE;
*
* see. it's still steaming. told you. (whot)
*/
+
+ {
+ /* FIXME: temporary solution only. */
+ static int nevents;
+ static xEvent ev[1000]; /* enough bytes for the events we have atm */
+
+ nevents = ConvertBackToXI((InternalEvent*)xE, ev);
+
+
UNWRAP_PROCESS_INPUT_PROC(mouse, xkbPrivPtr, backupproc);
- mouse->public.processInputProc(xE, mouse, count);
+ mouse->public.processInputProc(ev, mouse, nevents);
COND_WRAP_PROCESS_INPUT_PROC(mouse, xkbPrivPtr,
backupproc, xkbUnwrapProc);
+ }
xkbi->state.ptr_buttons = mouse->button->state;
/* clear any latched modifiers */
- if ( xkbi->state.latched_mods && (kbp->type==DeviceButtonRelease) ) {
+ if ( xkbi->state.latched_mods && (event->type == ET_ButtonRelease) ) {
unsigned changed_leds;
XkbStateRec oldState;
XkbSrvLedInfoPtr sli;
@@ -742,7 +754,7 @@ deviceKeyButtonPointer *kbp = xE;
changed_leds= XkbIndicatorsToUpdate(dev,changed,False);
if (changed_leds) {
XkbEventCauseRec cause;
- XkbSetCauseKey(&cause,(kbp->detail&0x7),kbp->type);
+ XkbSetCauseKey(&cause,(event->detail.key & 0x7), event->type);
XkbUpdateIndicators(dev,changed_leds,True,NULL,&cause);
}
}
@@ -750,8 +762,8 @@ deviceKeyButtonPointer *kbp = xE;
if (((xkbi->flags&_XkbStateNotifyInProgress)==0)&&(changed!=0)) {
xkbStateNotify sn;
- sn.keycode= kbp->detail;
- sn.eventType= kbp->type;
+ sn.keycode= event->detail.key;
+ sn.eventType= event->type;
sn.requestMajor = sn.requestMinor = 0;
sn.changed= changed;
XkbSendStateNotify(dev,&sn);
diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c
index 9a138b0be..6f5c6bc04 100644
--- a/xkb/xkbActions.c
+++ b/xkb/xkbActions.c
@@ -1068,7 +1068,7 @@ register int i,send;
}
void
-XkbHandleActions(DeviceIntPtr dev,DeviceIntPtr kbd,xEvent *xE,int count)
+XkbHandleActions(DeviceIntPtr dev, DeviceIntPtr kbd, DeviceEvent* event)
{
int key,bit,i;
XkbSrvInfoPtr xkbi;
@@ -1086,7 +1086,7 @@ xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(dev);
keyc= kbd->key;
xkbi= keyc->xkbInfo;
- key= xE->u.u.detail;
+ key= event->detail.key;
/* The state may change, so if we're not in the middle of sending a state
* notify, prepare for it */
if ((xkbi->flags&_XkbStateNotifyInProgress)==0) {
@@ -1100,10 +1100,8 @@ xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(dev);
xkbi->groupChange = 0;
sendEvent = 1;
- keyEvent= ((xE->u.u.type==KeyPress)||(xE->u.u.type==DeviceKeyPress)||
- (xE->u.u.type==KeyRelease)||(xE->u.u.type==DeviceKeyRelease));
- pressEvent= (xE->u.u.type==KeyPress)||(xE->u.u.type==DeviceKeyPress)||
- (xE->u.u.type==ButtonPress)||(xE->u.u.type==DeviceButtonPress);
+ keyEvent= ((event->type == ET_KeyPress) || (event->type == ET_KeyRelease));
+ pressEvent= ((event->type == ET_KeyPress)|| (event->type == ET_ButtonPress));
if (pressEvent) {
if (keyEvent)
@@ -1213,13 +1211,23 @@ xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(dev);
else
tmpdev = GetPairedDevice(dev);
+ {
+
+
+ /* FIXME: temporary solution only. */
+ static int nevents;
+ static xEvent ev[1000]; /* enough bytes for the events we have atm */
+ nevents = ConvertBackToXI((InternalEvent*)event, ev);
+
UNWRAP_PROCESS_INPUT_PROC(tmpdev,xkbPrivPtr, backupproc);
- dev->public.processInputProc(xE,tmpdev,count);
+ dev->public.processInputProc(ev, tmpdev, nevents);
COND_WRAP_PROCESS_INPUT_PROC(tmpdev, xkbPrivPtr,
backupproc,xkbUnwrapProc);
+
+ }
}
else if (keyEvent) {
- FixKeyState(xE,dev);
+ FixKeyState(event, dev);
}
xkbi->prev_state= oldState;
@@ -1229,7 +1237,7 @@ xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(dev);
if (changed) {
xkbStateNotify sn;
sn.keycode= key;
- sn.eventType= xE->u.u.type;
+ sn.eventType= event->type;
sn.requestMajor = sn.requestMinor = 0;
sn.changed= changed;
XkbSendStateNotify(dev,&sn);
@@ -1239,7 +1247,7 @@ xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(dev);
changed= XkbIndicatorsToUpdate(dev,changed,False);
if (changed) {
XkbEventCauseRec cause;
- XkbSetCauseKey(&cause,key,xE->u.u.type);
+ XkbSetCauseKey(&cause, key, event->type);
XkbUpdateIndicators(dev,changed,False,NULL,&cause);
}
return;
diff --git a/xkb/xkbPrKeyEv.c b/xkb/xkbPrKeyEv.c
index badfb14a2..33fd09840 100644
--- a/xkb/xkbPrKeyEv.c
+++ b/xkb/xkbPrKeyEv.c
@@ -38,11 +38,12 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "exevents.h"
#include <xkbsrv.h>
#include <ctype.h>
+#include "events.h"
/***====================================================================***/
void
-XkbProcessKeyboardEvent(xEvent *xE,DeviceIntPtr keybd,int count)
+XkbProcessKeyboardEvent(DeviceEvent *event, DeviceIntPtr keybd)
{
KeyClassPtr keyc = keybd->key;
XkbSrvInfoPtr xkbi;
@@ -51,12 +52,12 @@ XkbBehavior behavior;
unsigned ndx;
xkbi= keyc->xkbInfo;
- key= xE->u.u.detail;
+ key= event->detail.key;
if (xkbDebugFlags&0x8) {
- DebugF("[xkb] XkbPKE: Key %d %s\n",key,(xE->u.u.type==DeviceKeyPress?"down":"up"));
+ DebugF("[xkb] XkbPKE: Key %d %s\n",key,(event->type == ET_KeyPress?"down":"up"));
}
- if ( (xkbi->repeatKey==key) && (xE->u.u.type==DeviceKeyRelease) &&
+ if ( (xkbi->repeatKey==key) && (event->type== ET_KeyRelease) &&
((xkbi->desc->ctrls->enabled_ctrls&XkbRepeatKeysMask)==0) ) {
AccessXCancelRepeatKey(xkbi,key);
}
@@ -70,37 +71,37 @@ unsigned ndx;
if ((behavior.type&XkbKB_Permanent)==0) {
switch (behavior.type) {
case XkbKB_Default:
- if (xE->u.u.type == DeviceKeyPress &&
+ if (event->type == ET_KeyPress &&
(keyc->down[key>>3] & (1<<(key&7)))) {
- XkbLastRepeatEvent= (pointer)xE;
+ XkbLastRepeatEvent= (pointer)event;
- xE->u.u.type = DeviceKeyRelease;
- XkbHandleActions(keybd,keybd,xE,count);
+ event->type = ET_KeyRelease;
+ XkbHandleActions(keybd, keybd, event);
- xE->u.u.type = DeviceKeyPress;
- XkbHandleActions(keybd,keybd,xE,count);
+ event->type = ET_KeyPress;
+ XkbHandleActions(keybd, keybd, event);
XkbLastRepeatEvent= NULL;
return;
}
- else if (xE->u.u.type==DeviceKeyRelease &&
+ else if (event->type == ET_KeyRelease &&
(!(keyc->down[key>>3]&(1<<(key&7))))) {
- XkbLastRepeatEvent= (pointer)&xE;
- xE->u.u.type = DeviceKeyPress;
- XkbHandleActions(keybd,keybd,xE,count);
- xE->u.u.type = DeviceKeyRelease;
- XkbHandleActions(keybd,keybd,xE,count);
+ XkbLastRepeatEvent= (pointer)event;
+ event->type = ET_KeyPress;
+ XkbHandleActions(keybd, keybd, event);
+ event->type = ET_KeyRelease;
+ XkbHandleActions(keybd, keybd, event);
XkbLastRepeatEvent= NULL;
return;
}
break;
case XkbKB_Lock:
- if (xE->u.u.type == DeviceKeyRelease) {
+ if (event->type == ET_KeyRelease) {
return;
}
else {
int bit= 1<<(key&7);
if ( keyc->down[key>>3]&bit ) {
- xE->u.u.type = DeviceKeyRelease;
+ event->type = ET_KeyRelease;
}
}
break;
@@ -109,25 +110,25 @@ unsigned ndx;
if ( ndx<xkbi->nRadioGroups ) {
XkbRadioGroupPtr rg;
- if (xE->u.u.type == DeviceKeyRelease)
+ if (event->type == ET_KeyRelease)
return;
rg = &xkbi->radioGroups[ndx];
- if ( rg->currentDown == xE->u.u.detail ) {
+ if ( rg->currentDown == event->detail.key) {
if (behavior.data&XkbKB_RGAllowNone) {
- xE->u.u.type = DeviceKeyRelease;
- XkbHandleActions(keybd,keybd,xE,count);
+ event->type = ET_KeyRelease;
+ XkbHandleActions(keybd, keybd, event);
rg->currentDown= 0;
}
return;
}
if ( rg->currentDown!=0 ) {
- int key = xE->u.u.detail;
- xE->u.u.type = DeviceKeyRelease;
- xE->u.u.detail= rg->currentDown;
- XkbHandleActions(keybd,keybd,xE,count);
- xE->u.u.type = DeviceKeyPress;
- xE->u.u.detail= key;
+ int key = event->detail.key;
+ event->type = ET_KeyRelease;
+ event->detail.key = rg->currentDown;
+ XkbHandleActions(keybd, keybd, event);
+ event->type = ET_KeyPress;
+ event->detail.key = key;
}
rg->currentDown= key;
}
@@ -142,7 +143,7 @@ unsigned ndx;
break;
if ((behavior.data>=xkbi->desc->min_key_code)&&
(behavior.data<=xkbi->desc->max_key_code)) {
- xE->u.u.detail= behavior.data;
+ event->detail.key = behavior.data;
/* 9/11/94 (ef) -- XXX! need to match release with */
/* press even if the state of the */
/* corresponding overlay control */
@@ -155,7 +156,7 @@ unsigned ndx;
break;
}
}
- XkbHandleActions(keybd,keybd,xE,count);
+ XkbHandleActions(keybd, keybd, event);
return;
}
@@ -167,16 +168,23 @@ ProcessKeyboardEvent(xEvent *xE,DeviceIntPtr keybd,int count)
XkbSrvInfoPtr xkbi = NULL;
ProcessInputProc backup_proc;
xkbDeviceInfoPtr xkb_priv = XKBDEVICEINFO(keybd);
- int is_press = (xE->u.u.type == DeviceKeyPress);
- int is_release = (xE->u.u.type == DeviceKeyRelease);
+ DeviceEvent *event = (DeviceEvent*)xE;
+ 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) {
+ /* FIXME: temporary solution only. */
+ static int nevents;
+ static xEvent ev[1000]; /* enough bytes for the events we have atm */
+
+ nevents = ConvertBackToXI((InternalEvent*)xE, ev);
+
UNWRAP_PROCESS_INPUT_PROC(keybd, xkb_priv, backup_proc);
- keybd->public.processInputProc(xE, keybd, count);
+ keybd->public.processInputProc(ev, keybd, nevents);
COND_WRAP_PROCESS_INPUT_PROC(keybd, xkb_priv, backup_proc,
xkbUnwrapProc);
return;
@@ -190,12 +198,12 @@ ProcessKeyboardEvent(xEvent *xE,DeviceIntPtr keybd,int count)
* they'll punt through XPKE anyway. */
if ((xkbi->desc->ctrls->enabled_ctrls & XkbAllFilteredEventsMask)) {
if (is_press)
- AccessXFilterPressEvent(xE, keybd, count);
+ AccessXFilterPressEvent(event, keybd);
else if (is_release)
- AccessXFilterReleaseEvent(xE, keybd, count);
+ AccessXFilterReleaseEvent(event, keybd);
} else {
- XkbProcessKeyboardEvent(xE, keybd, count);
+ XkbProcessKeyboardEvent(event, keybd);
}
return;