summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r--src/plugins/platforms/eglfs/eglfs.pro7
-rw-r--r--src/plugins/platforms/eglfs/qeglfshooks.h (renamed from src/plugins/platforms/eglfs/qeglfs_hooks.h)31
-rw-r--r--src/plugins/platforms/eglfs/qeglfshooks_stub.cpp81
-rw-r--r--src/plugins/platforms/eglfs/qeglfshooks_x11.cpp (renamed from src/plugins/platforms/eglfs/qeglfs_hooks_x11.cpp)33
-rw-r--r--src/plugins/platforms/eglfs/qeglfsintegration.cpp2
-rw-r--r--src/plugins/platforms/eglfs/qeglfsscreen.cpp2
6 files changed, 128 insertions, 28 deletions
diff --git a/src/plugins/platforms/eglfs/eglfs.pro b/src/plugins/platforms/eglfs/eglfs.pro
index 9a36cacd05..421bbd5561 100644
--- a/src/plugins/platforms/eglfs/eglfs.pro
+++ b/src/plugins/platforms/eglfs/eglfs.pro
@@ -13,20 +13,21 @@ DESTDIR = $$QT.gui.plugins/platforms
DEFINES += MESA_EGL_NO_X11_HEADERS
#To test the hooks on x11 (xlib), comment the above define too
-#EGLFS_PLATFORM_HOOKS_SOURCES += qeglfs_hooks_x11.cpp
+#EGLFS_PLATFORM_HOOKS_SOURCES += qeglfshooks_x11.cpp
#LIBS += -lX11
SOURCES = main.cpp \
qeglfsintegration.cpp \
qeglfswindow.cpp \
qeglfsbackingstore.cpp \
- qeglfsscreen.cpp
+ qeglfsscreen.cpp \
+ qeglfshooks_stub.cpp
HEADERS = qeglfsintegration.h \
qeglfswindow.h \
qeglfsbackingstore.h \
qeglfsscreen.h \
- qeglfs_hooks.h
+ qeglfshooks.h
QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF
diff --git a/src/plugins/platforms/eglfs/qeglfs_hooks.h b/src/plugins/platforms/eglfs/qeglfshooks.h
index 628ef1f33b..a56c80261b 100644
--- a/src/plugins/platforms/eglfs/qeglfs_hooks.h
+++ b/src/plugins/platforms/eglfs/qeglfshooks.h
@@ -39,31 +39,34 @@
**
****************************************************************************/
-#ifndef QEGLFS_HOOKS_H
-#define QEGLFS_HOOKS_H
+#ifndef QEGLFSHOOKS_H
+#define QEGLFSHOOKS_H
#include "qplatformintegration_qpa.h"
#include <EGL/egl.h>
QT_BEGIN_NAMESPACE
-struct QEglFSHooks {
- void platformInit();
- void platformDestroy();
- EGLNativeDisplayType platformDisplay() const;
- QSize screenSize() const;
- EGLNativeWindowType createNativeWindow(const QSize &size);
- void destroyNativeWindow(EGLNativeWindowType window);
- bool hasCapability(QPlatformIntegration::Capability cap) const;
+class QEglFSHooks
+{
+public:
+ virtual void platformInit();
+ virtual void platformDestroy();
+ virtual EGLNativeDisplayType platformDisplay() const;
+ virtual QSize screenSize() const;
+ virtual EGLNativeWindowType createNativeWindow(const QSize &size);
+ virtual void destroyNativeWindow(EGLNativeWindowType window);
+ virtual bool hasCapability(QPlatformIntegration::Capability cap) const;
};
#ifdef EGLFS_PLATFORM_HOOKS
-extern QEglFSHooks platform_hooks;
-static QEglFSHooks *hooks = &platform_hooks;
+extern QEglFSHooks *platformHooks;
+static QEglFSHooks *hooks = platformHooks;
#else
-static QEglFSHooks *hooks = 0;
+extern QEglFSHooks stubHooks;
+static QEglFSHooks *hooks = &stubHooks;
#endif
QT_END_NAMESPACE
-#endif
+#endif // QEGLFSHOOKS_H
diff --git a/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp b/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp
new file mode 100644
index 0000000000..7cc3527a0c
--- /dev/null
+++ b/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the qmake spec of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qeglfshooks.h"
+
+void QEglFSHooks::platformInit()
+{
+}
+
+void QEglFSHooks::platformDestroy()
+{
+}
+
+EGLNativeDisplayType QEglFSHooks::platformDisplay() const
+{
+ return EGL_DEFAULT_DISPLAY;
+}
+
+QSize QEglFSHooks::screenSize() const
+{
+ return QSize();
+}
+
+EGLNativeWindowType QEglFSHooks::createNativeWindow(const QSize &size)
+{
+ Q_UNUSED(size);
+ return 0;
+}
+
+void QEglFSHooks::destroyNativeWindow(EGLNativeWindowType window)
+{
+ Q_UNUSED(window);
+}
+
+bool QEglFSHooks::hasCapability(QPlatformIntegration::Capability cap) const
+{
+ Q_UNUSED(cap);
+ return false;
+}
+
+#ifndef EGLFS_PLATFORM_HOOKS
+QEglFSHooks stubHooks;
+#endif
diff --git a/src/plugins/platforms/eglfs/qeglfs_hooks_x11.cpp b/src/plugins/platforms/eglfs/qeglfshooks_x11.cpp
index 594614e7a0..cb788c52f2 100644
--- a/src/plugins/platforms/eglfs/qeglfs_hooks_x11.cpp
+++ b/src/plugins/platforms/eglfs/qeglfshooks_x11.cpp
@@ -39,31 +39,42 @@
**
****************************************************************************/
-#include "qeglfs_hooks.h"
+#include "qeglfshooks.h"
#include <X11/Xlib.h>
-QEglFSHooks platform_hooks;
+class QEglFSX11Hooks : public QEglFSHooks
+{
+public:
+ virtual void platformInit();
+ virtual void platformDestroy();
+ virtual EGLNativeDisplayType platformDisplay() const;
+ virtual QSize screenSize() const;
+ virtual EGLNativeWindowType createNativeWindow(const QSize &size);
+ virtual void destroyNativeWindow(EGLNativeWindowType window);
+ virtual bool hasCapability(QPlatformIntegration::Capability cap) const;
+};
+
static Display *display = 0;
-void QEglFSHooks::platformInit()
+void QEglFSX11Hooks::platformInit()
{
display = XOpenDisplay(NULL);
if (!display)
qFatal("Could not open display");
}
-void QEglFSHooks::platformDestroy()
+void QEglFSX11Hooks::platformDestroy()
{
XCloseDisplay(display);
}
-EGLNativeDisplayType QEglFSHooks::platformDisplay() const
+EGLNativeDisplayType QEglFSX11Hooks::platformDisplay() const
{
return display;
}
-QSize QEglFSHooks::screenSize() const
+QSize QEglFSX11Hooks::screenSize() const
{
QList<QByteArray> env = qgetenv("EGLFS_X11_SIZE").split('x');
if (env.length() != 2)
@@ -71,7 +82,7 @@ QSize QEglFSHooks::screenSize() const
return QSize(env.at(0).toInt(), env.at(1).toInt());
}
-EGLNativeWindowType QEglFSHooks::createNativeWindow(const QSize &size)
+EGLNativeWindowType QEglFSX11Hooks::createNativeWindow(const QSize &size)
{
Window root = DefaultRootWindow(display);
XSetWindowAttributes swa;
@@ -83,13 +94,17 @@ EGLNativeWindowType QEglFSHooks::createNativeWindow(const QSize &size)
return win;
}
-void QEglFSHooks::destroyNativeWindow(EGLNativeWindowType window)
+void QEglFSX11Hooks::destroyNativeWindow(EGLNativeWindowType window)
{
XDestroyWindow(display, window);
}
-bool QEglFSHooks::hasCapability(QPlatformIntegration::Capability cap) const
+bool QEglFSX11Hooks::hasCapability(QPlatformIntegration::Capability cap) const
{
+ Q_UNUSED(cap);
return false;
}
+static QEglFSX11Hooks eglFSX11Hooks;
+QEglFSHooks *platformHooks = &eglFSX11Hooks;
+
diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/qeglfsintegration.cpp
index b1f5a69570..9b7d9246f9 100644
--- a/src/plugins/platforms/eglfs/qeglfsintegration.cpp
+++ b/src/plugins/platforms/eglfs/qeglfsintegration.cpp
@@ -43,7 +43,7 @@
#include "qeglfswindow.h"
#include "qeglfsbackingstore.h"
-#include "qeglfs_hooks.h"
+#include "qeglfshooks.h"
#include <QtPlatformSupport/private/qgenericunixfontdatabase_p.h>
#include <QtPlatformSupport/private/qgenericunixeventdispatcher_p.h>
diff --git a/src/plugins/platforms/eglfs/qeglfsscreen.cpp b/src/plugins/platforms/eglfs/qeglfsscreen.cpp
index 3c2f4c580d..ea939a9821 100644
--- a/src/plugins/platforms/eglfs/qeglfsscreen.cpp
+++ b/src/plugins/platforms/eglfs/qeglfsscreen.cpp
@@ -41,7 +41,7 @@
#include "qeglfsscreen.h"
#include "qeglfswindow.h"
-#include "qeglfs_hooks.h"
+#include "qeglfshooks.h"
#include <QtPlatformSupport/private/qeglconvenience_p.h>
#include <QtPlatformSupport/private/qeglplatformcontext_p.h>