Beispiel #1
0
import xcffib
import struct
import six
_events = {}
_errors = {}


class ClientMessageData(xcffib.Union):
    def __init__(self, unpacker):
        xcffib.Union.__init__(self, unpacker)
        self.data8 = xcffib.List(unpacker.copy(), "B", 20)
        self.data16 = xcffib.List(unpacker.copy(), "H", 10)
        self.data32 = xcffib.List(unpacker.copy(), "I", 5)

    def pack(self):
        buf = six.BytesIO()
        buf.write(xcffib.pack_list(self.data8, "B"))
        return buf.getvalue()


xcffib._add_ext(key, unionExtension, _events, _errors)
Beispiel #2
0
    def UnredirectSubwindows(self, window, update, is_checked=False):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xIB3x", window, update))
        return self.send_request(4, buf, is_checked=is_checked)

    def CreateRegionFromBorderClip(self, region, window, is_checked=False):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xII", region, window))
        return self.send_request(5, buf, is_checked=is_checked)

    def NameWindowPixmap(self, window, pixmap, is_checked=False):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xII", window, pixmap))
        return self.send_request(6, buf, is_checked=is_checked)

    def GetOverlayWindow(self, window, is_checked=True):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xI", window))
        return self.send_request(7,
                                 buf,
                                 GetOverlayWindowCookie,
                                 is_checked=is_checked)

    def ReleaseOverlayWindow(self, window, is_checked=False):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xI", window))
        return self.send_request(8, buf, is_checked=is_checked)


xcffib._add_ext(key, compositeExtension, _events, _errors)
Beispiel #3
0
import xcffib
import struct
import six
_events = {}
_errors = {}
class KeymapNotifyEvent(xcffib.Event):
    def __init__(self, unpacker):
        if isinstance(unpacker, xcffib.Protobj):
            unpacker = xcffib.MemoryUnpacker(unpacker.pack())
        xcffib.Event.__init__(self, unpacker)
        base = unpacker.offset
        unpacker.unpack("x")
        self.keys = xcffib.List(unpacker, "B", 31)
        self.bufsize = unpacker.offset - base
    def pack(self):
        buf = six.BytesIO()
        buf.write(struct.pack("=B", 11))
        buf.write(xcffib.pack_list(self.keys, "B"))
        buf_len = len(buf.getvalue())
        if buf_len < 32:
            buf.write(struct.pack("x" * (32 - buf_len)))
        return buf.getvalue()
    @classmethod
    def synthetic(cls, keys):
        self = cls.__new__(cls)
        self.keys = keys
        return self
_events[11] = KeymapNotifyEvent
xcffib._add_ext(key, no_sequenceExtension, _events, _errors)
Beispiel #4
0
    def ShowCursor(self, window, is_checked=False):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xI", window))
        return self.send_request(30, buf, is_checked=is_checked)

    def CreatePointerBarrier(self,
                             barrier,
                             window,
                             x1,
                             y1,
                             x2,
                             y2,
                             directions,
                             num_devices,
                             devices,
                             is_checked=False):
        buf = six.BytesIO()
        buf.write(
            struct.pack("=xx2xIIHHHHI2xH", barrier, window, x1, y1, x2, y2,
                        directions, num_devices))
        buf.write(xcffib.pack_list(devices, "H"))
        return self.send_request(31, buf, is_checked=is_checked)

    def DeletePointerBarrier(self, barrier, is_checked=False):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xI", barrier))
        return self.send_request(32, buf, is_checked=is_checked)


xcffib._add_ext(key, xfixesExtension, _events, _errors)
Beispiel #5
0
import xcffib
import struct
import six
_events = {}
_errors = {}
class EventForSend(xcffib.Buffer):
    pass
class eventstructExtension(xcffib.Extension):
    def SendExtensionEvent(self, device_id, propagate, num_classes, num_events, events, classes, is_checked=False):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xBBHB3x", device_id, propagate, num_classes, num_events))
        buf.write(xcffib.pack_list(events, EventForSend))
        buf.write(xcffib.pack_list(classes, "B"))
        return self.send_request(31, buf, is_checked=is_checked)
