[Python-checkins] CVS: python/dist/src/Mac/Modules/carbonevt CarbonEvtscan.py,1.4,1.4.4.1 CarbonEvtsupport.py,1.8,1.8.4.1 _CarbonEvtmodule.c,1.5,1.5.4.1

Jack Jansen jackjansen@users.sourceforge.net
2002年2月27日 15:09:10 -0800


Update of /cvsroot/python/python/dist/src/Mac/Modules/carbonevt
In directory usw-pr-cvs1:/tmp/cvs-serv500/carbonevt
Modified Files:
 Tag: release22-maint
	CarbonEvtscan.py CarbonEvtsupport.py _CarbonEvtmodule.c 
Log Message:
Backport of 1.5 thru 1.7 (of _CarbonEvtmodule.c):
- Fixed TrackMouseRegion() argument: ioWasInRgn is an in/out parameter.
- Today's Carbon Toolbox addition: CarbonEvt.TrackMouseLocation() and friends.
- fixed SetEventParameter() signature: removed unneccesary length arg.
Index: CarbonEvtscan.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/carbonevt/CarbonEvtscan.py,v
retrieving revision 1.4
retrieving revision 1.4.4.1
diff -C2 -d -r1.4 -r1.4.4.1
*** CarbonEvtscan.py	14 Dec 2001 23:16:04 -0000	1.4
--- CarbonEvtscan.py	27 Feb 2002 23:09:08 -0000	1.4.4.1
***************
*** 64,70 ****
 			"sHandler",
 			"MacCreateEvent",
! 			"TrackMouseLocationWithOptions",
! 			"TrackMouseLocation",
! 			"TrackMouseRegion",
 			"RegisterToolboxObjectClass",
 			"UnregisterToolboxObjectClass",
--- 64,70 ----
 			"sHandler",
 			"MacCreateEvent",
! #			"TrackMouseLocationWithOptions",
! #			"TrackMouseLocation",
! #			"TrackMouseRegion",
 			"RegisterToolboxObjectClass",
 			"UnregisterToolboxObjectClass",
***************
*** 108,113 ****
 
 	def makerepairinstructions(self):
! 		return []
! 		
 if __name__ == "__main__":
 	main()
--- 108,118 ----
 
 	def makerepairinstructions(self):
! 		return [
! 			([("UInt32", 'inSize', "InMode"), ("void_ptr", 'inDataPtr', "InMode")],
! 			 [("MyInBuffer", 'inDataPtr', "InMode")]),
! 			([("Boolean", 'ioWasInRgn', "OutMode")],
! 			 [("Boolean", 'ioWasInRgn', "InOutMode")]),
! 		]
! 
 if __name__ == "__main__":
 	main()
Index: CarbonEvtsupport.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/carbonevt/CarbonEvtsupport.py,v
retrieving revision 1.8
retrieving revision 1.8.4.1
diff -C2 -d -r1.8 -r1.8.4.1
*** CarbonEvtsupport.py	18 Dec 2001 12:35:57 -0000	1.8
--- CarbonEvtsupport.py	27 Feb 2002 23:09:08 -0000	1.8.4.1
***************
*** 35,38 ****
--- 35,44 ----
 # here are some types that are really other types
 
+ class MyVarInputBufferType(VarInputBufferType):
+ 	def passInput(self, name):
+ 		return "%s__len__, %s__in__" % (name, name)
+ 
+ MyInBuffer = MyVarInputBufferType('char', 'long', 'l')		# (buf, len)
+ 
 EventTime = double
 EventTimeout = EventTime
***************
*** 61,64 ****
--- 67,75 ----
 		Output('return NULL;')
 		OutRbrace()
+ 
+ 
+ RgnHandle = OpaqueByValueType("RgnHandle", "ResObj")
+ GrafPtr = OpaqueByValueType("GrafPtr", "GrafObj")
+ MouseTrackingResult = UInt16
 
 
Index: _CarbonEvtmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/carbonevt/_CarbonEvtmodule.c,v
retrieving revision 1.5
retrieving revision 1.5.4.1
diff -C2 -d -r1.5 -r1.5.4.1
*** _CarbonEvtmodule.c	18 Dec 2001 12:35:57 -0000	1.5
--- _CarbonEvtmodule.c	27 Feb 2002 23:09:08 -0000	1.5.4.1
***************
*** 216,232 ****
 	OSType inName;
 	OSType inType;
! 	UInt32 inSize;
! 	char* inDataPtr;
! 	if (!PyArg_ParseTuple(_args, "O&O&ls",
 	 PyMac_GetOSType, &inName,
 	 PyMac_GetOSType, &inType,
! 	 &inSize,
! 	 &inDataPtr))
 		return NULL;
 	_err = SetEventParameter(_self->ob_itself,
 	 inName,
 	 inType,
! 	 inSize,
! 	 inDataPtr);
 	if (_err != noErr) return PyMac_Error(_err);
 	Py_INCREF(Py_None);
--- 216,232 ----
 	OSType inName;
 	OSType inType;
! 	char *inDataPtr__in__;
! 	long inDataPtr__len__;
! 	int inDataPtr__in_len__;
! 	if (!PyArg_ParseTuple(_args, "O&O&s#",
 	 PyMac_GetOSType, &inName,
 	 PyMac_GetOSType, &inType,
! 	 &inDataPtr__in__, &inDataPtr__in_len__))
 		return NULL;
