Beispiel #1
0
class DamageNotify(rq.Event):
    _code = None
    _fields = rq.Struct(rq.Card8('type'), rq.Card8('level'),
                        rq.Card16('sequence_number'), rq.Drawable('drawable'),
                        DAMAGE('damage'), rq.Card32('timestamp'),
                        rq.Object('area', structs.Rectangle),
                        rq.Object('drawable_geometry', structs.Rectangle))
Beispiel #2
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
    )
Beispiel #3
0
class QueryFont(rq.ReplyRequest):
    _request = rq.Struct(
        rq.Opcode(47),
        rq.Pad(1),
        rq.RequestLength(),
        rq.Fontable('font')
        )

    _reply = rq.Struct(
        rq.ReplyCode(),
        rq.Pad(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.LengthOf('char_infos', 4),
        rq.List('properties', structs.FontProp),
        rq.List('char_infos', structs.CharInfo),
        )
Beispiel #4
0
class CreateLinearGradient(rq.Request):
    _request = rq.Struct(
        rq.Card8('opcode'),
        rq.Opcode(34),
        rq.RequestLength(),
        rq.Picture('pid'),
        rq.Object('p1', PointFix),
        rq.Object('p2', PointFix),
        rq.LengthOf(('stops', 'stop_colors'), 4),
        rq.List('stops', FixedObj),
        rq.List('stop_colors', Color),
    )
Beispiel #5
0
class CreateRadialGradient(rq.Request):
    _request = rq.Struct(
        rq.Card8('opcode'),
        rq.Opcode(35),
        rq.RequestLength(),
        rq.Picture('pid'),
        rq.Object('inner_center', PointFix),
        rq.Object('outer_center', PointFix),
        Fixed('inner_radius'),
        Fixed('outer_radius'),
        rq.LengthOf(('stops', 'stop_colors'), 4),
        rq.List('stops', FixedObj),
        rq.List('stop_colors', Color),
    )
Beispiel #6
0
class CreateSolidFill(rq.Request):
    _request = rq.Struct(
        rq.Card8('opcode'),
        rq.Opcode(33),
        rq.RequestLength(),
        rq.Picture('pid'),
        rq.Object('color', Color),
    )
Beispiel #7
0
class SetPictureTransform(rq.Request):
    _request = rq.Struct(
        rq.Card8('opcode'),
        rq.Opcode(28),
        rq.RequestLength(),
        rq.Picture('picture'),
        rq.Object('transform', Transform),
    )
Beispiel #8
0
class FillRectangles(rq.Request):
    _request = rq.Struct(
        rq.Card8('opcode'),
        rq.Opcode(26),
        rq.RequestLength(),
        PictOp('op'),
        rq.Pad(3),
        rq.Picture('dst'),
        rq.Object('color', Color),
        rq.List('rects', structs.Rectangle),
    )
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
        )
Beispiel #10
0
class CreateConicalGradient(rq.Request):
    _request = rq.Struct(
        rq.Card8('opcode'),
        rq.Opcode(36),
        rq.RequestLength(),
        rq.Picture('pid'),
        rq.Object('center', PointFix),
        Fixed('angle'),
        rq.LengthOf(('stops', 'stop_colors'), 4),
        rq.List('stops', FixedObj),
        rq.List('stop_colors', Color),
    )
Beispiel #11
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),
        )
Beispiel #12
0
AllClients = 3

FromServer = 0
FromClient = 1
ClientStarted = 2
ClientDied = 3
StartOfData = 4
EndOfData = 5

Record_Range8 = rq.Struct(rq.Card8('first'), rq.Card8('last'))
Record_Range16 = rq.Struct(rq.Card16('first'), rq.Card16('last'))
Record_ExtRange = rq.Struct(rq.Card8('major_range_first'),
                            rq.Card8('major_range_last'),
                            rq.Card16('minor_range_first'),
                            rq.Card16('minor_range_last'))
Record_Range = rq.Struct(rq.Object('core_requests', Record_Range8),
                         rq.Object('core_replies', Record_Range8),
                         rq.Object('ext_requests', Record_ExtRange),
                         rq.Object('ext_replies', Record_ExtRange),
                         rq.Object('delivered_events', Record_Range8),
                         rq.Object('device_events', Record_Range8),
                         rq.Object('errors', Record_Range8),
                         rq.Bool('client_started'), rq.Bool('client_died'))

Record_ClientInfo = rq.Struct(rq.Card32('client_resource'),
                              rq.LengthOf('ranges', 4),
                              rq.List('ranges', Record_Range))


class RawField(rq.ValueField):
    """A field with raw data, stored as a string"""
Beispiel #13
0
FromServer = 0
FromClient = 1
ClientStarted = 2
ClientDied = 3
StartOfData = 4
EndOfData = 5

Record_Range8 = rq.Struct(
    rq.Card8('first'),
    rq.Card8('last'))
Record_Range16 = rq.Struct(
    rq.Card16('first'),
    rq.Card16('last'))
Record_ExtRange = rq.Struct(
    rq.Object('major_range', Record_Range8),
    rq.Object('minor_range', Record_Range16))
