diff options
Diffstat (limited to 'src/gui/kernel/qapplication_s60.cpp')
-rw-r--r-- | src/gui/kernel/qapplication_s60.cpp | 98 |
1 files changed, 91 insertions, 7 deletions
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 } |