Re: [Pyobjc-dev] PyObjC CGPoint error in CGEventCreateMouseEvent
Brought to you by:
ronaldoussoren
From: Ratko J. <rja...@gm...> - 2010-04-04 15:55:27
|
I ran across the same problem back in September and there were a few bugs in the C code. I reported the bugs and they were fixed so I guess the Macports version includes those fixes. Don't know about the version numbers. CGEventTapCreate should take 6 parameters, as it does in carbon. What do you mean by "breaks the location"? "*When I run Python26 and PyObjC from Macports the event system works fine, but making an event breaks the location.*" Ratko On Sun, Apr 4, 2010 at 10:27 AM, Pepijn de Vos <pep...@gm...>wrote: > Hi all, > > I finally managed to get listening to events working, the code is at > http://github.com/pepijndevos/PyMouse/blob/master/mac.py#L30 > I don't know what made the difference, but after a lot of trying it > suddenly worked. > > Now I have another strange issue. > When I run the default Python and PyObjC version that came with Mac OS X > 10.6, Python segfaults while creating an event tap. > When I run Python26 and PyObjC from Macports the event system works fine, > but making an event breaks the location. > > Stock Python: > > >>> from Quartz import * > >>> def test(*args): > ... print args > ... > >>> tap = CGEventTapCreate( > ... kCGSessionEventTap, > ... kCGHeadInsertEventTap, > ... kCGEventTapOptionDefault, > ... CGEventMaskBit(kCGEventMouseMoved) | > ... CGEventMaskBit(kCGEventLeftMouseDown) | > ... CGEventMaskBit(kCGEventLeftMouseUp) | > ... CGEventMaskBit(kCGEventRightMouseDown) | > ... CGEventMaskBit(kCGEventRightMouseUp) | > ... CGEventMaskBit(kCGEventOtherMouseDown) | > ... CGEventMaskBit(kCGEventOtherMouseUp), > ... test) > Segmentation fault > > Macports Python: > > >>> from Quartz import * > >>> event = CGEventCreateMouseEvent(None, 3, CGPoint(200, 200), 1) > >>> CGEventGetLocation(event) > <NSPoint x=13510801139695616.0 y=6.953222975623699e-310> > > Also the stock version of CGEventTapCreate needs 5 parameters while the > Macports version needs 6. > > Macports version of PyObjC is 2.2 > Included version should be 2.2b3 according to a blog I found. > > Groeten, > Pepijn de Vos > -- > Sent from my iPod Shuffle > http://pepijndevos.nl > > > > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > Pyobjc-dev mailing list > Pyo...@li... > https://lists.sourceforge.net/lists/listinfo/pyobjc-dev > |