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

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

[elpa] externals/xelb 5a74daa 32/42: Generate implicit paddings at compi


From: Chris Feng
Subject: [elpa] externals/xelb 5a74daa 32/42: Generate implicit paddings at compile time
Date: Thu, 17 Sep 2015 23:16:49 +0000

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

    Generate implicit paddings at compile time
    
    This commit improves aaddcd9 by generating implicit paddings at compile time
    rather than deducting them at runtime.
---
 el_client.el           |  141 +++++++++++++++++++-----------------------------
 lib/xcb-dri2.el        |    2 +
 lib/xcb-glx.el         |    4 ++
 lib/xcb-randr.el       |   23 ++++++++
 lib/xcb-record.el      |    2 +
 lib/xcb-render.el      |    9 +++
 lib/xcb-xf86dri.el     |    1 +
 lib/xcb-xf86vidmode.el |    8 +++
 lib/xcb-xfixes.el      |    1 +
 lib/xcb-xinput.el      |   49 ++++++++++++-----
 lib/xcb-xkb.el         |   57 +++++++++++++------
 lib/xcb-xprint.el      |    5 ++
 lib/xcb-xproto.el      |    6 ++
 lib/xcb-xselinux.el    |    1 +
 lib/xcb-xv.el          |    3 +
 util/xcb-xim.el        |    3 +-
 xcb-types.el           |   27 ++--------
 17 files changed, 201 insertions(+), 141 deletions(-)

