diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2011-12-14 14:57:46 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2011-12-20 13:01:03 +1000 |
commit | 5c63dc6dbcbebbb19d79575a9f1ec9878e6537f1 (patch) | |
tree | 3344348a4da6ff2af5145a8ab47f7533d741ce8c /test | |
parent | 7f8127d203394cae45c3ded0d063030d7c5fdb70 (diff) |
dix: add DIX API to create touchpoints
The DIX touchpoints are the ones used for event processing.
Co-authored-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/touch.c | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/test/touch.c b/test/touch.c index 1ea8f0ca5..88955cbc1 100644 --- a/test/touch.c +++ b/test/touch.c @@ -28,6 +28,7 @@ #include <stdint.h> #include "inputstr.h" #include "assert.h" +#include "scrnintstr.h" static void touch_grow_queue(void) { @@ -190,11 +191,80 @@ static void touch_begin_ddxtouch(void) last_client_id = ti->client_id; } +static void touch_begin_touch(void) +{ + DeviceIntRec dev; + TouchClassRec touch; + ValuatorClassRec val; + TouchPointInfoPtr ti; + int touchid = 12434; + int sourceid = 23; + SpriteInfoRec sprite; + ScreenRec screen; + + screenInfo.screens[0] = &screen; + + memset(&dev, 0, sizeof(dev)); + dev.id = 2; + + memset(&sprite, 0, sizeof(sprite)); + dev.spriteInfo = &sprite; + + memset(&touch, 0, sizeof(touch)); + touch.num_touches = 0; + + memset(&val, 0, sizeof(val)); + dev.valuator = &val; + val.numAxes = 2; + + ti = TouchBeginTouch(&dev, sourceid, touchid, TRUE); + assert(!ti); + + dev.touch = &touch; + ti = TouchBeginTouch(&dev, sourceid, touchid, TRUE); + assert(ti); + assert(ti->client_id == touchid); + assert(ti->active); + assert(ti->sourceid == sourceid); + assert(ti->emulate_pointer); + + assert(touch.num_touches == 1); +} + +static void touch_init(void) +{ + DeviceIntRec dev; + Atom labels[2] = {0}; + int rc; + SpriteInfoRec sprite; + ScreenRec screen; + + screenInfo.screens[0] = &screen; + + memset(&dev, 0, sizeof(dev)); + + memset(&sprite, 0, sizeof(sprite)); + dev.spriteInfo = &sprite; + + InitAtoms(); + rc = InitTouchClassDeviceStruct(&dev, 1, XIDirectTouch, 2); + assert(rc == FALSE); + + InitValuatorClassDeviceStruct(&dev, 2, labels, 10, Absolute); + rc = InitTouchClassDeviceStruct(&dev, 1, XIDirectTouch, 2); + assert(rc == TRUE); + assert(dev.touch); +} + + + int main(int argc, char** argv) { touch_grow_queue(); touch_find_ddxid(); touch_begin_ddxtouch(); + touch_init(); + touch_begin_touch(); return 0; } |