summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@nokia.com>2010-03-31 07:41:39 (GMT)
committerJørgen Lind <jorgen.lind@nokia.com>2010-03-31 09:32:07 (GMT)
commita93f6b21f636df4840f86099c76d287afb978001 (patch)
treedc85d58ebc1ac7ee9d653157f42242cbc379a636 /src/gui/kernel
parenta31270b5fc88460d6923ac1f2b5b6e90da59c9c8 (diff)
downloadQt-a93f6b21f636df4840f86099c76d287afb978001.zip
Qt-a93f6b21f636df4840f86099c76d287afb978001.tar.gz
Qt-a93f6b21f636df4840f86099c76d287afb978001.tar.bz2
Refactoring GraphicsSystem to QPlatformIntegration
QPlatformIntegration is the "main" integration class which needs to be subclassed. This is done so that we don't pollute GraphicsSystem with functionality that really does not belong there. In lighthouse applications needs now to be started with -platform some_platform
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/kernel.pri10
-rw-r--r--src/gui/kernel/qapplication.cpp12
-rw-r--r--src/gui/kernel/qapplication_lite.cpp36
-rw-r--r--src/gui/kernel/qapplication_p.h15
-rw-r--r--src/gui/kernel/qdesktopwidget_lite.cpp24
-rw-r--r--src/gui/kernel/qplatformintegration_lite.cpp18
-rw-r--r--src/gui/kernel/qplatformintegration_lite.h73
-rw-r--r--src/gui/kernel/qplatformintegrationfactory_lite.cpp88
-rw-r--r--src/gui/kernel/qplatformintegrationfactory_lite_p.h78
-rw-r--r--src/gui/kernel/qplatformintegrationplugin_lite.cpp55
-rw-r--r--src/gui/kernel/qplatformintegrationplugin_lite.h92
-rw-r--r--src/gui/kernel/qplatformscreen_lite.cpp15
-rw-r--r--src/gui/kernel/qplatformscreen_lite.h31
-rw-r--r--src/gui/kernel/qwidget_lite.cpp14
-rw-r--r--src/gui/kernel/qwindowsysteminterface.h16
15 files changed, 533 insertions, 44 deletions
diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri
index 96892d2..cf5ec92 100644
--- a/src/gui/kernel/kernel.pri
+++ b/src/gui/kernel/kernel.pri
@@ -203,6 +203,10 @@ embedded_lite {
kernel/qgenericplugin_lite.h \
kernel/qeventdispatcher_lite_p.h \
kernel/qwindowsysteminterface.h \
+ kernel/qplatformintegration_lite.h \
+ kernel/qplatformscreen_lite.h \
+ kernel/qplatformintegrationfactory_lite_p.h \
+ kernel/qplatformintegrationplugin_lite.h \
SOURCES += \
kernel/qapplication_lite.cpp \
@@ -216,7 +220,11 @@ embedded_lite {
kernel/qsound_lite.cpp \
kernel/qwidget_lite.cpp \
kernel/qeventdispatcher_lite.cpp \
- kernel/qwindowsysteminterface.cpp
+ kernel/qwindowsysteminterface.cpp \
+ kernel/qplatformintegration_lite.cpp \
+ kernel/qplatformscreen_lite.cpp \
+ kernel/qplatformintegrationfactory_lite.cpp \
+ kernel/qplatformintegrationplugin_lite.cpp
contains(QT_CONFIG, glib) {
SOURCES += \
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index 4782d7c..a188276 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -441,6 +441,9 @@ QPalette *QApplicationPrivate::sys_pal = 0; // default system palette
QPalette *QApplicationPrivate::set_pal = 0; // default palette set by programmer
QGraphicsSystem *QApplicationPrivate::graphics_system = 0; // default graphics system
+#if defined(Q_WS_LITE)
+QPlatformIntegration *QApplicationPrivate::platform_integration = 0;
+#endif
QString QApplicationPrivate::graphics_system_name; // graphics system id - for delayed initialization
Q_GLOBAL_STATIC(QMutex, applicationFontMutex)
@@ -771,7 +774,6 @@ void QApplicationPrivate::construct(
)
{
initResources();
-
graphics_system_name = QLatin1String(qgetenv("QT_DEFAULT_GRAPHICS_SYSTEM"));
qt_is_gui_used = (qt_appType != QApplication::Tty);
@@ -939,10 +941,12 @@ void QApplicationPrivate::initialize()
// Set up which span functions should be used in raster engine...
qInitDrawhelperAsm();
-#if !defined(Q_WS_X11) && !defined(Q_WS_QWS)
+#if !defined(Q_WS_X11) && !defined(Q_WS_QWS) && !defined(Q_WS_LITE)
// initialize the graphics system - on X11 this is initialized inside
// qt_init() in qapplication_x11.cpp because of several reasons.
// On QWS, the graphics system is set by the QScreen plugin.
+ // For lighthouse it will be initialized to QLiteGraphicsSystem
+ // when the platformIntegration plugin is instansiated in qt_init(
graphics_system = QGraphicsSystemFactory::create(graphics_system_name);
#endif
#ifndef QT_NO_WHEELEVENT
@@ -1561,7 +1565,11 @@ QStyle* QApplication::setStyle(const QString& style)
void QApplication::setGraphicsSystem(const QString &system)
{
+#if !defined(Q_WS_LITE)
QApplicationPrivate::graphics_system_name = system;
+#else
+ Q_UNUSED(system)
+#endif
}
/*!
diff --git a/src/gui/kernel/qapplication_lite.cpp b/src/gui/kernel/qapplication_lite.cpp
index 5d7ab5a..c8d65ff 100644
--- a/src/gui/kernel/qapplication_lite.cpp
+++ b/src/gui/kernel/qapplication_lite.cpp
@@ -53,13 +53,15 @@
#include "private/qwidget_p.h"
#include "qgenericpluginfactory_lite.h"
+#include "qplatformintegrationfactory_lite_p.h"
#include <qdesktopwidget.h>
#include <qinputcontext.h>
-#include "private/qgraphicssystem_p.h"
+#include <QtGui/private/qgraphicssystem_lite_p.h>
#include <QGraphicsSystemCursor>
#include <qdebug.h>
#include <QWindowSystemInterface>
+#include <QPlatformIntegration>
QT_BEGIN_NAMESPACE
@@ -386,10 +388,9 @@ void QApplication::restoreOverrideCursor()
QWidget *QApplication::topLevelAt(const QPoint &pos)
{
- QGraphicsSystem *gs = QApplicationPrivate::graphicsSystem();
- if (!gs)
- return 0;
- QGraphicsSystemScreen *screen = gs->screens().first();
+ QPlatformIntegration *pi = QApplicationPrivate::platformIntegration();
+
+ QPlatformScreen *screen = pi->screens().first();
if (!screen)
return 0;
QWidget *w = screen->topLevelAt(pos);
@@ -404,6 +405,23 @@ void QApplication::alert(QWidget *, int)
{
}
+static void init_platform(const QString &name)
+{
+ QApplicationPrivate::platform_integration = QPlatformIntegrationFactory::create(name);
+ QApplicationPrivate::graphics_system = new QLiteGraphicsSystem;
+ if (!QApplicationPrivate::platform_integration) {
+ QStringList keys = QPlatformIntegrationFactory::keys();
+ QString fatalMessage =
+ QString::fromLatin1("Failed to load platform plugin \"%1\". Available platforms are: \n").arg(name);
+ foreach(QString key, keys) {
+ fatalMessage.append(key + QString::fromLatin1("\n"));
+ }
+ qFatal("%s", fatalMessage.toLocal8Bit().constData());
+
+ }
+
+}
+
static void init_plugins(const QList<QByteArray> pluginList)
{
for (int i = 0; i < pluginList.count(); ++i) {
@@ -447,6 +465,7 @@ void qt_init(QApplicationPrivate *priv, int type)
}
QList<QByteArray> pluginList;
+ QString platformName = qgetenv("QT_LITE_PLATFORM");
// Get command line params
@@ -460,6 +479,9 @@ void qt_init(QApplicationPrivate *priv, int type)
if (arg == "-fn" || arg == "-font") {
if (++i < argc)
appFont = argv[i];
+ } else if (arg == "-platform") {
+ if (++i < argc)
+ platformName = argv[i];
} else if (arg == "-plugin") {
if (++i < argc)
pluginList << argv[i];
@@ -473,9 +495,6 @@ void qt_init(QApplicationPrivate *priv, int type)
priv->argc = j;
}
-
-
-
#if 0
QByteArray pluginEnv = qgetenv("QT_LITE_PLUGINS");
if (!pluginEnv.isEmpty()) {
@@ -483,6 +502,7 @@ void qt_init(QApplicationPrivate *priv, int type)
}
#endif
+ init_platform(platformName);
init_plugins(pluginList);
QColormap::initialize();
diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h
index 2cf5fce..d0ab0c4 100644
--- a/src/gui/kernel/qapplication_p.h
+++ b/src/gui/kernel/qapplication_p.h
@@ -78,6 +78,7 @@
#endif
#ifdef Q_WS_LITE
#include <QWindowSystemInterface>
+#include "QtGui/qplatformintegration_lite.h"
#endif
QT_BEGIN_NAMESPACE
@@ -312,10 +313,15 @@ public:
static QString desktopStyleKey();
static QGraphicsSystem *graphicsSystem()
-#if !defined(Q_WS_QWS)
- { return graphics_system; }
-#else
+#if defined(Q_WS_QWS)
{ return QScreen::instance()->graphicsSystem(); }
+#else
+ { return graphics_system; }
+#endif
+
+#if defined(Q_WS_LITE)
+ static QPlatformIntegration *platformIntegration()
+ { return platform_integration; }
#endif
void createEventDispatcher();
@@ -417,6 +423,9 @@ public:
static QPalette *set_pal;
static QGraphicsSystem *graphics_system;
static QString graphics_system_name;
+#if defined(Q_WS_LITE)
+ static QPlatformIntegration *platform_integration;
+#endif
private:
static QFont *app_font; // private for a reason! Always use QApplication::font() instead!
diff --git a/src/gui/kernel/qdesktopwidget_lite.cpp b/src/gui/kernel/qdesktopwidget_lite.cpp
index a3535fb..b077d57 100644
--- a/src/gui/kernel/qdesktopwidget_lite.cpp
+++ b/src/gui/kernel/qdesktopwidget_lite.cpp
@@ -69,10 +69,8 @@ int QDesktopWidget::primaryScreen() const
int QDesktopWidget::numScreens() const
{
- QGraphicsSystem *gs = QApplicationPrivate::graphicsSystem();
- if (!gs)
- return 0;
- return qMax(gs->screens().size(), 1);
+ QPlatformIntegration *pi = QApplicationPrivate::platformIntegration();
+ return qMax(pi->screens().size(), 1);
}
QWidget *QDesktopWidget::screen(int)
@@ -82,10 +80,8 @@ QWidget *QDesktopWidget::screen(int)
const QRect QDesktopWidget::availableGeometry(int screenNo) const
{
- QGraphicsSystem *gs = QApplicationPrivate::graphicsSystem();
- if (!gs)
- return QRect();
- QList<QGraphicsSystemScreen *> screens = gs->screens();
+ QPlatformIntegration *pi = QApplicationPrivate::platformIntegration();
+ QList<QPlatformScreen *> screens = pi->screens();
if (screenNo == -1)
screenNo = 0;
if (screenNo < 0 || screenNo >= screens.size())
@@ -96,10 +92,8 @@ const QRect QDesktopWidget::availableGeometry(int screenNo) const
const QRect QDesktopWidget::screenGeometry(int screenNo) const
{
- QGraphicsSystem *gs = QApplicationPrivate::graphicsSystem();
- if (!gs)
- return QRect();
- QList<QGraphicsSystemScreen *> screens = gs->screens();
+ QPlatformIntegration *pi = QApplicationPrivate::platformIntegration();
+ QList<QPlatformScreen *> screens = pi->screens();
if (screenNo == -1)
screenNo = 0;
if (screenNo < 0 || screenNo >= screens.size())
@@ -122,10 +116,8 @@ int QDesktopWidget::screenNumber(const QWidget *w) const
int QDesktopWidget::screenNumber(const QPoint &p) const
{
- QGraphicsSystem *gs = QApplicationPrivate::graphicsSystem();
- if (!gs)
- return -1;
- QList<QGraphicsSystemScreen *> screens = gs->screens();
+ QPlatformIntegration *pi = QApplicationPrivate::platformIntegration();
+ QList<QPlatformScreen *> screens = pi->screens();
for (int i = 0; i < screens.size(); ++i)
if (screens[i]->geometry().contains(p))
diff --git a/src/gui/kernel/qplatformintegration_lite.cpp b/src/gui/kernel/qplatformintegration_lite.cpp
new file mode 100644
index 0000000..0e28fc6
--- /dev/null
+++ b/src/gui/kernel/qplatformintegration_lite.cpp
@@ -0,0 +1,18 @@
+#include "qplatformintegration_lite.h"
+
+QT_BEGIN_NAMESPACE
+
+QBlittable *QPlatformIntegration::createBlittable(const QSize &) const
+{ return 0; }
+
+QPixmap QPlatformIntegration::grabWindow(WId window, int x, int y, int width, int height) const
+{
+ Q_UNUSED(window);
+ Q_UNUSED(x);
+ Q_UNUSED(y);
+ Q_UNUSED(width);
+ Q_UNUSED(height);
+ return QPixmap();
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformintegration_lite.h b/src/gui/kernel/qplatformintegration_lite.h
new file mode 100644
index 0000000..543b7bc
--- /dev/null
+++ b/src/gui/kernel/qplatformintegration_lite.h
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** 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 QPLATFORMINTEGRATION_H
+#define QPLATFORMINTEGRATION_H
+
+#include <QtGui/private/qgraphicssystem_p.h>
+#include <QtGui/qplatformscreen_lite.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Gui)
+
+class Q_GUI_EXPORT QPlatformIntegration
+{
+public:
+ virtual ~QPlatformIntegration() { };
+
+// GraphicsSystem functions
+ virtual QPixmapData *createPixmapData(QPixmapData::PixelType type) const = 0;
+ virtual QWindowSurface *createWindowSurface(QWidget *widget) const = 0;
+ virtual QBlittable *createBlittable(const QSize &size) const;
+
+// Window System functions
+ virtual QList<QPlatformScreen *> screens() const = 0;
+ virtual QPixmap grabWindow(WId window, int x, int y, int width, int height) const;
+};
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QPLATFORMINTEGRATION_H
diff --git a/src/gui/kernel/qplatformintegrationfactory_lite.cpp b/src/gui/kernel/qplatformintegrationfactory_lite.cpp
new file mode 100644
index 0000000..7f650e9
--- /dev/null
+++ b/src/gui/kernel/qplatformintegrationfactory_lite.cpp
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** 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 "qplatformintegrationfactory_lite_p.h"
+#include <QPlatformIntegrationPlugin>
+#include "private/qfactoryloader_p.h"
+#include "qmutex.h"
+
+#include "qapplication.h"
+#include "qdebug.h"
+
+QT_BEGIN_NAMESPACE
+
+#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
+Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
+ (QPlatformIntegrationFactoryInterface_iid, QLatin1String("/platforms"), Qt::CaseInsensitive))
+#endif
+
+QPlatformIntegration *QPlatformIntegrationFactory::create(const QString& key)
+{
+ QPlatformIntegration *ret = 0;
+ QString platform = key.toLower();
+
+ qDebug() << loader()->keys();
+#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
+ if (QPlatformIntegrationFactoryInterface *factory = qobject_cast<QPlatformIntegrationFactoryInterface*>(loader()->instance(platform)))
+ ret = factory->create(platform);
+#endif
+
+ return ret;
+}
+
+/*!
+ Returns the list of valid keys, i.e. the keys this factory can
+ create styles for.
+
+ \sa create()
+*/
+QStringList QPlatformIntegrationFactory::keys()
+{
+#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
+ QStringList list = loader()->keys();
+#else
+ QStringList list;
+#endif
+ return list;
+}
+
+QT_END_NAMESPACE
+
diff --git a/src/gui/kernel/qplatformintegrationfactory_lite_p.h b/src/gui/kernel/qplatformintegrationfactory_lite_p.h
new file mode 100644
index 0000000..ba02d2c
--- /dev/null
+++ b/src/gui/kernel/qplatformintegrationfactory_lite_p.h
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** 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 QPLATFORMINTEGRATIONFACTORY_H
+#define QPLATFORMINTEGRATIONFACTORY_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qstringlist.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Gui)
+
+class QPlatformIntegration;
+
+class QPlatformIntegrationFactory
+{
+public:
+ static QStringList keys();
+ static QPlatformIntegration *create(const QString&);
+};
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QPLATFORMINTEGRATIONFACTORY_H
+
diff --git a/src/gui/kernel/qplatformintegrationplugin_lite.cpp b/src/gui/kernel/qplatformintegrationplugin_lite.cpp
new file mode 100644
index 0000000..cb1ed83
--- /dev/null
+++ b/src/gui/kernel/qplatformintegrationplugin_lite.cpp
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** 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 "qplatformintegrationplugin_lite.h"
+
+QT_BEGIN_NAMESPACE
+
+QPlatformIntegrationPlugin::QPlatformIntegrationPlugin(QObject *parent)
+ : QObject(parent)
+{
+}
+
+QPlatformIntegrationPlugin::~QPlatformIntegrationPlugin()
+{
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformintegrationplugin_lite.h b/src/gui/kernel/qplatformintegrationplugin_lite.h
new file mode 100644
index 0000000..0e116f2
--- /dev/null
+++ b/src/gui/kernel/qplatformintegrationplugin_lite.h
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** 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 QPLATFORMINTEGRATIONPLUGIN_H
+#define QPLATFORMINTEGRATIONPLUGIN_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qplugin.h>
+#include <QtCore/qfactoryinterface.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Gui)
+
+class QPlatformIntegration;
+
+struct QPlatformIntegrationFactoryInterface : public QFactoryInterface
+{
+ virtual QPlatformIntegration *create(const QString &key) = 0;
+};
+
+#define QPlatformIntegrationFactoryInterface_iid "com.nokia.Qt.QPlatformIntegrationFactoryInterface"
+
+Q_DECLARE_INTERFACE(QPlatformIntegrationFactoryInterface, QPlatformIntegrationFactoryInterface_iid)
+
+class Q_GUI_EXPORT QPlatformIntegrationPlugin : public QObject, public QPlatformIntegrationFactoryInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(QPlatformIntegrationFactoryInterface:QFactoryInterface)
+public:
+ explicit QPlatformIntegrationPlugin(QObject *parent = 0);
+ ~QPlatformIntegrationPlugin();
+
+ virtual QStringList keys() const = 0;
+ virtual QPlatformIntegration *create(const QString &key) = 0;
+};
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QPLATFORMINTEGRATIONPLUGIN_H
diff --git a/src/gui/kernel/qplatformscreen_lite.cpp b/src/gui/kernel/qplatformscreen_lite.cpp
new file mode 100644
index 0000000..f2ea2f8
--- /dev/null
+++ b/src/gui/kernel/qplatformscreen_lite.cpp
@@ -0,0 +1,15 @@
+#include "qplatformscreen_lite.h"
+
+QWidget *QPlatformScreen::topLevelAt(const QPoint & pos) const
+{
+ QWidgetList list = QApplication::topLevelWidgets();
+ for (int i = list.size()-1; i >= 0; --i) {
+ QWidget *w = list[i];
+ //### mask is ignored
+ if (w != QApplication::desktop() && w->isVisible() && w->geometry().contains(pos))
+ return w;
+ }
+
+ return 0;
+}
+
diff --git a/src/gui/kernel/qplatformscreen_lite.h b/src/gui/kernel/qplatformscreen_lite.h
new file mode 100644
index 0000000..ef90dee
--- /dev/null
+++ b/src/gui/kernel/qplatformscreen_lite.h
@@ -0,0 +1,31 @@
+#ifndef QPLATFORMSCREEN_H
+#define QPLATFORMSCREEN_H
+
+#include <QtCore/qrect.h>
+#include <QtGui/qimage.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Gui)
+
+class Q_GUI_EXPORT QPlatformScreen
+{
+public:
+ virtual ~QPlatformScreen() { }
+
+ virtual QRect geometry() const = 0;
+ virtual QRect availableGeometry() const {return geometry();};
+ virtual int depth() const = 0;
+ virtual QImage::Format format() const = 0;
+ virtual QSize physicalSize() const = 0;
+ virtual void setDirty(const QRect &) {}
+ virtual QWidget *topLevelAt(const QPoint &point) const;
+};
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QPLATFORMSCREEN_H
diff --git a/src/gui/kernel/qwidget_lite.cpp b/src/gui/kernel/qwidget_lite.cpp
index bcbcd82..add5592 100644
--- a/src/gui/kernel/qwidget_lite.cpp
+++ b/src/gui/kernel/qwidget_lite.cpp
@@ -51,7 +51,7 @@
#include <QGraphicsSystemCursor>
QT_BEGIN_NAMESPACE
-static QGraphicsSystemScreen *qt_screenForWidget(const QWidget *w);
+static QPlatformScreen *qt_screenForWidget(const QWidget *w);
void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool /*destroyOldWindow*/)
{
@@ -535,7 +535,7 @@ void QWidgetPrivate::scroll_sys(int dx, int dy, const QRect &r)
scrollRect(r, dx, dy);
}
-static QGraphicsSystemScreen *qt_screenForWidget(const QWidget *w)
+static QPlatformScreen *qt_screenForWidget(const QWidget *w)
{
if (!w)
return 0;
@@ -544,12 +544,8 @@ static QGraphicsSystemScreen *qt_screenForWidget(const QWidget *w)
frame.moveTopLeft(w->mapToGlobal(QPoint(0, 0)));
const QPoint p = (frame.topLeft() + frame.bottomRight()) / 2;
- QGraphicsSystem *gs = QApplicationPrivate::graphicsSystem();
- if (!gs) {
- qWarning("qt_screenForWidget: no graphics system");
- return 0;
- }
- QList<QGraphicsSystemScreen *> screens = gs->screens();
+ QPlatformIntegration *pi = QApplicationPrivate::platformIntegration();
+ QList<QPlatformScreen *> screens = pi->screens();
for (int i = 0; i < screens.size(); ++i) {
if (screens[i]->geometry().contains(p))
@@ -569,7 +565,7 @@ int QWidget::metric(PaintDeviceMetric m) const
{
Q_D(const QWidget);
- QGraphicsSystemScreen *screen = qt_screenForWidget(this);
+ QPlatformScreen *screen = qt_screenForWidget(this);
if (!screen) {
if (m == PdmDpiX || m == PdmDpiY)
return 72;
diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h
index fee7e75..70b2830 100644
--- a/src/gui/kernel/qwindowsysteminterface.h
+++ b/src/gui/kernel/qwindowsysteminterface.h
@@ -41,14 +41,18 @@
#ifndef QWINDOWSYSTEMINTERFACE_H
#define QWINDOWSYSTEMINTERFACE_H
-#include <QTime>
-#include <qwindowdefs.h>
-#include <QEvent>
-#include <QWidget>
-#include <QWeakPointer>
+#include <QtCore/QTime>
+#include <QtGui/qwindowdefs.h>
+#include <QtCore/QEvent>
+#include <QtGui/QWidget>
+#include <QtCore/QWeakPointer>
+
+QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
+QT_MODULE(Gui)
+
class Q_GUI_EXPORT QWindowSystemInterface
{
public:
@@ -129,5 +133,7 @@ public:
static QWindowSystemInterface::UserEvent * getUserEvent() { return userEventQueue.takeFirst(); }
static void queueUserEvent(QWindowSystemInterface::UserEvent *ev) { userEventQueue.append(ev); }
};
+
QT_END_NAMESPACE
+QT_END_HEADER
#endif // QWINDOWSYSTEMINTERFACE_H