Windows: Split code paths for touch/native gesture events.

Fix up 2b5df245d6 which routed
WM_GESTURE through QWindowsMouseHandler::translateTouchEvent()
causing asserts on missing touch devices.

Task-number: QTBUG-47184
Change-Id: Ie843ebb343e34487bcac9c9dbea88de641d51e28
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
This commit is contained in:
Friedemann Kleint 2015-07-20 11:01:39 +02:00
parent 17c236ad05
commit 4ef3d985dd
3 changed files with 27 additions and 6 deletions

View File

@ -919,7 +919,11 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
case QtWindows::InputMethodRequest:
return QWindowsInputContext::instance()->handleIME_Request(wParam, lParam, result);
case QtWindows::GestureEvent:
return d->m_mouseHandler.translateTouchEvent(platformWindow->window(), hwnd, et, msg, result);
#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER)
return platformSessionManager()->isInteractionBlocked() ? true : d->m_mouseHandler.translateGestureEvent(platformWindow->window(), hwnd, et, msg, result);
#else
return d->m_mouseHandler.translateGestureEvent(platformWindow->window(), hwnd, et, msg, result);
#endif
case QtWindows::InputMethodOpenCandidateWindowEvent:
case QtWindows::InputMethodCloseCandidateWindowEvent:
// TODO: Release/regrab mouse if a popup has mouse grab.

View File

@ -472,12 +472,11 @@ bool QWindowsMouseHandler::translateScrollEvent(QWindow *window, HWND,
}
// from bool QApplicationPrivate::translateTouchEvent()
bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND hwnd,
bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND,
QtWindows::WindowsEventType,
MSG msg, LRESULT *)
{
#ifndef Q_OS_WINCE
Q_UNUSED(hwnd);
typedef QWindowSystemInterface::TouchPoint QTouchPoint;
typedef QList<QWindowSystemInterface::TouchPoint> QTouchPointList;
@ -545,8 +544,24 @@ bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND hwnd,
QWindowSystemInterface::handleTouchEvent(window,
m_touchDevice,
touchPoints);
#else // !Q_OS_WINCE
Q_UNUSED(window)
Q_UNUSED(msg)
#endif
return true;
#else //Q_OS_WINCE
}
bool QWindowsMouseHandler::translateGestureEvent(QWindow *window, HWND hwnd,
QtWindows::WindowsEventType,
MSG msg, LRESULT *)
{
#ifndef Q_OS_WINCE
Q_UNUSED(window)
Q_UNUSED(hwnd)
Q_UNUSED(msg)
return false;
#else // !Q_OS_WINCE
GESTUREINFO gi;
memset(&gi, 0, sizeof(GESTUREINFO));
gi.cbSize = sizeof(GESTUREINFO);
@ -625,9 +640,8 @@ bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND hwnd,
QWindowSystemInterface::handleEnterEvent(window);
m_windowUnderMouse = window;
}
return true;
#endif
#endif // Q_OS_WINCE
}
QT_END_NAMESPACE

View File

@ -59,6 +59,9 @@ public:
bool translateTouchEvent(QWindow *widget, HWND hwnd,
QtWindows::WindowsEventType t, MSG msg,
LRESULT *result);
bool translateGestureEvent(QWindow *window, HWND hwnd,
QtWindows::WindowsEventType,
MSG msg, LRESULT *);
bool translateScrollEvent(QWindow *window, HWND hwnd,
MSG msg, LRESULT *result);