History

fix throttled rendering for the 2D display plugin

ZappoMan committed 11 years ago

Commit 6a7f3671 parent 5a442bd9 files · +64 −69Browse files

Showing the changes to interface/src/Application.cpp (1 of 9 files). Show all

Unified · Split

interface/src/Application.cpp+24−3
@@ -175,8 +175,6 @@ public: · 174 unmodified lines
175175 using namespace std;
176176
177177 // Starfield information
178−static uint8_t THROTTLED_IDLE_TIMER_DELAY = 10;
179−
180178 const qint64 MAXIMUM_CACHE_SIZE = 10 * BYTES_PER_GIGABYTES; // 10GB
181179
182180 static QTimer* locationUpdateTimer = NULL;
@@ -737,6 +735,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 554 unmodified lines
737735 _keyboardFocusHighlight->setVisible(false);
738736 }
739737 });
738+
739+ connect(this, &Application::applicationStateChanged, this, &Application::activeChanged);
740740 }
741741
742742 void Application::aboutToQuit() {
@@ -2108,8 +2108,11 @@ void Application::idle() { · 1365 unmodified lines
21082108 // Once rendering is off on another thread we should be able to have Application::idle run at start(0) in
21092109 // perpetuity and not expect events to get backed up.
21102110
2111+ bool isThrottled = getActiveDisplayPlugin()->isThrottled();
2112+ static const int THROTTLED_IDLE_TIMER_DELAY = MSECS_PER_SECOND / 15;
21112113 static const int IDLE_TIMER_DELAY_MS = 2;
2112− int desiredInterval = getActiveDisplayPlugin()->isThrottled() ? THROTTLED_IDLE_TIMER_DELAY : IDLE_TIMER_DELAY_MS;
2114+ int desiredInterval = isThrottled ? THROTTLED_IDLE_TIMER_DELAY : IDLE_TIMER_DELAY_MS;
2115+ //qDebug() << "isThrottled:" << isThrottled << "desiredInterval:" << desiredInterval;
21132116
21142117 if (idleTimer->interval() != desiredInterval) {
21152118 idleTimer->start(desiredInterval);
@@ -4612,6 +4615,24 @@ void Application::checkSkeleton() { · 2496 unmodified lines
46124615 }
46134616 }
46144617
4618+bool Application::isForeground() {
4619+ return _isForeground && !getWindow()->isMinimized();
4620+}
4621+
4622+void Application::activeChanged(Qt::ApplicationState state) {
4623+ switch (state) {
4624+ case Qt::ApplicationActive:
4625+ _isForeground = true;
4626+ break;
4627+
4628+ case Qt::ApplicationSuspended:
4629+ case Qt::ApplicationHidden:
4630+ case Qt::ApplicationInactive:
4631+ default:
4632+ _isForeground = false;
4633+ break;
4634+ }
4635+}
46154636 void Application::showFriendsWindow() {
46164637 const QString FRIENDS_WINDOW_TITLE = "Add/Remove Friends";
46174638 const QString FRIENDS_WINDOW_URL = "https://metaverse.highfidelity.com/user/friends";

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t