Example #1
0
import xcffib
import struct
import six
MAJOR_VERSION = 1
MINOR_VERSION = 0
key = xcffib.ExtensionKey("XEVIE")
_events = {}
_errors = {}


class QueryVersionReply(xcffib.Reply):
    def __init__(self, unpacker):
        if isinstance(unpacker, xcffib.Protobj):
            unpacker = xcffib.MemoryUnpacker(unpacker.pack())
        xcffib.Reply.__init__(self, unpacker)
        base = unpacker.offset
        self.server_major_version, self.server_minor_version = unpacker.unpack(
            "xx2x4xHH20x")
        self.bufsize = unpacker.offset - base


class QueryVersionCookie(xcffib.Cookie):
    reply_type = QueryVersionReply


class StartReply(xcffib.Reply):
    def __init__(self, unpacker):
        if isinstance(unpacker, xcffib.Protobj):
            unpacker = xcffib.MemoryUnpacker(unpacker.pack())
        xcffib.Reply.__init__(self, unpacker)
        base = unpacker.offset
Example #2
0
import xcffib
import struct
import six

MAJOR_VERSION = 3
MINOR_VERSION = 1
key = xcffib.ExtensionKey("SYNC")
_events = {}
_errors = {}
from . import xproto


class ALARMSTATE:
    Active = 0
    Inactive = 1
    Destroyed = 2


class TESTTYPE:
    PositiveTransition = 0
    NegativeTransition = 1
    PositiveComparison = 2
    NegativeComparison = 3


class VALUETYPE:
    Absolute = 0
    Relative = 1


class CA:
Example #3
0
import xcffib
import struct
import six
MAJOR_VERSION = 5
MINOR_VERSION = 0
key = xcffib.ExtensionKey("XFIXES")
_events = {}
_errors = {}
from . import xproto
from . import render
from . import shape


class QueryVersionReply(xcffib.Reply):
    def __init__(self, unpacker):
        if isinstance(unpacker, xcffib.Protobj):
            unpacker = xcffib.MemoryUnpacker(unpacker.pack())
        xcffib.Reply.__init__(self, unpacker)
        base = unpacker.offset
        self.major_version, self.minor_version = unpacker.unpack("xx2x4xII16x")
        self.bufsize = unpacker.offset - base


class QueryVersionCookie(xcffib.Cookie):
    reply_type = QueryVersionReply


class SaveSetMode:
    Insert = 0
    Delete = 1
Example #4
0
import xcffib
import struct
import six
MAJOR_VERSION = 0
MINOR_VERSION = 4
key = xcffib.ExtensionKey("Composite")
_events = {}
_errors = {}
from . import xproto
from . import xfixes


class Redirect:
    Automatic = 0
    Manual = 1


class QueryVersionReply(xcffib.Reply):
    def __init__(self, unpacker):
        if isinstance(unpacker, xcffib.Protobj):
            unpacker = xcffib.MemoryUnpacker(unpacker.pack())
        xcffib.Reply.__init__(self, unpacker)
        base = unpacker.offset
        self.major_version, self.minor_version = unpacker.unpack("xx2x4xII16x")
        self.bufsize = unpacker.offset - base


class QueryVersionCookie(xcffib.Cookie):
    reply_type = QueryVersionReply

Example #5
0
import xcffib
import struct
import six
MAJOR_VERSION = 2
MINOR_VERSION = 2
key = xcffib.ExtensionKey("XVideo")
_events = {}
_errors = {}
from . import xproto
from . import shm


class Type:
    InputMask = 1 << 0
    OutputMask = 1 << 1
    VideoMask = 1 << 2
    StillMask = 1 << 3
    ImageMask = 1 << 4


class ImageFormatInfoType:
    RGB = 0
    YUV = 1


class ImageFormatInfoFormat:
    Packed = 0
    Planar = 1


class AttributeFlag:
Example #6
0
import xcffib
import struct
import six
MAJOR_VERSION = 1
MINOR_VERSION = 0
key = xcffib.ExtensionKey("SELinux")
_events = {}
_errors = {}
from . import xproto


