Hey,

I am experiencing some really weird behavior with CGDisplaySetDisplayMode 
behavior on osx 10.9.3 on a late 2013 retina mbp.

if I call CGDisplaySetDisplayMode only once, it seems to end up in weird 
display modes, that are not even listed through CGDisplayCopyAllDisplayModes 
i.e. oftentimes 16 bit modes. If I call CGDisplaySetDisplayMode again right 
afterwards, it goes to the desired mode. Here is a very simple example:

if I do:

GDisplayModeRef originalMode = CGDisplayCopyDisplayMode(CGMainDisplayID());
CGDisplaySetDisplayMode(CGMainDisplayID(), originalMode, NULL);
CGDisplayModeRelease(originalMode);

It goes from the current mode (1440x900,32 bit hidpi) to the same mode in 16 
bit!!

If I do:

GDisplayModeRef originalMode = CGDisplayCopyDisplayMode(CGMainDisplayID());
CGDisplaySetDisplayMode(CGMainDisplayID(), originalMode, NULL);
CGDisplaySetDisplayMode(CGMainDisplayID(), originalMode, NULL);
CGDisplayModeRelease(originalMode);

it arrives at the correct mode.

This is the simplest test case I could come up with as I was getting similar 
garbage when using CGDisplayCopyAllDisplayModes
to select a specific mode, i.e:

                
                CFArrayRef allModes = CGDisplayCopyAllDisplayModes(_id, NULL);
                if(allModes)
                {
                    for(int i = 0; i < CFArrayGetCount(allModes); i++)
                    {
                        CGDisplayModeRef mode = 
(CGDisplayModeRef)CFArrayGetValueAtIndex(allModes, i);

                        Size width = CGDisplayModeGetWidth(mode);
                        Size height = CGDisplayModeGetHeight(mode);

                        if(width == 800 && height == 600)
                        {
                            CGDisplaySetDisplayMode((CGDirectDisplayID)_id, 
mode, NULL);
                            //CGDisplaySetDisplayMode((CGDirectDisplayID)_id, 
mode, NULL);
                            break;
                        }
                    }
                    
                    CFRelease(allModes);
                }

Only properly goes to 800x600 if I uncomment the second call to 
CGDisplaySetDisplayMode this seems really odd… 
Any ideas?

thanks,
Matthias
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to