diff options
Diffstat (limited to 'hw')
-rw-r--r-- | hw/dmx/input/dmxevents.c | 51 | ||||
-rw-r--r-- | hw/kdrive/src/kinput.c | 7 | ||||
-rw-r--r-- | hw/xfree86/common/xf86Xinput.c | 91 | ||||
-rw-r--r-- | hw/xfree86/common/xf86Xinput.h | 8 | ||||
-rw-r--r-- | hw/xnest/Events.c | 14 | ||||
-rw-r--r-- | hw/xquartz/darwinEvents.c | 9 | ||||
-rw-r--r-- | hw/xwin/winmouse.c | 8 |
7 files changed, 132 insertions, 56 deletions
diff --git a/hw/dmx/input/dmxevents.c b/hw/dmx/input/dmxevents.c index dfa6bdad5..d22cf0661 100644 --- a/hw/dmx/input/dmxevents.c +++ b/hw/dmx/input/dmxevents.c @@ -53,6 +53,7 @@ #include <X11/keysym.h> #include "opaque.h" #include "inputstr.h" +#include "inpututils.h" #include "mipointer.h" #include "mi.h" #include "exglobals.h" @@ -178,12 +179,14 @@ static void enqueueMotion(DevicePtr pDev, int x, int y) int i, nevents, valuators[3]; EventListPtr events; int detail = 0; /* XXX should this be mask of pressed buttons? */ + ValuatorMask mask; valuators[0] = x; valuators[1] = y; + valuator_mask_set_range(&mask, 0, 2, valuators); GetEventList(&events); nevents = GetPointerEvents(events, p, MotionNotify, detail, - POINTER_ABSOLUTE | POINTER_SCREEN, 0, 2, valuators); + POINTER_ABSOLUTE | POINTER_SCREEN, &mask); for (i = 0; i < nevents; i++) mieqEnqueue(p, (InternalEvent*)(events + i)->event); return; @@ -292,6 +295,7 @@ static void dmxExtMotion(DMXLocalInputInfoPtr dmxLocal, int count; EventListPtr events; int nevents; + ValuatorMask mask; memset(xE, 0, sizeof(xE)); @@ -370,9 +374,10 @@ static void dmxExtMotion(DMXLocalInputInfoPtr dmxLocal, if (block) dmxSigioBlock(); + valuator_mask_set_range(&mask, firstAxis, axesCount, v); GetEventList(&events); - nevents = GetPointerEvents(events, pDevice, MotionNotify, 0, POINTER_ABSOLUTE, - firstAxis, axesCount, v); + nevents = GetPointerEvents(events, pDevice, MotionNotify, 0, + POINTER_ABSOLUTE, &mask); for (i = 0; i < nevents; i++) mieqEnqueue(pDevice, (InternalEvent*)(events + i)->event); @@ -388,13 +393,14 @@ static int dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal, XDeviceKeyEvent *ke = (XDeviceKeyEvent *)e; XDeviceMotionEvent *me = (XDeviceMotionEvent *)e; DeviceIntPtr pDevice = dmxLocal->pDevice; - int valuators[6]; + int valuators[MAX_VALUATORS]; EventListPtr events; int nevents, i; + ValuatorMask mask; if (!e) return -1; /* No extended event passed, cannot handle */ - + if ((XID)dmxLocal->deviceId != ke->deviceid) { /* Search for the correct dmxLocal, * since backend and console events are @@ -432,23 +438,23 @@ static int dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal, } #define EXTRACT_VALUATORS(ke, valuators) \ - valuators[0] = ke->axis_data[0]; \ - valuators[1] = ke->axis_data[1]; \ - valuators[2] = ke->axis_data[2]; \ - valuators[3] = ke->axis_data[3]; \ - valuators[4] = ke->axis_data[4]; \ - valuators[5] = ke->axis_data[5]; \ + valuators[0] = ke->axis_data[0]; \ + valuators[1] = ke->axis_data[1]; \ + valuators[2] = ke->axis_data[2]; \ + valuators[3] = ke->axis_data[3]; \ + valuators[4] = ke->axis_data[4]; \ + valuators[5] = ke->axis_data[5]; \ switch (type) { case XI_DeviceKeyPress: case XI_DeviceKeyRelease: EXTRACT_VALUATORS(ke, valuators); + valuator_mask_set_range(&mask, ke->first_axis, ke->axes_count, valuators); if (block) dmxSigioBlock(); GetEventList(&events); nevents = GetKeyboardValuatorEvents(events, pDevice, event, - ke->keycode, ke->first_axis, - ke->axes_count, valuators); + ke->keycode, &mask); for (i = 0; i < nevents; i++) mieqEnqueue(pDevice, (InternalEvent*)(events + i)->event); @@ -458,12 +464,12 @@ static int dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal, case XI_DeviceButtonPress: case XI_DeviceButtonRelease: EXTRACT_VALUATORS(ke, valuators); + valuator_mask_set_range(&mask, ke->first_axis, ke->axes_count, valuators); if (block) dmxSigioBlock(); GetEventList(&events); nevents = GetPointerEvents(events, pDevice, event, ke->keycode, - POINTER_ABSOLUTE, ke->first_axis, - ke->axes_count, valuators); + POINTER_ABSOLUTE, &mask); for (i = 0; i < nevents; i++) mieqEnqueue(pDevice, (InternalEvent*)(events + i)->event); @@ -473,12 +479,11 @@ static int dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal, case XI_ProximityIn: case XI_ProximityOut: EXTRACT_VALUATORS(ke, valuators); + valuator_mask_set_range(&mask, ke->first_axis, ke->axes_count, valuators); if (block) dmxSigioBlock(); GetEventList(&events); - nevents = GetProximityEvents(events, pDevice, event, - ke->first_axis, ke->axes_count, - valuators); + nevents = GetProximityEvents(events, pDevice, event, &mask); for (i = 0; i < nevents; i++) mieqEnqueue(pDevice, (InternalEvent*)(events + i)->event); @@ -664,6 +669,7 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym, DeviceIntPtr p = dmxLocal->pDevice; int i, nevents, valuators[3]; EventListPtr events; + ValuatorMask mask; DMXDBG2("dmxEnqueue: Enqueuing type=%d detail=0x%0x\n", type, detail); @@ -687,12 +693,10 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym, case ButtonPress: case ButtonRelease: detail = dmxGetButtonMapping(dmxLocal, detail); + valuator_mask_zero(&mask); GetEventList(&events); nevents = GetPointerEvents(events, p, type, detail, - POINTER_ABSOLUTE | POINTER_SCREEN, - 0, /* first_valuator = 0 */ - 0, /* num_valuators = 0 */ - valuators); + POINTER_ABSOLUTE | POINTER_SCREEN, &mask); for (i = 0; i < nevents; i++) mieqEnqueue(p, (InternalEvent*)(events + i)->event); return; @@ -702,8 +706,9 @@ void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym, valuators[0] = e->xmotion.x; 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, 0, 3, valuators); + POINTER_ABSOLUTE | POINTER_SCREEN, &mask); for (i = 0; i < nevents; i++) mieqEnqueue(p, (InternalEvent*)(events + i)->event); return; diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c index 61ee163d4..608f3a725 100644 --- a/hw/kdrive/src/kinput.c +++ b/hw/kdrive/src/kinput.c @@ -48,6 +48,7 @@ #include "exglobals.h" #include "eventstr.h" #include "xserver-properties.h" +#include "inpututils.h" #define AtomFromName(x) MakeAtom(x, strlen(x), 1) @@ -1967,14 +1968,16 @@ _KdEnqueuePointerEvent (KdPointerInfo *pi, int type, int x, int y, int z, { int nEvents = 0, i = 0; int valuators[3] = { x, y, z }; + ValuatorMask mask; /* TRUE from KdHandlePointerEvent, means 'we swallowed the event'. */ if (!force && KdHandlePointerEvent(pi, type, x, y, z, b, absrel)) return; + valuator_mask_set_range(&mask, 0, 3, valuators); + GetEventList(&kdEvents); - nEvents = GetPointerEvents(kdEvents, pi->dixdev, type, b, absrel, - 0, 3, valuators); + nEvents = GetPointerEvents(kdEvents, pi->dixdev, type, b, absrel, &mask); for (i = 0; i < nEvents; i++) KdQueueEvent(pi->dixdev, (InternalEvent *)((kdEvents + i)->event)); } diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c index 67587ca30..cf54fd2f7 100644 --- a/hw/xfree86/common/xf86Xinput.c +++ b/hw/xfree86/common/xf86Xinput.c @@ -67,6 +67,7 @@ #include "exevents.h" /* AddInputDevice */ #include "exglobals.h" #include "eventstr.h" +#include "inpututils.h" #include <string.h> /* InputClassMatches */ #ifdef HAVE_FNMATCH_H @@ -98,7 +99,6 @@ return; \ } - EventListPtr xf86Events = NULL; static int @@ -991,6 +991,19 @@ xf86PostMotionEventP(DeviceIntPtr device, int num_valuators, const int *valuators) { + ValuatorMask mask; + + XI_VERIFY_VALUATORS(num_valuators); + + valuator_mask_set_range(&mask, first_valuator, num_valuators, valuators); + xf86PostMotionEventM(device, is_absolute, &mask); +} + +void +xf86PostMotionEventM(DeviceIntPtr device, + int is_absolute, + const ValuatorMask *mask) +{ int i = 0, nevents = 0; DeviceEvent *event; int flags = 0; @@ -1000,8 +1013,6 @@ xf86PostMotionEventP(DeviceIntPtr device, int dx = 0, dy = 0; #endif - XI_VERIFY_VALUATORS(num_valuators); - if (is_absolute) flags = POINTER_ABSOLUTE; else @@ -1009,19 +1020,20 @@ xf86PostMotionEventP(DeviceIntPtr device, #if XFreeXDGA /* The evdev driver may not always send all axes across. */ - if (num_valuators >= 1 && first_valuator <= 1) { + if (valuator_mask_isset(mask, 0) || + valuator_mask_isset(mask, 1)) if (miPointerGetScreen(device)) { index = miPointerGetScreen(device)->myNum; - if (first_valuator == 0) + if (valuator_mask_isset(mask, 0)) { - dx = valuators[0]; + dx = valuator_mask_get(mask, 0); if (is_absolute) dx -= device->last.valuators[0]; } - if (first_valuator == 1 || num_valuators >= 2) + if (valuator_mask_isset(mask, 1)) { - dy = valuators[1 - first_valuator]; + dy = valuator_mask_get(mask, 1); if (is_absolute) dy -= device->last.valuators[1]; } @@ -1029,12 +1041,9 @@ xf86PostMotionEventP(DeviceIntPtr device, if (DGAStealMotionEvent(device, index, dx, dy)) return; } - } #endif - nevents = GetPointerEvents(xf86Events, device, MotionNotify, 0, - flags, first_valuator, num_valuators, - valuators); + nevents = GetPointerEvents(xf86Events, device, MotionNotify, 0, flags, mask); for (i = 0; i < nevents; i++) { event = (DeviceEvent*)((xf86Events + i)->event); @@ -1072,13 +1081,23 @@ xf86PostProximityEventP(DeviceIntPtr device, int num_valuators, const int *valuators) { - int i, nevents; + ValuatorMask mask; XI_VERIFY_VALUATORS(num_valuators); + valuator_mask_set_range(&mask, first_valuator, num_valuators, valuators); + xf86PostProximityEventM(device, is_in, &mask); +} + +void +xf86PostProximityEventM(DeviceIntPtr device, + int is_in, + const ValuatorMask *mask) +{ + int i, nevents; + nevents = GetProximityEvents(xf86Events, device, - is_in ? ProximityIn : ProximityOut, - first_valuator, num_valuators, valuators); + is_in ? ProximityIn : ProximityOut, mask); for (i = 0; i < nevents; i++) mieqEnqueue(device, (InternalEvent*)((xf86Events + i)->event)); @@ -1118,6 +1137,21 @@ xf86PostButtonEventP(DeviceIntPtr device, int num_valuators, const int *valuators) { + ValuatorMask mask; + + XI_VERIFY_VALUATORS(num_valuators); + + valuator_mask_set_range(&mask, first_valuator, num_valuators, valuators); + xf86PostButtonEventM(device, is_absolute, button, is_down, &mask); +} + +void +xf86PostButtonEventM(DeviceIntPtr device, + int is_absolute, + int button, + int is_down, + const ValuatorMask *mask) +{ int i = 0, nevents = 0; int flags = 0; @@ -1125,8 +1159,6 @@ xf86PostButtonEventP(DeviceIntPtr device, int index; #endif - XI_VERIFY_VALUATORS(num_valuators); - if (is_absolute) flags = POINTER_ABSOLUTE; else @@ -1142,7 +1174,7 @@ xf86PostButtonEventP(DeviceIntPtr device, nevents = GetPointerEvents(xf86Events, device, is_down ? ButtonPress : ButtonRelease, button, - flags, first_valuator, num_valuators, valuators); + flags, mask); for (i = 0; i < nevents; i++) mieqEnqueue(device, (InternalEvent*)((xf86Events + i)->event)); @@ -1183,15 +1215,27 @@ xf86PostKeyEventP(DeviceIntPtr device, int num_valuators, const int *valuators) { - int i = 0, nevents = 0; + ValuatorMask mask; XI_VERIFY_VALUATORS(num_valuators); + valuator_mask_set_range(&mask, first_valuator, num_valuators, valuators); + xf86PostKeyEventM(device, key_code, is_down, is_absolute, &mask); +} + +void +xf86PostKeyEventM(DeviceIntPtr device, + unsigned int key_code, + int is_down, + int is_absolute, + const ValuatorMask *mask) +{ + int i = 0, nevents = 0; + if (is_absolute) { nevents = GetKeyboardValuatorEvents(xf86Events, device, is_down ? KeyPress : KeyRelease, - key_code, first_valuator, - num_valuators, valuators); + key_code, mask); } else { nevents = GetKeyboardEvents(xf86Events, device, @@ -1208,7 +1252,10 @@ xf86PostKeyboardEvent(DeviceIntPtr device, unsigned int key_code, int is_down) { - xf86PostKeyEventP(device, key_code, is_down, 0, 0, 0, NULL); + ValuatorMask mask; + + valuator_mask_zero(&mask); + xf86PostKeyEventM(device, key_code, is_down, 0, &mask); } InputInfoPtr diff --git a/hw/xfree86/common/xf86Xinput.h b/hw/xfree86/common/xf86Xinput.h index 5aa4509f5..829bf781a 100644 --- a/hw/xfree86/common/xf86Xinput.h +++ b/hw/xfree86/common/xf86Xinput.h @@ -115,19 +115,27 @@ extern _X_EXPORT void xf86PostMotionEvent(DeviceIntPtr device, int is_absolute, int first_valuator, int num_valuators, ...); extern _X_EXPORT void xf86PostMotionEventP(DeviceIntPtr device, int is_absolute, int first_valuator, int num_valuators, const int *valuators); +extern _X_EXPORT void xf86PostMotionEventM(DeviceIntPtr device, int is_absolute, + const ValuatorMask *mask); extern _X_EXPORT void xf86PostProximityEvent(DeviceIntPtr device, int is_in, int first_valuator, int num_valuators, ...); extern _X_EXPORT void xf86PostProximityEventP(DeviceIntPtr device, int is_in, int first_valuator, int num_valuators, const int *valuators); +extern _X_EXPORT void xf86PostProximityEventM(DeviceIntPtr device, int is_in, + const ValuatorMask *mask); extern _X_EXPORT void xf86PostButtonEvent(DeviceIntPtr device, int is_absolute, int button, int is_down, int first_valuator, int num_valuators, ...); extern _X_EXPORT void xf86PostButtonEventP(DeviceIntPtr device, int is_absolute, int button, int is_down, int first_valuator, int num_valuators, const int *valuators); +extern _X_EXPORT void xf86PostButtonEventM(DeviceIntPtr device, int is_absolute, int button, + int is_down, const ValuatorMask *mask); extern _X_EXPORT void xf86PostKeyEvent(DeviceIntPtr device, unsigned int key_code, int is_down, int is_absolute, int first_valuator, int num_valuators, ...); +extern _X_EXPORT void xf86PostKeyEventM(DeviceIntPtr device, unsigned int key_code, int is_down, + int is_absolute, const ValuatorMask *mask); extern _X_EXPORT void xf86PostKeyEventP(DeviceIntPtr device, unsigned int key_code, int is_down, int is_absolute, int first_valuator, int num_valuators, const int *valuators); diff --git a/hw/xnest/Events.c b/hw/xnest/Events.c index 62e17cb66..5ff6d210a 100644 --- a/hw/xnest/Events.c +++ b/hw/xnest/Events.c @@ -25,6 +25,7 @@ is" without express or implied warranty. #include "windowstr.h" #include "servermd.h" #include "inputstr.h" +#include "inpututils.h" #include "mi.h" @@ -117,6 +118,7 @@ xnestCollectEvents(void) { XEvent X; int i, n, valuators[2]; + ValuatorMask mask; ScreenPtr pScreen; GetEventList(&xnestEvents); @@ -133,19 +135,21 @@ xnestCollectEvents(void) break; case ButtonPress: + valuator_mask_set_range(&mask, 0, 0, NULL); xnestUpdateModifierState(X.xkey.state); lastEventTime = GetTimeInMillis(); n = GetPointerEvents(xnestEvents, xnestPointerDevice, ButtonPress, - X.xbutton.button, POINTER_RELATIVE, 0, 0, NULL); + X.xbutton.button, POINTER_RELATIVE, &mask); for (i = 0; i < n; i++) mieqEnqueue(xnestPointerDevice, (InternalEvent*)(xnestEvents + i)->event); 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, 0, 0, NULL); + X.xbutton.button, POINTER_RELATIVE, &mask); for (i = 0; i < n; i++) mieqEnqueue(xnestPointerDevice, (InternalEvent*)(xnestEvents + i)->event); break; @@ -153,9 +157,10 @@ xnestCollectEvents(void) case MotionNotify: valuators[0] = X.xmotion.x; valuators[1] = X.xmotion.y; + valuator_mask_set_range(&mask, 0, 2, valuators); lastEventTime = GetTimeInMillis(); n = GetPointerEvents(xnestEvents, xnestPointerDevice, MotionNotify, - 0, POINTER_ABSOLUTE, 0, 2, valuators); + 0, POINTER_ABSOLUTE, &mask); for (i = 0; i < n; i++) mieqEnqueue(xnestPointerDevice, (InternalEvent*)(xnestEvents + i)->event); break; @@ -186,9 +191,10 @@ xnestCollectEvents(void) NewCurrentScreen(inputInfo.pointer, pScreen, X.xcrossing.x, X.xcrossing.y); valuators[0] = X.xcrossing.x; valuators[1] = X.xcrossing.y; + valuator_mask_set_range(&mask, 0, 2, valuators); lastEventTime = GetTimeInMillis(); n = GetPointerEvents(xnestEvents, xnestPointerDevice, MotionNotify, - 0, POINTER_ABSOLUTE, 0, 2, valuators); + 0, POINTER_ABSOLUTE, &mask); for (i = 0; i < n; i++) mieqEnqueue(xnestPointerDevice, (InternalEvent*)(xnestEvents + i)->event); xnestDirectInstallColormaps(pScreen); diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c index 74fadf465..672d7680f 100644 --- a/hw/xquartz/darwinEvents.c +++ b/hw/xquartz/darwinEvents.c @@ -414,6 +414,7 @@ void DarwinSendPointerEvents(DeviceIntPtr pDev, int ev_type, int ev_button, floa float pressure, float tilt_x, float tilt_y) { static int darwinFakeMouseButtonDown = 0; int i, num_events; + ValuatorMask mask; ScreenPtr screen; int valuators[5]; @@ -464,8 +465,9 @@ void DarwinSendPointerEvents(DeviceIntPtr pDev, int ev_type, int ev_button, floa DarwinPrepareValuators(pDev, valuators, screen, pointer_x, pointer_y, pressure, tilt_x, tilt_y); darwinEvents_lock(); { + valuator_mask_set_range(&mask, 0, (pDev == darwinTabletCurrent) ? 5 : 2, valuators); num_events = GetPointerEvents(darwinEvents, pDev, ev_type, ev_button, - POINTER_ABSOLUTE, 0, pDev==darwinTabletCurrent?5:2, valuators); + POINTER_ABSOLUTE, 0, &mask); for(i=0; i<num_events; i++) mieqEnqueue (pDev, (InternalEvent*)darwinEvents[i].event); if(num_events > 0) DarwinPokeEQ(); } darwinEvents_unlock(); @@ -491,6 +493,7 @@ void DarwinSendProximityEvents(int ev_type, float pointer_x, float pointer_y) { ScreenPtr screen; DeviceIntPtr pDev = darwinTabletCurrent; int valuators[5]; + ValuatorMask mask; DEBUG_LOG("DarwinSendProximityEvents(%d, %f, %f)\n", ev_type, pointer_x, pointer_y); @@ -507,8 +510,8 @@ void DarwinSendProximityEvents(int ev_type, float pointer_x, float pointer_y) { DarwinPrepareValuators(pDev, valuators, screen, pointer_x, pointer_y, 0.0f, 0.0f, 0.0f); darwinEvents_lock(); { - num_events = GetProximityEvents(darwinEvents, pDev, ev_type, - 0, 5, valuators); + 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(); } darwinEvents_unlock(); diff --git a/hw/xwin/winmouse.c b/hw/xwin/winmouse.c index 342f20d56..e645d7ebc 100644 --- a/hw/xwin/winmouse.c +++ b/hw/xwin/winmouse.c @@ -240,15 +240,17 @@ winMouseButtonsSendEvent (int iEventType, int iButton) { EventListPtr events; int i, nevents; + ValuatorMask mask; #if defined(XFree86Server) if (g_winMouseButtonMap) iButton = g_winMouseButtonMap[iButton]; #endif + valuator_mask_zero(&mask); GetEventList(&events); nevents = GetPointerEvents(events, g_pwinPointer, iEventType, iButton, - POINTER_RELATIVE, 0, 0, NULL); + POINTER_RELATIVE, &mask); for (i = 0; i < nevents; i++) mieqEnqueue(g_pwinPointer, events[i].event); @@ -373,15 +375,17 @@ void winEnqueueMotion(int x, int y) { int i, nevents; int valuators[2]; + ValuatorMask mask; EventListPtr events; miPointerSetPosition(g_pwinPointer, &x, &y); valuators[0] = x; valuators[1] = y; + valuator_mask_set_range(&mask, 0, 2, valuators); GetEventList(&events); nevents = GetPointerEvents(events, g_pwinPointer, MotionNotify, 0, - POINTER_ABSOLUTE | POINTER_SCREEN, 0, 2, valuators); + POINTER_ABSOLUTE | POINTER_SCREEN, &mask); for (i = 0; i < nevents; i++) mieqEnqueue(g_pwinPointer, events[i].event); |