diff options
author | marha <marha@users.sourceforge.net> | 2014-11-29 16:13:30 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2014-11-29 16:13:30 +0100 |
commit | 7147e58c389cffeb930bdd8e3a2fdfc5d5bb3a0c (patch) | |
tree | e5b941fdff86328a065c46582ba53e0cc73c8576 /libxcb | |
parent | 0dbe845b2f4ba08924d6fcb9634d09dc3dde13d6 (diff) | |
parent | a1011d63ffb5cc4f41bf0f4622ee3f1493d419d9 (diff) | |
download | vcxsrv-7147e58c389cffeb930bdd8e3a2fdfc5d5bb3a0c.tar.gz vcxsrv-7147e58c389cffeb930bdd8e3a2fdfc5d5bb3a0c.tar.bz2 vcxsrv-7147e58c389cffeb930bdd8e3a2fdfc5d5bb3a0c.zip |
Merge remote-tracking branch 'origin/released'
Conflicts:
xorg-server/dix/dispatch.c
xorg-server/hw/xwin/ddraw.h
xorg-server/hw/xwin/glx/glshim.c
xorg-server/hw/xwin/winclipboard/xevents.c
xorg-server/hw/xwin/windialogs.c
xorg-server/hw/xwin/winmultiwindowshape.c
xorg-server/hw/xwin/winmultiwindowwindow.c
xorg-server/hw/xwin/winprefslex.l
xorg-server/hw/xwin/winshadddnl.c
xorg-server/hw/xwin/winshadgdi.c
xorg-server/hw/xwin/winwndproc.c
xorg-server/mi/miarc.c
xorg-server/os/connection.c
Diffstat (limited to 'libxcb')
-rwxr-xr-x | libxcb/src/c_client.py | 52 | ||||
-rw-r--r-- | libxcb/xcb-proto/src/xinput.xml | 37 |
2 files changed, 69 insertions, 20 deletions
diff --git a/libxcb/src/c_client.py b/libxcb/src/c_client.py index 27cae36a0..b9f47db7d 100755 --- a/libxcb/src/c_client.py +++ b/libxcb/src/c_client.py @@ -359,7 +359,8 @@ def _c_type_setup(self, name, postfix): field.c_pointer = '*' field.c_field_const_type = 'const ' + field.c_field_type self.c_need_aux = True - elif not field.type.fixed_size() and not field.type.is_case_or_bitcase: + + if not field.type.fixed_size() and not field.type.is_case_or_bitcase: self.c_need_sizeof = True field.c_iterator_type = _t(field.field_type + ('iterator',)) # xcb_fieldtype_iterator_t @@ -657,9 +658,15 @@ def get_serialize_params(context, self, buffer_var='_buffer', aux_var='_aux'): return (param_fields, wire_fields, params) # get_serialize_params() -def _c_serialize_helper_insert_padding(context, code_lines, space, postpone): +def _c_serialize_helper_insert_padding(context, code_lines, space, postpone, is_case_or_bitcase): code_lines.append('%s /* insert padding */' % space) - code_lines.append('%s xcb_pad = -xcb_block_len & (xcb_align_to - 1);' % space) + if is_case_or_bitcase: + code_lines.append( + '%s xcb_pad = -(xcb_block_len + xcb_padding_offset) & (xcb_align_to - 1);' + % space) + else: + code_lines.append( + '%s xcb_pad = -xcb_block_len & (xcb_align_to - 1);' % space) # code_lines.append('%s printf("automatically inserting padding: %%%%d\\n", xcb_pad);' % space) code_lines.append('%s xcb_buffer_len += xcb_block_len + xcb_pad;' % space) @@ -677,6 +684,8 @@ def _c_serialize_helper_insert_padding(context, code_lines, space, postpone): code_lines.append('%s }' % space) code_lines.append('%s xcb_block_len = 0;' % space) + if is_case_or_bitcase: + code_lines.append('%s xcb_padding_offset = 0;' % space) # keep tracking of xcb_parts entries for serialize return 1 @@ -771,6 +780,10 @@ def _c_serialize_helper_switch_field(context, self, field, c_switch_variable, pr elif context in ('unserialize', 'unpack'): length = "%s(xcb_tmp, %s&%s%s)" % (field.type.c_unpack_name, c_field_names, prefix_str, field.c_field_name) + elif 'sizeof' == context: + # remove trailing ", " from c_field_names because it will be used at end of arglist + my_c_field_names = c_field_names[:-2] + length = "%s(xcb_tmp, %s)" % (field.type.c_sizeof_name, my_c_field_names) return length # _c_serialize_helper_switch_field() @@ -870,9 +883,13 @@ def _c_serialize_helper_fields_fixed_size(context, self, field, # total padding = sizeof(pad0) * nmemb length += " * %d" % field.type.nmemb - if field.type.is_list: - # no such case in the protocol, cannot be tested and therefore ignored for now - raise Exception('list with fixed number of elemens unhandled in _unserialize()') + elif field.type.is_list: + # list with fixed number of elements + # length of array = sizeof(arrayElementType) * nmemb + length += " * %d" % field.type.nmemb + # use memcpy because C cannot assign whole arrays with operator= + value = ' memcpy(%s, xcb_tmp, %s);' % (abs_field_name, length) + elif 'serialize' == context: value = ' xcb_parts[xcb_parts_idx].iov_base = (char *) ' @@ -997,13 +1014,15 @@ def _c_serialize_helper_fields(context, self, # Variable length pad is <pad align= /> code_lines.append('%s xcb_align_to = %d;' % (space, field.type.align)) count += _c_serialize_helper_insert_padding(context, code_lines, space, - self.c_var_followed_by_fixed_fields) + self.c_var_followed_by_fixed_fields, + is_case_or_bitcase) continue else: # switch/bitcase: always calculate padding before and after variable sized fields if need_padding or is_case_or_bitcase: count += _c_serialize_helper_insert_padding(context, code_lines, space, - self.c_var_followed_by_fixed_fields) + self.c_var_followed_by_fixed_fields, + is_case_or_bitcase) value, length = _c_serialize_helper_fields_variable_size(context, self, field, code_lines, temp_vars, @@ -1043,7 +1062,12 @@ def _c_serialize_helper_fields(context, self, code_lines.append('%s xcb_parts_idx++;' % space) count += 1 - code_lines.append('%s xcb_align_to = ALIGNOF(%s);' % (space, 'char' if field.c_field_type == 'void' else field.c_field_type)) + code_lines.append( + '%s xcb_align_to = ALIGNOF(%s);' + % (space, + 'char' + if field.c_field_type == 'void' or field.type.is_switch + else field.c_field_type)) need_padding = True if self.c_var_followed_by_fixed_fields: @@ -1087,7 +1111,7 @@ def _c_serialize_helper(context, complex_type, code_lines, temp_vars, space, prefix, False) # "final padding" - count += _c_serialize_helper_insert_padding(context, code_lines, space, False) + count += _c_serialize_helper_insert_padding(context, code_lines, space, False, self.is_switch) return count # _c_serialize_helper() @@ -1157,6 +1181,8 @@ def _c_serialize(context, self): _c(' char *xcb_out = *_buffer;') _c(' unsigned int xcb_buffer_len = 0;') _c(' unsigned int xcb_align_to = 0;') + if self.is_switch: + _c(' unsigned int xcb_padding_offset = ((size_t)xcb_out) & 7;') prefix = [('_aux', '->', self)] aux_ptr = 'xcb_out' @@ -1180,6 +1206,8 @@ def _c_serialize(context, self): _c(' unsigned int xcb_block_len = 0;') _c(' unsigned int xcb_pad = 0;') _c(' unsigned int xcb_align_to = 0;') + if self.is_switch: + _c(' unsigned int xcb_padding_offset = ((size_t)_buffer) & 7;') elif 'sizeof' == context: param_names = [p[2] for p in params] @@ -1197,6 +1225,8 @@ def _c_serialize(context, self): else: _c(' char *xcb_tmp = (char *)_buffer;') prefix = [('_aux', '->', self)] + if self.is_switch: + _c(' unsigned int xcb_padding_offset = 0;') count = _c_serialize_helper(context, self, code_lines, temp_vars, prefix=prefix) # update variable size fields (only important for context=='serialize' @@ -1775,7 +1805,7 @@ def _c_complex(self, force_packed = False): for b in self.bitcases: space = '' if b.type.has_name: - _h(' struct _%s {', b.c_field_name) + _h(' struct {') space = ' ' for field in b.type.fields: _c_complex_field(self, field, space) diff --git a/libxcb/xcb-proto/src/xinput.xml b/libxcb/xcb-proto/src/xinput.xml index dc87e7829..7f7b0a66d 100644 --- a/libxcb/xcb-proto/src/xinput.xml +++ b/libxcb/xcb-proto/src/xinput.xml @@ -862,7 +862,7 @@ in struct DeviceTimeCoord. <field type="CARD8" name="len" /> <field type="CARD8" name="num_valuators" /> <field type="CARD8" name="mode" mask="ValuatorStateModeMask" /> - <list type="CARD32" name="valuators"> + <list type="INT32" name="valuators"> <fieldref>num_valuators</fieldref> </list> </struct> @@ -870,14 +870,33 @@ in struct DeviceTimeCoord. <struct name="InputState"> <field type="CARD8" name="class_id" enum="InputClass" /> <field type="CARD8" name="len" /> - <field type="CARD8" name="num_items" /> - <pad bytes="1" /> - <list type="CARD8" name="uninterpreted_data"> - <op op="-"> - <fieldref>len</fieldref> - <value>4</value> - </op> - </list> + <switch name="data"> + <fieldref>class_id</fieldref> + <case name="key"> + <enumref ref="InputClass">Key</enumref> + <field type="CARD8" name="num_keys" /> + <pad bytes="1" /> + <list type="CARD8" name="keys"> + <value>32</value> + </list> + </case> + <case name="button"> + <enumref ref="InputClass">Button</enumref> + <field type="CARD8" name="num_buttons" /> + <pad bytes="1" /> + <list type="CARD8" name="buttons"> + <value>32</value> + </list> + </case> + <case name="valuator"> + <enumref ref="InputClass">Valuator</enumref> + <field type="CARD8" name="num_valuators" /> + <field type="CARD8" name="mode" mask="ValuatorStateModeMask" /> + <list type="INT32" name="valuators"> + <fieldref>num_valuators</fieldref> + </list> + </case> + </switch> </struct> <request name="QueryDeviceState" opcode="30"> |