xcffib._add_ext(key, eventstructExtension, _events, _errors)
Beispiel #6
0
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xI", value_mask))
        if value_mask & CA.Counter:
            counter = items.pop(0)
            buf.write(struct.pack("=I", counter))
        if value_mask & CA.Value:
            value = items.pop(0)
            buf.write(value.pack() if hasattr(value, "pack") else INT64.
                      synthetic(*value).pack())
        if value_mask & CA.ValueType:
            valueType = items.pop(0)
            buf.write(struct.pack("=I", valueType))
        if value_mask & CA.Events:
            events = items.pop(0)
            buf.write(struct.pack("=I", events))
        return self.send_request(59,
                                 buf,
                                 GetPropertyCookie,
                                 is_checked=is_checked)

    def GetPropertyWithPad(self, is_checked=True):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2x"))
        return self.send_request(60,
                                 buf,
                                 GetPropertyWithPadCookie,
                                 is_checked=is_checked)


xcffib._add_ext(key, switchExtension, _events, _errors)
Beispiel #7
0
    def FenceFromFD(self,
                    drawable,
                    fence,
                    initially_triggered,
                    is_checked=False):
        buf = six.BytesIO()
        buf.write(
            struct.pack("=xx2xIIB3x", drawable, fence, initially_triggered))
        return self.send_request(4, buf, is_checked=is_checked)

    def FDFromFence(self, drawable, fence, is_checked=True):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xII", drawable, fence))
        return self.send_request(5,
                                 buf,
                                 FDFromFenceCookie,
                                 is_checked=is_checked)

    def GetSupportedModifiers(self, window, depth, bpp, is_checked=False):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xIBB2x", window, depth, bpp))
        return self.send_request(6, buf, is_checked=is_checked)

    def BuffersFromPixmap(self, pixmap, is_checked=False):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xI", pixmap))
        return self.send_request(8, buf, is_checked=is_checked)


xcffib._add_ext(key, dri3Extension, _events, _errors)
Beispiel #8
0
        buf = six.BytesIO()
        buf.write(struct.pack("=B", self.name_len))
        buf.write(xcffib.pack_list(self.name, "c"))
        return buf.getvalue()


class ListExtensionsReply(xcffib.Reply):
    def __init__(self, unpacker):
        xcffib.Reply.__init__(self, unpacker)
        base = unpacker.offset
        self.names_len, = unpacker.unpack("xB2x4x24x")
        self.names = xcffib.List(unpacker, STR, self.names_len)
        self.bufsize = unpacker.offset - base


class ListExtensionsCookie(xcffib.Cookie):
    reply_type = ListExtensionsReply


class request_replyExtension(xcffib.Extension):
    def ListExtensions(self, is_checked=True):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2x"))
        return self.send_request(99,
                                 buf,
                                 ListExtensionsCookie,
                                 is_checked=is_checked)


xcffib._add_ext(key, request_replyExtension, _events, _errors)
Beispiel #9
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)
Beispiel #10
0
            buf.write(struct.pack("=I", override_redirect))
        if value_mask & CW.SaveUnder:
            save_under = value_list.pop(0)
            buf.write(struct.pack("=I", save_under))
        if value_mask & CW.EventMask:
            event_mask = value_list.pop(0)
            buf.write(struct.pack("=I", event_mask))
        if value_mask & CW.DontPropagate:
            do_not_propogate_mask = value_list.pop(0)
            buf.write(struct.pack("=I", do_not_propogate_mask))
        if value_mask & CW.Colormap:
            colormap = value_list.pop(0)
            buf.write(struct.pack("=I", colormap))
        if value_mask & CW.Cursor:
            cursor = value_list.pop(0)
            buf.write(struct.pack("=I", cursor))
        return self.send_request(3, buf, is_checked=is_checked)

    def UnsetAttributes(self, drawable, is_checked=False):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xI", drawable))
        return self.send_request(4, buf, is_checked=is_checked)

    def Suspend(self, suspend, is_checked=False):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xI", suspend))
        return self.send_request(5, buf, is_checked=is_checked)


