Apologies! My bad.
When you observe a different process, I would certainly expect that you'd get the kAXMenuOpenedNotification immediately when the other process opens a contextual menu. Is that not the case for you?
No, its not. I add an observer notication (kAXMenuOpenedNotification) for another application's axuielementref. When the other application's menu opens, its only when the menu closes that I receive the callback, at which point, it is has been destroyed.
if I call:
if (AXUIElementPerformAction((AXUIElementRef)child, kAXShowMenuAction) != kAXErrorSuccess) { LOGSELECTORERROR; } I only see the notification callback when the menu disappears.
However, if perform the kAXShowMenuAction using another queue, I get the call back immediately.
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0UL), ^{ if (AXUIElementPerformAction((AXUIElementRef)child, kAXShowMenuAction) != kAXErrorSuccess) { LOGSELECTORERROR; } });
Thanks,
Patrick
On Apr 4, 2013, at 10:50 AM, Eric Schlegel wrote: On Apr 4, 2013, at 10:48 AM, Patrick Cusack < email@hidden> wrote: Sorry, I am observing another application. I made the assumption that was implied as I wouldn't use accessibility to query my own app. I don't own the NSMenu that I am querying. I am querying the menu that belongs to another application.
Ah. You said in your original email that you were observing your own process:
I am observing my application process looking for an kAXMenuOpenedNotification when I open a contextual menu. I do see the callback for the notification, but it is only after I click away and close the menu. Would anyone have an explanation as to why the menu notification is delayed?
so I was still going on that assumption.
When you observe a different process, I would certainly expect that you'd get the kAXMenuOpenedNotification immediately when the other process opens a contextual menu. Is that not the case for you?
-eric
|