|
11 | 11 | using osu.Framework.Extensions.EnumExtensions; |
12 | 12 | using osu.Framework.Graphics.Primitives; |
13 | 13 | using osu.Framework.Input; |
| 14 | +using osu.Framework.Input.StateChanges; |
14 | 15 | using osu.Framework.Input.States; |
15 | 16 | using osu.Framework.Logging; |
16 | 17 | using osuTK; |
@@ -530,14 +531,16 @@ private void handleKeyboardEvent(SDL_KeyboardEvent evtKey) |
530 | 531 |
|
531 | 532 | private void handleKeymapChangedEvent() => KeymapChanged?.Invoke(); |
532 | 533 |
|
| 534 | + private static TabletPenDeviceType getPenType(SDL_PenID instanceID) => SDL_GetPenDeviceType(instanceID).ToTabletPenDeviceType(); |
| 535 | + |
533 | 536 | private void handlePenMotionEvent(SDL_PenMotionEvent evtPenMotion) |
534 | 537 | { |
535 | | - PenMove?.Invoke(new Vector2(evtPenMotion.x, evtPenMotion.y) * Scale, evtPenMotion.pen_state.HasFlagFast(SDL_PenInputFlags.SDL_PEN_INPUT_DOWN)); |
| 538 | + PenMove?.Invoke(getPenType(evtPenMotion.which), new Vector2(evtPenMotion.x, evtPenMotion.y) * Scale, evtPenMotion.pen_state.HasFlagFast(SDL_PenInputFlags.SDL_PEN_INPUT_DOWN)); |
536 | 539 | } |
537 | 540 |
|
538 | 541 | private void handlePenTouchEvent(SDL_PenTouchEvent evtPenTouch) |
539 | 542 | { |
540 | | - PenTouch?.Invoke(evtPenTouch.down, new Vector2(evtPenTouch.x, evtPenTouch.y) * Scale); |
| 543 | + PenTouch?.Invoke(getPenType(evtPenTouch.which), evtPenTouch.down, new Vector2(evtPenTouch.x, evtPenTouch.y) * Scale); |
541 | 544 | } |
542 | 545 |
|
543 | 546 | /// <summary> |
@@ -745,13 +748,13 @@ private void updateConfineMode() |
745 | 748 | /// <summary> |
746 | 749 | /// Invoked when a pen moves. Passes pen position and whether the pen is touching the tablet surface. |
747 | 750 | /// </summary> |
748 | | - public event Action<Vector2, bool>? PenMove; |
| 751 | + public event Action<TabletPenDeviceType, Vector2, bool>? PenMove; |
749 | 752 |
|
750 | 753 | /// <summary> |
751 | 754 | /// Invoked when a pen touches (<c>true</c>) or lifts (<c>false</c>) from the tablet surface. |
752 | 755 | /// Also passes the current position of the pen. |
753 | 756 | /// </summary> |
754 | | - public event Action<bool, Vector2>? PenTouch; |
| 757 | + public event Action<TabletPenDeviceType, bool, Vector2>? PenTouch; |
755 | 758 |
|
756 | 759 | /// <summary> |
757 | 760 | /// Invoked when a <see cref="TabletPenButton">pen button</see> is pressed (<c>true</c>) or released (<c>false</c>). |
|
0 commit comments