Merge "Move createKeyEvent to a static function"