godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.91k stars 21.05k forks source link

X compose key on Linux types extra characters in editor #83537

Open lesbianlizard opened 11 months ago

lesbianlizard commented 11 months ago

Godot version

v4.1.2.stable.arch_linux

System information

Godot v4.1.2.stable unknown - Arch Linux #1 ZEN SMP PREEMPT_DYNAMIC Sat, 23 Sep 2023 22:54:46 +0000 - Tty - Vulkan (Forward+) - dedicated AMD Radeon R9 Fury Series (RADV FIJI) () - Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz (16 Threads)

Issue description

I'm using the i3 window manager (X11) on Arch Linux. When I type accented characters into any part of the Godot editor interface, such as the Text field of a Label, extra characters appear. For example, if I try to type prêt à commencer, the result is preêt aà commencer or pr^êt `à commencer, depending on which order I type the compose sequences in.

Steps to reproduce

Minimal reproduction project

N/A

akien-mga commented 11 months ago

I can't reproduce the issue on my Linux system. Mageia 9 running KDE Plasma 5.27.5 over X11. Using en_US keyboard layout, with Compose key on Right Alt.

What keyboard layout are you using, and are you running X11 or Wayland?

bruvzg commented 11 months ago

Check the version of system libxkbcommon, if it's under 0.8 (or missing at all) Godot won't be able to properly handle dead key composition.

lesbianlizard commented 11 months ago

I can't reproduce the issue on my Linux system. Mageia 9 running KDE Plasma 5.27.5 over X11. Using en_US keyboard layout, with Compose key on Right Alt.

What keyboard layout are you using, and are you running X11 or Wayland?

I'm not sure what en_US refers to for a keyboard layout. This is the output of setxkbmap -print:

% setxkbmap -print
xkb_keymap {
    xkb_keycodes  { include "evdev+aliases(qwerty)" };
    xkb_types     { include "complete"  };
    xkb_compat    { include "complete"  };
    xkb_symbols   { include "pc+us+us(rus):2+gr:3+inet(evdev)+capslock(escape)+compose(ralt)+group(sclk_toggle)"    };
    xkb_geometry  { include "pc(pc105)" };
};

I'm running i3, which is an X11 window manager.

lesbianlizard commented 11 months ago

Check the version of system libxkbcommon, if it's under 0.8 (or missing at all) Godot won't be able to properly handle dead key composition.

I have version 1.5.0 of libxkbcommon.

akien-mga commented 11 months ago

I'm not sure what en_US refers to for a keyboard layout. This is the output of setxkbmap -print:

It's the name of the layout you can pass to setxkbmap to use (setxkbmap en_US / setxkbmap fr, etc.). Though it seems like en_US is just an alias, the layout is called us internally.

image

Here's my config:

xkb_keymap {
        xkb_keycodes  { include "evdev+aliases(qwerty)" };
        xkb_types     { include "complete"      };
        xkb_compat    { include "complete"      };
        xkb_symbols   { include "pc+us(altgr-intl)+fr:2+inet(evdev)+terminate(ctrl_alt_bksp)+compose(ralt)"     };
        xkb_geometry  { include "pc(pc101)"     };
};

xkb_symbols { include "pc+us+us(rus):2+gr:3+inet(evdev)+capslock(escape)+compose(ralt)+group(sclk_toggle)" };

I'm not an expert at reading xkb_symbols definitions but this looks like you have a lot of different keyboard layout configured. Does compose(ralt) apply to all of them? Can you check how it behaves with a configuration similar to mine (i.e. just pc+us as the main layout)?


Edit: Here's my config after running setxkbmap us, which overrides what's defined by the above KDE settings.

$ setxkbmap us
$ setxkbmap -print
xkb_keymap {
        xkb_keycodes  { include "evdev+aliases(qwerty)" };
        xkb_types     { include "complete"      };
        xkb_compat    { include "complete"      };
        xkb_symbols   { include "pc+us+inet(evdev)+terminate(ctrl_alt_bksp)+compose(ralt)"      };
        xkb_geometry  { include "pc(pc101)"     };
};

I've confirmed that it works fine for me with both pc+us(altgr-intl)+fr:2 and pc+us.

I'm also using libxkbcommon 1.5.0.

lesbianlizard commented 11 months ago

Running setxkbmap -layout us -option compose:ralt to clear all my other layouts results in

xkb_keymap {
    xkb_keycodes  { include "evdev+aliases(qwerty)" };
    xkb_types     { include "complete"  };
    xkb_compat    { include "complete"  };
    xkb_symbols   { include "pc+us+inet(evdev)+capslock(escape)+compose(ralt)+group(sclk_toggle)"   };
    xkb_geometry  { include "pc(pc105)" };
};

I experience the bug the same either way.

lesbianlizard commented 11 months ago

The compose key only applies to the us layout in my original setup.

akien-mga commented 11 months ago

I just tested in i3 on my system (still Mageia 9), and the compose key works fine for me in Godot 4.1.2.

Can you confirm that it works for you outside Godot? I see i3 uses Alt as mod key by default, this could clash with Compose.

lesbianlizard commented 11 months ago

Yes, the compose key works normally in other applications. I don't use Alt as mod key with i3, either.

I also just tried Plasma 5.27.8 on X11 on my system, and the compose key worked fine in Godot in that environment.

lesbianlizard commented 11 months ago

I tried running i3 with the default configuration provided by Arch, rather than my own customized one, and I still experience the bug. arch-default-i3-config.txt

edit: i3 version 4.22, by the way

sophiedkk commented 10 months ago

For me the compose key makes the editor unresponsive in Godot 4.1 and 4.2. libxkbcommon.x86_64 1.6.0-1.fc39 @updates-testing

akien-mga commented 10 months ago

@rickdkk That's likely a different issue due to an ibus regression : #82338.