From c1efd2604658656e6289fd31f3d8a9866ba6cd80 Mon Sep 17 00:00:00 2001 From: Gerd Moellmann Date: Wed, 10 Jan 2001 12:19:28 +0000 Subject: [PATCH] (Fx_backspace_delete_keys_p): Use XkbGetMap and XkbGetNames instead of XkbGetKeyboard. --- src/ChangeLog | 5 +++++ src/xfns.c | 41 ++++++++++++++++++++++++++--------------- 2 files changed, 31 insertions(+), 15 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 51f2a856f6a..115ab52de12 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2001-01-10 Gerd Moellmann + + * xfns.c (Fx_backspace_delete_keys_p): Use XkbGetMap and + XkbGetNames instead of XkbGetKeyboard. + 2001-01-10 Dave Love * sysdep.c (random): Revert the declaration. diff --git a/src/xfns.c b/src/xfns.c index 037a0baa294..6d0d959fb09 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -11179,34 +11179,45 @@ usual X keysyms.") major = XkbMajorVersion; minor = XkbMinorVersion; if (!XkbLibraryVersion (&major, &minor)) - return Qnil; + { + UNBLOCK_INPUT; + return Qnil; + } /* Check that the server supports XKB. */ major = XkbMajorVersion; minor = XkbMinorVersion; if (!XkbQueryExtension (dpy, &op, &event, &error, &major, &minor)) - return Qnil; + { + UNBLOCK_INPUT; + return Qnil; + } have_keys = Qnil; - kb = XkbGetKeyboard (dpy, XkbAllComponentsMask, XkbUseCoreKbd); + kb = XkbGetMap (dpy, XkbAllMapComponentsMask, XkbUseCoreKbd); if (kb) { int delete_keycode = 0, backspace_keycode = 0, i; - - for (i = kb->min_key_code; - (i < kb->max_key_code - && (delete_keycode == 0 || backspace_keycode == 0)); - ++i) + + if (XkbGetNames (dpy, XkbAllNamesMask, kb) == Success) { - /* The XKB symbolic key names can be seen most easily - in the PS file generated by `xkbprint -label name $DISPLAY'. */ - if (bcmp ("DELE", kb->names->keys[i].name, 4) == 0) - delete_keycode = i; - else if (bcmp ("BKSP", kb->names->keys[i].name, 4) == 0) - backspace_keycode = i; + for (i = kb->min_key_code; + (i < kb->max_key_code + && (delete_keycode == 0 || backspace_keycode == 0)); + ++i) + { + /* The XKB symbolic key names can be seen most easily + in the PS file generated by `xkbprint -label name $DISPLAY'. */ + if (bcmp ("DELE", kb->names->keys[i].name, 4) == 0) + delete_keycode = i; + else if (bcmp ("BKSP", kb->names->keys[i].name, 4) == 0) + backspace_keycode = i; + } + + XkbFreeNames (kb, 0, True); } - XkbFreeKeyboard (kb, 0, True); + XkbFreeClientMap (kb, 0, True); if (delete_keycode && backspace_keycode -- 2.39.2