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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/main/java/me/eigenraven/lwjgl3ify/core/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public class Config {
public static boolean OPENGL_CONTEXT_NO_ERROR = false;

public static boolean INPUT_INVERT_WHEEL = false;
public static boolean INPUT_INVERT_X_WHEEL = false;
public static double INPUT_SCROLL_SPEED = 1.0;

public static String X11_CLASS_NAME = "minecraft";
Expand Down Expand Up @@ -182,6 +183,11 @@ public static void reloadConfigObject() {

INPUT_INVERT_WHEEL = config
.getBoolean("invertScrollWheel", CATEGORY_INPUT, INPUT_INVERT_WHEEL, "Invert scrolling direction");
INPUT_INVERT_X_WHEEL = config.getBoolean(
"invertHorizontalScroll",
CATEGORY_INPUT,
INPUT_INVERT_X_WHEEL,
"Invert horizontal scrolling direction (respects invertScrollWheel)");
INPUT_SCROLL_SPEED = (double) config.getFloat(
"scrollSpeedMultiplier",
CATEGORY_INPUT,
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/lwjglx/opengl/Display.java
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ public void invoke(long window, double xoffset, double yoffset) {
if (Config.DEBUG_PRINT_MOUSE_EVENTS) {
Lwjgl3ify.LOG.info("[DEBUG-MOUSE] wheel window:{} xoffset:{} yoffset:{}", window, xoffset, yoffset);
}
Mouse.addWheelEvent(yoffset);
Mouse.addWheelEvent(yoffset == 0 ? (Config.INPUT_INVERT_X_WHEEL ? -xoffset : xoffset) : yoffset);
}
};

Expand Down