xcffib._add_ext(key, screensaverExtension, _events, _errors)
Beispiel #11
0
    ConjointClear = 32
    ConjointSrc = 33
    ConjointDst = 34
    ConjointOver = 35
    ConjointOverReverse = 36
    ConjointIn = 37
    ConjointInReverse = 38
    ConjointOut = 39
    ConjointOutReverse = 40
    ConjointAtop = 41
    ConjointAtopReverse = 42
    ConjointXor = 43
    Multiply = 48
    Screen = 49
    Overlay = 50
    Darken = 51
    Lighten = 52
    ColorDodge = 53
    ColorBurn = 54
    HardLight = 55
    SoftLight = 56
    Difference = 57
    Exclusion = 58
    HSLHue = 59
    HSLSaturation = 60
    HSLColor = 61
    HSLLuminosity = 62


xcffib._add_ext(key, render_1._7Extension, _events, _errors)
Beispiel #12
0
        return self


_events[2] = IdleNotifyEvent


class presentExtension(xcffib.Extension):
    def QueryVersion(self, major_version, minor_version, is_checked=True):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xII", major_version, minor_version))
        return self.send_request(0,
                                 buf,
                                 QueryVersionCookie,
                                 is_checked=is_checked)

    def SelectInput(self, eid, window, event_mask, is_checked=False):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xIII", eid, window, event_mask))
        return self.send_request(3, buf, is_checked=is_checked)

    def QueryCapabilities(self, target, is_checked=True):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xI", target))
        return self.send_request(4,
                                 buf,
                                 QueryCapabilitiesCookie,
                                 is_checked=is_checked)


xcffib._add_ext(key, presentExtension, _events, _errors)
Beispiel #13
0
    def GetVersion(self,
                   client_major_version,
                   client_minor_version,
                   is_checked=True):
        buf = six.BytesIO()
        buf.write(
            struct.pack("=xx2xHH", client_major_version, client_minor_version))
        return self.send_request(0,
                                 buf,
                                 GetVersionCookie,
                                 is_checked=is_checked)

    def GetXIDRange(self, is_checked=True):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2x"))
        return self.send_request(1,
                                 buf,
                                 GetXIDRangeCookie,
                                 is_checked=is_checked)

    def GetXIDList(self, count, is_checked=True):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xI", count))
        return self.send_request(2,
                                 buf,
                                 GetXIDListCookie,
                                 is_checked=is_checked)


xcffib._add_ext(key, xc_miscExtension, _events, _errors)
Beispiel #14
0
        return self.send_request(4, buf, GetClientDriverNameCookie, is_checked=is_checked)
    def CreateContext(self, screen, visual, context, is_checked=True):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xIII", screen, visual, context))
        return self.send_request(5, buf, CreateContextCookie, is_checked=is_checked)
    def DestroyContext(self, screen, context, is_checked=False):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xII", screen, context))
        return self.send_request(6, buf, is_checked=is_checked)
    def CreateDrawable(self, screen, drawable, is_checked=True):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xII", screen, drawable))
        return self.send_request(7, buf, CreateDrawableCookie, is_checked=is_checked)
    def DestroyDrawable(self, screen, drawable, is_checked=False):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xII", screen, drawable))
        return self.send_request(8, buf, is_checked=is_checked)
    def GetDrawableInfo(self, screen, drawable, is_checked=True):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xII", screen, drawable))
        return self.send_request(9, buf, GetDrawableInfoCookie, is_checked=is_checked)
    def GetDeviceInfo(self, screen, is_checked=True):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xI", screen))
        return self.send_request(10, buf, GetDeviceInfoCookie, is_checked=is_checked)
    def AuthConnection(self, screen, magic, is_checked=True):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xII", screen, magic))
        return self.send_request(11, buf, AuthConnectionCookie, is_checked=is_checked)
