MinecraftMachina / ManyMC

📦 A familiar Minecraft Launcher with native support for macOS arm64 (M1)
GNU General Public License v3.0
500 stars 19 forks source link

Possible to implement MacOS scroll wheel fix? #13

Closed phurth closed 2 years ago

phurth commented 2 years ago

On MacOS, shift-scroll does a horizontal scroll which Minecraft ignores. The effect of this is to prevent scrolling through the hot bar while sneaking. This is a known issue in more recent versions of Minecraft. It appears there is a fix for this via an updated libglfw.dylib as found here. Is it possible to incorporate this fix within ManyMC?

ViRb3 commented 2 years ago

Hey, thanks for the report! Is the scroll fix submitted to the original GLFW or LWJGL, either as a pending PR or issue?

phurth commented 2 years ago

I don't think so, at least there's no indication of that in the sources I linked to. It appears someone modified libglfw.dylib (or one small component of it - cocoa_window.m) to fix a few Mac-specific incompatibilities. Ideally Mojang would patch Minecraft to fix this for real. It's been an issue for years. Interestingly, installing Forge fixes it for me as well.

ViRb3 commented 2 years ago

I just took a look at the patch that you linked. It looks like this:

\- (void)scrollWheel:(NSEvent *)event
{
    double deltaX = [event scrollingDeltaX];
    double deltaY = [event scrollingDeltaY];

    if ([event hasPreciseScrollingDeltas])
    {
        deltaX *= 0.1;
        deltaY *= 0.1;
    }

    if (fabs(deltaX) > 0.0 || fabs(deltaY) > 0.0)
-        _glfwInputScroll(window, deltaX, deltaY);
+        _glfwInputScroll(window, deltaX, deltaX + deltaY);
}

I don't think that this is a proper fix. It incorrectly makes GLFW report Y scroll to be X and Y combined, which so happens to work on Minecraft without side effects. The real issue actually comes from the fact that holding Shift produces X scroll on macOS, while it produces Y scroll on Windows and Linux. So, Minecraft simply hasn't implemented X scroll handling.

This issue is better suited as a mod. I have just fixed it in my McMouser mod v1.0.2 (CurseForge), and you can go ahead and download it for any MC version right away :)