From cd8d7de27f49aa2fbf1c3b5aab3461d4b226379e Mon Sep 17 00:00:00 2001 From: imn Date: Thu, 10 Dec 2015 12:01:56 +0300 Subject: [PATCH] Replased methods QX11Info::appVisual() and QX11Info::appColormap on XDefaultVisual and XDefaultColorMap --- src/GLViewer/GLViewer_ViewPort.cxx | 9 ++++++++- src/OCCViewer/OCCViewer_ViewPort.cxx | 10 +++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/GLViewer/GLViewer_ViewPort.cxx b/src/GLViewer/GLViewer_ViewPort.cxx index cf55d26cd..7a528a576 100644 --- a/src/GLViewer/GLViewer_ViewPort.cxx +++ b/src/GLViewer/GLViewer_ViewPort.cxx @@ -122,7 +122,6 @@ static Colormap choose_cmap( Display *dpy, XVisualInfo *vi ) cout << "Choosing cmap for vID = " << vi->visualid << endl; #endif -// TODO (QT5 PORTING) Below is a temporary solution, to allow compiling with Qt 5 #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) if ( vi->visualid == XVisualIDFromVisual( (Visual*)QX11Info::appVisual() ) ) { @@ -131,6 +130,14 @@ 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 ) { diff --git a/src/OCCViewer/OCCViewer_ViewPort.cxx b/src/OCCViewer/OCCViewer_ViewPort.cxx index f14c8265a..7575a6a66 100755 --- a/src/OCCViewer/OCCViewer_ViewPort.cxx +++ b/src/OCCViewer/OCCViewer_ViewPort.cxx @@ -114,7 +114,7 @@ static Colormap choose_cmap( Display *dpy, XVisualInfo *vi ) //#ifdef DEBUG //cout << "Choosing cmap for vID = " << vi->visualid << endl; //#endif -// TODO (QT5 PORTING) Below is a temporary solution, to allow compiling with Qt 5 + #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) if ( vi->visualid == XVisualIDFromVisual( (Visual*)QX11Info::appVisual() ) ) { @@ -123,6 +123,14 @@ 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 ) { -- 2.39.2