+ 	inDataPtr__len__ = inDataPtr__in_len__;
 	_err = SetEventParameter(_self->ob_itself,
 	 inName,
 	 inType,
! 	 inDataPtr__len__, inDataPtr__in__);
 	if (_err != noErr) return PyMac_Error(_err);
 	Py_INCREF(Py_None);
***************
*** 387,391 ****
 	 "() -> None"},
 	{"SetEventParameter", (PyCFunction)EventRef_SetEventParameter, 1,
! 	 "(OSType inName, OSType inType, UInt32 inSize, char* inDataPtr) -> None"},
 	{"GetEventClass", (PyCFunction)EventRef_GetEventClass, 1,
 	 "() -> (UInt32 _rv)"},
--- 387,391 ----
 	 "() -> None"},
 	{"SetEventParameter", (PyCFunction)EventRef_SetEventParameter, 1,
! 	 "(OSType inName, OSType inType, Buffer inDataPtr) -> None"},
 	{"GetEventClass", (PyCFunction)EventRef_GetEventClass, 1,
 	 "() -> (UInt32 _rv)"},
***************
*** 1391,1394 ****
--- 1391,1467 ----
 }
 
+ static PyObject *CarbonEvents_TrackMouseLocation(PyObject *_self, PyObject *_args)
+ {
+ 	PyObject *_res = NULL;
+ 	OSStatus _err;
+ 	GrafPtr inPort;
+ 	Point outPt;
+ 	UInt16 outResult;
+ 	if (!PyArg_ParseTuple(_args, "O&",
+ 	 GrafObj_Convert, &inPort))
+ 		return NULL;
+ 	_err = TrackMouseLocation(inPort,
+ 	 &outPt,
+ 	 &outResult);
+ 	if (_err != noErr) return PyMac_Error(_err);
+ 	_res = Py_BuildValue("O&H",
+ 	 PyMac_BuildPoint, outPt,
+ 	 outResult);
+ 	return _res;
+ }
+ 
+ static PyObject *CarbonEvents_TrackMouseLocationWithOptions(PyObject *_self, PyObject *_args)
+ {
+ 	PyObject *_res = NULL;
+ 	OSStatus _err;
+ 	GrafPtr inPort;
+ 	OptionBits inOptions;
+ 	double inTimeout;
+ 	Point outPt;
+ 	UInt32 outModifiers;
+ 	UInt16 outResult;
+ 	if (!PyArg_ParseTuple(_args, "O&ld",
+ 	 GrafObj_Convert, &inPort,
+ 	 &inOptions,
+ 	 &inTimeout))
+ 		return NULL;
+ 	_err = TrackMouseLocationWithOptions(inPort,
+ 	 inOptions,
+ 	 inTimeout,
+ 	 &outPt,
+ 	 &outModifiers,
+ 	 &outResult);
+ 	if (_err != noErr) return PyMac_Error(_err);
+ 	_res = Py_BuildValue("O&lH",
+ 	 PyMac_BuildPoint, outPt,
+ 	 outModifiers,
+ 	 outResult);
+ 	return _res;
+ }
+ 
+ static PyObject *CarbonEvents_TrackMouseRegion(PyObject *_self, PyObject *_args)
+ {
+ 	PyObject *_res = NULL;
+ 	OSStatus _err;
+ 	GrafPtr inPort;
+ 	RgnHandle inRegion;
+ 	Boolean ioWasInRgn;
+ 	UInt16 outResult;
+ 	if (!PyArg_ParseTuple(_args, "O&O&b",
+ 	 GrafObj_Convert, &inPort,
+ 	 ResObj_Convert, &inRegion,
+ 	 &ioWasInRgn))
+ 		return NULL;
+ 	_err = TrackMouseRegion(inPort,
+ 	 inRegion,
+ 	 &ioWasInRgn,
+ 	 &outResult);
+ 	if (_err != noErr) return PyMac_Error(_err);
+ 	_res = Py_BuildValue("bH",
+ 	 ioWasInRgn,
+ 	 outResult);
+ 	return _res;
+ }
+ 
 static PyObject *CarbonEvents_GetLastUserEventTime(PyObject *_self, PyObject *_args)
 {
***************
*** 1719,1722 ****
--- 1792,1801 ----
 	{"GetCurrentEventTime", (PyCFunction)CarbonEvents_GetCurrentEventTime, 1,
 	 "() -> (double _rv)"},
+ 	{"TrackMouseLocation", (PyCFunction)CarbonEvents_TrackMouseLocation, 1,
+ 	 "(GrafPtr inPort) -> (Point outPt, UInt16 outResult)"},
+ 	{"TrackMouseLocationWithOptions", (PyCFunction)CarbonEvents_TrackMouseLocationWithOptions, 1,
+ 	 "(GrafPtr inPort, OptionBits inOptions, double inTimeout) -> (Point outPt, UInt32 outModifiers, UInt16 outResult)"},
+ 	{"TrackMouseRegion", (PyCFunction)CarbonEvents_TrackMouseRegion, 1,
+ 	 "(GrafPtr inPort, RgnHandle inRegion, Boolean ioWasInRgn) -> (Boolean ioWasInRgn, UInt16 outResult)"},
 	{"GetLastUserEventTime", (PyCFunction)CarbonEvents_GetLastUserEventTime, 1,
 	 "() -> (double _rv)"},

AltStyle によって変換されたページ (->オリジナル) /