xcffib._add_ext(key, xf86driExtension, _events, _errors)
Beispiel #15
0
class EventMask:
    NoEvent = 0
    KeyPress = 1 << 0
    KeyRelease = 1 << 1
    ButtonPress = 1 << 2
    ButtonRelease = 1 << 3
    EnterWindow = 1 << 4
    LeaveWindow = 1 << 5
    PointerMotion = 1 << 6
    PointerMotionHint = 1 << 7
    Button1Motion = 1 << 8
    Button2Motion = 1 << 9
    Button3Motion = 1 << 10
    Button4Motion = 1 << 11
    Button5Motion = 1 << 12
    ButtonMotion = 1 << 13
    KeymapState = 1 << 14
    Exposure = 1 << 15
    VisibilityChange = 1 << 16
    StructureNotify = 1 << 17
    ResizeRedirect = 1 << 18
    SubstructureNotify = 1 << 19
    SubstructureRedirect = 1 << 20
    FocusChange = 1 << 21
    PropertyChange = 1 << 22
    ColorMapChange = 1 << 23
    OwnerGrabButton = 1 << 24


xcffib._add_ext(key, enumExtension, _events, _errors)
Beispiel #16
0
        buf = six.BytesIO()
        buf.write(struct.pack("=II", self.name, self.value))
        return buf.getvalue()
    fixed_size = 8
class ListFontsWithInfoReply(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.name_len, = unpacker.unpack("xB2x4x")
        self.min_bounds = CHARINFO(unpacker)
        unpacker.unpack("4x")
        unpacker.pad(CHARINFO)
        self.max_bounds = CHARINFO(unpacker)
        self.min_char_or_byte2, self.max_char_or_byte2, self.default_char, self.properties_len, self.draw_direction, self.min_byte1, self.max_byte1, self.all_chars_exist, self.font_ascent, self.font_descent, self.replies_hint = unpacker.unpack("4xHHHHBBBBhhI")
        unpacker.pad(FONTPROP)
        self.properties = xcffib.List(unpacker, FONTPROP, self.properties_len)
        unpacker.pad("c")
        self.name = xcffib.List(unpacker, "c", self.name_len)
        self.bufsize = unpacker.offset - base
class ListFontsWithInfoCookie(xcffib.Cookie):
    reply_type = ListFontsWithInfoReply
class type_padExtension(xcffib.Extension):
    def ListFontsWithInfo(self, max_names, pattern_len, pattern, is_checked=True):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xHH", max_names, pattern_len))
        buf.write(xcffib.pack_list(pattern, "c"))
        return self.send_request(50, buf, ListFontsWithInfoCookie, is_checked=is_checked)
xcffib._add_ext(key, type_padExtension, _events, _errors)
Beispiel #17
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)
Beispiel #18
0
                                 buf,
                                 GetSelectionContextCookie,
                                 is_checked=is_checked)

    def GetSelectionDataContext(self, selection, is_checked=True):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xI", selection))
        return self.send_request(20,
                                 buf,
                                 GetSelectionDataContextCookie,
                                 is_checked=is_checked)

    def ListSelections(self, is_checked=True):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2x"))
        return self.send_request(21,
                                 buf,
                                 ListSelectionsCookie,
                                 is_checked=is_checked)

    def GetClientContext(self, resource, is_checked=True):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xI", resource))
        return self.send_request(22,
                                 buf,
                                 GetClientContextCookie,
                                 is_checked=is_checked)


xcffib._add_ext(key, xselinuxExtension, _events, _errors)
Beispiel #19
0
        return self.send_request(3, buf, is_checked=is_checked)

    def GetContext(self, context, is_checked=True):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xI", context))
        return self.send_request(4,
                                 buf,
                                 GetContextCookie,
                                 is_checked=is_checked)

    def EnableContext(self, context, is_checked=True):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xI", context))
        return self.send_request(5,
                                 buf,
                                 EnableContextCookie,
                                 is_checked=is_checked)

    def DisableContext(self, context, is_checked=False):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xI", context))
        return self.send_request(6, buf, is_checked=is_checked)

    def FreeContext(self, context, is_checked=False):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xI", context))
        return self.send_request(7, buf, is_checked=is_checked)


