~sil2100/nux/revert_640

« back to all changes in this revision

Viewing changes to NuxGraphics/GestureEvent.cpp

  • Committer: Łukasz 'sil2100' Zemczak
  • Date: 2012-08-08 12:58:24 UTC
  • Revision ID: lukasz.zemczak@canonical.com-20120808125824-12o0md3gbv5jrawm
Reverting revision 640, as it was causing many serious regressions. The direct cause seems to be libgeis, not the nux changes themselves - but this is the easiest way of resolving the problem. This code can be re-added once geis is fixed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright 2012 Canonical Ltd.
3
 
 *
4
 
 * This program is free software: you can redistribute it and/or modify it
5
 
 * under the terms of the GNU Lesser General Public License, as
6
 
 * published by the  Free Software Foundation; either version 2.1 or 3.0
7
 
 * of the License.
8
 
 *
9
 
 * This program is distributed in the hope that it will be useful, but
10
 
 * WITHOUT ANY WARRANTY; without even the implied warranties of
11
 
 * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
12
 
 * PURPOSE.  See the applicable version of the GNU Lesser General Public
13
 
 * License for more details.
14
 
 *
15
 
 * You should have received a copy of both the GNU Lesser General Public
16
 
 * License along with this program. If not, see <http://www.gnu.org/licenses/>
17
 
 *
18
 
 * Authored by: Daniel d'Andrada <daniel.dandrada@canonical.com>
19
 
 *
20
 
 */
21
 
 
22
 
#include "GestureEvent.h"
23
 
#include "NuxCore/Logger.h"
24
 
 
25
 
using namespace nux;
26
 
 
27
 
namespace
28
 
{
29
 
  nux::logging::Logger logger("nux.gestureevent");
30
 
}
31
 
 
32
 
GestureEvent::GestureEvent()
33
 
{
34
 
  // that's how many fingers you have on your hand (duh).
35
 
  // Can't have gestures with more than that many touch points.
36
 
  touches_.reserve(5);
37
 
}
38
 
 
39
 
void GestureEvent::Accept()
40
 
{
41
 
  GeisStatus status;
42
 
  status = geis_gesture_accept(geis_, geis_group_, gesture_id_);
43
 
  if (status != GEIS_STATUS_SUCCESS)
44
 
  {
45
 
    LOG_WARNING(logger) << "Failed to accept gesture with id " << gesture_id_;
46
 
  }
47
 
}
48
 
 
49
 
void GestureEvent::Reject()
50
 
{
51
 
  GeisStatus status;
52
 
  status = geis_gesture_reject(geis_, geis_group_, gesture_id_);
53
 
  if (status != GEIS_STATUS_SUCCESS)
54
 
  {
55
 
    LOG_WARNING(logger) << "Failed to reject gesture with id " << gesture_id_;
56
 
  }
57
 
}
58
 
 
59
 
void GestureEvent::Reset()
60
 
{
61
 
  Event::Reset();
62
 
 
63
 
  gesture_id_ = -1;
64
 
  gesture_classes_ = 0;
65
 
  timestamp_ = -1;
66
 
  focus_.x = focus_.y = 0.0f;
67
 
  delta_.x = delta_.y = 0.0f;
68
 
  angle_ = 0.0f;
69
 
  angle_delta_ = 0.0f;
70
 
  angular_velocity_ = 0.0f;
71
 
  tap_duration_ = -1;
72
 
  velocity_.x = velocity_.y = 0.0f;
73
 
  radius_ = 0.0f;
74
 
  radius_delta_ = 0.0f;
75
 
  radial_velocity_ = 0.0f;
76
 
  is_construction_finished_ = false;
77
 
  touches_.clear();
78
 
  geis_ = nullptr;
79
 
  geis_group_ = nullptr;
80
 
}