Reputation: 979
Hello I'm OS X beginner.
I use MacBook Pro retina 13 2013 late. I need retina to non-retina switch in my menu-bar so, I tried to make this app... but I don't know how change my display resolution..
I find this article.. but short time blinking and change resolution, after back to original setting..
but I don't know it is right solution.
I want make exactly same as OS X's display setting retina to non-retina and non-retina to retina
Upvotes: 0
Views: 478
Reputation: 90551
The example code in that article shows both switching the display mode and then switching it back. There's a placeholder comment for you could put code to display something in between the mode switches, but if you don't do anything there it will just immediately switch back.
It sounds like you want to switch the display mode and leave it that way. You want that to affect the desktop and all apps, so you don't want to capture the display or hide the cursor.
If you want the change to stick even after your menu-bar app has exited, you need to use CGBeginDisplayConfiguration()
to get a CGDisplayConfigRef
, use CGConfigureDisplayWithDisplayMode()
to set the mode for the appropriate display, and then use CGCompleteDisplayConfiguration()
with the option kCGConfigureForSession
or kCGConfigurePermanently
.
Upvotes: 1