Last change
on this file since 403 was 211, checked in by Nicholas Riley, 19 years ago |
setup.py: use HotKey module (shared with LocationDo) instead of
_StreamVision module
HotKeymodule.c: the aforementioned module
StreamVision.py: use HotKey module instead of _StreamVision module.
Fix StreamVision.displayTrackInfo to not crash when iTunes jealously
hides the names of iTMS tracks from us. Switch track rating keys to
shift-F10/F11 to avoid conflicting with my preferred Expose/Dashboard
key bindings on my iBook.
|
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 */
|
---|
7 | extern PyTypeObject EventHotKeyRef_Type;
|
---|
8 | #define EventHotKeyRef_Check(x) ((x)->ob_type == &EventHotKeyRef_Type || PyObject_TypeCheck((x), &EventHotKeyRef_Type))
|
---|
9 | typedef struct EventHotKeyRefObject {
|
---|
10 | PyObject_HEAD
|
---|
11 | EventHotKeyRef ob_itself;
|
---|
12 | } EventHotKeyRefObject;
|
---|
13 |
|
---|
14 | static PyObject
|
---|
15 | *HotKey_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 |
|
---|
26 | static PyMethodDef HotKeymodule_methods[] = {
|
---|
27 | {"HotKeyAddress", HotKey_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 |
|
---|
33 | PyMODINIT_FUNC
|
---|
34 | initHotKey(void) {
|
---|
35 | (void)Py_InitModule("HotKey", HotKeymodule_methods);
|
---|
36 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.