Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What is the event path from user to application?




On Oct 16, 2005, at 1:48 PM, Gregory Cooksey wrote:

Is it possible for an application other than the Window Server to get a copy of that port

I don't know.

Okay, so all applications receive low level Carbon events?

Strictly speaking, all applications _create_ low-level Carbon events; the event structure that's passed from the WindowServer to the app is not a Carbon event, but a rather is a different event structure that is private to the WindowServer and Apple frameworks.


These would be of the kEventRawKey... type, correct?

All apps begin by creating events of this type from keyboard events provided by the WindowServer, yes.


And then does the standard window handler or whatever convert those raw key events into higher level events for the application to handle?

For keyboard events, the standard window handler doesn't actually play a role; keyboard events are handled by a default event handler installed at the application level for Carbon events, and somewhat different for Cocoa apps.


For mouse events, the standard window handler does convert these into higher-level semantic events.

Is an event posted to the application's main event queue indistinguishable from an event sent to the application by the Window Server, and will that work for Cocoa applications? If so, then the mach_inject method is still a possibility.

It would be distinguishable, but I doubt most apps would care.

If you need to insert keyboard events and mouse events into another application, most likely the best way to do this will be to use the APIs in CoreGraphics/CGRemoteOperation.h, which are designed for this purpose.

My concern with doing it that way is that I only want the application I specifically target to receive these events.

For keyboard events, you can use AXUIElementPostKeyboardEvent to post an event to a specific application.


On Tiger, you can use CGEventPostToPSN to post events of any time to a specific process.

-eric

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden
References: 
 >What is the event path from user to application? (From: Gregory Cooksey <email@hidden>)
 >Re: What is the event path from user to application? (From: Eric Schlegel <email@hidden>)
 >Re: What is the event path from user to application? (From: Gregory Cooksey <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.