summaryrefslogtreecommitdiff
path: root/dix/eventconvert.c
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2011-09-30 09:24:56 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2011-09-30 09:24:56 +1000
commit4c6bc0e76599dbe5ede2e1f48c9936a0e996b638 (patch)
tree5148df7b67e42eb61ad990847ff7e8b47164a239 /dix/eventconvert.c
parent057cc92ebfeebe81b7d01ff2c6aa2c066c8d1a64 (diff)
parent3304bbff9b4ed63f1a47410a5320a136420ba2c6 (diff)
Merge branch 'smooth-scrolling' into next
Diffstat (limited to 'dix/eventconvert.c')
-rw-r--r--dix/eventconvert.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/dix/eventconvert.c b/dix/eventconvert.c
index 024f2e833..9cc177efc 100644
--- a/dix/eventconvert.c
+++ b/dix/eventconvert.c
@@ -605,6 +605,7 @@ eventToDeviceEvent(DeviceEvent *ev, xEvent **xi)
xde->root_x = FP1616(ev->root_x, ev->root_x_frac);
xde->root_y = FP1616(ev->root_y, ev->root_y_frac);
+ xde->flags = ev->flags;
if (ev->key_repeat)
xde->flags |= XIKeyRepeat;
@@ -632,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++;
}
}
@@ -648,7 +650,7 @@ eventToRawEvent(RawDeviceEvent *ev, xEvent **xi)
int vallen, nvals;
int i, len = sizeof(xXIRawEvent);
char *ptr;
- FP3232 *axisval;
+ FP3232 *axisval, *axisval_raw;
nvals = count_bits(ev->valuators.mask, sizeof(ev->valuators.mask));
len += nvals * sizeof(FP3232) * 2; /* 8 byte per valuator, once
@@ -666,19 +668,23 @@ eventToRawEvent(RawDeviceEvent *ev, xEvent **xi)
raw->detail = ev->detail.button;
raw->deviceid = ev->deviceid;
raw->valuators_len = vallen;
+ raw->flags = ev->flags;
ptr = (char*)&raw[1];
axisval = (FP3232*)(ptr + raw->valuators_len * 4);
+ axisval_raw = axisval + nvals;
for (i = 0; i < sizeof(ev->valuators.mask) * 8; i++)
{
if (BitIsOn(ev->valuators.mask, i))
{
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->integral = trunc(ev->valuators.data[i]);
+ axisval->frac = ev->valuators.data[i] - axisval->integral;
+ axisval_raw->integral = trunc(ev->valuators.data_raw[i]);
+ axisval_raw->frac = ev->valuators.data_raw[i] -
+ axisval_raw->integral;
axisval++;
+ axisval_raw++;
}
}