diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-05-27 22:23:19 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-05-27 22:23:19 (GMT) |
commit | 0c10a281065c8733516393bcaf532e8d12404861 (patch) | |
tree | f643cf34ca306c7cb5a78dc0a29b4f63950476eb /src/gui/kernel | |
parent | f79ea0ecc9ebca896340babd370638a6cf607419 (diff) | |
parent | 016b89d07478c91617ad345a0b3d7f16d0f8cd21 (diff) | |
download | Qt-0c10a281065c8733516393bcaf532e8d12404861.zip Qt-0c10a281065c8733516393bcaf532e8d12404861.tar.gz Qt-0c10a281065c8733516393bcaf532e8d12404861.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-s60-public into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-s60-public:
Fix the compilation for tst_qabstractprintdialog and tst_qprinter on symbian.
Make link on linux/symbian
Fix double slashes on few data caging paths
Fix for QRuntimePixmapData serial number setting.
Enable QTouchEvent for S60 5.0
Add missing license header.
Fix build error on S60 3.1 environments
QRuntimeGraphicsSystem
Fix replacement functions in platform_paths.prf
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qapplication.cpp | 13 | ||||
-rw-r--r-- | src/gui/kernel/qapplication_s60.cpp | 98 | ||||
-rw-r--r-- | src/gui/kernel/qt_s60_p.h | 2 | ||||
-rw-r--r-- | src/gui/kernel/qwidget.cpp | 9 |
4 files changed, 112 insertions, 10 deletions
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 0d11b27..3d4bf5d 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -70,6 +70,10 @@ #include "qmessagebox.h" #include <QtGui/qgraphicsproxywidget.h> +#ifdef QT_GRAPHICSSYSTEM_RUNTIME +#include "private/qgraphicssystem_runtime_p.h" +#endif + #include "qinputcontext.h" #include "qkeymapper_p.h" @@ -1566,7 +1570,14 @@ QStyle* QApplication::setStyle(const QString& style) void QApplication::setGraphicsSystem(const QString &system) { - QApplicationPrivate::graphics_system_name = system; +#ifdef QT_GRAPHICSSYSTEM_RUNTIME + if (QApplicationPrivate::graphics_system_name == QLatin1String("runtime")) { + QRuntimeGraphicsSystem *r = + static_cast<QRuntimeGraphicsSystem *>(QApplicationPrivate::graphics_system); + r->setGraphicsSystem(system); + } else +#endif + QApplicationPrivate::graphics_system_name = system; } /*! diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index dc8d8f7..7e270aa 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -62,6 +62,10 @@ #include "qpaintengine.h" #include "private/qmenubar_p.h" #include "private/qsoftkeymanager_p.h" +#ifdef QT_GRAPHICSSYSTEM_RUNTIME +#include "private/qgraphicssystem_runtime_p.h" +#endif + #include "apgwgnam.h" // For CApaWindowGroupName #include <mdaaudiotoneplayer.h> // For CMdaAudioToneUtility @@ -83,6 +87,10 @@ QT_BEGIN_NAMESPACE +// Goom Events through Window Server +static const int KGoomMemoryLowEvent = 0x10282DBF; +static const int KGoomMemoryGoodEvent = 0x20026790; + #if defined(QT_DEBUG) static bool appNoGrab = false; // Grabbing enabled #endif @@ -408,32 +416,44 @@ void QSymbianControl::HandleLongTapEventL( const TPoint& aPenEventLocation, cons void QSymbianControl::translateAdvancedPointerEvent(const TAdvancedPointerEvent *event) { QApplicationPrivate *d = QApplicationPrivate::instance(); + QPointF screenPos = qwidget->mapToGlobal(QPoint(event->iPosition.iX, event->iPosition.iY)); qreal pressure; if(d->pressureSupported && event->Pressure() > 0) //workaround for misconfigured HAL pressure = event->Pressure() / qreal(d->maxTouchPressure); else pressure = qreal(1.0); + processTouchEvent(event->PointerNumber(), event->iType, screenPos, pressure); +} +#endif +void QSymbianControl::processTouchEvent(int pointerNumber, TPointerEvent::TType type, QPointF screenPos, qreal pressure) +{ QRect screenGeometry = qApp->desktop()->screenGeometry(qwidget); + QApplicationPrivate *d = QApplicationPrivate::instance(); + QList<QTouchEvent::TouchPoint> points = d->appAllTouchPoints; - while (points.count() <= event->PointerNumber()) + while (points.count() <= pointerNumber) points.append(QTouchEvent::TouchPoint(points.count())); Qt::TouchPointStates allStates = 0; for (int i = 0; i < points.count(); ++i) { QTouchEvent::TouchPoint &touchPoint = points[i]; - if (touchPoint.id() == event->PointerNumber()) { + if (touchPoint.id() == pointerNumber) { Qt::TouchPointStates state; - switch (event->iType) { + switch (type) { case TPointerEvent::EButton1Down: +#ifdef QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER case TPointerEvent::EEnterHighPressure: +#endif state = Qt::TouchPointPressed; break; case TPointerEvent::EButton1Up: +#ifdef QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER case TPointerEvent::EExitCloseProximity: +#endif state = Qt::TouchPointReleased; break; case TPointerEvent::EDrag: @@ -444,11 +464,10 @@ void QSymbianControl::translateAdvancedPointerEvent(const TAdvancedPointerEvent state = Qt::TouchPointStationary; break; } - if (event->PointerNumber() == 0) + if (pointerNumber == 0) state |= Qt::TouchPointPrimary; touchPoint.setState(state); - QPointF screenPos = qwidget->mapToGlobal(QPoint(event->iPosition.iX, event->iPosition.iY)); touchPoint.setScreenPos(screenPos); touchPoint.setNormalizedPos(QPointF(screenPos.x() / screenGeometry.width(), screenPos.y() / screenGeometry.height())); @@ -473,7 +492,6 @@ void QSymbianControl::translateAdvancedPointerEvent(const TAdvancedPointerEvent QTouchEvent::TouchScreen, points); } -#endif void QSymbianControl::HandlePointerEventL(const TPointerEvent& pEvent) { @@ -547,6 +565,13 @@ void QSymbianControl::HandlePointerEvent(const TPointerEvent& pEvent) qt_symbian_move_cursor_sprite(); #endif +//Generate single touch event for S60 5.0 (has touchscreen, does not have advanced pointers) +#ifndef QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER + if (S60->hasTouchscreen) { + processTouchEvent(0, pEvent.iType, QPointF(globalPos), 1.0); + } +#endif + sendMouseEvent(receiver, type, globalPos, button, modifiers); } @@ -931,7 +956,16 @@ void QSymbianControl::Draw(const TRect& controlRect) const const TRect backingStoreRect(TPoint(backingStoreBase.x(), backingStoreBase.y()), controlRect.Size()); if (engine->type() == QPaintEngine::Raster) { - QS60WindowSurface *s60Surface = static_cast<QS60WindowSurface *>(qwidget->windowSurface()); + QS60WindowSurface *s60Surface; +#ifdef QT_GRAPHICSSYSTEM_RUNTIME + if (QApplicationPrivate::graphics_system_name == QLatin1String("runtime")) { + QRuntimeWindowSurface *rtSurface = + static_cast<QRuntimeWindowSurface*>(qwidget->windowSurface()); + s60Surface = static_cast<QS60WindowSurface *>(rtSurface->m_windowSurface); + } else +#endif + s60Surface = static_cast<QS60WindowSurface *>(qwidget->windowSurface()); + CFbsBitmap *bitmap = s60Surface->symbianBitmap(); CWindowGc &gc = SystemGc(); @@ -1814,6 +1848,53 @@ int QApplicationPrivate::symbianProcessWsEvent(const QSymbianEvent *symbianEvent } #endif break; + case KGoomMemoryLowEvent: +#ifdef QT_DEBUG + qDebug() << "QApplicationPrivate::symbianProcessWsEvent - KGoomMemoryLowEvent"; +#endif + if (callSymbianEventFilters(symbianEvent)) + return 1; +#ifdef QT_GRAPHICSSYSTEM_RUNTIME + if(QApplicationPrivate::graphics_system_name == QLatin1String("runtime")) { + bool switchToSwRendering(false); + + foreach (QWidget *w, QApplication::topLevelWidgets()) { + if(w->d_func()->topData()->backingStore) { + switchToSwRendering = true; + break; + } + } + + if (switchToSwRendering) { + QRuntimeGraphicsSystem *gs = + static_cast<QRuntimeGraphicsSystem*>(QApplicationPrivate::graphics_system); + + uint memoryUsage = gs->memoryUsage(); + uint memoryForFullscreen = ( S60->screenDepth / 8 ) + * S60->screenWidthInPixels + * S60->screenHeightInPixels; + + S60->memoryLimitForHwRendering = memoryUsage - memoryForFullscreen; + gs->setGraphicsSystem(QLatin1String("raster")); + } + } +#endif + break; + case KGoomMemoryGoodEvent: +#ifdef QT_DEBUG + qDebug() << "QApplicationPrivate::symbianProcessWsEvent - KGoomMemoryGoodEvent"; +#endif + if (callSymbianEventFilters(symbianEvent)) + return 1; +#ifdef QT_GRAPHICSSYSTEM_RUNTIME + if(QApplicationPrivate::graphics_system_name == QLatin1String("runtime")) { + QRuntimeGraphicsSystem *gs = + static_cast<QRuntimeGraphicsSystem*>(QApplicationPrivate::graphics_system); + gs->setGraphicsSystem(QLatin1String("openvg"), S60->memoryLimitForHwRendering); + S60->memoryLimitForHwRendering = 0; + } +#endif + break; default: break; } @@ -1996,6 +2077,9 @@ void QApplicationPrivate::initializeMultitouch_sys() pressureSupported = 0; if (HAL::Get(HALData::EPointer3DMaxPressure, maxTouchPressure) != KErrNone) maxTouchPressure = KMaxTInt; +#else + pressureSupported = 0; + maxTouchPressure = KMaxTInt; #endif } diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index f560458..fe3fa57 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -129,6 +129,7 @@ public: int supportsPremultipliedAlpha : 1; int avkonComponentsSupportTransparency : 1; int menuBeingConstructed : 1; + int memoryLimitForHwRendering; QApplication::QS60MainApplicationFactory s60ApplicationFactory; // typedef'ed pointer type static inline void updateScreenSize(); static inline RWsSession& wsSession(); @@ -216,6 +217,7 @@ private: const QPoint &globalPos, Qt::MouseButton button, Qt::KeyboardModifiers modifiers); + void processTouchEvent(int pointerNumber, TPointerEvent::TType type, QPointF screenPos, qreal pressure); void HandleLongTapEventL( const TPoint& aPenEventLocation, const TPoint& aPenEventScreenLocation ); #ifdef QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER void translateAdvancedPointerEvent(const TAdvancedPointerEvent *event); diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 569af42..b5879ae 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -248,9 +248,14 @@ QWidgetPrivate::~QWidgetPrivate() QWindowSurface *QWidgetPrivate::createDefaultWindowSurface() { Q_Q(QWidget); + + QWindowSurface *surface; if (QApplicationPrivate::graphicsSystem()) - return QApplicationPrivate::graphicsSystem()->createWindowSurface(q); - return createDefaultWindowSurface_sys(); + surface = QApplicationPrivate::graphicsSystem()->createWindowSurface(q); + else + surface = createDefaultWindowSurface_sys(); + + return surface; } /*! |