YggdrasilWM  0.1.1
A tiny window manager coded in C++
X11Wrapper.hpp
Go to the documentation of this file.
1 
28 #ifndef X11_WRAPPER_HPP
29 #define X11_WRAPPER_HPP
31 extern "C" {
32 #include <X11/Xlib.h>
33 #include <X11/Xatom.h>
34 }
35 #include <memory>
36 #include <string>
37 
38 class X11Wrapper : public BaseX11Wrapper {
39 public:
40  X11Wrapper() = default;
41  ~X11Wrapper() = default;
42  Display * openDisplay() override;
43  Display * openDisplay(const char * displayName) override;
44  void closeDisplay(Display * display) override;
45  int defaultScreen(Display * display) override;
46  Window rootWindow(Display * display, int screen) override;
47  Atom internAtom(Display * display, const char * atomName, bool onlyIfExists) override;
48  int displayWidth(Display * display, int screen) override;
49  int displayHeight(Display * display, int screen) override;
50  int grabServer(Display * display) override;
51  int ungrabServer(Display * display) override;
52  int flush(Display * display) override;
53  XErrorHandler setErrorHandler(XErrorHandler handler) override;
54  int selectInput(Display * display, Window window, long eventMask) override;
55  int sync(Display * display, bool discard) override;
56  int queryTree(Display * display, Window window, Window * rootReturn, Window * parentReturn, Window ** childrenReturn, unsigned int * nChildrenReturn) override;
57  int freeX(void * data) override;
58  int nextEvent(Display * display, XEvent * eventReturn) override;
59  int sendEvent(Display * display, Window window, bool propagate, long eventMask, XEvent * event_send) override;
60  int changeProperty(Display * display, Window window, Atom property, Atom type, int format, int mode, const unsigned char * data, int nelements) override;
61  int getProperty(Display * display, Window window, Atom property, long longOffset, long longLength, bool delete_, Atom reqType, Atom * actualTypeReturn, int * actualFormatReturn, unsigned long * nitemsReturn, unsigned long * bytesAfterReturn, unsigned char ** propReturn) override;
62  int setInputFocus(Display * display, Window focus, int revertTo, Time time) override;
63  int getErrorText(Display * display, int code, char * buffer_return, int length) override;
64  int mapWindow(Display * display, Window window) override;
65  int unmapWindow(Display * display, Window window) override;
66  int configureWindow(Display * display, Window window, unsigned valueMask, XWindowChanges * changes) override;
67  int setInputFocus(Display * display, Window focus, int revertTo) override;
68  int raiseWindow(Display * display, Window window) override;
69  int lowerWindow(Display * display, Window window) override;
70  int setWindowBorder(Display * display, Window window, unsigned long border) override;
71  int getWindowProperty(Display * display, Window window, Atom property, long long_offset, long long_length, bool delete_, Atom req_type, Atom * actual_type_return, int * actual_format_return, unsigned long * nitems_return, unsigned long * bytes_after_return, unsigned char ** prop_return) override;
72  int destroyWindow(Display * display, Window window) override;
73  int getWindowAttributes(Display * display, Window window, XWindowAttributes * window_attributes_return) override;
74  int addToSaveSet(Display * display, Window window) override;
75  int removeFromSaveSet(Display * display, Window window) override;
76  int reparentWindow(Display * display, Window window, Window parent, int x, int y) override;
77  int grabButton(Display * display, unsigned int button, unsigned int modifiers, Window grabWindow, bool ownerEvents, unsigned int eventMask, int pointerMode, int keyboardMode, Window confineTo, Cursor cursor) override;
78  int ungrabButton(Display * display, unsigned int button, unsigned int modifiers, Window grab_window) override;
79  int grabKey(Display * display, int keycode, unsigned int modifiers, Window grabWindow, bool ownerEvents, int pointerMode, int keyboardMode) override;
80  int ungrabKey(Display * display, int keycode, unsigned int modifiers, Window grabWindow) override;
81  int moveWindow(Display * display, Window window, int x, int y) override;
82  int resizeWindow(Display * display, Window window, unsigned int width, unsigned int height) override;
83  int keysymToKeycode(Display * display, int keysym) override;
84  KeySym stringToKeysym(const char * string) override;
85  Window createWindow(Display * display, Window parent, int x, int y, unsigned int width, unsigned int height, unsigned int border_width, int depth, unsigned int _class, Visual * visual, unsigned long valuemask, XSetWindowAttributes * attributes) override;
86  int clearWindow(Display * display, Window window) override;
87  int drawString(Display * display, Window window, GC gc, int x, int y, const char * string, int length) override;
88  Window createSimpleWindow(Display * display, Window parent, int x, int y, unsigned int width, unsigned int height, unsigned int border_width, unsigned long border, unsigned long background) override;
89 };
90 
91 #endif //X11_WRAPPER_HPP
Definition: baseX11Wrapper.hpp:37
Definition: X11Wrapper.hpp:38
~X11Wrapper()=default
int queryTree(Display *display, Window window, Window *rootReturn, Window *parentReturn, Window **childrenReturn, unsigned int *nChildrenReturn) override
Definition: X11Wrapper.cpp:107
KeySym stringToKeysym(const char *string) override
Definition: X11Wrapper.cpp:390
X11Wrapper()=default
Window createSimpleWindow(Display *display, Window parent, int x, int y, unsigned int width, unsigned int height, unsigned int border_width, unsigned long border, unsigned long background) override
Definition: X11Wrapper.cpp:447
int getProperty(Display *display, Window window, Atom property, long longOffset, long longLength, bool delete_, Atom reqType, Atom *actualTypeReturn, int *actualFormatReturn, unsigned long *nitemsReturn, unsigned long *bytesAfterReturn, unsigned char **propReturn) override
Definition: X11Wrapper.cpp:168
Window createWindow(Display *display, Window parent, int x, int y, unsigned int width, unsigned int height, unsigned int border_width, int depth, unsigned int _class, Visual *visual, unsigned long valuemask, XSetWindowAttributes *attributes) override
Definition: X11Wrapper.cpp:398
void closeDisplay(Display *display) override
Definition: X11Wrapper.cpp:47
int defaultScreen(Display *display) override
Definition: X11Wrapper.cpp:54
int getWindowAttributes(Display *display, Window window, XWindowAttributes *window_attributes_return) override
Definition: X11Wrapper.cpp:281
int removeFromSaveSet(Display *display, Window window) override
Definition: X11Wrapper.cpp:295
int configureWindow(Display *display, Window window, unsigned valueMask, XWindowChanges *changes) override
Definition: X11Wrapper.cpp:216
int getWindowProperty(Display *display, Window window, Atom property, long long_offset, long long_length, bool delete_, Atom req_type, Atom *actual_type_return, int *actual_format_return, unsigned long *nitems_return, unsigned long *bytes_after_return, unsigned char **prop_return) override
Definition: X11Wrapper.cpp:251
int sync(Display *display, bool discard) override
Definition: X11Wrapper.cpp:102
int displayHeight(Display *display, int screen) override
Definition: X11Wrapper.cpp:74
int changeProperty(Display *display, Window window, Atom property, Atom type, int format, int mode, const unsigned char *data, int nelements) override
Definition: X11Wrapper.cpp:145
int mapWindow(Display *display, Window window) override
Definition: X11Wrapper.cpp:212
int clearWindow(Display *display, Window window) override
Definition: X11Wrapper.cpp:426
int grabButton(Display *display, unsigned int button, unsigned int modifiers, Window grabWindow, bool ownerEvents, unsigned int eventMask, int pointerMode, int keyboardMode, Window confineTo, Cursor cursor) override
Definition: X11Wrapper.cpp:307
int moveWindow(Display *display, Window window, int x, int y) override
Definition: X11Wrapper.cpp:371
int sendEvent(Display *display, Window window, bool propagate, long eventMask, XEvent *event_send) override
Definition: X11Wrapper.cpp:137
int flush(Display *display) override
Definition: X11Wrapper.cpp:86
int getErrorText(Display *display, int code, char *buffer_return, int length) override
Definition: X11Wrapper.cpp:205
int resizeWindow(Display *display, Window window, unsigned int width, unsigned int height) override
Definition: X11Wrapper.cpp:375
int ungrabKey(Display *display, int keycode, unsigned int modifiers, Window grabWindow) override
Definition: X11Wrapper.cpp:360
int displayWidth(Display *display, int screen) override
Definition: X11Wrapper.cpp:70
int setInputFocus(Display *display, Window focus, int revertTo, Time time) override
Definition: X11Wrapper.cpp:198
Window rootWindow(Display *display, int screen) override
Definition: X11Wrapper.cpp:58
int drawString(Display *display, Window window, GC gc, int x, int y, const char *string, int length) override
Definition: X11Wrapper.cpp:434
int freeX(void *data) override
Definition: X11Wrapper.cpp:125
int ungrabButton(Display *display, unsigned int button, unsigned int modifiers, Window grab_window) override
Definition: X11Wrapper.cpp:329
int selectInput(Display *display, Window window, long eventMask) override
Definition: X11Wrapper.cpp:94
int nextEvent(Display *display, XEvent *eventReturn) override
Definition: X11Wrapper.cpp:129
Atom internAtom(Display *display, const char *atomName, bool onlyIfExists) override
Definition: X11Wrapper.cpp:62
int ungrabServer(Display *display) override
Definition: X11Wrapper.cpp:82
int setWindowBorder(Display *display, Window window, unsigned long border) override
Definition: X11Wrapper.cpp:247
int grabKey(Display *display, int keycode, unsigned int modifiers, Window grabWindow, bool ownerEvents, int pointerMode, int keyboardMode) override
Definition: X11Wrapper.cpp:340
int keysymToKeycode(Display *display, int keysym) override
Definition: X11Wrapper.cpp:382
int grabServer(Display *display) override
Definition: X11Wrapper.cpp:78
Display * openDisplay() override
Definition: X11Wrapper.cpp:31
int raiseWindow(Display *display, Window window) override
Definition: X11Wrapper.cpp:235
XErrorHandler setErrorHandler(XErrorHandler handler) override
Definition: X11Wrapper.cpp:90
int addToSaveSet(Display *display, Window window) override
Definition: X11Wrapper.cpp:291
int lowerWindow(Display *display, Window window) override
Definition: X11Wrapper.cpp:239
int destroyWindow(Display *display, Window window) override
Definition: X11Wrapper.cpp:277
int reparentWindow(Display *display, Window window, Window parent, int x, int y) override
Definition: X11Wrapper.cpp:303
int unmapWindow(Display *display, Window window) override
Definition: X11Wrapper.cpp:223