I am trying something like
CGPoint point = CGContextConvertPointToDeviceSpace(state->cgDrawContext, state->rect.origin);
CGGetDisplaysWithPoint (point, 1, &display, &matchingDisplayCount);
while state->rect is CGRect that is lately passed to CGContextDrawImage, which in her turn draw in application window. But I always get main display (the one with 0,0 coordinates) id. CGContextConvertPointToDeviceSpace documentation states that it transforms point to device space, so is it different from global coordinates space mentioned in other parts of documentation ? And how can i get displayID of current display application is drawed on?