xcffib._add_ext(key, recordExtension, _events, _errors)
Beispiel #20
0
        self.name = xcffib.List(unpacker, "c", self.name_len)
        self.bufsize = unpacker.offset - base
    def pack(self):
        buf = six.BytesIO()
        buf.write(struct.pack("=B", self.name_len))
        buf.write(xcffib.pack_list(self.name, "c"))
        return buf.getvalue()
    @classmethod
    def synthetic(cls, name_len, name):
        self = cls.__new__(cls)
        self.name_len = name_len
        self.name = name
        return self
class ListExtensionsReply(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.names_len, = unpacker.unpack("xB2x4x24x")
        self.names = xcffib.List(unpacker, STR, self.names_len)
        self.bufsize = unpacker.offset - base
class ListExtensionsCookie(xcffib.Cookie):
    reply_type = ListExtensionsReply
class request_replyExtension(xcffib.Extension):
    def ListExtensions(self, is_checked=True):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2x"))
        return self.send_request(99, buf, ListExtensionsCookie, is_checked=is_checked)
xcffib._add_ext(key, request_replyExtension, _events, _errors)
Beispiel #21
0
    WM_NORMAL_HINTS = 40
    WM_SIZE_HINTS = 41
    WM_ZOOM_HINTS = 42
    MIN_SPACE = 43
    NORM_SPACE = 44
    MAX_SPACE = 45
    END_SPACE = 46
    SUPERSCRIPT_X = 47
    SUPERSCRIPT_Y = 48
    SUBSCRIPT_X = 49
    SUBSCRIPT_Y = 50
    UNDERLINE_POSITION = 51
    UNDERLINE_THICKNESS = 52
    STRIKEOUT_ASCENT = 53
    STRIKEOUT_DESCENT = 54
    ITALIC_ANGLE = 55
    X_HEIGHT = 56
    QUAD_WIDTH = 57
    WEIGHT = 58
    POINT_SIZE = 59
    RESOLUTION = 60
    COPYRIGHT = 61
    NOTICE = 62
    FONT_NAME = 63
    FAMILY_NAME = 64
    FULL_NAME = 65
    CAP_HEIGHT = 66
    WM_CLASS = 67
    WM_TRANSIENT_FOR = 68
xcffib._add_ext(key, xproto_1._7Extension, _events, _errors)
Beispiel #22
0
        return self
class RECTANGLE(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.x, self.y, self.width, self.height = unpacker.unpack("hhHH")
        self.bufsize = unpacker.offset - base
    def pack(self):
        buf = io.BytesIO()
        buf.write(struct.pack("=hhHH", self.x, self.y, self.width, self.height))
        return buf.getvalue()
    fixed_size = 8
    @classmethod
    def synthetic(cls, x, y, width, height):
        self = cls.__new__(cls)
        self.x = x
        self.y = y
        self.width = width
        self.height = height
        return self
class renderExtension(xcffib.Extension):
    def FillRectangles(self, op, dst, color, rects_len, rects, is_checked=False):
        buf = io.BytesIO()
        buf.write(struct.pack("=xx2xB3xI", op, dst))
        buf.write(color.pack() if hasattr(color, "pack") else COLOR.synthetic(*color).pack())
        buf.write(xcffib.pack_list(rects, RECTANGLE))
        return self.send_request(26, buf, is_checked=is_checked)
xcffib._add_ext(key, renderExtension, _events, _errors)
Beispiel #23
0
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xI", destination_window))
        return self.send_request(5,
                                 buf,
                                 QueryExtentsCookie,
                                 is_checked=is_checked)

    def SelectInput(self, destination_window, enable, is_checked=False):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xIB3x", destination_window, enable))
        return self.send_request(6, buf, is_checked=is_checked)

    def InputSelected(self, destination_window, is_checked=True):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xI", destination_window))
        return self.send_request(7,
                                 buf,
                                 InputSelectedCookie,
                                 is_checked=is_checked)

    def GetRectangles(self, window, source_kind, is_checked=True):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xIB3x", window, source_kind))
        return self.send_request(8,
                                 buf,
                                 GetRectanglesCookie,
                                 is_checked=is_checked)


xcffib._add_ext(key, shapeExtension, _events, _errors)
Beispiel #24
0
        buf = six.BytesIO()
        buf.write(
            struct.pack("=xx2xII", client_major_version, client_minor_version))
        return self.send_request(0,
                                 buf,
                                 QueryVersionCookie,
                                 is_checked=is_checked)

    def Create(self, damage, drawable, level, is_checked=False):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xIIB3x", damage, drawable, level))
        return self.send_request(1, buf, is_checked=is_checked)

    def Destroy(self, damage, is_checked=False):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xI", damage))
        return self.send_request(2, buf, is_checked=is_checked)

    def Subtract(self, damage, repair, parts, is_checked=False):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xIII", damage, repair, parts))
        return self.send_request(3, buf, is_checked=is_checked)

    def Add(self, drawable, region, is_checked=False):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xII", drawable, region))
        return self.send_request(4, buf, is_checked=is_checked)


xcffib._add_ext(key, damageExtension, _events, _errors)
Beispiel #25
0
        self = cls.__new__(cls)
        self.name = name
        self.value = value
        return self
class ListFontsWithInfoReply(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.name_len, = unpacker.unpack("xB2x4x")
        self.min_bounds = CHARINFO(unpacker)
        unpacker.unpack("4x")
        unpacker.pad(CHARINFO)
        self.max_bounds = CHARINFO(unpacker)
        self.min_char_or_byte2, self.max_char_or_byte2, self.default_char, self.properties_len, self.draw_direction, self.min_byte1, self.max_byte1, self.all_chars_exist, self.font_ascent, self.font_descent, self.replies_hint = unpacker.unpack("4xHHHHBBBBhhI")
        unpacker.pad(FONTPROP)
        self.properties = xcffib.List(unpacker, FONTPROP, self.properties_len)
        unpacker.pad("c")
        self.name = xcffib.List(unpacker, "c", self.name_len)
        self.bufsize = unpacker.offset - base
class ListFontsWithInfoCookie(xcffib.Cookie):
    reply_type = ListFontsWithInfoReply
class type_padExtension(xcffib.Extension):
    def ListFontsWithInfo(self, max_names, pattern_len, pattern, is_checked=True):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xxHH", max_names, pattern_len))
        buf.write(xcffib.pack_list(pattern, "c"))
        return self.send_request(50, buf, ListFontsWithInfoCookie, is_checked=is_checked)
xcffib._add_ext(key, type_padExtension, _events, _errors)
Beispiel #26
0
            unpacker.pad("H")
            self.data16 = xcffib.List(unpacker, "H", self.num_items)
        if self.format & PropertyFormat._32Bits:
            unpacker.pad("I")
            self.data32 = xcffib.List(unpacker, "I", self.num_items)
        self.bufsize = unpacker.offset - base
class GetPropertyWithPadCookie(xcffib.Cookie):
    reply_type = GetPropertyWithPadReply
class switchExtension(xcffib.Extension):
    def GetProperty(self, value_mask, items, is_checked=True):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xI", value_mask))
        if value_mask & CA.Counter:
            counter = items.pop(0)
            buf.write(struct.pack("=I", counter))
        if value_mask & CA.Value:
            value = items.pop(0)
            buf.write(value.pack() if hasattr(value, "pack") else INT64.synthetic(*value).pack())
        if value_mask & CA.ValueType:
            valueType = items.pop(0)
            buf.write(struct.pack("=I", valueType))
        if value_mask & CA.Events:
            events = items.pop(0)
            buf.write(struct.pack("=I", events))
        return self.send_request(59, buf, GetPropertyCookie, is_checked=is_checked)
    def GetPropertyWithPad(self, is_checked=True):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2x"))
        return self.send_request(60, buf, GetPropertyWithPadCookie, is_checked=is_checked)
xcffib._add_ext(key, switchExtension, _events, _errors)
Beispiel #27
0
    WM_ZOOM_HINTS = 42
    MIN_SPACE = 43
    NORM_SPACE = 44
    MAX_SPACE = 45
    END_SPACE = 46
    SUPERSCRIPT_X = 47
    SUPERSCRIPT_Y = 48
    SUBSCRIPT_X = 49
    SUBSCRIPT_Y = 50
    UNDERLINE_POSITION = 51
    UNDERLINE_THICKNESS = 52
    STRIKEOUT_ASCENT = 53
    STRIKEOUT_DESCENT = 54
    ITALIC_ANGLE = 55
    X_HEIGHT = 56
    QUAD_WIDTH = 57
    WEIGHT = 58
    POINT_SIZE = 59
    RESOLUTION = 60
    COPYRIGHT = 61
    NOTICE = 62
    FONT_NAME = 63
    FAMILY_NAME = 64
    FULL_NAME = 65
    CAP_HEIGHT = 66
    WM_CLASS = 67
    WM_TRANSIENT_FOR = 68


xcffib._add_ext(key, xproto_1._7Extension, _events, _errors)
Beispiel #28
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)))
        return buf.getvalue()
