How to get CGScreenRegisterMoveCallback working?
How to get CGScreenRegisterMoveCallback working?
- Subject: How to get CGScreenRegisterMoveCallback working?
- From: "Steve McLeod" <email@hidden>
- Date: Wed, 29 Oct 2008 19:00:01 +0100
Hi list,
I am a complete Objective-C/Cocoa/Xcode novice, so please be gentle if my
mistake is dead obvious.
I am trying to detect whether any window moves on the screen. As far as I
can tell CGScreenRegisterMoveCallback should let me do this. But in the
little test code below, which registers callbacks then waits 20 seconds, I
never see the message "Updated" or "Refreshed". The code builds and runs
without warnings.
Any ideas?
Many thanks,
Steve McLeod
---
#import <Foundation/Foundation.h>
#import <Cocoa/Cocoa.h>
void MyScreenRefreshCallback (CGRectCount count, const CGRect * rectArray,
void * userParameter){
NSLog(@"Refreshed");
}
void MyScreenUpdateMoveCallback (CGScreenUpdateMoveDelta delta, size_t
count, const CGRect * rectArray, void * userParameter) {
NSLog(@"Updated");
}
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSLog(@"Started");
CGRegisterScreenRefreshCallback(MyScreenRefreshCallback, NULL);
CGScreenRegisterMoveCallback(MyScreenUpdateMoveCallback, NULL);
sleep(20);
[pool drain];
return 0;
}
_______________________________________________
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