Exemplo n.º 1
0
class ChangeHosts(rq.Request):
    _request = rq.Struct(
        rq.Opcode(109), rq.Set('mode', 1, (X.HostInsert, X.HostDelete)),
        rq.RequestLength(),
        rq.Set('host_family', 1,
               (X.FamilyInternet, X.FamilyDECnet, X.FamilyChaos)), rq.Pad(1),
        rq.LengthOf('host', 2), rq.List('host', rq.Card8Obj))
Exemplo n.º 2
0
class ChangeKeyboardControl(rq.Request):
    _request = rq.Struct(
        rq.Opcode(102), rq.Pad(1), rq.RequestLength(),
        rq.ValueList(
            'attrs', 4, 0, rq.Int8('key_click_percent'),
            rq.Int8('bell_percent'), rq.Int16('bell_pitch'),
            rq.Int16('bell_duration'), rq.Card8('led'),
            rq.Set('led_mode', 1,
                   (X.LedModeOff, X.LedModeOn)), rq.Card8('key'),
            rq.Set('auto_repeat_mode', 1,
                   (X.AutoRepeatModeOff, X.AutoRepeatModeOn,
                    X.AutoRepeatModeDefault))))
Exemplo n.º 3
0
class FillPoly(rq.Request):
    _request = rq.Struct(
        rq.Opcode(69),
        rq.Pad(1),
        rq.RequestLength(),
        rq.Drawable('drawable'),
        rq.GC('gc'),
        rq.Set('shape', 1, (X.Complex, X.Nonconvex, X.Convex)),
        rq.Set('coord_mode', 1, (X.CoordModeOrigin, X.CoordModePrevious)),
        rq.Pad(2),
        rq.List('points', structs.Point),
        )
Exemplo n.º 4
0
class GrabKey(rq.Request):
    _request = rq.Struct(
        rq.Opcode(33),
        rq.Bool('owner_events'),
        rq.RequestLength(),
        rq.Window('grab_window'),
        rq.Card16('modifiers'),
        rq.Card8('key'),
        rq.Set('pointer_mode', 1, (X.GrabModeSync, X.GrabModeAsync)),
        rq.Set('keyboard_mode', 1, (X.GrabModeSync, X.GrabModeAsync)),
        rq.Pad(3),
        )
Exemplo n.º 5
0
class SetScreenSaver(rq.Request):
    _request = rq.Struct(
        rq.Opcode(107),
        rq.Pad(1),
        rq.RequestLength(),
        rq.Int16('timeout'),
        rq.Int16('interval'),
        rq.Set('prefer_blank', 1,
               (X.DontPreferBlanking, X.PreferBlanking, X.DefaultBlanking)),
        rq.Set('allow_exposures', 1,
               (X.DontAllowExposures, X.AllowExposures, X.DefaultExposures)),
        rq.Pad(2),
    )
Exemplo n.º 6
0
def GCValues(arg):
    return rq.ValueList(
        arg, 4, 0,
        rq.Set('function', 1,
               (X.GXclear, X.GXand, X.GXandReverse, X.GXcopy, X.GXandInverted,
                X.GXnoop, X.GXxor, X.GXor, X.GXnor, X.GXequiv, X.GXinvert,
                X.GXorReverse, X.GXcopyInverted, X.GXorInverted, X.GXnand,
                X.GXset)), rq.Card32('plane_mask'), rq.Card32('foreground'),
        rq.Card32('background'), rq.Card16('line_width'),
        rq.Set('line_style', 1,
               (X.LineSolid, X.LineOnOffDash, X.LineDoubleDash)),
        rq.Set('cap_style', 1,
               (X.CapNotLast, X.CapButt, X.CapRound, X.CapProjecting)),
        rq.Set('join_style', 1, (X.JoinMiter, X.JoinRound, X.JoinBevel)),
        rq.Set(
            'fill_style', 1,
            (X.FillSolid, X.FillTiled, X.FillStippled, X.FillOpaqueStippled)),
        rq.Set('fill_rule', 1, (X.EvenOddRule, X.WindingRule)),
        rq.Pixmap('tile'), rq.Pixmap('stipple'),
        rq.Int16('tile_stipple_x_origin'), rq.Int16('tile_stipple_y_origin'),
        rq.Font('font'),
        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)))
Exemplo n.º 7
0
class GrabButton(rq.Request):
    _request = rq.Struct(
        rq.Opcode(28),
        rq.Bool('owner_events'),
        rq.RequestLength(),
        rq.Window('grab_window'),
        rq.Card16('event_mask'),
        rq.Set('pointer_mode', 1, (X.GrabModeSync, X.GrabModeAsync)),
        rq.Set('keyboard_mode', 1, (X.GrabModeSync, X.GrabModeAsync)),
        rq.Window('confine_to', (X.NONE, )),
        rq.Cursor('cursor', (X.NONE, )),
        rq.Card8('button'),
        rq.Pad(1),
        rq.Card16('modifiers'),
        )
