Windows: Suppress mouse events synthesized by OS.
Change the hint for QPlatformIntegration::SynthesizeMouseFromTouchEvents to false for Windows and suppress the events synthesized by OS. The synthesized events cause touch events to generate 2 clicks in Quick2. Leave code as is for Windows CE. Task-number: QTBUG-31386 Change-Id: Ia0987342dcdd55c8540810da5e4b90518a501ce6 Reviewed-by: Alan Alpert <aalpert@blackberry.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
This commit is contained in:
parent
1df7a6a50a
commit
de3d449dcf
@ -552,11 +552,15 @@ QVariant QWindowsIntegration::styleHint(QPlatformIntegration::StyleHint hint) co
|
||||
break;
|
||||
case QPlatformIntegration::UseRtlExtensions:
|
||||
return QVariant(d->m_context.useRTLExtensions());
|
||||
#ifdef Q_OS_WINCE
|
||||
case QPlatformIntegration::SynthesizeMouseFromTouchEvents:
|
||||
// We do not want Qt to synthesize mouse events as Windows also does that.
|
||||
// Alternatively, Windows-generated touch mouse events can be identified and
|
||||
// ignored by checking GetMessageExtraInfo() for MI_WP_SIGNATURE (0xFF515700).
|
||||
return false;
|
||||
#endif // Q_OS_WINCE
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return QPlatformIntegration::styleHint(hint);
|
||||
}
|
||||
|
@ -157,9 +157,19 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd,
|
||||
QtWindows::WindowsEventType et,
|
||||
MSG msg, LRESULT *result)
|
||||
{
|
||||
enum { signatureMask = 0xffffff00, miWpSignature = 0xff515700 };
|
||||
|
||||
if (et == QtWindows::MouseWheelEvent)
|
||||
return translateMouseWheelEvent(window, hwnd, msg, result);
|
||||
|
||||
#ifndef Q_OS_WINCE
|
||||
// Check for events synthesized from touch. Lower byte is touch index, 0 means pen.
|
||||
const LPARAM extraInfo = GetMessageExtraInfo();
|
||||
const bool fromTouch = (extraInfo & signatureMask) == miWpSignature && (extraInfo & 0xff);
|
||||
if (fromTouch)
|
||||
return false;
|
||||
#endif // !Q_OS_WINCE
|
||||
|
||||
const QPoint winEventPosition(GET_X_LPARAM(msg.lParam), GET_Y_LPARAM(msg.lParam));
|
||||
if (et & QtWindows::NonClientEventFlag) {
|
||||
const QPoint globalPosition = winEventPosition;
|
||||
|
Loading…
Reference in New Issue
Block a user