+// gets all displays that are not mirror displays
+
+static CGDisplayErr wxOSXGetDisplayList(CGDisplayCount maxDisplays,
+ CGDirectDisplayID *displays,
+ CGDisplayCount *displayCount)
+{
+ CGDisplayErr error = kCGErrorSuccess;
+ CGDisplayCount onlineCount;
+
+ error = CGGetOnlineDisplayList(0,NULL,&onlineCount);
+ if ( error == kCGErrorSuccess )
+ {
+ *displayCount = 0;
+ if ( onlineCount > 0 )
+ {
+ CGDirectDisplayID *onlineDisplays = new CGDirectDisplayID[onlineCount];
+ error = CGGetOnlineDisplayList(onlineCount,onlineDisplays,&onlineCount);
+ if ( error == kCGErrorSuccess )
+ {
+ for ( CGDisplayCount i = 0; i < onlineCount; ++i )
+ {
+ if ( CGDisplayMirrorsDisplay(onlineDisplays[i]) != kCGNullDirectDisplay )
+ continue;
+
+ if ( displays == NULL )
+ *displayCount += 1;
+ else
+ {
+ if ( *displayCount < maxDisplays )
+ {
+ displays[*displayCount] = onlineDisplays[i];
+ *displayCount += 1;
+ }
+ }
+ }
+ }
+ delete[] onlineDisplays;
+ }
+
+ }
+ return error;
+}
+