diff --git a/README.md b/README.md index da23227..d3c1313 100644 --- a/README.md +++ b/README.md @@ -8,15 +8,7 @@ git clone https://github.com/Korea-Minecraft-Forum/CocoaInput.git cd CocoaInput ``` -2. Compile native library
-CocoaInput needs native-platform libraries to work. -To compile them, run one of below scripts which is your platform. - - native/build_lib_for_mac.sh - For macOS - - native/build_lib_for_x11.sh - For Linux - - native/build_lib_for_win.sh - For Windows - - (native/build_lib_all.sh - For all platform, You should create remote_build.sh to build macOS lib remotely.) - -3. Compile Mod
+2. Compile Mod
Type below command. Forge mod will be located in "forge/build/libs". Fabric mod will be located in "fabric/build/libs". @@ -31,7 +23,25 @@ Place it in your mods directory. CocoaInput requires [MinecraftForge](https://github.com/MinecraftForge/MinecraftForge) or [Fabric](https://github.com/FabricMC/fabric-loader). -This mod uses [Java Native Access](https://github.com/java-native-access/jna) (Apache Licence2) and binary for Minecraft 1.7.10 contains it. +## 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. + ## License Minecraft Mod Public License Japanese Translation diff --git a/common/src/main/java/jp/axer/cocoainput/arch/darwin/CallbackFunction.java b/common/src/main/java/jp/axer/cocoainput/arch/darwin/CallbackFunction.java index b59aaac..158da96 100644 --- a/common/src/main/java/jp/axer/cocoainput/arch/darwin/CallbackFunction.java +++ b/common/src/main/java/jp/axer/cocoainput/arch/darwin/CallbackFunction.java @@ -20,7 +20,7 @@ interface Func_setMarkedText extends Callback { } interface Func_firstRectForCharacterRange extends Callback { - Pointer invoke(); + void invoke(Pointer pointer); } // used to provide Objective-C with logging way diff --git a/common/src/main/java/jp/axer/cocoainput/arch/darwin/DarwinIMEOperator.java b/common/src/main/java/jp/axer/cocoainput/arch/darwin/DarwinIMEOperator.java index 9ee5f08..2fc2b7a 100644 --- a/common/src/main/java/jp/axer/cocoainput/arch/darwin/DarwinIMEOperator.java +++ b/common/src/main/java/jp/axer/cocoainput/arch/darwin/DarwinIMEOperator.java @@ -1,6 +1,6 @@ package jp.axer.cocoainput.arch.darwin; -import com.sun.jna.Memory; +import com.mojang.blaze3d.platform.Window; import com.sun.jna.Pointer; import jp.axer.cocoainput.CocoaInput; import jp.axer.cocoainput.arch.darwin.CallbackFunction.Func_firstRectForCharacterRange; @@ -10,6 +10,7 @@ import jp.axer.cocoainput.plugin.IMEReceiver; import jp.axer.cocoainput.util.ModLogger; import jp.axer.cocoainput.util.Rect; +import net.minecraft.client.Minecraft; import java.util.UUID; public class DarwinIMEOperator implements IMEOperator { @@ -43,7 +44,7 @@ public void invoke(String str, int position1, int length1, int position2, int le firstRectForCharacterRange_p = new Func_firstRectForCharacterRange() { @Override - public Pointer invoke() { + public void invoke(Pointer pointer) { ModLogger.debug("Called to determine where to draw."); Rect point = owner.getRect(); float[] buff; @@ -52,15 +53,17 @@ public Pointer invoke() { } else { buff = new float[]{point.getX(), point.getY(), point.getWidth(), point.getHeight()}; } + Window window = Minecraft.getInstance().getWindow(); double factor = CocoaInput.getScreenScaledFactor(); buff[0] *= factor; buff[1] *= factor; buff[2] *= factor; buff[3] *= factor; - Pointer ret = new Memory(Float.BYTES * 4); - ret.write(0, buff, 0, 4); - return ret; + buff[0] += window.getX(); + buff[1] += window.getY(); + + pointer.write(0, buff, 0, 4); } }; diff --git a/common/src/main/resources/darwin/libcocoainput.dylib b/common/src/main/resources/darwin/libcocoainput.dylib old mode 100644 new mode 100755 index 0ba5700..759bcdf Binary files a/common/src/main/resources/darwin/libcocoainput.dylib and b/common/src/main/resources/darwin/libcocoainput.dylib differ