aboutsummaryrefslogtreecommitdiffstats
path: root/efl/ecore_input/efl.ecore_input.pxd
blob: ce0de79ee16ebf6ef771b73d4c2cec5fd3e61c0f (plain) (blame)
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
237
238
239
240
241
242
243
244
# Copyright (C) 2007-2015 various contributors (see AUTHORS)
#
# This file is part of Python-EFL.
#
# Python-EFL is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 3 of the License, or (at your option) any later version.
#
# Python-EFL is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this Python-EFL.  If not, see <http://www.gnu.org/licenses/>.

from efl.eina cimport Eina_Bool
from efl.ecore cimport Ecore_Event_Handler, ecore_event_handler_add, \
    ecore_event_handler_del


cdef extern from "Ecore_Input.h":

    ####################################################################
    # Enums
    #
    cpdef enum Ecore_Event_Modifier: # this is not really an enum
        ECORE_EVENT_MODIFIER_SHIFT
        ECORE_EVENT_MODIFIER_CTRL
        ECORE_EVENT_MODIFIER_ALT
        ECORE_EVENT_MODIFIER_WIN
        ECORE_EVENT_MODIFIER_SCROLL
        ECORE_EVENT_MODIFIER_NUM
        ECORE_EVENT_MODIFIER_CAPS
        ECORE_EVENT_LOCK_SCROLL
        ECORE_EVENT_LOCK_NUM
        ECORE_EVENT_LOCK_CAPS
        ECORE_EVENT_LOCK_SHIFT
        ECORE_EVENT_MODIFIER_ALTGR
    ctypedef enum Ecore_Event_Modifier:
        pass

    ####################################################################
    # events (not exposed to python)
    #
    int ECORE_EVENT_KEY_DOWN
    int ECORE_EVENT_KEY_UP
    int ECORE_EVENT_MOUSE_BUTTON_DOWN
    int ECORE_EVENT_MOUSE_BUTTON_UP
    int ECORE_EVENT_MOUSE_MOVE
    int ECORE_EVENT_MOUSE_IN
    int ECORE_EVENT_MOUSE_OUT
    int ECORE_EVENT_MOUSE_WHEEL

    ####################################################################
    # Data Types
    #
    ctypedef void *Ecore_Window

    ctypedef struct _EventPoint:
        int x
        int y

    ctypedef struct _EventMulti:
        int device
        double radius
        double radius_x
        double radius_y
        double pressure
        double angle
        double x
        double y
        _EventPoint root

    ctypedef 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
        unsigned int keycode
        void *data

    ctypedef 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
        _EventPoint root
        _EventMulti multi

    ctypedef 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
        _EventPoint root

    ctypedef 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
        _EventPoint root
        _EventMulti multi

    ctypedef struct Ecore_Event_Mouse_IO:
        Ecore_Window window
        Ecore_Window event_window
        unsigned int timestamp
        unsigned int modifiers
        int x
        int y


    ####################################################################
    # Functions
    #
    int ecore_event_init()
    int ecore_event_shutdown()


####################################################################
# Python classes
#
from efl.ecore cimport Event, EventHandler


cdef class Window:
    # Can we do something with this opaque stuct ?
    pass


cdef class InputEventHandler(EventHandler):
    pass


cdef class EventPoint:
    cdef readonly int x
    cdef readonly int y


cdef class EventMulti:
    cdef readonly int device
    cdef readonly double radius
    cdef readonly double radius_x
    cdef readonly double radius_y
    cdef readonly double pressure
    cdef readonly double angle
    cdef readonly double x
    cdef readonly double y
    cdef readonly double root_x
    cdef readonly double root_y


cdef class EventKey(Event):
    cdef readonly object keyname
    cdef readonly object key
    cdef readonly object string
    cdef readonly object compose
    ## Can we do something with this Window opaque struct ?
    # cdef readonly Window window
    # cdef readonly Window root_window
    # cdef readonly Window event_window
    cdef readonly unsigned int modifiers
    cdef readonly unsigned int timestamp
    cdef readonly unsigned int keycode
    cdef readonly object same_screen


cdef class EventMouseButton(Event):
    # cdef readonly Window window
    # cdef readonly Window root_window
    # cdef readonly Window event_window
    cdef readonly unsigned int modifiers
    cdef readonly unsigned int timestamp
    cdef readonly unsigned int buttons
    cdef readonly object double_click
    cdef readonly object triple_click
    cdef readonly object same_screen
    cdef readonly int x
    cdef readonly int y
    cdef readonly EventPoint root
    cdef readonly EventMulti multi


cdef class EventMouseMove(Event):
    # cdef readonly Window window
    # cdef readonly Window root_window
    # cdef readonly Window event_window
    cdef readonly unsigned int modifiers
    cdef readonly unsigned int timestamp
    cdef readonly object same_screen
    cdef readonly int x
    cdef readonly int y
    cdef readonly EventPoint root
    cdef readonly EventMulti multi


cdef class EventMouseIO(Event):
    # cdef readonly Window window
    # cdef readonly Window event_window
    cdef readonly unsigned int modifiers
    cdef readonly unsigned int timestamp
    cdef readonly int x
    cdef readonly int y


cdef class EventMouseWheel(Event):
    # cdef readonly Window window
    # cdef readonly Window root_window
    # cdef readonly Window event_window
    cdef readonly unsigned int modifiers
    cdef readonly unsigned int timestamp
    cdef readonly object same_screen
    cdef readonly int direction
    cdef readonly int z
    cdef readonly int x
    cdef readonly int y
    cdef readonly EventPoint root