diff options
author | Lars Knoll <lars.knoll@nokia.com> | 2012-04-16 12:04:34 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@nokia.com> | 2012-04-16 12:04:34 +0200 |
commit | 9bd032355163d92cda5e7e59ecd21214b131f187 (patch) | |
tree | 002fa12558505683143c7eb08949a3d225bf0712 /src/plugins/platforms/eglfs | |
parent | d037d25c3d5236623371cf051aaf6a9e59792ba7 (diff) | |
parent | 41673c45dde2eb95ee21dd918235218399f2be2c (diff) |
Merge remote-tracking branch 'origin/master' into api_changes
Conflicts:
configure
src/corelib/io/qurl.cpp
src/gui/kernel/qwindow.cpp
src/tools/moc/generator.cpp
src/widgets/kernel/qwidget_qpa.cpp
src/widgets/styles/qstyle.h
src/widgets/widgets/qtabbar.cpp
tests/auto/corelib/codecs/utf8/tst_utf8.cpp
Change-Id: Ia457228d6f684ec8184e13e8fcc9d25857b1751e
Diffstat (limited to 'src/plugins/platforms/eglfs')
-rw-r--r-- | src/plugins/platforms/eglfs/eglfs.pro | 9 | ||||
-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.cpp | 81 | ||||
-rw-r--r-- | src/plugins/platforms/eglfs/qeglfshooks_x11.cpp | 110 | ||||
-rw-r--r-- | src/plugins/platforms/eglfs/qeglfsintegration.cpp | 6 | ||||
-rw-r--r-- | src/plugins/platforms/eglfs/qeglfsscreen.cpp | 9 |
6 files changed, 225 insertions, 21 deletions
diff --git a/src/plugins/platforms/eglfs/eglfs.pro b/src/plugins/platforms/eglfs/eglfs.pro index 89d56efc82..421bbd5561 100644 --- a/src/plugins/platforms/eglfs/eglfs.pro +++ b/src/plugins/platforms/eglfs/eglfs.pro @@ -12,17 +12,22 @@ DESTDIR = $$QT.gui.plugins/platforms #Avoid X11 header collision DEFINES += MESA_EGL_NO_X11_HEADERS +#To test the hooks on x11 (xlib), comment the above define too +#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 a30af9409f..a56c80261b 100644 --- a/src/plugins/platforms/eglfs/qeglfs_hooks.h +++ b/src/plugins/platforms/eglfs/qeglfshooks.h @@ -39,23 +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); +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 *platformHooks; +static QEglFSHooks *hooks = platformHooks; +#else +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/qeglfshooks_x11.cpp b/src/plugins/platforms/eglfs/qeglfshooks_x11.cpp new file mode 100644 index 0000000000..cb788c52f2 --- /dev/null +++ b/src/plugins/platforms/eglfs/qeglfshooks_x11.cpp @@ -0,0 +1,110 @@ +/**************************************************************************** +** +** 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" + +#include <X11/Xlib.h> + +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 QEglFSX11Hooks::platformInit() +{ + display = XOpenDisplay(NULL); + if (!display) + qFatal("Could not open display"); +} + +void QEglFSX11Hooks::platformDestroy() +{ + XCloseDisplay(display); +} + +EGLNativeDisplayType QEglFSX11Hooks::platformDisplay() const +{ + return display; +} + +QSize QEglFSX11Hooks::screenSize() const +{ + QList<QByteArray> env = qgetenv("EGLFS_X11_SIZE").split('x'); + if (env.length() != 2) + return QSize(640, 480); + return QSize(env.at(0).toInt(), env.at(1).toInt()); +} + +EGLNativeWindowType QEglFSX11Hooks::createNativeWindow(const QSize &size) +{ + Window root = DefaultRootWindow(display); + XSetWindowAttributes swa; + memset(&swa, 0, sizeof(swa)); + Window win = XCreateWindow(display, root, 0, 0, size.width(), size.height(), 0, CopyFromParent, + InputOutput, CopyFromParent, CWEventMask, &swa); + XMapWindow(display, win); + XStoreName(display, win, "EGLFS"); + return win; +} + +void QEglFSX11Hooks::destroyNativeWindow(EGLNativeWindowType window) +{ + XDestroyWindow(display, window); +} + +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 d9214f87fe..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> @@ -74,6 +74,10 @@ QEglFSIntegration::~QEglFSIntegration() bool QEglFSIntegration::hasCapability(QPlatformIntegration::Capability cap) const { + // We assume that devices will have more and not less capabilities + if (hooks && hooks->hasCapability(cap)) + return true; + switch (cap) { case ThreadedPixmaps: return true; case OpenGL: return true; diff --git a/src/plugins/platforms/eglfs/qeglfsscreen.cpp b/src/plugins/platforms/eglfs/qeglfsscreen.cpp index c7e983b0fb..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> @@ -53,13 +53,6 @@ QT_BEGIN_NAMESPACE -#ifdef EGLFS_PLATFORM_HOOKS -extern QEglFSHooks platform_hooks; -static QEglFSHooks *hooks = &platform_hooks; -#else -static QEglFSHooks *hooks = 0; -#endif - // #define QEGL_EXTRA_DEBUG #ifdef QEGL_EXTRA_DEBUG |