------------------------------------------------------------------------------
| 881 | |
| 882 | //------------------------------------------------------------------------------ |
| 883 | int vtkWin32RenderWindowInteractor::OnTouch(HWND hWnd, UINT wParam, UINT lParam) |
| 884 | { |
| 885 | if (!this->Enabled) |
| 886 | { |
| 887 | return 0; |
| 888 | } |
| 889 | |
| 890 | int ret(0); |
| 891 | UINT cInputs = LOWORD(wParam); |
| 892 | PTOUCHINPUT pInputs = new TOUCHINPUT[cInputs]; |
| 893 | if (pInputs) |
| 894 | { |
| 895 | int ctrl, shift, alt; |
| 896 | ::RecoverModifiersStatus(ctrl, shift, alt); |
| 897 | this->SetAltKey(alt); |
| 898 | GetTouchInputInfoType GTII = |
| 899 | (GetTouchInputInfoType)GetProcAddress(GetModuleHandle(TEXT("user32")), "GetTouchInputInfo"); |
| 900 | if (GTII((HTOUCHINPUT)lParam, cInputs, pInputs, sizeof(TOUCHINPUT))) |
| 901 | { |
| 902 | POINT ptInput; |
| 903 | for (UINT i = 0; i < cInputs; i++) |
| 904 | { |
| 905 | TOUCHINPUT ti = pInputs[i]; |
| 906 | int index = this->GetPointerIndexForContact(ti.dwID); |
| 907 | if (ti.dwID != 0 && index < VTKI_MAX_POINTERS) |
| 908 | { |
| 909 | // Do something with your touch input handle |
| 910 | ptInput.x = TOUCH_COORD_TO_PIXEL(ti.x); |
| 911 | ptInput.y = TOUCH_COORD_TO_PIXEL(ti.y); |
| 912 | ScreenToClient(hWnd, &ptInput); |
| 913 | this->SetEventInformationFlipY(ptInput.x, ptInput.y, ctrl, shift, 0, 0, 0, index); |
| 914 | } |
| 915 | } |
| 916 | bool didUpOrDown = false; |
| 917 | for (UINT i = 0; i < cInputs; i++) |
| 918 | { |
| 919 | TOUCHINPUT ti = pInputs[i]; |
| 920 | int index = this->GetPointerIndexForContact(ti.dwID); |
| 921 | if (ti.dwID != 0 && index < VTKI_MAX_POINTERS) |
| 922 | { |
| 923 | if (ti.dwFlags & TOUCHEVENTF_UP) |
| 924 | { |
| 925 | this->SetPointerIndex(index); |
| 926 | didUpOrDown = true; |
| 927 | this->InvokeEvent(vtkCommand::LeftButtonReleaseEvent, nullptr); |
| 928 | this->ClearPointerIndex(index); |
| 929 | } |
| 930 | if (ti.dwFlags & TOUCHEVENTF_DOWN) |
| 931 | { |
| 932 | this->SetPointerIndex(index); |
| 933 | didUpOrDown = true; |
| 934 | this->InvokeEvent(vtkCommand::LeftButtonPressEvent, nullptr); |
| 935 | } |
| 936 | this->SetPointerIndex(index); |
| 937 | } |
| 938 | } |
| 939 | if (!didUpOrDown) |
| 940 | { |
no test coverage detected