Debian Codegraph @

3rdparty/osgXR/src/OpenXR/GraphicsBindingX11.cpp

raw symbols SCIP
1 // SPDX-License-Identifier: LGPL-2.1-only
2 // Copyright (C) 2021 James Hogan <[email protected]>
3
4 #include "GraphicsBindingX11.h"
5
6 using namespace osgXR::OpenXR;
7
8 namespace {
9
10 /// Class to spy on protected members of GraphicsWindowX11.
11 class GraphicsWindowX11Spy : public osgViewer::GraphicsWindowX11
12 {
13 public:
14 const XVisualInfo *getVisualInfo() const
15 {
16 return _visualInfo;
17 }
18
19 const GLXFBConfig &getFBConfig() const
20 {
21 return _fbConfig;
22 }
23 };
24
25 }
26
27 template <>
28 GraphicsBindingX11::GraphicsBindingImpl(osgViewer::GraphicsWindowX11 *window) :
29 _binding{ XR_TYPE_GRAPHICS_BINDING_OPENGL_XLIB_KHR }
30 {
31 // window isn't actually of type GraphicsWindowX11Spy, but this allows us to
32 // spy on protected members that don't have public accessors.
33 auto spyWindow = static_cast<GraphicsWindowX11Spy *>(window);
34
35 _binding.xDisplay = window->getDisplay();
36 _binding.visualid = spyWindow->getVisualInfo()->visualid;
37 _binding.glxFBConfig = spyWindow->getFBConfig();
38 _binding.glxDrawable = window->getWindow();
39 _binding.glxContext = window->getContext();
40 }