summaryrefslogtreecommitdiffstats
path: root/Mac/Modules/evt/Evtmodule.c
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>1995-06-06 13:08:40 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>1995-06-06 13:08:40 (GMT)
commitb81cf9d61c71f9b5949b9424cec1f59ac4a426e8 (patch)
tree2b8fdc1f0dfd48b31a650f5a41864a8dc0b5ea7e /Mac/Modules/evt/Evtmodule.c
parentae8a68f40cd56aa952520260970ebd5b9d3fb95c (diff)
downloadcpython-b81cf9d61c71f9b5949b9424cec1f59ac4a426e8.zip
cpython-b81cf9d61c71f9b5949b9424cec1f59ac4a426e8.tar.gz
cpython-b81cf9d61c71f9b5949b9424cec1f59ac4a426e8.tar.bz2
Trying again to check it in. Changes to:
- Use Universal Headers as input - Change addpack calls to not depend on Guido's disklayout - Checkge testprograms to use new names for some functions
Diffstat (limited to 'Mac/Modules/evt/Evtmodule.c')
-rw-r--r--Mac/Modules/evt/Evtmodule.c183
1 files changed, 182 insertions, 1 deletions
diff --git a/Mac/Modules/evt/Evtmodule.c b/Mac/Modules/evt/Evtmodule.c
index 42d55b4..7169b59 100644
--- a/Mac/Modules/evt/Evtmodule.c
+++ b/Mac/Modules/evt/Evtmodule.c
@@ -39,6 +39,49 @@ extern PyObject *WinObj_WhichWindow(WindowPtr);
static PyObject *Evt_Error;
+static PyObject *Evt_GetDblTime(_self, _args)
+ PyObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ long _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetDblTime();
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Evt_GetCaretTime(_self, _args)
+ PyObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ long _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetCaretTime();
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Evt_SetEventMask(_self, _args)
+ PyObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ short value;
+ if (!PyArg_ParseTuple(_args, "h",
+ &value))
+ return NULL;
+ SetEventMask(value);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
static PyObject *Evt_GetNextEvent(_self, _args)
PyObject *_self;
PyObject *_args;
@@ -171,6 +214,96 @@ static PyObject *Evt_GetKeys(_self, _args)
return _res;
}
+static PyObject *Evt_TickCount(_self, _args)
+ PyObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ unsigned long _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = TickCount();
+ _res = Py_BuildValue("l",
+ _rv);
+ return _res;
+}
+
+static PyObject *Evt_PostEvent(_self, _args)
+ PyObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ OSErr _err;
+ short eventNum;
+ long eventMsg;
+ if (!PyArg_ParseTuple(_args, "hl",
+ &eventNum,
+ &eventMsg))
+ return NULL;
+ _err = PostEvent(eventNum,
+ eventMsg);
+ if (_err != noErr) return PyMac_Error(_err);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Evt_OSEventAvail(_self, _args)
+ PyObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ short mask;
+ EventRecord theEvent;
+ if (!PyArg_ParseTuple(_args, "h",
+ &mask))
+ return NULL;
+ _rv = OSEventAvail(mask,
+ &theEvent);
+ _res = Py_BuildValue("bO&",
+ _rv,
+ PyMac_BuildEventRecord, &theEvent);
+ return _res;
+}
+
+static PyObject *Evt_GetOSEvent(_self, _args)
+ PyObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ short mask;
+ EventRecord theEvent;
+ if (!PyArg_ParseTuple(_args, "h",
+ &mask))
+ return NULL;
+ _rv = GetOSEvent(mask,
+ &theEvent);
+ _res = Py_BuildValue("bO&",
+ _rv,
+ PyMac_BuildEventRecord, &theEvent);
+ return _res;
+}
+
+static PyObject *Evt_FlushEvents(_self, _args)
+ PyObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ short whichMask;
+ short stopMask;
+ if (!PyArg_ParseTuple(_args, "hh",
+ &whichMask,
+ &stopMask))
+ return NULL;
+ FlushEvents(whichMask,
+ stopMask);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
static PyObject *Evt_SystemClick(_self, _args)
PyObject *_self;
PyObject *_args;
@@ -189,7 +322,42 @@ static PyObject *Evt_SystemClick(_self, _args)
return _res;
}
+static PyObject *Evt_SystemTask(_self, _args)
+ PyObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ SystemTask();
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *Evt_SystemEvent(_self, _args)
+ PyObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ EventRecord theEvent;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetEventRecord, &theEvent))
+ return NULL;
+ _rv = SystemEvent(&theEvent);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
static PyMethodDef Evt_methods[] = {
+ {"GetDblTime", (PyCFunction)Evt_GetDblTime, 1,
+ "() -> (long _rv)"},
+ {"GetCaretTime", (PyCFunction)Evt_GetCaretTime, 1,
+ "() -> (long _rv)"},
+ {"SetEventMask", (PyCFunction)Evt_SetEventMask, 1,
+ "(short value) -> None"},
{"GetNextEvent", (PyCFunction)Evt_GetNextEvent, 1,
"(short eventMask) -> (Boolean _rv, EventRecord theEvent)"},
{"WaitNextEvent", (PyCFunction)Evt_WaitNextEvent, 1,
@@ -206,8 +374,22 @@ static PyMethodDef Evt_methods[] = {
"() -> (Boolean _rv)"},
{"GetKeys", (PyCFunction)Evt_GetKeys, 1,
"() -> (KeyMap theKeys)"},
+ {"TickCount", (PyCFunction)Evt_TickCount, 1,
+ "() -> (unsigned long _rv)"},
+ {"PostEvent", (PyCFunction)Evt_PostEvent, 1,
+ "(short eventNum, long eventMsg) -> None"},
+ {"OSEventAvail", (PyCFunction)Evt_OSEventAvail, 1,
+ "(short mask) -> (Boolean _rv, EventRecord theEvent)"},
+ {"GetOSEvent", (PyCFunction)Evt_GetOSEvent, 1,
+ "(short mask) -> (Boolean _rv, EventRecord theEvent)"},
+ {"FlushEvents", (PyCFunction)Evt_FlushEvents, 1,
+ "(short whichMask, short stopMask) -> None"},
{"SystemClick", (PyCFunction)Evt_SystemClick, 1,
"(EventRecord theEvent, WindowPtr theWindow) -> None"},
+ {"SystemTask", (PyCFunction)Evt_SystemTask, 1,
+ "() -> None"},
+ {"SystemEvent", (PyCFunction)Evt_SystemEvent, 1,
+ "(EventRecord theEvent) -> (Boolean _rv)"},
{NULL, NULL, 0}
};
@@ -232,4 +414,3 @@ void initEvt()
/* ========================= End module Evt ========================= */
-