From 044e06d5a40e3f8d5ae6861341b1f5449e3c0afe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Tue, 1 Mar 2011 10:09:18 +0100 Subject: Lighthouse: Add a native interface. Sometimes in applications code you need to get the native handles for displays, egl displays etc. The native interface class is how you access these handles. Reviewed-by: paul --- src/gui/kernel/kernel.pri | 6 ++- src/gui/kernel/qplatformintegration_qpa.cpp | 5 ++ src/gui/kernel/qplatformintegration_qpa.h | 4 +- src/gui/kernel/qplatformnativeinterface_qpa.cpp | 70 +++++++++++++++++++++++++ src/gui/kernel/qplatformnativeinterface_qpa.h | 68 ++++++++++++++++++++++++ 5 files changed, 150 insertions(+), 3 deletions(-) create mode 100644 src/gui/kernel/qplatformnativeinterface_qpa.cpp create mode 100644 src/gui/kernel/qplatformnativeinterface_qpa.h diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index 0ff3d88..32fa3d3 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -223,7 +223,8 @@ qpa { kernel/qdesktopwidget_qpa_p.h \ kernel/qplatformeventloopintegration_qpa.h \ kernel/qplatformcursor_qpa.h \ - kernel/qplatformclipboard_qpa.h + kernel/qplatformclipboard_qpa.h \ + kernel/qplatformnativeinterface_qpa.h SOURCES += \ kernel/qapplication_qpa.cpp \ @@ -246,7 +247,8 @@ qpa { kernel/qplatformeventloopintegration_qpa.cpp \ kernel/qplatformglcontext_qpa.cpp \ kernel/qplatformcursor_qpa.cpp \ - kernel/qplatformclipboard_qpa.cpp + kernel/qplatformclipboard_qpa.cpp \ + kernel/qplatformnativeinterface_qpa.cpp contains(QT_CONFIG, glib) { SOURCES += \ diff --git a/src/gui/kernel/qplatformintegration_qpa.cpp b/src/gui/kernel/qplatformintegration_qpa.cpp index 0cac57d..9f62538 100644 --- a/src/gui/kernel/qplatformintegration_qpa.cpp +++ b/src/gui/kernel/qplatformintegration_qpa.cpp @@ -111,6 +111,11 @@ QPlatformClipboard *QPlatformIntegration::clipboard() const return clipboard; } +QPlatformNativeInterface * QPlatformIntegration::nativeInterface() const +{ + return 0; +} + /*! \class QPlatformIntegration \since 4.8 diff --git a/src/gui/kernel/qplatformintegration_qpa.h b/src/gui/kernel/qplatformintegration_qpa.h index 7050245..f01d462 100644 --- a/src/gui/kernel/qplatformintegration_qpa.h +++ b/src/gui/kernel/qplatformintegration_qpa.h @@ -60,6 +60,7 @@ class QWidget; class QPlatformEventLoopIntegration; class QPlatformFontDatabase; class QPlatformClipboard; +class QPlatformNativeInterface; class Q_GUI_EXPORT QPlatformIntegration { @@ -89,7 +90,8 @@ public: //jl:XXX should it be hasGLContext and do we need it at all? virtual bool hasOpenGL() const; - +// Access native handles. The window handle is allready available from Wid; + virtual QPlatformNativeInterface *nativeInterface() const; }; QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatformnativeinterface_qpa.cpp b/src/gui/kernel/qplatformnativeinterface_qpa.cpp new file mode 100644 index 0000000..67406cd --- /dev/null +++ b/src/gui/kernel/qplatformnativeinterface_qpa.cpp @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qplatformnativeinterface_qpa.h" + +QT_BEGIN_NAMESPACE + +void * QPlatformNativeInterface::nativeDisplayForWidget(QWidget *widget) +{ + Q_UNUSED(widget); + return 0; +} + +void * QPlatformNativeInterface::eglDisplayForWidget(QWidget *widget) +{ + Q_UNUSED(widget); + return 0; +} + +void * QPlatformNativeInterface::nativeConnectionForWidget(QWidget *widget) +{ + Q_UNUSED(widget); + return 0; +} + +void * QPlatformNativeInterface::nativeScreenForWidget(QWidget *widget) +{ + Q_UNUSED(widget); + return 0; +} + +QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatformnativeinterface_qpa.h b/src/gui/kernel/qplatformnativeinterface_qpa.h new file mode 100644 index 0000000..d576297 --- /dev/null +++ b/src/gui/kernel/qplatformnativeinterface_qpa.h @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPLATFORMNATIVEINTERFACE_QPA_H +#define QPLATFORMNATIVEINTERFACE_QPA_H + +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QWidget; + +class Q_GUI_EXPORT QPlatformNativeInterface +{ +public: + virtual void *nativeDisplayForWidget(QWidget *widget); + virtual void *eglDisplayForWidget(QWidget *widget); + virtual void *nativeConnectionForWidget(QWidget *widget); + virtual void *nativeScreenForWidget(QWidget *widget); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPLATFORMNATIVEINTERFACE_QPA_H -- cgit v0.12