CGDisplayCopyAllDisplayModes gives more number of display modes than shown in system preferences pane..i wanted only those display modes which are shown under system preferences-> displays..how do i get only those?
Checking each mode with CGDisplayModeIsUsableForDesktopGUI()
will allow you to filter out modes which are too low-resolution, or have too shallow of a color depth, to be used as the "desktop" resolution. That should eliminate most of the truly wacky modes.