I'm trying to register for CGScreenRefreshCallback and CGScreenUpdateMoveCallback ( here's what apple's saying about http://developer.apple.com/mac/library/documentation/GraphicsImaging/Reference/Quartz_Services_Ref/Reference/reference.html#//apple_ref/doc/uid/TP30001070-CH1g-F16970 ) using C++ only.
I wrote this simple tester for the refresh callback in order to retrieve the changing rectangles:
#include "ApplicationServices/ApplicationServices.h"
#include <iostream>
using namespace std;
/////////////HEADER
static void DHRefreshCallback (CGRectCount count,const CGRect * rectArray,void * userParameter);
///////////////////
int main (int argc, char * const argv[]) {
CGRegisterScreenRefreshCallback(DHRefreshCallback, NULL);
while (true) {
// just hanging
}
return 0;
}
static void DHRefreshCallback (CGRectCount count,const CGRect * rectArray,void * userParameter){
cout << "something changed" << endl;
return;
}
...but didn't work.
I know I need a connection with WindowServer (Quartz Compositor \ Quartz Extreme \ Quartz Extreme 2D...still can't figure out the difference) and a running thread in order to get these callbacks, but I really don't know how to do this in C++ only (no Objective-C at all).
any direction?
thx in advance, pigiuz