Skip to content
Open
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
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx1G
org.gradle.java.home=/Library/Java/JavaVirtualMachines/temurin-21.jdk/Contents/Home
# org.gradle.java.home=/Library/Java/JavaVirtualMachines/temurin-21.jdk/Contents/Home

# Fabric Properties
# check these on https://fabricmc.net/use
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/roockydev/mactouchmc/Logger.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

public class Logger {

static void log(Level level, String message) {
public static void log(Level level, String message) {
LogManager.getLogger().log(level, "[MCTouchBar] " + message);
}
static void log(Level level, Object message) {
public static void log(Level level, Object message) {
LogManager.getLogger().log(level, "[MCTouchBar] " + message);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package com.roockydev.mactouchmc.config;

import com.roockydev.mactouchmc.Logger;
import org.apache.logging.log4j.Level;

public class ConfigParser {
public static TouchBarButtonConfig parse(String definition) {
TouchBarButtonConfig config = new TouchBarButtonConfig();
Expand All @@ -11,7 +14,7 @@ public static TouchBarButtonConfig parse(String definition) {
if (parts.length >= 4) config.type = TouchBarButtonConfig.ActionType.valueOf(parts[3].trim());
if (parts.length >= 5) config.keyId = Integer.parseInt(parts[4].trim());
} catch (Exception e) {
System.err.println("Failed to parse button definition: " + definition);
Logger.log(Level.ERROR, "Failed to parse button definition: " + definition);
}
return config;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ private static void releaseKey(int keyCode) {
int scancode = GLFW.glfwGetKeyScancode(keyCode);

// Inject RELEASE
// System.out.println("[DEBUG] VirtualInputHandler: Releasing Key=" + keyCode);
client.execute(() -> {
if (client.keyboard != null) {
client.keyboard.onKey(window, keyCode, scancode, GLFW.GLFW_RELEASE, 0);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.roockydev.mactouchmc.input;

import com.roockydev.mactouchmc.Logger;
import net.minecraft.client.MinecraftClient;
import org.apache.logging.log4j.Level;
import org.lwjgl.glfw.GLFW;

public class VirtualInputHandler {
Expand All @@ -26,15 +28,15 @@ public static void handleButtonPress(int buttonIndex, boolean isdown) {
// Inject the key
if (MinecraftClient.getInstance().keyboard != null) {
int scancode = GLFW.glfwGetKeyScancode(keyCode);
System.out.println("[DEBUG] VirtualInputHandler: Injecting Key=" + keyCode + " Scancode=" + scancode + " Action=" + action);
Logger.log(Level.DEBUG, "VirtualInputHandler: Injecting Key=" + keyCode + " Scancode=" + scancode + " Action=" + action);
MinecraftClient.getInstance().keyboard.onKey(window, keyCode, scancode, action, 0);

// If this was a PRESS action (from TouchBar tap), schedule a RELEASE in 2 ticks
if (action == GLFW.GLFW_PRESS) {
KeyReleaseManager.scheduleRelease(keyCode, 2);
}
} else {
System.err.println("Keyboard instance is null!");
Logger.log(Level.ERROR, "Keyboard instance is null!");
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.roockydev.mactouchmc.layout;

import com.roockydev.mactouchmc.Logger;
import com.roockydev.mactouchmc.api.TouchBarLayout;
import com.thizzer.jtouchbar.JTouchBar;
import org.apache.logging.log4j.Level;
import org.lwjgl.glfw.GLFWNativeCocoa;

/**
Expand Down Expand Up @@ -31,7 +33,7 @@ public void setLayout(TouchBarLayout layout) {

// Only switch if different (or force update logic if needed)
if (this.currentLayout != layout) {
System.out.println("[DEBUG] LayoutManager: Switching layout to " + layout.getClass().getSimpleName());
Logger.log(Level.DEBUG, "LayoutManager: Switching layout to " + layout.getClass().getSimpleName());
this.currentLayout = layout;
show(layout.getTouchBar());
}
Expand Down