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.
goldberg_emulator/overlay_experimental/linux/X11_Hook.h

64 lines
1.6 KiB
C

5 years ago
#ifndef __INCLUDED_X11_HOOK_H__
#define __INCLUDED_X11_HOOK_H__
#include "../Base_Hook.h"
#ifdef __LINUX__
#ifdef EMU_OVERLAY
5 years ago
#include <X11/X.h> // XEvent types
#include <X11/Xlib.h> // XEvent structure
extern "C" int XEventsQueued(Display *display, int mode);
extern "C" int XPending(Display *display);
5 years ago
class X11_Hook : public Base_Hook
{
public:
friend int XEventsQueued(Display *display, int mode);
friend int XPending(Display *display);
5 years ago
static constexpr const char* DLL_NAME = "libX11.so";
private:
static X11_Hook* _inst;
// Variables
bool hooked;
bool initialized;
Window game_wnd;
5 years ago
// Functions
X11_Hook();
int check_for_overlay(Display *d, int num_events);
5 years ago
// Hook to X11 window messages
decltype(XEventsQueued)* _XEventsQueued;
5 years ago
decltype(XPeekEvent)* _XPeekEvent;
decltype(XNextEvent)* _XNextEvent;
decltype(XPending)* _XPending;
//decltype(XKeysymToKeycode)* _XKeysymToKeycode;
//decltype(XLookupKeysym)* _XLookupKeysym;
//decltype(XGetGeometry)* _XGetGeometry;
5 years ago
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);
public:
5 years ago
virtual ~X11_Hook();
void resetRenderState();
void prepareForOverlay(Display *display, Window wnd);
Window get_game_wnd() const{ return game_wnd; }
5 years ago
bool start_hook();
static X11_Hook* Inst();
virtual const char* get_lib_name() const;
};
#endif//EMU_OVERLAY
5 years ago
#endif//__LINUX__
#endif//__INCLUDED_X11_HOOK_H__