aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/test/xi2/protocol-eventconvert.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-10-05 17:37:34 +0200
committermarha <marha@users.sourceforge.net>2011-10-05 17:37:34 +0200
commitf7025b4baa1ba35ee796785641f04eac5bedb0a6 (patch)
tree3df62b7b501a478e212397883657a8a8be4db7a3 /xorg-server/test/xi2/protocol-eventconvert.c
parent60adbfdea1ee754341d64454274e7aa83bae8971 (diff)
downloadvcxsrv-f7025b4baa1ba35ee796785641f04eac5bedb0a6.tar.gz
vcxsrv-f7025b4baa1ba35ee796785641f04eac5bedb0a6.tar.bz2
vcxsrv-f7025b4baa1ba35ee796785641f04eac5bedb0a6.zip
mkfontscale pixman xserver xtrans libX11 libXdmcp libxcb libXmu mesa git update 5 oct 2011
Diffstat (limited to 'xorg-server/test/xi2/protocol-eventconvert.c')
-rw-r--r--xorg-server/test/xi2/protocol-eventconvert.c40
1 files changed, 27 insertions, 13 deletions
diff --git a/xorg-server/test/xi2/protocol-eventconvert.c b/xorg-server/test/xi2/protocol-eventconvert.c
index 6ec94be6c..bfa23b51f 100644
--- a/xorg-server/test/xi2/protocol-eventconvert.c
+++ b/xorg-server/test/xi2/protocol-eventconvert.c
@@ -41,6 +41,7 @@ static void test_values_XIRawEvent(RawDeviceEvent *in, xXIRawEvent *out,
int nvals = 0;
int bits_set;
int len;
+ uint32_t flagmask = 0;
if (swap)
{
@@ -51,6 +52,7 @@ static void test_values_XIRawEvent(RawDeviceEvent *in, xXIRawEvent *out,
swapl(&out->time);
swapl(&out->detail);
swaps(&out->valuators_len);
+ swapl(&out->flags);
}
@@ -61,7 +63,17 @@ static void test_values_XIRawEvent(RawDeviceEvent *in, xXIRawEvent *out,
assert(out->detail == in->detail.button);
assert(out->deviceid == in->deviceid);
assert(out->valuators_len >= bytes_to_int32(bits_to_bytes(sizeof(in->valuators.mask))));
- assert(out->flags == 0); /* FIXME: we don't set the flags yet */
+
+ switch (in->type) {
+ case ET_RawMotion:
+ case ET_RawButtonPress:
+ case ET_RawButtonRelease:
+ flagmask = XIPointerEmulated;
+ break;
+ default:
+ flagmask = 0;
+ }
+ assert((out->flags & ~flagmask) == 0);
ptr = (unsigned char*)&out[1];
bits_set = 0;
@@ -92,8 +104,8 @@ static void test_values_XIRawEvent(RawDeviceEvent *in, xXIRawEvent *out,
value = (FP3232*)(((unsigned char*)&out[1]) + out->valuators_len * 4);
value += nvals;
- 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;
vo.integral = value->integral;
vo.frac = value->frac;
@@ -108,8 +120,8 @@ static void test_values_XIRawEvent(RawDeviceEvent *in, xXIRawEvent *out,
raw_value = value + bits_set;
- vi.integral = in->valuators.data_raw[i];
- vi.frac = in->valuators.data_raw_frac[i];
+ vi.integral = trunc(in->valuators.data_raw[i]);
+ vi.frac = in->valuators.data_raw[i] - vi.integral;
vo.integral = raw_value->integral;
vo.frac = raw_value->frac;
@@ -247,10 +259,8 @@ static void test_convert_XIRawEvent(void)
{
XISetMask(in.valuators.mask, i);
- in.valuators.data[i] = i;
- in.valuators.data_raw[i] = i + 10;
- in.valuators.data_frac[i] = i + 20;
- in.valuators.data_raw_frac[i] = i + 30;
+ in.valuators.data[i] = i + (i * 0.0010);
+ in.valuators.data_raw[i] = (i + 10) + (i * 0.0030);
test_XIRawEvent(&in);
XIClearMask(in.valuators.mask, i);
}
@@ -305,6 +315,11 @@ static void test_values_XIDeviceEvent(DeviceEvent *in, xXIDeviceEvent *out,
assert(out->sourceid == in->sourceid);
switch (in->type) {
+ case ET_ButtonPress:
+ case ET_Motion:
+ case ET_ButtonRelease:
+ flagmask = XIPointerEmulated;
+ break;
case ET_KeyPress:
flagmask = XIKeyRepeat;
break;
@@ -375,8 +390,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;
@@ -618,8 +633,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);
}