[elpa] externals/xelb updated (fe1b643 -> 4509a33)

2018-06-18 Thread Chris Feng
ch11ng pushed a change to branch externals/xelb.

  from  fe1b643   Fix handling of generic events
   new  c37b769   Add support for  and drop implicit 
padding
   new  4509a33   Fix `xcb:unmarshal' for 


Summary of changes:
 el_client.el   |  32 +--
 xcb-dri2.el|  26 ++-
 xcb-dri3.el|  38 ++--
 xcb-ewmh.el|  16 +-
 xcb-glx.el | 320 +++---
 xcb-icccm.el   |  10 +-
 xcb-keysyms.el |   2 +-
 xcb-present.el |  20 +-
 xcb-randr.el   | 179 -
 xcb-record.el  |  30 ++-
 xcb-render.el  | 114 +--
 xcb-res.el |  32 +--
 xcb-shape.el   |   8 +-
 xcb-sync.el|  14 +-
 xcb-types.el   | 100 +++---
 xcb-xc_misc.el |   4 +-
 xcb-xf86dri.el |  19 +-
 xcb-xf86vidmode.el |  68 +++
 xcb-xfixes.el  |  39 ++--
 xcb-xinerama.el|   4 +-
 xcb-xinput.el  | 557 +
 xcb-xkb.el | 398 ++
 xcb-xprint.el  |  56 +++---
 xcb-xproto.el  | 280 +--
 xcb-xselinux.el|  92 -
 xcb-xv.el  |  51 +++--
 xcb-xvmc.el|  22 +--
 xcb.el |  12 +-
 28 files changed, 1278 insertions(+), 1265 deletions(-)



[elpa] externals/exwm 0680be1: Grab & Replay key events with XI2 and XTEST

2018-06-18 Thread Chris Feng
branch: externals/exwm
commit 0680be104f9394e39dd55b5c4e33b9b7e4e77926
Author: Chris Feng 
Commit: Chris Feng 

Grab & Replay key events with XI2 and XTEST

; A change has been made in Xorg server 1.20 that replaying a key
; event with keyboard grabbed would generate extra focus change and
; enter/leave events.  This basically breaks line-mode for apps like
; Firefox.  This commit reimplements the grab & replay functionality
; with XI2 and XTEST.

* exwm-input.el (exwm-input--devices): New variable for caching slave
keyboards.
(exwm-input--update-devices): Update it and re-grab keys if necessary.
(exwm-input--on-Hierarchy): Event listener for the Hierarchy event
that would in turn call `exwm-input--update-devices' to update the
cache.

* exwm-input.el (exwm-input--on-KeyPress): Use XI2 KeyPress events.
(exwm-input--on-KeyRelease): Event listener for the KeyRelease events.
(exwm-input--grab-global-prefix-keys): Use XI2 and also select
KeyRelease events.
(exwm-input--on-KeyPress-line-mode): Use XI2 KeyPress events and
replay key events with XTEST.
(exwm-input--on-KeyPress-char-mode, exwm-input--grab-keyboard)
(exwm-input--release-keyboard): Use XI2 KeyPress events.

* exwm-input.el (exwm-input--init): Initialize the XI2 and XTEST
extensions; add listeners for XI2 KeyPress, KeyRelease and Hierarchy
events.
---
 exwm-input.el | 307 ++
 1 file changed, 222 insertions(+), 85 deletions(-)

