diff options
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qapplication.cpp | 28 | ||||
-rw-r--r-- | src/gui/kernel/qapplication.h | 4 | ||||
-rw-r--r-- | src/gui/kernel/qapplication_p.h | 3 | ||||
-rw-r--r-- | src/gui/kernel/qapplication_s60.cpp | 24 | ||||
-rw-r--r-- | src/gui/kernel/qapplication_win.cpp | 53 | ||||
-rw-r--r-- | src/gui/kernel/qguifunctions_wince.cpp | 5 | ||||
-rw-r--r-- | src/gui/kernel/qmime_mac.cpp | 4 |
7 files changed, 82 insertions, 39 deletions
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 35a9559..3605472 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -3426,7 +3426,35 @@ QString QApplication::sessionKey() const } #endif +/*! + \since 4.7.4 + \fn void QApplication::aboutToReleaseGpuResources() + + This signal is emitted when application is about to release all + GPU resources associated to contexts owned by application. + + The signal is particularly useful if your application has allocated + GPU resources directly apart from Qt and needs to do some last-second + cleanup. + + \warning This signal is only emitted on Symbian. + + \sa aboutToUseGpuResources() +*/ +/*! + \since 4.7.4 + \fn void QApplication::aboutToUseGpuResources() + + This signal is emitted when application is about to use GPU resources. + + The signal is particularly useful if your application needs to know + when GPU resources are be available. + + \warning This signal is only emitted on Symbian. + + \sa aboutToFreeGpuResources() +*/ /*! \since 4.2 diff --git a/src/gui/kernel/qapplication.h b/src/gui/kernel/qapplication.h index 1548849..3334056 100644 --- a/src/gui/kernel/qapplication.h +++ b/src/gui/kernel/qapplication.h @@ -305,6 +305,10 @@ Q_SIGNALS: void commitDataRequest(QSessionManager &sessionManager); void saveStateRequest(QSessionManager &sessionManager); #endif +#ifdef Q_OS_SYMBIAN + void aboutToReleaseGpuResources(); + void aboutToUseGpuResources(); +#endif public: QString styleSheet() const; diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index 0756d6c..c4cb19c 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -564,6 +564,9 @@ public: void symbianHandleLiteModeStartup(); void _q_aboutToQuit(); + + void emitAboutToReleaseGpuResources(); + void emitAboutToUseGpuResources(); #endif #if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) || defined(Q_WS_MAC) || defined(Q_WS_QPA) void sendSyntheticEnterLeave(QWidget *widget); diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 9acf429..46b16cb 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -239,6 +239,9 @@ void QS60Data::controlVisibilityChanged(CCoeControl *control, bool visible) if (QTLWExtra *topData = qt_widget_private(window)->maybeTopData()) { QWidgetBackingStoreTracker &backingStore = topData->backingStore; if (visible) { + QApplicationPrivate *d = QApplicationPrivate::instance(); + d->emitAboutToUseGpuResources(); + if (backingStore.data()) { backingStore.registerWidget(widget); } else { @@ -248,6 +251,9 @@ void QS60Data::controlVisibilityChanged(CCoeControl *control, bool visible) widget->repaint(); } } else { + QApplicationPrivate *d = QApplicationPrivate::instance(); + d->emitAboutToReleaseGpuResources(); + // In certain special scenarios we may get an ENotVisible event // without a previous EPartiallyVisible. The backingstore must // still be destroyed, hence the registerWidget() call below. @@ -2875,6 +2881,24 @@ void QApplicationPrivate::_q_aboutToQuit() #endif } +void QApplicationPrivate::emitAboutToReleaseGpuResources() +{ +#ifdef Q_SYMBIAN_SUPPORTS_SURFACES + Q_Q(QApplication); + QPointer<QApplication> guard(q); + emit q->aboutToReleaseGpuResources(); +#endif +} + +void QApplicationPrivate::emitAboutToUseGpuResources() +{ +#ifdef Q_SYMBIAN_SUPPORTS_SURFACES + Q_Q(QApplication); + QPointer<QApplication> guard(q); + emit q->aboutToUseGpuResources(); +#endif +} + QS60ThreadLocalData::QS60ThreadLocalData() { CCoeEnv *env = CCoeEnv::Static(); diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index c472738..19e7ba5 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -218,9 +218,9 @@ static bool aygResolved = false; static void resolveAygLibs() { if (!aygResolved) { - aygResolved = true; QSystemLibrary ayglib(QLatin1String("aygshell")); ptrRecognizeGesture = (AygRecognizeGesture) ayglib.resolve("SHRecognizeGesture"); + aygResolved = true; } } #endif // QT_NO_GESTURES @@ -854,19 +854,15 @@ void qt_init(QApplicationPrivate *priv, int) qt_win_initialize_directdraw(); #ifndef Q_OS_WINCE - ptrUpdateLayeredWindowIndirect = - (PtrUpdateLayeredWindowIndirect) QSystemLibrary::resolve(QLatin1String("user32"), - "UpdateLayeredWindowIndirect"); - ptrUpdateLayeredWindow = - (PtrUpdateLayeredWindow) QSystemLibrary::resolve(QLatin1String("user32"), - "UpdateLayeredWindow"); + QSystemLibrary user32(QLatin1String("user32")); + ptrUpdateLayeredWindowIndirect = (PtrUpdateLayeredWindowIndirect)user32.resolve("UpdateLayeredWindowIndirect"); + ptrUpdateLayeredWindow = (PtrUpdateLayeredWindow)user32.resolve("UpdateLayeredWindow"); if (ptrUpdateLayeredWindow && !ptrUpdateLayeredWindowIndirect) ptrUpdateLayeredWindowIndirect = qt_updateLayeredWindowIndirect; // Notify Vista and Windows 7 that we support highter DPI settings - ptrSetProcessDPIAware = (PtrSetProcessDPIAware) - QSystemLibrary::resolve(QLatin1String("user32"), "SetProcessDPIAware"); + ptrSetProcessDPIAware = (PtrSetProcessDPIAware)user32.resolve("SetProcessDPIAware"); if (ptrSetProcessDPIAware) ptrSetProcessDPIAware(); #endif @@ -886,29 +882,16 @@ void qt_init(QApplicationPrivate *priv, int) priv->GetGestureExtraArgs = (PtrGetGestureExtraArgs) &TKGetGestureExtraArguments; #elif !defined(Q_WS_WINCE) #if !defined(QT_NO_NATIVE_GESTURES) - priv->GetGestureInfo = - (PtrGetGestureInfo)QSystemLibrary::resolve(QLatin1String("user32"), - "GetGestureInfo"); - priv->GetGestureExtraArgs = - (PtrGetGestureExtraArgs)QSystemLibrary::resolve(QLatin1String("user32"), - "GetGestureExtraArgs"); - priv->CloseGestureInfoHandle = - (PtrCloseGestureInfoHandle)QSystemLibrary::resolve(QLatin1String("user32"), - "CloseGestureInfoHandle"); - priv->SetGestureConfig = - (PtrSetGestureConfig)QSystemLibrary::resolve(QLatin1String("user32"), - "SetGestureConfig"); - priv->GetGestureConfig = - (PtrGetGestureConfig)QSystemLibrary::resolve(QLatin1String("user32"), - "GetGestureConfig"); + priv->GetGestureInfo = (PtrGetGestureInfo)user32.resolve("GetGestureInfo"); + priv->GetGestureExtraArgs = (PtrGetGestureExtraArgs)user32.resolve("GetGestureExtraArgs"); + priv->CloseGestureInfoHandle = (PtrCloseGestureInfoHandle)user32.resolve("CloseGestureInfoHandle"); + priv->SetGestureConfig = (PtrSetGestureConfig)user32.resolve("SetGestureConfig"); + priv->GetGestureConfig = (PtrGetGestureConfig)user32.resolve("GetGestureConfig"); #endif // QT_NO_NATIVE_GESTURES QSystemLibrary libTheme(QLatin1String("uxtheme")); - priv->BeginPanningFeedback = - (PtrBeginPanningFeedback)libTheme.resolve("BeginPanningFeedback"); - priv->UpdatePanningFeedback = - (PtrUpdatePanningFeedback)libTheme.resolve("UpdatePanningFeedback"); - priv->EndPanningFeedback = - (PtrEndPanningFeedback)libTheme.resolve("EndPanningFeedback"); + priv->BeginPanningFeedback = (PtrBeginPanningFeedback)libTheme.resolve("BeginPanningFeedback"); + priv->UpdatePanningFeedback = (PtrUpdatePanningFeedback)libTheme.resolve("UpdatePanningFeedback"); + priv->EndPanningFeedback = (PtrEndPanningFeedback)libTheme.resolve("EndPanningFeedback"); #endif #endif // QT_NO_GESTURES } @@ -2388,15 +2371,14 @@ extern "C" LRESULT QT_WIN_CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wPa break; } +#if !defined(Q_OS_WINCE) typedef LRESULT (WINAPI *PtrLresultFromObject)(REFIID, WPARAM, LPUNKNOWN); static PtrLresultFromObject ptrLresultFromObject = 0; static bool oleaccChecked = false; - if (!oleaccChecked) { + QSystemLibrary oleacclib(QLatin1String("oleacc")); + ptrLresultFromObject = (PtrLresultFromObject)oleacclib.resolve("LresultFromObject"); oleaccChecked = true; -#if !defined(Q_OS_WINCE) - ptrLresultFromObject = (PtrLresultFromObject)QSystemLibrary::resolve(QLatin1String("oleacc"), "LresultFromObject"); -#endif } if (ptrLresultFromObject) { QAccessibleInterface *acc = QAccessible::queryAccessibleInterface(widget); @@ -2413,6 +2395,7 @@ extern "C" LRESULT QT_WIN_CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wPa if (res > 0) RETURN(res); } +#endif } result = false; break; @@ -3198,8 +3181,8 @@ bool QETWidget::translateMouseEvent(const MSG &msg) if (curWin != 0) { if (!trackMouseEventLookup) { - trackMouseEventLookup = true; ptrTrackMouseEvent = (PtrTrackMouseEvent)QSystemLibrary::resolve(QLatin1String("comctl32"), "_TrackMouseEvent"); + trackMouseEventLookup = true; } if (ptrTrackMouseEvent && !qApp->d_func()->inPopupMode()) { // We always have to set the tracking, since diff --git a/src/gui/kernel/qguifunctions_wince.cpp b/src/gui/kernel/qguifunctions_wince.cpp index 78dc469..ae2ca04 100644 --- a/src/gui/kernel/qguifunctions_wince.cpp +++ b/src/gui/kernel/qguifunctions_wince.cpp @@ -125,17 +125,16 @@ static AygInitDialog ptrAygInitDialog = 0; static AygFullScreen ptrAygFullScreen = 0; static AygSHSipInfo ptrAygSHSipInfo = 0; static AygSHDoneButton ptrAygSHDoneButton = 0; -static bool aygResolved = false; - static void resolveAygLibs() { + static bool aygResolved = false; if (!aygResolved) { - aygResolved = true; QLibrary ayglib(QLatin1String("aygshell")); ptrAygInitDialog = (AygInitDialog) ayglib.resolve("SHInitDialog"); ptrAygFullScreen = (AygFullScreen) ayglib.resolve("SHFullScreen"); ptrAygSHSipInfo = (AygSHSipInfo) ayglib.resolve("SHSipInfo"); ptrAygSHDoneButton = (AygSHDoneButton) ayglib.resolve("SHDoneButton"); + aygResolved = true; } } diff --git a/src/gui/kernel/qmime_mac.cpp b/src/gui/kernel/qmime_mac.cpp index 8b47d8e..e92bd49 100644 --- a/src/gui/kernel/qmime_mac.cpp +++ b/src/gui/kernel/qmime_mac.cpp @@ -520,13 +520,15 @@ static PtrGraphicsExportDoExport ptrGraphicsExportDoExport = 0; static bool resolveMimeQuickTimeSymbols() { - if (ptrGraphicsImportSetDataHandle == 0) { + static bool triedResolve = false; + if (!triedResolve) { QLibrary library(QLatin1String("/System/Library/Frameworks/QuickTime.framework/QuickTime")); ptrGraphicsImportSetDataHandle = reinterpret_cast<PtrGraphicsImportSetDataHandle>(library.resolve("GraphicsImportSetDataHandle")); ptrGraphicsImportCreateCGImage = reinterpret_cast<PtrGraphicsImportCreateCGImage>(library.resolve("GraphicsImportCreateCGImage")); ptrGraphicsExportSetInputCGImage = reinterpret_cast<PtrGraphicsExportSetInputCGImage>(library.resolve("GraphicsExportSetInputCGImage")); ptrGraphicsExportSetOutputHandle = reinterpret_cast<PtrGraphicsExportSetOutputHandle>(library.resolve("GraphicsExportSetOutputHandle")); ptrGraphicsExportDoExport = reinterpret_cast<PtrGraphicsExportDoExport>(library.resolve("GraphicsExportDoExport")); + triedResolve = true; } return ptrGraphicsImportSetDataHandle != 0 |