Detect unavailable keys properly. Fixes #592.

This commit is contained in:
Sergey Trofimov 2023-11-25 15:20:36 +01:00
parent 56db521a3e
commit 83a5f719d2

View file

@ -514,7 +514,7 @@ ARGS are additional arguments to CALLBACK."
keysyms keycode alt-modifier) keysyms keycode alt-modifier)
(dolist (k exwm-input--global-prefix-keys) (dolist (k exwm-input--global-prefix-keys)
(setq keysyms (xcb:keysyms:event->keysyms exwm--connection k)) (setq keysyms (xcb:keysyms:event->keysyms exwm--connection k))
(if (not keysyms) (if (or (not keysyms) (= 0 (caar keysyms)))
(warn "Key unavailable: %s" (key-description (vector k))) (warn "Key unavailable: %s" (key-description (vector k)))
(setq keycode (xcb:keysyms:keysym->keycode exwm--connection (setq keycode (xcb:keysyms:keysym->keycode exwm--connection
(caar keysyms))) (caar keysyms)))
@ -886,7 +886,7 @@ button event."
"Fake a key event equivalent to Emacs event EVENT." "Fake a key event equivalent to Emacs event EVENT."
(let* ((keysyms (xcb:keysyms:event->keysyms exwm--connection event)) (let* ((keysyms (xcb:keysyms:event->keysyms exwm--connection event))
keycode id) keycode id)
(when (= 0 (caar keysyms)) (when (or (not keysyms) (= 0 (caar keysyms)))
(user-error "[EXWM] Invalid key: %s" (single-key-description event))) (user-error "[EXWM] Invalid key: %s" (single-key-description event)))
(setq keycode (xcb:keysyms:keysym->keycode exwm--connection (setq keycode (xcb:keysyms:keysym->keycode exwm--connection
(caar keysyms))) (caar keysyms)))