From 76d833f33218c84853374e7458d642841300fb35 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 1 Oct 2013 09:11:26 +0000 Subject: [PATCH] From Adrien Grandemange, "On Windows 7 and 8, mouse messages are generated in addition to touch messages, which leads to duplicate PUSH, DRAG and RELEASE events in OSG. Besides, the mouse and touch messages referring to the same user input are not necessarily sent at the same time, due to gesture translation done by Windows by default, such as double-tap => double-click and long-push => right-click. The delay between the 2 types of messages is more noticeable on Windows 8 and leads to serious disruptions in our application. Mouse messages generated by touch input are only present for legacy support. I think they should be filtered out by OSG (real click events originating from a physical mouse will of course still go through). This is what this patch does, according to this suggestion: http://msdn.microsoft.com/en-us/library/dd693088%28v=VS.85%29.aspx (third issue in this page)." --- src/osgViewer/GraphicsWindowWin32.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/osgViewer/GraphicsWindowWin32.cpp b/src/osgViewer/GraphicsWindowWin32.cpp index 3168fcefd..148e9f4d1 100644 --- a/src/osgViewer/GraphicsWindowWin32.cpp +++ b/src/osgViewer/GraphicsWindowWin32.cpp @@ -29,6 +29,8 @@ #include #include +#define MOUSEEVENTF_FROMTOUCH 0xFF515700 + #if(WINVER < 0x0601) // Provide Declarations for Multitouch @@ -2457,6 +2459,8 @@ void GraphicsWindowWin32::transformMouseXY( float& x, float& y ) LRESULT GraphicsWindowWin32::handleNativeWindowingEvent( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) { + if ((GetMessageExtraInfo() & MOUSEEVENTF_FROMTOUCH) == MOUSEEVENTF_FROMTOUCH) return TRUE; + //!@todo adapt windows event time to osgGA event queue time for better resolution double eventTime = getEventQueue()->getTime(); double resizeTime = eventTime;