Allow OS synthesized mouse events by default on Windows

https://codereview.qt-project.org/#change,66028 fixes Quick2 apps so
there will be no need to ignore mouse events synthesized from touches
by the OS. The mousefromtouch plugin parameter is changed to
nomousefromtouch since mousefromtouch becomes the default.

This will restore the OS-provided functionality, like translating
tap-and-hold to right clicks, for Quick1 and widget apps.

Change-Id: I5554a91a54365b9c72c3ad304010b9fc4e53ab24
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
bb10
Laszlo Agocs 2013-09-20 14:41:38 +02:00 committed by The Qt Project
parent 99468bab8a
commit 94abcf9817
3 changed files with 7 additions and 7 deletions

View File

@ -346,8 +346,8 @@ static inline unsigned parseOptions(const QStringList &paramList)
}
} else if (param == QLatin1String("gl=gdi")) {
options |= QWindowsIntegration::DisableArb;
} else if (param == QLatin1String("mousefromtouch")) {
options |= QWindowsIntegration::PassOsMouseEventsSynthesizedFromTouch;
} else if (param == QLatin1String("nomousefromtouch")) {
options |= QWindowsIntegration::DontPassOsMouseEventsSynthesizedFromTouch;
}
}
return options;
@ -566,11 +566,9 @@ QVariant QWindowsIntegration::styleHint(QPlatformIntegration::StyleHint hint) co
case QPlatformIntegration::SynthesizeMouseFromTouchEvents:
#ifdef Q_OS_WINCE
// 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;
#else // Q_OS_WINCE
return QVariant(!(d->m_options & PassOsMouseEventsSynthesizedFromTouch));
return QVariant(bool(d->m_options & DontPassOsMouseEventsSynthesizedFromTouch));
#endif // !Q_OS_WINCE
default:
break;

View File

@ -60,7 +60,7 @@ public:
DisableArb = 0x4,
NoNativeDialogs = 0x8,
XpNativeDialogs = 0x10,
PassOsMouseEventsSynthesizedFromTouch = 0x20 // Pass OS-generated mouse events from touch.
DontPassOsMouseEventsSynthesizedFromTouch = 0x20 // Do not pass OS-generated mouse events from touch.
};
explicit QWindowsIntegration(const QStringList &paramList);

View File

@ -170,7 +170,9 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd,
Qt::MouseEventSource source = Qt::MouseEventNotSynthesized;
#ifndef Q_OS_WINCE
static const bool passSynthesizedMouseEvents = QWindowsIntegration::instance()->options() & QWindowsIntegration::PassOsMouseEventsSynthesizedFromTouch;
// Check for events synthesized from touch. Lower byte is touch index, 0 means pen.
static const bool passSynthesizedMouseEvents =
!(QWindowsIntegration::instance()->options() & QWindowsIntegration::DontPassOsMouseEventsSynthesizedFromTouch);
if (!passSynthesizedMouseEvents) {
// Check for events synthesized from touch. Lower 7 bits are touch/pen index, bit 8 indicates touch.
// However, when tablet support is active, extraInfo is a packet serial number. This is not a problem