mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-08 14:17:06 +03:00
0032219: Visualization, TKService - drop dependency from OpenGL
Visual selection has been moved out from Xw_Window constructor to OpenGl_GraphicDriver::InitContext(). Default Visual is now stored within Aspect_DisplayConnection.
This commit is contained in:
@@ -16,7 +16,6 @@
|
||||
#include <Aspect_DisplayConnectionDefinitionError.hxx>
|
||||
#include <OSD_Environment.hxx>
|
||||
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Aspect_DisplayConnection,Standard_Transient)
|
||||
|
||||
// =======================================================================
|
||||
@@ -27,6 +26,8 @@ Aspect_DisplayConnection::Aspect_DisplayConnection()
|
||||
{
|
||||
#if !defined(_WIN32) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX)) && !defined(__ANDROID__) && !defined(__QNX__) && !defined(__EMSCRIPTEN__)
|
||||
myDisplay = NULL;
|
||||
myDefVisualInfo = NULL;
|
||||
myDefFBConfig = NULL;
|
||||
myIsOwnDisplay = false;
|
||||
OSD_Environment anEnv ("DISPLAY");
|
||||
myDisplayName = anEnv.Value();
|
||||
@@ -41,6 +42,10 @@ Aspect_DisplayConnection::Aspect_DisplayConnection()
|
||||
Aspect_DisplayConnection::~Aspect_DisplayConnection()
|
||||
{
|
||||
#if !defined(_WIN32) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX)) && !defined(__ANDROID__) && !defined(__QNX__) && !defined(__EMSCRIPTEN__)
|
||||
if (myDefVisualInfo != NULL)
|
||||
{
|
||||
XFree (myDefVisualInfo);
|
||||
}
|
||||
if (myDisplay != NULL
|
||||
&& myIsOwnDisplay)
|
||||
{
|
||||
@@ -56,6 +61,8 @@ Aspect_DisplayConnection::~Aspect_DisplayConnection()
|
||||
// =======================================================================
|
||||
Aspect_DisplayConnection::Aspect_DisplayConnection (const TCollection_AsciiString& theDisplayName)
|
||||
: myDisplay (NULL),
|
||||
myDefVisualInfo (NULL),
|
||||
myDefFBConfig (NULL),
|
||||
myIsOwnDisplay (false)
|
||||
{
|
||||
myDisplayName = theDisplayName;
|
||||
@@ -68,11 +75,28 @@ Aspect_DisplayConnection::Aspect_DisplayConnection (const TCollection_AsciiStrin
|
||||
// =======================================================================
|
||||
Aspect_DisplayConnection::Aspect_DisplayConnection (Display* theDisplay)
|
||||
: myDisplay (NULL),
|
||||
myDefVisualInfo (NULL),
|
||||
myDefFBConfig (NULL),
|
||||
myIsOwnDisplay (false)
|
||||
{
|
||||
Init (theDisplay);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetDefaultVisualInfo
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Aspect_DisplayConnection::SetDefaultVisualInfo (XVisualInfo* theVisual,
|
||||
Aspect_FBConfig theFBConfig)
|
||||
{
|
||||
if (myDefVisualInfo != NULL)
|
||||
{
|
||||
XFree (myDefVisualInfo);
|
||||
}
|
||||
myDefVisualInfo = theVisual;
|
||||
myDefFBConfig = theFBConfig;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Init
|
||||
// purpose :
|
||||
|
@@ -22,6 +22,7 @@
|
||||
|
||||
#if !defined(_WIN32) && (!defined(__APPLE__) || defined(MACOSX_USE_GLX)) && !defined(__ANDROID__) && !defined(__QNX__) && !defined(__EMSCRIPTEN__)
|
||||
#include <InterfaceGraphic.hxx>
|
||||
#include <Aspect_FBConfig.hxx>
|
||||
#endif
|
||||
|
||||
//! This class creates and provides connection with X server.
|
||||
@@ -72,9 +73,21 @@ public:
|
||||
//! @param theDisplay external pointer to allocated Display, or NULL if new connection should be created
|
||||
void Init (Display* theDisplay);
|
||||
|
||||
//! Return default window visual or NULL when undefined.
|
||||
XVisualInfo* GetDefaultVisualInfo() const { return myDefVisualInfo; }
|
||||
|
||||
//! @return native Window FB config (GLXFBConfig on Xlib)
|
||||
Aspect_FBConfig GetDefaultFBConfig() const { return myDefFBConfig; }
|
||||
|
||||
//! Set default window visual; the visual will be deallocated using XFree().
|
||||
Standard_EXPORT void SetDefaultVisualInfo (XVisualInfo* theVisual,
|
||||
Aspect_FBConfig theFBConfig);
|
||||
|
||||
private:
|
||||
|
||||
Display* myDisplay;
|
||||
XVisualInfo* myDefVisualInfo;
|
||||
Aspect_FBConfig myDefFBConfig;
|
||||
NCollection_DataMap<Aspect_XAtom, Atom> myAtoms;
|
||||
TCollection_AsciiString myDisplayName;
|
||||
Standard_Boolean myIsOwnDisplay;
|
||||
|
Reference in New Issue
Block a user