Fix for SDL double-reporting display modes
authorTobias Markus <tobbi@mozilla-uk.org>
Wed, 13 Aug 2014 12:29:13 +0000 (14:29 +0200)
committerTobias Markus <tobbi@mozilla-uk.org>
Wed, 13 Aug 2014 12:29:13 +0000 (14:29 +0200)
src/supertux/menu/options_menu.cpp

index 58ebf40..c0991c2 100644 (file)
@@ -103,6 +103,7 @@ OptionsMenu::OptionsMenu(bool complete)
   }
 
   int display_mode_count = SDL_GetNumDisplayModes(0);
+  std::string last_display_mode;
   for(int i = 0; i < display_mode_count; ++i)
   {
     SDL_DisplayMode mode;
@@ -115,6 +116,9 @@ OptionsMenu::OptionsMenu(bool complete)
     {
       std::ostringstream out;
       out << mode.w << "x" << mode.h << "@" << mode.refresh_rate;
+      if(last_display_mode == out.str())
+        continue;
+      last_display_mode = out.str();
       fullscreen_res->list.push_back(out.str());
     }
   }