Skip to content
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 for horizontal scrolling #96

Merged
merged 3 commits into from
Nov 26, 2023
Merged

Fix for horizontal scrolling #96

merged 3 commits into from
Nov 26, 2023

Conversation

unilock
Copy link
Contributor

@unilock unilock commented Nov 26, 2023

This PR accounts for horizontal scrolling (as opposed to the traditional vertical scrolling), i.e. when holding SHIFT on macOS, to be accounted for by the game by passing xoffset (horizontal scroll offset) instead of yoffset (vertical scroll offset) to Mouse#addWheelEvent when yoffset is 0 (and thus not vertical) when initializing Display$Window#mouseButtonCallback.

This was a bug in Minecraft ever since it updated to LWJGL 3 officially, until it was fixed in 1.20.2.
Note that the vanilla game (now) inverts horizontal scrolling by default - for example, in my case (on my macOS machine), when scrolling through items in the hotbar, scrolling normally would move the item selector(?) in one direction, while doing so while holding SHIFT would move it in the other.

This does not match the behavior of the few mods that fixed this issue before Mojang did (including EmuNO, MacOS Input Fixes, and McMouser), which would scroll in the same direction regardless of whether SHIFT was held.

Because of this discrepancy, this PR also adds a config option to invert horizontal scrolling specifically. Note that it respects / "stacks with" the general "invert scrolling" config option - having both enabled would invert horizontal scrolling twice, making it go in the same direction as when both config options are disabled, etc.

Verified

This commit was signed with the committer’s verified signature.
Julesssss Jules
Display$Window#scrollCallback: when the vertical scrolling offset (yoffset) is 0, pass the horizontal scrolling offset (xoffset) to Mouse#addWheelEvent instead

Fixes #90

Signed-off-by: unilock <[email protected]>

Verified

This commit was signed with the committer’s verified signature.
Julesssss Jules
Respects "invertScrollWheel", in that horizontal scrolling will be double-inverted if both config options are enabled. (thus: not inverted)

Disabled by default.

(Technically, when horizontal scrolling was fixed in Minecraft 1.20.2, it was made to be inverted by default.)

(However, all mods that implemented the same fix before Mojang did (EmuNO, MacOS Input Fixes, McMouser, etc.) do *not* invert horizontal scrolling by default - LWJGL3ify follows this standard.)

Signed-off-by: unilock <[email protected]>

Verified

This commit was signed with the committer’s verified signature.
Julesssss Jules
Signed-off-by: unilock <[email protected]>
@eigenraven eigenraven self-requested a review November 26, 2023 17:56
@eigenraven eigenraven merged commit ecdd15f into GTNewHorizons:master Nov 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants