From b3d09eceb83e9d34906144d98f3de727679df6f0 Mon Sep 17 00:00:00 2001
From: Jorgen Lind <jorgen.lind@theqtcompany.com>
Date: Wed, 3 Jun 2015 14:10:19 +0200
Subject: [PATCH] Move the function helper to its own file

Also make it a class so a forward header is generated by syncqt

Change-Id: Ibab6b925dc6e9dab1b617b9b4027a4144e4a3773
Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
---
 src/platformheaders/helper/helper.pri               |  2 ++
 .../qplatformheaderhelper.h}                        | 13 ++++++++-----
 src/platformheaders/platformheaders.pro             |  1 +
 .../xcbfunctions/qxcbintegrationfunctions.h         |  4 ++--
 .../xcbfunctions/qxcbwindowfunctions.h              | 12 ++++++------
 sync.profile                                        |  2 +-
 6 files changed, 20 insertions(+), 14 deletions(-)
 create mode 100644 src/platformheaders/helper/helper.pri
 rename src/platformheaders/{xcbfunctions/qxcbfunctionshelper.h => helper/qplatformheaderhelper.h} (94%)

diff --git a/src/platformheaders/helper/helper.pri b/src/platformheaders/helper/helper.pri
new file mode 100644
index 00000000000..2f6e7662145
--- /dev/null
+++ b/src/platformheaders/helper/helper.pri
@@ -0,0 +1,2 @@
+HEADERS += \
+    $$PWD/qplatformheaderhelper.h
diff --git a/src/platformheaders/xcbfunctions/qxcbfunctionshelper.h b/src/platformheaders/helper/qplatformheaderhelper.h
similarity index 94%
rename from src/platformheaders/xcbfunctions/qxcbfunctionshelper.h
rename to src/platformheaders/helper/qplatformheaderhelper.h
index a9d734a387a..52302dbfba0 100644
--- a/src/platformheaders/xcbfunctions/qxcbfunctionshelper.h
+++ b/src/platformheaders/helper/qplatformheaderhelper.h
@@ -31,16 +31,19 @@
 **
 ****************************************************************************/
 
-#ifndef QXCBFUNCTIONHELPER_H
-#define QXCBFUNCTIONHELPER_H
+#ifndef QPLATFORMHEADERHELPER_H
+#define QPLATFORMHEADERHELPER_H
 
 #include <QtCore/QByteArray>
 #include <QtGui/QGuiApplication>
 
+#if 0
+#pragma qt_class(QPlatformHeaderHelper)
+#endif
+
 QT_BEGIN_NAMESPACE
 
