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:
parent
17c236ad05
commit
4ef3d985dd
@ -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.
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user