2020-03-20 11:53:43 +00:00
|
|
|
#ifndef LIBRARY_LOADER_NVCTRL_H
|
|
|
|
#define LIBRARY_LOADER_NVCTRL_H
|
|
|
|
#define Bool bool
|
|
|
|
#include <X11/Xlib.h>
|
|
|
|
#include "NVCtrl/NVCtrlLib.h"
|
|
|
|
#define LIBRARY_LOADER_NVCTRL_H_DLOPEN
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <dlfcn.h>
|
|
|
|
|
|
|
|
class libnvctrl_loader {
|
|
|
|
public:
|
|
|
|
libnvctrl_loader();
|
2020-04-04 17:46:54 +00:00
|
|
|
libnvctrl_loader(const std::string& library_name) : libnvctrl_loader() {
|
|
|
|
Load(library_name);
|
|
|
|
}
|
2020-03-20 11:53:43 +00:00
|
|
|
~libnvctrl_loader();
|
|
|
|
|
|
|
|
bool Load(const std::string& library_name);
|
|
|
|
bool IsLoaded() { return loaded_; }
|
|
|
|
|
2020-03-20 14:33:43 +00:00
|
|
|
decltype(&::XNVCTRLIsNvScreen) XNVCTRLIsNvScreen;
|
2020-03-20 11:53:43 +00:00
|
|
|
decltype(&::XNVCTRLQueryVersion) XNVCTRLQueryVersion;
|
|
|
|
decltype(&::XNVCTRLQueryAttribute) XNVCTRLQueryAttribute;
|
|
|
|
decltype(&::XNVCTRLQueryTargetStringAttribute) XNVCTRLQueryTargetStringAttribute;
|
2020-03-20 12:23:24 +00:00
|
|
|
decltype(&::XNVCTRLQueryTargetAttribute64) XNVCTRLQueryTargetAttribute64;
|
2020-03-20 11:53:43 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
void CleanUp(bool unload);
|
|
|
|
|
|
|
|
#if defined(LIBRARY_LOADER_NVCTRL_H_DLOPEN)
|
|
|
|
void* library_;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
bool loaded_;
|
|
|
|
|
|
|
|
// Disallow copy constructor and assignment operator.
|
|
|
|
libnvctrl_loader(const libnvctrl_loader&);
|
|
|
|
void operator=(const libnvctrl_loader&);
|
|
|
|
};
|
|
|
|
|
2020-08-04 18:27:12 +00:00
|
|
|
libnvctrl_loader& get_libnvctrl_loader();
|
2020-03-20 11:53:43 +00:00
|
|
|
#endif // LIBRARY_LOADER_NVCTRL_H
|