--* Receive high-level touch events from the wall. #INCLUDE "occshout.module" #INCLUDE "useful.module" PROC get.point (tl.point.t point, RESULT REAL32 x, y) SEQ tl.point.t.x.get (point, x) tl.point.t.y.get (point, y) : PROC dump.objects (touch.lib.t tl, CHAN BYTE out!) tl.obj.t obj: SEQ touch.lib.t.objects.get (tl, obj) WHILE obj <> 0 tl.obj.t next: INT last.updated: tl.point.t point: REAL32 x, y: SEQ print.sin ("obj at ", INT obj, out!) tl.obj.t.last.updated.get (obj, last.updated) print.sin (" last updated: ", last.updated, out!) tl.obj.t.loc.get (obj, point) get.point (point, x, y) print.srsrs (" loc: [", x, ", ", y, "]*n", out!) tl.obj.t.next.get (obj, next) obj := next print.n (out!) : PROC main (CHAN BYTE out!) shout.t shout: touch.lib.t tl: MOBILE []BYTE name: INITIAL [1]INT filter IS [kEvt.type.3d.calibrated.touch.location]: [kTL.max.layers + 1]INT layers: SEQ name := "touchobjects*#00" shout.connect.default (kClient.type.listener, name, shout) ASSERT (shout <> 0) shout.set.event.filter (shout, SIZE filter, filter) tl.init (0, 0, 0.0, 0.0, 1.0, 1.0, tl) ASSERT (tl <> 0) -- XXX: this is ugly; it holds the address of the array... occshout.set.touch.event.handler (tl, layers) WHILE TRUE shout.event.t evt: SEQ SEQ i = 0 FOR SIZE layers layers[i] := 0 shout.wait.next.event (shout, evt) -- XXX: ignore return value; I think tl_handle_touch is missing a "return 0" in its second case INT rc: tl.handle.touch (tl, evt, rc) shout.free.event (evt) SEQ i = 0 FOR SIZE layers IF layers[i] <> 0 tl.track.objects.for.layer (tl, i) TRUE SKIP dump.objects (tl, out!) :