mirror of
https://github.com/xmrig/xmrig.git
synced 2025-12-07 16:05:05 -05:00
Added pause-on-active option
Windows only for now. When set to true, pauses mining when user touches mouse or keyboard.
This commit is contained in:
@@ -161,3 +161,16 @@ bool xmrig::Platform::isOnBatteryPower()
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool xmrig::Platform::isUserActive()
|
||||
{
|
||||
LASTINPUTINFO info;
|
||||
info.cbSize = sizeof(LASTINPUTINFO);
|
||||
|
||||
if (!GetLastInputInfo(&info)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return static_cast<int>(GetTickCount() - info.dwTime) < 60 * 1000;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user