Record_Range = rq.Struct(
    rq.Object('core_requests', Record_Range8),
    rq.Object('core_replies', Record_Range8),
    rq.Object('ext_requests', Record_ExtRange),
    rq.Object('ext_replies', Record_ExtRange),
    rq.Object('delivered_events', Record_Range8),
    rq.Object('device_events', Record_Range8),
    rq.Object('errors', Record_Range8),
    rq.Bool('client_started'),
    rq.Bool('client_died'))

Record_ClientInfo = rq.Struct(
    rq.Card32('client_resource'),
    rq.LengthOf('ranges', 4),
Beispiel #14
0
#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

from Xlib import X, Xutil
from Xlib.protocol import rq

Aspect = rq.Struct( rq.Int32('num'), rq.Int32('denum') )

WMNormalHints = rq.Struct( rq.Card32('flags'),
                           rq.Pad(16),
                           rq.Int32('min_width', default = 0),
                           rq.Int32('min_height', default = 0),
                           rq.Int32('max_width', default = 0),
                           rq.Int32('max_height', default = 0),
                           rq.Int32('width_inc', default = 0),
                           rq.Int32('height_inc', default = 0),
                           rq.Object('min_aspect', Aspect, default = (0, 0)),
                           rq.Object('max_aspect', Aspect, default = (0, 0)),
                           rq.Int32('base_width', default = 0),
                           rq.Int32('base_height', default = 0),
                           rq.Int32('win_gravity', default = 0),
                           )

WMHints = rq.Struct( rq.Card32('flags'),
                     rq.Card32('input', default = 0),
                     rq.Set('initial_state', 4,
                            # withdrawn is totally bogus according to
                            # ICCCM, but some window managers seem to
                            # use this value to identify dockapps.
                            # Oh well.
                            ( Xutil.WithdrawnState,
                              Xutil.NormalState,
Beispiel #15
0
    may vary, e.g. List
    """
    def __init__(self, name, size, item_size):
        rq.LengthOf.__init__(self, name, size)
        self.item_size = item_size

    def parse_value(self, length, display):
        return length // self.item_size


ClientXIDMask = 1 << 0
LocalClientPIDMask = 1 << 1

ClientIdSpec = rq.Struct(rq.Card32("client"), rq.Card32("mask"))

ClientIdValue = rq.Struct(rq.Object("spec",
                                    ClientIdSpec), SizeOf("value", 4, 4),
                          rq.List("value", rq.Card32Obj))


class QueryClientIds(rq.ReplyRequest):
    _request = rq.Struct(rq.Card8("opcode"), rq.Opcode(ResQueryClientIds),
                         rq.RequestLength(), rq.LengthOf("specs", 4),
                         rq.List("specs", ClientIdSpec))
    _reply = rq.Struct(rq.ReplyCode(), rq.Pad(1), rq.Card16("sequence_number"),
                       rq.ReplyLength(), rq.LengthOf("ids", 4), rq.Pad(20),
                       rq.List("ids", ClientIdValue))


def query_client_ids(self, specs):
    """Request to identify a given set of clients with some identification method.
 def setUp(self):
     self.s1 = rq.Struct(Custom('a1'), Custom('a2'))
     self.s2 = rq.Struct(rq.Object('b1', self.s1), rq.Object('b2', self.s1))
     self.s3 = rq.Struct(rq.Object('c1', self.s2), rq.Object('c2', self.s2))
Beispiel #17
0
    DEVICEID('deviceid'),
    rq.Card32('time'),
    rq.Card32('detail'),
    rq.Window('root'),
    rq.Window('event'),
    rq.Window('child'),
    FP1616('root_x'),
    FP1616('root_y'),
    FP1616('event_x'),
    FP1616('event_y'),
    rq.LengthOf('buttons', 2),
    rq.Card16('valulators_len'),
    DEVICEID('sourceid'),
    rq.Pad(2),
    rq.Card32('flags'),
    rq.Object('mods', ModifierInfo),
    rq.Object('groups', GroupInfo),
    ButtonState('buttons'),
)

DeviceChangedEventData = rq.Struct(
    DEVICEID('deviceid'),
    rq.Card32('time'),
    rq.LengthOf('classes', 2),
    DEVICEID('sourceid'),
    rq.Card8('reason'),
    rq.Pad(11),
    rq.List('classes', ClassInfo),
)

Beispiel #18
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)
Beispiel #19
0
def Repeat(arg):
    return rq.Set(arg, 1, (RepeatNone, RepeatNormal, RepeatPad, RepeatReflect))


Color = rq.Struct(
    rq.Card16('red'),
    rq.Card16('green'),
    rq.Card16('blue'),
    rq.Card16('alpha'),
)
ChannelMask = rq.Struct(
    rq.Card16('shift'),
    rq.Card16('mask'),
)
DirectFormat = rq.Struct(
    rq.Object('red', ChannelMask),
    rq.Object('green', ChannelMask),
    rq.Object('blue', ChannelMask),
    rq.Object('alpha', ChannelMask),
)
IndexValue = rq.Struct(
    Pixel('pixel'),
    rq.Card16('red'),
    rq.Card16('green'),
    rq.Card16('blue'),
    rq.Card16('alpha'),
)
PictFormInfo = rq.Struct(
    PictFormat('id'),
    PictType('type'),
    rq.Card8('depth'),