summaryrefslogtreecommitdiffstats
path: root/Mac/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Mac/Modules')
-rw-r--r--Mac/Modules/evt/Evtmodule.c55
-rw-r--r--Mac/Modules/evt/evtscan.py1
-rw-r--r--Mac/Modules/evt/evtsupport.py25
3 files changed, 56 insertions, 25 deletions
diff --git a/Mac/Modules/evt/Evtmodule.c b/Mac/Modules/evt/Evtmodule.c
index edd8bc7..71858f6 100644
--- a/Mac/Modules/evt/Evtmodule.c
+++ b/Mac/Modules/evt/Evtmodule.c
@@ -195,29 +195,6 @@ static PyObject *Evt_GetNextEvent(_self, _args)
return _res;
}
-static PyObject *Evt_WaitNextEvent(_self, _args)
- PyObject *_self;
- PyObject *_args;
-{
- PyObject *_res = NULL;
- Boolean _rv;
- EventMask eventMask;
- EventRecord theEvent;
- UInt32 sleep;
- if (!PyArg_ParseTuple(_args, "hl",
- &eventMask,
- &sleep))
- return NULL;
- _rv = WaitNextEvent(eventMask,
- &theEvent,
- sleep,
- (RgnHandle)0);
- _res = Py_BuildValue("bO&",
- _rv,
- PyMac_BuildEventRecord, &theEvent);
- return _res;
-}
-
static PyObject *Evt_EventAvail(_self, _args)
PyObject *_self;
PyObject *_args;
@@ -360,6 +337,34 @@ static PyObject *Evt_SystemEvent(_self, _args)
return _res;
}
+static PyObject *Evt_WaitNextEvent(_self, _args)
+ PyObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+
+ Boolean _rv;
+ EventMask eventMask;
+ EventRecord theEvent;
+ UInt32 sleep;
+ Handle mouseregion = (Handle)0;
+
+ if (!PyArg_ParseTuple(_args, "hl|O&",
+ &eventMask,
+ &sleep,
+ OptResObj_Convert, &mouseregion))
+ return NULL;
+ _rv = WaitNextEvent(eventMask,
+ &theEvent,
+ sleep,
+ (RgnHandle)mouseregion);
+ _res = Py_BuildValue("bO&",
+ _rv,
+ PyMac_BuildEventRecord, &theEvent);
+ return _res;
+
+}
+
static PyMethodDef Evt_methods[] = {
{"GetMouse", (PyCFunction)Evt_GetMouse, 1,
"() -> (Point mouseLoc)"},
@@ -381,8 +386,6 @@ static PyMethodDef Evt_methods[] = {
"(EventMask value) -> None"},
{"GetNextEvent", (PyCFunction)Evt_GetNextEvent, 1,
"(EventMask eventMask) -> (Boolean _rv, EventRecord theEvent)"},
- {"WaitNextEvent", (PyCFunction)Evt_WaitNextEvent, 1,
- "(EventMask eventMask, UInt32 sleep) -> (Boolean _rv, EventRecord theEvent)"},
{"EventAvail", (PyCFunction)Evt_EventAvail, 1,
"(EventMask eventMask) -> (Boolean _rv, EventRecord theEvent)"},
{"PostEvent", (PyCFunction)Evt_PostEvent, 1,
@@ -399,6 +402,8 @@ static PyMethodDef Evt_methods[] = {
"() -> None"},
{"SystemEvent", (PyCFunction)Evt_SystemEvent, 1,
"(EventRecord theEvent) -> (Boolean _rv)"},
+ {"WaitNextEvent", (PyCFunction)Evt_WaitNextEvent, 1,
+ "(EventMask eventMask, UInt32 sleep [,RegionHandle]) -> (Boolean _rv, EventRecord theEvent)"},
{NULL, NULL, 0}
};
diff --git a/Mac/Modules/evt/evtscan.py b/Mac/Modules/evt/evtscan.py
index 3b3765f..1f558ea 100644
--- a/Mac/Modules/evt/evtscan.py
+++ b/Mac/Modules/evt/evtscan.py
@@ -39,6 +39,7 @@ class MyScanner(Scanner):
return [
"KeyTranslate",
"GetEventMask", # I cannot seem to find this routine...
+ "WaitNextEvent" # Manually generated because of optional region
]
def makeblacklisttypes(self):
diff --git a/Mac/Modules/evt/evtsupport.py b/Mac/Modules/evt/evtsupport.py
index d1cc1d1..ed06b5d 100644
--- a/Mac/Modules/evt/evtsupport.py
+++ b/Mac/Modules/evt/evtsupport.py
@@ -74,6 +74,31 @@ execfile(INPUTFILE)
for f in functions: module.add(f)
##for f in methods: object.add(f)
+WaitNextEvent_body = """
+Boolean _rv;
+EventMask eventMask;
+EventRecord theEvent;
+UInt32 sleep;
+Handle mouseregion = (Handle)0;
+
+if (!PyArg_ParseTuple(_args, "hl|O&",
+ &eventMask,
+ &sleep,
+ OptResObj_Convert, &mouseregion))
+ return NULL;
+_rv = WaitNextEvent(eventMask,
+ &theEvent,
+ sleep,
+ (RgnHandle)mouseregion);
+_res = Py_BuildValue("bO&",
+ _rv,
+ PyMac_BuildEventRecord, &theEvent);
+return _res;
+"""
+f = ManualGenerator("WaitNextEvent", WaitNextEvent_body);
+f.docstring = lambda: "(EventMask eventMask, UInt32 sleep [,RegionHandle]) -> (Boolean _rv, EventRecord theEvent)"
+module.add(f)
+
# generate output (open the output file as late as possible)
SetOutputFileName(OUTPUTFILE)
module.generate()