summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2009-05-26 10:45:09 (GMT)
committerBradley T. Hughes <bradley.hughes@nokia.com>2009-05-26 10:45:09 (GMT)
commit37fff42b5c52a8e0c36d6834ac494ebabb4ea449 (patch)
tree285ad1bdee0a4835c8edce58e66c7f7dc4f058a9 /src/gui/kernel
parentb6d42a179c021e7544242edb82d8368af27c4dad (diff)
downloadQt-37fff42b5c52a8e0c36d6834ac494ebabb4ea449.zip
Qt-37fff42b5c52a8e0c36d6834ac494ebabb4ea449.tar.gz
Qt-37fff42b5c52a8e0c36d6834ac494ebabb4ea449.tar.bz2
Don't enable WM_TOUCH* messages on all windows
Only do it when a widget has actually set the Qt::WA_AcceptTouchEvents attribute
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qwidget.cpp6
-rw-r--r--src/gui/kernel/qwidget_p.h1
-rw-r--r--src/gui/kernel/qwidget_win.cpp17
3 files changed, 19 insertions, 5 deletions
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 7b1b38c..486e145 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -9889,6 +9889,12 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
}
break;
+#if defined(Q_WS_WIN)
+ case Qt::WA_AcceptTouchEvents:
+ if (on)
+ d->registerTouchWindow();
+ break;
+#endif
default:
break;
}
diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h
index b2ae75e..8f8b467 100644
--- a/src/gui/kernel/qwidget_p.h
+++ b/src/gui/kernel/qwidget_p.h
@@ -557,6 +557,7 @@ public:
void unregisterOleDnd(QWidget *widget, QOleDropTarget *target);
#endif
void grabMouseWhileInWindow();
+ void registerTouchWindow();
#elif defined(Q_WS_MAC) // <--------------------------------------------------------- MAC
// This is new stuff
uint needWindowChange : 1;
diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp
index d381cb2..ef67237 100644
--- a/src/gui/kernel/qwidget_win.cpp
+++ b/src/gui/kernel/qwidget_win.cpp
@@ -497,13 +497,12 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
}
}
- // ### don't always register for touch events
- if (id && QApplicationPrivate::RegisterTouchWindow && !desktop)
- QApplicationPrivate::RegisterTouchWindow(id, 0);
-
q->setAttribute(Qt::WA_WState_Created); // accept move/resize events
hd = 0; // no display context
+ if (q->testAttribute(Qt::WA_AcceptTouchEvents))
+ registerTouchWindow();
+
if (window) { // got window from outside
if (IsWindowVisible(window))
q->setAttribute(Qt::WA_WState_Visible);
@@ -2072,8 +2071,16 @@ void QWidgetPrivate::setModal_sys()
{
}
+void QWidgetPrivate::registerTouchWindow()
+{
+ Q_Q(QWidget);
-
+ // enable WM_TOUCH* messages on our window
+ if (q->testAttribute(Qt::WA_WState_Created)
+ && QApplicationPrivate::RegisterTouchWindow
+ && q->windowType() != Qt::Desktop)
+ QApplicationPrivate::RegisterTouchWindow(q->effectiveWinId(), 0);
+}
QT_END_NAMESPACE