class QueryVersionReply(xcffib.Reply):
    def __init__(self, unpacker):
        if isinstance(unpacker, xcffib.Protobj):
            unpacker = xcffib.MemoryUnpacker(unpacker.pack())
        xcffib.Reply.__init__(self, unpacker)
        base = unpacker.offset
        self.server_major, self.server_minor = unpacker.unpack("xx2x4xHH")
        self.bufsize = unpacker.offset - base


class QueryVersionCookie(xcffib.Cookie):
    reply_type = QueryVersionReply


class GetDeviceCreateContextReply(xcffib.Reply):
    def __init__(self, unpacker):
        if isinstance(unpacker, xcffib.Protobj):
            unpacker = xcffib.MemoryUnpacker(unpacker.pack())
        xcffib.Reply.__init__(self, unpacker)
        base = unpacker.offset
Example #7
0
import xcffib
import struct
import six
MAJOR_VERSION = 0
MINOR_VERSION = 11
key = xcffib.ExtensionKey("RENDER")
_events = {}
_errors = {}


class PictOp:
    Clear = 0
    Src = 1
    Dst = 2
    Over = 3
    OverReverse = 4
    In = 5
    InReverse = 6
    Out = 7
    OutReverse = 8
    Atop = 9
    AtopReverse = 10
    Xor = 11
    Add = 12
    Saturate = 13
    DisjointClear = 16
    DisjointSrc = 17
    DisjointDst = 18
    DisjointOver = 19
    DisjointOverReverse = 20
    DisjointIn = 21
Example #8
0
import xcffib
import struct
import six
MAJOR_VERSION = 1
MINOR_VERSION = 0
key = xcffib.ExtensionKey("Generic Event Extension")
_events = {}
_errors = {}


class QueryVersionReply(xcffib.Reply):
    def __init__(self, unpacker):
        if isinstance(unpacker, xcffib.Protobj):
            unpacker = xcffib.MemoryUnpacker(unpacker.pack())
        xcffib.Reply.__init__(self, unpacker)
        base = unpacker.offset
        self.major_version, self.minor_version = unpacker.unpack("xx2x4xHH20x")
        self.bufsize = unpacker.offset - base


class QueryVersionCookie(xcffib.Cookie):
    reply_type = QueryVersionReply


