math/vtk9: do not pollute namespace with Xutil.h

Add the patch b3b088e8 from upstream, in order to permit cad/opencascade
to switch to VTK-9.

PR:		256876
Approved by:	yuri (maintainer)
This commit is contained in:
Thierry Thomas 2021-06-20 22:06:41 +02:00
parent cefed488ce
commit e67606b6b1
3 changed files with 69 additions and 1 deletions

View File

@ -1,6 +1,6 @@
PORTNAME= vtk
DISTVERSION= 9.0.1
PORTREVISION= 3
PORTREVISION= 4
CATEGORIES= math graphics
MASTER_SITES= https://vtk.org/files/release/${VTK_SHORT_VER}/
PKGNAMESUFFIX= 9

View File

@ -0,0 +1,44 @@
--- Rendering/OpenGL2/vtkXOpenGLRenderWindow.cxx.orig 2020-06-26 13:24:40 UTC
+++ Rendering/OpenGL2/vtkXOpenGLRenderWindow.cxx
@@ -61,10 +61,22 @@ typedef ptrdiff_t GLsizeiptr;
#include <sstream>
+// Patch from upstream b3b088e8
+#include <X11/Xatom.h>
+#include <X11/cursorfont.h>
+
#include <X11/Xlib.h>
#include <X11/Xutil.h>
-#include <X11/cursorfont.h>
+/*
+ * Work-around to get forward declarations of C typedef of anonymous
+ * structs working. We do not want to include XUtil.h in the header as
+ * it populates the global namespace.
+ */
+struct vtkXVisualInfo : public XVisualInfo
+{
+};
+
#define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091
#define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092
typedef GLXContext (*glXCreateContextAttribsARBProc)(
@@ -224,7 +236,7 @@ int XEventTypeEquals(Display*, XEvent* event, XPointer
return event->type == EventType;
}
-XVisualInfo* vtkXOpenGLRenderWindow::GetDesiredVisualInfo()
+vtkXVisualInfo* vtkXOpenGLRenderWindow::GetDesiredVisualInfo()
{
XVisualInfo* v = nullptr;
@@ -258,7 +270,7 @@ XVisualInfo* vtkXOpenGLRenderWindow::GetDesiredVisualI
vtkErrorMacro(<< "Could not find a decent visual\n");
}
}
- return (v);
+ return reinterpret_cast<vtkXVisualInfo*>(v);
}
vtkXOpenGLRenderWindow::vtkXOpenGLRenderWindow()

View File

@ -0,0 +1,24 @@
--- Rendering/OpenGL2/vtkXOpenGLRenderWindow.h.orig 2020-06-26 13:24:40 UTC
+++ Rendering/OpenGL2/vtkXOpenGLRenderWindow.h
@@ -28,11 +28,11 @@
#include "vtkOpenGLRenderWindow.h"
#include "vtkRenderingOpenGL2Module.h" // For export macro
#include <X11/Xlib.h> // Needed for X types used in the public interface
-#include <X11/Xutil.h> // Needed for X types used in the public interface
#include <stack> // for ivar
class vtkIdList;
class vtkXOpenGLRenderWindowInternal;
+struct vtkXVisualInfo;
class VTKRENDERINGOPENGL2_EXPORT vtkXOpenGLRenderWindow : public vtkOpenGLRenderWindow
{
@@ -112,7 +112,7 @@ class VTKRENDERINGOPENGL2_EXPORT vtkXOpenGLRenderWindo
*/
virtual Colormap GetDesiredColormap();
virtual Visual* GetDesiredVisual();
- virtual XVisualInfo* GetDesiredVisualInfo();
+ virtual vtkXVisualInfo* GetDesiredVisualInfo();
virtual int GetDesiredDepth();
//@}