Skip to content

Commit

Permalink
Move the function helper to its own file
Browse files Browse the repository at this point in the history
Also make it a class so a forward header is generated by syncqt

Change-Id: Ibab6b925dc6e9dab1b617b9b4027a4144e4a3773
Reviewed-by: Timur Pocheptsov <[email protected]>
Reviewed-by: Laszlo Agocs <[email protected]>
  • Loading branch information
Jorgen Lind committed Jun 5, 2015
1 parent bf0bdc5 commit b3d09ec
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 14 deletions.
2 changes: 2 additions & 0 deletions src/platformheaders/helper/helper.pri
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
HEADERS += \
$$PWD/qplatformheaderhelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -81,4 +84,4 @@ ReturnT callPlatformFunction(const QByteArray &functionName, Arg1 a1, Arg2 a2, A

QT_END_NAMESPACE

#endif /*QXCBFUNCTIONHELPER_H*/
#endif /*QPLATFORMHEADERHELPER_H*/
1 change: 1 addition & 0 deletions src/platformheaders/platformheaders.pro
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions src/platformheaders/xcbfunctions/qxcbintegrationfunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#ifndef QXCBINTEGRATIONFUNCTIONS_H
#define QXCBINTEGRATIONFUNCTIONS_H

#include "qxcbfunctionshelper.h"
#include <QtPlatformHeaders/QPlatformHeaderHelper>

QT_BEGIN_NAMESPACE

Expand All @@ -45,7 +45,7 @@ class QXcbIntegrationFunctions
static const QByteArray xEmbedSystemTrayVisualHasAlphaChannelIdentifier() { return QByteArrayLiteral("XcbXEmbedSystemTrayVisualHasAlphaChannel"); }
static bool xEmbedSystemTrayVisualHasAlphaChannel()
{
return QXcbFunctionsHelper::callPlatformFunction<bool, XEmbedSystemTrayVisualHasAlphaChannel>(xEmbedSystemTrayVisualHasAlphaChannelIdentifier());
return QPlatformHeaderHelper::callPlatformFunction<bool, XEmbedSystemTrayVisualHasAlphaChannel>(xEmbedSystemTrayVisualHasAlphaChannelIdentifier());
}
};

Expand Down
12 changes: 6 additions & 6 deletions src/platformheaders/xcbfunctions/qxcbwindowfunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#ifndef QXCBWINDOWFUNCTIONS_H
#define QXCBWINDOWFUNCTIONS_H

#include "qxcbfunctionshelper.h"
#include <QtPlatformHeaders/QPlatformHeaderHelper>

QT_BEGIN_NAMESPACE

Expand Down Expand Up @@ -66,35 +66,35 @@ class QXcbWindowFunctions {
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);
Expand Down
2 changes: 1 addition & 1 deletion sync.profile
Original file line number Diff line number Diff line change
Expand Up @@ -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" );
Expand Down

0 comments on commit b3d09ec

Please sign in to comment.