Commit eceb2d3d authored by Sam Lantinga's avatar Sam Lantinga

Ensure that the main display is picked up first

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404246
parent df27e595
...@@ -139,7 +139,7 @@ Cocoa_InitModes(_THIS) ...@@ -139,7 +139,7 @@ Cocoa_InitModes(_THIS)
CGDisplayErr result; CGDisplayErr result;
CGDirectDisplayID *displays; CGDirectDisplayID *displays;
CGDisplayCount numDisplays; CGDisplayCount numDisplays;
int i; int pass, i;
result = CGGetOnlineDisplayList(0, NULL, &numDisplays); result = CGGetOnlineDisplayList(0, NULL, &numDisplays);
if (result != kCGErrorSuccess) { if (result != kCGErrorSuccess) {
...@@ -154,12 +154,24 @@ Cocoa_InitModes(_THIS) ...@@ -154,12 +154,24 @@ Cocoa_InitModes(_THIS)
return; return;
} }
/* Pick up the primary display in the first pass, then get the rest */
for (pass = 0; pass < 2; ++pass) {
for (i = 0; i < numDisplays; ++i) { for (i = 0; i < numDisplays; ++i) {
SDL_VideoDisplay display; SDL_VideoDisplay display;
SDL_DisplayData *displaydata; SDL_DisplayData *displaydata;
SDL_DisplayMode mode; SDL_DisplayMode mode;
CFDictionaryRef moderef; CFDictionaryRef moderef;
if (pass == 0) {
if (!CGDisplayIsMain(displays[i])) {
continue;
}
} else {
if (CGDisplayIsMain(displays[i])) {
continue;
}
}
if (CGDisplayMirrorsDisplay(displays[i]) != kCGNullDirectDisplay) { if (CGDisplayMirrorsDisplay(displays[i]) != kCGNullDirectDisplay) {
continue; continue;
} }
...@@ -184,6 +196,7 @@ Cocoa_InitModes(_THIS) ...@@ -184,6 +196,7 @@ Cocoa_InitModes(_THIS)
display.driverdata = displaydata; display.driverdata = displaydata;
SDL_AddVideoDisplay(&display); SDL_AddVideoDisplay(&display);
} }
}
SDL_stack_free(displays); SDL_stack_free(displays);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment