emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/exwm 24b964b 25/64: Ignore repeated `MappingNotify` eve


From: Chris Feng
Subject: [elpa] externals/exwm 24b964b 25/64: Ignore repeated `MappingNotify` events
Date: Thu, 17 Sep 2015 23:17:58 +0000

branch: externals/exwm
commit 24b964bb4af100b959a33215cc91b9c896c9359e
Author: Chris Feng <address@hidden>
Commit: Chris Feng <address@hidden>

    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.
---
 exwm-input.el |   25 ++++++++++++++++++-------
 1 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/exwm-input.el b/exwm-input.el
index 24aa94a..293fd67 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -139,13 +139,24 @@ It's updated in several occasions, and only used by 
`exwm-input--set-focus'.")
   (let ((obj (make-instance 'xcb:MappingNotify)))
     (xcb:unmarshal obj data)
     (with-slots (request first-keycode count) obj
-      (cond ((= request xcb:Mapping:Modifier)
-             ;; Modifier keys changed
-             (xcb:keysyms:update-modifier-mapping exwm--connection))
-            ((= request xcb:Mapping:Keyboard)
-             ;; Only updated changed keys
-             (xcb:keysyms:update-keyboard-mapping exwm--connection
-                                                  first-keycode count))))))
+      (cond
+       ((= request xcb:Mapping:Modifier)
+        ;; Modifier keys changed
+        (exwm--log "Update modifier mapping")
+        (xcb:keysyms:update-modifier-mapping exwm--connection)
+        )
+       ((= 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)
   "Handle ButtonPress event."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]