public static CompositeInputControllerMartyr Activate( PointerInputType inputType) { var controllerMartyr = new CompositeInputControllerMartyr(previousInputType: ActiveInputType); switch (inputType) { case PointerInputType.Mouse: controllerMartyr.Add(martyr: PointerInput.Activate(pointer: Mouse.Instance)); controllerMartyr.Add(martyr: MouseWheelInput.Activate(mouseWheel: Mouse.Instance)); break; case PointerInputType.Pen: controllerMartyr.Add(martyr: PointerInput.Activate(pointer: Pen.Instance)); controllerMartyr.Add(martyr: SinglePointGesture.Activate(pointer: Pen.Instance)); break; case PointerInputType.SingleTouch: controllerMartyr.Add(martyr: PointerInput.Activate(pointer: SingleTouch.Instance)); controllerMartyr.Add(martyr: SinglePointGesture.Activate(pointer: SingleTouch.Instance)); break; case PointerInputType.MultiTouch: controllerMartyr.Add(martyr: PointerInput.Activate(pointer: MultiTouch.Instance)); controllerMartyr.Add(martyr: SinglePointGesture.Activate(pointer: MultiTouch.Instance)); controllerMartyr.Add(martyr: MultiPointGesture.Activate(pointer: MultiTouch.Instance)); break; } ActiveInputType = inputType; return(controllerMartyr); }
private PointerTouchInfo MakePointerTouchInfo(PointerInputType pointer, PointerFlags click, int x, int y, int radius, uint id, string type, uint orientation = 90, uint pressure = 32000) { var contact = new PointerTouchInfo { PointerInfo = { pointerType = pointer }, TouchFlags = TouchFlags.NONE, Orientation = orientation, Pressure = pressure }; if (type == "Start") { contact.PointerInfo.PointerFlags = PointerFlags.DOWN | PointerFlags.INRANGE | PointerFlags.INCONTACT; } else if (type == "Move") { contact.PointerInfo.PointerFlags = PointerFlags.UPDATE | PointerFlags.INRANGE | PointerFlags.INCONTACT; } else if (type == "End") { contact.PointerInfo.PointerFlags = PointerFlags.UP; } else if (type == "EndToHover") { contact.PointerInfo.PointerFlags = PointerFlags.UP | PointerFlags.INRANGE; } else if (type == "Hover") { contact.PointerInfo.PointerFlags = PointerFlags.UPDATE | PointerFlags.INRANGE; } else if (type == "EndFromHover") { contact.PointerInfo.PointerFlags = PointerFlags.UPDATE; } contact.PointerInfo.PointerFlags |= click; contact.TouchMasks = TouchMask.CONTACTAREA | TouchMask.ORIENTATION | TouchMask.PRESSURE; contact.PointerInfo.PtPixelLocation.X = x; contact.PointerInfo.PtPixelLocation.Y = y; contact.PointerInfo.PointerId = id; contact.ContactArea.left = x - radius; contact.ContactArea.right = x + radius; contact.ContactArea.top = y - radius; contact.ContactArea.bottom = y + radius; return(contact); }
private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) { bool ret; uint pointId; PointerInputType inputType = PointerInputType.PEN; POINTER_PEN_INFO penInfo = new POINTER_PEN_INFO(); switch (msg) { case API.WM_POINTERENTER: case API.WM_POINTERUPDATE: case API.WM_POINTERDOWN: case API.WM_POINTERUP: case API.WM_POINTERLEAVE: pointId = API.GET_POINTERID_WPARAM((uint)wParam.ToInt32()); ret = API.GetPointerType(pointId, ref inputType); if (!ret) { break; } if (inputType == PointerInputType.PEN) { ret = API.GetPointerPenInfo(pointId, ref penInfo); if (!ret) { break; } ProcessPenPoint(msg, penInfo, API.GET_X_LPARAM((uint)lParam.ToInt32()), API.GET_Y_LPARAM((uint)lParam.ToInt32())); } handled = true; break; default: break; } return(IntPtr.Zero); }
public CompositeInputControllerMartyr(PointerInputType previousInputType) { this._inputControllerMartyrStack = new Stack <IDisposable>(); this._previousInputType = previousInputType; }
public static extern bool GetPointerType(uint pointerId, ref PointerInputType pointerType);
public static extern bool UnregisterPointerInputTarget(IntPtr hwnd, PointerInputType pointerType);