mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 18:13:05 +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);
|
std::unique_lock<std::mutex> lock(_displayPluginLock);
|
||||||
|
|
||||||
|
auto oldDisplayPlugin = _displayPlugin;
|
||||||
if (_displayPlugin) {
|
if (_displayPlugin) {
|
||||||
_displayPlugin->deactivate();
|
_displayPlugin->deactivate();
|
||||||
}
|
}
|
||||||
|
@ -4893,12 +4894,27 @@ void Application::updateDisplayMode() {
|
||||||
// FIXME probably excessive and useless context switching
|
// FIXME probably excessive and useless context switching
|
||||||
_offscreenContext->makeCurrent();
|
_offscreenContext->makeCurrent();
|
||||||
|
|
||||||
// If the new plugin fails to activate, fallback to first item on the list
|
bool active = newDisplayPlugin->activate();
|
||||||
if (!newDisplayPlugin->activate()) {
|
|
||||||
qWarning() << "Failed to activate plugin: " << newDisplayPlugin->getName();
|
if (!active) {
|
||||||
newDisplayPlugin = displayPlugins.at(0);
|
// If the new plugin fails to activate, fallback to last display
|
||||||
qWarning() << "Activating fallback plugin: " << newDisplayPlugin->getName();
|
qWarning() << "Failed to activate display: " << newDisplayPlugin->getName();
|
||||||
if (!newDisplayPlugin->activate()) {
|
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");
|
qFatal("Failed to activate fallback plugin");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue