moehreag / legacy-lwjgl3

A legacy-fabric mod that makes minecraft versions older than 1.13 run using LWJGL 3 instead of the legacy LWJGL 2
GNU Lesser General Public License v2.1
15 stars 2 forks source link

Weird behavior when typing via wayland IME #12

Open PumpkinXD opened 1 week ago

PumpkinXD commented 1 week ago

Description When typing single character in gui's input field through IME: the character got ignoreed and have to retype again(if pressed backspace before retype, the character will be ignored again) When typing a word contains 2+ characters, the first character is ignored

Information OS: Fedora Linux 40 (KDE Plasma) x86_64 IME:Fcitx5 (5.1.10) Minecraft Version: 1.8.9 Ornithe Version: 0.15.11 Legacy-LWJGL3 Version:1.1.8+1.8.9

Attachment

https://github.com/user-attachments/assets/972cfe61-ceb3-4655-a539-d5f8762e85a0

PumpkinXD commented 1 week ago

Reproduced on Ibus 1.5.29-rc2 (Ubuntu 24.04)

https://github.com/user-attachments/assets/34bb1126-65d7-4fa4-888e-76477adb9e61

PumpkinXD commented 1 week ago

seems we can get around this by

+           if (lastEvent.getInt(0) > 0 && lastEvent.getInt(4) ==0 ){
+               lastEvent.putInt(5, ch);
+               this.tmp_event.clear();
+               this.tmp_event.putInt(keycode).put(state).putInt(ch).putLong(nanos).put(repeat ? (byte) 1 : (byte) 0);
+               this.tmp_event.flip();
+               this.event_queue.putEvent(this.tmp_event);
+               return;
+           }
                       if (lastEvent.getInt(0) > 0 && lastEvent.getInt(5) == 0) { 

https://github.com/moehreag/legacy-lwjgl3/blob/41a7abb0b502cf61a103fdd39a40c757d177f019/src/main/java/io/github/moehreag/legacylwjgl3/implementation/glfw/GLFWKeyboardImplementation.java#L55