mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 20:58:38 +02:00
Merge pull request #10142 from Triplelexx/21258
21258 - Don't render (or heavily use GPU) when window in minimized
This commit is contained in:
commit
50456f71ed
4 changed files with 16 additions and 1 deletions
|
@ -1436,6 +1436,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
||||||
entityPacketSender->setMyAvatar(myAvatar.get());
|
entityPacketSender->setMyAvatar(myAvatar.get());
|
||||||
|
|
||||||
connect(this, &Application::applicationStateChanged, this, &Application::activeChanged);
|
connect(this, &Application::applicationStateChanged, this, &Application::activeChanged);
|
||||||
|
connect(_window, SIGNAL(windowMinimizedChanged(bool)), this, SLOT(windowMinimizedChanged(bool)));
|
||||||
qCDebug(interfaceapp, "Startup time: %4.2f seconds.", (double)startupTimer.elapsed() / 1000.0);
|
qCDebug(interfaceapp, "Startup time: %4.2f seconds.", (double)startupTimer.elapsed() / 1000.0);
|
||||||
|
|
||||||
auto textureCache = DependencyManager::get<TextureCache>();
|
auto textureCache = DependencyManager::get<TextureCache>();
|
||||||
|
@ -2084,7 +2085,7 @@ void Application::initializeUi() {
|
||||||
|
|
||||||
void Application::paintGL() {
|
void Application::paintGL() {
|
||||||
// Some plugins process message events, allowing paintGL to be called reentrantly.
|
// Some plugins process message events, allowing paintGL to be called reentrantly.
|
||||||
if (_inPaint || _aboutToQuit) {
|
if (_inPaint || _aboutToQuit || _window->isMinimized()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6486,6 +6487,14 @@ void Application::activeChanged(Qt::ApplicationState state) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Application::windowMinimizedChanged(bool minimized) {
|
||||||
|
if (!minimized && !getActiveDisplayPlugin()->isActive()) {
|
||||||
|
getActiveDisplayPlugin()->activate();
|
||||||
|
} else if (minimized && getActiveDisplayPlugin()->isActive()) {
|
||||||
|
getActiveDisplayPlugin()->deactivate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Application::postLambdaEvent(std::function<void()> f) {
|
void Application::postLambdaEvent(std::function<void()> f) {
|
||||||
if (this->thread() == QThread::currentThread()) {
|
if (this->thread() == QThread::currentThread()) {
|
||||||
f();
|
f();
|
||||||
|
|
|
@ -415,6 +415,7 @@ private slots:
|
||||||
void faceTrackerMuteToggled();
|
void faceTrackerMuteToggled();
|
||||||
|
|
||||||
void activeChanged(Qt::ApplicationState state);
|
void activeChanged(Qt::ApplicationState state);
|
||||||
|
void windowMinimizedChanged(bool minimized);
|
||||||
|
|
||||||
void notifyPacketVersionMismatch();
|
void notifyPacketVersionMismatch();
|
||||||
|
|
||||||
|
|
|
@ -109,8 +109,12 @@ void MainWindow::changeEvent(QEvent* event) {
|
||||||
stateChangeEvent->oldState() == Qt::WindowMaximized) &&
|
stateChangeEvent->oldState() == Qt::WindowMaximized) &&
|
||||||
windowState() == Qt::WindowMinimized) {
|
windowState() == Qt::WindowMinimized) {
|
||||||
emit windowShown(false);
|
emit windowShown(false);
|
||||||
|
emit windowMinimizedChanged(true);
|
||||||
} else {
|
} else {
|
||||||
emit windowShown(true);
|
emit windowShown(true);
|
||||||
|
if (stateChangeEvent->oldState() == Qt::WindowMinimized) {
|
||||||
|
emit windowMinimizedChanged(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (event->type() == QEvent::ActivationChange) {
|
} else if (event->type() == QEvent::ActivationChange) {
|
||||||
if (isActiveWindow()) {
|
if (isActiveWindow()) {
|
||||||
|
|
|
@ -29,6 +29,7 @@ public slots:
|
||||||
signals:
|
signals:
|
||||||
void windowGeometryChanged(QRect geometry);
|
void windowGeometryChanged(QRect geometry);
|
||||||
void windowShown(bool shown);
|
void windowShown(bool shown);
|
||||||
|
void windowMinimizedChanged(bool minimized);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void closeEvent(QCloseEvent* event) override;
|
virtual void closeEvent(QCloseEvent* event) override;
|
||||||
|
|
Loading…
Reference in a new issue