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>
This commit is contained in:
Jorgen Lind 2015-06-03 14:10:19 +02:00 committed by Jørgen Lind
parent bf0bdc5fbb
commit b3d09eceb8
6 changed files with 20 additions and 14 deletions

View File

@ -0,0 +1,2 @@
HEADERS += \
$$PWD/qplatformheaderhelper.h

View File

@ -31,16 +31,19 @@
** **
****************************************************************************/ ****************************************************************************/
#ifndef QXCBFUNCTIONHELPER_H #ifndef QPLATFORMHEADERHELPER_H
#define QXCBFUNCTIONHELPER_H #define QPLATFORMHEADERHELPER_H
#include <QtCore/QByteArray> #include <QtCore/QByteArray>
#include <QtGui/QGuiApplication> #include <QtGui/QGuiApplication>
#if 0
#pragma qt_class(QPlatformHeaderHelper)
#endif
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
namespace QXcbFunctionsHelper namespace QPlatformHeaderHelper {
{
template<typename ReturnT, typename FunctionT> template<typename ReturnT, typename FunctionT>
ReturnT callPlatformFunction(const QByteArray &functionName) ReturnT callPlatformFunction(const QByteArray &functionName)
@ -81,4 +84,4 @@ ReturnT callPlatformFunction(const QByteArray &functionName, Arg1 a1, Arg2 a2, A
QT_END_NAMESPACE QT_END_NAMESPACE
#endif /*QXCBFUNCTIONHELPER_H*/ #endif /*QPLATFORMHEADERHELPER_H*/

View File

@ -7,6 +7,7 @@ include(nativecontexts/nativecontexts.pri)
include(xcbfunctions/xcbfunctions.pri) include(xcbfunctions/xcbfunctions.pri)
include(eglfsfunctions/eglfsfunctions.pri) include(eglfsfunctions/eglfsfunctions.pri)
include(windowsfunctions/windowsfunctions.pri) include(windowsfunctions/windowsfunctions.pri)
include(helper/helper.pri)
QMAKE_DOCS = $$PWD/doc/qtplatformheaders.qdocconf QMAKE_DOCS = $$PWD/doc/qtplatformheaders.qdocconf

View File

@ -34,7 +34,7 @@
#ifndef QXCBINTEGRATIONFUNCTIONS_H #ifndef QXCBINTEGRATIONFUNCTIONS_H
#define QXCBINTEGRATIONFUNCTIONS_H #define QXCBINTEGRATIONFUNCTIONS_H
#include "qxcbfunctionshelper.h" #include <QtPlatformHeaders/QPlatformHeaderHelper>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -45,7 +45,7 @@ public:
static const QByteArray xEmbedSystemTrayVisualHasAlphaChannelIdentifier() { return QByteArrayLiteral("XcbXEmbedSystemTrayVisualHasAlphaChannel"); } static const QByteArray xEmbedSystemTrayVisualHasAlphaChannelIdentifier() { return QByteArrayLiteral("XcbXEmbedSystemTrayVisualHasAlphaChannel"); }
static bool xEmbedSystemTrayVisualHasAlphaChannel() static bool xEmbedSystemTrayVisualHasAlphaChannel()
{ {
return QXcbFunctionsHelper::callPlatformFunction<bool, XEmbedSystemTrayVisualHasAlphaChannel>(xEmbedSystemTrayVisualHasAlphaChannelIdentifier()); return QPlatformHeaderHelper::callPlatformFunction<bool, XEmbedSystemTrayVisualHasAlphaChannel>(xEmbedSystemTrayVisualHasAlphaChannelIdentifier());
} }
}; };

View File

@ -34,7 +34,7 @@
#ifndef QXCBWINDOWFUNCTIONS_H #ifndef QXCBWINDOWFUNCTIONS_H
#define QXCBWINDOWFUNCTIONS_H #define QXCBWINDOWFUNCTIONS_H
#include "qxcbfunctionshelper.h" #include <QtPlatformHeaders/QPlatformHeaderHelper>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -66,35 +66,35 @@ public:
static const QByteArray setWmWindowTypeIdentifier() { return QByteArrayLiteral("XcbSetWmWindowType"); } static const QByteArray setWmWindowTypeIdentifier() { return QByteArrayLiteral("XcbSetWmWindowType"); }
static void setWmWindowType(QWindow *window, WmWindowType type) 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); typedef void (*SetWmWindowIconText)(QWindow *window, const QString &text);
static const QByteArray setWmWindowIconTextIdentifier() { return QByteArrayLiteral("XcbSetWmWindowIconText"); } static const QByteArray setWmWindowIconTextIdentifier() { return QByteArrayLiteral("XcbSetWmWindowIconText"); }
static void setWmWindowIconText(QWindow *window, const QString &text) 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); typedef void (*SetParentRelativeBackPixmap)(const QWindow *window);
static const QByteArray setParentRelativeBackPixmapIdentifier() { return QByteArrayLiteral("XcbSetParentRelativeBackPixmap"); } static const QByteArray setParentRelativeBackPixmapIdentifier() { return QByteArrayLiteral("XcbSetParentRelativeBackPixmap"); }
static void setParentRelativeBackPixmap(const QWindow *window) 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); typedef bool (*RequestSystemTrayWindowDock)(const QWindow *window);
static const QByteArray requestSystemTrayWindowDockIdentifier() { return QByteArrayLiteral("XcbRequestSystemTrayWindowDockIdentifier"); } static const QByteArray requestSystemTrayWindowDockIdentifier() { return QByteArrayLiteral("XcbRequestSystemTrayWindowDockIdentifier"); }
static bool requestSystemTrayWindowDock(const QWindow *window) 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); typedef QRect (*SystemTrayWindowGlobalGeometry)(const QWindow *window);
static const QByteArray systemTrayWindowGlobalGeometryIdentifier() { return QByteArrayLiteral("XcbSystemTrayWindowGlobalGeometryIdentifier"); } static const QByteArray systemTrayWindowGlobalGeometryIdentifier() { return QByteArrayLiteral("XcbSystemTrayWindowGlobalGeometryIdentifier"); }
static QRect systemTrayWindowGlobalGeometry(const QWindow *window) 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); typedef uint (*VisualId)(QWindow *window);

View File

@ -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 @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 @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" ); my @zlib_headers = ( "zconf.h", "zlib.h" );