~sethj/ubuntu/wily/unity/fix-for-1445595

« back to all changes in this revision

Viewing changes to tests/test-gesture-engine/GeisAdapterMock.h

  • Committer: Daniel d'Andrada
  • Date: 2012-07-27 20:20:29 UTC
  • mto: (2534.1.1 alt_tab_v2)
  • mto: This revision was merged to the branch mainline in revision 2531.
  • Revision ID: daniel.dandrada@canonical.com-20120727202029-9tbkwzemtzil6crt
Use gestures support from Nux and adapt code for regular gesture rules

Remove GeisAdapter as we are getting gesture events from Nux instead.

Then modify code to handle geisv2-style gestures. They require
acceptance/rejection and enable multiple simultaneous gestures

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 General Public License version 3, as published
6
 
 * by the  Free Software Foundation.
7
 
 *
8
 
 * This program is distributed in the hope that it will be useful, but
9
 
 * WITHOUT ANY WARRANTY; without even the implied warranties of
10
 
 * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
11
 
 * PURPOSE.  See the GNU General Public License for more details.
12
 
 *
13
 
 * You should have received a copy of the GNU General Public License
14
 
 * version 3 along with this program.  If not, see
15
 
 * <http://www.gnu.org/licenses/>
16
 
 *
17
 
 * Authored by: Daniel d'Andrada <daniel.dandrada@canonical.com>
18
 
 *
19
 
 */
20
 
 
21
 
#ifndef GEISADAPTER_MOCK_H
22
 
#define GEISADAPTER_MOCK_H
23
 
 
24
 
#include <sigc++/sigc++.h>
25
 
#include <X11/Xlib.h>
26
 
 
27
 
class GeisAdapterMock : public sigc::trackable
28
 
{
29
 
public:
30
 
  static GeisAdapterMock& Instance();
31
 
 
32
 
  ~GeisAdapterMock() {}
33
 
 
34
 
  typedef struct _GeisTapData
35
 
  {
36
 
    int id;
37
 
    int device_id;
38
 
    Window window;
39
 
    int touches;
40
 
    int timestamp;
41
 
    float focus_x;
42
 
    float focus_y;
43
 
    int tap_length_ms;
44
 
    float position_x;
45
 
    float position_y;
46
 
    float bound_x1;
47
 
    float bound_y1;
48
 
    float bound_x2;
49
 
    float bound_y2;
50
 
  } GeisTapData;
51
 
 
52
 
  typedef struct _GeisDragData
53
 
  {
54
 
    int id;
55
 
    int device_id;
56
 
    Window window;
57
 
    int touches;
58
 
    int timestamp;
59
 
    float focus_x;
60
 
    float focus_y;
61
 
    float delta_x;
62
 
    float delta_y;
63
 
    float velocity_x;
64
 
    float velocity_y;
65
 
    float position_x;
66
 
    float position_y;
67
 
    float bound_x1;
68
 
    float bound_y1;
69
 
    float bound_x2;
70
 
    float bound_y2;
71
 
  } GeisDragData;
72
 
 
73
 
  typedef struct _GeisRotateData
74
 
  {
75
 
    int id;
76
 
    int device_id;
77
 
    Window window;
78
 
    int touches;
79
 
    int timestamp;
80
 
    float focus_x;
81
 
    float focus_y;
82
 
    float angle;
83
 
    float angle_delta;
84
 
    float angle_velocity;
85
 
    float bound_x1;
86
 
    float bound_y1;
87
 
    float bound_x2;
88
 
    float bound_y2;
89
 
  } GeisRotateData;
90
 
 
91
 
  typedef struct _GeisPinchData
92
 
  {
93
 
    int id;
94
 
    int device_id;
95
 
    Window window;
96
 
    int touches;
97
 
    int timestamp;
98
 
    float focus_x;
99
 
    float focus_y;
100
 
    float radius;
101
 
    float radius_delta;
102
 
    float radius_velocity;
103
 
    float bound_x1;
104
 
    float bound_y1;
105
 
    float bound_x2;
106
 
    float bound_y2;
107
 
  } GeisPinchData;
108
 
 
109
 
  typedef struct _GeisTouchData
110
 
  {
111
 
    int id;
112
 
    int device_id;
113
 
    Window window;
114
 
    int touches;
115
 
    int timestamp;
116
 
    float focus_x;
117
 
    float focus_y;
118
 
    float bound_x1;
119
 
    float bound_y1;
120
 
    float bound_x2;
121
 
    float bound_y2;
122
 
  } GeisTouchData;
123
 
 
124
 
  sigc::signal<void, GeisTapData*> tap;
125
 
 
126
 
  sigc::signal<void, GeisDragData*> drag_start;
127
 
  sigc::signal<void, GeisDragData*> drag_update;
128
 
  sigc::signal<void, GeisDragData*> drag_finish;
129
 
 
130
 
  sigc::signal<void, GeisRotateData*> rotate_start;
131
 
  sigc::signal<void, GeisRotateData*> rotate_update;
132
 
  sigc::signal<void, GeisRotateData*> rotate_finish;
133
 
 
134
 
  sigc::signal<void, GeisPinchData*> pinch_start;
135
 
  sigc::signal<void, GeisPinchData*> pinch_update;
136
 
  sigc::signal<void, GeisPinchData*> pinch_finish;
137
 
 
138
 
  sigc::signal<void, GeisTouchData*> touch_start;
139
 
  sigc::signal<void, GeisTouchData*> touch_update;
140
 
  sigc::signal<void, GeisTouchData*> touch_finish;
141
 
 
142
 
private:
143
 
  GeisAdapterMock() {}
144
 
 
145
 
  static GeisAdapterMock* _default;
146
 
 
147
 
};
148
 
#endif