History

Fallback display to last, then desktop

Zach Pomerantz committed 10 years ago

Commit 7bcef1d1 parent 34a77b41 file · +22 −6Browse files

Showing the changes to interface/src/Application.cpp (1 of 1 file). Show all

Unified · Split

interface/src/Application.cpp+22−6
@@ -4886,6 +4886,7 @@ void Application::updateDisplayMode() { · 4885 unmodified lines
4886 {4886 {
4887 std::unique_lock<std::mutex> lock(_displayPluginLock);4887 std::unique_lock<std::mutex> lock(_displayPluginLock);
4888 4888
4889 auto oldDisplayPlugin = _displayPlugin;
4889 if (_displayPlugin) {4890 if (_displayPlugin) {
4890 _displayPlugin->deactivate();4891 _displayPlugin->deactivate();
4891 }4892 }
@@ -4893,12 +4894,27 @@ void Application::updateDisplayMode() { · 1 unmodified line
4893 // FIXME probably excessive and useless context switching4894 // FIXME probably excessive and useless context switching
4894 _offscreenContext->makeCurrent();4895 _offscreenContext->makeCurrent();
4895 4896
4896 // If the new plugin fails to activate, fallback to first item on the list4897 bool active = newDisplayPlugin->activate();
4897 if (!newDisplayPlugin->activate()) {4898
4898 qWarning() << "Failed to activate plugin: " << newDisplayPlugin->getName();4899 if (!active) {
4899 newDisplayPlugin = displayPlugins.at(0);4900 // If the new plugin fails to activate, fallback to last display
4900 qWarning() << "Activating fallback plugin: " << newDisplayPlugin->getName();4901 qWarning() << "Failed to activate display: " << newDisplayPlugin->getName();
4901 if (!newDisplayPlugin->activate()) {4902 newDisplayPlugin = oldDisplayPlugin;
4903
4904 if (newDisplayPlugin) {
4905 qWarning() << "Falling back to last display: " << newDisplayPlugin->getName();
4906 active = newDisplayPlugin->activate();
4907 }
4908
4909 // If there is no last display, or
4910 // If the last display fails to activate, fallback to desktop
4911 if (!active) {
4912 newDisplayPlugin = displayPlugins.at(0);
4913 qWarning() << "Falling back to display: " << newDisplayPlugin->getName();
4914 active = newDisplayPlugin->activate();
4915 }
4916
4917 if (!active) {
4902 qFatal("Failed to activate fallback plugin");4918 qFatal("Failed to activate fallback plugin");
4903 }4919 }
4904 }4920 }