Update interface to default to HMD display plugin
Showing the changes to interface/src/Application.cpp (1 of 1 file). Show all
Unified · Split
| @@ -3379,13 +3379,31 @@ void Application::loadSettings() { · 3378 unmodified lines | |||
| 3379 | // If there is a preferred plugin, we probably messed it up with the menu settings, so fix it. | 3379 | // If there is a preferred plugin, we probably messed it up with the menu settings, so fix it. |
| 3380 | auto pluginManager = PluginManager::getInstance(); | 3380 | auto pluginManager = PluginManager::getInstance(); |
| 3381 | auto plugins = pluginManager->getPreferredDisplayPlugins(); | 3381 | auto plugins = pluginManager->getPreferredDisplayPlugins(); |
| 3382 | for (auto plugin : plugins) { | 3382 | auto menu = Menu::getInstance(); |
| 3383 | auto menu = Menu::getInstance(); | 3383 | if (plugins.size() > 0) { |
| 3384 | if (auto action = menu->getActionForOption(plugin->getName())) { | 3384 | for (auto plugin : plugins) { |
| 3385 | action->setChecked(true); | 3385 | if (auto action = menu->getActionForOption(plugin->getName())) { |
| 3386 | action->trigger(); | 3386 | action->setChecked(true); |
| 3387 | // Find and activated highest priority plugin, bail for the rest | 3387 | action->trigger(); |
| 3388 | break; | 3388 | // Find and activated highest priority plugin, bail for the rest |
| 3389 | break; | ||
| 3390 | } | ||
| 3391 | } | ||
| 3392 | } else { | ||
| 3393 | // If this is our first run, and no preferred devices were set, default to | ||
| 3394 | // an HMD device if available. | ||
| 3395 | Setting::Handle<bool> firstRun { Settings::firstRun, true }; | ||
| 3396 | if (firstRun.get()) { | ||
| 3397 | auto displayPlugins = pluginManager->getDisplayPlugins(); | ||
| 3398 | for (auto& plugin : displayPlugins) { | ||
| 3399 | if (plugin->isHmd()) { | ||
| 3400 | if (auto action = menu->getActionForOption(plugin->getName())) { | ||
| 3401 | action->setChecked(true); | ||
| 3402 | action->trigger(); | ||
| 3403 | break; | ||
| 3404 | } | ||
| 3405 | } | ||
| 3406 | } | ||
| 3389 | } | 3407 | } |
| 3390 | } | 3408 | } |
| 3391 | 3409 | ||