[Xcb-commit] 2 commits - src xcbgen

Eamon Walsh ewalsh at kemper.freedesktop.org
Wed Oct 21 15:41:15 PDT 2009


 src/type.py      |    2 +-
 src/xcb.xsd      |    2 --
 src/xproto.xml   |    3 ++-
 xcbgen/xtypes.py |   28 ++++------------------------
 4 files changed, 7 insertions(+), 28 deletions(-)

New commits:
commit b684b0d0806c59526f57ca4e36e77104eec1b580
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Wed Oct 21 18:37:33 2009 -0400

    Re-fix the ConfigureWindow request padding issue.
    
    We rely on the fact that the valueparam field is treated as a list,
    and, like any other list, the Python code will check if the length
    field is previously defined in the structure before adding a new one.
    This allows us to insert the necessary 2-byte padding.
    
    Signed-off-by: Eamon Walsh <ewalsh at tycho.nsa.gov>

diff --git a/src/xproto.xml b/src/xproto.xml
index 69f3c8a..5a056e8 100644
--- a/src/xproto.xml
+++ b/src/xproto.xml
@@ -866,6 +866,8 @@ authorization from the authors.
   <request name="ConfigureWindow" opcode="12">
     <pad bytes="1" />
     <field type="WINDOW" name="window" />
+    <field type="CARD16" name="value_mask" />
+    <pad bytes="2" />
     <valueparam value-mask-type="CARD16"
                 value-mask-name="value_mask"
                 value-list-name="value_list" />
commit a03633320a28e07e561de86b32e75c8e4626ece7
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Wed Oct 21 18:22:06 2009 -0400

    Revert "made changes to support new value-mask-pad field of valueparam structures"
    
    This change fixes a ConfigureWindow request padding issue,
    but has a bug that affects xpyb (#24507).
    
    This reverts commit 57934caa3fb207320c33312646d8e98290950f51.

diff --git a/src/type.py b/src/type.py
index 873845b..8338232 100755
--- a/src/type.py
+++ b/src/type.py
@@ -47,7 +47,7 @@ class AnnotateType(XMLFilterBase):
 			self.declareType(attrs['newname'])
 			attnames = ['oldname', 'newname']
 		elif name == 'valueparam':
-			attnames = ['value-mask-type', 'value-mask-pad']
+			attnames = ['value-mask-type']
 		elif attrs.has_key('type'):
 			attnames = ['type']
 		newattrs = {}
diff --git a/src/xcb.xsd b/src/xcb.xsd
index 54a7370..f3fcb6f 100644
--- a/src/xcb.xsd
+++ b/src/xcb.xsd
@@ -112,8 +112,6 @@ authorization from the authors.
     <xsd:complexType>
       <xsd:attribute name="value-mask-type" type="xsd:string" use="required" />
       <xsd:attribute name="value-mask-name" type="xsd:string" use="required" />
-      <!-- This pad is currently needed only by ConfigureWindow.  Sigh. -->
-      <xsd:attribute name="value-mask-pad" type="xsd:integer" use="optional" />
       <xsd:attribute name="value-list-name" type="xsd:string" use="required" />
     </xsd:complexType>
   </xsd:element>
diff --git a/src/xproto.xml b/src/xproto.xml
index 6295dae..69f3c8a 100644
--- a/src/xproto.xml
+++ b/src/xproto.xml
@@ -868,7 +868,6 @@ authorization from the authors.
     <field type="WINDOW" name="window" />
     <valueparam value-mask-type="CARD16"
                 value-mask-name="value_mask"
-                value-mask-pad="2"
                 value-list-name="value_list" />
   </request>
 
diff --git a/xcbgen/xtypes.py b/xcbgen/xtypes.py
index 30617b8..01d765e 100644
--- a/xcbgen/xtypes.py
+++ b/xcbgen/xtypes.py
@@ -235,15 +235,15 @@ class ExprType(Type):
     def fixed_size(self):
         return True
 
-class SizedPadType(Type):
+class PadType(Type):
     '''
-    Derived class which represents a padding field of given size.
+    Derived class which represents a padding field.
     '''
-    def __init__(self, size):
+    def __init__(self, elt):
         Type.__init__(self, tcard8.name)
         self.is_pad = True
         self.size = 1
-        self.nmemb = int(size)
+        self.nmemb = 1 if (elt == None) else int(elt.get('bytes'))
 
     def resolve(self, module):
         self.resolved = True
@@ -251,13 +251,6 @@ class SizedPadType(Type):
     def fixed_size(self):
         return True
 
-class PadType(SizedPadType):
-    '''
-    Derived class which represents a padding field of given type.
-    '''
-    def __init__(self, elt):
-        self.nmemb = "1" if (elt == None) else elt.get('bytes')
-        SizedPadType.__init__(self, self.nmemb)
     
 class ComplexType(Type):
     '''
@@ -281,7 +274,6 @@ class ComplexType(Type):
 
         # Resolve all of our field datatypes.
         for child in list(self.elt):
-            value_mask_pad = None
             if child.tag == 'pad':
                 field_name = 'pad' + str(pads)
                 fkey = 'CARD8'
@@ -308,7 +300,6 @@ class ComplexType(Type):
                 fkey = 'CARD32'
                 type = ListType(child, module.get_type(fkey), self)
                 visible = True
-                value_mask_pad = child.get('value-mask-pad')
             else:
                 # Hit this on Reply
                 continue 
@@ -320,17 +311,6 @@ class ComplexType(Type):
             # Recursively resolve the type (could be another structure, list)
             type.resolve(module)
 
-            # Add a value-mask-pad if necessary
-            if value_mask_pad != None:
-                vmp_field_name = 'pad' + str(pads)
-                vmp_fkey = 'CARD8'
-                vmp_type = SizedPadType(value_mask_pad)
-                pads = pads + 1
-                vmp_visible = False
-                vmp_field_type = module.get_type_name(vmp_fkey)
-                vmp_type.make_member_of(module, self, vmp_field_type, vmp_field_name, vmp_visible, True, False)
-                vmp_type.resolve(module)
-
         self.calc_size() # Figure out how big we are
         self.resolved = True
 


More information about the xcb-commit mailing list