Explorar o código

Undefine another X11 macro colliding with RmlUi codebase, organize into separate file.

Michael Ragazzon %!s(int64=4) %!d(string=hai) anos
pai
achega
6aee45b689

+ 1 - 0
CMake/SampleFileList.cmake

@@ -293,5 +293,6 @@ else()
        )
        list(APPEND shell_HDR_FILES
                ${PROJECT_SOURCE_DIR}/Samples/shell/include/x11/InputX11.h
+               ${PROJECT_SOURCE_DIR}/Samples/shell/include/x11/X11MacroZapper.h
        )
 endif()

+ 1 - 0
CMake/gen_samplelists.sh

@@ -61,6 +61,7 @@ echo '               ${PROJECT_SOURCE_DIR}/Samples/shell/src/x11/ShellRenderInte
 echo '       )' >> $file
 echo '       list(APPEND shell_HDR_FILES' >> $file
 echo '               ${PROJECT_SOURCE_DIR}/Samples/shell/include/x11/InputX11.h' >> $file
+echo '               ${PROJECT_SOURCE_DIR}/Samples/shell/include/x11/X11MacroZapper.h' >> $file
 echo '       )' >> $file
 echo 'endif()' >> $file
 

+ 2 - 5
Samples/shell/include/ShellOpenGL.h

@@ -45,11 +45,8 @@
 #include <GL/gl.h>
 #include <GL/glext.h>
 #include <GL/glu.h>
-// The None define from X.h conflicts with RmlUi code base,
-// use the constant 0L instead where necessary
-#ifdef None
-  #undef None
-#endif
+
+#include <x11/X11MacroZapper.h>
 
 struct __X11NativeWindowData
 {

+ 1 - 6
Samples/shell/include/x11/InputX11.h

@@ -30,12 +30,7 @@
 #define RMLUI_SHELL_X11_INPUTX11_H
 
 #include <X11/Xlib.h>
-
-// The None define from X.h conflicts with RmlUi code base,
-// use the constant 0L instead where necessary
-#ifdef None
-  #undef None
-#endif
+#include <x11/X11MacroZapper.h>
 
 #include "Input.h"
 

+ 43 - 0
Samples/shell/include/x11/X11MacroZapper.h

@@ -0,0 +1,43 @@
+/*
+ * This source file is part of RmlUi, the HTML/CSS Interface Middleware
+ *
+ * For the latest information, see http://github.com/mikke89/RmlUi
+ *
+ * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
+ * Copyright (c) 2019 The RmlUi Team, and contributors
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ */
+
+#ifndef RMLUI_SHELL_X11_X11MACROZAPPER_H
+#define RMLUI_SHELL_X11_X11MACROZAPPER_H
+
+// The None and Always defines from X.h conflicts with RmlUi code base,
+// use their underlying constants where necessary.
+#ifdef None
+	// Value 0L
+	#undef None
+#endif
+#ifdef Always
+	// Value 2
+	#undef Always
+#endif
+
+#endif