Skip to content
Prev Previous commit
Next Next commit
Make handleMouseWheelEvent() thread-safe
  • Loading branch information
Susko3 committed Jan 11, 2025
commit 5119ef6d0f206fc8ad4f3d335c03a31bcae93d6e
11 changes: 9 additions & 2 deletions osu.Framework/Platform/SDL3/SDL3Window_Input.cs
Original file line number Diff line number Diff line change
Expand Up @@ -423,10 +423,17 @@ private void handleMouseWheelEvent(SDL_MouseWheelEvent evtWheel)
{
bool isPrecise(float f) => f % 1 != 0;

bool precise;

if (isPrecise(evtWheel.x) || isPrecise(evtWheel.y))
{
precise = true;
lastPreciseScroll = evtWheel.timestamp;

bool precise = evtWheel.timestamp < lastPreciseScroll + precise_scroll_debounce;
}
else
{
precise = evtWheel.timestamp < lastPreciseScroll + precise_scroll_debounce;
}

// SDL reports horizontal scroll opposite of what framework expects (in non-"natural" mode, scrolling to the right gives positive deltas while we want negative).
TriggerMouseWheel(new Vector2(-evtWheel.x, evtWheel.y), precise);
Expand Down
Loading