mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01: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());
|
||||
|
||||
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);
|
||||
|
||||
auto textureCache = DependencyManager::get<TextureCache>();
|
||||
|
@ -2084,7 +2085,7 @@ void Application::initializeUi() {
|
|||
|
||||
void Application::paintGL() {
|
||||
// Some plugins process message events, allowing paintGL to be called reentrantly.
|
||||
if (_inPaint || _aboutToQuit) {
|
||||
if (_inPaint || _aboutToQuit || _window->isMinimized()) {
|
||||
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) {
|
||||
if (this->thread() == QThread::currentThread()) {
|
||||
f();
|
||||
|
|
|
@ -415,6 +415,7 @@ private slots:
|
|||
void faceTrackerMuteToggled();
|
||||
|
||||
void activeChanged(Qt::ApplicationState state);
|
||||
void windowMinimizedChanged(bool minimized);
|
||||
|
||||
void notifyPacketVersionMismatch();
|
||||
|
||||
|
|
|
@ -109,8 +109,12 @@ void MainWindow::changeEvent(QEvent* event) {
|
|||
stateChangeEvent->oldState() == Qt::WindowMaximized) &&
|
||||
windowState() == Qt::WindowMinimized) {
|
||||
emit windowShown(false);
|
||||
emit windowMinimizedChanged(true);
|
||||
} else {
|
||||
emit windowShown(true);
|
||||
if (stateChangeEvent->oldState() == Qt::WindowMinimized) {
|
||||
emit windowMinimizedChanged(false);
|
||||
}
|
||||
}
|
||||
} else if (event->type() == QEvent::ActivationChange) {
|
||||
if (isActiveWindow()) {
|
||||
|
|
|
@ -29,6 +29,7 @@ public slots:
|
|||
signals:
|
||||
void windowGeometryChanged(QRect geometry);
|
||||
void windowShown(bool shown);
|
||||
void windowMinimizedChanged(bool minimized);
|
||||
|
||||
protected:
|
||||
virtual void closeEvent(QCloseEvent* event) override;
|
||||
|
|
Loading…
Reference in a new issue