OGLplus  (0.59.0) a C++ wrapper for rendering APIs

visual_info.hpp
Go to the documentation of this file.
1 
9 #ifndef EAGINE_INTEROP_X11_VISUAL_INFO_HPP
10 #define EAGINE_INTEROP_X11_VISUAL_INFO_HPP
11 
12 #include "../glx/fb_config.hpp"
13 #include "display.hpp"
14 
15 #include <X11/Xlib.h>
16 #include <stdexcept>
17 
18 namespace eagine::x11 {
19 
20 class visual_info : public object<::XVisualInfo, int(void*)> {
21 private:
22  static auto _from_id(const display& dpy, int id) -> ::XVisualInfo* {
23  ::XVisualInfo tpl;
24  tpl.visualid = VisualID(id);
25  int num_vis = 0;
26 
27  return ::XGetVisualInfo(dpy, VisualIDMask, &tpl, &num_vis);
28  }
29 
30 public:
31  visual_info(const display& dpy, const glx::fb_config& fbc)
32  : object<::XVisualInfo, int(void*)>(
33  ::glXGetVisualFromFBConfig(dpy, fbc),
34  ::XFree,
35  "Error Getting X VisualInfo from GLX FB config") {}
36 
37  visual_info(const display& dpy, int visual_id)
38  : object<::XVisualInfo, int(void*)>(
39  _from_id(dpy, visual_id),
40  ::XFree,
41  "Error Getting X VisualInfo from visual ID") {}
42 };
43 
44 } // namespace eagine::x11
45 
46 #endif
X11 wrapper code is placed in this namespace.
Definition: x11.hpp:11

Copyright © 2015-2021 Matúš Chochlík.
<chochlik -at -gmail.com>
Documentation generated on Tue Apr 13 2021 by Doxygen (version 1.8.17).