]> granicus.if.org Git - python/commitdiff
Added optional mouseregion parameter to WaitNextEvent (which is now
authorJack Jansen <jack.jansen@cwi.nl>
Thu, 17 Sep 1998 15:28:58 +0000 (15:28 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Thu, 17 Sep 1998 15:28:58 +0000 (15:28 +0000)
manually generated).

Mac/Modules/evt/Evtmodule.c
Mac/Modules/evt/evtscan.py
Mac/Modules/evt/evtsupport.py

index edd8bc7a22c0f3b6004aef256025eabc5e28656b..71858f606beac6f8055835edfa4202b90c0b24cd 100644 (file)
@@ -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}
 };
 
index 3b3765fc34b86164c6d042e4c95804cd89b3c035..1f558ead367ba781d539baa4b2bf1c79187e21ff 100644 (file)
@@ -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):
index d1cc1d1b743420083d31ae8bbbaed6a8316a7127..ed06b5d2d4fa9688f3dbd15bc1ee590f9c9c52d9 100644 (file)
@@ -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()