diff --git a/el_client.el b/el_client.el
index a66f9d1..9a5b6a1 100644
--- a/el_client.el
+++ b/el_client.el
@@ -56,7 +56,7 @@
 (defvar event-alist nil "Record X events in this module.")
 (make-variable-buffer-local 'event-alist)
 
-(defvar pad-count 0 "<pad> node counter.")
+(defvar pad-count -1 "<pad> node counter.")
 (make-variable-buffer-local 'pad-count)
 
 ;;;; Helper functions
@@ -81,9 +81,24 @@
   "Return the attribute ATTR of node NODE and escape it."
   (escape-name (node-attr node attr)))
 
-(defsubst node-subnodes (node)
-  "Return all the subnodes of node NODE as a list."
-  (cddr node))
+(defsubst node-subnodes (node &optional mark-auto-padding)
+  "Return all the subnodes of node NODE as a list.
+
+If MARK-AUTO-PADDING is non-nil, all <list>'s fitting for padding will include
+an `xelb-auto-padding' attribute."
+  (let ((subnodes (cddr node)))
+    (when mark-auto-padding
+      ;; Remove all <comment>'s and <doc>'s
+      (cl-delete-if (lambda (i) (or (eq 'comment (car i)) (eq 'doc (car i))))
+                    subnodes)
+      (dotimes (i (1- (length subnodes)))
+        (when (and (eq 'list (node-name (elt subnodes i)))
+                   (pcase (node-name (elt subnodes (1+ i)))
+                     ((or `reply `pad))
+                     (_ t)))
+          (setf (cadr (elt subnodes i))
+                (nconc (cadr (elt subnodes i)) `((xelb-auto-padding . t)))))))
+    subnodes))
 
 (defsubst node-subnode (node)
   "Return the (only) subnode of node NODE with useless contents skipped."
@@ -94,6 +109,10 @@
                      (or (eq (node-name i) 'comment) (eq (node-name i) 'doc)))
           (throw 'break i))))))
 
+(defsubst generate-pad-name ()
+  "Generate a new slot name for <pad>."
+  (make-symbol (format "pad~%d" (cl-incf pad-count))))
+
 ;;;; Entry & root element
 
 (defun parse (file)
@@ -153,7 +172,7 @@
 
 (defun parse-top-level-element (node)
   "Parse a top-level element."
-  (setq pad-count 0)
+  (setq pad-count -1)
   (pcase (node-name node)
     (`import (parse-import node))
     (`struct (parse-struct node))
@@ -179,31 +198,16 @@
 (defun parse-struct (node)
   "Parse <struct>."
   (let ((name (intern (concat prefix (node-attr node 'name))))
-        (contents (node-subnodes node))
-        result)
-    (setq contents
-          (apply 'nconc
-                 (mapcar (lambda (i)
-                           (setq result (parse-structure-content i))
-                           (when (eq (node-name i) 'pad) ;rename pad~
-                             (setq result
-                                   `((,(intern (format "pad~%d" pad-count))
-                                      ,@(cdar result))))
-                             (setq pad-count (1+ pad-count)))
-                           result)
-                         contents)))
-    `((defclass ,name (xcb:-struct) ,contents))))
+        (contents (node-subnodes node t)))
+    `((defclass ,name (xcb:-struct)
+        ,(apply 'nconc (mapcar 'parse-structure-content contents))))))
 
 (defun parse-union (node)
   "Parse <union>."
   (let ((name (intern (concat prefix (node-attr node 'name))))
         (contents (node-subnodes node)))
-    (setq contents
-          (apply 'nconc
-                 (mapcar (lambda (i)
-                           (parse-structure-content i))
-                         contents)))
-    `((defclass ,name (xcb:-union) ,contents))))
+    `((defclass ,name (xcb:-union)
+        ,(apply 'nconc (mapcar 'parse-structure-content contents))))))
 
 (defun parse-xidtype (node)
   "Parse <xidtype>."
@@ -242,41 +246,26 @@ The `combine-adjacent' attribute is simply ignored."
   (let* ((name (intern (concat prefix (node-attr node 'name))))
          (opcode (string-to-int (node-attr node 'opcode)))
          (contents `((~opcode :initform ,opcode :type xcb:-u1)))
-         (subnodes (node-subnodes node))
-         (reply-pad-count 0)
+         (subnodes (node-subnodes node t))
          expressions
-         result reply-result reply-name reply-contents)
+         result reply-name reply-contents)
     (dolist (i subnodes)
       (if (not (eq (node-name i) 'reply))
           (progn
             (setq result (parse-structure-content i))
-            (pcase (node-name i)
-              (`pad                     ;rename pad~
-               (setq result
-                     `((,(intern (format "pad~%d" pad-count))
-                        ,@(cdar result))))
-               (setq pad-count (1+ pad-count))
-               (setq contents (nconc contents result)))
-              (`exprfield             ;split into field and expression
-               (setq contents (nconc contents (list (car result))))
-               (setq expressions (nconc expressions (list (cadr result)))))
-              (_ (setq contents (nconc contents result)))))
+            (if (eq 'exprfield (node-name i))
+                ;; Split into field and expression
+                (setq contents (nconc contents (list (car result)))
+                      expressions (nconc expressions (list (cadr result))))
+              (setq contents (nconc contents result))))
         ;; Parse <reply>
+        (setq pad-count -1)             ;reset padding counter
         (setq reply-name
               (intern (concat prefix (node-attr node 'name) "~reply")))
-        (setq reply-contents (node-subnodes i))
+        (setq reply-contents (node-subnodes i t))
         (setq reply-contents
               (apply 'nconc
-                     (mapcar (lambda (j)
-                               (setq reply-result (parse-structure-content j))
-                               (when (eq (node-name j) 'pad) ;rename pad~
-                                 (setq reply-result
-                                       `((,(intern (format "pad~%d"
-                                                           reply-pad-count))
-                                          ,@(cdar reply-result))))
-                                 (setq reply-pad-count (1+ reply-pad-count)))
-                               reply-result)
-                             reply-contents)))))
+                     (mapcar 'parse-structure-content reply-contents)))))
     (delq nil contents)
     (delq nil
           `((defclass ,name (xcb:-request) ,contents)
@@ -298,19 +287,8 @@ KeymapNotify event; instead, we handle this case in 
`xcb:unmarshal'."
   (let ((name (intern (concat prefix (node-attr node 'name))))
         (event-number (string-to-int (node-attr node 'number)))
         (xge (node-attr node 'xge))
-        (contents (node-subnodes node))
-        result)
-    (setq contents
-          (apply 'nconc
-                 (mapcar (lambda (i)
-                           (setq result (parse-structure-content i))
-                           (when (eq (node-name i) 'pad) ;rename pad~
-                             (setq result
-                                   `((,(intern (format "pad~%d" pad-count))
-                                      ,@(cdar result))))
-                             (setq pad-count (1+ pad-count)))
-                           result)
-                         contents)))
+        (contents (node-subnodes node t)))
+    (setq contents (apply 'nconc (mapcar 'parse-structure-content contents)))
     (when xge                           ;generic event
       (setq contents
             (append
@@ -325,21 +303,10 @@ KeymapNotify event; instead, we handle this case in 
`xcb:unmarshal'."
   "Parse <error>."
   (let ((name (intern (concat prefix (node-attr node 'name))))
         (error-number (string-to-int (node-attr node 'number)))
-        (contents (node-subnodes node))
-        result)
-    (setq contents
-          (apply 'nconc
-                (mapcar (lambda (i)
-                          (setq result (parse-structure-content i))
-                          (when (eq (node-name i) 'pad) ;rename pad~
-                            (setq result
-                                  `((,(intern (format "pad~%d" pad-count))
-                                     ,@(cdar result))))
-                            (setq pad-count (1+ pad-count)))
-                          result)
-                        contents)))
+        (contents (node-subnodes node t)))
     (setq error-alist (nconc error-alist `((,error-number . ,name))))
-    `((defclass ,name (xcb:-error) ,contents))))
+    `((defclass ,name (xcb:-error)
+        ,(apply 'nconc (mapcar 'parse-structure-content contents))))))
 
 (defun parse-eventcopy (node)
   "Parse <eventcopy>."
@@ -381,9 +348,11 @@ KeymapNotify event; instead, we handle this case in 
`xcb:unmarshal'."
   (let ((bytes (node-attr node 'bytes))
         (align (node-attr node 'align)))
     (if bytes
-        `((pad~ :initform ,(string-to-int bytes) :type xcb:-pad))
+        `((,(generate-pad-name)
+           :initform ,(string-to-int bytes) :type xcb:-pad))
       (if align
-          `((pad~ :initform ,(string-to-int align) :type xcb:-pad-align))
+          `((,(generate-pad-name)
+             :initform ,(string-to-int align) :type xcb:-pad-align))
         (error "Invalid <pad> field")))))
 
 (defun parse-field (node)
@@ -410,7 +379,12 @@ KeymapNotify event; instead, we handle this case in 
`xcb:unmarshal'."
     `((,name :initarg ,(intern (concat ":" (symbol-name name)))
              :type xcb:-ignore)
       (,name-alt :initform '(name ,name type ,type size ,size)
-                 :type xcb:-list))))
+                 :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 (node-attr node 'xelb-auto-padding) (not (integerp size)))
+          `((,(generate-pad-name) :initform 4 :type xcb:-pad-align))))))
 
 ;; The car of result is the field declaration, and the cadr is the expression
 ;; to be evaluated.
@@ -453,18 +427,13 @@ KeymapNotify event; instead, we handle this case in 
`xcb:unmarshal'."
                     (let ((case-name (node-name i))
                           condition name-list tmp)
                       (when (or (eq case-name 'bitcase) (eq case-name 'case))
-                        (dolist (j (node-subnodes i))
+                        (dolist (j (node-subnodes i t))
                           (pcase (node-name j)
                             (`enumref
                              (setq condition
                                    (nconc condition (list (parse-enumref j)))))
                             (x
                              (setq tmp (parse-structure-content j))
-                             (when (eq x 'pad) ;rename pad~
-                               (setq tmp
-                                     `((,(intern (format "pad~%d" pad-count))
-                                        ,@(cdar tmp))))
-                               (setq pad-count (1+ pad-count)))
                              (setq fields (nconc fields tmp))
                              (setq name-list
                                    (nconc name-list (list (caar tmp)))))))
diff --git a/lib/xcb-dri2.el b/lib/xcb-dri2.el
index f30db9f..40196d9 100644
--- a/lib/xcb-dri2.el
+++ b/lib/xcb-dri2.el
@@ -69,6 +69,7 @@
                 '(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
@@ -82,6 +83,7 @@
                              (node-subnode node))))
                           (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/lib/xcb-glx.el b/lib/xcb-glx.el
index 6036b41..882bc37 100644
--- a/lib/xcb-glx.el
+++ b/lib/xcb-glx.el
@@ -520,11 +520,13 @@
                         (xcb:-fieldref 'num-versions)
                         2))
                 :type xcb:-list)
+   (pad~0 :initform 4 :type xcb:-pad-align)
    (gl-extension-string :initarg :gl-extension-string :type xcb:-ignore)
    (gl-extension-string~ :initform
                         '(name gl-extension-string type xcb:char size
                                (xcb:-fieldref 'gl-str-len))
                         :type xcb:-list)
+   (pad~1 :initform 4 :type xcb:-pad-align)
    (glx-extension-string :initarg :glx-extension-string :type xcb:-ignore)
    (glx-extension-string~ :initform
                          '(name glx-extension-string type xcb:char size
@@ -564,11 +566,13 @@
                         (xcb:-fieldref 'num-versions)
                         3))
                 :type xcb:-list)
+   (pad~0 :initform 4 :type xcb:-pad-align)
    (gl-extension-string :initarg :gl-extension-string :type xcb:-ignore)
    (gl-extension-string~ :initform
                         '(name gl-extension-string type xcb:char size
                                (xcb:-fieldref 'gl-str-len))
                         :type xcb:-list)
+   (pad~1 :initform 4 :type xcb:-pad-align)
    (glx-extension-string :initarg :glx-extension-string :type xcb:-ignore)
    (glx-extension-string~ :initform
                          '(name glx-extension-string type xcb:char size
diff --git a/lib/xcb-randr.el b/lib/xcb-randr.el
index ac89acf..e9aa0f8 100644
--- a/lib/xcb-randr.el
+++ b/lib/xcb-randr.el
@@ -131,6 +131,7 @@
           '(name sizes type xcb:randr:ScreenSize size
                  (xcb:-fieldref 'nSizes))
           :type xcb:-list)
+   (pad~1 :initform 4 :type xcb:-pad-align)
    (rates :initarg :rates :type xcb:-ignore)
    (rates~ :initform
           '(name rates type xcb:randr:RefreshRates size
@@ -211,16 +212,19 @@
           '(name crtcs type xcb:randr:CRTC size
                  (xcb:-fieldref 'num-crtcs))
           :type xcb:-list)
+   (pad~2 :initform 4 :type xcb:-pad-align)
    (outputs :initarg :outputs :type xcb:-ignore)
    (outputs~ :initform
             '(name outputs type xcb:randr:OUTPUT size
                    (xcb:-fieldref 'num-outputs))
             :type xcb:-list)
+   (pad~3 :initform 4 :type xcb:-pad-align)
    (modes :initarg :modes :type xcb:-ignore)
    (modes~ :initform
           '(name modes type xcb:randr:ModeInfo size
                  (xcb:-fieldref 'num-modes))
           :type xcb:-list)
+   (pad~4 :initform 4 :type xcb:-pad-align)
    (names :initarg :names :type xcb:-ignore)
    (names~ :initform
           '(name names type xcb:BYTE size
@@ -255,16 +259,19 @@
           '(name crtcs type xcb:randr:CRTC size
                  (xcb:-fieldref 'num-crtcs))
           :type xcb:-list)
+   (pad~0 :initform 4 :type xcb:-pad-align)
    (modes :initarg :modes :type xcb:-ignore)
    (modes~ :initform
           '(name modes type xcb:randr:MODE size
                  (xcb:-fieldref 'num-modes))
           :type xcb:-list)
+   (pad~1 :initform 4 :type xcb:-pad-align)
    (clones :initarg :clones :type xcb:-ignore)
    (clones~ :initform
            '(name clones type xcb:randr:OUTPUT size
                   (xcb:-fieldref 'num-clones))
            :type xcb:-list)
+   (pad~2 :initform 4 :type xcb:-pad-align)
    (name :initarg :name :type xcb:-ignore)
    (name~ :initform
          '(name name type xcb:BYTE size
@@ -426,6 +433,7 @@
             '(name outputs type xcb:randr:OUTPUT size
                    (xcb:-fieldref 'num-outputs))
             :type xcb:-list)
+   (pad~0 :initform 4 :type xcb:-pad-align)
    (possible :initarg :possible :type xcb:-ignore)
    (possible~ :initform
              '(name possible type xcb:randr:OUTPUT size
@@ -477,11 +485,13 @@
         '(name red type xcb:CARD16 size
                (xcb:-fieldref 'size))
         :type xcb:-list)
+   (pad~2 :initform 4 :type xcb:-pad-align)
    (green :initarg :green :type xcb:-ignore)
    (green~ :initform
           '(name green type xcb:CARD16 size
                  (xcb:-fieldref 'size))
           :type xcb:-list)
+   (pad~3 :initform 4 :type xcb:-pad-align)
    (blue :initarg :blue :type xcb:-ignore)
    (blue~ :initform
          '(name blue type xcb:CARD16 size
@@ -499,11 +509,13 @@
         '(name red type xcb:CARD16 size
                (xcb:-fieldref 'size))
         :type xcb:-list)
+   (pad~1 :initform 4 :type xcb:-pad-align)
    (green :initarg :green :type xcb:-ignore)
    (green~ :initform
           '(name green type xcb:CARD16 size
                  (xcb:-fieldref 'size))
           :type xcb:-list)
+   (pad~2 :initform 4 :type xcb:-pad-align)
    (blue :initarg :blue :type xcb:-ignore)
    (blue~ :initform
          '(name blue type xcb:CARD16 size
@@ -529,16 +541,19 @@
           '(name crtcs type xcb:randr:CRTC size
                  (xcb:-fieldref 'num-crtcs))
           :type xcb:-list)
+   (pad~2 :initform 4 :type xcb:-pad-align)
    (outputs :initarg :outputs :type xcb:-ignore)
    (outputs~ :initform
             '(name outputs type xcb:randr:OUTPUT size
                    (xcb:-fieldref 'num-outputs))
             :type xcb:-list)
+   (pad~3 :initform 4 :type xcb:-pad-align)
    (modes :initarg :modes :type xcb:-ignore)
    (modes~ :initform
           '(name modes type xcb:randr:ModeInfo size
                  (xcb:-fieldref 'num-modes))
           :type xcb:-list)
+   (pad~4 :initform 4 :type xcb:-pad-align)
    (names :initarg :names :type xcb:-ignore)
    (names~ :initform
           '(name names type xcb:BYTE size
@@ -562,6 +577,7 @@
                 '(name filter-name type xcb:char size
                        (xcb:-fieldref 'filter-len))
                 :type xcb:-list)
+   (pad~1 :initform 4 :type xcb:-pad-align)
    (filter-params :initarg :filter-params :type xcb:-ignore)
    (filter-params~ :initform
                   '(name filter-params type xcb:randr:FIXED size nil)
@@ -588,16 +604,19 @@
                         '(name pending-filter-name type xcb:char size
                                (xcb:-fieldref 'pending-len))
                         :type xcb:-list)
+   (pad~3 :initform 4 :type xcb:-pad-align)
    (pending-params :initarg :pending-params :type xcb:-ignore)
    (pending-params~ :initform
                    '(name pending-params type xcb:randr:FIXED size
                           (xcb:-fieldref 'pending-nparams))
                    :type xcb:-list)
+   (pad~4 :initform 4 :type xcb:-pad-align)
    (current-filter-name :initarg :current-filter-name :type xcb:-ignore)
    (current-filter-name~ :initform
                         '(name current-filter-name type xcb:char size
                                (xcb:-fieldref 'current-len))
                         :type xcb:-list)
+   (pad~5 :initform 4 :type xcb:-pad-align)
    (current-params :initarg :current-params :type xcb:-ignore)
    (current-params~ :initform
                    '(name current-params type xcb:randr:FIXED size
@@ -703,21 +722,25 @@
           '(name crtcs type xcb:randr:CRTC size
                  (xcb:-fieldref 'num-crtcs))
           :type xcb:-list)
+   (pad~1 :initform 4 :type xcb:-pad-align)
    (outputs :initarg :outputs :type xcb:-ignore)
    (outputs~ :initform
             '(name outputs type xcb:randr:OUTPUT size
                    (xcb:-fieldref 'num-outputs))
             :type xcb:-list)
+   (pad~2 :initform 4 :type xcb:-pad-align)
    (associated-providers :initarg :associated-providers :type xcb:-ignore)
    (associated-providers~ :initform
                          '(name associated-providers type xcb:randr:PROVIDER 
size
                                 (xcb:-fieldref 'num-associated-providers))
                          :type xcb:-list)
+   (pad~3 :initform 4 :type xcb:-pad-align)
    (associated-capability :initarg :associated-capability :type xcb:-ignore)
    (associated-capability~ :initform
                           '(name associated-capability type xcb:CARD32 size
                                  (xcb:-fieldref 'num-associated-providers))
                           :type xcb:-list)
+   (pad~4 :initform 4 :type xcb:-pad-align)
    (name :initarg :name :type xcb:-ignore)
    (name~ :initform
          '(name name type xcb:char size
diff --git a/lib/xcb-record.el b/lib/xcb-record.el
index b89327c..ce71daa 100644
--- a/lib/xcb-record.el
+++ b/lib/xcb-record.el
@@ -87,6 +87,7 @@
                  '(name client-specs type xcb:record:ClientSpec size
                         (xcb:-fieldref 'num-client-specs))
                  :type xcb:-list)
+   (pad~1 :initform 4 :type xcb:-pad-align)
    (ranges :initarg :ranges :type xcb:-ignore)
    (ranges~ :initform
            '(name ranges type xcb:record:Range size
@@ -106,6 +107,7 @@
                  '(name client-specs type xcb:record:ClientSpec size
                         (xcb:-fieldref 'num-client-specs))
                  :type xcb:-list)
+   (pad~1 :initform 4 :type xcb:-pad-align)
    (ranges :initarg :ranges :type xcb:-ignore)
    (ranges~ :initform
            '(name ranges type xcb:record:Range size
diff --git a/lib/xcb-render.el b/lib/xcb-render.el
index 841a021..0ec1ce7 100644
--- a/lib/xcb-render.el
+++ b/lib/xcb-render.el
@@ -254,11 +254,13 @@
             '(name formats type xcb:render:PICTFORMINFO size
                    (xcb:-fieldref 'num-formats))
             :type xcb:-list)
+   (pad~2 :initform 4 :type xcb:-pad-align)
    (screens :initarg :screens :type xcb:-ignore)
    (screens~ :initform
             '(name screens type xcb:render:PICTSCREEN size
                    (xcb:-fieldref 'num-screens))
             :type xcb:-list)
+   (pad~3 :initform 4 :type xcb:-pad-align)
    (subpixels :initarg :subpixels :type xcb:-ignore)
    (subpixels~ :initform
               '(name subpixels type xcb:CARD32 size
@@ -476,11 +478,13 @@
              '(name glyphids type xcb:CARD32 size
                     (xcb:-fieldref 'glyphs-len))
              :type xcb:-list)
+   (pad~0 :initform 4 :type xcb:-pad-align)
    (glyphs :initarg :glyphs :type xcb:-ignore)
    (glyphs~ :initform
            '(name glyphs type xcb:render:GLYPHINFO size
                   (xcb:-fieldref 'glyphs-len))
            :type xcb:-list)
+   (pad~1 :initform 4 :type xcb:-pad-align)
    (data :initarg :data :type xcb:-ignore)
    (data~ :initform
          '(name data type xcb:BYTE size nil)
@@ -596,6 +600,7 @@
             '(name aliases type xcb:CARD16 size
                    (xcb:-fieldref 'num-aliases))
             :type xcb:-list)
+   (pad~2 :initform 4 :type xcb:-pad-align)
    (filters :initarg :filters :type xcb:-ignore)
    (filters~ :initform
             '(name filters type xcb:STR size
@@ -613,6 +618,7 @@
            '(name filter type xcb:char size
                   (xcb:-fieldref 'filter-len))
            :type xcb:-list)
+   (pad~1 :initform 4 :type xcb:-pad-align)
    (values :initarg :values :type xcb:-ignore)
    (values~ :initform
            '(name values type xcb:render:FIXED size nil)
@@ -672,6 +678,7 @@
           '(name stops type xcb:render:FIXED size
                  (xcb:-fieldref 'num-stops))
           :type xcb:-list)
+   (pad~0 :initform 4 :type xcb:-pad-align)
    (colors :initarg :colors :type xcb:-ignore)
    (colors~ :initform
            '(name colors type xcb:render:COLOR size
@@ -692,6 +699,7 @@
           '(name stops type xcb:render:FIXED size
                  (xcb:-fieldref 'num-stops))
           :type xcb:-list)
+   (pad~0 :initform 4 :type xcb:-pad-align)
    (colors :initarg :colors :type xcb:-ignore)
    (colors~ :initform
            '(name colors type xcb:render:COLOR size
@@ -710,6 +718,7 @@
           '(name stops type xcb:render:FIXED size
                  (xcb:-fieldref 'num-stops))
           :type xcb:-list)
+   (pad~0 :initform 4 :type xcb:-pad-align)
    (colors :initarg :colors :type xcb:-ignore)
    (colors~ :initform
            '(name colors type xcb:render:COLOR size
diff --git a/lib/xcb-xf86dri.el b/lib/xcb-xf86dri.el
index 4d34e00..35a49a3 100644
--- a/lib/xcb-xf86dri.el
+++ b/lib/xcb-xf86dri.el
@@ -130,6 +130,7 @@
                '(name clip-rects type xcb:xf86dri:DrmClipRect size
                       (xcb:-fieldref 'num-clip-rects))
                :type xcb:-list)
+   (pad~1 :initform 4 :type xcb:-pad-align)
    (back-clip-rects :initarg :back-clip-rects :type xcb:-ignore)
    (back-clip-rects~ :initform
                     '(name back-clip-rects type xcb:xf86dri:DrmClipRect size
diff --git a/lib/xcb-xf86vidmode.el b/lib/xcb-xf86vidmode.el
index 4325ac8..bc8d684 100644
--- a/lib/xcb-xf86vidmode.el
+++ b/lib/xcb-xf86vidmode.el
@@ -132,16 +132,19 @@
           '(name hsync type xcb:xf86vidmode:SYNCRANGE size
                  (xcb:-fieldref 'num-hsync))
           :type xcb:-list)
+   (pad~2 :initform 4 :type xcb:-pad-align)
    (vsync :initarg :vsync :type xcb:-ignore)
    (vsync~ :initform
           '(name vsync type xcb:xf86vidmode:SYNCRANGE size
                  (xcb:-fieldref 'num-vsync))
           :type xcb:-list)
+   (pad~3 :initform 4 :type xcb:-pad-align)
    (vendor :initarg :vendor :type xcb:-ignore)
    (vendor~ :initform
            '(name vendor type xcb:char size
                   (xcb:-fieldref 'vendor-length))
            :type xcb:-list)
+   (pad~4 :initform 4 :type xcb:-pad-align)
    (alignment-pad :initarg :alignment-pad :type xcb:-ignore)
    (alignment-pad~ :initform
                   '(name alignment-pad type xcb:void size
@@ -155,6 +158,7 @@
                              (node-subnode node))))
                           (xcb:-fieldref 'vendor-length)))
                   :type xcb:-list)
+   (pad~5 :initform 4 :type xcb:-pad-align)
    (model :initarg :model :type xcb:-ignore)
    (model~ :initform
           '(name model type xcb:char size
@@ -390,6 +394,7 @@
                  (parse-expression
                   (node-subnode node)))))
         :type xcb:-list)
+   (pad~2 :initform 4 :type xcb:-pad-align)
    (green :initarg :green :type xcb:-ignore)
    (green~ :initform
           '(name green type xcb:CARD16 size
@@ -401,6 +406,7 @@
                    (parse-expression
                     (node-subnode node)))))
           :type xcb:-list)
+   (pad~3 :initform 4 :type xcb:-pad-align)
    (blue :initarg :blue :type xcb:-ignore)
    (blue~ :initform
          '(name blue type xcb:CARD16 size
@@ -429,6 +435,7 @@
                  (parse-expression
                   (node-subnode node)))))
         :type xcb:-list)
+   (pad~0 :initform 4 :type xcb:-pad-align)
    (green :initarg :green :type xcb:-ignore)
    (green~ :initform
           '(name green type xcb:CARD16 size
@@ -440,6 +447,7 @@
                    (parse-expression
                     (node-subnode node)))))
           :type xcb:-list)
+   (pad~1 :initform 4 :type xcb:-pad-align)
    (blue :initarg :blue :type xcb:-ignore)
    (blue~ :initform
          '(name blue type xcb:CARD16 size
diff --git a/lib/xcb-xfixes.el b/lib/xcb-xfixes.el
index 22c5666..7f6a0b3 100644
--- a/lib/xcb-xfixes.el
+++ b/lib/xcb-xfixes.el
@@ -308,6 +308,7 @@
                          (xcb:-fieldref 'width)
                          (xcb:-fieldref 'height)))
                  :type xcb:-list)
+   (pad~2 :initform 4 :type xcb:-pad-align)
    (name :initarg :name :type xcb:-ignore)
    (name~ :initform
          '(name name type xcb:char size
diff --git a/lib/xcb-xinput.el b/lib/xcb-xinput.el
index 3b23ded..2bb0ab8 100644
--- a/lib/xcb-xinput.el
+++ b/lib/xcb-xinput.el
@@ -153,6 +153,7 @@
             '(name devices type xcb:xinput:DeviceInfo size
                    (xcb:-fieldref 'devices-len))
             :type xcb:-list)
+   (pad~1 :initform 4 :type xcb:-pad-align)
    (infos :initarg :infos :type xcb:-ignore)
    (infos~ :initform
           '(name infos type xcb:xinput:InputInfo size
@@ -168,12 +169,13 @@
                               i))))
                          (slot-value obj 'devices))))
           :type xcb:-list)
+   (pad~2 :initform 4 :type xcb:-pad-align)
    (names :initarg :names :type xcb:-ignore)
    (names~ :initform
           '(name names type xcb:STR size
                  (xcb:-fieldref 'devices-len))
           :type xcb:-list)
-   (pad~1 :initform 4 :type xcb:-pad-align)))
+   (pad~3 :initform 4 :type xcb:-pad-align)))
 
 (defclass xcb:xinput:InputClassInfo
   (xcb:-struct)
@@ -242,6 +244,7 @@
                  '(name this-classes type xcb:xinput:EventClass size
                         (xcb:-fieldref 'num-this-classes))
                  :type xcb:-list)
+   (pad~1 :initform 4 :type xcb:-pad-align)
    (all-classes :initarg :all-classes :type xcb:-ignore)
    (all-classes~ :initform
                 '(name all-classes type xcb:xinput:EventClass size
@@ -945,6 +948,7 @@
                    (xcb:-fieldref 'num-events)
                    32))
            :type xcb:-list)
+   (pad~1 :initform 4 :type xcb:-pad-align)
    (classes :initarg :classes :type xcb:-ignore)
    (classes~ :initform
             '(name classes type xcb:xinput:EventClass size
@@ -993,11 +997,13 @@
                       '(name resolution-values type xcb:CARD32 size
                              (xcb:-fieldref 'num-valuators))
                       :type xcb:-list)
+   (pad~0 :initform 4 :type xcb:-pad-align)
    (resolution-min :initarg :resolution-min :type xcb:-ignore)
    (resolution-min~ :initform
                    '(name resolution-min type xcb:CARD32 size
                           (xcb:-fieldref 'num-valuators))
                    :type xcb:-list)
+   (pad~1 :initform 4 :type xcb:-pad-align)
    (resolution-max :initarg :resolution-max :type xcb:-ignore)
    (resolution-max~ :initform
                    '(name resolution-max type xcb:CARD32 size
@@ -1056,9 +1062,9 @@
            ((xcb:xinput:DeviceControl:abs_calib)
             min-x max-x min-y max-y flip-x flip-y rotation button-threshold)
            ((xcb:xinput:DeviceControl:core)
-            status iscore pad~0)
+            status iscore pad~2)
            ((xcb:xinput:DeviceControl:enable)
-            enable pad~1)
+            enable pad~3)
            ((xcb:xinput:DeviceControl:abs_area)
             offset-x offset-y width height screen following)))
         :type xcb:-switch)
@@ -1068,11 +1074,13 @@
                       '(name resolution-values type xcb:CARD32 size
                              (xcb:-fieldref 'num-valuators))
                       :type xcb:-list)
+   (pad~0 :initform 4 :type xcb:-pad-align)
    (resolution-min :initarg :resolution-min :type xcb:-ignore)
    (resolution-min~ :initform
                    '(name resolution-min type xcb:CARD32 size
                           (xcb:-fieldref 'num-valuators))
                    :type xcb:-list)
+   (pad~1 :initform 4 :type xcb:-pad-align)
    (resolution-max :initarg :resolution-max :type xcb:-ignore)
    (resolution-max~ :initform
                    '(name resolution-max type xcb:CARD32 size
@@ -1088,9 +1096,9 @@
    (button-threshold :initarg :button-threshold :type xcb:CARD32)
    (status :initarg :status :type xcb:CARD8)
    (iscore :initarg :iscore :type xcb:CARD8)
-   (pad~0 :initform 2 :type xcb:-pad)
+   (pad~2 :initform 2 :type xcb:-pad)
    (enable :initarg :enable :type xcb:CARD8)
-   (pad~1 :initform 3 :type xcb:-pad)
+   (pad~3 :initform 3 :type xcb:-pad)
    (offset-x :initarg :offset-x :type xcb:CARD32)
    (offset-y :initarg :offset-y :type xcb:CARD32)
    (width :initarg :width :type xcb:CARD32)
@@ -1609,6 +1617,7 @@
                    31)
                   32))
           :type xcb:-list)
+   (pad~0 :initform 4 :type xcb:-pad-align)
    (labels :initarg :labels :type xcb:-ignore)
    (labels~ :initform
            '(name labels type xcb:ATOM size
@@ -1674,9 +1683,9 @@
            ((xcb:xinput:DeviceClassType:Button)
             num-buttons state labels)
            ((xcb:xinput:DeviceClassType:Valuator)
-            number label min max value resolution mode pad~0)
+            number label min max value resolution mode pad~1)
            ((xcb:xinput:DeviceClassType:Scroll)
-            number* scroll-type pad~1 flags increment)
+            number* scroll-type pad~2 flags increment)
            ((xcb:xinput:DeviceClassType:Touch)
             mode* num-touches)))
         :type xcb:-switch)
@@ -1696,6 +1705,7 @@
                    31)
                   32))
           :type xcb:-list)
+   (pad~0 :initform 4 :type xcb:-pad-align)
    (labels :initarg :labels :type xcb:-ignore)
    (labels~ :initform
            '(name labels type xcb:ATOM size
@@ -1708,10 +1718,10 @@
    (value :initarg :value :type xcb:xinput:FP3232)
    (resolution :initarg :resolution :type xcb:CARD32)
    (mode :initarg :mode :type xcb:CARD8)
-   (pad~0 :initform 3 :type xcb:-pad)
+   (pad~1 :initform 3 :type xcb:-pad)
    (number* :initarg :number* :type xcb:CARD16)
    (scroll-type :initarg :scroll-type :type xcb:CARD16)
-   (pad~1 :initform 2 :type xcb:-pad)
+   (pad~2 :initform 2 :type xcb:-pad)
    (flags :initarg :flags :type xcb:CARD32)
    (increment :initarg :increment :type xcb:xinput:FP3232)
    (mode* :initarg :mode* :type xcb:CARD8)
@@ -1863,6 +1873,7 @@
          '(name mask type xcb:CARD32 size
                 (xcb:-fieldref 'mask-len))
          :type xcb:-list)
+   (pad~1 :initform 4 :type xcb:-pad-align)
    (modifiers :initarg :modifiers :type xcb:-ignore)
    (modifiers~ :initform
               '(name modifiers type xcb:CARD32 size
@@ -1978,9 +1989,9 @@
            (xcb:-fieldref 'format)
            cases
            (((xcb:xinput:PropertyFormat:8Bits)
-             data8 pad~1)
+             data8 pad~2)
             ((xcb:xinput:PropertyFormat:16Bits)
-             data16 pad~2)
+             data16 pad~3)
             ((xcb:xinput:PropertyFormat:32Bits)
              data32)))
          :type xcb:-switch)
@@ -1989,13 +2000,13 @@
           '(name data8 type xcb:CARD8 size
                  (xcb:-fieldref 'num-items))
           :type xcb:-list)
-   (pad~1 :initform 4 :type xcb:-pad-align)
+   (pad~2 :initform 4 :type xcb:-pad-align)
    (data16 :initarg :data16 :type xcb:-ignore)
    (data16~ :initform
            '(name data16 type xcb:CARD16 size
                   (xcb:-fieldref 'num-items))
            :type xcb:-list)
-   (pad~2 :initform 4 :type xcb:-pad-align)
+   (pad~3 :initform 4 :type xcb:-pad-align)
    (data32 :initarg :data32 :type xcb:-ignore)
    (data32~ :initform
            '(name data32 type xcb:CARD32 size
@@ -2235,11 +2246,13 @@
                 '(name button-mask type xcb:CARD32 size
                        (xcb:-fieldref 'buttons-len))
                 :type xcb:-list)
+   (pad~1 :initform 4 :type xcb:-pad-align)
    (valuator-mask :initarg :valuator-mask :type xcb:-ignore)
    (valuator-mask~ :initform
                   '(name valuator-mask type xcb:CARD32 size
                          (xcb:-fieldref 'valuators-len))
                   :type xcb:-list)
+   (pad~2 :initform 4 :type xcb:-pad-align)
    (axisvalues :initarg :axisvalues :type xcb:-ignore)
    (axisvalues~ :initform
                '(name axisvalues type xcb:xinput:FP3232 size
@@ -2289,11 +2302,13 @@
                 '(name button-mask type xcb:CARD32 size
                        (xcb:-fieldref 'buttons-len))
                 :type xcb:-list)
+   (pad~1 :initform 4 :type xcb:-pad-align)
    (valuator-mask :initarg :valuator-mask :type xcb:-ignore)
    (valuator-mask~ :initform
                   '(name valuator-mask type xcb:CARD32 size
                          (xcb:-fieldref 'valuators-len))
                   :type xcb:-list)
+   (pad~2 :initform 4 :type xcb:-pad-align)
    (axisvalues :initarg :axisvalues :type xcb:-ignore)
    (axisvalues~ :initform
                '(name axisvalues type xcb:xinput:FP3232 size
@@ -2440,6 +2455,7 @@
                   '(name valuator-mask type xcb:CARD32 size
                          (xcb:-fieldref 'valuators-len))
                   :type xcb:-list)
+   (pad~1 :initform 4 :type xcb:-pad-align)
    (axisvalues :initarg :axisvalues :type xcb:-ignore)
    (axisvalues~ :initform
                '(name axisvalues type xcb:xinput:FP3232 size
@@ -2455,6 +2471,7 @@
                                    i))))
                               (slot-value obj 'valuator-mask))))
                :type xcb:-list)
+   (pad~2 :initform 4 :type xcb:-pad-align)
    (axisvalues-raw :initarg :axisvalues-raw :type xcb:-ignore)
    (axisvalues-raw~ :initform
                    '(name axisvalues-raw type xcb:xinput:FP3232 size
@@ -2492,6 +2509,7 @@
                   '(name valuator-mask type xcb:CARD32 size
                          (xcb:-fieldref 'valuators-len))
                   :type xcb:-list)
+   (pad~1 :initform 4 :type xcb:-pad-align)
    (axisvalues :initarg :axisvalues :type xcb:-ignore)
    (axisvalues~ :initform
                '(name axisvalues type xcb:xinput:FP3232 size
@@ -2507,6 +2525,7 @@
                                    i))))
                               (slot-value obj 'valuator-mask))))
                :type xcb:-list)
+   (pad~2 :initform 4 :type xcb:-pad-align)
    (axisvalues-raw :initarg :axisvalues-raw :type xcb:-ignore)
    (axisvalues-raw~ :initform
                    '(name axisvalues-raw type xcb:xinput:FP3232 size
@@ -2561,11 +2580,13 @@
                 '(name button-mask type xcb:CARD32 size
                        (xcb:-fieldref 'buttons-len))
                 :type xcb:-list)
+   (pad~1 :initform 4 :type xcb:-pad-align)
    (valuator-mask :initarg :valuator-mask :type xcb:-ignore)
    (valuator-mask~ :initform
                   '(name valuator-mask type xcb:CARD32 size
                          (xcb:-fieldref 'valuators-len))
                   :type xcb:-list)
+   (pad~2 :initform 4 :type xcb:-pad-align)
    (axisvalues :initarg :axisvalues :type xcb:-ignore)
    (axisvalues~ :initform
                '(name axisvalues type xcb:xinput:FP3232 size
@@ -2625,6 +2646,7 @@
                   '(name valuator-mask type xcb:CARD32 size
                          (xcb:-fieldref 'valuators-len))
                   :type xcb:-list)
+   (pad~1 :initform 4 :type xcb:-pad-align)
    (axisvalues :initarg :axisvalues :type xcb:-ignore)
    (axisvalues~ :initform
                '(name axisvalues type xcb:xinput:FP3232 size
@@ -2640,6 +2662,7 @@
                                    i))))
                               (slot-value obj 'valuator-mask))))
                :type xcb:-list)
+   (pad~2 :initform 4 :type xcb:-pad-align)
    (axisvalues-raw :initarg :axisvalues-raw :type xcb:-ignore)
    (axisvalues-raw~ :initform
                    '(name axisvalues-raw type xcb:xinput:FP3232 size
diff --git a/lib/xcb-xkb.el b/lib/xcb-xkb.el
index f21b9c4..267cbe5 100644
--- a/lib/xcb-xkb.el
+++ b/lib/xcb-xkb.el
@@ -300,6 +300,7 @@
            '(name string type xcb:char size
                   (xcb:-fieldref 'length))
            :type xcb:-list)
+   (pad~0 :initform 4 :type xcb:-pad-align)
    (alignment-pad :initarg :alignment-pad :type xcb:-ignore)
    (alignment-pad~ :initform
                   '(name alignment-pad type xcb:void size
@@ -339,6 +340,7 @@
         '(name map type xcb:xkb:KTMapEntry size
                (xcb:-fieldref 'nMapEntries))
         :type xcb:-list)
+   (pad~1 :initform 4 :type xcb:-pad-align)
    (preserve :initarg :preserve :type xcb:-ignore)
    (preserve~ :initform
              '(name preserve type xcb:xkb:ModDef size
@@ -456,6 +458,7 @@
             '(name entries type xcb:xkb:KTSetMapEntry size
                    (xcb:-fieldref 'nMapEntries))
             :type xcb:-list)
+   (pad~1 :initform 4 :type xcb:-pad-align)
    (preserve-entries :initarg :preserve-entries :type xcb:-ignore)
    (preserve-entries~ :initform
                      '(name preserve-entries type xcb:xkb:KTSetMapEntry size
@@ -576,6 +579,7 @@
                  (xcb:-popcount
                   (xcb:-fieldref 'namesPresent)))
           :type xcb:-list)
+   (pad~0 :initform 4 :type xcb:-pad-align)
    (maps :initarg :maps :type xcb:-ignore)
    (maps~ :initform
          '(name maps type xcb:xkb:IndicatorMap size
@@ -1118,11 +1122,11 @@
          cases
          ((xcb:xkb:MapPart:KeyTypes types-rtrn)
           (xcb:xkb:MapPart:KeySyms syms-rtrn)
-          (xcb:xkb:MapPart:KeyActions acts-rtrn-count pad~1 acts-rtrn-acts)
+          (xcb:xkb:MapPart:KeyActions acts-rtrn-count pad~2 acts-rtrn-acts)
           (xcb:xkb:MapPart:KeyBehaviors behaviors-rtrn)
-          (xcb:xkb:MapPart:VirtualMods vmods-rtrn pad~2)
-          (xcb:xkb:MapPart:ExplicitComponents explicit-rtrn pad~3)
-          (xcb:xkb:MapPart:ModifierMap modmap-rtrn pad~4)
+          (xcb:xkb:MapPart:VirtualMods vmods-rtrn pad~3)
+          (xcb:xkb:MapPart:ExplicitComponents explicit-rtrn pad~4)
+          (xcb:xkb:MapPart:ModifierMap modmap-rtrn pad~5)
           (xcb:xkb:MapPart:VirtualModMap vmodmap-rtrn)))
        :type xcb:-switch)
    (types-rtrn :initarg :types-rtrn :type xcb:-ignore)
@@ -1140,7 +1144,7 @@
                     '(name acts-rtrn-count type xcb:CARD8 size
                            (xcb:-fieldref 'nKeyActions))
                     :type xcb:-list)
-   (pad~1 :initform 4 :type xcb:-pad-align)
+   (pad~2 :initform 4 :type xcb:-pad-align)
    (acts-rtrn-acts :initarg :acts-rtrn-acts :type xcb:-ignore)
    (acts-rtrn-acts~ :initform
                    '(name acts-rtrn-acts type xcb:xkb:Action size
@@ -1157,19 +1161,19 @@
                       (xcb:-popcount
                        (xcb:-fieldref 'virtualMods)))
                :type xcb:-list)
-   (pad~2 :initform 4 :type xcb:-pad-align)
+   (pad~3 :initform 4 :type xcb:-pad-align)
    (explicit-rtrn :initarg :explicit-rtrn :type xcb:-ignore)
    (explicit-rtrn~ :initform
                   '(name explicit-rtrn type xcb:xkb:SetExplicit size
                          (xcb:-fieldref 'totalKeyExplicit))
                   :type xcb:-list)
-   (pad~3 :initform 4 :type xcb:-pad-align)
+   (pad~4 :initform 4 :type xcb:-pad-align)
    (modmap-rtrn :initarg :modmap-rtrn :type xcb:-ignore)
    (modmap-rtrn~ :initform
                 '(name modmap-rtrn type xcb:xkb:KeyModMap size
                        (xcb:-fieldref 'totalModMapKeys))
                 :type xcb:-list)
-   (pad~4 :initform 4 :type xcb:-pad-align)
+   (pad~5 :initform 4 :type xcb:-pad-align)
    (vmodmap-rtrn :initarg :vmodmap-rtrn :type xcb:-ignore)
    (vmodmap-rtrn~ :initform
                  '(name vmodmap-rtrn type xcb:xkb:KeyVModMap size
@@ -1233,6 +1237,7 @@
                  '(name actionsCount type xcb:CARD8 size
                         (xcb:-fieldref 'nKeyActions))
                  :type xcb:-list)
+   (pad~0 :initform 4 :type xcb:-pad-align)
    (actions :initarg :actions :type xcb:-ignore)
    (actions~ :initform
             '(name actions type xcb:xkb:Action size
@@ -1287,6 +1292,7 @@
             '(name si-rtrn type xcb:xkb:SymInterpret size
                    (xcb:-fieldref 'nSIRtrn))
             :type xcb:-list)
+   (pad~2 :initform 4 :type xcb:-pad-align)
    (group-rtrn :initarg :group-rtrn :type xcb:-ignore)
    (group-rtrn~ :initform
                '(name group-rtrn type xcb:xkb:ModDef size
@@ -1310,6 +1316,7 @@
        '(name si type xcb:xkb:SymInterpret size
               (xcb:-fieldref 'nSI))
        :type xcb:-list)
+   (pad~2 :initform 4 :type xcb:-pad-align)
    (groupMaps :initarg :groupMaps :type xcb:-ignore)
    (groupMaps~ :initform
               '(name groupMaps type xcb:xkb:ModDef size
@@ -1466,6 +1473,7 @@
                    '(name nLevelsPerType type xcb:CARD8 size
                           (xcb:-fieldref 'nTypes))
                    :type xcb:-list)
+   (pad~1 :initform 4 :type xcb:-pad-align)
    (alignment-pad :initarg :alignment-pad :type xcb:-ignore)
    (alignment-pad~ :initform
                   '(name alignment-pad type xcb:CARD8 size
@@ -1479,6 +1487,7 @@
                              (node-subnode node))))
                           (xcb:-fieldref 'nTypes)))
                   :type xcb:-list)
+   (pad~2 :initform 4 :type xcb:-pad-align)
    (ktLevelNames :initarg :ktLevelNames :type xcb:-ignore)
    (ktLevelNames~ :initform
                  '(name ktLevelNames type xcb:ATOM size
@@ -1572,6 +1581,7 @@
                    '(name nLevelsPerType type xcb:CARD8 size
                           (xcb:-fieldref 'nTypes))
                    :type xcb:-list)
+   (pad~1 :initform 4 :type xcb:-pad-align)
    (ktLevelNames :initarg :ktLevelNames :type xcb:-ignore)
    (ktLevelNames~ :initform
                  '(name ktLevelNames type xcb:ATOM size
@@ -1652,26 +1662,31 @@
             '(name keymaps type xcb:xkb:Listing size
                    (xcb:-fieldref 'nKeymaps))
             :type xcb:-list)
+   (pad~1 :initform 4 :type xcb:-pad-align)
    (keycodes :initarg :keycodes :type xcb:-ignore)
    (keycodes~ :initform
              '(name keycodes type xcb:xkb:Listing size
                     (xcb:-fieldref 'nKeycodes))
              :type xcb:-list)
+   (pad~2 :initform 4 :type xcb:-pad-align)
    (types :initarg :types :type xcb:-ignore)
    (types~ :initform
           '(name types type xcb:xkb:Listing size
                  (xcb:-fieldref 'nTypes))
           :type xcb:-list)
+   (pad~3 :initform 4 :type xcb:-pad-align)
    (compatMaps :initarg :compatMaps :type xcb:-ignore)
    (compatMaps~ :initform
                '(name compatMaps type xcb:xkb:Listing size
                       (xcb:-fieldref 'nCompatMaps))
                :type xcb:-list)
+   (pad~4 :initform 4 :type xcb:-pad-align)
    (symbols :initarg :symbols :type xcb:-ignore)
    (symbols~ :initform
             '(name symbols type xcb:xkb:Listing size
                    (xcb:-fieldref 'nSymbols))
             :type xcb:-list)
+   (pad~5 :initform 4 :type xcb:-pad-align)
    (geometries :initarg :geometries :type xcb:-ignore)
    (geometries~ :initform
                '(name geometries type xcb:xkb:Listing size
@@ -1701,12 +1716,12 @@
              (xcb:-fieldref 'reported)
              cases
              (((logior xcb:xkb:GBNDetail:Types xcb:xkb:GBNDetail:ClientSymbols 
xcb:xkb:GBNDetail:ServerSymbols)
-               nil getmap-type nil typeDeviceID nil getmap-sequence 
getmap-length nil pad~1 typeMinKeyCode typeMaxKeyCode present firstType nTypes 
totalTypes firstKeySym totalSyms nKeySyms firstKeyAction totalActions 
nKeyActions firstKeyBehavior nKeyBehaviors totalKeyBehaviors firstKeyExplicit 
nKeyExplicit totalKeyExplicit firstModMapKey nModMapKeys totalModMapKeys 
firstVModMapKey nVModMapKeys totalVModMapKeys pad~2 virtualMods map)
-              (xcb:xkb:GBNDetail:CompatMap nil compatmap-type compatDeviceID 
compatmap-sequence compatmap-length nil groupsRtrn pad~3 firstSIRtrn nSIRtrn 
nTotalSI pad~4 si-rtrn group-rtrn)
-              (xcb:xkb:GBNDetail:IndicatorMaps nil indicatormap-type 
indicatorDeviceID indicatormap-sequence indicatormap-length nil which 
realIndicators nIndicators pad~5 maps)
+               getmap-type typeDeviceID getmap-sequence getmap-length pad~1 
typeMinKeyCode typeMaxKeyCode present firstType nTypes totalTypes firstKeySym 
totalSyms nKeySyms firstKeyAction totalActions nKeyActions firstKeyBehavior 
nKeyBehaviors totalKeyBehaviors firstKeyExplicit nKeyExplicit totalKeyExplicit 
firstModMapKey nModMapKeys totalModMapKeys firstVModMapKey nVModMapKeys 
totalVModMapKeys pad~2 virtualMods map)
+              (xcb:xkb:GBNDetail:CompatMap compatmap-type compatDeviceID 
compatmap-sequence compatmap-length groupsRtrn pad~4 firstSIRtrn nSIRtrn 
nTotalSI pad~5 si-rtrn group-rtrn)
+              (xcb:xkb:GBNDetail:IndicatorMaps indicatormap-type 
indicatorDeviceID indicatormap-sequence indicatormap-length which 
realIndicators nIndicators pad~7 maps)
               ((logior xcb:xkb:GBNDetail:KeyNames xcb:xkb:GBNDetail:OtherNames)
-               nil keyname-type keyDeviceID keyname-sequence keyname-length 
nil which* keyMinKeyCode keyMaxKeyCode nTypes* groupNames virtualMods* firstKey 
nKeys indicators nRadioGroups nKeyAliases nKTLevels pad~6 valueList)
-              (xcb:xkb:GBNDetail:Geometry nil geometry-type geometryDeviceID 
geometry-sequence geometry-length nil name geometryFound pad~7 widthMM heightMM 
nProperties nColors nShapes nSections nDoodads nKeyAliases* baseColorNdx 
labelColorNdx labelFont nil nil)))
+               keyname-type keyDeviceID keyname-sequence keyname-length which* 
keyMinKeyCode keyMaxKeyCode nTypes* groupNames virtualMods* firstKey nKeys 
indicators nRadioGroups nKeyAliases nKTLevels pad~8 valueList)
+              (xcb:xkb:GBNDetail:Geometry geometry-type geometryDeviceID 
geometry-sequence geometry-length name geometryFound pad~10 widthMM heightMM 
nProperties nColors nShapes nSections nDoodads nKeyAliases* baseColorNdx 
labelColorNdx labelFont)))
            :type xcb:-switch)
    (getmap-type :initarg :getmap-type :type xcb:CARD8)
    (typeDeviceID :initarg :typeDeviceID :type xcb:CARD8)
@@ -1767,6 +1782,7 @@
                     '(name acts-rtrn-count type xcb:CARD8 size
                            (xcb:-fieldref 'nKeyActions))
                     :type xcb:-list)
+   (pad~3 :initform 4 :type xcb:-pad-align)
    (acts-rtrn-acts :initarg :acts-rtrn-acts :type xcb:-ignore)
    (acts-rtrn-acts~ :initform
                    '(name acts-rtrn-acts type xcb:xkb:Action size
@@ -1803,16 +1819,17 @@
    (compatmap-sequence :initarg :compatmap-sequence :type xcb:CARD16)
    (compatmap-length :initarg :compatmap-length :type xcb:CARD32)
    (groupsRtrn :initarg :groupsRtrn :type xcb:CARD8)
-   (pad~3 :initform 1 :type xcb:-pad)
+   (pad~4 :initform 1 :type xcb:-pad)
    (firstSIRtrn :initarg :firstSIRtrn :type xcb:CARD16)
    (nSIRtrn :initarg :nSIRtrn :type xcb:CARD16)
    (nTotalSI :initarg :nTotalSI :type xcb:CARD16)
-   (pad~4 :initform 16 :type xcb:-pad)
+   (pad~5 :initform 16 :type xcb:-pad)
    (si-rtrn :initarg :si-rtrn :type xcb:-ignore)
    (si-rtrn~ :initform
             '(name si-rtrn type xcb:xkb:SymInterpret size
                    (xcb:-fieldref 'nSIRtrn))
             :type xcb:-list)
+   (pad~6 :initform 4 :type xcb:-pad-align)
    (group-rtrn :initarg :group-rtrn :type xcb:-ignore)
    (group-rtrn~ :initform
                '(name group-rtrn type xcb:xkb:ModDef size
@@ -1826,7 +1843,7 @@
    (which :initarg :which :type xcb:CARD32)
    (realIndicators :initarg :realIndicators :type xcb:CARD32)
    (nIndicators :initarg :nIndicators :type xcb:CARD8)
-   (pad~5 :initform 15 :type xcb:-pad)
+   (pad~7 :initform 15 :type xcb:-pad)
    (maps :initarg :maps :type xcb:-ignore)
    (maps~ :initform
          '(name maps type xcb:xkb:IndicatorMap size
@@ -1848,7 +1865,7 @@
    (nRadioGroups :initarg :nRadioGroups :type xcb:CARD8)
    (nKeyAliases :initarg :nKeyAliases :type xcb:CARD8)
    (nKTLevels :initarg :nKTLevels :type xcb:CARD16)
-   (pad~6 :initform 4 :type xcb:-pad)
+   (pad~8 :initform 4 :type xcb:-pad)
    (valueList :initform
              '(expression
                (xcb:-fieldref 'which)
@@ -1884,6 +1901,7 @@
                    '(name nLevelsPerType type xcb:CARD8 size
                           (xcb:-fieldref 'nTypes))
                    :type xcb:-list)
+   (pad~9 :initform 4 :type xcb:-pad-align)
    (ktLevelNames :initarg :ktLevelNames :type xcb:-ignore)
    (ktLevelNames~ :initform
                  '(name ktLevelNames type xcb:ATOM size
@@ -1929,7 +1947,7 @@
    (geometry-length :initarg :geometry-length :type xcb:CARD32)
    (name :initarg :name :type xcb:ATOM)
    (geometryFound :initarg :geometryFound :type xcb:BOOL)
-   (pad~7 :initform 1 :type xcb:-pad)
+   (pad~10 :initform 1 :type xcb:-pad)
    (widthMM :initarg :widthMM :type xcb:CARD16)
    (heightMM :initarg :heightMM :type xcb:CARD16)
    (nProperties :initarg :nProperties :type xcb:CARD16)
@@ -1976,11 +1994,13 @@
          '(name name type xcb:xkb:STRING8 size
                 (xcb:-fieldref 'nameLen))
          :type xcb:-list)
+   (pad~1 :initform 4 :type xcb:-pad-align)
    (btnActions :initarg :btnActions :type xcb:-ignore)
    (btnActions~ :initform
                '(name btnActions type xcb:xkb:Action size
                       (xcb:-fieldref 'nBtnsRtrn))
                :type xcb:-list)
+   (pad~2 :initform 4 :type xcb:-pad-align)
    (leds :initarg :leds :type xcb:-ignore)
    (leds~ :initform
          '(name leds type xcb:xkb:DeviceLedInfo size
@@ -2000,6 +2020,7 @@
                '(name btnActions type xcb:xkb:Action size
                       (xcb:-fieldref 'nBtns))
                :type xcb:-list)
+   (pad~0 :initform 4 :type xcb:-pad-align)
    (leds :initarg :leds :type xcb:-ignore)
    (leds~ :initform
          '(name leds type xcb:xkb:DeviceLedInfo size
diff --git a/lib/xcb-xprint.el b/lib/xcb-xprint.el
index 1b95229..74d9ab4 100644
--- a/lib/xcb-xprint.el
+++ b/lib/xcb-xprint.el
@@ -20,6 +20,7 @@
          '(name name type xcb:xprint:STRING8 size
                 (xcb:-fieldref 'nameLen))
          :type xcb:-list)
+   (pad~0 :initform 4 :type xcb:-pad-align)
    (descLen :initarg :descLen :type xcb:CARD32)
    (description :initarg :description :type xcb:-ignore)
    (description~ :initform
@@ -70,6 +71,7 @@
                  '(name printer-name type xcb:xprint:STRING8 size
                         (xcb:-fieldref 'printerNameLen))
                  :type xcb:-list)
+   (pad~0 :initform 4 :type xcb:-pad-align)
    (locale :initarg :locale :type xcb:-ignore)
    (locale~ :initform
            '(name locale type xcb:xprint:STRING8 size
@@ -101,6 +103,7 @@
                 '(name printerName type xcb:xprint:STRING8 size
                        (xcb:-fieldref 'printerNameLen))
                 :type xcb:-list)
+   (pad~0 :initform 4 :type xcb:-pad-align)
    (locale :initarg :locale :type xcb:-ignore)
    (locale~ :initform
            '(name locale type xcb:xprint:STRING8 size
@@ -165,11 +168,13 @@
          '(name data type xcb:BYTE size
                 (xcb:-fieldref 'len-data))
          :type xcb:-list)
+   (pad~0 :initform 4 :type xcb:-pad-align)
    (doc-format :initarg :doc-format :type xcb:-ignore)
    (doc-format~ :initform
                '(name doc-format type xcb:xprint:STRING8 size
                       (xcb:-fieldref 'len-fmt))
                :type xcb:-list)
+   (pad~1 :initform 4 :type xcb:-pad-align)
    (options :initarg :options :type xcb:-ignore)
    (options~ :initform
             '(name options type xcb:xprint:STRING8 size
diff --git a/lib/xcb-xproto.el b/lib/xcb-xproto.el
index a9a186d..be3e9a0 100644
--- a/lib/xcb-xproto.el
+++ b/lib/xcb-xproto.el
@@ -167,6 +167,7 @@
                                 '(name authorization-protocol-name type 
xcb:char size
                                        (xcb:-fieldref 
'authorization-protocol-name-len))
                                 :type xcb:-list)
+   (pad~2 :initform 4 :type xcb:-pad-align)
    (authorization-protocol-data :initarg :authorization-protocol-data :type 
xcb:-ignore)
    (authorization-protocol-data~ :initform
                                 '(name authorization-protocol-data type 
xcb:char size
@@ -229,11 +230,13 @@
            '(name vendor type xcb:char size
                   (xcb:-fieldref 'vendor-len))
            :type xcb:-list)
+   (pad~2 :initform 4 :type xcb:-pad-align)
    (pixmap-formats :initarg :pixmap-formats :type xcb:-ignore)
    (pixmap-formats~ :initform
                    '(name pixmap-formats type xcb:FORMAT size
                           (xcb:-fieldref 'pixmap-formats-len))
                    :type xcb:-list)
+   (pad~3 :initform 4 :type xcb:-pad-align)
    (roots :initarg :roots :type xcb:-ignore)
    (roots~ :initform
           '(name roots type xcb:SCREEN size
@@ -1513,6 +1516,7 @@
                '(name properties type xcb:FONTPROP size
                       (xcb:-fieldref 'properties-len))
                :type xcb:-list)
+   (pad~3 :initform 4 :type xcb:-pad-align)
    (char-infos :initarg :char-infos :type xcb:-ignore)
    (char-infos~ :initform
                '(name char-infos type xcb:CHARINFO size
@@ -1614,6 +1618,7 @@
                '(name properties type xcb:FONTPROP size
                       (xcb:-fieldref 'properties-len))
                :type xcb:-list)
+   (pad~2 :initform 4 :type xcb:-pad-align)
    (name :initarg :name :type xcb:-ignore)
    (name~ :initform
          '(name name type xcb:char size
@@ -2244,6 +2249,7 @@
            '(name pixels type xcb:CARD32 size
                   (xcb:-fieldref 'pixels-len))
            :type xcb:-list)
+   (pad~2 :initform 4 :type xcb:-pad-align)
    (masks :initarg :masks :type xcb:-ignore)
    (masks~ :initform
           '(name masks type xcb:CARD32 size
diff --git a/lib/xcb-xselinux.el b/lib/xcb-xselinux.el
index cdfade1..ea552cf 100644
--- a/lib/xcb-xselinux.el
+++ b/lib/xcb-xselinux.el
@@ -120,6 +120,7 @@
                    '(name object-context type xcb:char size
                           (xcb:-fieldref 'object-context-len))
                    :type xcb:-list)
+   (pad~0 :initform 4 :type xcb:-pad-align)
    (data-context :initarg :data-context :type xcb:-ignore)
    (data-context~ :initform
                  '(name data-context type xcb:char size
diff --git a/lib/xcb-xv.el b/lib/xcb-xv.el
index 9c62f5d..b14d0ee 100644
--- a/lib/xcb-xv.el
+++ b/lib/xcb-xv.el
@@ -104,11 +104,13 @@
             '(name pitches type xcb:CARD32 size
                    (xcb:-fieldref 'num-planes))
             :type xcb:-list)
+   (pad~0 :initform 4 :type xcb:-pad-align)
    (offsets :initarg :offsets :type xcb:-ignore)
    (offsets~ :initform
             '(name offsets type xcb:CARD32 size
                    (xcb:-fieldref 'num-planes))
             :type xcb:-list)
+   (pad~1 :initform 4 :type xcb:-pad-align)
    (data :initarg :data :type xcb:-ignore)
    (data~ :initform
          '(name data type xcb:CARD8 size
@@ -408,6 +410,7 @@
             '(name pitches type xcb:CARD32 size
                    (xcb:-fieldref 'num-planes))
             :type xcb:-list)
+   (pad~2 :initform 4 :type xcb:-pad-align)
    (offsets :initarg :offsets :type xcb:-ignore)
    (offsets~ :initform
             '(name offsets type xcb:CARD32 size
diff --git a/util/xcb-xim.el b/util/xcb-xim.el
index 2678990..847db54 100644
--- a/util/xcb-xim.el
+++ b/util/xcb-xim.el
@@ -111,8 +111,7 @@
 Consider let-bind it rather than change its global value.")
 
 (defclass xim:-struct (xcb:-struct)
-  ((~lsb :initform (symbol-value 'xim:lsb))
-   (~auto-padding :initform nil))       ;disable auto padding
+  ((~lsb :initform (symbol-value 'xim:lsb)))
   :documentation "Struct type for XIM.")
 
 (defclass xim:-request (xim:-struct)
diff --git a/xcb-types.el b/xcb-types.el
index a81b80e..d808c83 100644
--- a/xcb-types.el
+++ b/xcb-types.el
@@ -298,8 +298,7 @@ Consider let-bind it rather than change its global value.")
 (defclass xcb:-struct ()
   ((~lsb :initarg :~lsb
          :initform (symbol-value 'xcb:lsb) ;see `eieio-default-eval-maybe'
-         :type xcb:-ignore)
-   (~auto-padding :initarg :~auto-padding :initform t :type xcb:-ignore))
+         :type xcb:-ignore))
   :documentation "Struct type.")
 
 (cl-defmethod xcb:marshal ((obj xcb:-struct))
@@ -353,24 +352,13 @@ The optional POS argument indicates current byte index of 
the field (used by
      (let* ((list-name (plist-get value 'name))
             (list-type (plist-get value 'type))
             (list-size (plist-get value 'size))
-            (data (slot-value obj list-name))
-            implicit-padding)
+            (data (slot-value obj list-name)))
        (unless (integerp list-size)
-         (when (slot-value obj '~auto-padding) (setq implicit-padding t))
          (setq list-size (eval list-size `((obj . ,obj))))
          (unless list-size
            (setq list-size (length data)))) ;list-size can be nil
        (cl-assert (= list-size (length data)))
-       (let ((result (mapconcat (lambda (i)
-                                  (xcb:-marshal-field obj list-type i))
-                                data []))
-             len)
-         (if (not implicit-padding)
-             result
-           ;; The length slot in xcb:-request is left out
-           (setq len (if (object-of-class-p obj xcb:-request) (+ pos 2) pos))
-           (vconcat result
-                    (make-vector (logand (- 0 len (length result)) #x3) 0))))))
+       (mapconcat (lambda (i) (xcb:-marshal-field obj list-type i)) data [])))
     (`xcb:-switch
      (let ((slots (eieio-class-slots (eieio-object-class obj)))
            (expression (plist-get value 'expression))
@@ -474,10 +462,8 @@ and the second the consumed length."
        (setq initform (cadr initform)))
      (let ((list-name (plist-get initform 'name))
            (list-type (plist-get initform 'type))
-           (list-size (plist-get initform 'size))
-           implicit-padding)
+           (list-size (plist-get initform 'size)))
        (unless (integerp list-size)
-         (when (slot-value obj '~auto-padding) (setq implicit-padding t))
          (setq list-size (eval list-size `((obj . ,obj) (ctx . ,ctx)))))
        (cl-assert (integerp list-size))
        (pcase list-type
@@ -501,10 +487,7 @@ and the second the consumed length."
               (setq count (+ count (cadr tmp))))
             (setf (slot-value obj list-name) result)
             (setq list-size count))))   ;to byte length
-       (list initform (if implicit-padding
-                          ;; Assume DATA is aligned
-                          (+ list-size (% (- (length data) list-size) 4))
-                        list-size))))
+       (list initform list-size)))
     (`xcb:-switch
      (let ((slots (eieio-class-slots (eieio-object-class obj)))
            (expression (plist-get initform 'expression))



reply via email to

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