summaryrefslogtreecommitdiff
path: root/src/lib/ecore_input/Ecore_Input.h
blob: d9b3181369a433df4e4a6c2e711a9249c61cad73 (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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
#ifndef _ECORE_INPUT_H
#define _ECORE_INPUT_H

#ifdef _WIN32
# include <stddef.h>
#else
# include <inttypes.h>
#endif

#include <Eina.h>

#ifdef EAPI
# undef EAPI
#endif

#ifdef _WIN32
# ifdef EFL_ECORE_INPUT_BUILD
#  ifdef DLL_EXPORT
#   define EAPI __declspec(dllexport)
#  else
#   define EAPI
#  endif /* ! DLL_EXPORT */
# else
#  define EAPI __declspec(dllimport)
# endif /* ! EFL_ECORE_INPUT_BUILD */
#else
# ifdef __GNUC__
#  if __GNUC__ >= 4
#   define EAPI __attribute__ ((visibility("default")))
#  else
#   define EAPI
#  endif
# else
#  define EAPI
# endif
#endif

#ifdef __cplusplus
extern "C" {
#endif

EAPI extern int ECORE_EVENT_KEY_DOWN;
EAPI extern int ECORE_EVENT_KEY_UP;
EAPI extern int ECORE_EVENT_MOUSE_BUTTON_DOWN;
EAPI extern int ECORE_EVENT_MOUSE_BUTTON_UP;
EAPI extern int ECORE_EVENT_MOUSE_MOVE;
EAPI extern int ECORE_EVENT_MOUSE_WHEEL;
EAPI extern int ECORE_EVENT_MOUSE_IN;
EAPI extern int ECORE_EVENT_MOUSE_OUT;

#define ECORE_EVENT_MODIFIER_SHIFT      0x0001
#define ECORE_EVENT_MODIFIER_CTRL       0x0002
#define ECORE_EVENT_MODIFIER_ALT        0x0004
#define ECORE_EVENT_MODIFIER_WIN        0x0008
#define ECORE_EVENT_MODIFIER_SCROLL     0x0010
#define ECORE_EVENT_MODIFIER_NUM        0x0020
#define ECORE_EVENT_MODIFIER_CAPS       0x0040
#define ECORE_EVENT_LOCK_SCROLL         0x0080
#define ECORE_EVENT_LOCK_NUM            0x0100
#define ECORE_EVENT_LOCK_CAPS           0x0200
#define ECORE_EVENT_LOCK_SHIFT          0x0300
#define ECORE_EVENT_MODIFIER_ALTGR      0x0400 /**< @since 1.7 */

typedef uintptr_t                        Ecore_Window;
typedef struct _Ecore_Event_Key          Ecore_Event_Key;
typedef struct _Ecore_Event_Mouse_Button Ecore_Event_Mouse_Button;
typedef struct _Ecore_Event_Mouse_Wheel  Ecore_Event_Mouse_Wheel;
typedef struct _Ecore_Event_Mouse_Move   Ecore_Event_Mouse_Move;
typedef struct _Ecore_Event_Mouse_IO     Ecore_Event_Mouse_IO;
typedef struct _Ecore_Event_Modifiers    Ecore_Event_Modifiers;

typedef enum _Ecore_Event_Modifier
  {
     ECORE_NONE,
     ECORE_SHIFT,
     ECORE_CTRL,
     ECORE_ALT,
     ECORE_WIN,
     ECORE_SCROLL,
     ECORE_CAPS,
     ECORE_MODE, /**< @since 1.7 */
     ECORE_LAST
  } Ecore_Event_Modifier;

typedef enum _Ecore_Event_Press
  {
     ECORE_DOWN,
     ECORE_UP
  } Ecore_Event_Press;

typedef enum _Ecore_Event_IO
  {
     ECORE_IN,
     ECORE_OUT
  } Ecore_Event_IO;

typedef enum _Ecore_Compose_State
  {
     ECORE_COMPOSE_NONE,
     ECORE_COMPOSE_MIDDLE,
     ECORE_COMPOSE_DONE
  } Ecore_Compose_State;

struct _Ecore_Event_Key
  {
     const char      *keyname;
     const char      *key;
     const char      *string;
     const char      *compose;
     Ecore_Window     window;
     Ecore_Window     root_window;
     Ecore_Window     event_window;

     unsigned int     timestamp;
     unsigned int     modifiers;

     int              same_screen;
  };

struct _Ecore_Event_Mouse_Button
  {
     Ecore_Window     window;
     Ecore_Window     root_window;
     Ecore_Window     event_window;

     unsigned int     timestamp;
     unsigned int     modifiers;
     unsigned int     buttons;
     unsigned int     double_click;
     unsigned int     triple_click;
     int              same_screen;

     int              x;
     int              y;
     struct {
        int           x;
        int           y;
     } root;

     struct {
        int           device; /* @c 0 if normal mouse, @c 1+ for other mouse-devices (eg multi-touch - other fingers) */
        double        radius, radius_x, radius_y; /* radius of press point - radius_x and radius_y if it is an ellipse (radius is the average of the 2) */
        double        pressure; /* pressure - 1.0 == normal, > 1.0 == more, 0.0 == none */
        double        angle; /* angle relative to the perpendicular (0.0 == perpendicular), in degrees */
        double        x, y; /* same as x, y, root.x, root.y, but with sub-pixel precision, if available */
        struct {
           double     x, y;
        } root;
     } multi;
  };

struct _Ecore_Event_Mouse_Wheel
  {
     Ecore_Window     window;
     Ecore_Window     root_window;
     Ecore_Window     event_window;

     unsigned int     timestamp;
     unsigned int     modifiers;

     int              same_screen;
     int              direction;
     int              z;

     int              x;
     int              y;
     struct {
        int           x;
        int           y;
     } root;
  };

struct _Ecore_Event_Mouse_Move
  {
     Ecore_Window     window;
     Ecore_Window     root_window;
     Ecore_Window     event_window;

     unsigned int     timestamp;
     unsigned int     modifiers;

     int              same_screen;

     int              x;
     int              y;
     struct {
        int           x;
        int           y;
     } root;

     struct {
        int           device; /* @c 0 if normal mouse, @c 1+ for other mouse-devices (eg multi-touch - other fingers) */
        double        radius, radius_x, radius_y; /* radius of press point - radius_x and radius_y if it is an ellipse (radius is the average of the 2) */
        double        pressure; /* pressure - 1.0 == normal, > 1.0 == more, 0.0 == none */
        double        angle; /* angle relative to the perpendicular (0.0 == perpendicular), in degrees */
        double        x, y; /* same as x, y, root.x, root.y, but with sub-pixel precision, if available */
        struct {
           double     x, y;
        } root;
     } multi;
  };

struct _Ecore_Event_Mouse_IO
  {
     Ecore_Window     window;
     Ecore_Window     event_window;

     unsigned int     timestamp;
     unsigned int     modifiers;

     int              x;
     int              y;
  };

struct _Ecore_Event_Modifiers
  {
     unsigned int size;
     unsigned int array[ECORE_LAST];
  };

EAPI int                  ecore_event_init(void);
EAPI int                  ecore_event_shutdown(void);
EAPI unsigned int         ecore_event_modifier_mask(Ecore_Event_Modifier modifier);
EAPI Ecore_Event_Modifier ecore_event_update_modifier(const char *key, Ecore_Event_Modifiers *modifiers, int inc);

/**
 * @internal
 * @since 1.7
 */
EAPI Ecore_Compose_State  ecore_compose_get(const Eina_List *seq, char **seqstr_ret);

#ifdef __cplusplus
}
#endif

#endif