aboutsummaryrefslogtreecommitdiff
path: root/src/idogesturemanager.h
blob: bc3ad339fda481ad86bc61c414b11ba5dd3b5897 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
/*
 * Copyright 2010 Canonical, Ltd.
 *
 * This program is free software: you can redistribute it and/or modify it
 * under the terms of either or both of the following licenses:
 *
 * 1) the GNU Lesser General Public License version 3, as published by the
 * Free Software Foundation; and/or
 * 2) the GNU Lesser General Public License version 2.1, as published by
 * the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranties of
 * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
 * PURPOSE.  See the applicable version of the GNU Lesser General Public
 * License for more details.
 *
 * You should have received a copy of both the GNU Lesser General Public
 * License version 3 and version 2.1 along with this program.  If not, see
 * <http://www.gnu.org/licenses/>
 *
 * Authors:
 *    Cody Russell <crussell@canonical.com>
 */

#ifndef __IDO_GESTURE_MANAGER_H__
#define __IDO_GESTURE_MANAGER_H__

#include <gtk/gtk.h>

G_BEGIN_DECLS

#define IDO_TYPE_GESTURE_MANAGER         (ido_gesture_manager_get_type ())
#define IDO_GESTURE_MANAGER(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), IDO_TYPE_GESTURE_MANAGER, IdoGestureManager))
#define IDO_GESTURE_MANAGER_CLASS(c)     (G_TYPE_CHECK_CLASS_CAST ((c), IDO_TYPE_GESTURE_MANAGER, IdoGestureManagerClass))
#define IDO_IS_GESTURE_MANAGER(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), IDO_TYPE_GESTURE_MANAGER))
#define IDO_IS_GESTURE_MANAGER_CLASS(c)  (G_TYPE_CHECK_CLASS_TYPE ((c), IDO_TYPE_GESTURE_MANAGER))
#define IDO_GESTURE_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), IDO_TYPE_GESTURE_MANAGER, IdoGestureManagerClass))

typedef struct _IdoGestureManager        IdoGestureManager;
typedef struct _IdoGestureManagerClass   IdoGestureManagerClass;
typedef struct _IdoGestureManagerPrivate IdoGestureManagerPrivate;

typedef union  _IdoGestureEvent       IdoGestureEvent;
typedef struct _IdoEventGestureDrag   IdoEventGestureDrag;
typedef struct _IdoEventGesturePinch  IdoEventGesturePinch;
typedef struct _IdoEventGestureRotate IdoEventGestureRotate;

typedef enum {
  IDO_GESTURE_DRAG1,
  IDO_GESTURE_PINCH1,
  IDO_GESTURE_ROTATE1,

  IDO_GESTURE_DRAG2,
  IDO_GESTURE_PINCH2,
  IDO_GESTURE_ROTATE2,

  IDO_GESTURE_DRAG3,
  IDO_GESTURE_PINCH3,
  IDO_GESTURE_ROTATE3,

  IDO_GESTURE_DRAG4,
  IDO_GESTURE_PINCH4,
  IDO_GESTURE_ROTATE4,

  IDO_GESTURE_DRAG5,
  IDO_GESTURE_PINCH5,
  IDO_GESTURE_ROTATE5,

  IDO_GESTURE_TAP1,
  IDO_GESTURE_TAP2,
  IDO_GESTURE_TAP3,
  IDO_GESTURE_TAP4,
  IDO_GESTURE_TAP5
} IdoGestureType;

struct _IdoEventGestureDrag
{
  IdoGestureType  type;
  guint           id;
  GdkWindow      *window;
  GdkWindow      *root;
  GdkWindow      *child;
  guint32         timestamp;
  gint            fingers;
  gdouble         focus_x;
  gdouble         focus_y;
  gint            delta_x;
  gint            delta_y;
  gdouble         velocity_x;
  gdouble         velocity_y;
  gdouble         position_x;
  gdouble         position_y;
};

struct _IdoEventGesturePinch
{
  IdoGestureType  type;
  guint           id;
  GdkWindow      *window;
  GdkWindow      *root;
  GdkWindow      *child;
  guint32         timestamp;
  guint           fingers;
  gdouble         focus_x;
  gdouble         focus_y;
  gdouble         radius_delta;
  gdouble         radial_velocity;
  gdouble         radius;
};

struct _IdoEventGestureRotate
{
  IdoGestureType   type;
  guint            id;
  GdkWindow       *window;
  GdkWindow       *root;
  GdkWindow       *child;
  guint32          timestamp;
  guint            fingers;
  gdouble          focus_x;
  gdouble          focus_y;
  gdouble          angle_delta;
  gdouble          angular_velocity;
  gdouble          angle;
};

union _IdoGestureEvent
{
  IdoGestureType        type;
  IdoEventGestureDrag   drag;
  IdoEventGesturePinch  pinch;
  IdoEventGestureRotate rotate;
};

struct _IdoGestureManager
{
  GObject parent_instance;

  IdoGestureManagerPrivate *priv;
};

struct _IdoGestureManagerClass
{
  GObjectClass parent_class;
};

typedef void (* IdoGestureCallback) (GtkWindow        *window,
				     IdoGestureEvent  *gesture);

GType              ido_gesture_manager_get_type        (void) G_GNUC_CONST;
IdoGestureManager *ido_gesture_manager_get             (void);
void               ido_gesture_manager_register_window (IdoGestureManager *manager,
							GtkWindow         *window,
							IdoGestureType     gesture_type,
                                                        IdoGestureCallback start,
                                                        IdoGestureCallback update,
                                                        IdoGestureCallback end);

G_END_DECLS

#endif /* __IDO_GESTURE_MANAGER_H__ */