class SecurityGenerateAuthorization(rq.ReplyRequest): # The order of fields here does not match the specifications I've seen # online, but it *does* match with the X.org implementation. I guess the # spec is out-of-date. _request = rq.Struct(rq.Card8('opcode'), rq.Opcode(1), rq.RequestLength(), rq.LengthOf('auth_proto', 2), rq.LengthOf('auth_data', 2), rq.Card32('value_mask'), rq.String8('auth_proto'), rq.Binary('auth_data'), rq.List('values', rq.Card32Obj) ) _reply = rq.Struct(rq.ReplyCode(), rq.Pad(1), rq.Card16('sequence_number'), rq.ReplyLength(), AUTHID('authid'), rq.LengthOf('auth_data_return', 2), rq.Pad(18), rq.Binary('auth_data_return') )
class QueryTextExtents(rq.ReplyRequest): _request = rq.Struct( rq.Opcode(48), rq.OddLength('string'), rq.RequestLength(), rq.Fontable('font'), rq.String16('string'), ) _reply = rq.Struct( rq.ReplyCode(), rq.Card8('draw_direction'), rq.Card16('sequence_number'), rq.ReplyLength(), rq.Int16('font_ascent'), rq.Int16('font_descent'), rq.Int16('overall_ascent'), rq.Int16('overall_descent'), rq.Int32('overall_width'), rq.Int32('overall_left'), rq.Int32('overall_right'), rq.Pad(4), )
class GetProperty(rq.ReplyRequest): _request = rq.Struct( rq.Opcode(20), rq.Bool('delete'), rq.RequestLength(), rq.Window('window'), rq.Card32('property'), rq.Card32('type'), rq.Card32('long_offset'), rq.Card32('long_length'), ) _reply = rq.Struct( rq.ReplyCode(), rq.Format('value', 1), rq.Card16('sequence_number'), rq.ReplyLength(), rq.Card32('property_type'), rq.Card32('bytes_after'), rq.LengthOf('value', 4), rq.Pad(12), rq.PropertyData('value'), )
class SetCrtcConfig(rq.ReplyRequest): _request = rq.Struct( rq.Card8('opcode'), rq.Opcode(21), rq.RequestLength(), rq.Card32('crtc'), rq.Card32('timestamp'), rq.Card32('config_timestamp'), rq.Int16('x'), rq.Int16('y'), rq.Card32('mode'), rq.Card16('rotation'), rq.Pad(2), rq.List('outputs', rq.Card32Obj), ) _reply = rq.Struct( rq.ReplyCode(), rq.Card8('status'), rq.Card16('sequence_number'), rq.ReplyLength(), rq.Card32('new_timestamp'), rq.Pad(20), )
class GetCrtcInfo(rq.ReplyRequest): _request = rq.Struct( rq.Card8('opcode'), rq.Opcode(20), rq.RequestLength(), rq.Card32('crtc'), rq.Card32('config_timestamp'), ) _reply = rq.Struct( rq.ReplyCode(), rq.Card8('status'), rq.Card16('sequence_number'), rq.ReplyLength(), rq.Card32('timestamp'), rq.Card16('width'), rq.Card16('height'), rq.Card32('mode'), rq.Card16('rotation'), rq.Card16('possible_rotations'), rq.LengthOf('outputs', 2), rq.LengthOf('possible_outputs', 2), rq.List('outputs', rq.Card32Obj), rq.List('possible_outputs', rq.Card32Obj), )
class SetScreenConfig(rq.ReplyRequest): _request = rq.Struct( rq.Card8('opcode'), rq.Opcode(2), rq.RequestLength(), rq.Drawable('drawable'), rq.Card32('timestamp'), rq.Card32('config_timestamp'), rq.Card16('size_id'), rq.Card16('rotation'), rq.Card16('rate'), # added in version 1.1 rq.Pad(2), ) _reply = rq.Struct( rq.ReplyCode(), rq.Card8('status'), rq.Card16('sequence_number'), rq.ReplyLength(), rq.Card32('new_timestamp'), rq.Card32('new_config_timestamp'), rq.Window('root'), rq.Card16('subpixel_order'), rq.Pad(10), )
class GetScreenResourcesCurrent(rq.ReplyRequest): _request = rq.Struct( rq.Card8('opcode'), rq.Opcode(25), rq.RequestLength(), rq.Window('window'), ) _reply = rq.Struct( rq.ReplyCode(), rq.Pad(1), rq.Card16('sequence_number'), rq.ReplyLength(), rq.Card32('timestamp'), rq.Card32('config_timestamp'), rq.LengthOf('crtcs', 2), rq.LengthOf('outputs', 2), rq.LengthOf('modes', 2), rq.LengthOf('names', 2), rq.Pad(8), rq.List('crtcs', rq.Card32Obj), rq.List('outputs', rq.Card32Obj), rq.List('modes', RandR_ModeInfo), rq.String8('names'), )
class GetScreenInfo(rq.ReplyRequest): _request = rq.Struct( rq.Card8('opcode'), rq.Opcode(5), rq.RequestLength(), rq.Window('window'), ) _reply = rq.Struct( rq.ReplyCode(), rq.Card8('set_of_rotations'), rq.Card16('sequence_number'), rq.ReplyLength(), rq.Window('root'), rq.Card32('timestamp'), rq.Card32('config_timestamp'), rq.LengthOf('sizes', 2), rq.Card16('size_id'), rq.Card16('rotation'), rq.Card16('rate'), # added in version 1.1 rq.Card16('n_rate_ents'), # XCB's protocol description disagrees with the X headers on this; ignoring. rq.Pad(2), rq.List('sizes', RandR_ScreenSizes), #rq.List('rates', RandR_Rates) #FIXME: Why does uncommenting this cause an error? )
class AllocColor(rq.ReplyRequest): _request = rq.Struct( rq.Opcode(84), rq.Pad(1), rq.RequestLength(), rq.Colormap('cmap'), rq.Card16('red'), rq.Card16('green'), rq.Card16('blue'), rq.Pad(2), ) _reply = rq.Struct( rq.ReplyCode(), rq.Pad(1), rq.Card16('sequence_number'), rq.ReplyLength(), rq.Card16('red'), rq.Card16('green'), rq.Card16('blue'), rq.Pad(2), rq.Card32('pixel'), rq.Pad(12), )
class LookupColor(rq.ReplyRequest): _request = rq.Struct( rq.Opcode(92), rq.Pad(1), rq.RequestLength(), rq.Colormap('cmap'), rq.LengthOf('name', 2), rq.Pad(2), rq.String8('name'), ) _reply = rq.Struct( rq.ReplyCode(), rq.Pad(1), rq.Card16('sequence_number'), rq.ReplyLength(), rq.Card16('exact_red'), rq.Card16('exact_green'), rq.Card16('exact_blue'), rq.Card16('screen_red'), rq.Card16('screen_green'), rq.Card16('screen_blue'), rq.Pad(12), )
class SecurityRevokeAuthorization(rq.Request): _request = rq.Struct(rq.Card8('opcode'), rq.Opcode(2), rq.RequestLength(), AUTHID('authid'))
class FreeContext(rq.Request): _request = rq.Struct(rq.Card8('opcode'), rq.Opcode(7), rq.RequestLength(), rq.Card32('context')) # Record_RC
class GrabControl(rq.Request): _request = rq.Struct(rq.Card8('opcode'), rq.Opcode(3), rq.RequestLength(), rq.Bool('impervious'), rq.Pad(3))
class FreeGC(rq.Request): _request = rq.Struct(rq.Opcode(60), rq.Pad(1), rq.RequestLength(), rq.GC('gc'))
class ForceScreenSaver(rq.Request): _request = rq.Struct( rq.Opcode(115), rq.Set('mode', 1, (X.ScreenSaverReset, X.ScreenSaverActive)), rq.RequestLength(), )
class SetAccessControl(rq.Request): _request = rq.Struct( rq.Opcode(111), rq.Set('mode', 1, (X.DisableAccess, X.EnableAccess)), rq.RequestLength(), )
class DPMSDisable(rq.Request): _request = rq.Struct( rq.Card8('opcode'), rq.Opcode(5), rq.RequestLength(), )
class DPMSSetTimeouts(rq.Request): _request = rq.Struct(rq.Card8('opcode'), rq.Opcode(3), rq.RequestLength(), rq.Card16('standby_timeout'), rq.Card16('suspend_timeout'), rq.Card16('off_timeout'), rq.Pad(2))
class QueryClients(rq.ReplyRequest): _request = rq.Struct(rq.Card8("opcode"), rq.Opcode(ResQueryClients), rq.RequestLength()) _reply = rq.Struct(rq.ReplyCode(), rq.Pad(1), rq.Card16("sequence_number"), rq.ReplyLength(), rq.LengthOf("clients", 4), rq.Pad(20), rq.List("clients", Client))
class SelectSelectionInput(rq.Request): _request = rq.Struct(rq.Card8('opcode'), rq.Opcode(2), rq.RequestLength(), rq.Window('window'), rq.Card32('selection'), rq.Card32('mask'))
class ShowCursor(rq.Request): _request = rq.Struct(rq.Card8('opcode'), rq.Opcode(30), rq.RequestLength(), rq.Window('window'))
class UngrabKeyboard(rq.Request): _request = rq.Struct(rq.Opcode(32), rq.Pad(1), rq.RequestLength(), rq.Card32('time'))
class Bell(rq.Request): _request = rq.Struct( rq.Opcode(104), rq.Int8('percent'), rq.RequestLength(), )
class UngrabServer(rq.Request): _request = rq.Struct( rq.Opcode(37), rq.Pad(1), rq.RequestLength(), )
class SetCloseDownMode(rq.Request): _request = rq.Struct( rq.Opcode(112), rq.Set('mode', 1, (X.DestroyAll, X.RetainPermanent, X.RetainTemporary)), rq.RequestLength(), )
class FreePixmap(rq.Request): _request = rq.Struct(rq.Opcode(54), rq.Pad(1), rq.RequestLength(), rq.Pixmap('pixmap'))
class NoOperation(rq.Request): _request = rq.Struct( rq.Opcode(127), rq.Pad(1), rq.RequestLength(), )
class DestroySubWindows(rq.Request): _request = rq.Struct(rq.Opcode(5), rq.Pad(1), rq.RequestLength(), rq.Window('window'))
class ListFontsWithInfo(rq.ReplyRequest): _request = rq.Struct( rq.Opcode(50), rq.Pad(1), rq.RequestLength(), rq.Card16('max_names'), rq.LengthOf('pattern', 2), rq.String8('pattern'), ) _reply = rq.Struct( rq.ReplyCode(), rq.LengthOf('name', 1), rq.Card16('sequence_number'), rq.ReplyLength(), rq.Object('min_bounds', structs.CharInfo), rq.Pad(4), rq.Object('max_bounds', structs.CharInfo), rq.Pad(4), rq.Card16('min_char_or_byte2'), rq.Card16('max_char_or_byte2'), rq.Card16('default_char'), rq.LengthOf('properties', 2), rq.Card8('draw_direction'), rq.Card8('min_byte1'), rq.Card8('max_byte1'), rq.Card8('all_chars_exist'), rq.Int16('font_ascent'), rq.Int16('font_descent'), rq.Card32('replies_hint'), rq.List('properties', structs.FontProp), rq.String8('name'), ) # Somebody must have smoked some really wicked weed when they # defined the ListFontsWithInfo request: # The server sends a reply for _each_ matching font... # It then sends a special reply (name length == 0) to indicate # that there are no more fonts in the reply. # This means that we have to do some special parsing to see if # we have got the end-of-reply reply. If we haven't, we # have to reinsert the request in the front of the # display.sent_request queue to catch the next response. # Bastards. def __init__(self, *args, **keys): self._fonts = [] ReplyRequest.__init__(*(self, ) + args, **keys) def _parse_response(self, data): if ord(data[1]) == 0: self._response_lock.acquire() self._data = self._fonts del self._fonts self._response_lock.release() return r, d = self._reply.parse_binary(data) self._fonts.append(r) self._display.sent_requests.insert(0, self) # Override the default __getattr__, since it isn't usable for # the list reply. Instead provide a __getitem__ and a __len__. def __getattr__(self, attr): raise AttributeError(attr) def __getitem__(self, item): return self._data[item] def __len__(self): return len(self._data)
class CloseFont(rq.Request): _request = rq.Struct(rq.Opcode(46), rq.Pad(1), rq.RequestLength(), rq.Font('font'))