mirror of
https://github.com/ch11ng/exwm.git
synced 2024-11-23 19:47:58 +01:00
Ignore repeated MappingNotify
events
For some reason, `MappingNotify` events are generated quite frequently and greatly impact the performance. This commit disables the complete refresh of keyboard mapping.
This commit is contained in:
parent
048994c794
commit
24b964bb4a
1 changed files with 18 additions and 7 deletions
|
@ -139,13 +139,24 @@ It's updated in several occasions, and only used by `exwm-input--set-focus'.")
|
||||||
(let ((obj (make-instance 'xcb:MappingNotify)))
|
(let ((obj (make-instance 'xcb:MappingNotify)))
|
||||||
(xcb:unmarshal obj data)
|
(xcb:unmarshal obj data)
|
||||||
(with-slots (request first-keycode count) obj
|
(with-slots (request first-keycode count) obj
|
||||||
(cond ((= request xcb:Mapping:Modifier)
|
(cond
|
||||||
;; Modifier keys changed
|
((= request xcb:Mapping:Modifier)
|
||||||
(xcb:keysyms:update-modifier-mapping exwm--connection))
|
;; Modifier keys changed
|
||||||
((= request xcb:Mapping:Keyboard)
|
(exwm--log "Update modifier mapping")
|
||||||
;; Only updated changed keys
|
(xcb:keysyms:update-modifier-mapping exwm--connection)
|
||||||
(xcb:keysyms:update-keyboard-mapping exwm--connection
|
)
|
||||||
first-keycode count))))))
|
((= request xcb:Mapping:Keyboard)
|
||||||
|
;; Only update changed keys
|
||||||
|
(with-slots (min-keycode max-keycode)
|
||||||
|
(xcb:get-setup exwm--connection)
|
||||||
|
;; Since this operation is quite time-consuming, a complete refresh
|
||||||
|
;; is forbidden as it's unlikely to bring any useful information
|
||||||
|
(unless (and (= min-keycode first-keycode)
|
||||||
|
(= max-keycode (+ first-keycode count -1)))
|
||||||
|
(exwm--log "Update keyboard mapping: %d ~ %d"
|
||||||
|
first-keycode (+ first-keycode count))
|
||||||
|
(xcb:keysyms:update-keyboard-mapping exwm--connection
|
||||||
|
first-keycode count))))))))
|
||||||
|
|
||||||
(defun exwm-input--on-ButtonPress (data synthetic)
|
(defun exwm-input--on-ButtonPress (data synthetic)
|
||||||
"Handle ButtonPress event."
|
"Handle ButtonPress event."
|
||||||
|
|
Loading…
Reference in a new issue