private bool IgnoreGestureToMousePromotion(StylusSystemGestureEventArgs gestureArgs, StylusTouchDevice touchDevice) { if (gestureArgs != null && touchDevice.DownHandled) { // If touchDevice's down event is already handled // and if this gesture is a candidate for mouse // left button down promotion, then such a // promotion should be ignored. SystemGesture gesture = gestureArgs.SystemGesture; if (gesture == SystemGesture.Tap || gesture == SystemGesture.Drag) { return true; } } return false; }
internal void PromoteStoredItemsToMouse(StylusTouchDevice touchDevice) { if (!ShouldPromoteToMouse(touchDevice.StylusDevice)) { return; } IList<StagingAreaInputItem> storedItems = touchDevice.StoredStagingAreaItems; int count = storedItems.Count; for (int i = 0; i < count; i++) { // A stored item could be a Stylus input staging item queued to be promoted to mouse // OR a raw mouse input report staging item for Button1Press delayed from // StylusLogic.PreProcessInput. If this staging item is of such a raw mouse // input report call StylusDevice's PlaybackCachedDownInputReport OR else // call PromoteMainToMouse method. StagingAreaInputItem stagingItem = storedItems[i]; InputReportEventArgs inputReportArgs = stagingItem.Input as InputReportEventArgs; if (inputReportArgs != null && inputReportArgs.Report.Type == InputType.Mouse && !(inputReportArgs.Device is StylusDevice)) { touchDevice.StylusDevice.PlayBackCachedDownInputReport(inputReportArgs.Report.Timestamp); } else { PromoteMainToMouse(stagingItem); } } storedItems.Clear(); }