~chasedouglas/frame/ubuntu-upstream-xi

« back to all changes in this revision

Viewing changes to src/v1/frame.c

  • Committer: Chase Douglas
  • Date: 2011-12-09 01:36:45 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: chase.douglas@ubuntu.com-20111209013645-n24l4myiumblzsfu
* New upstream release.
  - Version 2 adds a new API built on top of XInput multitouch

Show diffs side-by-side

added added

removed removed

Lines of Context:
236
236
        return -ENOMEM;
237
237
}
238
238
 
239
 
static void transform_slot(struct utouch_contact *slot,
240
 
                           const struct utouch_surface *s)
 
239
static void transform_slot(utouch_frame_handle fh,
 
240
                           struct utouch_contact *slot)
241
241
{
 
242
        const struct utouch_surface *s = fh->surface;
242
243
        float fx = (s->mapped_max_x - s->mapped_min_x) / (s->max_x - s->min_x);
243
244
        float fy = (s->mapped_max_y - s->mapped_min_y) / (s->max_y - s->min_y);
244
245
        /* assume clipped view for asymmetrical scaling */
245
246
        float f = MAX(fx, fy);
246
247
 
 
248
        if(fh->coordinate_transform) {
 
249
                fh->coordinate_transform(&slot->x, &slot->y, fh->coordinate_transform_user_data);
 
250
        }
 
251
 
247
252
        slot->x = fx * (slot->x - s->min_x) + s->mapped_min_x;
248
253
        slot->y = fy * (slot->y - s->min_y) + s->mapped_min_y;
249
254
        slot->touch_major *= f;
279
284
        a->pressure = b->pressure;
280
285
        a->distance = b->distance;
281
286
 
282
 
        transform_slot(a, s);
 
287
        transform_slot(fh, a);
283
288
 
284
289
        if (a->active && ap->active && a->id == ap->id) {
285
290
                a->x += b->vx * dt;
406
411
 
407
412
        return frame;
408
413
}
 
414
 
 
415
void utouch_frame_set_coordinate_transform_callback(utouch_frame_handle fh,
 
416
                                                    utouch_coordinate_transform_cb callback,
 
417
                                                    void *user_data)
 
418
{
 
419
        fh->coordinate_transform = callback;
 
420
        fh->coordinate_transform_user_data = user_data;
 
421
}