Re: pointers for newbie wanting to write a 'window' logger
site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=WrIz56WvTqn2YA3ZOE0VF63ObqfbkdSAkkpcl2m6qmI=; b=XN9misIbu8W69YHjohbcJLDrWFn/wUoJFKO0ngKarjpCABZ6Mcfat7yWKiwpHJjkAJ PdhuqIOdpkwFVvqYbbxcmP+2foy5DlOo2mGJozqjXyzpPUVwppX6p8jmrkMgLxKMnOJd bexTq6tZLVIM6phKtTWCVnr/EjwFjHOnKlIs0= Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=mbMv3Y5IHGS/eFxxTFtyevEuPhhWVgJnldx7t+TW45Ib3bXfsvl1Eb0KDLYJsPrQds WSt07G8hD1SLDC/+VGcZIvGFE378e//p3zd0c7D4NUyCNJy+T/IIo548tL9rOmeIMhzC 9SaQ1yqWFGsZNa3+JXzo/v7T1+d8ekC6aQbJA= take a look on ApplicationServices.framework and CGWindowListCreateDescriptionFromArray On Mon, Sep 8, 2008 at 9:15 AM, Joel Sherriff <joel@6sa.com> wrote:
Hmm, well it looks like the thing I expected to be hard is easy (thank's to Philip's pointer), but the thing I expected to be easy isn't so much. This is also not particularly a kernel thing, but I might as well continue the thread if no one objects...
Any thoughts on how to get the window title of the "active" window? The event mechanism doesn't give a lot of detail since it's at such a low level - Process Serial Number, PID, and a bunch of other things I don't understand...but not Window Id, so I know now that an event occurred, but not what window it was sent to. That's half the battle. It looks like there's a new CGWindow interface in Leopard that has some details - but only the application name (kCGWindowName), not the title. And, without a window id in the CGEvent data I couldn't link the two together anyway. But application name isn't sufficient for my needs - I really need the title.
Joel
Philip Aker wrote:
On Sep 5, 2008, at 2:43 PM, Joel Sherriff wrote:
New to OS X, but I need to write an app that records activity similiar to a keylogger - only that I don't want the keys that are recorded, only to know that a key or mouse button was pressed and what the window title of the window that got the event was. A window-activity logger, versus a keylogger. I'd prefer not to go to as low a level as a kernel extension,
Sounds like you could do this with the event tap and window facilities available in CoreGraphics (CGEvent.h for starters). Look here <http://prefabsoftware.com/> to see an illustration of the tap portion of your needs.
as I'd really like to keep this in user space (but I will, if I have to). I've done the same thing in Windows (using hooks) and Linux (X11 using the XRecord extension to the X server), but I know little or nothing about Quartz, Aqua, Carbon, kernel extensions, etc, etc, so I'm asking for guidance as to the right layer to target and technology to use. In the X11 version, the monitor loads from the Xsession config - that is it starts when the user logs in and runs only while the user is logged in... ideally I'd like to mimic that. Can someone with more experience on OS X features give me some pointers?
Btw, I know this isn't specifically a kernel question, but I figure the kernel guru's would know best when something shouldn't be done in a kernel extension. If a kernel extension is the only way to do it though, then that's the way I'll go.
Philip Aker echo astwta@lvpc.dslh@nl | tr a-z@. p-za-o.@
Democracy: Two wolves and a sheep voting on lunch.
_______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/openspecies%40gmail.com
This email sent to openspecies@gmail.com
-- -mmw _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... This email sent to site_archiver@lists.apple.com
participants (1)
-
mm w