2019-09-01 20:53:16 +02:00
|
|
|
#ifndef __INCLUDED_X11_HOOK_H__
|
|
|
|
#define __INCLUDED_X11_HOOK_H__
|
|
|
|
|
|
|
|
#include "../Base_Hook.h"
|
|
|
|
|
|
|
|
#ifdef __LINUX__
|
|
|
|
#ifndef NO_OVERLAY
|
|
|
|
|
|
|
|
#include <X11/X.h> // XEvent types
|
|
|
|
#include <X11/Xlib.h> // XEvent structure
|
|
|
|
|
|
|
|
class X11_Hook : public Base_Hook
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static constexpr const char* DLL_NAME = "libX11.so";
|
|
|
|
|
|
|
|
private:
|
|
|
|
static X11_Hook* _inst;
|
|
|
|
|
|
|
|
// Variables
|
|
|
|
bool hooked;
|
|
|
|
bool initialized;
|
2019-09-03 10:32:32 +02:00
|
|
|
Window game_wnd;
|
2019-09-01 20:53:16 +02:00
|
|
|
|
|
|
|
// Functions
|
|
|
|
X11_Hook();
|
|
|
|
|
|
|
|
// Hook to X11 window messages
|
|
|
|
|
|
|
|
|
2019-09-03 10:32:32 +02:00
|
|
|
decltype(XEventsQueued)* _XEventsQueued;
|
2019-09-01 20:53:16 +02:00
|
|
|
decltype(XPeekEvent)* _XPeekEvent;
|
|
|
|
decltype(XNextEvent)* _XNextEvent;
|
2019-09-03 10:32:32 +02:00
|
|
|
decltype(XPending)* _XPending;
|
|
|
|
//decltype(XKeysymToKeycode)* _XKeysymToKeycode;
|
|
|
|
//decltype(XLookupKeysym)* _XLookupKeysym;
|
|
|
|
//decltype(XGetGeometry)* _XGetGeometry;
|
2019-09-01 20:53:16 +02:00
|
|
|
|
|
|
|
public:
|
2019-09-03 10:32:32 +02:00
|
|
|
static int MyXEventsQueued(Display * display, int mode);
|
|
|
|
static int MyXNextEvent(Display* display, XEvent *event);
|
|
|
|
static int MyXPeekEvent(Display* display, XEvent *event);
|
|
|
|
static int MyXPending(Display* display);
|
|
|
|
|
2019-09-01 20:53:16 +02:00
|
|
|
virtual ~X11_Hook();
|
|
|
|
|
|
|
|
void resetRenderState();
|
2019-09-03 10:32:32 +02:00
|
|
|
void prepareForOverlay(Display *display, Window wnd);
|
|
|
|
|
|
|
|
Window get_game_wnd() const{ return game_wnd; }
|
2019-09-01 20:53:16 +02:00
|
|
|
|
|
|
|
bool start_hook();
|
|
|
|
static X11_Hook* Inst();
|
|
|
|
virtual const char* get_lib_name() const;
|
2019-09-03 10:32:32 +02:00
|
|
|
|
|
|
|
inline decltype(XEventsQueued)* get_XEventsQueued() const { return _XEventsQueued; }
|
|
|
|
inline decltype(XPeekEvent)* get_XPeekEvent() const { return _XPeekEvent; }
|
|
|
|
inline decltype(XNextEvent)* get_XNextEvent() const { return _XNextEvent; }
|
|
|
|
inline decltype(XPending)* get_XPending() const { return _XPending; }
|
|
|
|
|
|
|
|
inline void loadXEventsQueued(decltype(XEventsQueued)* pfnXEventsQueued) { _XEventsQueued = pfnXEventsQueued; }
|
|
|
|
inline void loadXPeekEvent(decltype(XPeekEvent)* pfnXPeekEvent) { _XPeekEvent = pfnXPeekEvent; }
|
|
|
|
inline void loadXNextEvent(decltype(XNextEvent)* pfnXNextEvent) { _XNextEvent = pfnXNextEvent; }
|
|
|
|
inline void loadXPending(decltype(XPending)* pfnXPending) { _XPending = pfnXPending; }
|
2019-09-01 20:53:16 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif//NO_OVERLAY
|
|
|
|
#endif//__LINUX__
|
|
|
|
#endif//__INCLUDED_X11_HOOK_H__
|