You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
MangoHud/src/loaders/loader_x11.h

38 lines
914 B
C++

#pragma once
#include <X11/Xlib.h>
#include <memory>
#include <string>
#include <dlfcn.h>
class libx11_loader {
public:
libx11_loader();
libx11_loader(const std::string& library_name) { Load(library_name); }
~libx11_loader();
bool Load(const std::string& library_name);
bool IsLoaded() { return loaded_; }
decltype(&::XOpenDisplay) XOpenDisplay;
decltype(&::XCloseDisplay) XCloseDisplay;
decltype(&::XDefaultScreen) XDefaultScreen;
decltype(&::XQueryKeymap) XQueryKeymap;
decltype(&::XKeysymToKeycode) XKeysymToKeycode;
decltype(&::XStringToKeysym) XStringToKeysym;
decltype(&::XGetGeometry) XGetGeometry;
private:
void CleanUp(bool unload);
void* library_ = nullptr;
bool loaded_ = false;
// Disallow copy constructor and assignment operator.
libx11_loader(const libx11_loader&);
void operator=(const libx11_loader&);
};
std::shared_ptr<libx11_loader> get_libx11();