From 881b4162161fad59c758d4b0393f963ac051f53c Mon Sep 17 00:00:00 2001 From: ann0see <20726856+ann0see@users.noreply.github.com> Date: Mon, 5 May 2025 20:40:45 +0200 Subject: [PATCH] Avoid sleeping on windows --- src/client.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/client.cpp b/src/client.cpp index 60be5c3b26..0aee733ca4 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -979,6 +979,11 @@ void CClient::Start() // start audio interface Sound.Start(); + +#if defined( Q_OS_WINDOWS ) + // Disable hibernation or display dimming if the app is running on Windows + SetThreadExecutionState ( ES_CONTINUOUS | ES_SYSTEM_REQUIRED | ES_DISPLAY_REQUIRED ); +#endif } void CClient::Stop() @@ -1013,6 +1018,11 @@ void CClient::Stop() // reset current signal level and LEDs bJitterBufferOK = true; SignalLevelMeter.Reset(); + +#if defined( Q_OS_WINDOWS ) + // Allow hibernation or display dimming if the app is running again (Windows) + SetThreadExecutionState ( ES_CONTINUOUS ); +#endif } void CClient::Init()