Salome HOME
refs #1324: patch for activation/deactivation modes on modules switch
[modules/gui.git] / src / OCCViewer / OCCViewer_ViewPort.cxx
index 36fd5e7d173877653fe596bd5986c5f97f2ea186..d0d2ce19d94539ccd0747b8e3d6b41c027cf1920 100755 (executable)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -40,7 +40,7 @@
 
 #include <stdlib.h>
 
-#if !defined WIN32
+#if !defined WIN32 && !defined __APPLE__
 #include <QX11Info>
 #include <GL/glx.h>
 #include <X11/Xlib.h>
@@ -115,6 +115,7 @@ static Colormap choose_cmap( Display *dpy, XVisualInfo *vi )
   //cout << "Choosing cmap for vID = " << vi->visualid << endl;
   //#endif
 
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
   if ( vi->visualid == XVisualIDFromVisual( (Visual*)QX11Info::appVisual() ) )
   {
 #ifdef DEBUG
@@ -122,7 +123,15 @@ static Colormap choose_cmap( Display *dpy, XVisualInfo *vi )
 #endif
     return QX11Info::appColormap();
   }
-
+#else
+  if ( vi->visualid == XVisualIDFromVisual( XDefaultVisual( QX11Info::display(), -1 ) ) )
+  {
+#ifdef DEBUG
+//    cout << "Using XDefaultColormap" << endl;
+#endif
+    return XDefaultColormap( QX11Info::display(), -1 );
+  }
+#endif
   if ( mesa_gl )
   {
     Atom hp_cmaps = XInternAtom( dpy, "_HP_RGB_SMOOTH_MAP_LIST", true );
@@ -209,7 +218,9 @@ void OCCViewer_ViewPort::initialize()
   setBackgroundRole( QPalette::NoRole );//NoBackground );
   // set focus policy to threat QContextMenuEvent from keyboard  
   setFocusPolicy( Qt::StrongFocus );
+#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0) && OCC_VERSION_LARGE < 0x07000000) || QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
   setAttribute( Qt::WA_PaintOnScreen );
+#endif
   setAttribute( Qt::WA_NoSystemBackground );
 }
 
@@ -225,7 +236,7 @@ void OCCViewer_ViewPort::cleanup()
 */
 void OCCViewer_ViewPort::selectVisualId()
 {
-#if !defined WIN32
+#if !defined WIN32 && !defined __APPLE__
   XVisualInfo* pVisualInfo;
   if ( QX11Info::display() )
   {