Can't scroll while holding SHIFT on macOS
unilock opened this issue ยท 3 comments
On macOS, while holding the SHIFT key, scrolling using the mouse wheel does not work anywhere in-game. This is most notable when attempting to scroll through hotbar slots.
This does not affect 1.7.10 without LWJGL3ify.
See MC-121772.
(as a side note, lwjgl3ify is surprisingly not affected by MC-59810)
Versions:
- Minecraft
1.7.10
- Forge
10.13.4.1614
- LWJGL
3.3.2
- LWJGL3ify
1.5.2
I suspect the issue is here:
lwjgl3ify/src/main/java/org/lwjglx/opengl/Display.java
Lines 263 to 272 in f5906d0
Holding SHIFT while scrolling on macOS usually enables "horizontal scrolling", which I assume would mean here that the xoffset
parameter would be set instead of the yoffset
parameter. However, it seems the former is completely ignored by LWJGL3ify.
Minecraft itself had this issue until 1.20.2; I wonder what their fix was?
Minecraft itself had this issue until 1.20.2; I wonder what their fix was?
net.minecraft.client.MouseHandler
(Yarn mappings)
private void onScroll(long l, double d, double e) {
if (l == Minecraft.getInstance().getWindow().getWindow()) {
boolean bl = this.minecraft.options.discreteMouseScroll().get();
double f = this.minecraft.options.mouseWheelSensitivity().get();
double g = (bl ? Math.signum(d) : d) * f;
double h = (bl ? Math.signum(e) : e) * f;
if (this.minecraft.getOverlay() == null) {
if (this.minecraft.screen != null) {
double i = this.xpos * (double)this.minecraft.getWindow().getGuiScaledWidth() / (double)this.minecraft.getWindow().getScreenWidth();
double j = this.ypos * (double)this.minecraft.getWindow().getGuiScaledHeight() / (double)this.minecraft.getWindow().getScreenHeight();
this.minecraft.screen.mouseScrolled(i, j, g, h);
this.minecraft.screen.afterMouseAction();
} else if (this.minecraft.player != null) {
if (this.accumulatedScrollX != 0.0 && Math.signum(g) != Math.signum(this.accumulatedScrollX)) {
this.accumulatedScrollX = 0.0;
}
if (this.accumulatedScrollY != 0.0 && Math.signum(h) != Math.signum(this.accumulatedScrollY)) {
this.accumulatedScrollY = 0.0;
}
this.accumulatedScrollX += g;
this.accumulatedScrollY += h;
int k = (int)this.accumulatedScrollX;
int m = (int)this.accumulatedScrollY;
if (k == 0 && m == 0) {
return;
}
this.accumulatedScrollX -= (double)k;
this.accumulatedScrollY -= (double)m;
int n = m == 0 ? -k : m;
if (this.minecraft.player.isSpectator()) {
if (this.minecraft.gui.getSpectatorGui().isMenuActive()) {
this.minecraft.gui.getSpectatorGui().onMouseScrolled(-n);
} else {
float o = Mth.clamp(this.minecraft.player.getAbilities().getFlyingSpeed() + (float)m * 0.005F, 0.0F, 0.2F);
this.minecraft.player.getAbilities().setFlyingSpeed(o);
}
} else {
this.minecraft.player.getInventory().swapPaint((double)n);
}
}
}
}
}
I guess that would translate to simply Mouse.addWheelEvent(yoffset == 0 ? -xoffset : yoffset);
in this case.
Note that this would reverse hotbar scrolling while holding SHIFT (instead of breaking it completely), which is what vanilla Minecraft 1.20.2 does as well.
Unless there were an option to toggle this behavior (a la MacOS Input Fixes), I personally would prefer leaving out the inversion of xoffset
, making scrolling work in the same direction regardless of SHIFT being held.