Port some critical OS X fixes from the dev branch (QTBUG-40585 patch and App Nap disabling).