Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 1 | |
| 2 | /* =========================== Module Evt =========================== */ |
| 3 | |
| 4 | #include "Python.h" |
| 5 | |
| 6 | |
| 7 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 8 | #include "macglue.h" |
Jack Jansen | 9d8b96c | 2000-07-14 22:16:45 +0000 | [diff] [blame] | 9 | #include "pymactoolbox.h" |
Guido van Rossum | e26c263 | 1995-02-28 09:11:41 +0000 | [diff] [blame] | 10 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 11 | #include <Events.h> |
| 12 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 13 | static PyObject *Evt_Error; |
| 14 | |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 15 | static PyObject *Evt_GetMouse(_self, _args) |
| 16 | PyObject *_self; |
| 17 | PyObject *_args; |
| 18 | { |
| 19 | PyObject *_res = NULL; |
| 20 | Point mouseLoc; |
| 21 | if (!PyArg_ParseTuple(_args, "")) |
| 22 | return NULL; |
| 23 | GetMouse(&mouseLoc); |
| 24 | _res = Py_BuildValue("O&", |
| 25 | PyMac_BuildPoint, mouseLoc); |
| 26 | return _res; |
| 27 | } |
| 28 | |
| 29 | static PyObject *Evt_Button(_self, _args) |
| 30 | PyObject *_self; |
| 31 | PyObject *_args; |
| 32 | { |
| 33 | PyObject *_res = NULL; |
| 34 | Boolean _rv; |
| 35 | if (!PyArg_ParseTuple(_args, "")) |
| 36 | return NULL; |
| 37 | _rv = Button(); |
| 38 | _res = Py_BuildValue("b", |
| 39 | _rv); |
| 40 | return _res; |
| 41 | } |
| 42 | |
| 43 | static PyObject *Evt_StillDown(_self, _args) |
| 44 | PyObject *_self; |
| 45 | PyObject *_args; |
| 46 | { |
| 47 | PyObject *_res = NULL; |
| 48 | Boolean _rv; |
| 49 | if (!PyArg_ParseTuple(_args, "")) |
| 50 | return NULL; |
| 51 | _rv = StillDown(); |
| 52 | _res = Py_BuildValue("b", |
| 53 | _rv); |
| 54 | return _res; |
| 55 | } |
| 56 | |
| 57 | static PyObject *Evt_WaitMouseUp(_self, _args) |
| 58 | PyObject *_self; |
| 59 | PyObject *_args; |
| 60 | { |
| 61 | PyObject *_res = NULL; |
| 62 | Boolean _rv; |
| 63 | if (!PyArg_ParseTuple(_args, "")) |
| 64 | return NULL; |
| 65 | _rv = WaitMouseUp(); |
| 66 | _res = Py_BuildValue("b", |
| 67 | _rv); |
| 68 | return _res; |
| 69 | } |
| 70 | |
| 71 | static PyObject *Evt_TickCount(_self, _args) |
| 72 | PyObject *_self; |
| 73 | PyObject *_args; |
| 74 | { |
| 75 | PyObject *_res = NULL; |
| 76 | UInt32 _rv; |
| 77 | if (!PyArg_ParseTuple(_args, "")) |
| 78 | return NULL; |
| 79 | _rv = TickCount(); |
| 80 | _res = Py_BuildValue("l", |
| 81 | _rv); |
| 82 | return _res; |
| 83 | } |
| 84 | |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 85 | static PyObject *Evt_GetCaretTime(_self, _args) |
| 86 | PyObject *_self; |
| 87 | PyObject *_args; |
| 88 | { |
| 89 | PyObject *_res = NULL; |
Jack Jansen | 7d0bc83 | 1995-06-09 20:56:31 +0000 | [diff] [blame] | 90 | UInt32 _rv; |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 91 | if (!PyArg_ParseTuple(_args, "")) |
| 92 | return NULL; |
| 93 | _rv = GetCaretTime(); |
| 94 | _res = Py_BuildValue("l", |
| 95 | _rv); |
| 96 | return _res; |
| 97 | } |
| 98 | |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 99 | static PyObject *Evt_GetKeys(_self, _args) |
| 100 | PyObject *_self; |
| 101 | PyObject *_args; |
| 102 | { |
| 103 | PyObject *_res = NULL; |
| 104 | KeyMap theKeys__out__; |
| 105 | if (!PyArg_ParseTuple(_args, "")) |
| 106 | return NULL; |
| 107 | GetKeys(theKeys__out__); |
| 108 | _res = Py_BuildValue("s#", |
| 109 | (char *)&theKeys__out__, (int)sizeof(KeyMap)); |
| 110 | theKeys__error__: ; |
| 111 | return _res; |
| 112 | } |
| 113 | |
| 114 | static PyObject *Evt_GetDblTime(_self, _args) |
| 115 | PyObject *_self; |
| 116 | PyObject *_args; |
| 117 | { |
| 118 | PyObject *_res = NULL; |
| 119 | UInt32 _rv; |
| 120 | if (!PyArg_ParseTuple(_args, "")) |
| 121 | return NULL; |
| 122 | _rv = GetDblTime(); |
| 123 | _res = Py_BuildValue("l", |
| 124 | _rv); |
| 125 | return _res; |
| 126 | } |
| 127 | |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 128 | static PyObject *Evt_SetEventMask(_self, _args) |
| 129 | PyObject *_self; |
| 130 | PyObject *_args; |
| 131 | { |
| 132 | PyObject *_res = NULL; |
Jack Jansen | d40f3c6 | 1995-10-09 23:12:22 +0000 | [diff] [blame] | 133 | EventMask value; |
Jack Jansen | 0b13e7c | 2000-07-07 13:09:35 +0000 | [diff] [blame] | 134 | if (!PyArg_ParseTuple(_args, "H", |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 135 | &value)) |
| 136 | return NULL; |
| 137 | SetEventMask(value); |
| 138 | Py_INCREF(Py_None); |
| 139 | _res = Py_None; |
| 140 | return _res; |
| 141 | } |
| 142 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 143 | static PyObject *Evt_GetNextEvent(_self, _args) |
| 144 | PyObject *_self; |
| 145 | PyObject *_args; |
| 146 | { |
| 147 | PyObject *_res = NULL; |
| 148 | Boolean _rv; |
Jack Jansen | d40f3c6 | 1995-10-09 23:12:22 +0000 | [diff] [blame] | 149 | EventMask eventMask; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 150 | EventRecord theEvent; |
Jack Jansen | 0b13e7c | 2000-07-07 13:09:35 +0000 | [diff] [blame] | 151 | if (!PyArg_ParseTuple(_args, "H", |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 152 | &eventMask)) |
| 153 | return NULL; |
| 154 | _rv = GetNextEvent(eventMask, |
| 155 | &theEvent); |
| 156 | _res = Py_BuildValue("bO&", |
| 157 | _rv, |
| 158 | PyMac_BuildEventRecord, &theEvent); |
| 159 | return _res; |
| 160 | } |
| 161 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 162 | static PyObject *Evt_EventAvail(_self, _args) |
| 163 | PyObject *_self; |
| 164 | PyObject *_args; |
| 165 | { |
| 166 | PyObject *_res = NULL; |
| 167 | Boolean _rv; |
Jack Jansen | d40f3c6 | 1995-10-09 23:12:22 +0000 | [diff] [blame] | 168 | EventMask eventMask; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 169 | EventRecord theEvent; |
Jack Jansen | 0b13e7c | 2000-07-07 13:09:35 +0000 | [diff] [blame] | 170 | if (!PyArg_ParseTuple(_args, "H", |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 171 | &eventMask)) |
| 172 | return NULL; |
| 173 | _rv = EventAvail(eventMask, |
| 174 | &theEvent); |
| 175 | _res = Py_BuildValue("bO&", |
| 176 | _rv, |
| 177 | PyMac_BuildEventRecord, &theEvent); |
| 178 | return _res; |
| 179 | } |
| 180 | |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 181 | static PyObject *Evt_PostEvent(_self, _args) |
| 182 | PyObject *_self; |
| 183 | PyObject *_args; |
| 184 | { |
| 185 | PyObject *_res = NULL; |
| 186 | OSErr _err; |
Jack Jansen | d40f3c6 | 1995-10-09 23:12:22 +0000 | [diff] [blame] | 187 | EventKind eventNum; |
Jack Jansen | 7d0bc83 | 1995-06-09 20:56:31 +0000 | [diff] [blame] | 188 | UInt32 eventMsg; |
Jack Jansen | 0b13e7c | 2000-07-07 13:09:35 +0000 | [diff] [blame] | 189 | if (!PyArg_ParseTuple(_args, "Hl", |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 190 | &eventNum, |
| 191 | &eventMsg)) |
| 192 | return NULL; |
| 193 | _err = PostEvent(eventNum, |
| 194 | eventMsg); |
| 195 | if (_err != noErr) return PyMac_Error(_err); |
| 196 | Py_INCREF(Py_None); |
| 197 | _res = Py_None; |
| 198 | return _res; |
| 199 | } |
| 200 | |
Jack Jansen | abf1703 | 2000-06-20 07:42:23 +0000 | [diff] [blame] | 201 | #ifndef TARGET_API_MAC_CARBON |
| 202 | |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 203 | static PyObject *Evt_OSEventAvail(_self, _args) |
| 204 | PyObject *_self; |
| 205 | PyObject *_args; |
| 206 | { |
| 207 | PyObject *_res = NULL; |
| 208 | Boolean _rv; |
Jack Jansen | d40f3c6 | 1995-10-09 23:12:22 +0000 | [diff] [blame] | 209 | EventMask mask; |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 210 | EventRecord theEvent; |
Jack Jansen | 0b13e7c | 2000-07-07 13:09:35 +0000 | [diff] [blame] | 211 | if (!PyArg_ParseTuple(_args, "H", |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 212 | &mask)) |
| 213 | return NULL; |
| 214 | _rv = OSEventAvail(mask, |
| 215 | &theEvent); |
| 216 | _res = Py_BuildValue("bO&", |
| 217 | _rv, |
| 218 | PyMac_BuildEventRecord, &theEvent); |
| 219 | return _res; |
| 220 | } |
Jack Jansen | abf1703 | 2000-06-20 07:42:23 +0000 | [diff] [blame] | 221 | #endif |
| 222 | |
| 223 | #ifndef TARGET_API_MAC_CARBON |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 224 | |
| 225 | static PyObject *Evt_GetOSEvent(_self, _args) |
| 226 | PyObject *_self; |
| 227 | PyObject *_args; |
| 228 | { |
| 229 | PyObject *_res = NULL; |
| 230 | Boolean _rv; |
Jack Jansen | d40f3c6 | 1995-10-09 23:12:22 +0000 | [diff] [blame] | 231 | EventMask mask; |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 232 | EventRecord theEvent; |
Jack Jansen | 0b13e7c | 2000-07-07 13:09:35 +0000 | [diff] [blame] | 233 | if (!PyArg_ParseTuple(_args, "H", |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 234 | &mask)) |
| 235 | return NULL; |
| 236 | _rv = GetOSEvent(mask, |
| 237 | &theEvent); |
| 238 | _res = Py_BuildValue("bO&", |
| 239 | _rv, |
| 240 | PyMac_BuildEventRecord, &theEvent); |
| 241 | return _res; |
| 242 | } |
Jack Jansen | abf1703 | 2000-06-20 07:42:23 +0000 | [diff] [blame] | 243 | #endif |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 244 | |
| 245 | static PyObject *Evt_FlushEvents(_self, _args) |
| 246 | PyObject *_self; |
| 247 | PyObject *_args; |
| 248 | { |
| 249 | PyObject *_res = NULL; |
Jack Jansen | d40f3c6 | 1995-10-09 23:12:22 +0000 | [diff] [blame] | 250 | EventMask whichMask; |
| 251 | EventMask stopMask; |
Jack Jansen | 0b13e7c | 2000-07-07 13:09:35 +0000 | [diff] [blame] | 252 | if (!PyArg_ParseTuple(_args, "HH", |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 253 | &whichMask, |
| 254 | &stopMask)) |
| 255 | return NULL; |
| 256 | FlushEvents(whichMask, |
| 257 | stopMask); |
| 258 | Py_INCREF(Py_None); |
| 259 | _res = Py_None; |
| 260 | return _res; |
| 261 | } |
| 262 | |
Jack Jansen | abf1703 | 2000-06-20 07:42:23 +0000 | [diff] [blame] | 263 | #ifndef TARGET_API_MAC_CARBON |
| 264 | |
Guido van Rossum | e26c263 | 1995-02-28 09:11:41 +0000 | [diff] [blame] | 265 | static PyObject *Evt_SystemClick(_self, _args) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 266 | PyObject *_self; |
| 267 | PyObject *_args; |
| 268 | { |
| 269 | PyObject *_res = NULL; |
Guido van Rossum | e26c263 | 1995-02-28 09:11:41 +0000 | [diff] [blame] | 270 | EventRecord theEvent; |
| 271 | WindowPtr theWindow; |
| 272 | if (!PyArg_ParseTuple(_args, "O&O&", |
| 273 | PyMac_GetEventRecord, &theEvent, |
| 274 | WinObj_Convert, &theWindow)) |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 275 | return NULL; |
Guido van Rossum | e26c263 | 1995-02-28 09:11:41 +0000 | [diff] [blame] | 276 | SystemClick(&theEvent, |
| 277 | theWindow); |
| 278 | Py_INCREF(Py_None); |
| 279 | _res = Py_None; |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 280 | return _res; |
| 281 | } |
Jack Jansen | abf1703 | 2000-06-20 07:42:23 +0000 | [diff] [blame] | 282 | #endif |
| 283 | |
| 284 | #ifndef TARGET_API_MAC_CARBON |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 285 | |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 286 | static PyObject *Evt_SystemTask(_self, _args) |
| 287 | PyObject *_self; |
| 288 | PyObject *_args; |
| 289 | { |
| 290 | PyObject *_res = NULL; |
| 291 | if (!PyArg_ParseTuple(_args, "")) |
| 292 | return NULL; |
| 293 | SystemTask(); |
| 294 | Py_INCREF(Py_None); |
| 295 | _res = Py_None; |
| 296 | return _res; |
| 297 | } |
Jack Jansen | abf1703 | 2000-06-20 07:42:23 +0000 | [diff] [blame] | 298 | #endif |
| 299 | |
| 300 | #ifndef TARGET_API_MAC_CARBON |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 301 | |
| 302 | static PyObject *Evt_SystemEvent(_self, _args) |
| 303 | PyObject *_self; |
| 304 | PyObject *_args; |
| 305 | { |
| 306 | PyObject *_res = NULL; |
| 307 | Boolean _rv; |
| 308 | EventRecord theEvent; |
| 309 | if (!PyArg_ParseTuple(_args, "O&", |
| 310 | PyMac_GetEventRecord, &theEvent)) |
| 311 | return NULL; |
| 312 | _rv = SystemEvent(&theEvent); |
| 313 | _res = Py_BuildValue("b", |
| 314 | _rv); |
| 315 | return _res; |
| 316 | } |
Jack Jansen | abf1703 | 2000-06-20 07:42:23 +0000 | [diff] [blame] | 317 | #endif |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 318 | |
Jack Jansen | 91b5bed | 1998-09-17 15:28:58 +0000 | [diff] [blame] | 319 | static PyObject *Evt_WaitNextEvent(_self, _args) |
| 320 | PyObject *_self; |
| 321 | PyObject *_args; |
| 322 | { |
| 323 | PyObject *_res = NULL; |
| 324 | |
| 325 | Boolean _rv; |
| 326 | EventMask eventMask; |
| 327 | EventRecord theEvent; |
| 328 | UInt32 sleep; |
| 329 | Handle mouseregion = (Handle)0; |
| 330 | |
| 331 | if (!PyArg_ParseTuple(_args, "hl|O&", |
| 332 | &eventMask, |
| 333 | &sleep, |
| 334 | OptResObj_Convert, &mouseregion)) |
| 335 | return NULL; |
| 336 | _rv = WaitNextEvent(eventMask, |
| 337 | &theEvent, |
| 338 | sleep, |
| 339 | (RgnHandle)mouseregion); |
| 340 | _res = Py_BuildValue("bO&", |
| 341 | _rv, |
| 342 | PyMac_BuildEventRecord, &theEvent); |
| 343 | return _res; |
| 344 | |
| 345 | } |
| 346 | |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 347 | static PyMethodDef Evt_methods[] = { |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 348 | {"GetMouse", (PyCFunction)Evt_GetMouse, 1, |
| 349 | "() -> (Point mouseLoc)"}, |
| 350 | {"Button", (PyCFunction)Evt_Button, 1, |
| 351 | "() -> (Boolean _rv)"}, |
| 352 | {"StillDown", (PyCFunction)Evt_StillDown, 1, |
| 353 | "() -> (Boolean _rv)"}, |
| 354 | {"WaitMouseUp", (PyCFunction)Evt_WaitMouseUp, 1, |
| 355 | "() -> (Boolean _rv)"}, |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 356 | {"TickCount", (PyCFunction)Evt_TickCount, 1, |
Jack Jansen | 7d0bc83 | 1995-06-09 20:56:31 +0000 | [diff] [blame] | 357 | "() -> (UInt32 _rv)"}, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 358 | {"GetCaretTime", (PyCFunction)Evt_GetCaretTime, 1, |
| 359 | "() -> (UInt32 _rv)"}, |
| 360 | {"GetKeys", (PyCFunction)Evt_GetKeys, 1, |
| 361 | "() -> (KeyMap theKeys)"}, |
| 362 | {"GetDblTime", (PyCFunction)Evt_GetDblTime, 1, |
| 363 | "() -> (UInt32 _rv)"}, |
| 364 | {"SetEventMask", (PyCFunction)Evt_SetEventMask, 1, |
| 365 | "(EventMask value) -> None"}, |
| 366 | {"GetNextEvent", (PyCFunction)Evt_GetNextEvent, 1, |
| 367 | "(EventMask eventMask) -> (Boolean _rv, EventRecord theEvent)"}, |
Jack Jansen | 21f9687 | 1998-02-20 16:02:09 +0000 | [diff] [blame] | 368 | {"EventAvail", (PyCFunction)Evt_EventAvail, 1, |
| 369 | "(EventMask eventMask) -> (Boolean _rv, EventRecord theEvent)"}, |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 370 | {"PostEvent", (PyCFunction)Evt_PostEvent, 1, |
Jack Jansen | d40f3c6 | 1995-10-09 23:12:22 +0000 | [diff] [blame] | 371 | "(EventKind eventNum, UInt32 eventMsg) -> None"}, |
Jack Jansen | abf1703 | 2000-06-20 07:42:23 +0000 | [diff] [blame] | 372 | |
| 373 | #ifndef TARGET_API_MAC_CARBON |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 374 | {"OSEventAvail", (PyCFunction)Evt_OSEventAvail, 1, |
Jack Jansen | d40f3c6 | 1995-10-09 23:12:22 +0000 | [diff] [blame] | 375 | "(EventMask mask) -> (Boolean _rv, EventRecord theEvent)"}, |
Jack Jansen | abf1703 | 2000-06-20 07:42:23 +0000 | [diff] [blame] | 376 | #endif |
| 377 | |
| 378 | #ifndef TARGET_API_MAC_CARBON |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 379 | {"GetOSEvent", (PyCFunction)Evt_GetOSEvent, 1, |
Jack Jansen | d40f3c6 | 1995-10-09 23:12:22 +0000 | [diff] [blame] | 380 | "(EventMask mask) -> (Boolean _rv, EventRecord theEvent)"}, |
Jack Jansen | abf1703 | 2000-06-20 07:42:23 +0000 | [diff] [blame] | 381 | #endif |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 382 | {"FlushEvents", (PyCFunction)Evt_FlushEvents, 1, |
Jack Jansen | d40f3c6 | 1995-10-09 23:12:22 +0000 | [diff] [blame] | 383 | "(EventMask whichMask, EventMask stopMask) -> None"}, |
Jack Jansen | abf1703 | 2000-06-20 07:42:23 +0000 | [diff] [blame] | 384 | |
| 385 | #ifndef TARGET_API_MAC_CARBON |
Guido van Rossum | e26c263 | 1995-02-28 09:11:41 +0000 | [diff] [blame] | 386 | {"SystemClick", (PyCFunction)Evt_SystemClick, 1, |
| 387 | "(EventRecord theEvent, WindowPtr theWindow) -> None"}, |
Jack Jansen | abf1703 | 2000-06-20 07:42:23 +0000 | [diff] [blame] | 388 | #endif |
| 389 | |
| 390 | #ifndef TARGET_API_MAC_CARBON |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 391 | {"SystemTask", (PyCFunction)Evt_SystemTask, 1, |
| 392 | "() -> None"}, |
Jack Jansen | abf1703 | 2000-06-20 07:42:23 +0000 | [diff] [blame] | 393 | #endif |
| 394 | |
| 395 | #ifndef TARGET_API_MAC_CARBON |
Jack Jansen | b81cf9d | 1995-06-06 13:08:40 +0000 | [diff] [blame] | 396 | {"SystemEvent", (PyCFunction)Evt_SystemEvent, 1, |
| 397 | "(EventRecord theEvent) -> (Boolean _rv)"}, |
Jack Jansen | abf1703 | 2000-06-20 07:42:23 +0000 | [diff] [blame] | 398 | #endif |
Jack Jansen | 91b5bed | 1998-09-17 15:28:58 +0000 | [diff] [blame] | 399 | {"WaitNextEvent", (PyCFunction)Evt_WaitNextEvent, 1, |
| 400 | "(EventMask eventMask, UInt32 sleep [,RegionHandle]) -> (Boolean _rv, EventRecord theEvent)"}, |
Guido van Rossum | 17448e2 | 1995-01-30 11:53:55 +0000 | [diff] [blame] | 401 | {NULL, NULL, 0} |
| 402 | }; |
| 403 | |
| 404 | |
| 405 | |
| 406 | |
| 407 | void initEvt() |
| 408 | { |
| 409 | PyObject *m; |
| 410 | PyObject *d; |
| 411 | |
| 412 | |
| 413 | |
| 414 | |
| 415 | m = Py_InitModule("Evt", Evt_methods); |
| 416 | d = PyModule_GetDict(m); |
| 417 | Evt_Error = PyMac_GetOSErrException(); |
| 418 | if (Evt_Error == NULL || |
| 419 | PyDict_SetItemString(d, "Error", Evt_Error) != 0) |
| 420 | Py_FatalError("can't initialize Evt.Error"); |
| 421 | } |
| 422 | |
| 423 | /* ========================= End module Evt ========================= */ |
| 424 | |