diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2010-10-19 13:37:46 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2010-10-22 11:02:48 +1000 |
commit | 675f4a8525d29ebad783351e17be785b2f32b2e8 (patch) | |
tree | 4a1aba9abeb869d0eedb1bbaf01f14c59bf778a0 /hw/xwin/winmouse.c | |
parent | fc48a8f9f5f66e591b3e39211d44ce68267303f8 (diff) |
Abstract valuator masks through a set of APIs.
This commit introduces an abstraction API for handling masked valuators. The
intent is that drivers just allocate a mask, set the data and pass the mask
to the server. The actual storage type of the mask is hidden from the
drivers.
The new calls for drivers are:
valuator_mask_new() /* to allocate a valuator mask */
valuator_mask_zero() /* to reset a mask to zero */
valuator_mask_set() /* to set a valuator value */
The new interface to the server is
xf86PostMotionEventM()
xf86PostButtonEventM()
xf86PostKeyboardEventM()
xf86PostProximityEventM()
all taking a mask instead of the valuator array.
The ValuatorMask is currently defined for MAX_VALUATORS fixed size due to
memory allocation restrictions in SIGIO handlers.
For easier review, a lot of the code still uses separate valuator arrays.
This will be fixed in a later patch.
This patch was initially written by Chase Douglas.
Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Diffstat (limited to 'hw/xwin/winmouse.c')
-rw-r--r-- | hw/xwin/winmouse.c | 8 |
1 files changed, 6 insertions, 2 deletions
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); |