Skip to content

Conversation

@Susko3
Copy link
Member

@Susko3 Susko3 commented Jan 27, 2026

As reported on the osu! forum:

From users logs I've gathered, pens on android currently report they've left proximity right before a click/touch. This is unexpected behaviour from both SDL and Android, as a pen should remain in proximity while it's touching the screen. #6695 made pen handling stricter and this caused the regression.

There are efforts to fix this on SDL's side, but progress has died down as it involves implementing a hack instead of trying to figure out why the Android part is not up to spec.

Instead, let's fix this locally in osu!framework by fetching the pen device type on all event types. The workaround is only applied on Android, as that's the platform with user reports (x11/xinput2 should also be broken, but affected users can use SDL2 or Wayland).

Testing

I don't currently have a device to test with.

On Android:

  • pen clicking works
  • pen hovering has valid and expected device type
  • pen touch event has valid and expected device type
  • moving the pen while touching has expected device type
  • SDL_GetPenDeviceType() in tryGetPenDeviceType() never fails
  • no logs are triggered in relevant handling code
  • unexpected condition is logged if the !penProximityWorkaround check is removed from handlePenProximityEvent()

Copy link
Contributor

@hwsmm hwsmm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a remark: if (penProximityWorkaround) in tryGetPenDevice is always reached because current Android SDL3 sends a motion event before a proximity-in event (which is a bug).

Other than that, I confirmed that this works fine on my tablet, and ticks most boxes in the OP. I'm not sure about the condition of 'SDL_GetPenDeviceType() in tryGetPenDeviceType() never fails', though..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants