X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Finput%2Fwindows%2Ftouchscreen.cpp;h=ce8e5a2f71270c2278e97a6aba799c985d173907;hb=43d31e73c4b97a37017757232c4ef1db355fee3a;hp=180f1c04f568816bb9fc8de1ce7ed383c156173e;hpb=1d7113259625a91f5f6d2f53365aad22ae744689;p=libs%2Fgui.git diff --git a/source/input/windows/touchscreen.cpp b/source/input/windows/touchscreen.cpp index 180f1c0..ce8e5a2 100644 --- a/source/input/windows/touchscreen.cpp +++ b/source/input/windows/touchscreen.cpp @@ -8,9 +8,31 @@ using namespace std; namespace Msp { namespace Input { +bool Touchscreen::is_available() +{ + // Must have at least Windows 7 (WinNT 6.1) for WM_TOUCH + OSVERSIONINFOEX version; + version.dwOSVersionInfoSize = sizeof(version); + version.dwMajorVersion = 6; + version.dwMinorVersion = 1; + version.wServicePackMajor = 0; + version.wServicePackMinor = 0; + DWORD mask = VER_MAJORVERSION|VER_MINORVERSION|VER_SERVICEPACKMAJOR|VER_SERVICEPACKMINOR; + DWORDLONG cond = VerSetConditionMask(0, mask, VER_GREATER_EQUAL); + if(VerifyVersionInfo(&version, mask, cond)) + return false; + + if(!GetSystemMetrics(SM_TABLETPC)) + return false; + if(!(GetSystemMetrics(SM_DIGITIZER)&NID_READY)) + return false; + + return true; +} + void Touchscreen::input_event(const Graphics::Window::Event &event) { - if(event.msg==WM_TOUCHMOVE) + if(event.msg==WM_TOUCH) { HTOUCHINPUT handle = reinterpret_cast(event.lparam); unsigned n_points = LOWORD(event.wparam); @@ -41,7 +63,5 @@ void Touchscreen::input_event(const Graphics::Window::Event &event) } } - - } // namespace Input } // namespace Msp