diff options
Diffstat (limited to 'libxcb')
-rw-r--r-- | libxcb/src/c_client.py | 18 | ||||
-rw-r--r-- | libxcb/src/xcb_in.c | 13 | ||||
-rw-r--r-- | libxcb/src/xcb_out.c | 40 | ||||
-rw-r--r-- | libxcb/src/xcbext.h | 1 | ||||
-rw-r--r-- | libxcb/src/xcbint.h | 7 | ||||
-rw-r--r-- | libxcb/xcb-proto/doc/xml-xcb.txt | 13 | ||||
-rw-r--r-- | libxcb/xcb-proto/src/res.xml | 70 | ||||
-rw-r--r-- | libxcb/xcb-proto/src/screensaver.xml | 13 | ||||
-rw-r--r-- | libxcb/xcb-proto/src/xcb.xsd | 2 | ||||
-rw-r--r-- | libxcb/xcb-proto/src/xkb.xml | 447 | ||||
-rw-r--r-- | libxcb/xcb-proto/xcbgen/xtypes.py | 18 |
11 files changed, 247 insertions, 395 deletions
diff --git a/libxcb/src/c_client.py b/libxcb/src/c_client.py index a8e21012c..a43eae21b 100644 --- a/libxcb/src/c_client.py +++ b/libxcb/src/c_client.py @@ -688,10 +688,20 @@ def _c_serialize_helper_switch(context, self, complex_name, switch_expr = _c_accessor_get_expr(self.expr, None) for b in self.bitcases: - bitcase_expr = _c_accessor_get_expr(b.type.expr, None) - code_lines.append(' if(%s & %s) {' % (switch_expr, bitcase_expr)) -# code_lines.append(' printf("switch %s: entering bitcase section %s (mask=%%%%d)...\\n", %s);' % -# (self.name[-1], b.type.name[-1], bitcase_expr)) + len_expr = len(b.type.expr) + for n, expr in enumerate(b.type.expr): + bitcase_expr = _c_accessor_get_expr(expr, None) + # only one <enumref> in the <bitcase> + if len_expr == 1: + code_lines.append(' if(%s & %s) {' % (switch_expr, bitcase_expr)) + # multiple <enumref> in the <bitcase> + elif n == 0: # first + code_lines.append(' if((%s & %s) ||' % (switch_expr, bitcase_expr)) + elif len_expr == (n + 1): # last + code_lines.append(' (%s & %s)) {' % (switch_expr, bitcase_expr)) + else: # between first and last + code_lines.append(' (%s & %s) ||' % (switch_expr, bitcase_expr)) + b_prefix = prefix if b.type.has_name: b_prefix = prefix + [(b.c_field_name, '.', b.type)] diff --git a/libxcb/src/xcb_in.c b/libxcb/src/xcb_in.c index da2b7077a..a10dbe83c 100644 --- a/libxcb/src/xcb_in.c +++ b/libxcb/src/xcb_in.c @@ -94,8 +94,9 @@ static void remove_finished_readers(reader_list **prev_reader, uint64_t complete static int read_packet(xcb_connection_t *c) { xcb_generic_reply_t genrep; - int length = 32; - int eventlength = 0; /* length after first 32 bytes for GenericEvents */ + uint64_t length = 32; + uint64_t eventlength = 0; /* length after first 32 bytes for GenericEvents */ + uint64_t bufsize; void *buf; pending_reply *pend = 0; struct event_list *event; @@ -170,8 +171,12 @@ static int read_packet(xcb_connection_t *c) if ((genrep.response_type & 0x7f) == XCB_XGE_EVENT) eventlength = genrep.length * 4; - buf = malloc(length + eventlength + - (genrep.response_type == XCB_REPLY ? 0 : sizeof(uint32_t))); + bufsize = length + eventlength + + (genrep.response_type == XCB_REPLY ? 0 : sizeof(uint32_t)); + if (bufsize < INT32_MAX) + buf = malloc((size_t) bufsize); + else + buf = NULL; if(!buf) { _xcb_conn_shutdown(c, XCB_CONN_CLOSED_MEM_INSUFFICIENT); diff --git a/libxcb/src/xcb_out.c b/libxcb/src/xcb_out.c index 996fedb23..4cb837c1a 100644 --- a/libxcb/src/xcb_out.c +++ b/libxcb/src/xcb_out.c @@ -87,21 +87,24 @@ static void send_sync(xcb_connection_t *c) static void get_socket_back(xcb_connection_t *c) { - while(c->out.return_socket && c->out.socket_moving) - pthread_cond_wait(&c->out.socket_cond, &c->iolock); - if(!c->out.return_socket) - return; - - c->out.socket_moving = 1; - pthread_mutex_unlock(&c->iolock); - c->out.return_socket(c->out.socket_closure); - pthread_mutex_lock(&c->iolock); - c->out.socket_moving = 0; - - pthread_cond_broadcast(&c->out.socket_cond); - c->out.return_socket = 0; - c->out.socket_closure = 0; - _xcb_in_replies_done(c); + while (c->out.return_socket) { + /* we are about to release the lock, + so make a copy of the current status */ + xcb_return_socket_func_t return_socket = c->out.return_socket; + void *socket_closure = c->out.socket_closure; + int socket_seq = c->out.socket_seq; + + pthread_mutex_unlock(&c->iolock); + return_socket(socket_closure); + pthread_mutex_lock(&c->iolock); + + /* make sure nobody else has acquired the socket */ + if (socket_seq == c->out.socket_seq) { + c->out.return_socket = 0; + c->out.socket_closure = 0; + _xcb_in_replies_done(c); + } + } } /* Public interface */ @@ -273,12 +276,13 @@ int xcb_take_socket(xcb_connection_t *c, void (*return_socket)(void *closure), v * write requests, so keep flushing until we're done */ do - ret = _xcb_out_flush_to(c, c->out.request); + ret = _xcb_out_flush_to(c, c->out.request); while (ret && c->out.request != c->out.request_written); if(ret) { c->out.return_socket = return_socket; c->out.socket_closure = closure; + ++c->out.socket_seq; if(flags) _xcb_in_expect_reply(c, c->out.request, WORKAROUND_EXTERNAL_SOCKET_OWNER, flags); assert(c->out.request == c->out.request_written); @@ -315,11 +319,9 @@ int xcb_flush(xcb_connection_t *c) int _xcb_out_init(_xcb_out *out) { - if(pthread_cond_init(&out->socket_cond, 0)) - return 0; out->return_socket = 0; out->socket_closure = 0; - out->socket_moving = 0; + out->socket_seq = 0; if(pthread_cond_init(&out->cond, 0)) return 0; diff --git a/libxcb/src/xcbext.h b/libxcb/src/xcbext.h index 98b3c93c1..4e1f2f73d 100644 --- a/libxcb/src/xcbext.h +++ b/libxcb/src/xcbext.h @@ -66,6 +66,7 @@ unsigned int xcb_send_request(xcb_connection_t *c, int flags, struct iovec *vect * callback which XCB can call when it wants the write side of the * socket back to make a request. This callback synchronizes with the * external socket owner and flushes any output queues if appropriate. + * The callback might be called from different threads at the same time. * If you are sending requests which won't cause a reply, please note the * comment for xcb_writev which explains some sequence number wrap issues. * */ diff --git a/libxcb/src/xcbint.h b/libxcb/src/xcbint.h index f9e5a52f7..7f9ab2838 100644 --- a/libxcb/src/xcbint.h +++ b/libxcb/src/xcbint.h @@ -79,14 +79,15 @@ void *_xcb_map_remove(_xcb_map *q, unsigned int key); /* xcb_out.c */ +typedef void (*xcb_return_socket_func_t)(void *closure); + typedef struct _xcb_out { pthread_cond_t cond; int writing; - pthread_cond_t socket_cond; - void (*return_socket)(void *closure); + xcb_return_socket_func_t return_socket; void *socket_closure; - int socket_moving; + unsigned int socket_seq; char queue[XCB_QUEUE_BUFFER_SIZE]; int queue_len; diff --git a/libxcb/xcb-proto/doc/xml-xcb.txt b/libxcb/xcb-proto/doc/xml-xcb.txt index 705772736..cf6d14e46 100644 --- a/libxcb/xcb-proto/doc/xml-xcb.txt +++ b/libxcb/xcb-proto/doc/xml-xcb.txt @@ -229,13 +229,18 @@ enum; the value is restricted to one of the constants named in the enum. <switch> instead for new protocol definitions. <switch name="identifier"> switch expression - <bitcase> bitcase expression, fields </bitcase> </switch> + <bitcase> bitcase expression(s), fields </bitcase> </switch> This element represents conditional inclusion of fields. It can be viewed as sequence of multiple ifs: if ( switch expression & bitcase expression ) - is equal to bitcase expression, bitcase fields are included in structure. - It can be used only as the last field of structure. New protocol definitions - should prefer to use this instead of <valueparam>. + is non-zero, bitcase fields are included in structure. It can be used only + as the last field of a structure. + + When a bitcase includes multiple <enumref> clauses, the contents of the + bitcase are only present once regardless of the number of bitcase expressions + that match. + + New protocol definitions should prefer to use this instead of <valueparam>. Expressions ----------- diff --git a/libxcb/xcb-proto/src/res.xml b/libxcb/xcb-proto/src/res.xml index d758d893b..1dd3bd196 100644 --- a/libxcb/xcb-proto/src/res.xml +++ b/libxcb/xcb-proto/src/res.xml @@ -26,9 +26,10 @@ sale, use or other dealings in this Software without prior written authorization from the authors. --> <xcb header="res" extension-xname="X-Resource" extension-name="Res" - major-version="1" minor-version="0"> + major-version="1" minor-version="2"> <import>xproto</import> + <!-- v1.0 --> <struct name="Client"> <field type="CARD32" name="resource_base" /> <field type="CARD32" name="resource_mask" /> @@ -39,6 +40,41 @@ authorization from the authors. <field type="CARD32" name="count" /> </struct> + <!-- v1.2 --> + <struct name="ClientIdSpec"> + <field type="CARD32" name="client" /> + <field type="CARD32" name="mask" /> + </struct> + + <struct name="ClientIdValue"> + <field type="ClientIdSpec" name="spec" /> + <field type="CARD32" name="length" /> + <list type="CARD8" name="client_ids"> + <fieldref>length</fieldref> + </list> + </struct> + + <struct name="ResourceIdSpec"> + <field type="CARD32" name="resource" /> + <field type="CARD32" name="type" /> + </struct> + + <struct name="ResourceSizeSpec"> + <field type="ResourceIdSpec" name="spec" /> + <field type="CARD32" name="bytes" /> + <field type="CARD32" name="ref_count" /> + <field type="CARD32" name="use_count" /> + </struct> + + <struct name="ResourceSizeValue"> + <field type="ResourceSizeSpec" name="size" /> + <field type="CARD32" name="num_cross_references" /> + <list type="ResourceSizeSpec" name="cross_references"> + <fieldref>num_cross_references</fieldref> + </list> + </struct> + + <!-- v1.0 --> <request name="QueryVersion" opcode="0"> <field type="CARD8" name="client_major" /> <field type="CARD8" name="client_minor" /> @@ -80,4 +116,36 @@ authorization from the authors. <field type="CARD32" name="bytes_overflow" /> </reply> </request> + + <!-- v1.2 --> + <request name="QueryClientIds" opcode="4"> + <field type="CARD32" name="num_specs" /> + <list type="ClientIdSpec" name="specs"> + <fieldref>num_specs</fieldref> + </list> + <reply> + <pad bytes="1" /> + <field type="CARD32" name="num_ids" /> + <pad bytes="20" /> + <list type="ClientIdValue" name="ids"> + <fieldref>num_ids</fieldref> + </list> + </reply> + </request> + + <request name="QueryResourceBytes" opcode="5"> + <field type="CARD32" name="client" /> + <field type="CARD32" name="num_specs" /> + <list type="ResourceIdSpec" name="specs"> + <fieldref>num_specs</fieldref> + </list> + <reply> + <pad bytes="1" /> + <field type="CARD32" name="num_sizes" /> + <pad bytes="20" /> + <list type="ResourceSizeValue" name="sizes"> + <fieldref>num_sizes</fieldref> + </list> + </reply> + </request> </xcb> diff --git a/libxcb/xcb-proto/src/screensaver.xml b/libxcb/xcb-proto/src/screensaver.xml index 9c7bccb08..7449c0a0b 100644 --- a/libxcb/xcb-proto/src/screensaver.xml +++ b/libxcb/xcb-proto/src/screensaver.xml @@ -75,14 +75,14 @@ Draft Standard Version 1.1 <field type="CARD32" name="ms_until_server"/> <field type="CARD32" name="ms_since_user_input"/> <field type="CARD32" name="event_mask" /> - <field type="BYTE" name="kind"/> <!-- enum Kind --> + <field type="BYTE" name="kind" enum="Kind"/> <pad bytes="7"/> </reply> </request> <request name="SelectInput" opcode="2"> <field type="DRAWABLE" name="drawable"/> - <field type="CARD32" name="event_mask" /> <!-- enum Event --> + <field type="CARD32" name="event_mask" mask="Event"/> </request> <request name="SetAttributes" opcode="3"> @@ -92,7 +92,7 @@ Draft Standard Version 1.1 <field type="CARD16" name="width"/> <field type="CARD16" name="height"/> <field type="CARD16" name="border_width"/> - <field type="BYTE" name="class"/> <!-- enum XCBWindowClass --> + <field type="BYTE" name="class" enum="WindowClass"/> <field type="CARD8" name="depth"/> <field type="VISUALID" name="visual"/> <valueparam value-mask-type="CARD32" @@ -113,14 +113,11 @@ Draft Standard Version 1.1 <!-- Events --> <event name="Notify" number="0"> - <field type="CARD8" name="code"/> - <field type="BYTE" name="state"/> <!-- enum State --> - <pad bytes="1" /> - <field type="CARD16" name="sequence_number"/> + <field type="BYTE" name="state" enum="State"/> <field type="TIMESTAMP" name="time"/> <field type="WINDOW" name="root"/> <field type="WINDOW" name="window"/> - <field type="BYTE" name="kind"/> <!-- enum Kind --> + <field type="BYTE" name="kind" enum="Kind"/> <field type="BOOL" name="forced"/> <pad bytes="14"/> </event> diff --git a/libxcb/xcb-proto/src/xcb.xsd b/libxcb/xcb-proto/src/xcb.xsd index cfa90c9c2..4ef269e10 100644 --- a/libxcb/xcb-proto/src/xcb.xsd +++ b/libxcb/xcb-proto/src/xcb.xsd @@ -59,7 +59,7 @@ authorization from the authors. <xsd:complexType name="caseexpr"> <xsd:sequence> <!-- case expression: --> - <xsd:group ref="expression" minOccurs="1" maxOccurs="1" /> + <xsd:group ref="expression" minOccurs="1" maxOccurs="unbounded" /> <!-- match --> <xsd:group ref="fields" minOccurs="1" maxOccurs="unbounded" /> <xsd:choice> diff --git a/libxcb/xcb-proto/src/xkb.xml b/libxcb/xcb-proto/src/xkb.xml index a6ef37490..0e263c4fb 100644 --- a/libxcb/xcb-proto/src/xkb.xml +++ b/libxcb/xcb-proto/src/xkb.xml @@ -268,7 +268,7 @@ authorization from the authors. <item name="KeyType1"> <bit>0</bit> </item> </enum> - <enum name="SymInterpret"> + <enum name="SymInterpretMatch"> <item name="NoneOf"> <value>0</value> </item> <item name="AnyOfOrNone"> <value>1</value> </item> <item name="AnyOf"> <value>2</value> </item> @@ -311,7 +311,7 @@ authorization from the authors. <field name="mods" type="CARD8" mask="ModMask" /> <field name="realMods" type="CARD8" mask="ModMask" /> <field name="vmods" type="CARD16" mask="VMod" /> - <field name="ctrls" type="CARD32" enum="BoolCtrl" /> + <field name="ctrls" type="CARD32" mask="BoolCtrl" /> </struct> <enum name="CMDetail"> @@ -370,33 +370,42 @@ authorization from the authors. </struct> <struct name="KeyName"> - <list name="name" type="CARD8"> + <list name="name" type="char"> <value>4</value> </list> </struct> <struct name="KeyAlias"> - <list name="real" type="CARD8"> + <list name="real" type="char"> <value>4</value> </list> - <list name="alias" type="CARD8"> + <list name="alias" type="char"> <value>4</value> </list> </struct> - <struct name="CountedString8"> - <field name="length" type="CARD8" /> - <list name="string" type="CARD8"> - <fieldref>length</fieldref> - </list> - </struct> - <struct name="CountedString16"> <field name="length" type="CARD16" /> - <list name="string" type="CARD8"> + <list name="string" type="char"> <fieldref>length</fieldref> </list> - <pad bytes="1" /> + <list type="void" name="alignment_pad"> + <op op="-"> + <op op="&"> + <op op="+"> + <fieldref>length</fieldref> + <value>5</value> + </op> + <unop op="~"> + <value>3</value> + </unop> + </op> + <op op="+"> + <fieldref>length</fieldref> + <value>2</value> + </op> + </op> + </list> </struct> <struct name="KTMapEntry"> @@ -1020,6 +1029,23 @@ authorization from the authors. <field name="val2value" type="CARD8" /> </struct> + <struct name="SIAction"> + <field name="type" type="CARD8" enum="SAType" /> + <list name="data" type="CARD8"> + <value>7</value> + </list> + </struct> + + <struct name="SymInterpret"> + <field name="sym" type="KEYSYM" /> + <field name="mods" type="CARD8" mask="ModMask" /> + <!-- "match" may also have XkbSI_LevelOneOnly (0x80) or'd into it --> + <field name="match" type="CARD8" altenum="SymInterpretMatch" /> + <field name="virtualMod" type="CARD8" mask="VModsLow" /> + <field name="flags" type="CARD8" /> + <field name="action" type="SIAction" /> + </struct> + <union name="Action"> <field name="noaction" type="SANoAction" /> <field name="setmods" type="SASetMods" /> @@ -1060,11 +1086,11 @@ authorization from the authors. <request name="SelectEvents" opcode="1"> <field name="deviceSpec" type="DeviceSpec" /> - <field name="affectWhich" type="CARD16" enum="EventType" /> - <field name="clear" type="CARD16" enum="EventType" /> - <field name="selectAll" type="CARD16" enum="EventType" /> - <field name="affectMap" type="CARD16" enum="MapPart" /> - <field name="map" type="CARD16" enum="MapPart" /> + <field name="affectWhich" type="CARD16" mask="EventType" /> + <field name="clear" type="CARD16" mask="EventType" /> + <field name="selectAll" type="CARD16" mask="EventType" /> + <field name="affectMap" type="CARD16" mask="MapPart" /> + <field name="map" type="CARD16" mask="MapPart" /> <switch name="details"> <op op="&"> <fieldref>affectWhich</fieldref> @@ -1211,9 +1237,9 @@ authorization from the authors. <field name="accessXTimeoutOptionsMask" type="AXOption" /> <field name="accessXTimeoutOptionsValues" type="AXOption" /> <pad bytes="2" /> - <field name="accessXTimeoutMask" type="CARD32" enum="BoolCtrl" /> - <field name="accessXTimeoutValues" type="CARD32" enum="BoolCtrl" /> - <field name="enabledControls" type="CARD32" enum="BoolCtrl" /> + <field name="accessXTimeoutMask" type="CARD32" mask="BoolCtrl" /> + <field name="accessXTimeoutValues" type="CARD32" mask="BoolCtrl" /> + <field name="enabledControls" type="CARD32" mask="BoolCtrl" /> <list name="perKeyRepeat" type="CARD8"> <value>32</value> </list> @@ -1234,8 +1260,8 @@ authorization from the authors. <field name="groupsWrap" type="CARD8" /> <field name="accessXOptions" type="AXOption" /> <pad bytes="2" /> - <field name="affectEnabledControls" type="CARD32" enum="BoolCtrl" /> - <field name="enabledControls" type="CARD32" enum="BoolCtrl" /> + <field name="affectEnabledControls" type="CARD32" mask="BoolCtrl" /> + <field name="enabledControls" type="CARD32" mask="BoolCtrl" /> <field name="changeControls" type="CARD32" mask="Control" /> <field name="repeatDelay" type="CARD16" /> <field name="repeatInterval" type="CARD16" /> @@ -1247,8 +1273,8 @@ authorization from the authors. <field name="mouseKeysMaxSpeed" type="CARD16" /> <field name="mouseKeysCurve" type="INT16" /> <field name="accessXTimeout" type="CARD16" /> - <field name="accessXTimeoutMask" type="CARD32" enum="BoolCtrl" /> - <field name="accessXTimeoutValues" type="CARD32" enum="BoolCtrl" /> + <field name="accessXTimeoutMask" type="CARD32" mask="BoolCtrl" /> + <field name="accessXTimeoutValues" type="CARD32" mask="BoolCtrl" /> <field name="accessXTimeoutOptionsMask" type="AXOption" /> <field name="accessXTimeoutOptionsValues" type="AXOption" /> <list name="perKeyRepeat" type="CARD8"> @@ -1258,8 +1284,8 @@ authorization from the authors. <request name="GetMap" opcode="8"> <field name="deviceSpec" type="DeviceSpec" /> - <field name="full" type="CARD16" enum="MapPart" /> - <field name="partial" type="CARD16" enum="MapPart" /> + <field name="full" type="CARD16" mask="MapPart" /> + <field name="partial" type="CARD16" mask="MapPart" /> <field name="firstType" type="CARD8" /> <field name="nTypes" type="CARD8" /> <field name="firstKeySym" type="KEYCODE" /> @@ -1281,7 +1307,7 @@ authorization from the authors. <pad bytes="2" /> <field name="minKeyCode" type="KEYCODE" /> <field name="maxKeyCode" type="KEYCODE" /> - <field name="present" type="CARD16" enum="MapPart" /> + <field name="present" type="CARD16" mask="MapPart" /> <field name="firstType" type="CARD8" /> <field name="nTypes" type="CARD8" /> <field name="totalTypes" type="CARD8" /> @@ -1337,7 +1363,7 @@ authorization from the authors. <bitcase> <enumref ref="MapPart">VirtualMods</enumref> <list name="vmods_rtrn" type="CARD8" mask="ModMask"> - <fieldref>nVModMapKeys</fieldref> + <popcount><fieldref>virtualMods</fieldref></popcount> </list> </bitcase> <bitcase> @@ -1364,7 +1390,7 @@ authorization from the authors. <request name="SetMap" opcode="9"> <field name="deviceSpec" type="DeviceSpec" /> - <field name="present" type="CARD16" enum="MapPart" /> + <field name="present" type="CARD16" mask="MapPart" /> <field name="flags" type="CARD16" mask="SetMapFlags" /> <field name="minKeyCode" type="KEYCODE" /> <field name="maxKeyCode" type="KEYCODE" /> @@ -1421,7 +1447,7 @@ authorization from the authors. <bitcase> <enumref ref="MapPart">VirtualMods</enumref> <list name="vmods" type="CARD8"> - <fieldref>nVModMapKeys</fieldref> + <popcount><fieldref>virtualMods</fieldref></popcount> </list> </bitcase> <bitcase> @@ -1459,11 +1485,8 @@ authorization from the authors. <field name="nSIRtrn" type="CARD16" /> <field name="nTotalSI" type="CARD16" /> <pad bytes="16" /> - <list name="si_rtrn" type="CARD8" mask="SymInterpret"> - <op op="*"> - <value>16</value> - <fieldref>nSIRtrn</fieldref> - </op> + <list name="si_rtrn" type="SymInterpret"> + <fieldref>nSIRtrn</fieldref> </list> <list name="group_rtrn" type="ModDef"> <popcount> @@ -1482,11 +1505,8 @@ authorization from the authors. <field name="firstSI" type="CARD16" /> <field name="nSI" type="CARD16" /> <pad bytes="2"/> - <list name="si" type="CARD8" mask="SymInterpret"> - <op op="*"> - <value>16</value> - <fieldref>nSI</fieldref> - </op> + <list name="si" type="SymInterpret"> + <fieldref>nSI</fieldref> </list> <list name="groupMaps" type="ModDef"> <popcount> @@ -1516,7 +1536,7 @@ authorization from the authors. <field name="nIndicators" type="CARD8" /> <pad bytes="15" /> <list name="maps" type="IndicatorMap"> - <fieldref>nIndicators</fieldref> + <popcount><fieldref>which</fieldref></popcount> </list> </reply> </request> @@ -1984,6 +2004,8 @@ authorization from the authors. <fieldref>reported</fieldref> <bitcase name="types"> <enumref ref="GBNDetail">Types</enumref> + <enumref ref="GBNDetail">ClientSymbols</enumref> + <enumref ref="GBNDetail">ServerSymbols</enumref> <!-- from the spec, this has to be a GetMap reply --> <field name="getmap_type" type="CARD8" /> <!-- done 'emulating' GetMap reply header--> @@ -1995,7 +2017,7 @@ authorization from the authors. <pad bytes="2" /> <field name="typeMinKeyCode" type="KEYCODE" /> <field name="typeMaxKeyCode" type="KEYCODE" /> - <field name="present" type="CARD16" enum="MapPart" /> + <field name="present" type="CARD16" mask="MapPart" /> <field name="firstType" type="CARD8" /> <field name="nTypes" type="CARD8" /> <field name="totalTypes" type="CARD8" /> @@ -2051,7 +2073,7 @@ authorization from the authors. <bitcase> <enumref ref="MapPart">VirtualMods</enumref> <list name="vmods_rtrn" type="CARD8" mask="ModMask"> - <fieldref>nVModMapKeys</fieldref> + <popcount><fieldref>virtualMods</fieldref></popcount> </list> </bitcase> <bitcase> @@ -2076,18 +2098,20 @@ authorization from the authors. </bitcase> <bitcase name="compat_map"> <enumref ref="GBNDetail">CompatMap</enumref> + <!-- from the spec, this has to include a reply header --> + <field name="compatmap_type" type="CARD8" /> <field name="compatDeviceID" type="CARD8" /> + <field name="compatmap_sequence" type="CARD16" /> + <field name="compatmap_length" type="CARD32" /> + <!-- done 'emulating' reply header --> <field name="groupsRtrn" type="CARD8" mask="SetOfGroup" /> <pad bytes="1" /> <field name="firstSIRtrn" type="CARD16" /> <field name="nSIRtrn" type="CARD16" /> <field name="nTotalSI" type="CARD16" /> <pad bytes="16" /> - <list name="si_rtrn" type="CARD8" mask="SymInterpret"> - <op op="*"> - <value>16</value> - <fieldref>nSIRtrn</fieldref> - </op> + <list name="si_rtrn" type="SymInterpret"> + <fieldref>nSIRtrn</fieldref> </list> <list name="group_rtrn" type="ModDef"> <popcount> @@ -2095,179 +2119,14 @@ authorization from the authors. </popcount> </list> </bitcase> - <bitcase name="client_symbols"> - <enumref ref="GBNDetail">ClientSymbols</enumref> - <field name="clientDeviceID" type="CARD8" /> - <pad bytes="2" /> - <field name="clientMinKeyCode" type="KEYCODE" /> - <field name="clientMaxKeyCode" type="KEYCODE" /> - <field name="present" type="CARD16" enum="MapPart" /> - <field name="firstType" type="CARD8" /> - <field name="nTypes" type="CARD8" /> - <field name="totalTypes" type="CARD8" /> - <field name="firstKeySym" type="KEYCODE" /> - <field name="totalSyms" type="CARD16" /> - <field name="nKeySyms" type="CARD8" /> - <field name="firstKeyAction" type="KEYCODE" /> - <field name="totalActions" type="CARD16" /> - <field name="nKeyActions" type="CARD8" /> - <field name="firstKeyBehavior" type="KEYCODE" /> - <field name="nKeyBehaviors" type="CARD8" /> - <field name="totalKeyBehaviors" type="CARD8" /> - <field name="firstKeyExplicit" type="KEYCODE" /> - <field name="nKeyExplicit" type="CARD8" /> - <field name="totalKeyExplicit" type="CARD8" /> - <field name="firstModMapKey" type="KEYCODE" /> - <field name="nModMapKeys" type="CARD8" /> - <field name="totalModMapKeys" type="CARD8" /> - <field name="firstVModMapKey" type="KEYCODE" /> - <field name="nVModMapKeys" type="CARD8" /> - <field name="totalVModMapKeys" type="CARD8" /> - <pad bytes="1" /> - <field name="virtualMods" type="CARD16" mask="VMod" /> - <switch name="map"> - <fieldref>present</fieldref> - <bitcase> - <enumref ref="MapPart">KeyTypes</enumref> - <list name="types_rtrn" type="KeyType"> - <fieldref>nTypes</fieldref> - </list> - </bitcase> - <bitcase> - <enumref ref="MapPart">KeySyms</enumref> - <list name="syms_rtrn" type="KeySymMap"> - <fieldref>nKeySyms</fieldref> - </list> - </bitcase> - <bitcase> - <enumref ref="MapPart">KeyActions</enumref> - <list name="acts_rtrn_count" type="CARD8"> - <fieldref>nKeyActions</fieldref> - </list> - <list name="acts_rtrn_acts" type="Action"> - <fieldref>totalActions</fieldref> - </list> - </bitcase> - <bitcase> - <enumref ref="MapPart">KeyBehaviors</enumref> - <list name="behaviors_rtrn" type="SetBehavior"> - <fieldref>totalKeyBehaviors</fieldref> - </list> - </bitcase> - <bitcase> - <enumref ref="MapPart">VirtualMods</enumref> - <list name="vmods_rtrn" type="CARD8" mask="ModMask"> - <fieldref>nVModMapKeys</fieldref> - </list> - </bitcase> - <bitcase> - <enumref ref="MapPart">ExplicitComponents</enumref> - <list name="explicit_rtrn" type="SetExplicit"> - <fieldref>totalKeyExplicit</fieldref> - </list> - </bitcase> - <bitcase> - <enumref ref="MapPart">ModifierMap</enumref> - <list name="modmap_rtrn" type="KeyModMap"> - <fieldref>totalModMapKeys</fieldref> - </list> - </bitcase> - <bitcase> - <enumref ref="MapPart">VirtualModMap</enumref> - <list name="vmodmap_rtrn" type="KeyVModMap"> - <fieldref>totalVModMapKeys</fieldref> - </list> - </bitcase> - </switch> - </bitcase> - <bitcase name="server_symbols"> - <enumref ref="GBNDetail">ServerSymbols</enumref> - <field name="serverDeviceID" type="CARD8" /> - <pad bytes="2" /> - <field name="serverMinKeyCode" type="KEYCODE" /> - <field name="serverMaxKeyCode" type="KEYCODE" /> - <field name="present" type="CARD16" enum="MapPart" /> - <field name="firstType" type="CARD8" /> - <field name="nTypes" type="CARD8" /> - <field name="totalTypes" type="CARD8" /> - <field name="firstKeySym" type="KEYCODE" /> - <field name="totalSyms" type="CARD16" /> - <field name="nKeySyms" type="CARD8" /> - <field name="firstKeyAction" type="KEYCODE" /> - <field name="totalActions" type="CARD16" /> - <field name="nKeyActions" type="CARD8" /> - <field name="firstKeyBehavior" type="KEYCODE" /> - <field name="nKeyBehaviors" type="CARD8" /> - <field name="totalKeyBehaviors" type="CARD8" /> - <field name="firstKeyExplicit" type="KEYCODE" /> - <field name="nKeyExplicit" type="CARD8" /> - <field name="totalKeyExplicit" type="CARD8" /> - <field name="firstModMapKey" type="KEYCODE" /> - <field name="nModMapKeys" type="CARD8" /> - <field name="totalModMapKeys" type="CARD8" /> - <field name="firstVModMapKey" type="KEYCODE" /> - <field name="nVModMapKeys" type="CARD8" /> - <field name="totalVModMapKeys" type="CARD8" /> - <pad bytes="1" /> - <field name="virtualMods" type="CARD16" mask="VMod" /> - <switch name="map"> - <fieldref>present</fieldref> - <bitcase> - <enumref ref="MapPart">KeyTypes</enumref> - <list name="types_rtrn" type="KeyType"> - <fieldref>nTypes</fieldref> - </list> - </bitcase> - <bitcase> - <enumref ref="MapPart">KeySyms</enumref> - <list name="syms_rtrn" type="KeySymMap"> - <fieldref>nKeySyms</fieldref> - </list> - </bitcase> - <bitcase> - <enumref ref="MapPart">KeyActions</enumref> - <list name="acts_rtrn_count" type="CARD8"> - <fieldref>nKeyActions</fieldref> - </list> - <list name="acts_rtrn_acts" type="Action"> - <fieldref>totalActions</fieldref> - </list> - </bitcase> - <bitcase> - <enumref ref="MapPart">KeyBehaviors</enumref> - <list name="behaviors_rtrn" type="SetBehavior"> - <fieldref>totalKeyBehaviors</fieldref> - </list> - </bitcase> - <bitcase> - <enumref ref="MapPart">VirtualMods</enumref> - <list name="vmods_rtrn" type="CARD8" mask="ModMask"> - <fieldref>nVModMapKeys</fieldref> - </list> - </bitcase> - <bitcase> - <enumref ref="MapPart">ExplicitComponents</enumref> - <list name="explicit_rtrn" type="SetExplicit"> - <fieldref>totalKeyExplicit</fieldref> - </list> - </bitcase> - <bitcase> - <enumref ref="MapPart">ModifierMap</enumref> - <list name="modmap_rtrn" type="KeyModMap"> - <fieldref>totalModMapKeys</fieldref> - </list> - </bitcase> - <bitcase> - <enumref ref="MapPart">VirtualModMap</enumref> - <list name="vmodmap_rtrn" type="KeyVModMap"> - <fieldref>totalVModMapKeys</fieldref> - </list> - </bitcase> - </switch> - </bitcase> <bitcase name="indicator_maps"> <enumref ref="GBNDetail">IndicatorMaps</enumref> + <!-- from the spec, this has to include a reply header --> + <field name="indicatormap_type" type="CARD8" /> <field name="indicatorDeviceID" type="CARD8" /> + <field name="indicatormap_sequence" type="CARD16" /> + <field name="indicatormap_length" type="CARD32" /> + <!-- done 'emulating' reply header --> <field name="which" type="CARD32" /> <field name="realIndicators" type="CARD32" /> <field name="nIndicators" type="CARD8" /> @@ -2278,7 +2137,13 @@ authorization from the authors. </bitcase> <bitcase name="key_names"> <enumref ref="GBNDetail">KeyNames</enumref> + <enumref ref="GBNDetail">OtherNames</enumref> + <!-- from the spec, this has to include a reply header --> + <field name="keyname_type" type="CARD8" /> <field name="keyDeviceID" type="CARD8" /> + <field name="keyname_sequence" type="CARD16" /> + <field name="keyname_length" type="CARD32" /> + <!-- done 'emulating' reply header --> <field name="which" type="CARD32" mask="NameDetail" /> <field name="keyMinKeyCode" type="KEYCODE" /> <field name="keyMaxKeyCode" type="KEYCODE" /> @@ -2377,110 +2242,14 @@ authorization from the authors. </bitcase> </switch> </bitcase> - <bitcase name="other_names"> - <enumref ref="GBNDetail">OtherNames</enumref> - <field name="otherDeviceID" type="CARD8" /> - <field name="which" type="CARD32" mask="NameDetail" /> - <field name="otherMinKeyCode" type="KEYCODE" /> - <field name="otherMaxKeyCode" type="KEYCODE" /> - <field name="nTypes" type="CARD8" /> - <field name="groupNames" type="CARD8" mask="SetOfGroup" /> - <field name="virtualMods" type="CARD16" mask="VMod" /> - <field name="firstKey" type="KEYCODE" /> - <field name="nKeys" type="CARD8" /> - <field name="indicators" type="CARD32" /> - <field name="nRadioGroups" type="CARD8" /> - <field name="nKeyAliases" type="CARD8" /> - <field name="nKTLevels" type="CARD16" /> - <pad bytes="4" /> - <switch name="valueList"> - <fieldref>which</fieldref> - <bitcase> - <enumref ref="NameDetail">Keycodes</enumref> - <field name="keycodesName" type="ATOM" /> - </bitcase> - <bitcase> - <enumref ref="NameDetail">Geometry</enumref> - <field name="geometryName" type="ATOM" /> - </bitcase> - <bitcase> - <enumref ref="NameDetail">Symbols</enumref> - <field name="symbolsName" type="ATOM" /> - </bitcase> - <bitcase> - <enumref ref="NameDetail">PhysSymbols</enumref> - <field name="physSymbolsName" type="ATOM" /> - </bitcase> - <bitcase> - <enumref ref="NameDetail">Types</enumref> - <field name="typesName" type="ATOM" /> - </bitcase> - <bitcase> - <enumref ref="NameDetail">Compat</enumref> - <field name="compatName" type="ATOM" /> - </bitcase> - <bitcase> - <enumref ref="NameDetail">KeyTypeNames</enumref> - <list name="typeNames" type="ATOM"> - <fieldref>nTypes</fieldref> - </list> - </bitcase> - <bitcase> - <enumref ref="NameDetail">KTLevelNames</enumref> - <list name="nLevelsPerType" type="CARD8"> - <fieldref>nKTLevels</fieldref> - </list> - <list name="ktLevelNames" type="ATOM"> - <sumof ref="nLevelsPerType" /> - </list> - </bitcase> - <bitcase> - <enumref ref="NameDetail">IndicatorNames</enumref> - <list name="indicatorNames" type="ATOM"> - <popcount> - <fieldref>indicators</fieldref> - </popcount> - </list> - </bitcase> - <bitcase> - <enumref ref="NameDetail">VirtualModNames</enumref> - <list name="virtualModNames" type="ATOM"> - <popcount> - <fieldref>virtualMods</fieldref> - </popcount> - </list> - </bitcase> - <bitcase> - <enumref ref="NameDetail">GroupNames</enumref> - <list name="groups" type="ATOM"> - <popcount> - <fieldref>groupNames</fieldref> - </popcount> - </list> - </bitcase> - <bitcase> - <enumref ref="NameDetail">KeyNames</enumref> - <list name="keyNames" type="KeyName"> - <fieldref>nKeys</fieldref> - </list> - </bitcase> - <bitcase> - <enumref ref="NameDetail">KeyAliases</enumref> - <list name="keyAliases" type="KeyAlias"> - <fieldref>nKeyAliases</fieldref> - </list> - </bitcase> - <bitcase> - <enumref ref="NameDetail">RGNames</enumref> - <list name="radioGroupNames" type="ATOM"> - <fieldref>nRadioGroups</fieldref> - </list> - </bitcase> - </switch> - </bitcase> <bitcase name="geometry"> <enumref ref="GBNDetail">Geometry</enumref> + <!-- from the spec, this has to include a reply header --> + <field name="geometry_type" type="CARD8" /> <field name="geometryDeviceID" type="CARD8" /> + <field name="geometry_sequence" type="CARD16" /> + <field name="geometry_length" type="CARD32" /> + <!-- done 'emulating' reply header --> <field name="name" type="ATOM" /> <field name="geometryFound" type="BOOL" /> <pad bytes="1" /> @@ -2593,9 +2362,8 @@ authorization from the authors. <!-- Events --> - <event name="NewKeyboardNotify" number="0" no-sequence-number="true"> + <event name="NewKeyboardNotify" number="0"> <field name="xkbType" type="CARD8" /> - <field name="sequence" type="CARD16" /> <field name="time" type="TIMESTAMP" /> <field name="deviceID" type="CARD8" /> <field name="oldDeviceID" type="CARD8" /> @@ -2609,9 +2377,8 @@ authorization from the authors. <pad bytes="14" /> </event> - <event name="MapNotify" number="1" no-sequence-number="true"> + <event name="MapNotify" number="1"> <field name="xkbType" type="CARD8" /> - <field name="sequence" type="CARD16" /> <field name="time" type="TIMESTAMP" /> <field name="deviceID" type="CARD8" /> <field name="ptrBtnActions" type="CARD8" /> @@ -2636,9 +2403,8 @@ authorization from the authors. <pad bytes="2" /> </event> - <event name="StateNotify" number="2" no-sequence-number="true"> + <event name="StateNotify" number="2"> <field name="xkbType" type="CARD8" /> - <field name="sequence" type="CARD16" /> <field name="time" type="TIMESTAMP" /> <field name="deviceID" type="CARD8" /> <field name="mods" type="CARD8" mask="ModMask" /> @@ -2662,9 +2428,8 @@ authorization from the authors. <field name="requestMinor" type="CARD8" /> </event> - <event name="ControlsNotify" number="3" no-sequence-number="true"> + <event name="ControlsNotify" number="3"> <field name="xkbType" type="CARD8" /> - <field name="sequence" type="CARD16" /> <field name="time" type="TIMESTAMP" /> <field name="deviceID" type="CARD8" /> <field name="numGroups" type="CARD8" /> @@ -2679,9 +2444,8 @@ authorization from the authors. <pad bytes="4" /> </event> - <event name="IndicatorStateNotify" number="4" no-sequence-number="true"> + <event name="IndicatorStateNotify" number="4"> <field name="xkbType" type="CARD8" /> - <field name="sequence" type="CARD16" /> <field name="time" type="TIMESTAMP" /> <field name="deviceID" type="CARD8" /> <pad bytes="3" /> @@ -2690,9 +2454,8 @@ authorization from the authors. <pad bytes="12" /> </event> - <event name="IndicatorMapNotify" number="5" no-sequence-number="true"> + <event name="IndicatorMapNotify" number="5"> <field name="xkbType" type="CARD8" /> - <field name="sequence" type="CARD16" /> <field name="time" type="TIMESTAMP" /> <field name="deviceID" type="CARD8" /> <pad bytes="3" /> @@ -2701,9 +2464,8 @@ authorization from the authors. <pad bytes="12" /> </event> - <event name="NamesNotify" number="6" no-sequence-number="true"> + <event name="NamesNotify" number="6"> <field name="xkbType" type="CARD8" /> - <field name="sequence" type="CARD16" /> <field name="time" type="TIMESTAMP" /> <field name="deviceID" type="CARD8" /> <pad bytes="1" /> @@ -2723,9 +2485,8 @@ authorization from the authors. <pad bytes="4" /> </event> - <event name="CompatMapNotify" number="7" no-sequence-number="true"> + <event name="CompatMapNotify" number="7"> <field name="xkbType" type="CARD8" /> - <field name="sequence" type="CARD16" /> <field name="time" type="TIMESTAMP" /> <field name="deviceID" type="CARD8" /> <field name="changedGroups" type="CARD8" mask="SetOfGroup" /> @@ -2735,9 +2496,8 @@ authorization from the authors. <pad bytes="16" /> </event> - <event name="BellNotify" number="8" no-sequence-number="true"> + <event name="BellNotify" number="8"> <field name="xkbType" type="CARD8" /> - <field name="sequence" type="CARD16" /> <field name="time" type="TIMESTAMP" /> <field name="deviceID" type="CARD8" /> <field name="bellClass" type="CARD8" enum="BellClassResult" /> @@ -2751,9 +2511,8 @@ authorization from the authors. <pad bytes="7" /> </event> - <event name="ActionMessage" number="9" no-sequence-number="true"> + <event name="ActionMessage" number="9"> <field name="xkbType" type="CARD8" /> - <field name="sequence" type="CARD16" /> <field name="time" type="TIMESTAMP" /> <field name="deviceID" type="CARD8" /> <field name="keycode" type="KEYCODE" /> @@ -2767,9 +2526,8 @@ authorization from the authors. <pad bytes="10" /> </event> - <event name="AccessXNotify" number="10" no-sequence-number="true"> + <event name="AccessXNotify" number="10"> <field name="xkbType" type="CARD8" /> - <field name="sequence" type="CARD16" /> <field name="time" type="TIMESTAMP" /> <field name="deviceID" type="CARD8" /> <field name="keycode" type="KEYCODE" /> @@ -2779,9 +2537,8 @@ authorization from the authors. <pad bytes="16" /> </event> - <event name="ExtensionDeviceNotify" number="11" no-sequence-number="true"> + <event name="ExtensionDeviceNotify" number="11"> <field name="xkbType" type="CARD8" /> - <field name="sequence" type="CARD16" /> <field name="time" type="TIMESTAMP" /> <field name="deviceID" type="CARD8" /> <pad bytes="1" /> diff --git a/libxcb/xcb-proto/xcbgen/xtypes.py b/libxcb/xcb-proto/xcbgen/xtypes.py index f6d463445..5469cd961 100644 --- a/libxcb/xcb-proto/xcbgen/xtypes.py +++ b/libxcb/xcb-proto/xcbgen/xtypes.py @@ -481,8 +481,14 @@ class BitcaseType(ComplexType): ''' def __init__(self, index, name, elt, *parent): elts = list(elt) - self.expr = Expression(elts[0] if len(elts) else elt, self) - ComplexType.__init__(self, name, elts[1:]) + self.expr = [] + fields = [] + for elt in elts: + if elt.tag == 'enumref': + self.expr.append(Expression(elt, self)) + else: + fields.append(elt) + ComplexType.__init__(self, name, fields) self.has_name = True self.index = 1 self.lenfield_parent = list(parent) + [self] @@ -510,8 +516,9 @@ class BitcaseType(ComplexType): def resolve(self, module): if self.resolved: return - - self.expr.resolve(module, self.parents+[self]) + + for e in self.expr: + e.resolve(module, self.parents+[self]) # Resolve the bitcase expression ComplexType.resolve(self, module) @@ -593,8 +600,7 @@ class Event(ComplexType): ComplexType.__init__(self, name, elt) self.opcodes = {} - tmp = elt.get('no-sequence-number') - self.has_seq = (tmp == None or tmp.lower() == 'false' or tmp == '0') + self.has_seq = not bool(elt.get('no-sequence-number')) self.doc = None for item in list(elt): |