Exemplo n.º 8
0
class CirculateWindow(rq.Request):
    _request = rq.Struct(
        rq.Opcode(13),
        rq.Set('direction', 1, (X.RaiseLowest, X.LowerHighest)),
        rq.RequestLength(),
        rq.Window('window'),
        )
Exemplo n.º 9
0
class ChangeSaveSet(rq.Request):
    _request = rq.Struct(
        rq.Opcode(6),
        rq.Set('mode', 1, (X.SetModeInsert, X.SetModeDelete)),
        rq.RequestLength(),
        rq.Window('window'),
        )
Exemplo n.º 10
0
class SetCloseDownMode(rq.Request):
    _request = rq.Struct(
        rq.Opcode(112),
        rq.Set('mode', 1,
               (X.DestroyAll, X.RetainPermanent, X.RetainTemporary)),
        rq.RequestLength(),
    )
Exemplo n.º 11
0
class CreateColormap(rq.Request):
    _request = rq.Struct(
        rq.Opcode(78),
        rq.Set('alloc', 1, (X.AllocNone, X.AllocAll)),
        rq.RequestLength(),
        rq.Colormap('mid'),
        rq.Window('window'),
        rq.Card32('visual'),
        )
Exemplo n.º 12
0
class SetInputFocus(rq.Request):
    _request = rq.Struct(
        rq.Opcode(42),
        rq.Set('revert_to', 1, (X.RevertToNone, X.RevertToPointerRoot,
                                X.RevertToParent)),
        rq.RequestLength(),
        rq.Window('focus'),
        rq.Card32('time'),
        )
Exemplo n.º 13
0
class PolyLine(rq.Request):
    _request = rq.Struct(
        rq.Opcode(65),
        rq.Set('coord_mode', 1, (X.CoordModeOrigin, X.CoordModePrevious)),
        rq.RequestLength(),
        rq.Drawable('drawable'),
        rq.GC('gc'),
        rq.List('points', structs.Point),
        )
Exemplo n.º 14
0
class ConfigureWindow(rq.Request):
    _request = rq.Struct(
        rq.Opcode(12), rq.Pad(1), rq.RequestLength(), rq.Window('window'),
        rq.ValueList(
            'attrs', 2, 2, rq.Int16('x'), rq.Int16('y'), rq.Card16('width'),
            rq.Card16('height'), rq.Int16('border_width'),
            rq.Window('sibling'),
            rq.Set('stack_mode', 1,
                   (X.Above, X.Below, X.TopIf, X.BottomIf, X.Opposite))))
Exemplo n.º 15
0
class AllowEvents(rq.Request):
    _request = rq.Struct(
        rq.Opcode(35),
        rq.Set(
            'mode', 1,
            (X.AsyncPointer, X.SyncPointer, X.ReplayPointer, X.AsyncKeyboard,
             X.SyncKeyboard, X.ReplayKeyboard, X.AsyncBoth, X.SyncBoth)),
        rq.RequestLength(),
        rq.Card32('time'),
    )
Exemplo n.º 16
0
class GrabKeyboard(rq.ReplyRequest):
    _request = rq.Struct(
        rq.Opcode(31),
        rq.Bool('owner_events'),
        rq.RequestLength(),
        rq.Window('grab_window'),
        rq.Card32('time'),
        rq.Set('pointer_mode', 1, (X.GrabModeSync, X.GrabModeAsync)),
        rq.Set('keyboard_mode', 1, (X.GrabModeSync, X.GrabModeAsync)),
        rq.Pad(2),
        )

    _reply = rq.Struct(
        rq.ReplyCode(),
        rq.Card8('status'),
        rq.Card16('sequence_number'),
        rq.ReplyLength(),
        rq.Pad(24),
        )
Exemplo n.º 17
0
class SetClipRectangles(rq.Request):
    _request = rq.Struct(
        rq.Opcode(59),
        rq.Set('ordering', 1, (X.Unsorted, X.YSorted, X.YXSorted, X.YXBanded)),
        rq.RequestLength(),
        rq.GC('gc'),
        rq.Int16('x_origin'),
        rq.Int16('y_origin'),
        rq.List('rectangles', structs.Rectangle),
        )
Exemplo n.º 18
0
class GrabPointer(rq.ReplyRequest):
    _request = rq.Struct(
        rq.Opcode(26),
        rq.Bool('owner_events'),
        rq.RequestLength(),
        rq.Window('grab_window'),
        rq.Card16('event_mask'),
        rq.Set('pointer_mode', 1, (X.GrabModeSync, X.GrabModeAsync)),
        rq.Set('keyboard_mode', 1, (X.GrabModeSync, X.GrabModeAsync)),
        rq.Window('confine_to', (X.NONE, )),
        rq.Cursor('cursor', (X.NONE, )),
        rq.Card32('time'),
        )

    _reply = rq.Struct(
        rq.ReplyCode(),
        rq.Card8('status'),
        rq.Card16('sequence_number'),
        rq.ReplyLength(),
        rq.Pad(24),
        )
