diff options
Diffstat (limited to 'src/gui/kernel')
31 files changed, 269 insertions, 40 deletions
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 6caa7ee..72e5c58 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -185,8 +185,10 @@ QApplicationPrivate::QApplicationPrivate(int &argc, char **argv, QApplication::T directPainters = 0; #endif +#ifndef QT_NO_GESTURES gestureManager = 0; gestureWidget = 0; +#endif // QT_NO_GESTURES #if defined(Q_WS_X11) || defined(Q_WS_WIN) move_cursor = 0; @@ -3711,6 +3713,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) #endif // !QT_NO_WHEELEVENT || !QT_NO_TABLETEVENT } +#ifndef QT_NO_GESTURES // walk through parents and check for gestures if (d->gestureManager) { switch (e->type()) { @@ -3755,7 +3758,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) } } } - +#endif // QT_NO_GESTURES // User input and window activation makes tooltips sleep switch (e->type()) { @@ -4260,6 +4263,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) res = d->notify_helper(receiver, e); break; +#ifndef QT_NO_GESTURES case QEvent::NativeGesture: { // only propagate the first gesture event (after the GID_BEGIN) @@ -4338,6 +4342,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) } break; } +#endif // QT_NO_GESTURES default: res = d->notify_helper(receiver, e); break; @@ -5770,6 +5775,7 @@ Q_GUI_EXPORT void qt_translateRawTouchEvent(QWidget *window, QApplicationPrivate::translateRawTouchEvent(window, deviceType, touchPoints); } +#ifndef QT_NO_GESTURES QGestureManager* QGestureManager::instance() { QApplicationPrivate *qAppPriv = QApplicationPrivate::instance(); @@ -5777,6 +5783,7 @@ QGestureManager* QGestureManager::instance() qAppPriv->gestureManager = new QGestureManager(qApp); return qAppPriv->gestureManager; } +#endif // QT_NO_GESTURES // These pixmaps approximate the images in the Windows User Interface Guidelines. diff --git a/src/gui/kernel/qapplication.h b/src/gui/kernel/qapplication.h index f93f24a..3613f95 100644 --- a/src/gui/kernel/qapplication.h +++ b/src/gui/kernel/qapplication.h @@ -399,7 +399,9 @@ private: friend class QDirectPainter; friend class QDirectPainterPrivate; #endif +#ifndef QT_NO_GESTURES friend class QGestureManager; +#endif #if defined(Q_WS_MAC) || defined(Q_WS_X11) Q_PRIVATE_SLOT(d_func(), void _q_alertTimeOut()) diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index 9a5714b..97ceea9 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -84,7 +84,9 @@ class QInputContext; class QObject; class QWidget; class QSocketNotifier; +#ifndef QT_NO_GESTURES class QGestureManager; +#endif extern bool qt_is_gui_used; #ifndef QT_NO_CLIPBOARD @@ -200,6 +202,7 @@ typedef BOOL (WINAPI *PtrRegisterTouchWindow)(HWND, ULONG); typedef BOOL (WINAPI *PtrGetTouchInputInfo)(HANDLE, UINT, PVOID, int); typedef BOOL (WINAPI *PtrCloseTouchInputHandle)(HANDLE); +#ifndef QT_NO_GESTURES typedef BOOL (WINAPI *PtrGetGestureInfo)(HANDLE, PVOID); typedef BOOL (WINAPI *PtrGetGestureExtraArgs)(HANDLE, UINT, PBYTE); typedef BOOL (WINAPI *PtrCloseGestureInfoHandle)(HANDLE); @@ -263,6 +266,8 @@ typedef struct tagGESTURECONFIG #define GID_ROLLOVER 0xf003 #endif +#endif // QT_NO_GESTURES + #endif // Q_WS_WIN class QScopedLoopLevelCounter @@ -517,6 +522,7 @@ public: void sendSyntheticEnterLeave(QWidget *widget); #endif +#ifndef QT_NO_GESTURES QGestureManager *gestureManager; QWidget *gestureWidget; #if defined(Q_WS_X11) || defined(Q_WS_WIN) @@ -524,6 +530,7 @@ public: QPixmap *copy_cursor; QPixmap *link_cursor; #endif +#endif #if defined(Q_WS_WIN) QPixmap *ignore_cursor; #endif @@ -552,6 +559,7 @@ public: QHash<DWORD, int> touchInputIDToTouchPointID; bool translateTouchEvent(const MSG &msg); +#ifndef QT_NO_GESTURES PtrGetGestureInfo GetGestureInfo; PtrGetGestureExtraArgs GetGestureExtraArgs; PtrCloseGestureInfoHandle CloseGestureInfoHandle; @@ -560,6 +568,7 @@ public: PtrBeginPanningFeedback BeginPanningFeedback; PtrUpdatePanningFeedback UpdatePanningFeedback; PtrEndPanningFeedback EndPanningFeedback; +#endif // QT_NO_GESTURES #endif #ifdef QT_RX71_MULTITOUCH diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 82c3545..9f47112 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -1032,6 +1032,9 @@ void QSymbianControl::SizeChanged() qwidget->d_func()->syncBackingStore(); if (!slowResize && tlwExtra) tlwExtra->inTopLevelResize = false; + } else { + QResizeEvent *e = new QResizeEvent(newSize, oldSize); + QApplication::postEvent(qwidget, e); } } @@ -1800,19 +1803,27 @@ int QApplicationPrivate::symbianProcessWsEvent(const QSymbianEvent *symbianEvent return 1; const TWsVisibilityChangedEvent *visChangedEvent = event->VisibilityChanged(); QWidget *w = QWidgetPrivate::mapper->value(control); - if (!w->d_func()->maybeTopData()) + QWidget *const window = w->window(); + if (!window->d_func()->maybeTopData()) break; + QRefCountedWidgetBackingStore &backingStore = window->d_func()->maybeTopData()->backingStore; if (visChangedEvent->iFlags & TWsVisibilityChangedEvent::ENotVisible) { - delete w->d_func()->topData()->backingStore; - w->d_func()->topData()->backingStore = 0; + // Decrement backing store reference count + backingStore.deref(); // In order to ensure that any resources used by the window surface // are immediately freed, we flush the WSERV command buffer. S60->wsSession().Flush(); - } else if ((visChangedEvent->iFlags & TWsVisibilityChangedEvent::EPartiallyVisible) - && !w->d_func()->maybeBackingStore()) { - w->d_func()->topData()->backingStore = new QWidgetBackingStore(w); - w->d_func()->invalidateBuffer(w->rect()); - w->repaint(); + } else if (visChangedEvent->iFlags & TWsVisibilityChangedEvent::EPartiallyVisible) { + if (backingStore.data()) { + // Increment backing store reference count + backingStore.ref(); + } else { + // Create backing store with an initial reference count of 1 + backingStore.create(window); + backingStore.ref(); + w->d_func()->invalidateBuffer(w->rect()); + w->repaint(); + } } return 1; } diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index d2ce5ff..e10a6b0 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -52,9 +52,11 @@ extern void qt_wince_hide_taskbar(HWND hwnd); //defined in qguifunctions_wince.c #include <windowsm.h> #include <tpcshell.h> #ifdef QT_WINCE_GESTURES +#ifndef QT_NO_GESTURES #include <gesture.h> #endif #endif +#endif #include "qapplication.h" #include "qdesktopwidget.h" @@ -198,6 +200,7 @@ struct SHRGINFO { #define SPI_SETSIPINFO 224 #endif +#ifndef QT_NO_GESTURES typedef DWORD (API *AygRecognizeGesture)(SHRGINFO*); static AygRecognizeGesture ptrRecognizeGesture = 0; static bool aygResolved = false; @@ -209,6 +212,7 @@ static void resolveAygLibs() ptrRecognizeGesture = (AygRecognizeGesture) ayglib.resolve("SHRecognizeGesture"); } } +#endif // QT_NO_GESTURES #endif @@ -461,7 +465,9 @@ public: bool translateConfigEvent(const MSG &msg); bool translateCloseEvent(const MSG &msg); bool translateTabletEvent(const MSG &msg, PACKET *localPacketBuf, int numPackets); +#ifndef QT_NO_GESTURES bool translateGestureEvent(const MSG &msg, const GESTUREINFO &gi); +#endif void repolishStyle(QStyle &style); inline void showChildren(bool spontaneous) { d_func()->showChildren(spontaneous); } inline void hideChildren(bool spontaneous) { d_func()->hideChildren(spontaneous); } @@ -841,6 +847,7 @@ void qt_init(QApplicationPrivate *priv, int) ptrSetProcessDPIAware(); #endif +#ifndef QT_NO_GESTURES priv->GetGestureInfo = 0; priv->GetGestureExtraArgs = 0; priv->CloseGestureInfoHandle = 0; @@ -881,6 +888,7 @@ void qt_init(QApplicationPrivate *priv, int) (PtrEndPanningFeedback)QLibrary::resolve(QLatin1String("uxtheme"), "EndPanningFeedback"); #endif +#endif // QT_NO_GESTURES } /***************************************************************************** @@ -1540,7 +1548,7 @@ extern "C" LRESULT QT_WIN_CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wPa case WM_SETTINGCHANGE: #ifdef Q_WS_WINCE // CE SIP hide/show - if (wParam == SPI_SETSIPINFO) { + if (qt_desktopWidget && wParam == SPI_SETSIPINFO) { QResizeEvent re(QSize(0, 0), QSize(0, 0)); // Calculated by QDesktopWidget QApplication::sendEvent(qt_desktopWidget, &re); break; @@ -1665,12 +1673,14 @@ extern "C" LRESULT QT_WIN_CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wPa shrg.ptDown.y = GET_Y_LPARAM(lParam); shrg.dwFlags = SHRG_RETURNCMD | SHRG_NOANIMATION; resolveAygLibs(); +#ifndef QT_NO_GESTURES if (ptrRecognizeGesture && (ptrRecognizeGesture(&shrg) == GN_CONTEXTMENU)) { if (QApplication::activePopupWidget()) QApplication::activePopupWidget()->close(); QContextMenuEvent e(QContextMenuEvent::Mouse, pos, globalPos); result = qt_sendSpontaneousEvent(alienWidget, &e); } +#endif // QT_NO_GESTURES } } } @@ -2554,6 +2564,7 @@ extern "C" LRESULT QT_WIN_CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wPa } result = false; break; +#ifndef QT_NO_GESTURES #if !defined(Q_WS_WINCE) || defined(QT_WINCE_GESTURES) case WM_GESTURE: { GESTUREINFO gi; @@ -2588,6 +2599,7 @@ extern "C" LRESULT QT_WIN_CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wPa break; } #endif // !defined(Q_WS_WINCE) || defined(QT_WINCE_GESTURES) +#endif // QT_NO_GESTURES #ifndef QT_NO_CURSOR case WM_SETCURSOR: { QCursor *ovr = QApplication::overrideCursor(); @@ -3821,6 +3833,7 @@ bool QETWidget::translateCloseEvent(const MSG &) return d_func()->close_helper(QWidgetPrivate::CloseWithSpontaneousEvent); } +#ifndef QT_NO_GESTURES bool QETWidget::translateGestureEvent(const MSG &, const GESTUREINFO &gi) { const QPoint widgetPos = QPoint(gi.ptsLocation.x, gi.ptsLocation.y); @@ -3859,7 +3872,7 @@ bool QETWidget::translateGestureEvent(const MSG &, const GESTUREINFO &gi) qt_sendSpontaneousEvent(widget, &event); return true; } - +#endif // QT_NO_GESTURES void QApplication::setCursorFlashTime(int msecs) { diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp index b2dc638..9d5a7c0 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/gui/kernel/qapplication_x11.cpp @@ -5264,7 +5264,7 @@ bool QETWidget::translateConfigEvent(const XEvent *event) if (isVisible() && data->crect.size() != oldSize) { Q_ASSERT(d->extra->topextra); - QWidgetBackingStore *bs = d->extra->topextra->backingStore; + QWidgetBackingStore *bs = d->extra->topextra->backingStore.data(); const bool hasStaticContents = bs && bs->hasStaticContents(); // If we have a backing store with static contents, we have to disable the top-level // resize optimization in order to get invalidated regions for resized widgets. diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index 86c4025..772016a 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -952,12 +952,14 @@ static int qCocoaViewCount = 0; if (!QApplicationPrivate::tryModalHelper(qwidget, 0)) return; +#ifndef QT_NO_GESTURES QNativeGestureEvent qNGEvent; qNGEvent.gestureType = QNativeGestureEvent::Zoom; NSPoint p = [[event window] convertBaseToScreen:[event locationInWindow]]; qNGEvent.position = flipPoint(p).toPoint(); qNGEvent.percentage = [event magnification]; qt_sendSpontaneousEvent(qwidget, &qNGEvent); +#endif // QT_NO_GESTURES } - (void)rotateWithEvent:(NSEvent *)event; @@ -965,12 +967,14 @@ static int qCocoaViewCount = 0; if (!QApplicationPrivate::tryModalHelper(qwidget, 0)) return; +#ifndef QT_NO_GESTURES QNativeGestureEvent qNGEvent; qNGEvent.gestureType = QNativeGestureEvent::Rotate; NSPoint p = [[event window] convertBaseToScreen:[event locationInWindow]]; qNGEvent.position = flipPoint(p).toPoint(); qNGEvent.percentage = -[event rotation]; qt_sendSpontaneousEvent(qwidget, &qNGEvent); +#endif // QT_NO_GESTURES } - (void)swipeWithEvent:(NSEvent *)event; @@ -978,6 +982,7 @@ static int qCocoaViewCount = 0; if (!QApplicationPrivate::tryModalHelper(qwidget, 0)) return; +#ifndef QT_NO_GESTURES QNativeGestureEvent qNGEvent; qNGEvent.gestureType = QNativeGestureEvent::Swipe; NSPoint p = [[event window] convertBaseToScreen:[event locationInWindow]]; @@ -991,6 +996,7 @@ static int qCocoaViewCount = 0; else if ([event deltaY] == -1) qNGEvent.angle = 270.0f; qt_sendSpontaneousEvent(qwidget, &qNGEvent); +#endif // QT_NO_GESTURES } - (void)beginGestureWithEvent:(NSEvent *)event; @@ -998,11 +1004,13 @@ static int qCocoaViewCount = 0; if (!QApplicationPrivate::tryModalHelper(qwidget, 0)) return; +#ifndef QT_NO_GESTURES QNativeGestureEvent qNGEvent; qNGEvent.gestureType = QNativeGestureEvent::GestureBegin; NSPoint p = [[event window] convertBaseToScreen:[event locationInWindow]]; qNGEvent.position = flipPoint(p).toPoint(); qt_sendSpontaneousEvent(qwidget, &qNGEvent); +#endif // QT_NO_GESTURES } - (void)endGestureWithEvent:(NSEvent *)event; @@ -1010,11 +1018,13 @@ static int qCocoaViewCount = 0; if (!QApplicationPrivate::tryModalHelper(qwidget, 0)) return; +#ifndef QT_NO_GESTURES QNativeGestureEvent qNGEvent; qNGEvent.gestureType = QNativeGestureEvent::GestureEnd; NSPoint p = [[event window] convertBaseToScreen:[event locationInWindow]]; qNGEvent.position = flipPoint(p).toPoint(); qt_sendSpontaneousEvent(qwidget, &qNGEvent); +#endif // QT_NO_GESTURES } - (void)frameDidChange:(NSNotification *)note diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 055c127..f75495a 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -3421,9 +3421,11 @@ QDebug operator<<(QDebug dbg, const QEvent *e) { case QEvent::ChildRemoved: n = n ? n : "ChildRemoved"; dbg.nospace() << "QChildEvent(" << n << ", " << (static_cast<const QChildEvent*>(e))->child(); return dbg.space(); +#ifndef QT_NO_GESTURES case QEvent::Gesture: n = "Gesture"; break; +#endif default: dbg.nospace() << "QEvent(" << (const void *)e << ", type = " << e->type() << ')'; return dbg.space(); @@ -4254,6 +4256,7 @@ QTouchEvent::TouchPoint &QTouchEvent::TouchPoint::operator=(const QTouchEvent::T return *this; } +#ifndef QT_NO_GESTURES /*! \class QGestureEvent \since 4.6 @@ -4558,4 +4561,6 @@ const QGestureEventPrivate *QGestureEvent::d_func() const */ #endif +#endif // QT_NO_GESTURES + QT_END_NAMESPACE diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index 90242fe..9c70c02 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -62,7 +62,9 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) class QAction; +#ifndef QT_NO_GESTURES class QGesture; +#endif class Q_GUI_EXPORT QInputEvent : public QEvent { @@ -824,6 +826,7 @@ protected: friend class QApplicationPrivate; }; +#ifndef QT_NO_GESTURES class QGesture; class QGestureEventPrivate; class Q_GUI_EXPORT QGestureEvent : public QEvent @@ -875,6 +878,7 @@ private: friend class QApplication; friend class QGestureManager; }; +#endif // QT_NO_GESTURES QT_END_NAMESPACE diff --git a/src/gui/kernel/qevent_p.h b/src/gui/kernel/qevent_p.h index 5c94a23..e323aa9 100644 --- a/src/gui/kernel/qevent_p.h +++ b/src/gui/kernel/qevent_p.h @@ -120,6 +120,7 @@ public: qreal pressure; }; +#ifndef QT_NO_GESTURES class QNativeGestureEvent : public QEvent { public: @@ -164,7 +165,7 @@ public: QMap<Qt::GestureType, bool> accepted; QMap<Qt::GestureType, QWidget *> targetWidgets; }; - +#endif // QT_NO_GESTURES class QFileOpenEventPrivate { diff --git a/src/gui/kernel/qeventdispatcher_mac.mm b/src/gui/kernel/qeventdispatcher_mac.mm index 0d93b9f..e26fbde 100644 --- a/src/gui/kernel/qeventdispatcher_mac.mm +++ b/src/gui/kernel/qeventdispatcher_mac.mm @@ -492,6 +492,7 @@ static bool IsMouseOrKeyEvent( NSEvent* event ) case NSOtherMouseDown: case NSOtherMouseUp: case NSOtherMouseDragged: +#ifndef QT_NO_GESTURES #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 case NSEventTypeGesture: // touch events case NSEventTypeMagnify: @@ -500,6 +501,7 @@ static bool IsMouseOrKeyEvent( NSEvent* event ) case NSEventTypeBeginGesture: case NSEventTypeEndGesture: #endif +#endif // QT_NO_GESTURES result = true; break; diff --git a/src/gui/kernel/qgesture.cpp b/src/gui/kernel/qgesture.cpp index 49bdea7..f5688f4 100644 --- a/src/gui/kernel/qgesture.cpp +++ b/src/gui/kernel/qgesture.cpp @@ -42,6 +42,8 @@ #include "qgesture.h" #include "private/qgesture_p.h" +#ifndef QT_NO_GESTURES + QT_BEGIN_NAMESPACE /*! @@ -725,3 +727,5 @@ void QTapAndHoldGesture::setPosition(const QPointF &value) } QT_END_NAMESPACE + +#endif // QT_NO_GESTURES diff --git a/src/gui/kernel/qgesture.h b/src/gui/kernel/qgesture.h index c9bdce6..8c10895 100644 --- a/src/gui/kernel/qgesture.h +++ b/src/gui/kernel/qgesture.h @@ -49,6 +49,8 @@ #include <QtCore/qrect.h> #include <QtCore/qmetatype.h> +#ifndef QT_NO_GESTURES + QT_BEGIN_HEADER Q_DECLARE_METATYPE(Qt::GestureState) @@ -258,4 +260,6 @@ QT_END_NAMESPACE Q_DECLARE_METATYPE(QGesture::GestureCancelPolicy) QT_END_HEADER +#endif // QT_NO_GESTURES + #endif // QGESTURE_H diff --git a/src/gui/kernel/qgesture_p.h b/src/gui/kernel/qgesture_p.h index bf60f97..f5474c1 100644 --- a/src/gui/kernel/qgesture_p.h +++ b/src/gui/kernel/qgesture_p.h @@ -59,6 +59,8 @@ #include "qelapsedtimer.h" #include "private/qobject_p.h" +#ifndef QT_NO_GESTURES + QT_BEGIN_NAMESPACE class QGesturePrivate : public QObjectPrivate @@ -179,4 +181,6 @@ public: QT_END_NAMESPACE +#endif // QT_NO_GESTURES + #endif // QGESTURE_P_H diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp index 43facef..2af031b 100644 --- a/src/gui/kernel/qgesturemanager.cpp +++ b/src/gui/kernel/qgesturemanager.cpp @@ -66,6 +66,8 @@ # define DEBUG qDebug #endif +#ifndef QT_NO_GESTURES + QT_BEGIN_NAMESPACE QGestureManager::QGestureManager(QObject *parent) @@ -684,6 +686,7 @@ void QGestureManager::recycle(QGesture *gesture) if (recognizer) { gesture->setGestureCancelPolicy(QGesture::CancelNone); recognizer->reset(gesture); + m_activeGestures.remove(gesture); } else { cleanupGesturesForRemovedRecognizer(gesture); } @@ -691,4 +694,6 @@ void QGestureManager::recycle(QGesture *gesture) QT_END_NAMESPACE +#endif // QT_NO_GESTURES + #include "moc_qgesturemanager_p.cpp" diff --git a/src/gui/kernel/qgesturemanager_p.h b/src/gui/kernel/qgesturemanager_p.h index c452f49..747cb1a 100644 --- a/src/gui/kernel/qgesturemanager_p.h +++ b/src/gui/kernel/qgesturemanager_p.h @@ -58,6 +58,8 @@ #include "private/qwidget_p.h" #include "qgesturerecognizer.h" +#ifndef QT_NO_GESTURES + QT_BEGIN_NAMESPACE class QBasicTimer; @@ -143,4 +145,6 @@ private: QT_END_NAMESPACE +#endif // QT_NO_GESTURES + #endif // QGESTUREMANAGER_P_H diff --git a/src/gui/kernel/qgesturerecognizer.cpp b/src/gui/kernel/qgesturerecognizer.cpp index 9dcca17..3e23bbf 100644 --- a/src/gui/kernel/qgesturerecognizer.cpp +++ b/src/gui/kernel/qgesturerecognizer.cpp @@ -44,6 +44,8 @@ #include "private/qgesture_p.h" #include "private/qgesturemanager_p.h" +#ifndef QT_NO_GESTURES + QT_BEGIN_NAMESPACE /*! @@ -231,3 +233,5 @@ void QGestureRecognizer::unregisterRecognizer(Qt::GestureType type) } QT_END_NAMESPACE + +#endif // QT_NO_GESTURES diff --git a/src/gui/kernel/qgesturerecognizer.h b/src/gui/kernel/qgesturerecognizer.h index 3e17c99..5afb43f 100644 --- a/src/gui/kernel/qgesturerecognizer.h +++ b/src/gui/kernel/qgesturerecognizer.h @@ -45,6 +45,8 @@ #include <QtCore/qglobal.h> #include <QtCore/qnamespace.h> +#ifndef QT_NO_GESTURES + QT_BEGIN_HEADER QT_BEGIN_NAMESPACE @@ -95,4 +97,6 @@ QT_END_NAMESPACE QT_END_HEADER +#endif // QT_NO_GESTURES + #endif // QGESTURERECOGNIZER_H diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp index b038fde..562227a 100644 --- a/src/gui/kernel/qkeysequence.cpp +++ b/src/gui/kernel/qkeysequence.cpp @@ -439,6 +439,10 @@ static const struct { { Qt::Key_MediaPrevious, QT_TRANSLATE_NOOP("QShortcut", "Media Previous") }, { Qt::Key_MediaNext, QT_TRANSLATE_NOOP("QShortcut", "Media Next") }, { Qt::Key_MediaRecord, QT_TRANSLATE_NOOP("QShortcut", "Media Record") }, + //: Media player pause button + { Qt::Key_MediaPause, QT_TRANSLATE_NOOP("QShortcut", "Media Pause") }, + //: Media player button to toggle between playing and paused + { Qt::Key_MediaTogglePlayPause, QT_TRANSLATE_NOOP("QShortcut", "Toggle Media Play/Pause") }, { Qt::Key_HomePage, QT_TRANSLATE_NOOP("QShortcut", "Home Page") }, { Qt::Key_Favorites, QT_TRANSLATE_NOOP("QShortcut", "Favorites") }, { Qt::Key_Search, QT_TRANSLATE_NOOP("QShortcut", "Search") }, @@ -575,13 +579,25 @@ static const struct { // -------------------------------------------------------------- // Device keys - { Qt::Key_Context1, QT_TRANSLATE_NOOP("QShortcut", "Context1") }, - { Qt::Key_Context2, QT_TRANSLATE_NOOP("QShortcut", "Context2") }, - { Qt::Key_Context3, QT_TRANSLATE_NOOP("QShortcut", "Context3") }, - { Qt::Key_Context4, QT_TRANSLATE_NOOP("QShortcut", "Context4") }, - { Qt::Key_Call, QT_TRANSLATE_NOOP("QShortcut", "Call") }, - { Qt::Key_Hangup, QT_TRANSLATE_NOOP("QShortcut", "Hangup") }, - { Qt::Key_Flip, QT_TRANSLATE_NOOP("QShortcut", "Flip") }, + { Qt::Key_Context1, QT_TRANSLATE_NOOP("QShortcut", "Context1") }, + { Qt::Key_Context2, QT_TRANSLATE_NOOP("QShortcut", "Context2") }, + { Qt::Key_Context3, QT_TRANSLATE_NOOP("QShortcut", "Context3") }, + { Qt::Key_Context4, QT_TRANSLATE_NOOP("QShortcut", "Context4") }, + //: Button to start a call (note: a separate button is used to end the call) + { Qt::Key_Call, QT_TRANSLATE_NOOP("QShortcut", "Call") }, + //: Button to end a call (note: a separate button is used to start the call) + { Qt::Key_Hangup, QT_TRANSLATE_NOOP("QShortcut", "Hangup") }, + //: Button that will hang up if we're in call, or make a call if we're not. + { Qt::Key_ToggleCallHangup, QT_TRANSLATE_NOOP("QShortcut", "Toggle Call/Hangup") }, + { Qt::Key_Flip, QT_TRANSLATE_NOOP("QShortcut", "Flip") }, + //: Button to trigger voice dialling + { Qt::Key_VoiceDial, QT_TRANSLATE_NOOP("QShortcut", "Voice Dial") }, + //: Button to redial the last number called + { Qt::Key_LastNumberRedial, QT_TRANSLATE_NOOP("QShortcut", "Last Number Redial") }, + //: Button to trigger the camera shutter (take a picture) + { Qt::Key_Camera, QT_TRANSLATE_NOOP("QShortcut", "Camera Shutter") }, + //: Button to focus the camera + { Qt::Key_CameraFocus, QT_TRANSLATE_NOOP("QShortcut", "Camera Focus") }, // -------------------------------------------------------------- // Japanese keyboard support diff --git a/src/gui/kernel/qmacgesturerecognizer_mac.mm b/src/gui/kernel/qmacgesturerecognizer_mac.mm index fba839b..0ccbb52 100644 --- a/src/gui/kernel/qmacgesturerecognizer_mac.mm +++ b/src/gui/kernel/qmacgesturerecognizer_mac.mm @@ -47,6 +47,8 @@ #include "qwidget.h" #include "qdebug.h" +#ifndef QT_NO_GESTURES + QT_BEGIN_NAMESPACE QMacSwipeGestureRecognizer::QMacSwipeGestureRecognizer() @@ -260,3 +262,5 @@ void QMacPanGestureRecognizer::reset(QGesture *gesture) #endif // QT_MAC_USE_COCOA QT_END_NAMESPACE + +#endif // QT_NO_GESTURES diff --git a/src/gui/kernel/qmacgesturerecognizer_mac_p.h b/src/gui/kernel/qmacgesturerecognizer_mac_p.h index dd8a150..f48c160 100644 --- a/src/gui/kernel/qmacgesturerecognizer_mac_p.h +++ b/src/gui/kernel/qmacgesturerecognizer_mac_p.h @@ -57,6 +57,8 @@ #include "qpoint.h" #include "qgesturerecognizer.h" +#ifndef QT_NO_GESTURES + QT_BEGIN_NAMESPACE class QMacSwipeGestureRecognizer : public QGestureRecognizer @@ -99,4 +101,6 @@ private: QT_END_NAMESPACE +#endif // QT_NO_GESTURES + #endif // QMACSWIPEGESTURERECOGNIZER_MAC_P_H diff --git a/src/gui/kernel/qstandardgestures.cpp b/src/gui/kernel/qstandardgestures.cpp index a575717..6960838 100644 --- a/src/gui/kernel/qstandardgestures.cpp +++ b/src/gui/kernel/qstandardgestures.cpp @@ -47,6 +47,8 @@ #include "qabstractscrollarea.h" #include "qdebug.h" +#ifndef QT_NO_GESTURES + QT_BEGIN_NAMESPACE QPanGestureRecognizer::QPanGestureRecognizer() @@ -563,3 +565,5 @@ void QTapAndHoldGestureRecognizer::reset(QGesture *state) } QT_END_NAMESPACE + +#endif // QT_NO_GESTURES diff --git a/src/gui/kernel/qstandardgestures_p.h b/src/gui/kernel/qstandardgestures_p.h index 64505d8..da73b85 100644 --- a/src/gui/kernel/qstandardgestures_p.h +++ b/src/gui/kernel/qstandardgestures_p.h @@ -56,6 +56,8 @@ #include "qgesturerecognizer.h" #include "private/qgesture_p.h" +#ifndef QT_NO_GESTURES + QT_BEGIN_NAMESPACE class QPanGestureRecognizer : public QGestureRecognizer @@ -110,4 +112,6 @@ public: QT_END_NAMESPACE +#endif // QT_NO_GESTURES + #endif // QSTANDARDGESTURES_P_H diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index a891be0..77d416b 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -161,6 +161,51 @@ static inline bool hasBackingStoreSupport() extern bool qt_sendSpontaneousEvent(QObject*, QEvent*); // qapplication.cpp extern QDesktopWidget *qt_desktopWidget; // qapplication.cpp + +QRefCountedWidgetBackingStore::QRefCountedWidgetBackingStore() + : m_ptr(0) + , m_count(0) +{ + +} + +QRefCountedWidgetBackingStore::~QRefCountedWidgetBackingStore() +{ + delete m_ptr; +} + +void QRefCountedWidgetBackingStore::create(QWidget *widget) +{ + destroy(); + m_ptr = new QWidgetBackingStore(widget); + m_count = 0; +} + +void QRefCountedWidgetBackingStore::destroy() +{ + delete m_ptr; + m_ptr = 0; + m_count = 0; +} + +void QRefCountedWidgetBackingStore::ref() +{ + Q_ASSERT(m_ptr); + ++m_count; +} + +void QRefCountedWidgetBackingStore::deref() +{ + if (m_count) { + Q_ASSERT(m_ptr); + if (0 == --m_count) { + delete m_ptr; + m_ptr = 0; + } + } +} + + QWidgetPrivate::QWidgetPrivate(int version) : QObjectPrivate(version) , extra(0) @@ -202,7 +247,9 @@ QWidgetPrivate::QWidgetPrivate(int version) , picture(0) #elif defined(Q_WS_WIN) , noPaintOnScreen(0) + #ifndef QT_NO_GESTURES , nativeGesturePanEnabled(0) + #endif #elif defined(Q_WS_MAC) , needWindowChange(0) , hasAlienChildren(0) @@ -1348,11 +1395,9 @@ void QWidget::create(WId window, bool initializeWindow, bool destroyOldWindow) // a real toplevel window needs a backing store if (isWindow() && windowType() != Qt::Desktop) { - delete d->topData()->backingStore; - // QWidgetBackingStore will check this variable, hence it must be 0 - d->topData()->backingStore = 0; + d->topData()->backingStore.destroy(); if (hasBackingStoreSupport()) - d->topData()->backingStore = new QWidgetBackingStore(this); + d->topData()->backingStore.create(this); } d->setModal_sys(); @@ -1397,8 +1442,10 @@ QWidget::~QWidget() qWarning("QWidget: %s (%s) deleted while being painted", className(), name()); #endif +#ifndef QT_NO_GESTURES foreach (Qt::GestureType type, d->gestureContext.keys()) ungrabGesture(type); +#endif // force acceptDrops false before winId is destroyed. d->registerDropSite(false); @@ -1478,8 +1525,7 @@ QWidget::~QWidget() // the backing store will delete its window surface, which may or may // not have a reference to this widget that will be used later to // notify the window it no longer has a surface. - delete d->extra->topextra->backingStore; - d->extra->topextra->backingStore = 0; + d->extra->topextra->backingStore.destroy(); } #endif if (QWidgetBackingStore *bs = d->maybeBackingStore()) { @@ -1577,7 +1623,6 @@ void QWidgetPrivate::createTLExtra() QTLWExtra* x = extra->topextra = new QTLWExtra; x->icon = 0; x->iconPixmap = 0; - x->backingStore = 0; x->windowSurface = 0; x->sharedPainter = 0; x->incw = x->inch = 0; @@ -1661,7 +1706,7 @@ void QWidgetPrivate::deleteExtra() #endif if (extra->topextra) { deleteTLSysExtra(); - delete extra->topextra->backingStore; + extra->topextra->backingStore.destroy(); delete extra->topextra->icon; delete extra->topextra->iconPixmap; #if defined(Q_WS_QWS) && !defined(QT_NO_QWS_MANAGER) @@ -8540,9 +8585,11 @@ bool QWidget::event(QEvent *event) #endif // Q_WS_MAC break; } +#ifndef QT_NO_GESTURES case QEvent::Gesture: event->ignore(); break; +#endif #ifndef QT_NO_PROPERTIES case QEvent::DynamicPropertyChange: { const QByteArray &propName = static_cast<QDynamicPropertyChangeEvent *>(event)->propertyName(); @@ -11975,6 +12022,7 @@ QGraphicsProxyWidget *QWidget::graphicsProxyWidget() const Synonym for QList<QWidget *>. */ +#ifndef QT_NO_GESTURES /*! Subscribes the widget to a given \a gesture with specific \a flags. @@ -12002,7 +12050,7 @@ void QWidget::ungrabGesture(Qt::GestureType gesture) manager->cleanupCachedGestures(this, gesture); } } - +#endif // QT_NO_GESTURES /*! \typedef WId diff --git a/src/gui/kernel/qwidget.h b/src/gui/kernel/qwidget.h index e12148b..941bd68 100644 --- a/src/gui/kernel/qwidget.h +++ b/src/gui/kernel/qwidget.h @@ -360,8 +360,10 @@ public: void setGraphicsEffect(QGraphicsEffect *effect); #endif //QT_NO_GRAPHICSEFFECT +#ifndef QT_NO_GESTURES void grabGesture(Qt::GestureType type, Qt::GestureFlags flags = Qt::GestureFlags()); void ungrabGesture(Qt::GestureType type); +#endif public Q_SLOTS: void setWindowTitle(const QString &); @@ -742,8 +744,10 @@ private: friend class QGraphicsProxyWidgetPrivate; friend class QStyleSheetStyle; friend struct QWidgetExceptionCleaner; +#ifndef QT_NO_GESTURES friend class QGestureManager; friend class QWinNativePanGestureRecognizer; +#endif // QT_NO_GESTURES friend class QWidgetEffectSourcePrivate; #ifdef Q_WS_MAC diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 6df9c3b..56e72af 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -757,6 +757,7 @@ static OSWindowRef qt_mac_create_window(QWidget *, WindowClass wclass, WindowAtt return window; } +#ifndef QT_NO_GESTURES #if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 /* We build the release package against the 10.4 SDK. So, to enable gestures for applications running on @@ -773,6 +774,7 @@ enum { kEventParamMagnificationAmount = 'magn' }; #endif +#endif // QT_NO_GESTURES // window events static EventTypeSpec window_events[] = { @@ -1081,6 +1083,7 @@ OSStatus QWidgetPrivate::qt_window_event(EventHandlerCallRef er, EventRef event, handled_event = false; break; } +#ifndef QT_NO_GESTURES case kEventClassGesture: { // First, find the widget that was under // the mouse when the gesture happened: @@ -1147,6 +1150,7 @@ OSStatus QWidgetPrivate::qt_window_event(EventHandlerCallRef er, EventRef event, QApplication::sendSpontaneousEvent(widget, &qNGEvent); break; } +#endif // QT_NO_GESTURES default: handled_event = false; diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index 412705a..d432263 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -110,13 +110,53 @@ class QWidgetItemV2; class QStyle; +class Q_AUTOTEST_EXPORT QRefCountedWidgetBackingStore +{ +public: + QRefCountedWidgetBackingStore(); + ~QRefCountedWidgetBackingStore(); + + void create(QWidget *tlw); + void destroy(); + + void ref(); + void deref(); + + inline QWidgetBackingStore* data() + { + return m_ptr; + } + + inline QWidgetBackingStore* operator->() + { + return m_ptr; + } + + inline QWidgetBackingStore& operator*() + { + return *m_ptr; + } + + inline operator bool() const + { + return (0 != m_ptr); + } + +private: + Q_DISABLE_COPY(QRefCountedWidgetBackingStore) + +private: + QWidgetBackingStore* m_ptr; + int m_count; +}; + struct QTLWExtra { // *************************** Cross-platform variables ***************************** // Regular pointers (keep them together to avoid gaps on 64 bits architectures). QIcon *icon; // widget icon QPixmap *iconPixmap; - QWidgetBackingStore *backingStore; + QRefCountedWidgetBackingStore backingStore; QWindowSurface *windowSurface; QPainter *sharedPainter; @@ -686,7 +726,9 @@ public: #ifndef QT_NO_ACTION QList<QAction*> actions; #endif +#ifndef QT_NO_GESTURES QMap<Qt::GestureType, Qt::GestureFlags> gestureContext; +#endif // Bit fields. uint high_attributes[4]; // the low ones are in QWidget::widget_attributes @@ -715,8 +757,9 @@ public: void updateX11AcceptFocus(); #elif defined(Q_WS_WIN) // <--------------------------------------------------------- WIN uint noPaintOnScreen : 1; // see qwidget_win.cpp ::paintEngine() +#ifndef QT_NO_GESTURES uint nativeGesturePanEnabled : 1; - +#endif bool shouldShowMaximizeButton(); void winUpdateIsOpaque(); void reparentChildren(); @@ -930,7 +973,7 @@ inline QWidgetBackingStore *QWidgetPrivate::maybeBackingStore() const { Q_Q(const QWidget); QTLWExtra *x = q->window()->d_func()->maybeTopData(); - return x ? x->backingStore : 0; + return x ? x->backingStore.data() : 0; } QT_END_NAMESPACE diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 02e7cb8..86b858d 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -433,6 +433,7 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de // Request mouse move events. drawableWindow->PointerFilter(EPointerFilterEnterExit | EPointerFilterMove | EPointerFilterDrag, 0); + drawableWindow->EnableVisibilityChangeEvents(); if (q->isVisible() && q->testAttribute(Qt::WA_Mapped)) { activateSymbianWindow(control.data()); @@ -487,11 +488,8 @@ void QWidgetPrivate::show_sys() && !S60->buttonGroupContainer() && !S60->statusPane()) { bool isFullscreen = q->windowState() & Qt::WindowFullScreen; - bool cbaRequested = q->windowFlags() & Qt::WindowSoftkeysVisibleHint; - // If the window is fullscreen and has not explicitly requested that the CBA be visible - // we delay the creation even more. - if ((!isFullscreen || cbaRequested) && !q->testAttribute(Qt::WA_DontShowOnScreen)) { + if (!q->testAttribute(Qt::WA_DontShowOnScreen)) { // Create the status pane and CBA here CEikAppUi *ui = static_cast<CEikAppUi *>(S60->appUi()); @@ -911,14 +909,12 @@ void QWidgetPrivate::registerDropSite(bool /* on */) void QWidgetPrivate::createTLSysExtra() { - extra->topextra->backingStore = 0; extra->topextra->inExpose = 0; } void QWidgetPrivate::deleteTLSysExtra() { - delete extra->topextra->backingStore; - extra->topextra->backingStore = 0; + extra->topextra->backingStore.destroy(); } void QWidgetPrivate::createSysExtra() diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp index 5482da3..a7e66bf 100644 --- a/src/gui/kernel/qwidget_win.cpp +++ b/src/gui/kernel/qwidget_win.cpp @@ -2075,7 +2075,7 @@ void QWidgetPrivate::registerTouchWindow() void QWidgetPrivate::winSetupGestures() { -#if !defined(QT_NO_NATIVE_GESTURES) +#if !defined(QT_NO_GESTURES) && !defined(QT_NO_NATIVE_GESTURES) Q_Q(QWidget); if (!q || !q->isVisible() || !nativeGesturePanEnabled) return; diff --git a/src/gui/kernel/qwinnativepangesturerecognizer_win.cpp b/src/gui/kernel/qwinnativepangesturerecognizer_win.cpp index 0bddbf6..780de5d 100644 --- a/src/gui/kernel/qwinnativepangesturerecognizer_win.cpp +++ b/src/gui/kernel/qwinnativepangesturerecognizer_win.cpp @@ -50,6 +50,8 @@ #include "private/qapplication_p.h" #include "private/qwidget_p.h" +#ifndef QT_NO_GESTURES + QT_BEGIN_NAMESPACE #if !defined(QT_NO_NATIVE_GESTURES) @@ -127,3 +129,5 @@ void QWinNativePanGestureRecognizer::reset(QGesture *state) #endif // QT_NO_NATIVE_GESTURES QT_END_NAMESPACE + +#endif // QT_NO_GESTURES diff --git a/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h b/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h index 146b067..64addeb 100644 --- a/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h +++ b/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h @@ -54,6 +54,7 @@ // #include <QGestureRecognizer> + #include <objbase.h> class IInkRectangle; @@ -87,6 +88,8 @@ DECLARE_INTERFACE_(IInkTablets, IDispatch) STDMETHOD(IsPacketPropertySupported)(THIS_ BSTR packetPropertyName, VARIANT_BOOL *Supported) PURE; }; +#ifndef QT_NO_GESTURES + QT_BEGIN_NAMESPACE #if !defined(QT_NO_NATIVE_GESTURES) @@ -105,4 +108,6 @@ public: QT_END_NAMESPACE +#endif // QT_NO_GESTURES + #endif // QWINNATIVEPANGESTURERECOGNIZER_WIN_P_H |