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

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

[elpa] externals/xelb d06c4c0: Allow users to disable the keyboard mappi


From: Chris Feng
Subject: [elpa] externals/xelb d06c4c0: Allow users to disable the keyboard mapping auto-update feature
Date: Wed, 10 Feb 2016 04:51:32 +0000

branch: externals/xelb
commit d06c4c06020d71a38563feebee0c804b2b87cc84
Author: Chris Feng <address@hidden>
Commit: Chris Feng <address@hidden>

    Allow users to disable the keyboard mapping auto-update feature
    
    * xcb-keysyms.el (xcb:keysyms:auto-update, xcb:keysyms:init): Use new
    variable `xcb:keysyms:auto-update' to control the keyboard mapping
    auto-update feature.  This feature does not work well with e.g. XTEST
    extension and should be disabled sometimes.  We need to switch to use the
    Xkb extension (does not work with Emacs 24) to resolve the problem.
---
 xcb-keysyms.el |   36 ++++++++++++++++++++----------------
 1 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/xcb-keysyms.el b/xcb-keysyms.el
index ad4e145..83ef346 100644
--- a/xcb-keysyms.el
+++ b/xcb-keysyms.el
@@ -44,6 +44,8 @@
 
 (require 'xcb)
 
+(defvar xcb:keysyms:auto-update t "Auto update keyboard mapping.")
+
 (defvar xcb:keysyms:meta-mask nil "META key mask.")
 (defvar xcb:keysyms:control-mask xcb:ModMask:Control "CONTROL key mask.")
 (defvar xcb:keysyms:shift-mask xcb:ModMask:Shift "SHIFT key mask.")
@@ -65,22 +67,24 @@ This method must be called before using any other method in 
this module."
     (unless xcb:keysyms:meta-mask     ;avoid duplicated initialization
       (xcb:keysyms:update-modifier-mapping obj)
       ;; Update on MappingNotify event.
-      (xcb:+event obj 'xcb:MappingNotify
-                  `(lambda (data _)
-                     (let ((obj1 (make-instance 'xcb:MappingNotify)))
-                       (xcb:unmarshal obj1 data)
-                       (with-slots (request first-keycode count) obj1
-                         (cond
-                          ((= request xcb:Mapping:Modifier)
-                           ;; Modifier keys changed
-                           (xcb:-log "Update modifier mapping")
-                           (xcb:keysyms:update-modifier-mapping ,obj))
-                          ((= request xcb:Mapping:Keyboard)
-                           ;; Update changed keys
-                           (xcb:-log "Update keyboard mapping: %s - %s"
-                                     first-keycode (+ first-keycode count -1))
-                           (xcb:keysyms:update-keyboard-mapping
-                            ,obj first-keycode count))))))))))
+      (when xcb:keysyms:auto-update
+        (xcb:+event obj 'xcb:MappingNotify
+                    `(lambda (data _)
+                       (let ((obj1 (make-instance 'xcb:MappingNotify)))
+                         (xcb:unmarshal obj1 data)
+                         (with-slots (request first-keycode count) obj1
+                           (cond
+                            ((= request xcb:Mapping:Modifier)
+                             ;; Modifier keys changed
+                             (xcb:-log "Update modifier mapping")
+                             (xcb:keysyms:update-modifier-mapping ,obj))
+                            ((= request xcb:Mapping:Keyboard)
+                             ;; Update changed keys
+                             (xcb:-log "Update keyboard mapping: %s - %s"
+                                       first-keycode
+                                       (+ first-keycode count -1))
+                             (xcb:keysyms:update-keyboard-mapping
+                              ,obj first-keycode count)))))))))))
 
 (cl-defmethod xcb:keysyms:update-keyboard-mapping ((obj xcb:connection)
                                                    first-keycode count)



reply via email to

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