Re: Watching for new windows
Re: Watching for new windows
- Subject: Re: Watching for new windows
- From: Modesitt Software <email@hidden>
- Date: Thu, 20 Nov 2003 14:29:27 -0800
I'll try what you suggested, although it's not immediately obvious
which call would return the window list. When I receive a carbon event
that the frontmost app changed (kEventAppFrontSwitched), I tried
simply asking for the window title since I already know the frontmost
application's AXUIElementRef, but all I get back is the name of the
application:
CFTypeRef cfRef;
AXUIElementCopyAttributeValue( inElement, kAXTitleAttribute, &cfRef );
// returns app name, not window title when this is called on a Cocoa
app that just became frontmost
Otherwise this works fine when the window changes. I'll look for the
call to obtain the window list.
Thanks,
Bill
On Nov 20, 2003, at 1:38 PM, Mike Engber wrote:
Now that I see what you're trying to do I can suggest a way to do it.
When you get the notification that the frontmost app has changed, you
can ask the app for its window list and determine what's in front from
there.
The reason cocoa doesn't send a main window changed notification is
because the main window of an app didn't change. I.e. if you'd asked
the app for its main window before and after the app was frontmost
you'd have gotten the same answer both times.
-ME
On Nov 20, 2003, at 11:49 AM, Modesitt Software wrote:
On Nov 19, 2003, at 10:01 PM, Bill Cheeseman wrote:
His remarks suggested that the extra notification was coming from
Carbon,
but, if I understood him correctly, that the duplication only
happened when
an application element in a Cocoa application was targeted. (It
seems like
this is the opposite from what the person who started this thread
reported,
but I'm not sure I understood exactly how he encountered the
duplicate
notifications.)
I started this thread, and I seem to get the opposite of this bug.
My intent is to log the frontmost window of the current application.
When my app starts, it creates an observer for (almost) every process
running. When the user changes windows using the current
application, my app is notified. So far so good. However, when the
user switches to a Carbon application, my observer receives two
identical notifications. When the user switches to a Cocoa
application, my observer receives no notifications. So I get either
two or zero notifications when the user switches to a different app,
but all I really want is one!
Thanks,
Bill
_______________________________________________
accessibility-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/accessibility-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
accessibility-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/accessibility-dev
Do not post admin requests to the list. They will be ignored.