| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
#pragma once |
| 5 |
|
| 6 |
#include <string> |
| 7 |
#include <vector> |
| 8 |
|
| 9 |
#ifdef HAVE_XRANDR |
| 10 |
#include <X11/extensions/Xrandr.h> |
| 11 |
#endif |
| 12 |
#include <X11/Xlib.h> |
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
#define _NET_WM_STATE_REMOVE 0 // remove/unset property |
| 17 |
#define _NET_WM_STATE_ADD 1 // add/set property |
| 18 |
#define _NET_WM_STATE_TOGGLE 2 // toggle property |
| 19 |
|
| 20 |
namespace X11Utils |
| 21 |
{ |
| 22 |
bool ToggleFullscreen(Display* dpy, Window win); |
| 23 |
|
| 24 |
#ifdef HAVE_XRANDR |
| 25 |
class XRRConfiguration |
| 26 |
{ |
| 27 |
public: |
| 28 |
XRRConfiguration(Display* _dpy, Window _win); |
| 29 |
~XRRConfiguration(); |
| 30 |
|
| 31 |
void Update(); |
| 32 |
void ToggleDisplayMode(bool bFullscreen); |
| 33 |
void AddResolutions(std::vector<std::string>& resos); |
| 34 |
|
| 35 |
private: |
| 36 |
Display* dpy; |
| 37 |
Window win; |
| 38 |
int screen; |
| 39 |
XRRScreenResources* screenResources; |
| 40 |
XRROutputInfo* outputInfo; |
| 41 |
XRRCrtcInfo* crtcInfo; |
| 42 |
RRMode fullMode; |
| 43 |
int fb_width, fb_height, fb_width_mm, fb_height_mm; |
| 44 |
int fs_fb_width, fs_fb_height, fs_fb_width_mm, fs_fb_height_mm; |
| 45 |
bool bValid; |
| 46 |
bool bIsFullscreen; |
| 47 |
}; |
| 48 |
#endif |
| 49 |
} |