summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2009-04-07 21:51:02 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2009-04-19 22:17:07 +1000
commit4318075140cc287871d3c3b9f777289ea4ffa23a (patch)
treeccc9afeb45afa4aff49d7de21ab24e5448f98856
parent9212948461c5e053abb61fff73ced4a00f138544 (diff)
dix: store subpixel precision and send it down the wire to the client.
For the valuator data, not yet for root x/y and event x/y. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--dix/eventconvert.c11
-rw-r--r--dix/getevents.c3
-rw-r--r--include/events.h3
3 files changed, 12 insertions, 5 deletions
diff --git a/dix/eventconvert.c b/dix/eventconvert.c
index 4cd5567e8..8b973a580 100644
--- a/dix/eventconvert.c
+++ b/dix/eventconvert.c
@@ -357,7 +357,7 @@ eventToDeviceEvent(DeviceEvent *ev, xEvent **xi)
xXIDeviceEvent *xde;
int i, btlen, vallen;
char *ptr;
- int32_t *axisval;
+ FP3232 *axisval;
/* FIXME: this should just send the buttons we have, not MAX_BUTTONs. Same
* with MAX_VALUATORS below */
@@ -401,15 +401,15 @@ eventToDeviceEvent(DeviceEvent *ev, xEvent **xi)
}
ptr += xde->buttons_len * 4;
- axisval = (int32_t*)(ptr + xde->valuators_len * 4);
+ axisval = (FP3232*)(ptr + xde->valuators_len * 4);
for (i = 0; i < sizeof(ev->valuators.mask) * 8; i++)
{
if (BitIsOn(ev->valuators.mask, i))
{
SetBit(ptr, i);
- *axisval = ev->valuators.data[i];
+ axisval->integral = ev->valuators.data[i];
+ axisval->frac = ev->valuators.data_frac[i];
axisval++;
- axisval++; /* FIXME: this should be the frac. part */
}
}
@@ -451,9 +451,10 @@ eventToRawEvent(RawDeviceEvent *ev, xEvent **xi)
{
SetBit(ptr, i);
axisval->integral = ev->valuators.data[i];
+ axisval->frac = ev->valuators.data_frac[i];
(axisval + nvals)->integral = ev->valuators.data_raw[i];
+ (axisval + nvals)->frac = ev->valuators.data_raw_frac[i];
axisval++;
- /* FIXME: frac part */
}
}
diff --git a/dix/getevents.c b/dix/getevents.c
index b0bacbdbc..7aafc9828 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -174,10 +174,13 @@ set_valuators(DeviceIntPtr dev, DeviceEvent* event, int first_valuator,
SetBit(event->valuators.mask, i);
if (dev->valuator->mode == Absolute)
SetBit(event->valuators.mode, i);
+ event->valuators.data_frac[first_valuator + i] =
+ dev->last.remainder[first_valuator + i] * (1 << 16) * (1 << 16);
}
memcpy(&event->valuators.data[first_valuator],
valuators, num_valuators * sizeof(uint32_t));
+
}
void
diff --git a/include/events.h b/include/events.h
index a289662d4..da8f58aaf 100644
--- a/include/events.h
+++ b/include/events.h
@@ -93,6 +93,7 @@ typedef struct
uint8_t mask[(MAX_VALUATORS + 7)/8]; /**< Valuator mask */
uint8_t mode[(MAX_VALUATORS + 7)/8]; /**< Valuator mode (Abs or Rel)*/
uint32_t data[MAX_VALUATORS]; /**< Valuator data */
+ int32_t data_frac[MAX_VALUATORS]; /**< Fractional part for data */
} valuators;
struct {
uint32_t base; /**< XKB base modifiers */
@@ -191,7 +192,9 @@ typedef struct
struct {
uint8_t mask[(MAX_VALUATORS + 7)/8]; /**< Valuator mask */
int32_t data[MAX_VALUATORS]; /**< Valuator data */
+ int32_t data_frac[MAX_VALUATORS]; /**< Fractional part for data */
int32_t data_raw[MAX_VALUATORS]; /**< Valuator data as posted */
+ int32_t data_raw_frac[MAX_VALUATORS];/**< Fractional part for data_raw */
} valuators;
} RawDeviceEvent;