mirror of
https://github.com/overte-org/overte.git
synced 2025-04-15 12:28:51 +02:00
Fallback display to last, then desktop
This commit is contained in:
parent
34a77b47a3
commit
7bcef1d319
1 changed files with 22 additions and 6 deletions
|
@ -4886,6 +4886,7 @@ void Application::updateDisplayMode() {
|
|||
{
|
||||
std::unique_lock<std::mutex> lock(_displayPluginLock);
|
||||
|
||||
auto oldDisplayPlugin = _displayPlugin;
|
||||
if (_displayPlugin) {
|
||||
_displayPlugin->deactivate();
|
||||
}
|
||||
|
@ -4893,12 +4894,27 @@ void Application::updateDisplayMode() {
|
|||
// FIXME probably excessive and useless context switching
|
||||
_offscreenContext->makeCurrent();
|
||||
|
||||
// If the new plugin fails to activate, fallback to first item on the list
|
||||
if (!newDisplayPlugin->activate()) {
|
||||
qWarning() << "Failed to activate plugin: " << newDisplayPlugin->getName();
|
||||
newDisplayPlugin = displayPlugins.at(0);
|
||||
qWarning() << "Activating fallback plugin: " << newDisplayPlugin->getName();
|
||||
if (!newDisplayPlugin->activate()) {
|
||||
bool active = newDisplayPlugin->activate();
|
||||
|
||||
if (!active) {
|
||||
// If the new plugin fails to activate, fallback to last display
|
||||
qWarning() << "Failed to activate display: " << newDisplayPlugin->getName();
|
||||
newDisplayPlugin = oldDisplayPlugin;
|
||||
|
||||
if (newDisplayPlugin) {
|
||||
qWarning() << "Falling back to last display: " << newDisplayPlugin->getName();
|
||||
active = newDisplayPlugin->activate();
|
||||
}
|
||||
|
||||
// If there is no last display, or
|
||||
// If the last display fails to activate, fallback to desktop
|
||||
if (!active) {
|
||||
newDisplayPlugin = displayPlugins.at(0);
|
||||
qWarning() << "Falling back to display: " << newDisplayPlugin->getName();
|
||||
active = newDisplayPlugin->activate();
|
||||
}
|
||||
|
||||
if (!active) {
|
||||
qFatal("Failed to activate fallback plugin");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue