Skip to content

Commit

Permalink
change: only detect left alt key
Browse files Browse the repository at this point in the history
Related to #2
  • Loading branch information
ishland committed Dec 31, 2023
1 parent a7a07ae commit 3d32d3c
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package com.ishland.fixkeyboardonlinux.mixin;

import net.minecraft.client.Keyboard;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.util.InputUtil;
import org.lwjgl.glfw.GLFW;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
Expand All @@ -12,7 +15,7 @@ public class MixinKeyboard {

@Inject(method = "onChar", at = @At(value = "HEAD"), cancellable = true)
private void beforeOnChar(CallbackInfo ci) {
if (Screen.hasControlDown() || Screen.hasAltDown()) ci.cancel();
if (Screen.hasControlDown() || InputUtil.isKeyPressed(MinecraftClient.getInstance().getWindow().getHandle(), GLFW.GLFW_KEY_LEFT_ALT)) ci.cancel();
}

}

0 comments on commit 3d32d3c

Please sign in to comment.