protected override void WndProc(ref Message m) { var state = TouchLocationState.Invalid; switch (m.Msg) { case WM_TABLET_QUERYSYSTEMGESTURESTA: { // This disables the windows touch helpers, popups, and // guides that get in the way of touch gameplay. const int flags = 0x00000001 | // TABLET_DISABLE_PRESSANDHOLD 0x00000008 | // TABLET_DISABLE_PENTAPFEEDBACK 0x00000010 | // TABLET_DISABLE_PENBARRELFEEDBACK 0x00000100 | // TABLET_DISABLE_TOUCHUIFORCEON 0x00000200 | // TABLET_DISABLE_TOUCHUIFORCEOFF 0x00008000 | // TABLET_DISABLE_TOUCHSWITCH 0x00010000 | // TABLET_DISABLE_FLICKS 0x00080000 | // TABLET_DISABLE_SMOOTHSCROLLING 0x00100000; // TABLET_DISABLE_FLICKFALLBACKKEYS m.Result = new IntPtr(flags); return; } case WM_SYSCOMMAND: // Disable the system menu from being toggled by // keyboard input so we can own the ALT key. if (m.WParam.ToInt32() == 0xF100) // SC_KEYMENU { m.Result = IntPtr.Zero; return; } break; case WM_POINTERUP: state = TouchLocationState.Released; break; case WM_POINTERDOWN: state = TouchLocationState.Pressed; break; case WM_POINTERUPDATE: state = TouchLocationState.Moved; break; } if (state != TouchLocationState.Invalid) { var id = m.GetPointerId(); var position = m.GetPointerLocation(); position = PointToClient(position); var vec = new Vector2(position.X, position.Y); TouchPanel.AddEvent(id, state, vec, false); } base.WndProc(ref m); }
protected override void WndProc(ref Message m) { var state = TouchLocationState.Invalid; switch (m.Msg) { case WM_SYSCOMMAND: // Disable the system menu from being toggled by // keyboard input so we can own the ALT key. if (m.WParam.ToInt32() == 0xF100) // SC_KEYMENU { m.Result = IntPtr.Zero; return; } break; case WM_POINTERUP: state = TouchLocationState.Released; break; case WM_POINTERDOWN: state = TouchLocationState.Pressed; break; case WM_POINTERUPDATE: state = TouchLocationState.Moved; break; } if (state != TouchLocationState.Invalid) { var id = m.GetPointerId(); var position = m.GetPointerLocation(); position = PointToClient(position); var vec = new Vector2(position.X, position.Y); TouchPanel.AddEvent(id, state, vec, false); } base.WndProc(ref m); }
protected override void WndProc(ref Message m) { var state = TouchLocationState.Invalid; if (m.Msg == WM_POINTERUP) state = TouchLocationState.Released; else if (m.Msg == WM_POINTERDOWN) state = TouchLocationState.Pressed; else if (m.Msg == WM_POINTERUPDATE) state = TouchLocationState.Moved; if (state != TouchLocationState.Invalid) { var id = m.GetPointerId(); var position = m.GetPointerLocation(); position = PointToClient(position); var vec = new Vector2(position.X, position.Y); TouchPanel.AddEvent(id, state, vec, false); } base.WndProc(ref m); }