Пример #1
0
class GetCrtcTransform(rq.ReplyRequest):
    _request = rq.Struct(
        rq.Card8('opcode'),
        rq.Opcode(27),
        rq.RequestLength(),
        rq.Card32('crtc'),
    )
    _reply = rq.Struct(
        rq.ReplyCode(),
        rq.Card8('status'),
        rq.Card16('sequence_number'),
        rq.ReplyLength(),
        rq.Object('pending_transform', Render_Transform),
        rq.Bool('has_transforms'),
        rq.Pad(3),
        rq.Object('current_transform', Render_Transform),
        rq.Pad(4),
        rq.LengthOf('pending_filter_name', 2),
        rq.LengthOf('pending_filter_params', 2),
        rq.LengthOf('current_filter_name', 2),
        rq.LengthOf('current_filter_params', 2),
        rq.String8('pending_filter_name'),
        rq.List(
            'pending_filter_params', rq.Card32Obj
        ),  #FIXME: The protocol says FIXED? http://cgit.freedesktop.org/xorg/proto/randrproto/tree/randrproto.txt#n2161
        rq.String8('current_filter_name'),
        rq.List(
            'current_filter_params', rq.Card32Obj
        ),  #FIXME: The protocol says FIXED? http://cgit.freedesktop.org/xorg/proto/randrproto/tree/randrproto.txt#n2161
    )
Пример #2
0
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.String8('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.String8('auth_data_return'))
Пример #3
0
class _GetOutputInfo(rq.ReplyRequest):
    _request = rq.Struct(
        rq.Card8('opcode'),
        rq.Opcode(9),
        rq.RequestLength(),
        rq.Card32('output'),
        rq.Card32('config_timestamp'),
        )
    _reply = rq.Struct(
        rq.ReplyCode(),
        rq.Card8('status'),
        rq.Card16('sequence_number'),
        rq.ReplyLength(),
        rq.Card32('timestamp'),
        rq.Card32('crtc'),
        rq.Card32('mm_width'),
        rq.Card32('mm_height'),
        rq.Card8('connection'),
        rq.Card8('subpixel_order'),
        rq.LengthOf('crtcs', 2),
        rq.LengthOf('modes', 2),
        rq.Card16('num_preferred'),
        rq.LengthOf('clones', 2),
        rq.LengthOf('name', 2),
        rq.List('crtcs', rq.Card32Obj),
        rq.List('modes', rq.Card32Obj),
        rq.List('clones', rq.Card32Obj),
        rq.String8('name'),
)
Пример #4
0
class AllocNamedColor(rq.ReplyRequest):
    _request = rq.Struct(
        rq.Opcode(85),
        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.Card32('pixel'),
        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(8),
        )
Пример #5
0
class OpenFont(rq.Request):
    _request = rq.Struct(
        rq.Opcode(45),
        rq.Pad(1),
        rq.RequestLength(),
        rq.Font('fid'),
        rq.LengthOf('name', 2),
        rq.Pad(2),
        rq.String8('name'),
        )
Пример #6
0
class ImageText8(rq.Request):
    _request = rq.Struct(
        rq.Opcode(76),
        rq.LengthOf('string', 1),
        rq.RequestLength(),
        rq.Drawable('drawable'),
        rq.GC('gc'),
        rq.Int16('x'),
        rq.Int16('y'),
        rq.String8('string'),
        )
Пример #7
0
class StoreNamedColor(rq.Request):
    _request = rq.Struct(
        rq.Opcode(90),
        rq.Card8('flags'),
        rq.RequestLength(),
        rq.Colormap('cmap'),
        rq.Card32('pixel'),
        rq.LengthOf('name', 2),
        rq.Pad(2),
        rq.String8('name'),
        )
Пример #8
0
class SetPictureFilter(rq.Request):
    _request = rq.Struct(
        rq.Card8('opcode'),
        rq.Opcode(30),
        rq.RequestLength(),
        rq.Picture('picture'),
        rq.LengthOf('filter', 2),
        rq.Pad(2),
        rq.String8('filter'),
        rq.List('values', FixedObj),
    )
Пример #9
0
class AddGlyphs(rq.Request):
    _request = rq.Struct(
        rq.Card8('opcode'),
        rq.Opcode(20),
        rq.RequestLength(),
        rq.GlyphSet('glyphset'),
        rq.LengthOf(('glyphids', 'glyphs'), 4),
        rq.List('glyphids', rq.Card32),
        rq.List('glyphs', GlyphInfo),
        rq.String8('images'),
    )
Пример #10
0
class SetCrtcTransform(rq.Request):
    _request = rq.Struct(
        rq.Card8('opcode'),
        rq.Opcode(26),
        rq.RequestLength(),
        rq.Card32('crtc'),
        rq.Object('transform', Render_Transform),
        rq.LengthOf('filter_name', 2),
        rq.Pad(2),
        rq.String8('filter_name'),
        rq.List('filter_params', rq.Card32Obj), #FIXME: The protocol says FIXED? http://cgit.freedesktop.org/xorg/proto/randrproto/tree/randrproto.txt#n2161
        )
Пример #11
0
class GetAtomName(rq.ReplyRequest):
    _request = rq.Struct(rq.Opcode(17), rq.Pad(1), rq.RequestLength(),
                         rq.Card32('atom'))

    _reply = rq.Struct(
        rq.ReplyCode(),
        rq.Pad(1),
        rq.Card16('sequence_number'),
        rq.ReplyLength(),
        rq.LengthOf('name', 2),
        rq.Pad(22),
        rq.String8('name'),
    )
Пример #12
0
class PutImage(rq.Request):
    _request = rq.Struct(
        rq.Opcode(72),
        rq.Set('format', 1, (X.XYBitmap, X.XYPixmap, X.ZPixmap)),
        rq.RequestLength(),
        rq.Drawable('drawable'),
        rq.GC('gc'),
        rq.Card16('width'),
        rq.Card16('height'),
        rq.Int16('dst_x'),
        rq.Int16('dst_y'),
        rq.Card8('left_pad'),
        rq.Card8('depth'),
        rq.Pad(2),
        rq.String8('data'),
        )
Пример #13
0
class _CreateMode(rq.ReplyRequest):
    _request = rq.Struct(
        rq.Card8('opcode'),
        rq.Opcode(16),
        rq.RequestLength(),
        rq.Window('window'),
        rq.Object('mode', randr.RandR_ModeInfo),
        rq.String8('name'),
        )
    _reply = rq.Struct(
        rq.ReplyCode(),
        rq.Pad(1),
        rq.Card16('sequence_number'),
        rq.ReplyLength(),
        rq.Card32('mode'),
        rq.Pad(20),
        )
Пример #14
0
class InternAtom(rq.ReplyRequest):
    _request = rq.Struct(
        rq.Opcode(16),
        rq.Bool('only_if_exists'),
        rq.RequestLength(),
        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.Card32('atom'),
        rq.Pad(20),
        )
Пример #15
0
class ListFonts(rq.ReplyRequest):
    _request = rq.Struct(
        rq.Opcode(49),
        rq.Pad(1),
        rq.RequestLength(),
        rq.Card16('max_names'),
        rq.LengthOf('pattern', 2),
        rq.String8('pattern'),
        )

    _reply = rq.Struct(
        rq.ReplyCode(),
        rq.Pad(1),
        rq.Card16('sequence_number'),
        rq.ReplyLength(),
        rq.LengthOf('fonts', 2),
        rq.Pad(22),
        rq.List('fonts', rq.Str),
        )
Пример #16
0
class QueryExtension(rq.ReplyRequest):
    _request = rq.Struct(
        rq.Opcode(98),
        rq.Pad(1),
        rq.RequestLength(),
        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.Card8('present'),
        rq.Card8('major_opcode'),
        rq.Card8('first_event'),
        rq.Card8('first_error'),
        rq.Pad(20),
        )
Пример #17
0
class GetImage(rq.ReplyRequest):
    _request = rq.Struct(
        rq.Opcode(73),
        rq.Set('format', 1, (X.XYPixmap, X.ZPixmap)),
        rq.RequestLength(),
        rq.Drawable('drawable'),
        rq.Int16('x'),
        rq.Int16('y'),
        rq.Card16('width'),
        rq.Card16('height'),
        rq.Card32('plane_mask'),
        )

    _reply = rq.Struct(
        rq.ReplyCode(),
        rq.Card8('depth'),
        rq.Card16('sequence_number'),
        rq.ReplyLength(),
        rq.Card32('visual'),
        rq.Pad(20),
        rq.String8('data'),
        )
Пример #18
0
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),
        )
