- /* handle multi-touch messages */
- case WM_TOUCH:
- {
- unsigned int numInputs = (unsigned int)wParam;
- unsigned int i = 0;
- TOUCHINPUT* ti = (TOUCHINPUT*)malloc( sizeof(TOUCHINPUT)*numInputs);
-
- if (fghGetTouchInputInfo == (pGetTouchInputInfo)0xDEADBEEF) {
- fghGetTouchInputInfo = (pGetTouchInputInfo)GetProcAddress(GetModuleHandle("user32"),"GetTouchInputInfo");
- fghCloseTouchInputHandle = (pCloseTouchInputHandle)GetProcAddress(GetModuleHandle("user32"),"CloseTouchInputHandle");
- }
-
- if (!fghGetTouchInputInfo) {
- free( (void*)ti );
- break;
- }
-
- if (fghGetTouchInputInfo( (HTOUCHINPUT)lParam, numInputs, ti, sizeof(TOUCHINPUT) )) {
- /* Handle each contact point */
- for (i = 0; i < numInputs; ++i ) {
-
- POINT tp;
- tp.x = TOUCH_COORD_TO_PIXEL(ti[i].x);
- tp.y = TOUCH_COORD_TO_PIXEL(ti[i].y);
- ScreenToClient( hWnd, &tp );
-
- ti[i].dwID = ti[i].dwID * 2;
-
- if (ti[i].dwFlags & TOUCHEVENTF_DOWN) {
- INVOKE_WCB( *window, MultiEntry, ( ti[i].dwID, GLUT_ENTERED ) );
- INVOKE_WCB( *window, MultiButton, ( ti[i].dwID, tp.x, tp.y, 0, GLUT_DOWN ) );
- } else if (ti[i].dwFlags & TOUCHEVENTF_MOVE) {
- INVOKE_WCB( *window, MultiMotion, ( ti[i].dwID, tp.x, tp.y ) );
- } else if (ti[i].dwFlags & TOUCHEVENTF_UP) {
- INVOKE_WCB( *window, MultiButton, ( ti[i].dwID, tp.x, tp.y, 0, GLUT_UP ) );
- INVOKE_WCB( *window, MultiEntry, ( ti[i].dwID, GLUT_LEFT ) );
- }
- }
- }
- fghCloseTouchInputHandle((HTOUCHINPUT)lParam);
- free( (void*)ti );
- lRet = 0; /*DefWindowProc( hWnd, uMsg, wParam, lParam );*/
- break;
- }
+ /* handle multi-touch messages */
+ case WM_TOUCH:
+ {
+ unsigned int numInputs = (unsigned int)wParam;
+ unsigned int i = 0;
+ TOUCHINPUT* ti = (TOUCHINPUT*)malloc( sizeof(TOUCHINPUT)*numInputs);
+
+ if (fghGetTouchInputInfo == (pGetTouchInputInfo)0xDEADBEEF) {
+ fghGetTouchInputInfo = (pGetTouchInputInfo)GetProcAddress(GetModuleHandle("user32"),"GetTouchInputInfo");
+ fghCloseTouchInputHandle = (pCloseTouchInputHandle)GetProcAddress(GetModuleHandle("user32"),"CloseTouchInputHandle");
+ }
+
+ if (!fghGetTouchInputInfo) {
+ free( (void*)ti );
+ break;
+ }
+
+ if (fghGetTouchInputInfo( (HTOUCHINPUT)lParam, numInputs, ti, sizeof(TOUCHINPUT) )) {
+ /* Handle each contact point */
+ for (i = 0; i < numInputs; ++i ) {
+
+ POINT tp;
+ tp.x = TOUCH_COORD_TO_PIXEL(ti[i].x);
+ tp.y = TOUCH_COORD_TO_PIXEL(ti[i].y);
+ ScreenToClient( hWnd, &tp );
+
+ ti[i].dwID = ti[i].dwID * 2;
+
+ if (ti[i].dwFlags & TOUCHEVENTF_DOWN) {
+ INVOKE_WCB( *window, MultiEntry, ( ti[i].dwID, GLUT_ENTERED ) );
+ INVOKE_WCB( *window, MultiButton, ( ti[i].dwID, tp.x, tp.y, 0, GLUT_DOWN ) );
+ } else if (ti[i].dwFlags & TOUCHEVENTF_MOVE) {
+ INVOKE_WCB( *window, MultiMotion, ( ti[i].dwID, tp.x, tp.y ) );
+ } else if (ti[i].dwFlags & TOUCHEVENTF_UP) {
+ INVOKE_WCB( *window, MultiButton, ( ti[i].dwID, tp.x, tp.y, 0, GLUT_UP ) );
+ INVOKE_WCB( *window, MultiEntry, ( ti[i].dwID, GLUT_LEFT ) );
+ }
+ }
+ }
+ fghCloseTouchInputHandle((HTOUCHINPUT)lParam);
+ free( (void*)ti );
+ lRet = 0; /*DefWindowProc( hWnd, uMsg, wParam, lParam );*/
+ break;
+ }