diff options
author | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2010-06-07 16:10:46 (GMT) |
---|---|---|
committer | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2010-06-07 16:10:46 (GMT) |
commit | d26856959f5031c03ed245df5aa9cb3b15a0596b (patch) | |
tree | 8484a674a9acb81d18c5a01ef9f2445c2a2a81b0 /src/gui/kernel | |
parent | 0c0f22ec0e36d7001c8195dcc6e390a37118e33e (diff) | |
parent | bf966d125d5c5fa7719ae9f9110db8742d5a4c85 (diff) | |
download | Qt-d26856959f5031c03ed245df5aa9cb3b15a0596b.zip Qt-d26856959f5031c03ed245df5aa9cb3b15a0596b.tar.gz Qt-d26856959f5031c03ed245df5aa9cb3b15a0596b.tar.bz2 |
Merge branch '4.7' of git@scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-staging1
Diffstat (limited to 'src/gui/kernel')
28 files changed, 148 insertions, 10 deletions
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 8529615..438a17e 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -187,8 +187,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; @@ -780,6 +782,9 @@ void QApplicationPrivate::construct( qt_is_gui_used = (qt_appType != QApplication::Tty); process_cmdline(); + // the environment variable has the lowest precedence of runtime graphicssystem switches + if (graphics_system_name.isEmpty()) + graphics_system_name = QString::fromLocal8Bit(qgetenv("QT_GRAPHICSSYSTEM")); // Must be called before initialize() qt_init(this, qt_appType #ifdef Q_WS_X11 @@ -1560,10 +1565,18 @@ QStyle* QApplication::setStyle(const QString& style) on-screen widgets and QPixmaps. The available systems are \c{"native"}, \c{"raster"} and \c{"opengl"}. - This function call overrides both the application commandline - \c{-graphicssystem} switch and the configure \c{-graphicssystem} switch. + There are several ways to set the graphics backend, in order of decreasing + precedence: + \list + \o the application commandline \c{-graphicssystem} switch + \o QApplication::setGraphicsSystem() + \o the QT_GRAPHICSSYSTEM environment variable + \o the Qt configure \c{-graphicssystem} switch + \endlist + If the highest precedence switch sets an invalid name, the error will be + ignored and the default backend will be used. - \warning This function must be called before the QApplication constructor + \warning This function is only effective before the QApplication constructor is called. \note The \c{"opengl"} option is currently experimental. @@ -3707,6 +3720,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()) { @@ -3751,7 +3765,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) } } } - +#endif // QT_NO_GESTURES // User input and window activation makes tooltips sleep switch (e->type()) { @@ -4256,6 +4270,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) @@ -4334,6 +4349,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) } break; } +#endif // QT_NO_GESTURES default: res = d->notify_helper(receiver, e); break; @@ -5767,6 +5783,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(); @@ -5774,6 +5791,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 c21b982..cb1d063 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 e83cd71..3a3f816 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 @@ -519,6 +524,7 @@ public: void sendSyntheticEnterLeave(QWidget *widget); #endif +#ifndef QT_NO_GESTURES QGestureManager *gestureManager; QWidget *gestureWidget; #if defined(Q_WS_X11) || defined(Q_WS_WIN) @@ -526,6 +532,7 @@ public: QPixmap *copy_cursor; QPixmap *link_cursor; #endif +#endif #if defined(Q_WS_WIN) QPixmap *ignore_cursor; #endif @@ -554,6 +561,7 @@ public: QHash<DWORD, int> touchInputIDToTouchPointID; bool translateTouchEvent(const MSG &msg); +#ifndef QT_NO_GESTURES PtrGetGestureInfo GetGestureInfo; PtrGetGestureExtraArgs GetGestureExtraArgs; PtrCloseGestureInfoHandle CloseGestureInfoHandle; @@ -562,6 +570,7 @@ public: PtrBeginPanningFeedback BeginPanningFeedback; PtrUpdatePanningFeedback UpdatePanningFeedback; PtrEndPanningFeedback EndPanningFeedback; +#endif // QT_NO_GESTURES #endif #ifdef QT_RX71_MULTITOUCH diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index 60fc5e1..c52fbdf 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; @@ -211,6 +214,7 @@ static void resolveAygLibs() ptrRecognizeGesture = (AygRecognizeGesture) ayglib.resolve("SHRecognizeGesture"); } } +#endif // QT_NO_GESTURES #endif @@ -463,7 +467,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); } @@ -843,6 +849,7 @@ void qt_init(QApplicationPrivate *priv, int) ptrSetProcessDPIAware(); #endif +#ifndef QT_NO_GESTURES priv->GetGestureInfo = 0; priv->GetGestureExtraArgs = 0; priv->CloseGestureInfoHandle = 0; @@ -883,6 +890,7 @@ void qt_init(QApplicationPrivate *priv, int) (PtrEndPanningFeedback)QLibrary::resolve(QLatin1String("uxtheme"), "EndPanningFeedback"); #endif +#endif // QT_NO_GESTURES } /***************************************************************************** @@ -1667,12 +1675,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 } } } @@ -2556,6 +2566,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; @@ -2590,6 +2601,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(); @@ -3825,6 +3837,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); @@ -3863,7 +3876,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/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index 4953c48..eec9699 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/qdrag.cpp b/src/gui/kernel/qdrag.cpp index b57615c..77f8fc0 100644 --- a/src/gui/kernel/qdrag.cpp +++ b/src/gui/kernel/qdrag.cpp @@ -253,7 +253,9 @@ Qt::DropAction QDrag::exec(Qt::DropActions supportedActions) can take some time, but this function does not block the event loop. Other events are still delivered to the application while the operation is performed. On Windows, the Qt event loop is - blocked while during the operation. + blocked during the operation. However, QDrag::exec() on + Windows causes processEvents() to be called frequently to keep the GUI responsive. + If any loops or operations are called while a drag operation is active, it will block the drag operation. */ Qt::DropAction QDrag::exec(Qt::DropActions supportedActions, Qt::DropAction defaultDropAction) diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index acf7184..92eed33 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 7363d70..e43a560 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) @@ -688,6 +690,7 @@ void QGestureManager::recycle(QGesture *gesture) if (recognizer) { gesture->setGestureCancelPolicy(QGesture::CancelNone); recognizer->reset(gesture); + m_activeGestures.remove(gesture); } else { cleanupGesturesForRemovedRecognizer(gesture); } @@ -695,4 +698,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/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 bfcfa86..8a3e89e 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() @@ -566,3 +568,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 91dfaab..e9ec488 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -202,7 +202,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) @@ -1399,8 +1401,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); @@ -8541,9 +8545,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(); @@ -11959,6 +11965,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. @@ -11986,7 +11993,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 f12c956..1928599 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -752,6 +752,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 @@ -768,6 +769,7 @@ enum { kEventParamMagnificationAmount = 'magn' }; #endif +#endif // QT_NO_GESTURES // window events static EventTypeSpec window_events[] = { @@ -1076,6 +1078,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: @@ -1142,6 +1145,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 3f494d8..f23a94c 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -685,7 +685,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 @@ -714,8 +716,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(); 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 |