self.data_recv = self.data_recv[8:]

                # Loop around to see if we have got the additional data
                # already

PixmapFormat = rq.Struct(rq.Card8('depth'), rq.Card8('bits_per_pixel'),
                         rq.Card8('scanline_pad'), rq.Pad(5))

VisualType = rq.Struct(rq.Card32('visual_id'), rq.Card8('visual_class'),
                       rq.Card8('bits_per_rgb_value'),
                       rq.Card16('colormap_entries'), rq.Card32('red_mask'),
                       rq.Card32('green_mask'), rq.Card32('blue_mask'),
                       rq.Pad(4))

Depth = rq.Struct(rq.Card8('depth'), rq.Pad(1), rq.LengthOf('visuals', 2),
                  rq.Pad(4), rq.List('visuals', VisualType))

Screen = rq.Struct(rq.Window('root'), rq.Colormap('default_colormap'),
                   rq.Card32('white_pixel'), rq.Card32('black_pixel'),
                   rq.Card32('current_input_mask'),
                   rq.Card16('width_in_pixels'), rq.Card16('height_in_pixels'),
                   rq.Card16('width_in_mms'), rq.Card16('height_in_mms'),
                   rq.Card16('min_installed_maps'),
                   rq.Card16('max_installed_maps'), rq.Card32('root_visual'),
                   rq.Card8('backing_store'), rq.Card8('save_unders'),
                   rq.Card8('root_depth'), rq.LengthOf('allowed_depths', 1),
                   rq.List('allowed_depths', Depth))


class ConnectionSetupRequest(rq.GetAttrData):
    _request = rq.Struct(rq.Set('byte_order', 1, (0x42, 0x6c)), rq.Pad(1),
Example #2
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 = []
        apply(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)
Example #3
0
        rq.Set('subwindow_mode', 1, (X.ClipByChildren, X.IncludeInferiors)),
        rq.Bool('graphics_exposures'), rq.Int16('clip_x_origin'),
        rq.Int16('clip_y_origin'), rq.Pixmap('clip_mask'),
        rq.Card16('dash_offset'), rq.Card8('dashes'),
        rq.Set('arc_mode', 1, (X.ArcChord, X.ArcPieSlice)))


TimeCoord = rq.Struct(
    rq.Card32('time'),
    rq.Int16('x'),
    rq.Int16('y'),
)

Host = rq.Struct(
    rq.Set('family', 1, (X.FamilyInternet, X.FamilyDECnet, X.FamilyChaos)),
    rq.Pad(1), rq.LengthOf('name', 2), rq.List('name', rq.Card8Obj))

CharInfo = rq.Struct(
    rq.Int16('left_side_bearing'),
    rq.Int16('right_side_bearing'),
    rq.Int16('character_width'),
    rq.Int16('ascent'),
    rq.Int16('descent'),
    rq.Card16('attributes'),
)

FontProp = rq.Struct(
    rq.Card32('name'),
    rq.Card32('value'),
)
Example #4
0
                         rq.Set('arc_mode', 1, (X.ArcChord, X.ArcPieSlice))
                         )



TimeCoord = rq.Struct(
    rq.Card32('time'),
    rq.Int16('x'),
    rq.Int16('y'),
    )

Host = rq.Struct(
    rq.Set('family', 1, (X.FamilyInternet, X.FamilyDECnet, X.FamilyChaos)),
    rq.Pad(1),
    rq.LengthOf('name', 2),
    rq.List('name', rq.Card8Obj)
    )

CharInfo = rq.Struct(
    rq.Int16('left_side_bearing'),
    rq.Int16('right_side_bearing'),
    rq.Int16('character_width'),
    rq.Int16('ascent'),
    rq.Int16('descent'),
    rq.Card16('attributes'),
    )

FontProp = rq.Struct(
    rq.Card32('name'),
    rq.Card32('value'),
    )