diff --git a/exwm-input.el b/exwm-input.el
index 1534108..9bb6444 100644
--- a/exwm-input.el
+++ b/exwm-input.el
@@ -36,6 +36,9 @@
 ;;; Code:
 
 (require 'xcb-keysyms)
+(require 'xcb-xinput)
+(require 'xcb-xtest)
+
 (require 'exwm-core)
 
 (defgroup exwm-input nil
@@ -102,6 +105,8 @@ defined in `exwm-mode-map' here."
 (defconst exwm-input--update-focus-interval 0.01
   "Time interval (in seconds) for accumulating input focus update requests.")
 
+(defvar exwm-input--devices nil "List of slave keyboard devices.")
+
 (defvar exwm-input--during-command nil
   "Indicate whether between `pre-command-hook' and `post-command-hook'.")
 
@@ -364,6 +369,44 @@ ARGS are additional arguments to CALLBACK."
  :window exwm--root
  :data (or id xcb:Window:None
 
+(defun exwm-input--update-devices (update)
+  "Update the cache of slave keyboards."
+  (with-slots (infos)
+  (xcb:+request-unchecked+reply exwm--connection
+  (make-instance 'xcb:xinput:XIQueryDevice
+ :deviceid xcb:xinput:Device:All))
+(setq exwm-input--devices
+  (delq nil
+(mapcar (lambda (info)
+  (with-slots (deviceid type enabled name) info
+(setq name (downcase name))
+(when (and (= xcb:xinput:DeviceType:SlaveKeyboard
+  type)
+   (string-match-p "keyboard" name)
+   ;; Exclude XTEST keyboard.
+   (not (string-match-p "xtest" name)))
+  deviceid)))
+infos)))
+(unless exwm-input--devices
+  (error "Failed to retrieve keyboards"))
+(when update
+  ;; Try to re-grab all keys.
+  (exwm-input--update-global-prefix-keys)
+  (dolist (pair exwm--id-buffer-alist)
+(with-current-buffer (cdr pair)
+  (when exwm--keyboard-grabbed
+(exwm-input--grab-keyboard (car pair
+
+(defun exwm-input--on-Hierarchy (data _synthetic)
+  "Handle Hierarchy events."
+  (let ((evt (make-instance 'xcb:xinput:Hierarchy)))
+(xcb:unmarshal evt data)
+(with-slots (flags infos) evt
+  (when (/= 0 (logand flags
+  (logior xcb:xinput:HierarchyMask:SlaveAdded
+  xcb:xinput:HierarchyMask:SlaveRemoved)))
+(exwm-input--update-devices t)
+
 (defun exwm-input--on-ButtonPress (data _synthetic)
   "Handle ButtonPress event."
   (let ((obj (make-instance 'xcb:ButtonPress))
@@ -417,12 +460,30 @@ ARGS are additional arguments to CALLBACK."
 
 (defun exwm-input--on-KeyPress (data _synthetic)
   "Handle KeyPress event."
-  (let ((obj (make-instance 'xcb:KeyPress)))
+  (let ((obj (make-instance 'xcb:xinput:KeyPress)))
 (xcb:unmarshal obj data)
 (if (eq major-mode 'exwm-mode)
 (funcall exwm--on-KeyPress obj data)
   (exwm-input--on-KeyPress-char-mode obj
 
+(defun exwm-input--on-KeyRelease (data _synthetic)
+  "Handle KeyRelease event."
+  ;; TODO: For simplicity every KeyRelease event is replayed which is likely
+  ;; to cause overheads and perhaps problems.
+  (let ((evt (make-instance 'xcb:xinput:KeyRelease)))
+(xcb:unmarshal evt data);FIXME: optimize.
+(with-slots (deviceid detail root-x root-y) evt
+   

[elpa] externals/xelb c37b769 1/2: Add support for and drop implicit padding

2018-06-18 Thread Chris Feng
branch: externals/xelb
commit c37b769c52156f34e729a7517cdaa21958c45073
Author: Chris Feng 
Commit: Chris Feng 

Add support for  and drop implicit padding

* el_client.el (xelb-parse-required_start_align): New function for
parsing .
(xelb-parse-structure-content): Use it.
(xelb-parse-list): Drop implicit padding after .

* xcb-types.el (xcb:-marshal-field, xcb:unmarshal,
xcb:-unmarshal-field): Make adaptions for .
---
 el_client.el   | 23 +---
 xcb-dri2.el|  2 --
 xcb-dri3.el| 20 +++---
 xcb-glx.el | 30 ++---
 xcb-present.el | 12 ++---
 xcb-randr.el   | 23 +---
 xcb-record.el  |  2 --
 xcb-render.el  |  8 --
 xcb-types.el   | 50 +++---
 xcb-xf86dri.el |  1 -
 xcb-xf86vidmode.el |  8 --
 xcb-xfixes.el  |  1 -
 xcb-xinput.el  | 78 ++
 xcb-xkb.el | 30 ++---
 xcb-xprint.el  |  4 ---
 xcb-xproto.el  |  4 ---
 xcb-xv.el  |  3 ---
 17 files changed, 128 insertions(+), 171 deletions(-)

diff --git a/el_client.el b/el_client.el
index dadcc39..9f1dc0c 100644
--- a/el_client.el
+++ b/el_client.el
@@ -513,12 +513,13 @@ The `combine-adjacent' attribute is simply ignored."
   "Parse a structure content node NODE."
   (pcase (xelb-node-name node)
 (`pad (xelb-parse-pad node))
+(`required_start_align (xelb-parse-required_start_align node))
 (`field (xelb-parse-field node))
 (`fd (xelb-parse-fd node))
 (`list (xelb-parse-list node))
 (`exprfield (xelb-parse-exprfield node))
 (`switch (xelb-parse-switch node))
-((or `comment `doc `required_start_align)) ;simply ignored
+((or `comment `doc));simply ignored
 (x (error "Unsupported structure content: <%s>" x
 
 ;; The car of the result shall be renamed to prevent duplication of slot names
@@ -534,6 +535,17 @@ The `combine-adjacent' attribute is simply ignored."
  :initform ,(string-to-number align) :type xcb:-pad-align))
 (error "Invalid  field")
 
+(defun xelb-parse-required_start_align (node)
+  "Parse ."
+  (let ((align (xelb-node-attr node 'align))
+(offset (xelb-node-attr node 'offset)))
+`((,(xelb-generate-pad-name)
+   :initform ,(if offset
+  (vector (string-to-number align)
+  (string-to-number offset))
+(string-to-number align))
+   :type xcb:-pad-align
+
 (defun xelb-parse-field (node)
   "Parse ."
   (let* ((name (intern (xelb-node-attr-escape node 'name)))
@@ -554,13 +566,7 @@ The `combine-adjacent' attribute is simply ignored."
 `((,name :initarg ,(intern (concat ":" (symbol-name name)))
  :type xcb:-ignore)
   (,name-alt :initform '(name ,name type ,type size ,size)
- :type xcb:-list)
-  ;; Auto padding after variable-length list
-  ;; FIXME: according to the definition of `XCB_TYPE_PAD' in xcb.h, it does
-  ;;not always padding to 4 bytes.
-  ,@(when (and (xelb-node-attr node 'xelb-auto-padding)
-   (not (integerp size)))
-  `((,(xelb-generate-pad-name) :initform 4 :type xcb:-pad-align))
+ :type xcb:-list
 
 ;; The car of result is the field declaration, and the cadr is the expression
 ;; to be evaluated.
@@ -606,7 +612,6 @@ The `combine-adjacent' attribute is simply ignored."
   (when (or (eq case-name 'bitcase) (eq case-name 'case))
 (dolist (j (xelb-node-subnodes i t))
   (pcase (xelb-node-name j)
-(`required_start_align)
 (`enumref
  (setq condition
(nconc condition
diff --git a/xcb-dri2.el b/xcb-dri2.el
index 21f3059..62c7619 100644
--- a/xcb-dri2.el
+++ b/xcb-dri2.el
@@ -96,7 +96,6 @@
 '(name driver-name type xcb:char size
(xcb:-fieldref 'driver-name-length))
 :type xcb:-list)
-   (pad~2 :initform 4 :type xcb:-pad-align)
(alignment-pad :initarg :alignment-pad :type xcb:-ignore)
(alignment-pad~ :initform
   '(name alignment-pad type xcb:void size
@@ -108,7 +107,6 @@
(lognot 3))
   (xcb:-fieldref 'driver-name-length)))
   :type xcb:-list)
-   (pad~3 :initform 4 :type xcb:-pad-align)
(device-name :initarg :device-name :type xcb:-ignore)
(device-name~ :initform
 '(name device-name type xcb:char size
diff --git a/xcb-dri3.el b/xcb-dri3.el
index 6fd34f3..ad69b43 100644
--- a/xcb-dri3.el
+++ b/xcb-dri3.el
@@ -121,18 +121,18 @@
(pad~0 :initform 2 :type xcb:-pad)))
 (defclass xcb:dri3:GetSupportedModifiers~reply
   (xcb:-reply)
-  ((pad~0 :initform 1 :type x