diff options
author | Jørgen Lind <jorgen.lind@nokia.com> | 2010-04-07 16:13:19 +0200 |
---|---|---|
committer | Jørgen Lind <jorgen.lind@nokia.com> | 2010-04-07 16:14:05 +0200 |
commit | c13076a30e5ae3d0f6795261ad00ca1eb73ad0b9 (patch) | |
tree | 081619d235389411f5ba7a16d96e37f477e7b2c0 | |
parent | fcec5d444f1e37e7b53ab503fa46b4d7f7d90b41 (diff) | |
download | qt4-tools-c13076a30e5ae3d0f6795261ad00ca1eb73ad0b9.tar.gz |
Added QPlatformWindow
-rw-r--r-- | src/gui/kernel/kernel.pri | 4 | ||||
-rw-r--r-- | src/gui/kernel/qplatformintegration_lite.h | 2 | ||||
-rw-r--r-- | src/gui/kernel/qplatformwindow_lite.cpp | 72 | ||||
-rw-r--r-- | src/gui/kernel/qplatformwindow_lite.h | 79 | ||||
-rw-r--r-- | src/gui/kernel/qwidget.cpp | 38 | ||||
-rw-r--r-- | src/gui/kernel/qwidget.h | 6 | ||||
-rw-r--r-- | src/gui/kernel/qwidget_lite.cpp | 82 | ||||
-rw-r--r-- | src/gui/kernel/qwidget_p.h | 5 | ||||
-rw-r--r-- | src/gui/painting/painting.pri | 2 | ||||
-rw-r--r-- | src/gui/painting/qbackingstore.cpp | 16 | ||||
-rw-r--r-- | src/gui/painting/qgraphicssystem_lite.cpp | 3 | ||||
-rw-r--r-- | src/gui/painting/qwindowsurface.cpp | 53 | ||||
-rw-r--r-- | src/gui/painting/qwindowsurface_p.h | 16 | ||||
-rw-r--r-- | src/plugins/platforms/minimal/qplatformintegration_minimal.cpp | 7 | ||||
-rw-r--r-- | src/plugins/platforms/minimal/qplatformintegration_minimal.h | 2 | ||||
-rw-r--r-- | src/plugins/platforms/minimal/qwindowsurface_minimal.cpp | 8 | ||||
-rw-r--r-- | src/plugins/platforms/minimal/qwindowsurface_minimal.h | 4 | ||||
-rw-r--r-- | src/plugins/plugins.pro | 2 |
18 files changed, 298 insertions, 103 deletions
diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index cf5ec9289c..049637fadb 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -207,6 +207,7 @@ embedded_lite { kernel/qplatformscreen_lite.h \ kernel/qplatformintegrationfactory_lite_p.h \ kernel/qplatformintegrationplugin_lite.h \ + kernel/qplatformwindow_lite.h SOURCES += \ kernel/qapplication_lite.cpp \ @@ -224,7 +225,8 @@ embedded_lite { kernel/qplatformintegration_lite.cpp \ kernel/qplatformscreen_lite.cpp \ kernel/qplatformintegrationfactory_lite.cpp \ - kernel/qplatformintegrationplugin_lite.cpp + kernel/qplatformintegrationplugin_lite.cpp \ + kernel/qplatformwindow_lite.cpp contains(QT_CONFIG, glib) { SOURCES += \ diff --git a/src/gui/kernel/qplatformintegration_lite.h b/src/gui/kernel/qplatformintegration_lite.h index 9125bd1359..389dcfb79f 100644 --- a/src/gui/kernel/qplatformintegration_lite.h +++ b/src/gui/kernel/qplatformintegration_lite.h @@ -62,7 +62,7 @@ public: // GraphicsSystem functions virtual QPixmapData *createPixmapData(QPixmapData::PixelType type) const = 0; - virtual QWindowSurface *createWindowSurface(QWidget *widget) const = 0; + virtual void createWindowAndSurface(QPlatformWindow **window, QWindowSurface **surface, QWidget *widget, WId winId = 0) const = 0; virtual QBlittable *createBlittable(const QSize &size) const; // Window System functions diff --git a/src/gui/kernel/qplatformwindow_lite.cpp b/src/gui/kernel/qplatformwindow_lite.cpp new file mode 100644 index 0000000000..ff1bf48daa --- /dev/null +++ b/src/gui/kernel/qplatformwindow_lite.cpp @@ -0,0 +1,72 @@ +#include "qplatformwindow_lite.h" + +#include <QtGui/qwidget.h> + +class QPlatformWindowPrivate +{ + QWidget *tlw; + QRect rect; + friend class QPlatformWindow; +}; + +QPlatformWindow::QPlatformWindow(QWidget *tlw) + : d_ptr(new QPlatformWindowPrivate) +{ + Q_D(QPlatformWindow); + d->tlw = tlw; + tlw->setPlatformWindow(this); +} + +QPlatformWindow::~QPlatformWindow() +{ +} + +QWidget *QPlatformWindow::widget() const +{ + Q_D(const QPlatformWindow); + return d->tlw; +} + +void QPlatformWindow::setGeometry(const QRect &rect) +{ + Q_D(QPlatformWindow); + d->rect = rect; +} + +QRect QPlatformWindow::geometry() const +{ + Q_D(const QPlatformWindow); + return d->rect; +} + +/*! +Reimplemented in subclasses to show the surface if \a visible is \c true, and hide it if \a visible is \c false. +*/ +void QPlatformWindow::setVisible(bool visible) +{ + Q_UNUSED(visible); +} +/*! +Requests setting the window flags of this surface to \a type. Returns the actual flags set. +*/ +Qt::WindowFlags QPlatformWindow::setWindowFlags(Qt::WindowFlags flags) +{ + Q_UNUSED(flags); + return Qt::Window; +} + +/*! + Returns the effective window flags for this surface. +*/ +Qt::WindowFlags QPlatformWindow::windowFlags() const +{ + return Qt::Window; +} + +WId QPlatformWindow::winId() const { return WId(0); } + +void QPlatformWindow::setWindowTitle(const QString &) {} + +void QPlatformWindow::raise() { qWarning("This plugin does not support raise()"); } + +void QPlatformWindow::lower() { qWarning("This plugin does not support lower()"); } diff --git a/src/gui/kernel/qplatformwindow_lite.h b/src/gui/kernel/qplatformwindow_lite.h new file mode 100644 index 0000000000..3fa97b5fb2 --- /dev/null +++ b/src/gui/kernel/qplatformwindow_lite.h @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** 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 QPLATFORMWINDOW_H +#define QPLATFORMWINDOW_H + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +#include <QtCore/qscopedpointer.h> + +class QPlatformWindowPrivate; + +class Q_GUI_EXPORT QPlatformWindow +{ + Q_DECLARE_PRIVATE(QPlatformWindow); +public: + QPlatformWindow(QWidget *tlw); + virtual ~QPlatformWindow(); + + QWidget *widget() const; + virtual void setGeometry(const QRect &rect); + virtual QRect geometry() const; + + virtual void setVisible(bool visible); + virtual Qt::WindowFlags setWindowFlags(Qt::WindowFlags flags); + virtual Qt::WindowFlags windowFlags() const; + virtual WId winId() const; + + virtual void setWindowTitle(const QString &); + virtual void raise(); + virtual void lower(); + +protected: + QScopedPointer<QPlatformWindowPrivate> d_ptr; +}; + +QT_END_NAMESPACE + +QT_END_HEADER +#endif //QPLATFORMWINDOW_H diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 3ca7591dc3..4bcec939c9 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -11836,6 +11836,44 @@ QWindowSurface *QWidget::windowSurface() const return bs ? bs->windowSurface : 0; } +/*! + \preliminary + + Sets the window to be the \a window specified. + The QWidget takes ownership of the \a surface. +*/ +void QWidget::setPlatformWindow(QPlatformWindow *window) +{ +#ifndef Q_BACKINGSTORE_SUBSURFACES + if (!isTopLevel()) + return; +#endif + + Q_D(QWidget); + + QTLWExtra *topData = d->topData(); + if (topData->platformWindow == window) + return; + + delete topData->platformWindow; + topData->platformWindow = window; +} + +/*! + \preliminary + + Returns the QPlatformWindow this widget will be drawn into. +*/ +QPlatformWindow *QWidget::platformWindow() const +{ + Q_D(const QWidget); + QTLWExtra *extra = d->maybeTopData(); + if (extra && extra->platformWindow) + return extra->platformWindow; + + return 0; +} + void QWidgetPrivate::getLayoutItemMargins(int *left, int *top, int *right, int *bottom) const { if (left) diff --git a/src/gui/kernel/qwidget.h b/src/gui/kernel/qwidget.h index e12148b97f..7dff703741 100644 --- a/src/gui/kernel/qwidget.h +++ b/src/gui/kernel/qwidget.h @@ -94,6 +94,7 @@ class QHideEvent; class QInputContext; class QIcon; class QWindowSurface; +class QPlatformWindow; class QLocale; class QGraphicsProxyWidget; class QGraphicsEffect; @@ -625,6 +626,11 @@ public: void setWindowSurface(QWindowSurface *surface); QWindowSurface *windowSurface() const; +#if defined(Q_WS_LITE) + void setPlatformWindow(QPlatformWindow *window); + QPlatformWindow *platformWindow() const; +#endif + Q_SIGNALS: void customContextMenuRequested(const QPoint &pos); diff --git a/src/gui/kernel/qwidget_lite.cpp b/src/gui/kernel/qwidget_lite.cpp index add5592ad8..7915d7f112 100644 --- a/src/gui/kernel/qwidget_lite.cpp +++ b/src/gui/kernel/qwidget_lite.cpp @@ -39,26 +39,28 @@ ** ****************************************************************************/ -#include "qwidget.h" -#include "qevent.h" -#include "qapplication.h" -#include "private/qbackingstore_p.h" -#include "private/qwidget_p.h" -#include "private/qgraphicssystem_p.h" -#include "private/qapplication_p.h" -#include "qdesktopwidget.h" - -#include <QGraphicsSystemCursor> +#include "QtGui/qwidget.h" +#include "QtGui/qevent.h" +#include "QtGui/qapplication.h" +#include "QtGui/private/qbackingstore_p.h" +#include "QtGui/private/qwidget_p.h" +#include "QtGui/private/qgraphicssystem_p.h" +#include "QtGui/private/qapplication_p.h" +#include "QtGui/qdesktopwidget.h" +#include "QtGui/qplatformwindow_lite.h" + +#include <QtGui/QGraphicsSystemCursor> QT_BEGIN_NAMESPACE static QPlatformScreen *qt_screenForWidget(const QWidget *w); -void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool /*destroyOldWindow*/) +void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyOldWindow) { Q_Q(QWidget); Q_UNUSED(window); Q_UNUSED(initializeWindow); + Q_UNUSED(destroyOldWindow); // XXX Qt::WindowFlags flags = data.window_flags; @@ -67,15 +69,16 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool /*destro return; // we only care about real toplevels QWindowSurface *surface = q->windowSurface(); + QPlatformWindow *platformWindow = q->platformWindow(); - if (!surface) - surface = createDefaultWindowSurface(); - + if (!surface) { + QApplicationPrivate::platformIntegration()->createWindowAndSurface(&platformWindow,&surface,q); + } Q_ASSERT(surface); - data.window_flags = surface->setWindowFlags(data.window_flags); + data.window_flags = q->platformWindow()->setWindowFlags(data.window_flags); - setWinId(surface->winId()); + setWinId(q->platformWindow()->winId()); // qDebug() << "create_sys" << q << q->internalWinId(); } @@ -119,8 +122,8 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f) if (f & Qt::Window) { //qDebug() << "setParent_sys" << q << newparent << hex << f; - if (QWindowSurface *surface = q->windowSurface()) - data.window_flags = surface->setWindowFlags(data.window_flags); + if (QPlatformWindow *window = q->platformWindow()) + data.window_flags = window->setWindowFlags(data.window_flags); } // XXX Reparenting child to toplevel or vice versa ### if ((f&Qt::Window) && !(oldFlags&Qt::Window)) { @@ -191,8 +194,8 @@ void QWidgetPrivate::setWindowTitle_sys(const QString &caption) if (!q->isWindow()) return; - if (QWindowSurface *surface = q->windowSurface()) - surface->setWindowTitle(caption); + if (QPlatformWindow *window = q->platformWindow()) + window->setWindowTitle(caption); } @@ -299,9 +302,14 @@ void QWidgetPrivate::show_sys() if (QWindowSurface *surface = q->windowSurface()) { const QRect geomRect = q->geometry(); - if (surface->geometry() != geomRect) - surface->setGeometry(geomRect); - surface->setVisible(true); + const QRect windowRect = q->platformWindow()->geometry(); + if (windowRect != geomRect) { + q->platformWindow()->setGeometry(geomRect); + if (windowRect.size() != geomRect.size()) { + surface->resize(geomRect.size()); + } + } + q->platformWindow()->setVisible(true); } if (q->windowType() != Qt::Popup && q->windowType() != Qt::ToolTip && !(q->windowFlags() & Qt::X11BypassWindowManagerHint)) @@ -320,8 +328,8 @@ void QWidgetPrivate::hide_sys() } return; } - if (QWindowSurface *surface = q->windowSurface()) { - surface->setVisible(false); + if (QPlatformWindow *window = q->platformWindow()) { + window->setVisible(false); } //### we don't yet have proper focus event handling @@ -427,8 +435,7 @@ void QWidgetPrivate::raise_sys() { Q_Q(QWidget); if (q->isWindow()) { - QWindowSurface *surface = q->windowSurface(); - surface->raise(); + q->platformWindow()->raise(); } } @@ -437,8 +444,7 @@ void QWidgetPrivate::lower_sys() Q_Q(QWidget); if (q->isWindow()) { Q_ASSERT(q->testAttribute(Qt::WA_WState_Created)); - QWindowSurface *surface = q->windowSurface(); - surface->lower(); + q->platformWindow()->lower(); } else if (QWidget *p = q->parentWidget()) { setDirtyOpaqueRegion(); p->d_func()->invalidateBuffer(effectiveRectFor(q->geometry())); @@ -491,8 +497,11 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove) if (q->isWindow()) { const QWidgetBackingStore *bs = maybeBackingStore(); - if (bs->windowSurface) - bs->windowSurface->setGeometry(q->frameGeometry()); + if (bs->windowSurface) { + q->platformWindow()->setGeometry(q->frameGeometry()); + if (isResize) + bs->windowSurface->resize(r.size()); + } } else { if (isMove && !isResize) moveRect(QRect(oldPos, olds), x - oldPos.x(), y - oldPos.y()); @@ -653,16 +662,7 @@ QPaintEngine *QWidget::paintEngine() const QWindowSurface *QWidgetPrivate::createDefaultWindowSurface_sys() { - Q_Q(QWidget); - if (q->windowType() == Qt::Desktop) - return 0; - q->ensurePolished(); - - QGraphicsSystem *gs = QApplicationPrivate::graphicsSystem(); - if (!gs) - return 0; - - return gs->createWindowSurface(q); + qFatal("CreateDefaultWindowSurface_sys should not be used on lighthouse"); } void QWidgetPrivate::setModal_sys() diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index 0f34ae05f2..4ca493ee1f 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -102,6 +102,9 @@ class QWSManager; #if defined(Q_WS_MAC) class QCoreGraphicsPaintEnginePrivate; #endif +#if defined(Q_WS_LITE) +class QPlatformWindow; +#endif class QPaintEngine; class QPixmap; class QWidgetBackingStore; @@ -176,6 +179,8 @@ struct QTLWExtra { #endif #elif defined(Q_OS_SYMBIAN) uint inExpose : 1; // Prevents drawing recursion +#elif defined(Q_WS_LITE) + QPlatformWindow *platformWindow; #endif }; diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index c4e8f7a1dc..972bac201e 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -117,7 +117,7 @@ embedded { SOURCES += \ painting/qgraphicssystem_qws.cpp \ -} else { +} else: if(!embedded_lite) { HEADERS += \ painting/qgraphicssystem_raster_p.h \ painting/qgraphicssystemfactory_p.h \ diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp index f2cd7e6139..30c042e953 100644 --- a/src/gui/painting/qbackingstore.cpp +++ b/src/gui/painting/qbackingstore.cpp @@ -286,7 +286,11 @@ bool QWidgetBackingStore::bltRect(const QRect &rect, int dx, int dy, QWidget *wi void QWidgetBackingStore::releaseBuffer() { if (windowSurface) +#if defined(Q_WS_LITE) + windowSurface->resize(QSize()); +#else windowSurface->setGeometry(QRect()); +#endif #ifdef Q_BACKINGSTORE_SUBSURFACES for (int i = 0; i < subSurfaces.size(); ++i) subSurfaces.at(i)->setGeometry(QRect()); @@ -415,6 +419,7 @@ void QWidgetBackingStore::endPaint(const QRegion &cleaned, QWindowSurface *windo QRegion QWidgetBackingStore::dirtyRegion(QWidget *widget) const { const bool widgetDirty = widget && widget != tlw; +#if !defined(Q_WS_LITE) const QRect tlwRect(topLevelRect()); const QRect surfaceGeometry(windowSurface->geometry()); if (surfaceGeometry != tlwRect && surfaceGeometry.size() != tlwRect.size()) { @@ -426,6 +431,7 @@ QRegion QWidgetBackingStore::dirtyRegion(QWidget *widget) const } return QRect(QPoint(), tlwRect.size()); } +#endif // Calculate the region that needs repaint. QRegion r(dirty); @@ -467,7 +473,11 @@ QRegion QWidgetBackingStore::dirtyRegion(QWidget *widget) const QRegion QWidgetBackingStore::staticContents(QWidget *parent, const QRect &withinClipRect) const { if (!parent && tlw->testAttribute(Qt::WA_StaticContents)) { +#if defined(Q_WS_LITE) + const QSize surfaceGeometry(windowSurface->size()); +#else const QRect surfaceGeometry(windowSurface->geometry()); +#endif QRect surfaceRect(0, 0, surfaceGeometry.width(), surfaceGeometry.height()); if (!withinClipRect.isEmpty()) surfaceRect &= withinClipRect; @@ -1144,11 +1154,12 @@ void QWidgetBackingStore::sync() return; } - const bool inTopLevelResize = tlwExtra->inTopLevelResize; const bool updatesDisabled = !tlw->updatesEnabled(); + bool repaintAllWidgets = false; +#if !defined(Q_WS_LITE) + const bool inTopLevelResize = tlwExtra->inTopLevelResize; const QRect tlwRect(topLevelRect()); const QRect surfaceGeometry(windowSurface->geometry()); - bool repaintAllWidgets = false; if (inTopLevelResize || surfaceGeometry != tlwRect) { if ((inTopLevelResize || surfaceGeometry.size() != tlwRect.size()) && !updatesDisabled) { @@ -1171,6 +1182,7 @@ void QWidgetBackingStore::sync() } windowSurface->setGeometry(tlwRect); } +#endif if (updatesDisabled) return; diff --git a/src/gui/painting/qgraphicssystem_lite.cpp b/src/gui/painting/qgraphicssystem_lite.cpp index 42e723862b..a62abbb409 100644 --- a/src/gui/painting/qgraphicssystem_lite.cpp +++ b/src/gui/painting/qgraphicssystem_lite.cpp @@ -51,7 +51,8 @@ QPixmapData *QLiteGraphicsSystem::createPixmapData(QPixmapData::PixelType type) QWindowSurface *QLiteGraphicsSystem::createWindowSurface(QWidget *widget) const { - return QApplicationPrivate::platformIntegration()->createWindowSurface(widget); + qFatal("should not use QLiteGraphicsSystem::createWindowSurface"); + return 0; } QBlittable *QLiteGraphicsSystem::createBlittable(const QSize &size) const diff --git a/src/gui/painting/qwindowsurface.cpp b/src/gui/painting/qwindowsurface.cpp index 34c2936047..20594c40a4 100644 --- a/src/gui/painting/qwindowsurface.cpp +++ b/src/gui/painting/qwindowsurface.cpp @@ -52,7 +52,11 @@ public: QWindowSurfacePrivate(QWidget *w) : window(w), staticContentsSupport(false) {} QWidget *window; +#if !defined(Q_WS_LITE) QRect geometry; +#else + QSize size; +#endif //Q_WS_LITE QRegion staticContents; QList<QImage*> bufferImages; bool staticContentsSupport; @@ -144,6 +148,7 @@ void QWindowSurface::endPaint(const QRegion &) d_ptr->bufferImages.clear(); } +#if !defined(Q_WS_LITE) /*! Sets the currently allocated area to be the given \a rect. @@ -164,6 +169,17 @@ QRect QWindowSurface::geometry() const { return d_ptr->geometry; } +#else +void QWindowSurface::resize(const QSize &size) +{ + d_ptr->size = size; +} + +QSize QWindowSurface::size() const +{ + return d_ptr->size; +} +#endif //Q_WS_LITE /*! Scrolls the given \a area \a dx pixels to the right and \a dy @@ -349,41 +365,4 @@ void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset) } } - -#ifdef Q_WS_LITE -/*! -Requests setting the window flags of this surface to \a type. Returns the actual flags set. -*/ -Qt::WindowFlags QWindowSurface::setWindowFlags(Qt::WindowFlags type) -{ - Q_UNUSED(type); - qDebug() << "QWindowSurface::setWindowFlags" << hex << type; - return Qt::Window; -} - -/*! - Returns the effective window flags for this surface. -*/ -Qt::WindowFlags QWindowSurface::windowFlags() const -{ - return Qt::Window; -} - -/*! -Reimplemented in subclasses to show the surface if \a visible is \c true, and hide it if \a visible is \c false. -*/ - -void QWindowSurface::setVisible(bool visible) -{ - Q_UNUSED(visible); -} - - -WId QWindowSurface::winId() const -{ - return WId(0); -} - -#endif - QT_END_NAMESPACE diff --git a/src/gui/painting/qwindowsurface_p.h b/src/gui/painting/qwindowsurface_p.h index 5930704e0c..3a14b0f29f 100644 --- a/src/gui/painting/qwindowsurface_p.h +++ b/src/gui/painting/qwindowsurface_p.h @@ -63,6 +63,7 @@ class QRect; class QPoint; class QImage; class QWindowSurfacePrivate; +class QPlatformWindow; class Q_GUI_EXPORT QWindowSurface { @@ -75,8 +76,13 @@ public: virtual QPaintDevice *paintDevice() = 0; virtual void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) = 0; +#if !defined(Q_WS_LITE) virtual void setGeometry(const QRect &rect); QRect geometry() const; +#else + virtual void resize(const QSize &size); + QSize size() const; +#endif virtual bool scroll(const QRegion &area, int dx, int dy); @@ -89,16 +95,6 @@ public: virtual QPoint offset(const QWidget *widget) const; inline QRect rect(const QWidget *widget) const; -#ifdef Q_WS_LITE - virtual void setVisible(bool visible); - virtual Qt::WindowFlags setWindowFlags(Qt::WindowFlags type); - virtual Qt::WindowFlags windowFlags() const; - virtual WId winId() const; - - virtual void setWindowTitle(const QString &) {} - virtual void raise() { qWarning("This plugin does not support raise()"); } - virtual void lower() { qWarning("This plugin does not support lower()"); } -#endif bool hasStaticContentsSupport() const; void setStaticContents(const QRegion ®ion); diff --git a/src/plugins/platforms/minimal/qplatformintegration_minimal.cpp b/src/plugins/platforms/minimal/qplatformintegration_minimal.cpp index 693e0c3270..2f0312706f 100644 --- a/src/plugins/platforms/minimal/qplatformintegration_minimal.cpp +++ b/src/plugins/platforms/minimal/qplatformintegration_minimal.cpp @@ -2,6 +2,7 @@ #include "qwindowsurface_minimal.h" #include <QtGui/private/qpixmap_raster_p.h> +#include <QtGui/QPlatformWindow> QMinimalIntegration::QMinimalIntegration() { @@ -19,7 +20,9 @@ QPixmapData *QMinimalIntegration::createPixmapData(QPixmapData::PixelType type) { return new QRasterPixmapData(type); } -QWindowSurface *QMinimalIntegration::createWindowSurface(QWidget *widget) const +void QMinimalIntegration::createWindowAndSurface(QPlatformWindow**window, QWindowSurface**surface, QWidget *widget, WId winId) const { - return new QMinimalWindowSurface(widget); + qDebug() << "createWindow"; + *surface = new QMinimalWindowSurface(widget); + *window = new QPlatformWindow(widget); } diff --git a/src/plugins/platforms/minimal/qplatformintegration_minimal.h b/src/plugins/platforms/minimal/qplatformintegration_minimal.h index d4eb78b456..127c5730c3 100644 --- a/src/plugins/platforms/minimal/qplatformintegration_minimal.h +++ b/src/plugins/platforms/minimal/qplatformintegration_minimal.h @@ -72,7 +72,7 @@ public: QMinimalIntegration(); QPixmapData *createPixmapData(QPixmapData::PixelType type) const; - QWindowSurface *createWindowSurface(QWidget *widget) const; + void createWindowAndSurface(QPlatformWindow**window, QWindowSurface**surface, QWidget *widget, WId winId) const; QList<QPlatformScreen *> screens() const { return mScreens; } diff --git a/src/plugins/platforms/minimal/qwindowsurface_minimal.cpp b/src/plugins/platforms/minimal/qwindowsurface_minimal.cpp index 0b2bdd2fef..2f8b1f0c54 100644 --- a/src/plugins/platforms/minimal/qwindowsurface_minimal.cpp +++ b/src/plugins/platforms/minimal/qwindowsurface_minimal.cpp @@ -73,13 +73,13 @@ void QMinimalWindowSurface::flush(QWidget *widget, const QRegion ®ion, const mImage.save(filename); } -void QMinimalWindowSurface::setGeometry(const QRect &rect) +void QMinimalWindowSurface::resize(const QSize &size) { //qDebug() << "QMinimalWindowSurface::setGeometry:" << (long)this << rect; - QWindowSurface::setGeometry(rect); + QWindowSurface::resize(size); QImage::Format format = QApplicationPrivate::platformIntegration()->screens().first()->format(); - if (mImage.size() != rect.size()) - mImage = QImage(rect.size(), format); + if (mImage.size() != size) + mImage = QImage(size, format); } QT_END_NAMESPACE diff --git a/src/plugins/platforms/minimal/qwindowsurface_minimal.h b/src/plugins/platforms/minimal/qwindowsurface_minimal.h index 959a73140c..96f989db36 100644 --- a/src/plugins/platforms/minimal/qwindowsurface_minimal.h +++ b/src/plugins/platforms/minimal/qwindowsurface_minimal.h @@ -44,6 +44,8 @@ #include <QtGui/private/qwindowsurface_p.h> +#include <QtGui/QPlatformWindow> + QT_BEGIN_NAMESPACE class QMinimalWindowSurface : public QWindowSurface @@ -54,7 +56,7 @@ public: QPaintDevice *paintDevice(); void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); - void setGeometry(const QRect &rect); + void resize(const QSize &size); private: QImage mImage; diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro index 730fdc5332..73ab3e9104 100644 --- a/src/plugins/plugins.pro +++ b/src/plugins/plugins.pro @@ -6,7 +6,7 @@ unix:!symbian { } else { SUBDIRS *= codecs } -!embedded:SUBDIRS *= graphicssystems +!embedded:!embedded-lite:SUBDIRS *= graphicssystems embedded:SUBDIRS *= gfxdrivers decorations mousedrivers kbddrivers !win32:!embedded:!mac:!symbian:SUBDIRS *= inputmethods symbian:SUBDIRS += s60 |