class geExtension(xcffib.Extension):
    def QueryVersion(self,
                     client_major_version,
                     client_minor_version,
                     is_checked=True):
        buf = six.BytesIO()
        buf.write(
Example #9
0
import xcffib
import struct
import six
MAJOR_VERSION = 1
MINOR_VERSION = 1
key = xcffib.ExtensionKey("XC-MISC")
_events = {}
_errors = {}


class GetVersionReply(xcffib.Reply):
    def __init__(self, unpacker):
        if isinstance(unpacker, xcffib.Protobj):
            unpacker = xcffib.MemoryUnpacker(unpacker.pack())
        xcffib.Reply.__init__(self, unpacker)
        base = unpacker.offset
        self.server_major_version, self.server_minor_version = unpacker.unpack(
            "xx2x4xHH")
        self.bufsize = unpacker.offset - base


class GetVersionCookie(xcffib.Cookie):
    reply_type = GetVersionReply


class GetXIDRangeReply(xcffib.Reply):
    def __init__(self, unpacker):
        if isinstance(unpacker, xcffib.Protobj):
            unpacker = xcffib.MemoryUnpacker(unpacker.pack())
        xcffib.Reply.__init__(self, unpacker)
        base = unpacker.offset
Example #10
0
import xcffib
import struct
import six
MAJOR_VERSION = 1
MINOR_VERSION = 2
key = xcffib.ExtensionKey("Present")
_events = {}
_errors = {}
from . import xproto
from . import randr
from . import xfixes
from . import sync


class Event:
    ConfigureNotify = 0
    CompleteNotify = 1
    IdleNotify = 2
    RedirectNotify = 3


class EventMask:
    NoEvent = 0
    ConfigureNotify = 1 << 0
    CompleteNotify = 1 << 1
    IdleNotify = 1 << 2
    RedirectNotify = 1 << 3


class Option:
    _None = 0
Example #11
0
import xcffib
import struct
import six
MAJOR_VERSION = 4
MINOR_VERSION = 1
key = xcffib.ExtensionKey("XFree86-DRI")
_events = {}
_errors = {}
class DrmClipRect(xcffib.Struct):
    def __init__(self, unpacker):
        if isinstance(unpacker, xcffib.Protobj):
            unpacker = xcffib.MemoryUnpacker(unpacker.pack())
        xcffib.Struct.__init__(self, unpacker)
        base = unpacker.offset
        self.x1, self.y1, self.x2, self.x3 = unpacker.unpack("hhhh")
        self.bufsize = unpacker.offset - base
    def pack(self):
        buf = six.BytesIO()
        buf.write(struct.pack("=hhhh", self.x1, self.y1, self.x2, self.x3))
        return buf.getvalue()
    fixed_size = 8
    @classmethod
    def synthetic(cls, x1, y1, x2, x3):
        self = cls.__new__(cls)
        self.x1 = x1
        self.y1 = y1
        self.x2 = x2
        self.x3 = x3
        return self
class QueryVersionReply(xcffib.Reply):
    def __init__(self, unpacker):
Example #12
0
import xcffib
import struct
import six
MAJOR_VERSION = 0
MINOR_VERSION = 0
key = xcffib.ExtensionKey("DPMS")
_events = {}
_errors = {}


class GetVersionReply(xcffib.Reply):
    def __init__(self, unpacker):
        if isinstance(unpacker, xcffib.Protobj):
            unpacker = xcffib.MemoryUnpacker(unpacker.pack())
        xcffib.Reply.__init__(self, unpacker)
        base = unpacker.offset
        self.server_major_version, self.server_minor_version = unpacker.unpack(
            "xx2x4xHH")
        self.bufsize = unpacker.offset - base


class GetVersionCookie(xcffib.Cookie):
    reply_type = GetVersionReply


class CapableReply(xcffib.Reply):
    def __init__(self, unpacker):
        if isinstance(unpacker, xcffib.Protobj):
            unpacker = xcffib.MemoryUnpacker(unpacker.pack())
        xcffib.Reply.__init__(self, unpacker)
        base = unpacker.offset
Example #13
0
import xcffib
import struct
import six
MAJOR_VERSION = 1
MINOR_VERSION = 2
key = xcffib.ExtensionKey("MIT-SHM")
_events = {}
_errors = {}
from . import xproto


class CompletionEvent(xcffib.Event):
    def __init__(self, unpacker):
        if isinstance(unpacker, xcffib.Protobj):
            unpacker = xcffib.MemoryUnpacker(unpacker.pack())
        xcffib.Event.__init__(self, unpacker)
        base = unpacker.offset
        self.drawable, self.minor_event, self.major_event, self.shmseg, self.offset = unpacker.unpack(
            "xx2xIHBxII")
        self.bufsize = unpacker.offset - base

    def pack(self):
        buf = six.BytesIO()
        buf.write(struct.pack("=B", 0))
        buf.write(
            struct.pack("=x2xIHBxII", self.drawable, self.minor_event,
                        self.major_event, self.shmseg, self.offset))
        buf_len = len(buf.getvalue())
        if buf_len < 32:
            buf.write(struct.pack("x" * (32 - buf_len)))
        return buf.getvalue()
Example #14
0
import xcffib
import struct
import six
MAJOR_VERSION = 1
MINOR_VERSION = 1
key = xcffib.ExtensionKey("SHAPE")
_events = {}
_errors = {}
from . import xproto


class SO:
    Set = 0
    Union = 1
    Intersect = 2
    Subtract = 3
    Invert = 4


class SK:
    Bounding = 0
    Clip = 1
    Input = 2


class NotifyEvent(xcffib.Event):
    def __init__(self, unpacker):
        if isinstance(unpacker, xcffib.Protobj):
            unpacker = xcffib.MemoryUnpacker(unpacker.pack())
        xcffib.Event.__init__(self, unpacker)
        base = unpacker.offset
Example #15
0
import xcffib
import struct
import six
MAJOR_VERSION = 0
MINOR_VERSION = 0
key = xcffib.ExtensionKey("BIG-REQUESTS")
_events = {}
_errors = {}
class EnableReply(xcffib.Reply):
    def __init__(self, unpacker):
        if isinstance(unpacker, xcffib.Protobj):
            unpacker = xcffib.MemoryUnpacker(unpacker.pack())
        xcffib.Reply.__init__(self, unpacker)
        base = unpacker.offset
        self.maximum_request_length, = unpacker.unpack("xx2x4xI")
        self.bufsize = unpacker.offset - base
class EnableCookie(xcffib.Cookie):
    reply_type = EnableReply
class bigreqExtension(xcffib.Extension):
    def Enable(self, is_checked=True):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2x"))
        return self.send_request(0, buf, EnableCookie, is_checked=is_checked)
xcffib._add_ext(key, bigreqExtension, _events, _errors)
Example #16
0
import xcffib
import struct
import six
MAJOR_VERSION = 0
MINOR_VERSION = 11
key = xcffib.ExtensionKey("XPROTO")
_events = {}
_errors = {}


class Atom:
    _None = 0
    Any = 0
    PRIMARY = 1
    SECONDARY = 2
    ARC = 3
    ATOM = 4
    BITMAP = 5
    CARDINAL = 6
    COLORMAP = 7
    CURSOR = 8
    CUT_BUFFER0 = 9
    CUT_BUFFER1 = 10
    CUT_BUFFER2 = 11
    CUT_BUFFER3 = 12
    CUT_BUFFER4 = 13
    CUT_BUFFER5 = 14
    CUT_BUFFER6 = 15
    CUT_BUFFER7 = 16
    DRAWABLE = 17
    FONT = 18
Example #17
0
import xcffib
import struct
import six

MAJOR_VERSION = 1
MINOR_VERSION = 1
key = xcffib.ExtensionKey("MIT-SCREEN-SAVER")
_events = {}
_errors = {}
from . import xproto


class Kind:
    Blanked = 0
    Internal = 1
    External = 2


class Event:
    NotifyMask = 1 << 0
    CycleMask = 1 << 1


class State:
    Off = 0
    On = 1
    Cycle = 2
    Disabled = 3


class QueryVersionReply(xcffib.Reply):
Example #18
0
import xcffib
import struct
import six
MAJOR_VERSION = 1
MINOR_VERSION = 2
key = xcffib.ExtensionKey("X-Resource")
_events = {}
_errors = {}
from . import xproto
class Client(xcffib.Struct):
    def __init__(self, unpacker):
        if isinstance(unpacker, xcffib.Protobj):
            unpacker = xcffib.MemoryUnpacker(unpacker.pack())
        xcffib.Struct.__init__(self, unpacker)
        base = unpacker.offset
        self.resource_base, self.resource_mask = unpacker.unpack("II")
        self.bufsize = unpacker.offset - base
    def pack(self):
        buf = six.BytesIO()
        buf.write(struct.pack("=II", self.resource_base, self.resource_mask))
        return buf.getvalue()
    fixed_size = 8
    @classmethod
    def synthetic(cls, resource_base, resource_mask):
        self = cls.__new__(cls)
        self.resource_base = resource_base
        self.resource_mask = resource_mask
        return self
class Type(xcffib.Struct):
    def __init__(self, unpacker):
        if isinstance(unpacker, xcffib.Protobj):
Example #19
0
import xcffib
import struct
import six
MAJOR_VERSION = 1
MINOR_VERSION = 2
key = xcffib.ExtensionKey("DRI3")
_events = {}
_errors = {}
from . import xproto


class QueryVersionReply(xcffib.Reply):
    def __init__(self, unpacker):
        if isinstance(unpacker, xcffib.Protobj):
            unpacker = xcffib.MemoryUnpacker(unpacker.pack())
        xcffib.Reply.__init__(self, unpacker)
        base = unpacker.offset
        self.major_version, self.minor_version = unpacker.unpack("xx2x4xII")
        self.bufsize = unpacker.offset - base


class QueryVersionCookie(xcffib.Cookie):
    reply_type = QueryVersionReply


class OpenReply(xcffib.Reply):
    def __init__(self, unpacker):
        if isinstance(unpacker, xcffib.Protobj):
            unpacker = xcffib.MemoryUnpacker(unpacker.pack())
        xcffib.Reply.__init__(self, unpacker)
        base = unpacker.offset
Example #20
0
import xcffib
import struct
import six
MAJOR_VERSION = 1
MINOR_VERSION = 1
key = xcffib.ExtensionKey("XVideo-MotionCompensation")
_events = {}
_errors = {}
from . import xv


class SurfaceInfo(xcffib.Struct):
    def __init__(self, unpacker):
        if isinstance(unpacker, xcffib.Protobj):
            unpacker = xcffib.MemoryUnpacker(unpacker.pack())
        xcffib.Struct.__init__(self, unpacker)
        base = unpacker.offset
        self.id, self.chroma_format, self.pad0, self.max_width, self.max_height, self.subpicture_max_width, self.subpicture_max_height, self.mc_type, self.flags = unpacker.unpack(
            "IHHHHHHII")
        self.bufsize = unpacker.offset - base

    def pack(self):
        buf = six.BytesIO()
        buf.write(
            struct.pack("=IHHHHHHII", self.id, self.chroma_format, self.pad0,
                        self.max_width, self.max_height,
                        self.subpicture_max_width, self.subpicture_max_height,
                        self.mc_type, self.flags))
        return buf.getvalue()

    fixed_size = 24
Example #21
0
class XkbExtension(xcffib.Extension):
    """Helper class to load and use Xkb xcffib extension; needed
    because there is not XKB support in xcffib."""

    # pylint: disable=invalid-name,missing-function-docstring
    def UseExtension(self, is_checked=True):
        buf = io.BytesIO()
        buf.write(struct.pack("=xx2xHH", 1, 0))
        return self.send_request(0,
                                 buf,
                                 XkbGetStateCookie,
                                 is_checked=is_checked)

    def GetState(self, deviceSpec=0x100, is_checked=True):
        buf = io.BytesIO()
        buf.write(struct.pack("=xx2xHxx", deviceSpec))
        return self.send_request(4,
                                 buf,
                                 XkbGetStateCookie,
                                 is_checked=is_checked)


key = xcffib.ExtensionKey("XKEYBOARD")
# this is a lie: there are events and errors types
_events = {}
_errors = {}

# pylint: disable=protected-access
xcffib._add_ext(key, XkbExtension, _events, _errors)
Example #22
0
import xcffib
import struct
import six

MAJOR_VERSION = 1
MINOR_VERSION = 1
key = xcffib.ExtensionKey("DAMAGE")
_events = {}
_errors = {}
from . import xproto
from . import xfixes


class ReportLevel:
    RawRectangles = 0
    DeltaRectangles = 1
    BoundingBox = 2
    NonEmpty = 3


class BadDamageError(xcffib.Error):
    def __init__(self, unpacker):
        if isinstance(unpacker, xcffib.Protobj):
            unpacker = xcffib.MemoryUnpacker(unpacker.pack())
        xcffib.Error.__init__(self, unpacker)
        base = unpacker.offset
        unpacker.unpack("xx2x")
        self.bufsize = unpacker.offset - base

    def pack(self):
        buf = six.BytesIO()
Example #23
0
import xcffib
import struct
import six

MAJOR_VERSION = 2
MINOR_VERSION = 2
key = xcffib.ExtensionKey("ERROR")
_events = {}
_errors = {}


class RequestError(xcffib.Error):
    def __init__(self, unpacker):
        if isinstance(unpacker, xcffib.Protobj):
            unpacker = xcffib.MemoryUnpacker(unpacker.pack())
        xcffib.Error.__init__(self, unpacker)
        base = unpacker.offset
        self.bad_value, self.minor_opcode, self.major_opcode = unpacker.unpack(
            "xx2xIHBx")
        self.bufsize = unpacker.offset - base

    def pack(self):
        buf = six.BytesIO()
        buf.write(struct.pack("=B", 1))
        buf.write(
            struct.pack("=x2xIHBx", self.bad_value, self.minor_opcode,
                        self.major_opcode))
        return buf.getvalue()


BadRequest = RequestError
Example #24
0
import xcffib
import struct
import six
MAJOR_VERSION = 1
MINOR_VERSION = 4
key = xcffib.ExtensionKey("EVENT")
_events = {}
_errors = {}


class ScreenChangeNotifyEvent(xcffib.Event):
    def __init__(self, unpacker):
        if isinstance(unpacker, xcffib.Protobj):
            unpacker = xcffib.MemoryUnpacker(unpacker.pack())
        xcffib.Event.__init__(self, unpacker)
        base = unpacker.offset
        self.rotation, self.timestamp, self.config_timestamp, self.root, self.request_window, self.sizeID, self.subpixel_order, self.width, self.height, self.mwidth, self.mheight = unpacker.unpack(
            "xB2xIIIIHHHHHH")
        self.bufsize = unpacker.offset - base

    def pack(self):
        buf = six.BytesIO()
        buf.write(struct.pack("=B", 0))
        buf.write(
            struct.pack("=B2xIIIIHHHHHH", self.rotation, self.timestamp,
                        self.config_timestamp, self.root, self.request_window,
                        self.sizeID, self.subpixel_order, self.width,
                        self.height, self.mwidth, self.mheight))
        buf_len = len(buf.getvalue())
        if buf_len < 32:
            buf.write(struct.pack("x" * (32 - buf_len)))
Example #25
0
import xcffib
import struct
import six
MAJOR_VERSION = 1
MINOR_VERSION = 13
key = xcffib.ExtensionKey("RECORD")
_events = {}
_errors = {}


class Range8(xcffib.Struct):
    def __init__(self, unpacker):
        if isinstance(unpacker, xcffib.Protobj):
            unpacker = xcffib.MemoryUnpacker(unpacker.pack())
        xcffib.Struct.__init__(self, unpacker)
        base = unpacker.offset
        self.first, self.last = unpacker.unpack("BB")
        self.bufsize = unpacker.offset - base

    def pack(self):
        buf = six.BytesIO()
        buf.write(struct.pack("=BB", self.first, self.last))
        return buf.getvalue()

    fixed_size = 2

    @classmethod
    def synthetic(cls, first, last):
        self = cls.__new__(cls)
        self.first = first
        self.last = last
Example #26
0
import xcffib
import struct
import six
MAJOR_VERSION = 2
MINOR_VERSION = 2
key = xcffib.ExtensionKey("XTEST")
_events = {}
_errors = {}
from . import xproto


class GetVersionReply(xcffib.Reply):
    def __init__(self, unpacker):
        if isinstance(unpacker, xcffib.Protobj):
            unpacker = xcffib.MemoryUnpacker(unpacker.pack())
        xcffib.Reply.__init__(self, unpacker)
        base = unpacker.offset
        self.major_version, self.minor_version = unpacker.unpack("xB2x4xH")
        self.bufsize = unpacker.offset - base


class GetVersionCookie(xcffib.Cookie):
    reply_type = GetVersionReply


class Cursor:
    _None = 0
    Current = 1


class CompareCursorReply(xcffib.Reply):
Example #27
0
import xcffib
import struct
import six
MAJOR_VERSION = 2
MINOR_VERSION = 2
key = xcffib.ExtensionKey("XFree86-VidModeExtension")
_events = {}
_errors = {}


class ModeFlag:
    Positive_HSync = 1 << 0
    Negative_HSync = 1 << 1
    Positive_VSync = 1 << 2
    Negative_VSync = 1 << 3
    Interlace = 1 << 4
    Composite_Sync = 1 << 5
    Positive_CSync = 1 << 6
    Negative_CSync = 1 << 7
    HSkew = 1 << 8
    Broadcast = 1 << 9
    Pixmux = 1 << 10
    Double_Clock = 1 << 11
    Half_Clock = 1 << 12


class ClockFlag:
    Programable = 1 << 0


class Permission: