mirror of
https://github.com/emacs-exwm/exwm.git
synced 2024-11-27 14:57:59 +01:00
Skip global keys unavailable in X server
* exwm-input.el (exwm-input--grab-global-prefix-keys): Some global keys might not be available in X server (perhaps due to misconfiguration).
This commit is contained in:
parent
988f983233
commit
9c85f172e5
1 changed files with 21 additions and 18 deletions
|
@ -488,8 +488,10 @@ ARGS are additional arguments to CALLBACK."
|
||||||
:keyboard-mode xcb:GrabMode:Async))
|
:keyboard-mode xcb:GrabMode:Async))
|
||||||
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))
|
||||||
keycode (xcb:keysyms:keysym->keycode exwm--connection
|
(if (not keysyms)
|
||||||
|
(warn "Key unavailable: %s" (key-description (vector k)))
|
||||||
|
(setq keycode (xcb:keysyms:keysym->keycode exwm--connection
|
||||||
(caar keysyms)))
|
(caar keysyms)))
|
||||||
(exwm--log "Grabbing key=%s (keysyms=%s keycode=%s)"
|
(exwm--log "Grabbing key=%s (keysyms=%s keycode=%s)"
|
||||||
(single-key-description k) keysyms keycode)
|
(single-key-description k) keysyms keycode)
|
||||||
|
@ -499,13 +501,14 @@ ARGS are additional arguments to CALLBACK."
|
||||||
;; Also grab this key with num-lock mask set.
|
;; Also grab this key with num-lock mask set.
|
||||||
(when (and (/= 0 xcb:keysyms:num-lock-mask)
|
(when (and (/= 0 xcb:keysyms:num-lock-mask)
|
||||||
(= 0 (logand (cdr keysym) xcb:keysyms:num-lock-mask)))
|
(= 0 (logand (cdr keysym) xcb:keysyms:num-lock-mask)))
|
||||||
(setf alt-modifier (logior (cdr keysym) xcb:keysyms:num-lock-mask)))
|
(setf alt-modifier (logior (cdr keysym)
|
||||||
|
xcb:keysyms:num-lock-mask)))
|
||||||
(dolist (xwin xwins)
|
(dolist (xwin xwins)
|
||||||
(setf (slot-value req 'grab-window) xwin)
|
(setf (slot-value req 'grab-window) xwin)
|
||||||
(xcb:+request exwm--connection req)
|
(xcb:+request exwm--connection req)
|
||||||
(when alt-modifier
|
(when alt-modifier
|
||||||
(setf (slot-value req 'modifiers) alt-modifier)
|
(setf (slot-value req 'modifiers) alt-modifier)
|
||||||
(xcb:+request exwm--connection req)))))
|
(xcb:+request exwm--connection req))))))
|
||||||
(xcb:flush exwm--connection)))
|
(xcb:flush exwm--connection)))
|
||||||
|
|
||||||
(defun exwm-input--set-key (key command)
|
(defun exwm-input--set-key (key command)
|
||||||
|
|
Loading…
Reference in a new issue