summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis Dzyubenko <denis.dzyubenko@nokia.com>2009-11-06 17:26:43 +0100
committerDenis Dzyubenko <denis.dzyubenko@nokia.com>2009-11-06 17:44:24 +0100
commitd672ff5ddc23fe7c332d17b32378a00e21fad7b3 (patch)
tree2d6c44a817697ca7b13ff91afa1ae73bbc361dd7
parent69f0cfbb9c609ac922a6d45a7ef3d75b59d23c25 (diff)
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
-rw-r--r--src/gui/kernel/qapplication_win.cpp2
-rw-r--r--src/gui/kernel/qgesturemanager.cpp4
-rw-r--r--src/gui/kernel/qstandardgestures.cpp3
-rw-r--r--src/gui/kernel/qwidget_win.cpp2
-rw-r--r--src/gui/kernel/qwinnativepangesturerecognizer_win.cpp4
-rw-r--r--src/gui/kernel/qwinnativepangesturerecognizer_win_p.h4
-rw-r--r--tools/configure/configureapp.cpp11
7 files changed, 27 insertions, 3 deletions
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index 387c29b5d1..05e75a2cac 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 375116f495..2a6e286f87 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 0ea476400d..6b0441bd8d 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<QAbstractScrollArea *>(target->parent()))
static_cast<QWidget *>(target)->setAttribute(Qt::WA_AcceptTouchEvents);
@@ -77,7 +77,6 @@ QGestureRecognizer::Result QPanGestureRecognizer::recognize(QGesture *state,
const QTouchEvent *ev = static_cast<const QTouchEvent *>(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 95ef1cf8d6..87f1cadc79 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 5fceb13161..7dff54317e 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 8fb0d50b17..7d53ed2b57 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 d8c2abd4f3..265bc5c6a0 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" ||