Exemplo n.º 19
0
class ChangeProperty(rq.Request):
    _request = rq.Struct(
        rq.Opcode(18),
        rq.Set('mode', 1, (X.PropModeReplace, X.PropModePrepend, X.PropModeAppend)),
        rq.RequestLength(),
        rq.Window('window'),
        rq.Card32('property'),
        rq.Card32('type'),
        rq.Format('data', 1),
        rq.Pad(3),
        rq.LengthOf('data', 4),
        rq.PropertyData('data'),
        )
Exemplo n.º 20
0
class ConnectionSetupRequest(rq.GetAttrData):
    _request = rq.Struct(rq.Set('byte_order', 1, (0x42, 0x6c)), rq.Pad(1),
                         rq.Card16('protocol_major'),
                         rq.Card16('protocol_minor'),
                         rq.LengthOf('auth_prot_name', 2),
                         rq.LengthOf('auth_prot_data', 2), rq.Pad(2),
                         rq.String8('auth_prot_name'),
                         rq.String8('auth_prot_data'))

    _reply = rq.Struct(rq.Card8('status'), rq.Card8('reason_length'),
                       rq.Card16('protocol_major'),
                       rq.Card16('protocol_minor'),
                       rq.Card16('additional_length'))

    _success_reply = rq.Struct(
        rq.Card32('release_number'),
        rq.Card32('resource_id_base'),
        rq.Card32('resource_id_mask'),
        rq.Card32('motion_buffer_size'),
        rq.LengthOf('vendor', 2),
        rq.Card16('max_request_length'),
        rq.LengthOf('roots', 1),
        rq.LengthOf('pixmap_formats', 1),
        rq.Card8('image_byte_order'),
        rq.Card8('bitmap_format_bit_order'),
        rq.Card8('bitmap_format_scanline_unit'),
        rq.Card8('bitmap_format_scanline_pad'),
        rq.Card8('min_keycode'),
        rq.Card8('max_keycode'),
        rq.Pad(4),
        rq.String8('vendor'),
        rq.List('pixmap_formats', PixmapFormat),
        rq.List('roots', Screen),
    )

    def __init__(self, display, *args, **keys):
        self._binary = apply(self._request.to_binary, args, keys)
        self._data = None

        # Don't bother about locking, since no other threads have
        # access to the display yet

        display.request_queue.append((self, 1))

        # However, we must lock send_and_recv, but we don't have
        # to loop.

        display.send_recv_lock.acquire()
        display.send_and_recv(request=-1)
Exemplo n.º 21
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'),
        )
Exemplo n.º 22
0
class CreateWindow(rq.Request):
    _request = rq.Struct(
        rq.Opcode(1),
        rq.Card8('depth'),
        rq.RequestLength(),
        rq.Window('wid'),
        rq.Window('parent'),
        rq.Int16('x'),
        rq.Int16('y'),
        rq.Card16('width'),
        rq.Card16('height'),
        rq.Card16('border_width'),
        rq.Set('window_class', 2, (X.CopyFromParent, X.InputOutput, X.InputOnly)),
        rq.Card32('visual'),
        structs.WindowValues('attrs'),
        )
Exemplo n.º 23
0
def WindowValues(arg):
    return rq.ValueList( arg, 4, 0,
                         rq.Pixmap('background_pixmap'),
                         rq.Card32('background_pixel'),
                         rq.Pixmap('border_pixmap'),
                         rq.Card32('border_pixel'),
                         rq.Gravity('bit_gravity'),
                         rq.Gravity('win_gravity'),
                         rq.Set('backing_store', 1,
                                (X.NotUseful, X.WhenMapped, X.Always)),
                         rq.Card32('backing_planes'),
                         rq.Card32('backing_pixel'),
                         rq.Bool('override_redirect'),
                         rq.Bool('save_under'),
                         rq.Card32('event_mask'),
                         rq.Card32('do_not_propagate_mask'),
                         rq.Colormap('colormap'),
                         rq.Cursor('cursor'),
                         )
Exemplo n.º 24
0
class QueryBestSize(rq.ReplyRequest):
    _request = rq.Struct(
        rq.Opcode(97),
        rq.Set('item_class', 1, (X.CursorShape, X.TileShape, X.StippleShape)),
        rq.RequestLength(),
        rq.Drawable('drawable'),
        rq.Card16('width'),
        rq.Card16('height'),
        )

    _reply = rq.Struct(
        rq.ReplyCode(),
        rq.Pad(1),
        rq.Card16('sequence_number'),
        rq.ReplyLength(),
        rq.Card16('width'),
        rq.Card16('height'),
        rq.Pad(20),
        )
Exemplo n.º 25
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'),
        )
Exemplo n.º 26
0
class ForceScreenSaver(rq.Request):
    _request = rq.Struct(
        rq.Opcode(115),
        rq.Set('mode', 1, (X.ScreenSaverReset, X.ScreenSaverActive)),
        rq.RequestLength(),
        )
Exemplo n.º 27
0
        rq.Font('font'),
        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'),
)
Exemplo n.º 28
0
class SetAccessControl(rq.Request):
    _request = rq.Struct(
        rq.Opcode(111),
        rq.Set('mode', 1, (X.DisableAccess, X.EnableAccess)),
        rq.RequestLength(),
        )