Skip to content

Commit 5c97ab4

Browse files
committed
Debug output for libkokoa
1 parent 9f746d8 commit 5c97ab4

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

libkokoa/library.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,5 +118,9 @@ void prepareLocale() {
118118
}
119119

120120
void setDebug(long debug) {
121-
DEBUG = debug == 0 ? false : true;
121+
if (DEBUG != (debug == 0 ? false : true)) {
122+
DEBUG = debug == 0 ? false : true;
123+
printf("[libkokoa/DEBUG] %sed debug mode\n", (DEBUG == true ? "enter" : "exit"));
124+
fflush(stdout);
125+
}
122126
}

src/main/java/cn/yesterday17/kokoalinux/config/ConfigManager.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package cn.yesterday17.kokoalinux.config;
22

33
import cn.yesterday17.kokoalinux.KokoaLinux;
4+
import cn.yesterday17.kokoalinux.input.InputHelper;
45
import com.google.common.collect.Sets;
56
import net.minecraftforge.common.config.Configuration;
67
import net.minecraftforge.fml.client.event.ConfigChangedEvent;
@@ -55,6 +56,9 @@ private static void sync() {
5556
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
5657
e.printStackTrace();
5758
}
59+
60+
// Sync debug with libkokoa
61+
InputHelper.setDebug();
5862
}
5963

6064
@SubscribeEvent

src/main/java/cn/yesterday17/kokoalinux/config/KokoaConfig.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@
77
public class KokoaConfig {
88
// Used by org.lwjgl.opengl.LinuxEvent.filterEventX
99
public static boolean enableIME = true;
10+
11+
public static boolean debug = false;
1012
}

src/main/java/cn/yesterday17/kokoalinux/input/InputHelper.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package cn.yesterday17.kokoalinux.input;
22

33
import cn.yesterday17.kokoalinux.KokoaGlobal;
4+
import cn.yesterday17.kokoalinux.config.KokoaConfig;
45

56
public class InputHelper {
67
// Used by org.lwjgl.opengl.LinuxDisplay.incDisplay
@@ -44,4 +45,8 @@ public static void destroyIC(long xic) {
4445
public static void toggleIC(boolean active) {
4546
KokoaGlobal.xic = InputNative.instance.toggleIC(active ? 1 : 0);
4647
}
48+
49+
public static void setDebug() {
50+
InputNative.instance.setDebug(KokoaConfig.debug ? 1 : 0);
51+
}
4752
}

0 commit comments

Comments
 (0)