[ecore] merged svn latest code (svn54830)
[profile/ivi/ecore.git] / src / lib / ecore_input / Ecore_Input.h
1 #ifndef _ECORE_INPUT_H
2 #define _ECORE_INPUT_H
3
4
5 #ifdef EAPI
6 # undef EAPI
7 #endif
8
9 #ifdef _WIN32
10 # ifdef EFL_ECORE_INPUT_BUILD
11 #  ifdef DLL_EXPORT
12 #   define EAPI __declspec(dllexport)
13 #  else
14 #   define EAPI
15 #  endif /* ! DLL_EXPORT */
16 # else
17 #  define EAPI __declspec(dllimport)
18 # endif /* ! EFL_ECORE_INPUT_BUILD */
19 #else
20 # ifdef __GNUC__
21 #  if __GNUC__ >= 4
22 #   define EAPI __attribute__ ((visibility("default")))
23 #  else
24 #   define EAPI
25 #  endif
26 # else
27 #  define EAPI
28 # endif
29 #endif
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
35    EAPI extern int ECORE_EVENT_KEY_DOWN;
36    EAPI extern int ECORE_EVENT_KEY_UP;
37    EAPI extern int ECORE_EVENT_MOUSE_BUTTON_DOWN;
38    EAPI extern int ECORE_EVENT_MOUSE_BUTTON_UP;
39    EAPI extern int ECORE_EVENT_MOUSE_MOVE;
40    EAPI extern int ECORE_EVENT_MOUSE_WHEEL;
41    EAPI extern int ECORE_EVENT_MOUSE_IN;
42    EAPI extern int ECORE_EVENT_MOUSE_OUT;
43
44 #define ECORE_EVENT_MODIFIER_SHIFT      0x0001
45 #define ECORE_EVENT_MODIFIER_CTRL       0x0002
46 #define ECORE_EVENT_MODIFIER_ALT        0x0004
47 #define ECORE_EVENT_MODIFIER_WIN        0x0008
48 #define ECORE_EVENT_MODIFIER_SCROLL     0x0010
49 #define ECORE_EVENT_MODIFIER_NUM        0x0020
50 #define ECORE_EVENT_MODIFIER_CAPS       0x0040
51 #define ECORE_EVENT_LOCK_SCROLL         0x0080
52 #define ECORE_EVENT_LOCK_NUM            0x0100
53 #define ECORE_EVENT_LOCK_CAPS           0x0200
54
55    typedef uintptr_t                        Ecore_Window;
56    typedef struct _Ecore_Event_Key          Ecore_Event_Key;
57    typedef struct _Ecore_Event_Mouse_Button Ecore_Event_Mouse_Button;
58    typedef struct _Ecore_Event_Mouse_Wheel  Ecore_Event_Mouse_Wheel;
59    typedef struct _Ecore_Event_Mouse_Move   Ecore_Event_Mouse_Move;
60    typedef struct _Ecore_Event_Mouse_IO     Ecore_Event_Mouse_IO;
61    typedef struct _Ecore_Event_Modifiers    Ecore_Event_Modifiers;
62    
63    typedef enum _Ecore_Event_Modifier
64      {
65         ECORE_NONE,
66         ECORE_SHIFT,
67         ECORE_CTRL,
68         ECORE_ALT,
69         ECORE_WIN,
70         ECORE_SCROLL,
71         ECORE_CAPS,
72         ECORE_LAST
73      } Ecore_Event_Modifier;
74
75    typedef enum _Ecore_Event_Press
76      {
77         ECORE_DOWN,
78         ECORE_UP
79      } Ecore_Event_Press;
80
81    typedef enum _Ecore_Event_IO
82      {
83         ECORE_IN,
84         ECORE_OUT
85      } Ecore_Event_IO;
86
87    struct _Ecore_Event_Key
88      {
89         const char      *keyname;
90         const char      *key;
91         const char      *string;
92         const char      *compose;
93         Ecore_Window     window;
94         Ecore_Window     root_window;
95         Ecore_Window     event_window;
96         
97         unsigned int     timestamp;
98         unsigned int     modifiers;
99         
100         int              same_screen;
101      };
102
103    struct _Ecore_Event_Mouse_Button
104      {
105         Ecore_Window     window;
106         Ecore_Window     root_window;
107         Ecore_Window     event_window;
108         
109         unsigned int     timestamp;
110         unsigned int     modifiers;
111         unsigned int     buttons;
112         unsigned int     double_click;
113         unsigned int     triple_click;
114         int              same_screen;
115         
116         int              x;
117         int              y;
118         struct {
119            int           x;
120            int           y;
121         } root;
122         
123         struct {
124            int           device; /* 0 if normal mouse, 1+ for other mouse-devices (eg multi-touch - other fingers) */
125            double        radius, radius_x, radius_y; /* radius of press point - radius_x and y if its an ellipse (radius is the average of the 2) */
126            double        pressure; /* pressure - 1.0 == normal, > 1.0 == more, 0.0 == none */
127            double        angle; /* angle relative to perpendicular (0.0 == perpendicular), in degrees */
128            double        x, y; /* same as x, y root.x, root.y, but with sub-pixel precision, if available */
129            struct {
130               double     x, y;
131            } root;
132         } multi;
133      };
134    
135    struct _Ecore_Event_Mouse_Wheel
136      {
137         Ecore_Window     window;
138         Ecore_Window     root_window;
139         Ecore_Window     event_window;
140         
141         unsigned int     timestamp;
142         unsigned int     modifiers;
143         
144         int              same_screen;
145         int              direction;
146         int              z;
147         
148         int              x;
149         int              y;
150         struct {
151            int           x;
152            int           y;
153         } root;
154      };
155    
156    struct _Ecore_Event_Mouse_Move
157      {
158         Ecore_Window     window;
159         Ecore_Window     root_window;
160         Ecore_Window     event_window;
161         
162         unsigned int     timestamp;
163         unsigned int     modifiers;
164         
165         int              same_screen;
166         
167         int              x;
168         int              y;
169         struct {
170            int           x;
171            int           y;
172         } root;
173         
174         struct {
175            int           device; /* 0 if normal mouse, 1+ for other mouse-devices (eg multi-touch - other fingers) */
176            double        radius, radius_x, radius_y; /* radius of press point - radius_x and y if its an ellipse (radius is the average of the 2) */
177            double        pressure; /* pressure - 1.0 == normal, > 1.0 == more, 0.0 == none */
178            double        angle; /* angle relative to perpendicular (0.0 == perpendicular), in degrees */
179            double        x, y; /* same as x, y root.x, root.y, but with sub-pixel precision, if available */
180            struct {
181               double     x, y;
182            } root;
183         } multi;
184      };
185    
186    struct _Ecore_Event_Mouse_IO
187      {
188         Ecore_Window     window;
189         Ecore_Window     event_window;
190         
191         unsigned int     timestamp;
192         unsigned int     modifiers;
193         
194         int              x;
195         int              y;
196      };
197
198    struct _Ecore_Event_Modifiers
199      {
200         unsigned int size;
201         unsigned int array[ECORE_LAST];
202      };
203    
204    EAPI int                  ecore_event_init(void);
205    EAPI int                  ecore_event_shutdown(void);
206    
207    EAPI unsigned int         ecore_event_modifier_mask(Ecore_Event_Modifier modifier);
208    EAPI Ecore_Event_Modifier ecore_event_update_modifier(const char *key, Ecore_Event_Modifiers *modifiers, int inc);
209
210 #ifdef __cplusplus
211 }
212 #endif
213
214 #endif