Browse Source

Mac: Don't check for drop-file events on startup if the app was launched from a terminal (resolves issue #1081.)

Alex Szpakowski 10 years ago
parent
commit
6a1ca3a45e
1 changed files with 8 additions and 4 deletions
  1. 8 4
      src/love.cpp

+ 8 - 4
src/love.cpp

@@ -110,12 +110,16 @@ static void get_app_arguments(int argc, char **argv, int &new_argc, char **&new_
 	}
 
 #ifdef LOVE_MACOSX
-	// Check for a drop file string.
-	std::string dropfilestr = love::macosx::checkDropEvents();
+	// Check for a drop file string, if the app wasn't launched in a terminal.
+	// Checking for the terminal is a pretty big hack, but works around an issue
+	// where OS X will switch Spaces if the terminal launching love is in its
+	// own full-screen Space.
+	std::string dropfilestr;
+	if (!isatty(STDIN_FILENO))
+		dropfilestr = love::macosx::checkDropEvents();
+
 	if (!dropfilestr.empty())
-	{
 		temp_argv.insert(temp_argv.begin() + 1, dropfilestr);
-	}
 	else
 #endif
 	{