cocoa_common: refactor fullscreen code for readability

Break up the code into several methods and reduce code duplication. Also add
comments to make the intention of all this clearer.
cocoa_common: change dock to autohide (as opposed to hide)