Пример #19
0
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'),
    )
Пример #20
0
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)
Пример #21
0
))

_struct_test('fixed list pad', (
    ('lc8p', lambda name: rq.FixedList(name, 2, rq.Card8, pad=1), [0x42, 0xc3],
     lambda v: pack('2B2x', *v)),
    ('lc16p', lambda name: rq.FixedList(name, 3, rq.Card16, pad=1),
     [666, 1, 60143], lambda v: pack('3H2x', *v)),
    ('lc32p', lambda name: rq.FixedList(name, 5, rq.Card32, pad=1),
     [0xf02facb, 666, 1, 0x1043, 0xdeadbeef], lambda v: pack('5L', *v)),
))

_struct_test('string8', (
    (None, lambda name: rq.LengthOf('s1', 1), None, pack('B', 7)),
    (None, lambda name: rq.LengthOf('s2', 2), None, pack('H', 13)),
    (None, lambda name: rq.LengthOf('s3', 4), None, pack('L', 34)),
    ('s1', lambda name: rq.String8(name, pad=0), "testing", packstr),
    ('s2', lambda name: rq.String8(name, pad=0), "one two three", packstr),
    ('s3', lambda name: rq.String8(name, pad=0),
     "supercalifragilisticexpialidocious", packstr),
))

_struct_test('string8 pad', (
    (None, lambda name: rq.LengthOf('s1', 1), None, pack('B', 7)),
    (None, lambda name: rq.LengthOf('s2', 2), None, pack('H', 13)),
    (None, lambda name: rq.LengthOf('s3', 4), None, pack('L', 34)),
    ('s1', lambda name: rq.String8(name, pad=1), "testing",
     partial(packstr, padding=1)),
    ('s2', lambda name: rq.String8(name, pad=1), "one two three",
     partial(packstr, padding=3)),
    ('s3', lambda name: rq.String8(name, pad=1),
     "supercalifragilisticexpialidocious", partial(packstr, padding=2)),
Пример #22
0
        class_data, _ = class_struct.parse_binary(data, display)
        data = data[length * 4:]
        return class_data, data


ClassInfo = ClassInfoClass()

DeviceInfo = rq.Struct(
    DEVICEID('deviceid'),
    rq.Card16('use'),
    rq.Card16('attachment'),
    rq.LengthOf('classes', 2),
    rq.LengthOf('name', 2),
    rq.Bool('enabled'),
    rq.Pad(1),
    rq.String8('name', 4),
    rq.List('classes', ClassInfo),
)


class XIQueryDevice(rq.ReplyRequest):
    _request = rq.Struct(
        rq.Card8('opcode'),
        rq.Opcode(48),
        rq.RequestLength(),
        DEVICEID('deviceid'),
        rq.Pad(2),
    )

    _reply = rq.Struct(
        rq.ReplyCode(),