mirror of
https://github.com/xmrig/xmrig.git
synced 2025-12-08 08:23:34 -05:00
Merge a7d57daad3 into f9e990d0f0
This commit is contained in:
@@ -180,15 +180,21 @@ else()
|
|||||||
|
|
||||||
if (XMRIG_OS_ANDROID)
|
if (XMRIG_OS_ANDROID)
|
||||||
set(EXTRA_LIBS pthread rt dl log)
|
set(EXTRA_LIBS pthread rt dl log)
|
||||||
elseif (XMRIG_OS_LINUX)
|
else()
|
||||||
list(APPEND SOURCES_OS
|
if (XMRIG_OS_LINUX)
|
||||||
src/crypto/common/LinuxMemory.h
|
list(APPEND SOURCES_OS
|
||||||
src/crypto/common/LinuxMemory.cpp
|
src/crypto/common/LinuxMemory.h
|
||||||
)
|
src/crypto/common/LinuxMemory.cpp
|
||||||
|
)
|
||||||
|
|
||||||
set(EXTRA_LIBS pthread rt dl)
|
set(EXTRA_LIBS pthread rt dl)
|
||||||
elseif (XMRIG_OS_FREEBSD)
|
elseif (XMRIG_OS_FREEBSD)
|
||||||
set(EXTRA_LIBS kvm pthread)
|
set(EXTRA_LIBS kvm pthread)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_package(X11 REQUIRED)
|
||||||
|
set(EXTRA_LIBS ${EXTRA_LIBS} Xss ${X11_LIBRARIES})
|
||||||
|
include_directories(${X11_INCLUDE_DIR})
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,8 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
|
#include <X11/extensions/scrnsaver.h>
|
||||||
|
|
||||||
|
|
||||||
#include "base/kernel/Platform.h"
|
#include "base/kernel/Platform.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
@@ -175,5 +177,19 @@ bool xmrig::Platform::isOnBatteryPower()
|
|||||||
|
|
||||||
uint64_t xmrig::Platform::idleTime()
|
uint64_t xmrig::Platform::idleTime()
|
||||||
{
|
{
|
||||||
return std::numeric_limits<uint64_t>::max();
|
Display *dpy = XOpenDisplay(nullptr);
|
||||||
|
|
||||||
|
if (!dpy) {
|
||||||
|
return std::numeric_limits<uint64_t>::max();
|
||||||
|
}
|
||||||
|
|
||||||
|
XScreenSaverInfo *info = XScreenSaverAllocInfo();
|
||||||
|
XScreenSaverQueryInfo(dpy, DefaultRootWindow(dpy), info);
|
||||||
|
|
||||||
|
uint64_t idle = info->idle;
|
||||||
|
|
||||||
|
XFree(info);
|
||||||
|
XCloseDisplay(dpy);
|
||||||
|
|
||||||
|
return idle;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user