diff options
-rw-r--r-- | Xi/exevents.c | 5 | ||||
-rw-r--r-- | dix/eventconvert.c | 5 | ||||
-rw-r--r-- | dix/getevents.c | 4 | ||||
-rw-r--r-- | include/eventstr.h | 3 | ||||
-rw-r--r-- | test/xi2/protocol-eventconvert.c | 7 |
5 files changed, 9 insertions, 15 deletions
diff --git a/Xi/exevents.c b/Xi/exevents.c index 38089a27c..4dd9b85d5 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -774,12 +774,9 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent* event) for (i = 0; i <= last_valuator && i < v->numAxes; i++) { + /* XXX: Relative/Absolute mode */ if (BitIsOn(&event->valuators.mask, i)) - { - /* XXX: Relative/Absolute mode */ v->axisVal[i] = event->valuators.data[i]; - v->axisVal[i] += (event->valuators.data_frac[i] * 1.0f / (1 << 16) / (1 << 16)); - } } if (event->type == ET_KeyPress) { diff --git a/dix/eventconvert.c b/dix/eventconvert.c index 54e902081..9cc177efc 100644 --- a/dix/eventconvert.c +++ b/dix/eventconvert.c @@ -633,8 +633,9 @@ eventToDeviceEvent(DeviceEvent *ev, xEvent **xi) if (BitIsOn(ev->valuators.mask, i)) { SetBit(ptr, i); - axisval->integral = ev->valuators.data[i]; - axisval->frac = ev->valuators.data_frac[i]; + axisval->integral = trunc(ev->valuators.data[i]); + axisval->frac = (ev->valuators.data[i] - axisval->integral) * + (1UL << 32); axisval++; } } diff --git a/dix/getevents.c b/dix/getevents.c index d04f4125e..fac845ea0 100644 --- a/dix/getevents.c +++ b/dix/getevents.c @@ -196,9 +196,7 @@ set_valuators(DeviceIntPtr dev, DeviceEvent* event, ValuatorMask *mask) SetBit(event->valuators.mask, i); if (valuator_get_mode(dev, i) == Absolute) SetBit(event->valuators.mode, i); - event->valuators.data[i] = valuator_mask_get(mask, i); - event->valuators.data_frac[i] = - dev->last.remainder[i] * (1 << 16) * (1 << 16); + event->valuators.data[i] = valuator_mask_get_double(mask, i); } else if (valuator_get_mode(dev, i) == Absolute) event->valuators.data[i] = dev->valuator->axisVal[i]; diff --git a/include/eventstr.h b/include/eventstr.h index 0645585a3..2de077fd2 100644 --- a/include/eventstr.h +++ b/include/eventstr.h @@ -95,8 +95,7 @@ struct _DeviceEvent struct { uint8_t mask[(MAX_VALUATORS + 7)/8]; /**< Valuator mask */ uint8_t mode[(MAX_VALUATORS + 7)/8]; /**< Valuator mode (Abs or Rel)*/ - int32_t data[MAX_VALUATORS]; /**< Valuator data */ - int32_t data_frac[MAX_VALUATORS]; /**< Fractional part for data */ + double data[MAX_VALUATORS]; /**< Valuator data */ } valuators; struct { uint32_t base; /**< XKB base modifiers */ diff --git a/test/xi2/protocol-eventconvert.c b/test/xi2/protocol-eventconvert.c index 6df9af0fe..d7a9ee420 100644 --- a/test/xi2/protocol-eventconvert.c +++ b/test/xi2/protocol-eventconvert.c @@ -374,8 +374,8 @@ static void test_values_XIDeviceEvent(DeviceEvent *in, xXIDeviceEvent *out, { FP3232 vi, vo; - vi.integral = in->valuators.data[i]; - vi.frac = in->valuators.data_frac[i]; + vi.integral = trunc(in->valuators.data[i]); + vi.frac = (in->valuators.data[i] - vi.integral) * (1UL << 32); vo = *values; @@ -617,8 +617,7 @@ static void test_convert_XIDeviceEvent(void) { XISetMask(in.valuators.mask, i); - in.valuators.data[i] = i; - in.valuators.data_frac[i] = i + 20; + in.valuators.data[i] = i + (i * 0.0020); test_XIDeviceEvent(&in); XIClearMask(in.valuators.mask, i); } |