[osg-users] Bug touch point in win32

Robert Osfield robert.osfield at gmail.com
Tue May 31 03:05:52 PDT 2016


Thanks Nguyen, fix merged and submitted git master.

On 25 April 2016 at 17:40, Nguyen Van Truong <truongnv.w2g at gmail.com> wrote:
> I Use two touch screen in my App. I had a bug touch point in secondary
> screen ( the touch point not same mouse push point). My code repair
>
> case WM_TOUCH:
>         /////////////
>             {
>                 unsigned int numInputs = (unsigned int) wParam;
>                 TOUCHINPUT* ti = new TOUCHINPUT[numInputs];
> POINT pt;
>                 osg::ref_ptr<osgGA::GUIEventAdapter> osg_event(NULL);
>                 if(getTouchInputInfoFunc &&
> (*getTouchInputInfoFunc)((HTOUCHINPUT)lParam, numInputs, ti,
> sizeof(TOUCHINPUT)))
>                 {
>                     // For each contact, dispatch the message to the
> appropriate message handler.
>                     for(unsigned int i=0; i< numInputs; ++i)
>                     {
> pt.x =TOUCH_COORD_TO_PIXEL(ti[i].x);
> pt.y =TOUCH_COORD_TO_PIXEL(ti[i].y);
> ScreenToClient(getHWND(), &pt);
>                         if(ti[i].dwFlags & TOUCHEVENTF_DOWN)
>                         {
>                             if (!osg_event) {
>                                 osg_event = getEventQueue()->touchBegan(
> ti[i].dwID, osgGA::GUIEventAdapter::TOUCH_BEGAN, pt.x, pt.y);
>                             } else {
>                                 osg_event->addTouchPoint( ti[i].dwID,
> osgGA::GUIEventAdapter::TOUCH_BEGAN, pt.x, pt.y);
>                             }
>                         }
>                         else if(ti[i].dwFlags & TOUCHEVENTF_MOVE)
>                         {
>                             if (!osg_event) {
>                                 osg_event = getEventQueue()->touchMoved(
> ti[i].dwID, osgGA::GUIEventAdapter::TOUCH_MOVED, pt.x, pt.y);
>                             } else {
>                                 osg_event->addTouchPoint( ti[i].dwID,
> osgGA::GUIEventAdapter::TOUCH_MOVED, pt.x, pt.y);
>                             }
>                         }
>                         else if(ti[i].dwFlags & TOUCHEVENTF_UP)
>                         {
>                             // No double tap detection with RAW TOUCH
> Events, sorry.
>                             if (!osg_event) {
>                                 osg_event = getEventQueue()->touchEnded(
> ti[i].dwID, osgGA::GUIEventAdapter::TOUCH_ENDED, pt.x, pt.y, 1);
>                             } else {
>                                 osg_event->addTouchPoint( ti[i].dwID,
> osgGA::GUIEventAdapter::TOUCH_ENDED, pt.x, pt.y);
>                             }
>                         }
>                     }
>                 }
>                 if (closeTouchInputHandleFunc)
>                     (*closeTouchInputHandleFunc)((HTOUCHINPUT)lParam);
>                 delete [] ti;
>             }
>             break;



More information about the osg-users mailing list