cocoa: refactor init window positioning code