Re: [Pyobjc-dev] Modify wrapper or loadBundleFunctions syntax
Brought to you by:
ronaldoussoren
|
From: Pepijn de V. <pep...@gm...> - 2010-04-12 18:34:56
|
Thank you, that seemed to work.
By the way, the bug is right there under your nose:
<arg type='{CGPoint=ff}' type64='{CGPoint=**ff**}' />
Change the second ff into dd and it's done.
Should I submit a patch or bug report somewhere?
Groeten,
Pepijn de Vos
--
Sent from my iPod Shuffle
http://pepijndevos.nl
On Apr 12, 2010, at 8:13 PM, Virgil Dupras wrote:
> On Mon, Apr 12, 2010 at 7:44 PM, Pepijn de Vos <pep...@gm...> wrote:
>> Hi,
>> It's me again.
>> How can I change the wrapper for a function like CGEventCreateMouseEvent
>> from Quartz?
>> It seems like my CGPoint uses floats instead of doubles, which is wrong for
>> 64 bit, like in Snow Leopard.
>> Another option is going back to using objc and importing the function
>> manually.
>> The problem is that I don't know the syntax for loadBundleFunctions.
>> I managed to get CGPostMouseEvent working with this: v{CGPoint=dd} (instead
>> of ff)
>> What would I need to do to import CGEventCreateMouseEvent?
>> Groeten,
>> Pepijn de Vos
>> --
>> Sent from my iPod Shuffle
>> http://pepijndevos.nl
>> On Apr 4, 2010, at 6:23 PM, Ratko Jagodic wrote:
>>
>> Hi Pepijn,
>> Sorry, but I haven't seen this before. It seemed to work for me. If you feel
>> adventurous, you could try investigating yourself in the PyObjC source. The
>> file is _callbacks.m where the link between C/Python is for events.
>> Sorry I couldn't be of more help. Maybe others on this list could provide
>> more info.
>> Good luck.
>> Ratko
>>
>>
>> On Sun, Apr 4, 2010 at 11:02 AM, Pepijn de Vos <pep...@gm...>
>> wrote:
>>>
>>> Hi,
>>> As you can see in the code below the returned value of the mouse event has
>>> an insane value.
>>> When I generate a click or move event the mouse jumps to the very corner
>>> of the screen.
>>> <NSPoint x=13510801139695616.0 y=6.953222975623699e-310>
>>> Could it be that integer and float conversions between C and Python are
>>> messed up somewhere?
>>> I tried to use a tuple, a NSPoint and a CGPoint, which made no difference
>>> at all.
>>> Just creating a CGPoint object without the event works fine though.
>>> Groeten,
>>> Pepijn de Vos
>>> --
>>> Sent from my iPod Shuffle
>>> http://pepijndevos.nl
>>> On Apr 4, 2010, at 5:54 PM, Ratko Jagodic wrote:
>>>
>>> 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
>>>
>>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> 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
>>
>>
>
> Maybe you can inspire yourself from the PyObjC.bridgeSupport file? The entry is:
>
> <function name='CGEventCreateMouseEvent'>
> <retval already_cfretained='true' type='^{__CGEvent=}' />
> <arg type='^{__CGEventSource=}' />
> <arg type='I' />
> <arg type='{CGPoint=ff}' type64='{CGPoint=ff}' />
> <arg type='I' />
> </function>
>
> So maybe that your 64-bit signature would be
> "^{__CGEvent=}^{__CGEventSource=}I{CGPoint=dd}I" or something?
>
> --
> Virgil Dupras
|