Repository navigation
fix(sdl): only forward whole wheel notches to the LWJGL 2 input path - #708
Merged
Rongmario merged 1 commit intoOct 21, 2026
Merged
Conversation
High-resolution mouse wheels report a single notch as several SDL wheel events with fractional deltas. LWJGL 2 consumers (hotbar scrolling, JEI page flipping, most mod GUIs) treat every non-zero Mouse.getEventDWheel() as one step, so one notch scrolled several slots or pages. Feed the legacy queue SDL's accumulated integer_y instead, which is only non-zero once a whole notch completes. The modern MouseEvent.Wheel keeps the smooth fractional amount. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Rongmario
approved these changes
Oct 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
With a high-resolution mouse wheel, one physical notch scrolls several hotbar slots or JEI/HEI pages at once (one click jumped from page 1 to page 17). Reproduced on KDE Plasma 6.8 Wayland and on X11 (XWayland,
SDL_VIDEO_DRIVER=x11) with a Logitech G502 X PLUS in hi-res scroll mode. Related to #548, but not the same issue.Cause
SDL reports one notch as several wheel events with fractional
y(about 0.125 each).Window.wheelforwards every one of them toLegacyInputQueues.wheel, which appends one LWJGL 2 mouse event per SDL event. LWJGL 2 consumers (vanillachangeCurrentItem, JEI page flipping, most mod GUIs) treat every non-zeroMouse.getEventDWheel()as one step. LWJGLY already scales the magnitude correctly (wheel * 120with carry), so the number of events is what's wrong, not their size.Fix
The legacy path now uses
SDL_MouseWheelEvent.integer_y, which SDL only makes non-zero once a whole notch has accumulated, and skips the event when it is 0. The modernMouseEvent.Wheelpost is unchanged and keeps the smooth float amount.integer_yneeds SDL 3.2.12 or newer; the bundled LWJGL 3.4.3 natives ship SDL 3.4.14.Testing
./gradlew compileJavapasses onmain.0.7.11-alphaand played a large 1.12.2 modpack with it (KDE Wayland, G502 X PLUS hi-res wheel). One ratchet click now moves the hotbar one slot and JEI/HEI one page. Free-spin scrolling still works.🤖 Generated with Claude Code