diff --git a/README.md b/README.md index 46772e6..af9d6f8 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@ # caramelChat -![License](https://img.shields.io/github/license/LemonCaramel/caramelChat.svg) ![GitHub Issues](https://img.shields.io/github/issues/LemonCaramel/caramelChat.svg) ![GitHub Tag](https://img.shields.io/github/tag/LemonCaramel/caramelChat.svg) @@ -34,6 +33,25 @@ Below is the ModLoader compatibility. | Fabric / Quilt | 🟢 Compatible | | Forge / NeoForge | 🟢 Compatible | +## 🛠️ Troubleshooting (macOS 14.0+) +If you are using macOS Sonoma or later versions, you may experience the following issue: +- Some characters are skipped when typing very quickly. +- The client crashes when a system key is pressed (e.g., input source switch). + +Most of the causes are due to the Input Tooltip added in Sonoma. However, Apple has not provided an API to disable it. + +![macOS Sonoma Indicator](https://github.com/LemonCaramel/caramelChat/assets/45729082/e1d34917-1892-4cb6-aa3f-38fdab58fad9) + + +You can disable the Input Tooltip system-wide through the following guide. + +Open the Terminal and enter the following command: +```Bash +sudo mkdir -p /Library/Preferences/FeatureFlags/Domain +sudo /usr/libexec/PlistBuddy -c "Add 'redesigned_text_cursor:Enabled' bool false" /Library/Preferences/FeatureFlags/Domain/UIKit.plist +``` +And then, reboot your Macintosh. This will return you to the input environment from before Sonoma. + ## 🚀️ Contributing All contributions are welcome regardless of Native or Java. diff --git a/common/src/main/java/moe/caramel/chat/Main.java b/common/src/main/java/moe/caramel/chat/Main.java index 30145c6..9e9ced8 100644 --- a/common/src/main/java/moe/caramel/chat/Main.java +++ b/common/src/main/java/moe/caramel/chat/Main.java @@ -79,7 +79,7 @@ public static String copyLibrary(final String name) { final InputStream is = url.openStream(); final FileOutputStream fos = new FileOutputStream(lib) ) { - ModLogger.debug("Extracting library to {0}", lib.getAbsolutePath()); + ModLogger.debug("Extracting library to {}", lib.getAbsolutePath()); fos.write(is.readAllBytes()); lib.deleteOnExit(); } diff --git a/common/src/main/java/moe/caramel/chat/driver/arch/darwin/DarwinOperator.java b/common/src/main/java/moe/caramel/chat/driver/arch/darwin/DarwinOperator.java index b854dc5..9411ea8 100644 --- a/common/src/main/java/moe/caramel/chat/driver/arch/darwin/DarwinOperator.java +++ b/common/src/main/java/moe/caramel/chat/driver/arch/darwin/DarwinOperator.java @@ -1,7 +1,6 @@ package moe.caramel.chat.driver.arch.darwin; -import com.sun.jna.Memory; -import com.sun.jna.Pointer; +import com.mojang.blaze3d.platform.Window; import moe.caramel.chat.driver.IOperator; import moe.caramel.chat.util.ModLogger; import moe.caramel.chat.wrapper.AbstractIMEWrapper; @@ -38,18 +37,20 @@ public DarwinOperator(final DarwinController controller, final AbstractIMEWrappe this.wrapper.appendPreviewText(str); }, // Rect Range - () -> { + (pointer) -> { ModLogger.debug("[Native|Java] Called to determine where to draw."); final float[] buff = this.wrapper.getRect().copy(); - final float factor = (float) Minecraft.getInstance().getWindow().getGuiScale(); + final Window window = Minecraft.getInstance().getWindow(); + final float factor = (float) window.getGuiScale(); buff[0] *= factor; buff[1] *= factor; buff[2] *= factor; buff[3] *= factor; - final Pointer rect = new Memory(Float.BYTES * 4); - rect.write(0, buff, 0, 4); - return rect; + buff[0] += window.getX(); + buff[1] += window.getY(); + + pointer.write(0, buff, 0, 4); } ); } diff --git a/common/src/main/java/moe/caramel/chat/driver/arch/darwin/Driver_Darwin.java b/common/src/main/java/moe/caramel/chat/driver/arch/darwin/Driver_Darwin.java index bf096f5..9acd9fe 100644 --- a/common/src/main/java/moe/caramel/chat/driver/arch/darwin/Driver_Darwin.java +++ b/common/src/main/java/moe/caramel/chat/driver/arch/darwin/Driver_Darwin.java @@ -44,7 +44,7 @@ interface SetMarkedText extends Callback { } interface FirstRectForCharacterRange extends Callback { - Pointer invoke(); + void invoke(final Pointer pointer); } interface LogInfoCallback extends Callback { diff --git a/common/src/main/resources/native/libdarwincocoainput.dylib b/common/src/main/resources/native/libdarwincocoainput.dylib old mode 100644 new mode 100755 index 0ba5700..759bcdf Binary files a/common/src/main/resources/native/libdarwincocoainput.dylib and b/common/src/main/resources/native/libdarwincocoainput.dylib differ diff --git a/gradle.properties b/gradle.properties index 34a3d65..62e4a5c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,7 @@ org.gradle.jvmargs=-Xmx2G archives_base_name=caramelChat -mod_version=1.1.0 +mod_version=1.1.1-SNAPSHOT maven_group=moe.caramel minecraft_version=1.20.2