-namespace QXcbFunctionsHelper
-{
+namespace QPlatformHeaderHelper {
 
 template<typename ReturnT, typename FunctionT>
 ReturnT callPlatformFunction(const QByteArray &functionName)
@@ -81,4 +84,4 @@ ReturnT callPlatformFunction(const QByteArray &functionName, Arg1 a1, Arg2 a2, A
 
 QT_END_NAMESPACE
 
-#endif  /*QXCBFUNCTIONHELPER_H*/
+#endif  /*QPLATFORMHEADERHELPER_H*/
diff --git a/src/platformheaders/platformheaders.pro b/src/platformheaders/platformheaders.pro
index 5e875f7d2dc..6b6294d34c0 100644
--- a/src/platformheaders/platformheaders.pro
+++ b/src/platformheaders/platformheaders.pro
@@ -7,6 +7,7 @@ include(nativecontexts/nativecontexts.pri)
 include(xcbfunctions/xcbfunctions.pri)
 include(eglfsfunctions/eglfsfunctions.pri)
 include(windowsfunctions/windowsfunctions.pri)
+include(helper/helper.pri)
 
 QMAKE_DOCS = $$PWD/doc/qtplatformheaders.qdocconf
 
diff --git a/src/platformheaders/xcbfunctions/qxcbintegrationfunctions.h b/src/platformheaders/xcbfunctions/qxcbintegrationfunctions.h
index 87e19e6a456..66bfb723076 100644
--- a/src/platformheaders/xcbfunctions/qxcbintegrationfunctions.h
+++ b/src/platformheaders/xcbfunctions/qxcbintegrationfunctions.h
@@ -34,7 +34,7 @@
 #ifndef QXCBINTEGRATIONFUNCTIONS_H
 #define QXCBINTEGRATIONFUNCTIONS_H
 
-#include "qxcbfunctionshelper.h"
+#include <QtPlatformHeaders/QPlatformHeaderHelper>
 
 QT_BEGIN_NAMESPACE
 
@@ -45,7 +45,7 @@ public:
     static const QByteArray xEmbedSystemTrayVisualHasAlphaChannelIdentifier() { return QByteArrayLiteral("XcbXEmbedSystemTrayVisualHasAlphaChannel"); }
     static bool xEmbedSystemTrayVisualHasAlphaChannel()
     {
-        return QXcbFunctionsHelper::callPlatformFunction<bool, XEmbedSystemTrayVisualHasAlphaChannel>(xEmbedSystemTrayVisualHasAlphaChannelIdentifier());
+        return QPlatformHeaderHelper::callPlatformFunction<bool, XEmbedSystemTrayVisualHasAlphaChannel>(xEmbedSystemTrayVisualHasAlphaChannelIdentifier());
     }
 };
 
diff --git a/src/platformheaders/xcbfunctions/qxcbwindowfunctions.h b/src/platformheaders/xcbfunctions/qxcbwindowfunctions.h
index d477a63ec7d..0db2e2a09df 100644
--- a/src/platformheaders/xcbfunctions/qxcbwindowfunctions.h
+++ b/src/platformheaders/xcbfunctions/qxcbwindowfunctions.h
@@ -34,7 +34,7 @@
 #ifndef QXCBWINDOWFUNCTIONS_H
 #define QXCBWINDOWFUNCTIONS_H
 
-#include "qxcbfunctionshelper.h"
+#include <QtPlatformHeaders/QPlatformHeaderHelper>
 
 QT_BEGIN_NAMESPACE
 
@@ -66,35 +66,35 @@ public:
     static const QByteArray setWmWindowTypeIdentifier() { return QByteArrayLiteral("XcbSetWmWindowType"); }
     static void setWmWindowType(QWindow *window, WmWindowType type)
     {
-        return QXcbFunctionsHelper::callPlatformFunction<void, SetWmWindowType, QWindow *, WmWindowType>(setWmWindowTypeIdentifier(), window, type);
+        return QPlatformHeaderHelper::callPlatformFunction<void, SetWmWindowType, QWindow *, WmWindowType>(setWmWindowTypeIdentifier(), window, type);
     }
 
     typedef void (*SetWmWindowIconText)(QWindow *window, const QString &text);
     static const QByteArray setWmWindowIconTextIdentifier() { return QByteArrayLiteral("XcbSetWmWindowIconText"); }
     static void setWmWindowIconText(QWindow *window, const QString &text)
     {
-        return QXcbFunctionsHelper::callPlatformFunction<void, SetWmWindowIconText, QWindow *, const QString &>(setWmWindowIconTextIdentifier(), window, text);
+        return QPlatformHeaderHelper::callPlatformFunction<void, SetWmWindowIconText, QWindow *, const QString &>(setWmWindowIconTextIdentifier(), window, text);
     }
 
     typedef void (*SetParentRelativeBackPixmap)(const QWindow *window);
     static const QByteArray setParentRelativeBackPixmapIdentifier() { return QByteArrayLiteral("XcbSetParentRelativeBackPixmap"); }
     static void setParentRelativeBackPixmap(const QWindow *window)
     {
-        return QXcbFunctionsHelper::callPlatformFunction<void, SetParentRelativeBackPixmap, const QWindow *>(setParentRelativeBackPixmapIdentifier(), window);
+        return QPlatformHeaderHelper::callPlatformFunction<void, SetParentRelativeBackPixmap, const QWindow *>(setParentRelativeBackPixmapIdentifier(), window);
     }
 
     typedef bool (*RequestSystemTrayWindowDock)(const QWindow *window);
     static const QByteArray requestSystemTrayWindowDockIdentifier() { return QByteArrayLiteral("XcbRequestSystemTrayWindowDockIdentifier"); }
     static bool requestSystemTrayWindowDock(const QWindow *window)
     {
-        return QXcbFunctionsHelper::callPlatformFunction<bool, RequestSystemTrayWindowDock, const QWindow *>(requestSystemTrayWindowDockIdentifier(), window);
+        return QPlatformHeaderHelper::callPlatformFunction<bool, RequestSystemTrayWindowDock, const QWindow *>(requestSystemTrayWindowDockIdentifier(), window);
     }
 
     typedef QRect (*SystemTrayWindowGlobalGeometry)(const QWindow *window);
     static const QByteArray systemTrayWindowGlobalGeometryIdentifier() { return QByteArrayLiteral("XcbSystemTrayWindowGlobalGeometryIdentifier"); }
     static QRect systemTrayWindowGlobalGeometry(const QWindow *window)
     {
-        return QXcbFunctionsHelper::callPlatformFunction<QRect, SystemTrayWindowGlobalGeometry, const QWindow *>(systemTrayWindowGlobalGeometryIdentifier(), window);
+        return QPlatformHeaderHelper::callPlatformFunction<QRect, SystemTrayWindowGlobalGeometry, const QWindow *>(systemTrayWindowGlobalGeometryIdentifier(), window);
     }
 
     typedef uint (*VisualId)(QWindow *window);
diff --git a/sync.profile b/sync.profile
index bf29ca6e26b..1700d94fff9 100644
--- a/sync.profile
+++ b/sync.profile
@@ -50,7 +50,7 @@
     }
 );
 
-@qpa_headers = ( qr/^qplatform/, qr/^qwindowsystem/ );
+@qpa_headers = ( qr/^(?!qplatformheaderhelper)qplatform/, qr/^qwindowsystem/ );
 my @angle_headers = ('egl.h', 'eglext.h', 'eglplatform.h', 'gl2.h', 'gl2ext.h', 'gl2platform.h', 'ShaderLang.h', 'khrplatform.h');
 my @internal_zlib_headers = ( "crc32.h", "deflate.h", "gzguts.h", "inffast.h", "inffixed.h", "inflate.h", "inftrees.h", "trees.h", "zutil.h" );
 my @zlib_headers = ( "zconf.h", "zlib.h" );
-- 
GitLab