aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/xkb/xkbAccessX.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/xkb/xkbAccessX.c')
-rw-r--r--xorg-server/xkb/xkbAccessX.c107
1 files changed, 56 insertions, 51 deletions
diff --git a/xorg-server/xkb/xkbAccessX.c b/xorg-server/xkb/xkbAccessX.c
index 2baa70d7a..47023c048 100644
--- a/xorg-server/xkb/xkbAccessX.c
+++ b/xorg-server/xkb/xkbAccessX.c
@@ -30,19 +30,20 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <stdio.h>
#include <math.h>
-#define NEED_EVENTS 1
#include <X11/X.h>
#include <X11/Xproto.h>
#include <X11/keysym.h>
+#include "exglobals.h"
+#include <X11/extensions/XIproto.h>
#include "inputstr.h"
+#include "eventstr.h"
#include <xkbsrv.h>
#if !defined(WIN32)
#include <sys/time.h>
#endif
-_X_EXPORT int XkbDfltRepeatDelay= 660;
-_X_EXPORT int XkbDfltRepeatInterval= 40;
-pointer XkbLastRepeatEvent= NULL;
+int XkbDfltRepeatDelay= 660;
+int XkbDfltRepeatInterval= 40;
#define DFLT_TIMEOUT_CTRLS (XkbAX_KRGMask|XkbStickyKeysMask|XkbMouseKeysMask)
#define DFLT_TIMEOUT_OPTS (XkbAX_IndicatorFBMask)
@@ -118,27 +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);
+ event.key_repeat = isRepeat;
+
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))
- XkbDDXKeyClick(keybd,keyCode,TRUE);
- else if (isRepeat)
- XkbLastRepeatEvent= (pointer)&xE;
- XkbProcessKeyboardEvent(&xE,keybd,1L);
- XkbLastRepeatEvent= NULL;
+ XkbProcessKeyboardEvent(&event, keybd);
return;
-
} /* AccessXKeyboardEvent */
/************************************************************************/
@@ -305,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, DeviceKeyRelease, key, True);
- AccessXKeyboardEvent(dev, DeviceKeyPress, key, True);
+ AccessXKeyboardEvent(dev, ET_KeyPress, xkbi->repeatKey, True);
return xkbi->desc->ctrls->repeat_interval;
}
@@ -347,7 +344,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)))
@@ -443,14 +440,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) {
@@ -556,7 +552,7 @@ KeySym * sym = XkbKeySymsPtr(xkbi->desc,key);
}
if (!ignoreKeyEvent)
- XkbProcessKeyboardEvent(xE,keybd,count);
+ XkbProcessKeyboardEvent(event, keybd);
return ignoreKeyEvent;
} /* AccessXFilterPressEvent */
@@ -573,13 +569,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
@@ -605,7 +600,7 @@ Bool ignoreKeyEvent = FALSE;
ev.keycode= key;
ev.slowKeysDelay= ctrls->slow_keys_delay;
ev.debounceDelay= ctrls->debounce_delay;
- if (BitIsOn(keybd->key->down,key) | (xkbi->mouseKey == key)) {
+ if (BitIsOn(keybd->key->down,key) || (xkbi->mouseKey == key)) {
ev.detail= XkbAXN_SKRelease;
beep_type= _BEEP_SLOW_RELEASE;
}
@@ -665,7 +660,7 @@ Bool ignoreKeyEvent = FALSE;
}
if (!ignoreKeyEvent)
- XkbProcessKeyboardEvent(xE,keybd,count);
+ XkbProcessKeyboardEvent(event, keybd);
return ignoreKeyEvent;
} /* AccessXFilterReleaseEvent */
@@ -683,24 +678,31 @@ Bool ignoreKeyEvent = FALSE;
extern int xkbDevicePrivateIndex;
extern void xkbUnwrapProc(DeviceIntPtr, DeviceHandleProc, pointer);
void
-ProcessPointerEvent( register xEvent * xE,
- register DeviceIntPtr mouse,
- int count)
+ProcessPointerEvent( InternalEvent *ev,
+ DeviceIntPtr mouse)
{
-DeviceIntPtr dev = GetPairedDevice(mouse);
-XkbSrvInfoPtr xkbi = dev->key->xkbInfo;
+DeviceIntPtr dev;
+XkbSrvInfoPtr xkbi = NULL;
unsigned changed = 0;
ProcessInputProc backupproc;
xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(mouse);
+DeviceEvent *event = (DeviceEvent*)ev;
- xkbi->shiftKeyCount = 0;
- xkbi->lastPtrEventTime= xE->u.keyButtonPointer.time;
+ dev = (IsMaster(mouse) || mouse->u.master) ? GetMaster(mouse, MASTER_KEYBOARD) : mouse;
- if (xE->u.u.type==ButtonPress) {
+ if (dev && dev->key)
+ {
+ xkbi = dev->key->xkbInfo;
+ xkbi->shiftKeyCount = 0;
+ xkbi->lastPtrEventTime= event->time;
+ }
+
+ if (event->type == ET_ButtonPress) {
changed |= XkbPointerButtonMask;
}
- else if (xE->u.u.type==ButtonRelease) {
- xkbi->lockedPtrButtons&= ~(1<<(xE->u.u.detail&0x7));
+ else if (event->type == ET_ButtonRelease) {
+ if (xkbi)
+ xkbi->lockedPtrButtons&= ~(1 << (event->detail.key & 0x7));
changed |= XkbPointerButtonMask;
}
@@ -719,15 +721,19 @@ xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(mouse);
*
* see. it's still steaming. told you. (whot)
*/
+
UNWRAP_PROCESS_INPUT_PROC(mouse, xkbPrivPtr, backupproc);
- mouse->public.processInputProc(xE, mouse, count);
+ mouse->public.processInputProc(ev, mouse);
COND_WRAP_PROCESS_INPUT_PROC(mouse, xkbPrivPtr,
backupproc, xkbUnwrapProc);
- xkbi->state.ptr_buttons = mouse->button->state;
+ if (!xkbi)
+ return;
+
+ xkbi->state.ptr_buttons = (mouse->button) ? mouse->button->state : 0;
/* clear any latched modifiers */
- if ( xkbi->state.latched_mods && (xE->u.u.type==ButtonRelease) ) {
+ if ( xkbi->state.latched_mods && (event->type == ET_ButtonRelease) ) {
unsigned changed_leds;
XkbStateRec oldState;
XkbSrvLedInfoPtr sli;
@@ -742,17 +748,16 @@ xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(mouse);
changed_leds= XkbIndicatorsToUpdate(dev,changed,False);
if (changed_leds) {
XkbEventCauseRec cause;
- XkbSetCauseKey(&cause,(xE->u.u.detail&0x7),xE->u.u.type);
+ XkbSetCauseKey(&cause,(event->detail.key & 0x7), event->type);
XkbUpdateIndicators(dev,changed_leds,True,NULL,&cause);
}
}
- dev->key->state= XkbStateFieldFromRec(&xkbi->state);
}
if (((xkbi->flags&_XkbStateNotifyInProgress)==0)&&(changed!=0)) {
xkbStateNotify sn;
- sn.keycode= xE->u.u.detail;
- sn.eventType= xE->u.u.type;
+ sn.keycode= event->detail.key;
+ sn.eventType= event->type;
sn.requestMajor = sn.requestMinor = 0;
sn.changed= changed;
XkbSendStateNotify(dev,&sn);