Re: Dock Size and Position
Re: Dock Size and Position
- Subject: Re: Dock Size and Position
- From: spiderlama <email@hidden>
- Date: Sat, 14 Jul 2007 13:15:44 +1000
Ok, I've been looking into the Accessibility framework to get a
windows position, width and height (and getting a call-back whenever
this changes), but I can't get anything to work.
No #import's I try work either.
AXUIElementRef element;
AXObserverRef observer;
AXError error;
...
-(NSRect)getWindowRect {
NSRect result;
error = AXUIElementCopyAttributeValue(element, kAXPositionAttribute,
(CFTypeRef *) &result.origin);
error = AXUIElementCopyAttributeValue(element, kAXWidthAttribute,
(CFTypeRef *) &result.size.width);
error = AXUIElementCopyAttributeValue(element, kAXHeightAttribute,
(CFTypeRef *) &result.size.height);
return result;
}
-(void)callback {
NSRect rect = [self getWindowRect];
/* creates an nsimage and sets it to windows background */
}
-(void)applicationDidFinishLaunching... {
pid_t pid = [[[NSWorkspace launchedApplications]
objectForKey:@"AppName"] intValue];
element = AXUIElementCreateApplication(pid);
AXObserverCreate(pid, callback, &observer);
AXObserverAddNotification(observer, element,
kAXWindowResizedNotification, nil);
...
CFRunLoopSource(CFRunLoopGetCurrent(), AXObserverGetRunLoopSource
(observer), kCFRunLoopCommonModes);
}
On 13/07/2007, at 5:44 AM, Jonathon Mah wrote:
Hi Matt,
On 2007-07-12, at 20:25, spiderlama wrote:
What function can I "plug into" in the Dock that contains an
argument with the Dock's size and position? And more generally,
how can I use APE (or another method) to achieve my goals?
Just a thought: You might be able to get this information with the
accessibility framework, which could potentially be far more
compatible.
Jonathon Mah
email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden