From d672ff5ddc23fe7c332d17b32378a00e21fad7b3 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Fri, 6 Nov 2009 17:26:43 +0100 Subject: Added a -no-native-gestures option for configure.exe The option allows to disable native Windows7 gestures since they require the creation of the native window handle. This partially disabled alien widgets concept and make window resizing slower and more flickery. Reviewed-by: Espen Riskedal --- src/gui/kernel/qapplication_win.cpp | 2 ++ src/gui/kernel/qgesturemanager.cpp | 4 +++- src/gui/kernel/qstandardgestures.cpp | 3 +-- src/gui/kernel/qwidget_win.cpp | 2 ++ src/gui/kernel/qwinnativepangesturerecognizer_win.cpp | 4 ++++ src/gui/kernel/qwinnativepangesturerecognizer_win_p.h | 4 ++++ tools/configure/configureapp.cpp | 11 +++++++++++ 7 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index 387c29b..05e75a2 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -832,6 +832,7 @@ void qt_init(QApplicationPrivate *priv, int) priv->GetGestureInfo = (PtrGetGestureInfo) &TKGetGestureInfo; priv->GetGestureExtraArgs = (PtrGetGestureExtraArgs) &TKGetGestureExtraArguments; #elif !defined(Q_WS_WINCE) + #if !defined(QT_NO_NATIVE_GESTURES) priv->GetGestureInfo = (PtrGetGestureInfo)QLibrary::resolve(QLatin1String("user32"), "GetGestureInfo"); @@ -847,6 +848,7 @@ void qt_init(QApplicationPrivate *priv, int) priv->GetGestureConfig = (PtrGetGestureConfig)QLibrary::resolve(QLatin1String("user32"), "GetGestureConfig"); + #endif // QT_NO_NATIVE_GESTURES priv->BeginPanningFeedback = (PtrBeginPanningFeedback)QLibrary::resolve(QLatin1String("uxtheme"), "BeginPanningFeedback"); diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp index 375116f..2a6e286 100644 --- a/src/gui/kernel/qgesturemanager.cpp +++ b/src/gui/kernel/qgesturemanager.cpp @@ -52,7 +52,7 @@ #ifdef Q_WS_MAC #include "qmacgesturerecognizer_mac_p.h" #endif -#if defined(Q_OS_WIN) +#if defined(Q_OS_WIN) && !defined(QT_NO_NATIVE_GESTURES) #include "qwinnativepangesturerecognizer_win_p.h" #endif @@ -94,7 +94,9 @@ QGestureManager::QGestureManager(QObject *parent) registerGestureRecognizer(new QTapGestureRecognizer); #endif #if defined(Q_OS_WIN) + #if !defined(QT_NO_NATIVE_GESTURES) registerGestureRecognizer(new QWinNativePanGestureRecognizer); + #endif #else registerGestureRecognizer(new QTapAndHoldGestureRecognizer); #endif diff --git a/src/gui/kernel/qstandardgestures.cpp b/src/gui/kernel/qstandardgestures.cpp index 0ea4764..6b0441b 100644 --- a/src/gui/kernel/qstandardgestures.cpp +++ b/src/gui/kernel/qstandardgestures.cpp @@ -56,7 +56,7 @@ QPanGestureRecognizer::QPanGestureRecognizer() QGesture *QPanGestureRecognizer::create(QObject *target) { if (target && target->isWidgetType()) { -#if defined(Q_OS_WIN) +#if defined(Q_OS_WIN) && !defined(QT_NO_NATIVE_GESTURES) // for scroll areas on Windows we want to use native gestures instead if (!qobject_cast(target->parent())) static_cast(target)->setAttribute(Qt::WA_AcceptTouchEvents); @@ -77,7 +77,6 @@ QGestureRecognizer::Result QPanGestureRecognizer::recognize(QGesture *state, const QTouchEvent *ev = static_cast(event); QGestureRecognizer::Result result; - switch (event->type()) { case QEvent::TouchBegin: { result = QGestureRecognizer::MayBeGesture; diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp index 95ef1cf..87f1cad 100644 --- a/src/gui/kernel/qwidget_win.cpp +++ b/src/gui/kernel/qwidget_win.cpp @@ -2032,6 +2032,7 @@ void QWidgetPrivate::registerTouchWindow() void QWidgetPrivate::winSetupGestures() { +#if !defined(QT_NO_NATIVE_GESTURES) Q_Q(QWidget); if (!q || !q->isVisible() || !nativeGesturePanEnabled) return; @@ -2080,6 +2081,7 @@ void QWidgetPrivate::winSetupGestures() qAppPriv->SetGestureConfig(winid, 0, sizeof(gc)/sizeof(gc[0]), gc, sizeof(gc[0])); } +#endif } QT_END_NAMESPACE diff --git a/src/gui/kernel/qwinnativepangesturerecognizer_win.cpp b/src/gui/kernel/qwinnativepangesturerecognizer_win.cpp index 5fceb13..7dff543 100644 --- a/src/gui/kernel/qwinnativepangesturerecognizer_win.cpp +++ b/src/gui/kernel/qwinnativepangesturerecognizer_win.cpp @@ -52,6 +52,8 @@ QT_BEGIN_NAMESPACE +#if !defined(QT_NO_NATIVE_GESTURES) + QWinNativePanGestureRecognizer::QWinNativePanGestureRecognizer() { } @@ -122,4 +124,6 @@ void QWinNativePanGestureRecognizer::reset(QGesture *state) QGestureRecognizer::reset(state); } +#endif // QT_NO_NATIVE_GESTURES + QT_END_NAMESPACE diff --git a/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h b/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h index 8fb0d50..7d53ed2 100644 --- a/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h +++ b/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h @@ -57,6 +57,8 @@ QT_BEGIN_NAMESPACE +#if !defined(QT_NO_NATIVE_GESTURES) + class QWinNativePanGestureRecognizer : public QGestureRecognizer { public: @@ -67,6 +69,8 @@ public: void reset(QGesture *state); }; +#endif // QT_NO_NATIVE_GESTURES + QT_END_NAMESPACE #endif // QWINNATIVEPANGESTURERECOGNIZER_WIN_P_H diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index d8c2abd..265bc5c 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -351,6 +351,7 @@ Configure::Configure( int& argc, char** argv ) dictionary[ "INCREDIBUILD_XGE" ] = "auto"; dictionary[ "LTCG" ] = "no"; + dictionary[ "NATIVE_GESTURES" ] = "yes"; } Configure::~Configure() @@ -796,6 +797,10 @@ void Configure::parseCmdLine() dictionary[ "INCREDIBUILD_XGE" ] = "no"; else if( configCmdLine.at(i) == "-incredibuild-xge" ) dictionary[ "INCREDIBUILD_XGE" ] = "yes"; + else if( configCmdLine.at(i) == "-native-gestures" ) + dictionary[ "NATIVE_GESTURES" ] = "yes"; + else if( configCmdLine.at(i) == "-no-native-gestures" ) + dictionary[ "NATIVE_GESTURES" ] = "no"; #if !defined(EVAL) // Others --------------------------------------------------- else if (configCmdLine.at(i) == "-fpu" ) @@ -1774,6 +1779,8 @@ bool Configure::displayHelp() desc("STYLE_WINDOWSCE", "yes", "", " windowsce", ' '); desc("STYLE_WINDOWSMOBILE" , "yes", "", " windowsmobile", ' '); desc("STYLE_S60" , "yes", "", " s60\n", ' '); + desc("NATIVE_GESTURES", "no", "-no-native-gestures", "Do not use native gestures on Windows 7."); + desc("NATIVE_GESTURES", "yes", "-native-gestures", "Use native gestures on Windows 7."); /* We do not support -qconfig on Windows yet @@ -2521,6 +2528,9 @@ void Configure::generateOutputVars() if (dictionary["DECLARATIVE"] == "yes") qtConfig += "declarative"; + if( dictionary[ "NATIVE_GESTURES" ] == "yes" ) + qtConfig += "native-gestures"; + // We currently have no switch for QtSvg, so add it unconditionally. qtConfig += "svg"; @@ -2897,6 +2907,7 @@ void Configure::generateConfigfiles() if(dictionary["SCRIPTTOOLS"] == "no") qconfigList += "QT_NO_SCRIPTTOOLS"; if(dictionary["FREETYPE"] == "no") qconfigList += "QT_NO_FREETYPE"; if(dictionary["S60"] == "no") qconfigList += "QT_NO_S60"; + if(dictionary["NATIVE_GESTURES"] == "no") qconfigList += "QT_NO_NATIVE_GESTURES"; if(dictionary["OPENGL_ES_CM"] == "yes" || dictionary["OPENGL_ES_CL"] == "yes" || -- cgit v0.12