GetPointerEvents: always send valuator events for MotionNotify

Always chase a DeviceMotionNotify event with a DeviceValuator, which is
not required in the spec, but will silently break the lib if you don't
include.
This commit is contained in:
Daniel Stone 2006-12-06 23:18:52 +02:00 committed by Daniel Stone
parent c458a70d65
commit 72e7f2ac6c

View File

@ -484,6 +484,8 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons,
int num_events = 0, final_valuator = 0;
CARD32 ms = 0;
deviceKeyButtonPointer *kbp = NULL;
/* Thanks to a broken lib, we _always_ have to chase DeviceMotionNotifies
* with DeviceValuators. */
Bool sendValuators = (type == MotionNotify || flags & POINTER_ABSOLUTE);
DeviceIntPtr cp = inputInfo.pointer;
int x = 0, y = 0;
@ -500,15 +502,16 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons,
else
num_events = 1;
if (type == MotionNotify && num_valuators <= 0) {
return 0;
}
/* Do we need to send a DeviceValuator event? */
if ((num_valuators + first_valuator) > 2 && sendValuators) {
if (sendValuators) {
if ((((num_valuators - 1) / 6) + 1) > MAX_VALUATOR_EVENTS)
num_valuators = MAX_VALUATOR_EVENTS * 6;
num_events += ((num_valuators - 1) / 6) + 1;
}
else if (type == MotionNotify && num_valuators <= 0) {
return 0;
}
final_valuator = num_valuators + first_valuator;
@ -614,7 +617,7 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons,
kbp->root_y = y;
events++;
if (final_valuator > 2 && sendValuators) {
if (sendValuators) {
kbp->deviceid |= MORE_EVENTS;
clipValuators(pDev, first_valuator, num_valuators, valuators);
events = getValuatorEvents(events, pDev, first_valuator,