Prevent Windows From Going to Sleep While In Train Mode

Fixes #2324
[skip travis]
This commit is contained in:
Alejandro Martinez
2020-10-02 17:36:09 -03:00
committed by Ale Martinez
parent 4c62c52fc3
commit d2a530e19e

View File

@@ -1578,6 +1578,11 @@ void TrainSidebar::guiUpdate() // refreshes the telemetry
CFStringRef reasonForActivity = CFSTR("TrainSidebar::guiUpdate");
IOPMAssertionID assertionID;
IOReturn suspendSreensaverSuccess = IOPMAssertionCreateWithName(kIOPMAssertionTypeNoDisplaySleep, kIOPMAssertionLevelOn, reasonForActivity, &assertionID);
#elif defined(WIN32)
// Multimedia applications, such as video players and presentation applications, must use ES_DISPLAY_REQUIRED
// when they display video for long periods of time without user input.
SetThreadExecutionState(ES_DISPLAY_REQUIRED);
#endif
if(calibrating) {