SDL 1.3: Cocoa video driver fails init when both displays are mirrored

In the most current svn version of SDL 1.3, SDL_Init() will fail if you’re
running OSX with a pair of displays in mirror mode.

Specifically, SDL_cocoamodes.m contains the following snippet in
Cocoa_InitModes():

if (CGDisplayIsInMirrorSet(displays[i])) {
continue;
}

This isn’t correct. If all displays are in the mirror set, then no displays
will ultimately be added.

The first display in each particular mirror set must be added to the display
list.

Locally, I’ve changed this to be:

if (i!=0 && CGDisplayIsInMirrorSet(displays[i])) {
continue;
}

This works for the simple case where there are two displays, both of which
are mirrored.

This will fail if display [0] isn’t mirrored, but displays [1] and [2] are.

Could somebody with more familiarity with cocoa mirror sets suggest a better
patch, one that detects if a given display is the first in its mirror set?

-Chris

I’ve entered this into bugzilla, thanks!
http://bugzilla.libsdl.org/show_bug.cgi?id=844On Sun, Oct 11, 2009 at 7:54 PM, interim_descriptor <interim.descriptor at gmail.com> wrote:

In the most current svn version of SDL 1.3, SDL_Init() will fail if you’re
running OSX with a pair of displays in mirror mode.

Specifically, SDL_cocoamodes.m contains the following snippet in
Cocoa_InitModes():

if (CGDisplayIsInMirrorSet(displays[i])) {
??? continue;
}

This isn’t correct. If all displays are in the mirror set, then no displays
will ultimately be added.

The first display in each particular mirror set must be added to the display
list.

Locally, I’ve changed this to be:

if (i!=0 && CGDisplayIsInMirrorSet(displays[i])) {
??? continue;
}

This works for the simple case where there are two displays, both of which
are mirrored.

This will fail if display [0] isn’t mirrored, but displays [1] and [2] are.

Could somebody with more familiarity with cocoa mirror sets suggest a better
patch, one that detects if a given display is the first in its mirror set?

-Chris


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


-Sam Lantinga, Founder and President, Galaxy Gameworks LLC