UI: Don't use SetThreadExecutionState()

.. because it works correctly only on Windows 11+.
Otherwise it prevents the OS from sleeping.
This commit is contained in:
Nodir Temirkhodjaev 2023-11-28 19:35:37 +03:00
parent ea24637337
commit e5a52a3691
4 changed files with 7 additions and 6 deletions

View File

@ -174,7 +174,7 @@ bool ControlManager::processRequest(Control::Command command, const QVariantList
// DBG: qCDebug(LC) << "Client requested: id:" << w->id() << command << args.size();
OsUtil::setThreadIsBusy(true);
// XXX: OsUtil::setThreadIsBusy(true);
QString errorMessage;
const bool success = processCommand({
@ -188,7 +188,7 @@ bool ControlManager::processRequest(Control::Command command, const QVariantList
qCWarning(LC) << "Bad command" << errorMessage << ':' << command << args;
}
OsUtil::setThreadIsBusy(false);
// XXX: OsUtil::setThreadIsBusy(false);
return success;
}

View File

@ -124,7 +124,7 @@ void LogManager::processLogBuffer(LogBuffer *logBuffer, bool success, quint32 er
void LogManager::processLogEntries(LogBuffer *logBuffer)
{
OsUtil::setThreadIsBusy(true);
// XXX: OsUtil::setThreadIsBusy(true);
for (;;) {
const FortLogType logType = logBuffer->peekEntryType();
@ -133,7 +133,7 @@ void LogManager::processLogEntries(LogBuffer *logBuffer)
break;
}
OsUtil::setThreadIsBusy(false);
// XXX: OsUtil::setThreadIsBusy(false);
}
bool LogManager::processLogEntry(LogBuffer *logBuffer, FortLogType logType)

View File

@ -36,7 +36,7 @@ inline bool sendCommandDataToClients(
{
bool ok = true;
OsUtil::setThreadIsBusy(true);
// XXX: OsUtil::setThreadIsBusy(true);
for (ControlWorker *w : clients) {
if (!w->isServiceClient())
@ -48,7 +48,7 @@ inline bool sendCommandDataToClients(
}
}
OsUtil::setThreadIsBusy(false);
// XXX: OsUtil::setThreadIsBusy(false);
return ok;
}

View File

@ -158,5 +158,6 @@ void OsUtil::writeToConsole(const QString &line)
void OsUtil::setThreadIsBusy(bool on)
{
// Works correct only on Windows 11+
SetThreadExecutionState(ES_CONTINUOUS | (on ? ES_SYSTEM_REQUIRED : 0));
}