-
Notifications
You must be signed in to change notification settings - Fork 423
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Windows Ink events being handled as touch events #5309
Conversation
Can confirm that, on a touchscreen monitor, touch names are reported as |
I tested with my tool which use windows ink api to Inject pen event. I never use .net before and I can't find any place showed the event name in both protected override void HandleTouchFingerEvent(SDL.SDL_TouchFingerEvent evtTfinger)
{
Logger.Log($"pen event: {evtTfinger.type} {evtTfinger.x} {evtTfinger.y}", LoggingTarget.Runtime, LogLevel.Debug);
if (evtTfinger.TryGetTouchName(out string name) && name == "pen")
{
// Windows Ink tablet/pen handling
// InputManager expects to receive this as mouse events, to have proper `mouseSource` input priority (see InputManager.GetPendingInputs)
// osu! expects to get tablet events as mouse events, and touch events as touch events for touch device (TD mod) handling (see https://github.com/ppy/osu/issues/25590)
TriggerMouseMove(evtTfinger.x * ClientSize.Width, evtTfinger.y * ClientSize.Height);
Logger.Log($"pen event: {evtTfinger.type}({name}) {evtTfinger.x} {evtTfinger.y}", LoggingTarget.Runtime, LogLevel.Debug);
// ... looks good, at least
This bug really prevents me from playing lazer so I did this quick test, hope it helps you. |
Redundant with the SDL2-CS update, see flibitijibibo/SDL2-CS#235.
Thanks for testing! Looks like it's correctly recognising pen/windows ink events. Some things to try out:
|
ok, I did test, my vTablet runs well with default setting
I can't find "relative mouse mode", I think you mean
The pointer would be locked at 0,0
Enable Input/Touch or not doesn't effect to my app
I think it is based on OTD, so it doesn't works for me
|
Hmm, this means that windows ink hover events are delivered trough
That's a bit unexpected, as the linked |
I don't know how to get raw input event in osu, I played with pure pen and save a record, hope it include the data you need I build a golang program (thank gpt), then you can test it without a tablet.
Source Codepackage main
import (
"flag"
"math"
"time"
"github.com/Teages/go-vdigi"
)
var (
fps int
duration int
)
func init() {
flag.IntVar(&fps, "fps", 240, "frames per second")
flag.IntVar(&duration, "duration", 1, "duration in seconds")
flag.Parse()
}
func main() {
screens := vdigi.GetScreens()
mainScreen, _ := screens.GetScreen(0)
width, height := mainScreen.Width, mainScreen.Height
pointer, _ := vdigi.CreatePointerForScreen(0)
centerX, centerY := int32(width/2), int32(height/2)
drawCircle(pointer, centerX, centerY, 100, 0)
drawCircle(pointer, centerX, centerY, 50, 32767)
pointer.Update(centerX, centerY, 0)
pointer.Destroy()
}
func drawCircle(pointer *vdigi.Pointer, centerX, centerY, radius int32, pressure uint32) {
frames := duration * fps
for i := 0; i < frames; i++ {
angle := float64(i) * 2 * math.Pi / float64(frames)
x := centerX + int32(float64(radius)*math.Cos(angle))
y := centerY + int32(float64(radius)*math.Sin(angle))
pointer.Update(x, y, pressure)
time.Sleep(time.Second / time.Duration(fps))
}
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gonna get this in as we continue to get reports of this. The remaining issue looks like it can be solved separately.
From my testing with the above program, windows ink input works with High precision mouse turned on and off. The only issue seems to be with Precision != 1.0: hover events apply the precision, but "pen down" events don't. But that was an issue even before this PR, so it should be solved separately. |
Depends on:
SDL_GetTouchName
flibitijibibo/SDL2-CS#234Previously (without
SDL_HINT_TOUCH_MOUSE_EVENTS = "0"
) pen/touch inputs were sent as mouse events.Disabling
Use Windows Ink
in wacom driver settings fixes the issue, as it reports inputs as mouse events.This also fixes in-game tablet handling clashing with Windows Ink "touches", as
InputManager
will properly block unwanted mouse events (but won't block touch events!).