Fix issues with shortcut keys not always working correctly on OSX

Cherry picked changes from upstream MonoDevelop to fix issues with shortcut keys not always working correctly on OSX. 

Fixes issue with Cmd+A (Select All) not working correctly after using the main menu.