On Oct 16, 2005, at 10:53 AM, Gregory Cooksey wrote:
Hi,
I've been reading through a lot of documentation on Apple's web
site, but I haven't been able to get a grip on the overall event
pathway from a user's key strokes or mouse input to the
application's event handler. I am trying to write a fuzz testing
system for OS X [1] and need to find a way to insert user interface
events into an arbitrary application. My understanding is that it
isn't possible for one application to post a Carbon event to
another application, so I was looking at using mach_inject to
insert a thread into my target and post events to the queue from
the inserted thread. I am concerned that this would only work with
Carbon applications. I've been trying to dig a bit deeper, and
found a reference to a mach event port, but have thus far been
unable to figure out any more about that.
Is there documentation available anywhere about how the system
processes events and sends them to a user application? Am I asking
this on the right mailing list? If not, where should I direct my
questions?
Here's a quick overview:
- user presses a keystroke
- the HID Manager portion of IOKit handles an interrupt, reads the
keyboard data, and notifies the Window Server
- the Window Server is a separate process that is part of the
CoreGraphics framework. It routes user input events to the
appropriate process (the process that currently has keyboard focus)
- the Window Server gets the event and signals a mach port for the
focused process
- the focused process's run loop wakes up because of the signal on
its mach port and reads the input event from the Window Server
- the focused process converts the input event into a Carbon event
(note that this is true for Cocoa apps as well, since the Cocoa event
system uses Carbon events for its lowest-level event receipt) and
posts it into the Carbon event queue
- the focused process pulls the next event from the Carbon event
queue and returns it to the app as a Carbon Event, EventRecord, or
NSEvent, depending on the type of app
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.
-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