source: trunk/StreamVision/_StreamVisionmodule.c@ 188

Last change on this file since 188 was 188, checked in by Nicholas Riley, 19 years ago

StreamVision

File size: 1.1 KB
Line 
1#include "Python.h"
2#include "pymactoolbox.h"
3
4#include <Carbon/Carbon.h>
5
6/* from _CarbonEvtmodule.c */
7extern PyTypeObject EventHotKeyRef_Type;
8#define EventHotKeyRef_Check(x) ((x)->ob_type == &EventHotKeyRef_Type || PyObject_TypeCheck((x), &EventHotKeyRef_Type))
9typedef struct EventHotKeyRefObject {
10 PyObject_HEAD
11 EventHotKeyRef ob_itself;
12} EventHotKeyRefObject;
13
14static PyObject
15*StreamVision_HotKeyAddress(PyObject *self, PyObject *args) {
16 PyObject *v;
17 if (!PyArg_ParseTuple(args, "O", &v))
18 return NULL;
19 if (!EventHotKeyRef_Check(v)) {
20 PyErr_SetString(PyExc_TypeError, "_CarbonEvt.EventHotKeyRef required");
21 return NULL;
22 }
23 return PyInt_FromLong((int)((EventHotKeyRefObject *)v)->ob_itself);
24}
25
26static PyMethodDef _StreamVisionmodule_methods[] = {
27 {"HotKeyAddress", StreamVision_HotKeyAddress, METH_VARARGS,
28 "HotKeyAddress(_CarbonEvt.EventHotKeyRef) -> integer\n\n"
29 "Return the address of the underlying EventHotKeyRef (passed as data1 in hot key NSEvents)."},
30 {NULL, NULL, 0, NULL}
31};
32
33PyMODINIT_FUNC
34init_StreamVision(void) {
35 (void)Py_InitModule("_StreamVision", _StreamVisionmodule_methods);
36}
Note: See TracBrowser for help on using the repository browser.