_events[0] = ScreenChangeNotifyEvent
xcffib._add_ext(key, eventExtension, _events, _errors)
Beispiel #29
0
import xcffib
import struct
import six
_events = {}
_errors = {}


class KeymapNotifyEvent(xcffib.Event):
    def __init__(self, unpacker):
        xcffib.Event.__init__(self, unpacker)
        base = unpacker.offset
        unpacker.unpack("x")
        self.keys = xcffib.List(unpacker, "B", 31)
        self.bufsize = unpacker.offset - base

    def pack(self):
        buf = six.BytesIO()
        buf.write(struct.pack("=B", 11))
        buf.write(xcffib.pack_list(self.keys, "B"))
        buf_len = len(buf.getvalue())
        if buf_len < 32:
            buf.write(struct.pack("x" * (32 - buf_len)))
        return buf.getvalue()


_events[11] = KeymapNotifyEvent
xcffib._add_ext(key, no_sequenceExtension, _events, _errors)
Beispiel #30
0
    def CompareCursor(self, window, cursor, is_checked=True):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xII", window, cursor))
        return self.send_request(1,
                                 buf,
                                 CompareCursorCookie,
                                 is_checked=is_checked)

    def FakeInput(self,
                  type,
                  detail,
                  time,
                  root,
                  rootX,
                  rootY,
                  deviceid,
                  is_checked=False):
        buf = six.BytesIO()
        buf.write(
            struct.pack("=xx2xBB2xII8xhh7xB", type, detail, time, root, rootX,
                        rootY, deviceid))
        return self.send_request(2, buf, is_checked=is_checked)

    def GrabControl(self, impervious, is_checked=False):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xB3x", impervious))
        return self.send_request(3, buf, is_checked=is_checked)


xcffib._add_ext(key, xtestExtension, _events, _errors)
                                 buf,
                                 GetGammaRampCookie,
                                 is_checked=is_checked)

    def SetGammaRamp(self, screen, size, red, green, blue, is_checked=False):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xHH", screen, size))
        buf.write(xcffib.pack_list(red, "H"))
        buf.write(xcffib.pack_list(green, "H"))
        buf.write(xcffib.pack_list(blue, "H"))
        return self.send_request(18, buf, is_checked=is_checked)

    def GetGammaRampSize(self, screen, is_checked=True):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xH2x", screen))
        return self.send_request(19,
                                 buf,
                                 GetGammaRampSizeCookie,
                                 is_checked=is_checked)

    def GetPermissions(self, screen, is_checked=True):
        buf = six.BytesIO()
        buf.write(struct.pack("=xx2xH2x", screen))
        return self.send_request(20,
                                 buf,
                                 GetPermissionsCookie,
                                 is_checked=is_checked)


xcffib._add_ext(key, xf86vidmodeExtension, _events, _errors)