diff options
-rw-r--r-- | dix/getevents.c | 80 | ||||
-rw-r--r-- | hw/dmx/input/dmxevents.c | 54 | ||||
-rw-r--r-- | hw/kdrive/src/kinput.c | 18 | ||||
-rw-r--r-- | hw/xfree86/common/xf86Events.c | 6 | ||||
-rw-r--r-- | hw/xfree86/common/xf86Xinput.c | 38 | ||||
-rw-r--r-- | hw/xnest/Events.c | 32 | ||||
-rw-r--r-- | hw/xquartz/darwinEvents.c | 20 | ||||
-rw-r--r-- | hw/xwin/winkeybd.c | 6 | ||||
-rw-r--r-- | hw/xwin/winmouse.c | 15 | ||||
-rw-r--r-- | include/input.h | 21 |
10 files changed, 155 insertions, 135 deletions
diff --git a/dix/getevents.c b/dix/getevents.c index 5ffa1df92..68a5224dc 100644 --- a/dix/getevents.c +++ b/dix/getevents.c @@ -47,6 +47,7 @@ #include "eventstr.h" #include "eventconvert.h" #include "inpututils.h" +#include "mi.h" #include <X11/extensions/XKBproto.h> #include "xkbsrv.h" @@ -924,6 +925,39 @@ updateHistory(DeviceIntPtr dev, ValuatorMask *mask, CARD32 ms) } } +static void +queueEventList(DeviceIntPtr device, EventList *events, int nevents) +{ + int i; + + for (i = 0; i < nevents; i++) + mieqEnqueue(device, (InternalEvent*)((events + i)->event)); +} + +/** + * Generate internal events representing this keyboard event and enqueue + * them on the event queue. + * + * FIXME: don't require the event list to be passed in. + * FIXME: flags for relative/abs motion? + * + * @param events Event list used as temporary storage + * @param device The device to generate the event for + * @param type Event type, one of KeyPress or KeyRelease + * @param keycode Key code of the pressed/released key + * @param mask Valuator mask for valuators present for this event. + * + */ +void +QueueKeyboardEvents(EventList *events, DeviceIntPtr device, int type, + int keycode, const ValuatorMask *mask) +{ + int nevents; + + nevents = GetKeyboardEvents(events, device, type, keycode, mask); + queueEventList(device, events, nevents); +} + /** * Returns a set of InternalEvents for KeyPress/KeyRelease, optionally * also with valuator events. @@ -1062,6 +1096,30 @@ transformAbsolute(DeviceIntPtr dev, ValuatorMask *mask, int *x, int *y) } /** + * Generate internal events representing this pointer event and enqueue them + * on the event queue. + * + * FIXME: don't require the event list to be passed in. + * + * @param events Event list used as temporary storage + * @param device The device to generate the event for + * @param type Event type, one of ButtonPress, ButtonRelease, MotionNotify + * @param buttons Button number of the buttons modified. Must be 0 for + * MotionNotify + * @param flags Event modification flags + * @param mask Valuator mask for valuators present for this event. + */ +void +QueuePointerEvents(EventList *events, DeviceIntPtr device, int type, + int buttons, int flags, const ValuatorMask *mask) +{ + int nevents; + + nevents = GetPointerEvents(events, device, type, buttons, flags, mask); + queueEventList(device, events, nevents); +} + +/** * Generate a series of InternalEvents (filled into the EventList) * representing pointer motion, or button presses. * @@ -1214,6 +1272,28 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons, return num_events; } +/** + * Generate internal events representing this proximity event and enqueue + * them on the event queue. + * + * FIXME: don't require the event list to be passed in. + * + * @param events Event list used as temporary storage + * @param device The device to generate the event for + * @param type Event type, one of ProximityIn or ProximityOut + * @param keycode Key code of the pressed/released key + * @param mask Valuator mask for valuators present for this event. + * + */ +void +QueueProximityEvents(EventList *events, DeviceIntPtr device, int type, + const ValuatorMask *mask) +{ + int nevents; + + nevents = GetProximityEvents(events, device, type, mask); + queueEventList(device, events, nevents); +} /** * Generate ProximityIn/ProximityOut InternalEvents, accompanied by diff --git a/hw/dmx/input/dmxevents.c b/hw/dmx/input/dmxevents.c index 15d80f5bb..3f9035cdd 100644 --- a/hw/dmx/input/dmxevents.c +++ b/hw/dmx/input/dmxevents.c @@ -176,7 +176,7 @@ static void enqueueMotion(DevicePtr pDev, int x, int y) { GETDMXLOCALFROMPDEV; DeviceIntPtr p = dmxLocal->pDevice; - int i, nevents, valuators[3]; + int valuators[3]; EventListPtr events; int detail = 0; /* XXX should this be mask of pressed buttons? */ ValuatorMask mask; @@ -185,10 +185,8 @@ static void enqueueMotion(DevicePtr pDev, int x, int y) valuator_mask_set_range(&mask, 0, 2, valuators); GetEventList(&events); - nevents = GetPointerEvents(events, p, MotionNotify, detail, - POINTER_ABSOLUTE | POINTER_SCREEN, &mask); - for (i = 0; i < nevents; i++) - mieqEnqueue(p, (InternalEvent*)(events + i)->event); + QueuePointerEvents(events, p, MotionNotify, detail, + POINTER_ABSOLUTE | POINTER_SCREEN, &mask); return; } @@ -291,10 +289,8 @@ static void dmxExtMotion(DMXLocalInputInfoPtr dmxLocal, deviceValuator *xv = (deviceValuator *)xev+1; int thisX = 0; int thisY = 0; - int i; int count; EventListPtr events; - int nevents; ValuatorMask mask; memset(xE, 0, sizeof(xE)); @@ -348,6 +344,7 @@ static void dmxExtMotion(DMXLocalInputInfoPtr dmxLocal, } count = 2; } else { + int i; for (i = 0, count = 0; i < axesCount; i += 6) { xev->time = GetTimeInMillis(); xev->type = DeviceMotionNotify; @@ -376,10 +373,8 @@ static void dmxExtMotion(DMXLocalInputInfoPtr dmxLocal, dmxSigioBlock(); valuator_mask_set_range(&mask, firstAxis, axesCount, v); GetEventList(&events); - nevents = GetPointerEvents(events, pDevice, MotionNotify, 0, - POINTER_ABSOLUTE, &mask); - for (i = 0; i < nevents; i++) - mieqEnqueue(pDevice, (InternalEvent*)(events + i)->event); + QueuePointerEvents(events, pDevice, MotionNotify, 0, + POINTER_ABSOLUTE, &mask); if (block) dmxSigioUnblock(); @@ -395,7 +390,6 @@ static int dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal, DeviceIntPtr pDevice = dmxLocal->pDevice; int valuators[MAX_VALUATORS]; EventListPtr events; - int nevents, i; ValuatorMask mask; if (!e) @@ -453,11 +447,7 @@ static int dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal, if (block) dmxSigioBlock(); GetEventList(&events); - nevents = GetKeyboardEvents(events, pDevice, event, - ke->keycode, &mask); - for (i = 0; i < nevents; i++) - mieqEnqueue(pDevice, (InternalEvent*)(events + i)->event); - + QueueKeyboardEvents(events, pDevice, event, ke->keycode, &mask); if (block) dmxSigioUnblock(); break; @@ -468,11 +458,8 @@ static int dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal, if (block) dmxSigioBlock(); GetEventList(&events); - nevents = GetPointerEvents(events, pDevice, event, ke->keycode, - POINTER_ABSOLUTE, &mask); - for (i = 0; i < nevents; i++) - mieqEnqueue(pDevice, (InternalEvent*)(events + i)->event); - + QueuePointerEvents(events, pDevice, event, ke->keycode, + POINTER_ABSOLUTE, &mask); if (block) dmxSigioUnblock(); break; @@ -483,10 +470,7 @@ static int dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal, if (block) dmxSigioBlock(); GetEventList(&events); - nevents = GetProximityEvents(events, pDevice, event, &mask); - for (i = 0; i < nevents; i++) - mieqEnqueue(pDevice, (InternalEvent*)(events + i)->event); - + QueueProximityEvents(events, pDevice, event, &mask); if (block) dmxSigioUnblock(); break; @@ -667,7 +651,7 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym, GETDMXINPUTFROMPDEV; xEvent xE; DeviceIntPtr p = dmxLocal->pDevice; - int i, nevents, valuators[3]; + int valuators[3]; EventListPtr events; ValuatorMask mask; @@ -685,9 +669,7 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym, GetEventList(&events); /*ErrorF("KEY %d sym %d\n", detail, (int) keySym);*/ - nevents = GetKeyboardEvents(events, p, type, detail, NULL); - for (i = 0; i < nevents; i++) - mieqEnqueue(p, (InternalEvent*)(events + i)->event); + QueueKeyboardEvents(events, p, type, detail, NULL); return; case ButtonPress: @@ -695,10 +677,8 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym, detail = dmxGetButtonMapping(dmxLocal, detail); valuator_mask_zero(&mask); GetEventList(&events); - nevents = GetPointerEvents(events, p, type, detail, - POINTER_ABSOLUTE | POINTER_SCREEN, &mask); - for (i = 0; i < nevents; i++) - mieqEnqueue(p, (InternalEvent*)(events + i)->event); + QueuePointerEvents(events, p, type, detail, + POINTER_ABSOLUTE | POINTER_SCREEN, &mask); return; case MotionNotify: @@ -707,10 +687,8 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym, valuators[1] = e->xmotion.y; valuators[2] = e->xmotion.state; /* FIXME: WTF?? */ valuator_mask_set_range(&mask, 0, 3, valuators); - nevents = GetPointerEvents(events, p, type, detail, - POINTER_ABSOLUTE | POINTER_SCREEN, &mask); - for (i = 0; i < nevents; i++) - mieqEnqueue(p, (InternalEvent*)(events + i)->event); + QueuePointerEvents(events, p, type, detail, + POINTER_ABSOLUTE | POINTER_SCREEN, &mask); return; case EnterNotify: diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c index f21475fb6..521542c91 100644 --- a/hw/kdrive/src/kinput.c +++ b/hw/kdrive/src/kinput.c @@ -1793,7 +1793,7 @@ void KdReleaseAllKeys (void) { #if 0 - int key, nEvents, i; + int key; KdKeyboardInfo *ki; KdBlockSigio (); @@ -1804,9 +1804,7 @@ KdReleaseAllKeys (void) if (key_is_down(ki->dixdev, key, KEY_POSTED | KEY_PROCESSED)) { KdHandleKeyboardEvent(ki, KeyRelease, key); GetEventList(&kdEvents); - nEvents = GetKeyboardEvents(kdEvents, ki->dixdev, KeyRelease, key, NULL); - for (i = 0; i < nEvents; i++) - KdQueueEvent (ki->dixdev, (kdEvents + i)->event); + QueueGetKeyboardEvents(kdEvents, ki->dixdev, KeyRelease, key, NULL); } } } @@ -1842,7 +1840,7 @@ KdEnqueueKeyboardEvent(KdKeyboardInfo *ki, unsigned char key_code; KeyClassPtr keyc = NULL; KeybdCtrl *ctrl = NULL; - int type, nEvents, i; + int type; if (!ki || !ki->dixdev || !ki->dixdev->kbdfeed || !ki->dixdev->key) return; @@ -1863,10 +1861,7 @@ KdEnqueueKeyboardEvent(KdKeyboardInfo *ki, type = KeyPress; GetEventList(&kdEvents); - - nEvents = GetKeyboardEvents(kdEvents, ki->dixdev, type, key_code, NULL); - for (i = 0; i < nEvents; i++) - KdQueueEvent(ki->dixdev, (InternalEvent *)((kdEvents + i)->event)); + QueueKeyboardEvents(kdEvents, ki->dixdev, type, key_code, NULL); } else { ErrorF("driver %s wanted to post scancode %d outside of [%d, %d]!\n", @@ -1965,7 +1960,6 @@ void _KdEnqueuePointerEvent (KdPointerInfo *pi, int type, int x, int y, int z, int b, int absrel, Bool force) { - int nEvents = 0, i = 0; int valuators[3] = { x, y, z }; ValuatorMask mask; @@ -1976,9 +1970,7 @@ _KdEnqueuePointerEvent (KdPointerInfo *pi, int type, int x, int y, int z, valuator_mask_set_range(&mask, 0, 3, valuators); GetEventList(&kdEvents); - nEvents = GetPointerEvents(kdEvents, pi->dixdev, type, b, absrel, &mask); - for (i = 0; i < nEvents; i++) - KdQueueEvent(pi->dixdev, (InternalEvent *)((kdEvents + i)->event)); + QueuePointerEvents(kdEvents, pi->dixdev, type, b, absrel, &mask); } void diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c index 3006ad183..6402d72b3 100644 --- a/hw/xfree86/common/xf86Events.c +++ b/hw/xfree86/common/xf86Events.c @@ -376,7 +376,7 @@ static void xf86ReleaseKeys(DeviceIntPtr pDev) { KeyClassPtr keyc; - int i, j, nevents, sigstate; + int i, sigstate; if (!pDev || !pDev->key) return; @@ -399,9 +399,7 @@ xf86ReleaseKeys(DeviceIntPtr pDev) i++) { if (key_is_down(pDev, i, KEY_POSTED)) { sigstate = xf86BlockSIGIO (); - nevents = GetKeyboardEvents(xf86Events, pDev, KeyRelease, i, NULL); - for (j = 0; j < nevents; j++) - mieqEnqueue(pDev, (InternalEvent*)(xf86Events + j)->event); + QueueKeyboardEvents(xf86Events, pDev, KeyRelease, i, NULL); xf86UnblockSIGIO(sigstate); } } diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c index aae665864..111f16f50 100644 --- a/hw/xfree86/common/xf86Xinput.c +++ b/hw/xfree86/common/xf86Xinput.c @@ -1012,7 +1012,6 @@ xf86PostMotionEventM(DeviceIntPtr device, int is_absolute, const ValuatorMask *mask) { - int i = 0, nevents = 0; int flags = 0; if (valuator_mask_num_valuators(mask) > 0) @@ -1050,11 +1049,7 @@ xf86PostMotionEventM(DeviceIntPtr device, } #endif - nevents = GetPointerEvents(xf86Events, device, MotionNotify, 0, flags, mask); - - for (i = 0; i < nevents; i++) { - mieqEnqueue(device, (InternalEvent*)((xf86Events + i)->event)); - } + QueuePointerEvents(xf86Events, device, MotionNotify, 0, flags, mask); } void @@ -1099,13 +1094,8 @@ xf86PostProximityEventM(DeviceIntPtr device, int is_in, const ValuatorMask *mask) { - int i, nevents; - - nevents = GetProximityEvents(xf86Events, device, - is_in ? ProximityIn : ProximityOut, mask); - for (i = 0; i < nevents; i++) - mieqEnqueue(device, (InternalEvent*)((xf86Events + i)->event)); - + QueueProximityEvents(xf86Events, device, + is_in ? ProximityIn : ProximityOut, mask); } void @@ -1157,7 +1147,6 @@ xf86PostButtonEventM(DeviceIntPtr device, int is_down, const ValuatorMask *mask) { - int i = 0, nevents = 0; int flags = 0; if (valuator_mask_num_valuators(mask) > 0) @@ -1177,13 +1166,9 @@ xf86PostButtonEventM(DeviceIntPtr device, } #endif - nevents = GetPointerEvents(xf86Events, device, - is_down ? ButtonPress : ButtonRelease, button, - flags, mask); - - for (i = 0; i < nevents; i++) - mieqEnqueue(device, (InternalEvent*)((xf86Events + i)->event)); - + QueuePointerEvents(xf86Events, device, + is_down ? ButtonPress : ButtonRelease, button, + flags, mask); } void @@ -1235,8 +1220,6 @@ xf86PostKeyEventM(DeviceIntPtr device, int is_absolute, const ValuatorMask *mask) { - int i = 0, nevents = 0; - #if XFreeXDGA DeviceIntPtr pointer; @@ -1250,12 +1233,9 @@ xf86PostKeyEventM(DeviceIntPtr device, } #endif - nevents = GetKeyboardEvents(xf86Events, device, - is_down ? KeyPress : KeyRelease, - key_code, mask); - - for (i = 0; i < nevents; i++) - mieqEnqueue(device, (InternalEvent*)((xf86Events + i)->event)); + QueueKeyboardEvents(xf86Events, device, + is_down ? KeyPress : KeyRelease, + key_code, mask); } void diff --git a/hw/xnest/Events.c b/hw/xnest/Events.c index 5c800860a..574e4e415 100644 --- a/hw/xnest/Events.c +++ b/hw/xnest/Events.c @@ -104,20 +104,16 @@ xnestCollectExposures(void) void xnestQueueKeyEvent(int type, unsigned int keycode) { - int i, n; - GetEventList(&xnestEvents); lastEventTime = GetTimeInMillis(); - n = GetKeyboardEvents(xnestEvents, xnestKeyboardDevice, type, keycode, NULL); - for (i = 0; i < n; i++) - mieqEnqueue(xnestKeyboardDevice, (InternalEvent*)(xnestEvents + i)->event); + QueueKeyboardEvents(xnestEvents, xnestKeyboardDevice, type, keycode, NULL); } void xnestCollectEvents(void) { XEvent X; - int i, n, valuators[2]; + int valuators[2]; ValuatorMask mask; ScreenPtr pScreen; GetEventList(&xnestEvents); @@ -138,20 +134,16 @@ xnestCollectEvents(void) valuator_mask_set_range(&mask, 0, 0, NULL); xnestUpdateModifierState(X.xkey.state); lastEventTime = GetTimeInMillis(); - n = GetPointerEvents(xnestEvents, xnestPointerDevice, ButtonPress, - X.xbutton.button, POINTER_RELATIVE, &mask); - for (i = 0; i < n; i++) - mieqEnqueue(xnestPointerDevice, (InternalEvent*)(xnestEvents + i)->event); + QueuePointerEvents(xnestEvents, xnestPointerDevice, ButtonPress, + X.xbutton.button, POINTER_RELATIVE, &mask); break; case ButtonRelease: valuator_mask_set_range(&mask, 0, 0, NULL); xnestUpdateModifierState(X.xkey.state); lastEventTime = GetTimeInMillis(); - n = GetPointerEvents(xnestEvents, xnestPointerDevice, ButtonRelease, - X.xbutton.button, POINTER_RELATIVE, &mask); - for (i = 0; i < n; i++) - mieqEnqueue(xnestPointerDevice, (InternalEvent*)(xnestEvents + i)->event); + QueuePointerEvents(xnestEvents, xnestPointerDevice, ButtonRelease, + X.xbutton.button, POINTER_RELATIVE, &mask); break; case MotionNotify: @@ -159,10 +151,8 @@ xnestCollectEvents(void) valuators[1] = X.xmotion.y; valuator_mask_set_range(&mask, 0, 2, valuators); lastEventTime = GetTimeInMillis(); - n = GetPointerEvents(xnestEvents, xnestPointerDevice, MotionNotify, - 0, POINTER_ABSOLUTE, &mask); - for (i = 0; i < n; i++) - mieqEnqueue(xnestPointerDevice, (InternalEvent*)(xnestEvents + i)->event); + QueuePointerEvents(xnestEvents, xnestPointerDevice, MotionNotify, + 0, POINTER_ABSOLUTE, &mask); break; case FocusIn: @@ -193,10 +183,8 @@ xnestCollectEvents(void) valuators[1] = X.xcrossing.y; valuator_mask_set_range(&mask, 0, 2, valuators); lastEventTime = GetTimeInMillis(); - n = GetPointerEvents(xnestEvents, xnestPointerDevice, MotionNotify, - 0, POINTER_ABSOLUTE, &mask); - for (i = 0; i < n; i++) - mieqEnqueue(xnestPointerDevice, (InternalEvent*)(xnestEvents + i)->event); + QueuePointerEvents(xnestEvents, xnestPointerDevice, MotionNotify, + 0, POINTER_ABSOLUTE, &mask); xnestDirectInstallColormaps(pScreen); } } diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c index f3e12250e..99956e012 100644 --- a/hw/xquartz/darwinEvents.c +++ b/hw/xquartz/darwinEvents.c @@ -433,7 +433,6 @@ static void DarwinPrepareValuators(DeviceIntPtr pDev, int *valuators, ScreenPtr void DarwinSendPointerEvents(DeviceIntPtr pDev, int ev_type, int ev_button, float pointer_x, float pointer_y, float pressure, float tilt_x, float tilt_y) { static int darwinFakeMouseButtonDown = 0; - int i, num_events; ScreenPtr screen; int valuators[5]; @@ -486,15 +485,13 @@ void DarwinSendPointerEvents(DeviceIntPtr pDev, int ev_type, int ev_button, floa darwinEvents_lock(); { ValuatorMask mask; valuator_mask_set_range(&mask, 0, (pDev == darwinPointer) ? 2 : 5, valuators); - num_events = GetPointerEvents(darwinEvents, pDev, ev_type, ev_button, - POINTER_ABSOLUTE, &mask); - for(i=0; i<num_events; i++) mieqEnqueue (pDev, (InternalEvent*)darwinEvents[i].event); - if(num_events > 0) DarwinPokeEQ(); + QueuePointerEvents(darwinEvents, pDev, ev_type, ev_button, + POINTER_ABSOLUTE, &mask); + DarwinPokeEQ(); } darwinEvents_unlock(); } void DarwinSendKeyboardEvents(int ev_type, int keycode) { - int i, num_events; if(!darwinEvents) { DEBUG_LOG("DarwinSendKeyboardEvents called before darwinEvents was initialized\n"); @@ -502,15 +499,13 @@ void DarwinSendKeyboardEvents(int ev_type, int keycode) { } darwinEvents_lock(); { - num_events = GetKeyboardEvents(darwinEvents, darwinKeyboard, ev_type, keycode + MIN_KEYCODE, NULL); - for(i=0; i<num_events; i++) mieqEnqueue(darwinKeyboard, (InternalEvent*)darwinEvents[i].event); - if(num_events > 0) DarwinPokeEQ(); + QueueKeyboardEvents(darwinEvents, darwinKeyboard, ev_type, keycode + MIN_KEYCODE, NULL); + DarwinPokeEQ(); } darwinEvents_unlock(); } void DarwinSendProximityEvents(DeviceIntPtr pDev, int ev_type, float pointer_x, float pointer_y, float pressure, float tilt_x, float tilt_y) { - int i, num_events; ScreenPtr screen; int valuators[5]; @@ -531,9 +526,8 @@ void DarwinSendProximityEvents(DeviceIntPtr pDev, int ev_type, float pointer_x, darwinEvents_lock(); { ValuatorMask mask; valuator_mask_set_range(&mask, 0, 5, valuators); - num_events = GetProximityEvents(darwinEvents, pDev, ev_type, &mask); - for(i=0; i<num_events; i++) mieqEnqueue (pDev, (InternalEvent*)darwinEvents[i].event); - if(num_events > 0) DarwinPokeEQ(); + QueueProximityEvents(darwinEvents, pDev, ev_type, &mask); + DarwinPokeEQ(); } darwinEvents_unlock(); } diff --git a/hw/xwin/winkeybd.c b/hw/xwin/winkeybd.c index 912e2de1c..cf0dea22e 100644 --- a/hw/xwin/winkeybd.c +++ b/hw/xwin/winkeybd.c @@ -473,7 +473,6 @@ void winSendKeyEvent (DWORD dwKey, Bool fDown) { EventListPtr events; - int i, nevents; /* * When alt-tabing between screens we can get phantom key up messages @@ -485,10 +484,7 @@ winSendKeyEvent (DWORD dwKey, Bool fDown) g_winKeyState[dwKey] = fDown; GetEventList(&events); - nevents = GetKeyboardEvents(events, g_pwinKeyboard, fDown ? KeyPress : KeyRelease, dwKey + MIN_KEYCODE, NULL); - - for (i = 0; i < nevents; i++) - mieqEnqueue(g_pwinKeyboard, (InternalEvent*)events[i].event); + QueueKeyboardEvents(events, g_pwinKeyboard, fDown ? KeyPress : KeyRelease, dwKey + MIN_KEYCODE, NULL); winDebug("winSendKeyEvent: dwKey: %d, fDown: %d, nEvents %d\n", dwKey, fDown, nevents); diff --git a/hw/xwin/winmouse.c b/hw/xwin/winmouse.c index 080e09626..0e36687cf 100644 --- a/hw/xwin/winmouse.c +++ b/hw/xwin/winmouse.c @@ -235,7 +235,6 @@ void winMouseButtonsSendEvent (int iEventType, int iButton) { EventListPtr events; - int i, nevents; ValuatorMask mask; if (g_winMouseButtonMap) @@ -243,11 +242,8 @@ winMouseButtonsSendEvent (int iEventType, int iButton) valuator_mask_zero(&mask); GetEventList(&events); - nevents = GetPointerEvents(events, g_pwinPointer, iEventType, iButton, - POINTER_RELATIVE, &mask); - - for (i = 0; i < nevents; i++) - mieqEnqueue(g_pwinPointer, (InternalEvent*)events[i].event); + QueuePointerEvents(events, g_pwinPointer, iEventType, iButton, + POINTER_RELATIVE, &mask); #if CYGDEBUG ErrorF("winMouseButtonsSendEvent: iEventType: %d, iButton: %d, nEvents %d\n", @@ -367,7 +363,6 @@ winMouseButtonsHandle (ScreenPtr pScreen, */ void winEnqueueMotion(int x, int y) { - int i, nevents; int valuators[2]; ValuatorMask mask; EventListPtr events; @@ -378,9 +373,7 @@ void winEnqueueMotion(int x, int y) valuator_mask_set_range(&mask, 0, 2, valuators); GetEventList(&events); - nevents = GetPointerEvents(events, g_pwinPointer, MotionNotify, 0, - POINTER_ABSOLUTE | POINTER_SCREEN, &mask); + QueuePointerEvents(events, g_pwinPointer, MotionNotify, 0, + POINTER_ABSOLUTE | POINTER_SCREEN, &mask); - for (i = 0; i < nevents; i++) - mieqEnqueue(g_pwinPointer, (InternalEvent*)events[i].event); } diff --git a/include/input.h b/include/input.h index 6799a53dd..100c00fc0 100644 --- a/include/input.h +++ b/include/input.h @@ -461,6 +461,14 @@ extern _X_EXPORT int GetPointerEvents( int flags, const ValuatorMask *mask); +extern _X_EXPORT void QueuePointerEvents( + EventListPtr events, + DeviceIntPtr pDev, + int type, + int buttons, + int flags, + const ValuatorMask *mask); + extern _X_EXPORT int GetKeyboardEvents( EventListPtr events, DeviceIntPtr pDev, @@ -468,12 +476,25 @@ extern _X_EXPORT int GetKeyboardEvents( int key_code, const ValuatorMask *mask); +extern _X_EXPORT void QueueKeyboardEvents( + EventListPtr events, + DeviceIntPtr pDev, + int type, + int key_code, + const ValuatorMask *mask); + extern int GetProximityEvents( EventListPtr events, DeviceIntPtr pDev, int type, const ValuatorMask *mask); +extern void QueueProximityEvents( + EventListPtr events, + DeviceIntPtr pDev, + int type, + const ValuatorMask *mask); + extern void PostSyntheticMotion( DeviceIntPtr pDev, int x, |