Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/graphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ int CGraphics::loadTextureSkyBox(QImage* img)

void CGraphics::getViewpoint (dReal* xyz, dReal* hpr)
{
if (graphicDisabled) return;
xyz[0] = view_xyz[0];
xyz[1] = view_xyz[1];
xyz[2] = view_xyz[2];
Expand Down Expand Up @@ -1223,4 +1222,3 @@ void CGraphics::drawLine (const dReal pos1[3], const dReal pos2[3])
glVertex3f (pos2[0],pos2[1],pos2[2]);
glEnd();
}

17 changes: 11 additions & 6 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ MainWindow::MainWindow(QWidget *parent)
setCentralWidget(glwidget);

timer = new QTimer(this);
timer->setTimerType(Qt::PreciseTimer);
timer->setInterval(getInterval());
restartDebounceTimer = new QTimer(this);
restartDebounceTimer->setSingleShot(true);
Expand Down Expand Up @@ -391,13 +392,17 @@ void MainWindow::update()
&& (focusWidget == configwidget || configwidget->isAncestorOf(focusWidget));
}

if (glwidget->ssl->isGLEnabled) {
const bool appIsActive = QApplication::applicationState() == Qt::ApplicationActive;
const bool shouldPauseForConfigEdit = isEditingConfig && appIsActive;

if (!glwidget->ssl->isGLEnabled) {
glwidget->ssl->g->disableGraphics();
glwidget->step();
} else if (!shouldPauseForConfigEdit && appIsActive && glwidget->isVisible()) {
glwidget->ssl->g->enableGraphics();
if (!isEditingConfig)
{
glwidget->updateGL();
}
} else {
glwidget->updateGL();
} else if (!shouldPauseForConfigEdit) {
// Keep the simulation running while the app is in background/minimized.
glwidget->ssl->g->disableGraphics();
glwidget->step();
}
Expand Down
Loading