X11Utils.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // Copyright 2010 Dolphin Emulator Project
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #pragma once
  4. #include <string>
  5. #include <vector>
  6. #ifdef HAVE_XRANDR
  7. #include <X11/extensions/Xrandr.h>
  8. #endif
  9. #include <X11/Xlib.h>
  10. // EWMH state actions, see
  11. // http://freedesktop.org/wiki/Specifications/wm-spec?action=show&redirect=Standards%2Fwm-spec
  12. #define _NET_WM_STATE_REMOVE 0 // remove/unset property
  13. #define _NET_WM_STATE_ADD 1 // add/set property
  14. #define _NET_WM_STATE_TOGGLE 2 // toggle property
  15. namespace X11Utils
  16. {
  17. bool ToggleFullscreen(Display* dpy, Window win);
  18. #ifdef HAVE_XRANDR
  19. class XRRConfiguration
  20. {
  21. public:
  22. XRRConfiguration(Display* _dpy, Window _win);
  23. ~XRRConfiguration();
  24. void Update();
  25. void ToggleDisplayMode(bool bFullscreen);
  26. void AddResolutions(std::vector<std::string>& resos);
  27. private:
  28. Display* dpy;
  29. Window win;
  30. int screen;
  31. XRRScreenResources* screenResources;
  32. XRROutputInfo* outputInfo;
  33. XRRCrtcInfo* crtcInfo;
  34. RRMode fullMode;
  35. int fb_width, fb_height, fb_width_mm, fb_height_mm;
  36. int fs_fb_width, fs_fb_height, fs_fb_width_mm, fs_fb_height_mm;
  37. bool bValid;
  38. bool bIsFullscreen;
  39. };
  40. #endif
  41. } // namespace X11Utils