From e26c263e71f9f46d3a6fc7b5c69b6a8e81c1997c Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Tue, 28 Feb 1995 09:11:41 +0000 Subject: [PATCH] more stuff --- Mac/Lib/toolbox/Menus.py | 4 +++- Mac/Modules/evt/Evtmodule.c | 27 +++++++++++++++++---------- Mac/Modules/evt/evtsupport.py | 6 ++++-- 3 files changed, 24 insertions(+), 13 deletions(-) diff --git a/Mac/Lib/toolbox/Menus.py b/Mac/Lib/toolbox/Menus.py index 11b9a485e4a..59dc89a049f 100644 --- a/Mac/Lib/toolbox/Menus.py +++ b/Mac/Lib/toolbox/Menus.py @@ -1,4 +1,5 @@ # Generated from 'D:Development:THINK C:Mac #includes:Apple #includes:Menus.h' + mDrawMsg = 0 mChooseMsg = 1 mSizeMsg = 2 @@ -9,4 +10,5 @@ hMenuCmd = 27 hierMenu = -1 mPopUpMsg = 3 mctAllItems = -98 -mctLastIDIndic = -99 /*last color table entry has this in ID field*/ +mctLastIDIndic = -99 + diff --git a/Mac/Modules/evt/Evtmodule.c b/Mac/Modules/evt/Evtmodule.c index 074a33efea2..42d55b435d1 100644 --- a/Mac/Modules/evt/Evtmodule.c +++ b/Mac/Modules/evt/Evtmodule.c @@ -30,7 +30,10 @@ extern int MenuObj_Convert(PyObject *, MenuHandle *); extern PyObject *CtlObj_New(ControlHandle); extern int CtlObj_Convert(PyObject *, ControlHandle *); +extern PyObject *WinObj_WhichWindow(WindowPtr); + #include +#include #define resNotFound -192 /* Can't include because of Python's "errors.h" */ @@ -159,27 +162,30 @@ static PyObject *Evt_GetKeys(_self, _args) { PyObject *_res = NULL; KeyMap theKeys__out__; - int theKeys__len__; if (!PyArg_ParseTuple(_args, "")) return NULL; GetKeys(theKeys__out__); _res = Py_BuildValue("s#", - (char *)&theKeys__out__, sizeof(KeyMap)); + (char *)&theKeys__out__, (int)sizeof(KeyMap)); theKeys__error__: ; return _res; } -static PyObject *Evt_TickCount(_self, _args) +static PyObject *Evt_SystemClick(_self, _args) PyObject *_self; PyObject *_args; { PyObject *_res = NULL; - long _rv; - if (!PyArg_ParseTuple(_args, "")) + EventRecord theEvent; + WindowPtr theWindow; + if (!PyArg_ParseTuple(_args, "O&O&", + PyMac_GetEventRecord, &theEvent, + WinObj_Convert, &theWindow)) return NULL; - _rv = TickCount(); - _res = Py_BuildValue("l", - _rv); + SystemClick(&theEvent, + theWindow); + Py_INCREF(Py_None); + _res = Py_None; return _res; } @@ -200,8 +206,8 @@ static PyMethodDef Evt_methods[] = { "() -> (Boolean _rv)"}, {"GetKeys", (PyCFunction)Evt_GetKeys, 1, "() -> (KeyMap theKeys)"}, - {"TickCount", (PyCFunction)Evt_TickCount, 1, - "() -> (long _rv)"}, + {"SystemClick", (PyCFunction)Evt_SystemClick, 1, + "(EventRecord theEvent, WindowPtr theWindow) -> None"}, {NULL, NULL, 0} }; @@ -226,3 +232,4 @@ void initEvt() /* ========================= End module Evt ========================= */ + diff --git a/Mac/Modules/evt/evtsupport.py b/Mac/Modules/evt/evtsupport.py index 4798619db0b..6f59b8b3013 100644 --- a/Mac/Modules/evt/evtsupport.py +++ b/Mac/Modules/evt/evtsupport.py @@ -22,8 +22,7 @@ from macsupport import * # Create the type objects -WindowPtr = OpaqueByValueType(OBJECTTYPE, OBJECTPREFIX) -WindowPeek = OpaqueByValueType("WindowPeek", OBJECTPREFIX) +#WindowPeek = OpaqueByValueType("WindowPeek", OBJECTPREFIX) RgnHandle = FakeType("(RgnHandle)0") # XXX @@ -31,6 +30,7 @@ KeyMap = ArrayOutputBufferType("KeyMap") includestuff = includestuff + """ #include <%s>""" % MACHEADERFILE + """ +#include #define resNotFound -192 /* Can't include because of Python's "errors.h" */ """ @@ -63,6 +63,7 @@ Function = OSErrFunctionGenerator functions = [] ##methods = [] execfile(INPUTFILE) +execfile("evtedit.py") # add the populated lists to the generator groups # (in a different wordl the scan program would generate this) @@ -72,3 +73,4 @@ for f in functions: module.add(f) # generate output (open the output file as late as possible) SetOutputFileName(OUTPUTFILE) module.generate() +