~oif-packaging/grail/raring

« back to all changes in this revision

Viewing changes to src/handle.cpp

  • Committer: Chase Douglas
  • Date: 2012-06-21 20:30:14 UTC
  • mto: This revision was merged to the branch mainline in revision 234.
  • Revision ID: chase.douglas@ubuntu.com-20120621203014-g2uhy6mg779aufop
Rename utouch-grail to grail

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************
2
2
 *
3
 
 * utouch-grail - Multitouch Gesture Recognition Library
 
3
 * grail - Multitouch Gesture Recognition Library
4
4
 *
5
5
 * Copyright (C) 2011-2012 Canonical Ltd.
6
6
 *
29
29
#include <limits>
30
30
#include <stdexcept>
31
31
 
32
 
#include <utouch/frame_x11.h>
 
32
#include <oif/frame_x11.h>
33
33
 
34
34
#include "atomic-recognizer.h"
35
35
#include "event.h"
37
37
#include "regular-recognizer.h"
38
38
#include "subscription.h"
39
39
 
40
 
namespace utouch {
 
40
namespace oif {
41
41
namespace grail {
42
42
 
43
43
UGHandle::UGHandle(UFHandle frame_handle)
207
207
  return id;
208
208
}
209
209
 
210
 
void UGHandle::EnqueueEvent(utouch::grail::UGEvent* event) {
 
210
void UGHandle::EnqueueEvent(oif::grail::UGEvent* event) {
211
211
  static const uint64_t num = 1;
212
212
 
213
213
  event_queue_.push_back(event);
217
217
 
218
218
void UGHandle::RemoveGestureFromEventQueue(unsigned int id) {
219
219
  for (auto it = event_queue_.begin(); it != event_queue_.end(); ) {
220
 
    utouch::grail::UGEvent* event = *it++;
 
220
    oif::grail::UGEvent* event = *it++;
221
221
    if (grail_event_get_type(event) != UGEventTypeSlice)
222
222
      continue;
223
223
 
288
288
}
289
289
 
290
290
} // namespace grail
291
 
} // namespace utouch
 
291
} // namespace oif
292
292
 
293
293
extern "C" {
294
294
 
295
295
UGStatus grail_new(UFHandle frame_handle, UGHandle* handle) {
296
296
  try {
297
 
    *handle = new utouch::grail::UGHandle(frame_handle);
 
297
    *handle = new oif::grail::UGHandle(frame_handle);
298
298
  } catch(const std::exception&) {
299
299
    return UGStatusErrorResources;
300
300
  }
303
303
}
304
304
 
305
305
void grail_delete_v3(UGHandle handle) {
306
 
  delete static_cast<utouch::grail::UGHandle*>(handle);
 
306
  delete static_cast<oif::grail::UGHandle*>(handle);
307
307
}
308
308
 
309
309
int grail_get_fd(UGHandle handle) {
310
 
  return static_cast<utouch::grail::UGHandle*>(handle)->event_fd();
 
310
  return static_cast<oif::grail::UGHandle*>(handle)->event_fd();
311
311
}
312
312
 
313
313
UGStatus grail_subscription_activate(UGHandle handle,
314
314
                                     const UGSubscription subscription) {
315
 
  return static_cast<utouch::grail::UGHandle*>(handle)->ActivateSubscription(
316
 
      static_cast<utouch::grail::UGSubscription*>(subscription));
 
315
  return static_cast<oif::grail::UGHandle*>(handle)->ActivateSubscription(
 
316
      static_cast<oif::grail::UGSubscription*>(subscription));
317
317
}
318
318
 
319
319
void grail_subscription_deactivate(UGHandle handle,
320
320
                                   const UGSubscription subscription) {
321
 
  return static_cast<utouch::grail::UGHandle*>(handle)->DeactivateSubscription(
322
 
      static_cast<utouch::grail::UGSubscription*>(subscription));
 
321
  return static_cast<oif::grail::UGHandle*>(handle)->DeactivateSubscription(
 
322
      static_cast<oif::grail::UGSubscription*>(subscription));
323
323
}
324
324
 
325
325
void grail_process_frame_event(UGHandle handle, const UFEvent event) {
326
326
  try {
327
 
    static_cast<utouch::grail::UGHandle*>(handle)->ProcessFrameEvent(event);
 
327
    static_cast<oif::grail::UGHandle*>(handle)->ProcessFrameEvent(event);
328
328
  } catch (const std::exception&) {
329
329
  }
330
330
}
331
331
 
332
332
UGStatus grail_get_event(UGHandle handle, UGEvent *event) {
333
 
  return static_cast<utouch::grail::UGHandle*>(handle)->GetEvent(event);
 
333
  return static_cast<oif::grail::UGHandle*>(handle)->GetEvent(event);
334
334
}
335
335
 
336
336
void grail_update_time(UGHandle handle, uint64_t time) {
337
 
  static_cast<utouch::grail::UGHandle*>(handle)->UpdateTime(time);
 
337
  static_cast<oif::grail::UGHandle*>(handle)->UpdateTime(time);
338
338
}
339
339
 
340
340
uint64_t grail_next_timeout(UGHandle handle) {
341
 
  return static_cast<utouch::grail::UGHandle*>(handle)->NextTimeout();
 
341
  return static_cast<oif::grail::UGHandle*>(handle)->NextTimeout();
342
342
}
343
343
 
344
344
UGStatus grail_accept_gesture(UGHandle handle, unsigned int id) {
345
 
  return static_cast<utouch::grail::UGHandle*>(handle)->AcceptGesture(id);
 
345
  return static_cast<oif::grail::UGHandle*>(handle)->AcceptGesture(id);
346
346
}
347
347
 
348
348
UGStatus grail_reject_gesture(UGHandle handle, unsigned int id) {
349
 
  return static_cast<utouch::grail::UGHandle*>(handle)->RejectGesture(id);
 
349
  return static_cast<oif::grail::UGHandle*>(handle)->RejectGesture(id);
350
350
}
351
351
 
352
352
} // extern "C"