URI: 
       tFix keyboard handling when using xwayland - ledit - Text editor (WIP)
  HTML git clone git://lumidify.org/ledit.git (fast, but not encrypted)
  HTML git clone https://lumidify.org/git/ledit.git (encrypted, but very slow)
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
   DIR commit da620ad0dd9ca2e768f6d0289d25ecb51e2415d2
   DIR parent 943b164b4033d4e0c1b667bff9c086faf4007e78
  HTML Author: lumidify <nobody@lumidify.org>
       Date:   Thu, 21 Dec 2023 19:47:37 +0100
       
       Fix keyboard handling when using xwayland
       
       Diffstat:
         M ledit.c                             |      31 +++++++++++++++++++++----------
       
       1 file changed, 21 insertions(+), 10 deletions(-)
       ---
   DIR diff --git a/ledit.c b/ledit.c
       t@@ -490,17 +490,28 @@ mainloop(void) {
        
                        if (!test_extra && change_kbd) {
                                change_kbd = 0;
       -                        XkbStateRec s;
       -                        XkbGetState(common.dpy, XkbUseCoreKbd, &s);
       -                        XkbDescPtr desc = XkbGetKeyboard(
       -                            common.dpy, XkbAllComponentsMask, XkbUseCoreKbd
       +                        XkbDescPtr desc = XkbGetMap(
       +                            common.dpy, 0, XkbUseCoreKbd
                                );
       -                        char *group = XGetAtomName(
       -                            common.dpy, desc->names->groups[s.group]
       -                        );
       -                        change_keyboard(group);
       -                        XFree(group);
       -                        XkbFreeKeyboard(desc, XkbAllComponentsMask, True);
       +                        if (!desc || XkbGetNames(common.dpy, XkbGroupNamesMask, desc) != Success) {
       +                                /* FIXME: maybe show this as error message in windows */
       +                                fprintf(
       +                                        stderr,
       +                                        "Unable to obtain keyboard layout information.\n"
       +                                );
       +                                if (desc)
       +                                        XkbFreeClientMap(desc, 0, True);
       +                        } else {
       +                                XkbStateRec s;
       +                                XkbGetState(common.dpy, XkbUseCoreKbd, &s);
       +                                char *group = XGetAtomName(
       +                                    common.dpy, desc->names->groups[s.group]
       +                                );
       +                                change_keyboard(group);
       +                                XFree(group);
       +                                XkbFreeNames(desc, XkbGroupNamesMask, True);
       +                                XkbFreeClientMap(desc, 0, True);
       +                        }
                        }
                        redraw();