xcffib
Advanced tools
+1
-1
| Metadata-Version: 2.1 | ||
| Name: xcffib | ||
| Version: 1.7.1 | ||
| Version: 1.8.0 | ||
| Summary: xcffib is the XCB binding for python | ||
@@ -5,0 +5,0 @@ Home-page: http://github.com/tych0/xcffib |
+1
-1
@@ -1,2 +0,2 @@ | ||
| # xcffib [](https://github.com/tych0/xcffib/actions) | ||
| # xcffib [](https://github.com/tych0/xcffib/actions) | ||
@@ -3,0 +3,0 @@ `xcffib` is the XCB binding for Python. |
+14
-16
@@ -30,4 +30,5 @@ #!/usr/bin/env python | ||
| """ | ||
| def finalize_options(self): | ||
| if not os.path.exists('./xcffib'): | ||
| if not os.path.exists("./xcffib"): | ||
| print("It looks like you need to generate the binding.") | ||
@@ -41,3 +42,3 @@ print("please run 'make xcffib' or 'make check'.") | ||
| def finalize_options(self): | ||
| if not os.path.exists('./xcffib'): | ||
| if not os.path.exists("./xcffib"): | ||
| print("It looks like you need to generate the binding.") | ||
@@ -48,3 +49,3 @@ print("please run 'make xcffib' or 'make check'.") | ||
| version = "1.7.1" | ||
| version = "1.8.0" | ||
| dependencies = ["cffi>=1.1.0; python_implementation != 'PyPy'"] | ||
@@ -63,18 +64,15 @@ | ||
| setup_requires=dependencies, | ||
| python_requires = ">=3.10", | ||
| packages=['xcffib'], | ||
| package_data={'xcffib': ['py.typed']}, | ||
| python_requires=">=3.10", | ||
| packages=["xcffib"], | ||
| package_data={"xcffib": ["py.typed"]}, | ||
| zip_safe=False, | ||
| cmdclass={ | ||
| 'build': binding_build, | ||
| 'install': binding_install | ||
| }, | ||
| cmdclass={"build": binding_build, "install": binding_install}, | ||
| classifiers=[ | ||
| 'Development Status :: 5 - Production/Stable', | ||
| 'License :: OSI Approved :: Apache Software License', | ||
| 'Programming Language :: Python :: 3', | ||
| 'Programming Language :: Python :: Implementation :: CPython', | ||
| 'Programming Language :: Python :: Implementation :: PyPy', | ||
| 'Topic :: Software Development :: Libraries' | ||
| "Development Status :: 5 - Production/Stable", | ||
| "License :: OSI Approved :: Apache Software License", | ||
| "Programming Language :: Python :: 3", | ||
| "Programming Language :: Python :: Implementation :: CPython", | ||
| "Programming Language :: Python :: Implementation :: PyPy", | ||
| "Topic :: Software Development :: Libraries", | ||
| ], | ||
| ) |
+12
-12
@@ -36,3 +36,3 @@ # Copyright 2014 Tycho Andersen | ||
| class XcffibTest(XvfbTest): | ||
| """ A home for common functions needed for xcffib testing. """ | ||
| """A home for common functions needed for xcffib testing.""" | ||
@@ -58,3 +58,6 @@ def setUp(self): | ||
| self.default_screen.root, | ||
| x, y, w, h, | ||
| x, | ||
| y, | ||
| w, | ||
| h, | ||
| 0, | ||
@@ -64,7 +67,4 @@ xcffib.xproto.WindowClass.InputOutput, | ||
| xcffib.xproto.CW.BackPixel | xcffib.xproto.CW.EventMask, | ||
| [ | ||
| self.default_screen.black_pixel, | ||
| xcffib.xproto.EventMask.StructureNotify | ||
| ], | ||
| is_checked=is_checked | ||
| [self.default_screen.black_pixel, xcffib.xproto.EventMask.StructureNotify], | ||
| is_checked=is_checked, | ||
| ) | ||
@@ -78,11 +78,11 @@ | ||
| [ | ||
| EventMask.SubstructureNotify | | ||
| EventMask.StructureNotify | | ||
| EventMask.SubstructureRedirect | ||
| ] | ||
| EventMask.SubstructureNotify | ||
| | EventMask.StructureNotify | ||
| | EventMask.SubstructureRedirect | ||
| ], | ||
| ).check() | ||
| self.spawn(['xeyes']) | ||
| self.spawn(["xeyes"]) | ||
| def intern(self, name): | ||
| return self.xproto.InternAtom(False, len(name), name).reply().atom |
@@ -187,3 +187,3 @@ # Copyright 2014 Tycho Andersen | ||
| title_bytes = b"test\xc2\xb7" | ||
| title_string = "test\u00B7" | ||
| title_string = "test\u00b7" | ||
@@ -202,3 +202,3 @@ # First check with an object already encoded as bytes | ||
| reply = xproto_test.xproto.GetProperty( | ||
| False, wid, net_wm_name, xcffib.xproto.GetPropertyType.Any, 0, (2 ** 32) - 1 | ||
| False, wid, net_wm_name, xcffib.xproto.GetPropertyType.Any, 0, (2**32) - 1 | ||
| ).reply() | ||
@@ -223,3 +223,3 @@ | ||
| reply = xproto_test.xproto.GetProperty( | ||
| False, wid, net_wm_name, xcffib.xproto.GetPropertyType.Any, 0, (2 ** 32) - 1 | ||
| False, wid, net_wm_name, xcffib.xproto.GetPropertyType.Any, 0, (2**32) - 1 | ||
| ).reply() | ||
@@ -226,0 +226,0 @@ |
@@ -24,4 +24,5 @@ # Copyright 2012 Florian Mounier | ||
| """ | ||
| This is mostly stolen from qtile's tests/scripts/window.py | ||
| This is mostly stolen from qtile's tests/scripts/window.py | ||
| """ | ||
| import os | ||
@@ -28,0 +29,0 @@ import sys |
@@ -14,31 +14,11 @@ import xcffib | ||
| # motion | ||
| xtest.FakeInput( | ||
| 6, | ||
| 0, | ||
| xcffib.xproto.Time.CurrentTime, | ||
| screen.root, | ||
| x, | ||
| y, | ||
| 0) | ||
| xtest.FakeInput(6, 0, xcffib.xproto.Time.CurrentTime, screen.root, x, y, 0) | ||
| # press | ||
| xtest.FakeInput( | ||
| 4, | ||
| 1, | ||
| xcffib.xproto.Time.CurrentTime, | ||
| screen.root, | ||
| 0, | ||
| 0, | ||
| 0) | ||
| xtest.FakeInput(4, 1, xcffib.xproto.Time.CurrentTime, screen.root, 0, 0, 0) | ||
| # release | ||
| xtest.FakeInput( | ||
| 5, | ||
| 1, | ||
| xcffib.xproto.Time.CurrentTime, | ||
| screen.root, | ||
| 2, | ||
| 2, | ||
| 0) | ||
| xtest.FakeInput(5, 1, xcffib.xproto.Time.CurrentTime, screen.root, 2, 2, 0) | ||
| xcffib_test.conn.flush() | ||
| test(50, 10) | ||
@@ -45,0 +25,0 @@ |
+17
-25
@@ -30,3 +30,2 @@ # Copyright 2014 Tycho Andersen | ||
| class TestPythonCode: | ||
| def test_struct_pack_uses_List(self): | ||
@@ -37,6 +36,6 @@ # suppose we have a list of ints... | ||
| # Unpacker wants a cffi.cdata | ||
| cffi_ints = xcffib.ffi.new('char[]', ints) | ||
| cffi_ints = xcffib.ffi.new("char[]", ints) | ||
| l = xcffib.List(xcffib.CffiUnpacker(cffi_ints), "I", count=4) | ||
| ints2 = struct.pack("=IIII", *l) | ||
| data = xcffib.List(xcffib.CffiUnpacker(cffi_ints), "I", count=4) | ||
| ints2 = struct.pack("=IIII", *data) | ||
@@ -48,3 +47,3 @@ # after packing and unpacking, we should still have those ints | ||
| data = struct.pack("=" + ("b" * 20), *range(20)) | ||
| cffi_data = xcffib.ffi.new('char[]', data) | ||
| cffi_data = xcffib.ffi.new("char[]", data) | ||
@@ -59,7 +58,7 @@ cm = xcffib.xproto.ClientMessageData(xcffib.CffiUnpacker(cffi_data)) | ||
| assert cm.data32[1] == 0x07060504 | ||
| assert cm.data32[2] == 0x0b0a0908 | ||
| assert cm.data32[2] == 0x0B0A0908 | ||
| elif sys.byteorder == "big": | ||
| assert cm.data32[0] == 0x00010203 | ||
| assert cm.data32[1] == 0x04050607 | ||
| assert cm.data32[2] == 0x08090a0b | ||
| assert cm.data32[2] == 0x08090A0B | ||
| else: | ||
@@ -103,6 +102,3 @@ raise Exception("unknown byte order?") | ||
| e = xcffib.xproto.ClientMessageEvent.synthetic( | ||
| format=32, | ||
| window=wid, | ||
| type=wm_protocols, | ||
| data=union | ||
| format=32, window=wid, type=wm_protocols, data=union | ||
| ) | ||
@@ -134,9 +130,6 @@ | ||
| e = xcffib.xproto.ClientMessageEvent.synthetic( | ||
| format=32, | ||
| window=wid, | ||
| type=wm_protocols, | ||
| data=union | ||
| format=32, window=wid, type=wm_protocols, data=union | ||
| ) | ||
| e2 = xcffib.xproto.ClientMessageEvent(e) | ||
| _ = xcffib.xproto.ClientMessageEvent(e) | ||
@@ -153,5 +146,6 @@ def test_get_image(self, xcffib_test): | ||
| output_format = xcffib.xproto.ImageFormat.ZPixmap | ||
| plane_mask = 2**32 - 1 # No idea what this is but it works! | ||
| plane_mask = 2**32 - 1 # No idea what this is but it works! | ||
| reply = xcffib_test.conn.core.GetImage( | ||
| output_format, root, 0, 0, width, height, plane_mask).reply() | ||
| output_format, root, 0, 0, width, height, plane_mask | ||
| ).reply() | ||
| reply.data.buf() | ||
@@ -183,3 +177,3 @@ | ||
| 0, # dx | ||
| 0 # dy | ||
| 0, # dy | ||
| ) | ||
@@ -193,3 +187,3 @@ | ||
| event = xcffib_test.conn.hoist_event(generic_reply) | ||
| assert isinstance(event, xcffib.xinput.BarrierHitEvent) | ||
@@ -208,3 +202,3 @@ assert event.root_x >> 16 == 100 | ||
| print(info.name.to_string()) | ||
| assert info.name.to_string() == 'screen' | ||
| assert info.name.to_string() == "screen" | ||
| finally: | ||
@@ -214,8 +208,6 @@ xcffib_test.conn.disconnect() | ||
| class TestXcffibTestGenerator: | ||
| def test_XcffibTest_generator(self): | ||
| try: | ||
| old_display = os.environ['DISPLAY'] | ||
| old_display = os.environ["DISPLAY"] | ||
| except KeyError: | ||
@@ -225,3 +217,3 @@ old_display = "" | ||
| with XcffibTest(width=1001, height=502) as test: | ||
| assert os.environ['DISPLAY'] != old_display | ||
| assert os.environ["DISPLAY"] != old_display | ||
| setup = test.conn.get_setup() | ||
@@ -228,0 +220,0 @@ screen = setup.roots[0] |
+23
-11
@@ -31,3 +31,5 @@ import xcffib | ||
| conn.render = conn(xcffib.render.key) | ||
| conn.render.QueryVersion(xcffib.render.MAJOR_VERSION, xcffib.render.MINOR_VERSION) | ||
| conn.render.QueryVersion( | ||
| xcffib.render.MAJOR_VERSION, xcffib.render.MINOR_VERSION | ||
| ) | ||
@@ -69,8 +71,12 @@ window = conn.generate_id() | ||
| xcffib.render.POINTFIX.synthetic(0, 0), | ||
| xcffib.render.POINTFIX.synthetic(double_to_fixed(WIDTH), double_to_fixed(HEIGHT)), | ||
| xcffib.render.POINTFIX.synthetic( | ||
| double_to_fixed(WIDTH), double_to_fixed(HEIGHT) | ||
| ), | ||
| 2, | ||
| [0, double_to_fixed(1)], | ||
| [ | ||
| xcffib.render.COLOR.synthetic(0, 0, 0, 0xffff), # Solid black | ||
| xcffib.render.COLOR.synthetic(0xffff, 0xffff, 0xffff, 0xffff), # Solid white | ||
| xcffib.render.COLOR.synthetic(0, 0, 0, 0xFFFF), # Solid black | ||
| xcffib.render.COLOR.synthetic( | ||
| 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF | ||
| ), # Solid white | ||
| ], | ||
@@ -85,6 +91,10 @@ ).check() | ||
| pic_window, | ||
| 0, 0, | ||
| 0, 0, | ||
| 0, 0, | ||
| WIDTH, HEIGHT | ||
| 0, | ||
| 0, | ||
| 0, | ||
| 0, | ||
| 0, | ||
| 0, | ||
| WIDTH, | ||
| HEIGHT, | ||
| ) | ||
@@ -95,5 +105,7 @@ | ||
| window, | ||
| 0, 0, | ||
| WIDTH, HEIGHT, | ||
| 0xffffffff | ||
| 0, | ||
| 0, | ||
| WIDTH, | ||
| HEIGHT, | ||
| 0xFFFFFFFF, | ||
| ).reply() | ||
@@ -100,0 +112,0 @@ |
+3
-6
@@ -1,7 +0,2 @@ | ||
| import xcffib | ||
| import xcffib.xproto | ||
| def test_query_rules_names(xproto_test): | ||
| setup = xproto_test.conn.get_setup() | ||
| root = xproto_test.default_screen.root | ||
@@ -13,3 +8,5 @@ | ||
| # should be enough for anybody... | ||
| prop = xproto_test.xproto.GetProperty(False, root, xkb_rules_names, string, 0, 64 * 1024).reply() | ||
| prop = xproto_test.xproto.GetProperty( | ||
| False, root, xkb_rules_names, string, 0, 64 * 1024 | ||
| ).reply() | ||
@@ -16,0 +13,0 @@ strings = prop.value.to_nullsep_string() |
| Metadata-Version: 2.1 | ||
| Name: xcffib | ||
| Version: 1.7.1 | ||
| Version: 1.8.0 | ||
| Summary: xcffib is the XCB binding for python | ||
@@ -5,0 +5,0 @@ Home-page: http://github.com/tych0/xcffib |
+93
-89
@@ -38,3 +38,3 @@ # Copyright 2014 Tycho Andersen | ||
| __xcb_proto_version__ = "1.17.0" | ||
| __version__ = "1.7.1" | ||
| __version__ = "1.8.0" | ||
@@ -87,3 +87,2 @@ X_PROTOCOL = lib.X_PROTOCOL | ||
| class Unpacker(object): | ||
| def __init__(self, known_max=None): | ||
@@ -136,3 +135,2 @@ self.size = 0 | ||
| class CffiUnpacker(Unpacker): | ||
| def __init__(self, cdata, known_max=None): | ||
@@ -157,3 +155,2 @@ self.cdata = cdata | ||
| class MemoryUnpacker(Unpacker): | ||
| def __init__(self, buf): | ||
@@ -176,8 +173,8 @@ self.buf = buf | ||
| def popcount(n): | ||
| return bin(n).count('1') | ||
| return bin(n).count("1") | ||
| class XcffibException(Exception): | ||
| """Generic XcbException; replaces xcb.Exception.""" | ||
| """ Generic XcbException; replaces xcb.Exception. """ | ||
| pass | ||
@@ -193,19 +190,23 @@ | ||
| lib.XCB_CONN_ERROR: ( | ||
| 'xcb connection errors because of socket, ' | ||
| 'pipe and other stream errors.'), | ||
| "xcb connection errors because of socket, pipe and other stream errors." | ||
| ), | ||
| lib.XCB_CONN_CLOSED_EXT_NOTSUPPORTED: ( | ||
| 'xcb connection shutdown because extension not supported'), | ||
| "xcb connection shutdown because extension not supported" | ||
| ), | ||
| lib.XCB_CONN_CLOSED_MEM_INSUFFICIENT: ( | ||
| 'malloc(), calloc() and realloc() error upon failure, ' | ||
| 'for eg ENOMEM'), | ||
| "malloc(), calloc() and realloc() error upon failure, for eg ENOMEM" | ||
| ), | ||
| lib.XCB_CONN_CLOSED_REQ_LEN_EXCEED: ( | ||
| 'Connection closed, exceeding request length that server ' | ||
| 'accepts.'), | ||
| "Connection closed, exceeding request length that server accepts." | ||
| ), | ||
| lib.XCB_CONN_CLOSED_PARSE_ERR: ( | ||
| 'Connection closed, error during parsing display string.'), | ||
| "Connection closed, error during parsing display string." | ||
| ), | ||
| lib.XCB_CONN_CLOSED_INVALID_SCREEN: ( | ||
| 'Connection closed because the server does not have a screen ' | ||
| 'matching the display.'), | ||
| "Connection closed because the server does not have a screen " | ||
| "matching the display." | ||
| ), | ||
| lib.XCB_CONN_CLOSED_FDPASSING_FAILED: ( | ||
| 'Connection closed because some FD passing operation failed'), | ||
| "Connection closed because some FD passing operation failed" | ||
| ), | ||
| } | ||
@@ -215,3 +216,4 @@ | ||
| XcffibException.__init__( | ||
| self, self.REASONS.get(err, "Unknown connection error.")) | ||
| self, self.REASONS.get(err, "Unknown connection error.") | ||
| ) | ||
@@ -239,4 +241,3 @@ | ||
| if not issubclass(value, Extension): | ||
| raise XcffibException( | ||
| "Extension type not derived from xcffib.Extension") | ||
| raise XcffibException("Extension type not derived from xcffib.Extension") | ||
| if not issubclass(__setup, Struct): | ||
@@ -258,4 +259,3 @@ raise XcffibException("Setup type not derived from xcffib.Struct") | ||
| if not issubclass(value, Extension): | ||
| raise XcffibException( | ||
| "Extension type not derived from xcffib.Extension") | ||
| raise XcffibException("Extension type not derived from xcffib.Extension") | ||
| extensions[key] = (value, events, errors) | ||
@@ -265,9 +265,8 @@ | ||
| class ExtensionKey(object): | ||
| """ This definitely isn't needed, but we keep it around for compatibility | ||
| with xpyb. | ||
| """ | ||
| def __init__(self, name): | ||
| self.name = name | ||
| self.c_key = ffi.new("struct xcb_extension_t *") | ||
| self.c_name = ffi.new("char[]", self.name.encode()) | ||
| self.c_key.name = self.c_name | ||
| self.c_key.global_id = 0 | ||
@@ -283,15 +282,5 @@ def __hash__(self): | ||
| def to_cffi(self): | ||
| c_key = ffi.new("struct xcb_extension_t *") | ||
| c_key.name = name = ffi.new('char[]', self.name.encode()) | ||
| cffi_explicit_lifetimes[c_key] = name | ||
| # xpyb doesn't ever set global_id, which seems wrong, but whatever. | ||
| c_key.global_id = 0 | ||
| return c_key | ||
| class Protobj(object): | ||
| """ Note: Unlike xcb.Protobj, this does NOT implement the sequence | ||
| """Note: Unlike xcb.Protobj, this does NOT implement the sequence | ||
| protocol. I found this behavior confusing: Protobj would implement the | ||
@@ -351,3 +340,4 @@ sequence protocol on self.buf, and then List would go and implement it on | ||
| assert self.is_checked and self.reply_type is None, ( | ||
| "Request is not void and checked") | ||
| "Request is not void and checked" | ||
| ) | ||
| self.conn.request_check(self.sequence) | ||
@@ -360,3 +350,2 @@ | ||
| class VoidCookie(Cookie): | ||
| def reply(self): | ||
@@ -367,3 +356,2 @@ raise XcffibException("No reply for this message type") | ||
| class Extension(object): | ||
| def __init__(self, conn, key=None): | ||
@@ -375,8 +363,7 @@ self.conn = conn | ||
| else: | ||
| c_key = key.to_cffi() | ||
| cffi_explicit_lifetimes[self] = c_key | ||
| self.c_key = c_key | ||
| self.c_key = key.c_key | ||
| def send_request(self, opcode, data, cookie=VoidCookie, reply=None, | ||
| is_checked=False): | ||
| def send_request( | ||
| self, opcode, data, cookie=VoidCookie, reply=None, is_checked=False | ||
| ): | ||
| data = data.getvalue() | ||
@@ -401,3 +388,3 @@ | ||
| # the function. | ||
| xcb_parts[2].iov_base = iov_base = ffi.new('char[]', data) # noqa | ||
| xcb_parts[2].iov_base = iov_base = ffi.new("char[]", data) # noqa | ||
| xcb_parts[2].iov_len = len(data) | ||
@@ -415,6 +402,6 @@ xcb_parts[3].iov_base = ffi.NULL | ||
| if name.endswith("Checked"): | ||
| real = name[:-len("Checked")] | ||
| real = name[: -len("Checked")] | ||
| is_checked = True | ||
| elif name.endswith("Unchecked"): | ||
| real = name[:-len("Unchecked")] | ||
| real = name[: -len("Unchecked")] | ||
| is_checked = False | ||
@@ -430,5 +417,5 @@ else: | ||
| class List(Protobj): | ||
| def __init__(self, unpacker, typ, count=None): | ||
| Protobj.__init__(self, unpacker) | ||
| self.typ = typ | ||
@@ -452,3 +439,3 @@ self.list = [] | ||
| self.raw = bytes(unpacker.buf[old:old + self.bufsize]) | ||
| self.raw = bytes(unpacker.buf[old : old + self.bufsize]) | ||
@@ -475,22 +462,31 @@ assert count is None or count == len(self.list) | ||
| def __repr__(self): | ||
| # the spec uses both CHAR8 and VOID to indicate strings, we stringify | ||
| # both here. this is of course a heuristic, because it uses VOID to | ||
| # mean other things, but this just debug code, so it's probably fine... | ||
| if self.typ in ["c", "B"]: | ||
| return "\"" + self.to_string() + "\"" | ||
| else: | ||
| return "[" + ", ".join(repr(i) for i in self) + "]" | ||
| def to_string(self): | ||
| """ A helper for converting a List of chars to a native string. Dies if | ||
| """A helper for converting a List of chars to a native string. Dies if | ||
| the list contents are not something that could be reasonably converted | ||
| to a string. """ | ||
| to a string.""" | ||
| try: | ||
| return ''.join(chr(i[0]) for i in self) | ||
| return "".join(chr(i[0]) for i in self) | ||
| except TypeError: | ||
| return ''.join(chr(i) for i in self) | ||
| return "".join(chr(i) for i in self) | ||
| def to_nullsep_string(self) -> list[str]: | ||
| """ A helper for converting a List of chars to a list of native | ||
| strings, starting a new string each time a null (i.e. \\x00) is seen. """ | ||
| """A helper for converting a List of chars to a list of native | ||
| strings, starting a new string each time a null (i.e. \\x00) is seen.""" | ||
| return self.to_string().split("\x00") | ||
| def to_utf8(self): | ||
| return b''.join(self).decode('utf-8') | ||
| return b"".join(self).decode("utf-8") | ||
| def to_atoms(self): | ||
| """ A helper for converting a List of chars to an array of atoms """ | ||
| return struct.unpack("<" + "%dI" % (len(self) // 4), b''.join(self)) | ||
| """A helper for converting a List of chars to an array of atoms""" | ||
| return struct.unpack("<" + "%dI" % (len(self) // 4), b"".join(self)) | ||
@@ -511,3 +507,2 @@ def buf(self): | ||
| class OffsetMap(object): | ||
| def __init__(self, core): | ||
@@ -522,3 +517,5 @@ self.offsets = [(0, 0, core)] | ||
| try: | ||
| _, _, things = next((k, opcode, v) for k, opcode, v in self.offsets if opcode == extension) | ||
| _, _, things = next( | ||
| (k, opcode, v) for k, opcode, v in self.offsets if opcode == extension | ||
| ) | ||
| return things[item] | ||
@@ -530,3 +527,5 @@ except StopIteration: | ||
| try: | ||
| offset, _, things = next((k, opcode, v) for k, opcode, v in self.offsets if item >= k) | ||
| offset, _, things = next( | ||
| (k, opcode, v) for k, opcode, v in self.offsets if item >= k | ||
| ) | ||
| return things[item - offset] | ||
@@ -538,13 +537,13 @@ except StopIteration: | ||
| class Connection(object): | ||
| """`auth` here should be '<name>:<data>', a format bequeathed to us from | ||
| xpyb.""" | ||
| """ `auth` here should be '<name>:<data>', a format bequeathed to us from | ||
| xpyb. """ | ||
| def __init__(self, display=None, fd=-1, auth=None): | ||
| if auth is not None: | ||
| [name, data] = auth.split(b':') | ||
| [name, data] = auth.split(b":") | ||
| c_auth = ffi.new("xcb_auth_info_t *") | ||
| c_auth.name = ffi.new('char[]', name) | ||
| c_auth.name = ffi.new("char[]", name) | ||
| c_auth.namelen = len(name) | ||
| c_auth.data = ffi.new('char[]', data) | ||
| c_auth.data = ffi.new("char[]", data) | ||
| c_auth.datalen = len(data) | ||
@@ -557,3 +556,3 @@ else: | ||
| else: | ||
| display = display.encode('latin1') | ||
| display = display.encode("latin1") | ||
@@ -574,4 +573,5 @@ i = ffi.new("int *") | ||
| if core is None: | ||
| raise XcffibException("No core protocol object has been set. " | ||
| "Did you import xcffib.xproto?") | ||
| raise XcffibException( | ||
| "No core protocol object has been set. Did you import xcffib.xproto?" | ||
| ) | ||
@@ -587,6 +587,10 @@ self.core = core(self) | ||
| for key, (_, events, errors) in extensions.items(): | ||
| # We're explicitly not putting this as an argument to the next call | ||
| # as a hack for lifetime management. | ||
| c_ext = key.to_cffi() | ||
| reply = lib.xcb_get_extension_data(self._conn, c_ext) | ||
| reply = lib.xcb_get_extension_data(self._conn, key.c_key) | ||
| # although it does not say so in the man page, | ||
| # xcb_get_extension_data() will return NULL if the connection has | ||
| # an error. let's guard against this, and do our own connection | ||
| # checking in this case. | ||
| if reply == ffi.NULL: | ||
| self.invalid() | ||
| raise XcffibException("uh oh... connection valid but xcb_get_extension_data() returned NULL?") | ||
| self._event_offsets.add(reply.first_event, reply.major_opcode, events) | ||
@@ -610,2 +614,3 @@ self._error_offsets.add(reply.first_error, reply.major_opcode, errors) | ||
| """ | ||
| @functools.wraps(f) | ||
@@ -619,2 +624,3 @@ def wrapper(*args): | ||
| self.invalid() | ||
| return wrapper | ||
@@ -730,3 +736,3 @@ | ||
| def hoist_event(self, e): | ||
| """ Hoist an xcb_generic_event_t to the right xcffib structure. """ | ||
| """Hoist an xcb_generic_event_t to the right xcffib structure.""" | ||
| if e.response_type == 0: | ||
@@ -739,3 +745,3 @@ return self._process_error(ffi.cast("xcb_generic_error_t *", e)) | ||
| # cares about it. | ||
| response_type = e.response_type & 0x7f | ||
| response_type = e.response_type & 0x7F | ||
@@ -776,3 +782,2 @@ buf = CffiUnpacker(e) | ||
| class Response(Protobj): | ||
| def __init__(self, unpacker): | ||
@@ -798,3 +803,2 @@ Protobj.__init__(self, unpacker) | ||
| class Reply(Response): | ||
| def __init__(self, unpacker): | ||
@@ -809,3 +813,2 @@ Response.__init__(self, unpacker) | ||
| class Event(Response): | ||
| def __init__(self, unpacker): | ||
@@ -819,7 +822,8 @@ # This is here for debugging purposes! | ||
| if self.xge and isinstance(unpacker, CffiUnpacker): | ||
| self.extension, self.length, self.event_type, self.full_sequence = unpacker.unpack("xB2xIH22xI") | ||
| self.extension, self.length, self.event_type, self.full_sequence = ( | ||
| unpacker.unpack("xB2xIH22xI") | ||
| ) | ||
| # There's some extra work to do if the event has data past the 32 byte boundary | ||
| if self.length: | ||
| # Calculate the size of the original buffer. This is 4 bytes short as it seems to omit the `full_sequence` field | ||
@@ -832,3 +836,3 @@ buffer_size = 32 + (self.length * 4) + 4 | ||
| # Copy the event to the new buffer and skip the `full_sequence` field | ||
| buffer[32:buffer_size - 5] = buffer[36: buffer_size - 1] | ||
| buffer[32 : buffer_size - 5] = buffer[36 : buffer_size - 1] | ||
@@ -844,11 +848,10 @@ # Provide the resized buffer to the unpacker | ||
| class Error(Response, XcffibException): | ||
| def __init__(self, unpacker): | ||
| Response.__init__(self, unpacker) | ||
| XcffibException.__init__(self) | ||
| self.code = unpacker.unpack('B', increment=False) | ||
| self.code = unpacker.unpack("B", increment=False) | ||
| def pack_list(from_, pack_type): | ||
| """ Return the wire packed version of `from_`. `pack_type` should be some | ||
| """Return the wire packed version of `from_`. `pack_type` should be some | ||
| subclass of `xcffib.Struct`, or a string that can be passed to | ||
@@ -861,3 +864,3 @@ `struct.pack`. You must pass `size` if `pack_type` is a struct.pack string. | ||
| if pack_type == 'c': | ||
| if pack_type == "c": | ||
| if isinstance(from_, bytes): | ||
@@ -873,3 +876,3 @@ # Catch Python 3 bytes and Python 2 strings | ||
| # Here we create the tuple of bytes from the encoded string | ||
| from_ = [bytes((b,)) for b in bytearray(from_, 'utf-8')] | ||
| from_ = [bytes((b,)) for b in bytearray(from_, "utf-8")] | ||
| elif isinstance(from_[0], int): | ||
@@ -882,2 +885,3 @@ # Pack from_ as char array, where from_ may be an array of ints | ||
| yield r | ||
| from_ = [bytes((b,)) for i in from_ for b in to_bytes(i)] | ||
@@ -901,3 +905,3 @@ | ||
| def wrap(ptr): | ||
| c_conn = ffi.cast('xcb_connection_t *', ptr) | ||
| c_conn = ffi.cast("xcb_connection_t *", ptr) | ||
| conn = Connection.__new__(Connection) | ||
@@ -904,0 +908,0 @@ conn._conn = c_conn |
+15
-1
| import xcffib | ||
| import struct | ||
| import io | ||
| from dataclasses import dataclass | ||
| MAJOR_VERSION = 0 | ||
@@ -9,4 +11,8 @@ MINOR_VERSION = 0 | ||
| _errors = {} | ||
| @dataclass(init=False) | ||
| class EnableReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -17,6 +23,12 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.maximum_request_length, = unpacker.unpack("xx2x4xI") | ||
| (self.maximum_request_length,) = unpacker.unpack("xx2x4xI") | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class EnableCookie(xcffib.Cookie): | ||
| reply_type = EnableReply | ||
| @dataclass(init=False) | ||
| class bigreqExtension(xcffib.Extension): | ||
@@ -27,2 +39,4 @@ def Enable(self, is_checked=True): | ||
| return self.send_request(0, buf, EnableCookie, is_checked=is_checked) | ||
| xcffib._add_ext(key, bigreqExtension, _events, _errors) |
+33
-1
| import xcffib | ||
| import struct | ||
| import io | ||
| from dataclasses import dataclass | ||
| MAJOR_VERSION = 0 | ||
@@ -11,7 +13,14 @@ MINOR_VERSION = 4 | ||
| from . import xfixes | ||
| @dataclass(init=False) | ||
| class Redirect: | ||
| Automatic = 0 | ||
| Manual = 1 | ||
| @dataclass(init=False) | ||
| class QueryVersionReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -24,6 +33,13 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class QueryVersionCookie(xcffib.Cookie): | ||
| reply_type = QueryVersionReply | ||
| @dataclass(init=False) | ||
| class GetOverlayWindowReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -34,6 +50,12 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.overlay_win, = unpacker.unpack("xx2x4xI20x") | ||
| (self.overlay_win,) = unpacker.unpack("xx2x4xI20x") | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetOverlayWindowCookie(xcffib.Cookie): | ||
| reply_type = GetOverlayWindowReply | ||
| @dataclass(init=False) | ||
| class compositeExtension(xcffib.Extension): | ||
@@ -44,2 +66,3 @@ def QueryVersion(self, client_major_version, client_minor_version, is_checked=True): | ||
| return self.send_request(0, buf, QueryVersionCookie, is_checked=is_checked) | ||
| def RedirectWindow(self, window, update, is_checked=False): | ||
@@ -49,2 +72,3 @@ buf = io.BytesIO() | ||
| return self.send_request(1, buf, is_checked=is_checked) | ||
| def RedirectSubwindows(self, window, update, is_checked=False): | ||
@@ -54,2 +78,3 @@ buf = io.BytesIO() | ||
| return self.send_request(2, buf, is_checked=is_checked) | ||
| def UnredirectWindow(self, window, update, is_checked=False): | ||
@@ -59,2 +84,3 @@ buf = io.BytesIO() | ||
| return self.send_request(3, buf, is_checked=is_checked) | ||
| def UnredirectSubwindows(self, window, update, is_checked=False): | ||
@@ -64,2 +90,3 @@ buf = io.BytesIO() | ||
| return self.send_request(4, buf, is_checked=is_checked) | ||
| def CreateRegionFromBorderClip(self, region, window, is_checked=False): | ||
@@ -69,2 +96,3 @@ buf = io.BytesIO() | ||
| return self.send_request(5, buf, is_checked=is_checked) | ||
| def NameWindowPixmap(self, window, pixmap, is_checked=False): | ||
@@ -74,2 +102,3 @@ buf = io.BytesIO() | ||
| return self.send_request(6, buf, is_checked=is_checked) | ||
| def GetOverlayWindow(self, window, is_checked=True): | ||
@@ -79,2 +108,3 @@ buf = io.BytesIO() | ||
| return self.send_request(7, buf, GetOverlayWindowCookie, is_checked=is_checked) | ||
| def ReleaseOverlayWindow(self, window, is_checked=False): | ||
@@ -84,2 +114,4 @@ buf = io.BytesIO() | ||
| return self.send_request(8, buf, is_checked=is_checked) | ||
| xcffib._add_ext(key, compositeExtension, _events, _errors) |
+54
-4
| import xcffib | ||
| import struct | ||
| import io | ||
| from dataclasses import dataclass | ||
| MAJOR_VERSION = 1 | ||
@@ -11,2 +13,5 @@ MINOR_VERSION = 1 | ||
| from . import xfixes | ||
| @dataclass(init=False) | ||
| class ReportLevel: | ||
@@ -17,4 +22,8 @@ RawRectangles = 0 | ||
| NonEmpty = 3 | ||
| @dataclass(init=False) | ||
| class BadDamageError(xcffib.Error): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -27,2 +36,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -33,6 +43,12 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| BadBadDamage = BadDamageError | ||
| _errors[0] = BadDamageError | ||
| @dataclass(init=False) | ||
| class QueryVersionReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -45,6 +61,13 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class QueryVersionCookie(xcffib.Cookie): | ||
| reply_type = QueryVersionReply | ||
| @dataclass(init=False) | ||
| class NotifyEvent(xcffib.Event): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -55,3 +78,5 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.level, self.drawable, self.damage, self.timestamp = unpacker.unpack("xB2xIII") | ||
| self.level, self.drawable, self.damage, self.timestamp = unpacker.unpack( | ||
| "xB2xIII" | ||
| ) | ||
| self.area = xproto.RECTANGLE(unpacker) | ||
@@ -61,8 +86,21 @@ unpacker.pad(xproto.RECTANGLE) | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=B", 0)) | ||
| buf.write(struct.pack("=B2xIII", self.level, self.drawable, self.damage, self.timestamp)) | ||
| buf.write(self.area.pack() if hasattr(self.area, "pack") else xproto.RECTANGLE.synthetic(*self.area).pack()) | ||
| buf.write(self.geometry.pack() if hasattr(self.geometry, "pack") else xproto.RECTANGLE.synthetic(*self.geometry).pack()) | ||
| buf.write( | ||
| struct.pack( | ||
| "=B2xIII", self.level, self.drawable, self.damage, self.timestamp | ||
| ) | ||
| ) | ||
| buf.write( | ||
| self.area.pack() | ||
| if hasattr(self.area, "pack") | ||
| else xproto.RECTANGLE.synthetic(*self.area).pack() | ||
| ) | ||
| buf.write( | ||
| self.geometry.pack() | ||
| if hasattr(self.geometry, "pack") | ||
| else xproto.RECTANGLE.synthetic(*self.geometry).pack() | ||
| ) | ||
| buf_len = len(buf.getvalue()) | ||
@@ -72,2 +110,3 @@ if buf_len < 32: | ||
| return buf.getvalue() | ||
| @classmethod | ||
@@ -83,3 +122,8 @@ def synthetic(cls, level, drawable, damage, timestamp, area, geometry): | ||
| return self | ||
| _events[0] = NotifyEvent | ||
| @dataclass(init=False) | ||
| class damageExtension(xcffib.Extension): | ||
@@ -90,2 +134,3 @@ def QueryVersion(self, client_major_version, client_minor_version, is_checked=True): | ||
| return self.send_request(0, buf, QueryVersionCookie, is_checked=is_checked) | ||
| def Create(self, damage, drawable, level, is_checked=False): | ||
@@ -95,2 +140,3 @@ buf = io.BytesIO() | ||
| return self.send_request(1, buf, is_checked=is_checked) | ||
| def Destroy(self, damage, is_checked=False): | ||
@@ -100,2 +146,3 @@ buf = io.BytesIO() | ||
| return self.send_request(2, buf, is_checked=is_checked) | ||
| def Subtract(self, damage, repair, parts, is_checked=False): | ||
@@ -105,2 +152,3 @@ buf = io.BytesIO() | ||
| return self.send_request(3, buf, is_checked=is_checked) | ||
| def Add(self, drawable, region, is_checked=False): | ||
@@ -110,2 +158,4 @@ buf = io.BytesIO() | ||
| return self.send_request(4, buf, is_checked=is_checked) | ||
| xcffib._add_ext(key, damageExtension, _events, _errors) |
+82
-6
| import xcffib | ||
| import struct | ||
| import io | ||
| from dataclasses import dataclass | ||
| MAJOR_VERSION = 1 | ||
@@ -10,2 +12,5 @@ MINOR_VERSION = 0 | ||
| from . import xproto | ||
| @dataclass(init=False) | ||
| class SwapAction: | ||
@@ -16,4 +21,8 @@ Undefined = 0 | ||
| Copied = 3 | ||
| @dataclass(init=False) | ||
| class SwapInfo(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -26,2 +35,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -31,3 +41,5 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| fixed_size = 8 | ||
| @classmethod | ||
@@ -39,4 +51,8 @@ def synthetic(cls, window, swap_action): | ||
| return self | ||
| @dataclass(init=False) | ||
| class BufferAttributes(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -47,4 +63,5 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.window, = unpacker.unpack("I") | ||
| (self.window,) = unpacker.unpack("I") | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -54,3 +71,5 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| fixed_size = 4 | ||
| @classmethod | ||
@@ -61,4 +80,8 @@ def synthetic(cls, window): | ||
| return self | ||
| @dataclass(init=False) | ||
| class VisualInfo(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -71,2 +94,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -76,3 +100,5 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| fixed_size = 8 | ||
| @classmethod | ||
@@ -85,4 +111,8 @@ def synthetic(cls, visual_id, depth, perf_level): | ||
| return self | ||
| @dataclass(init=False) | ||
| class VisualInfos(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -93,5 +123,6 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.n_infos, = unpacker.unpack("I") | ||
| (self.n_infos,) = unpacker.unpack("I") | ||
| self.infos = xcffib.List(unpacker, VisualInfo, self.n_infos) | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -102,2 +133,3 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| @classmethod | ||
@@ -109,4 +141,8 @@ def synthetic(cls, n_infos, infos): | ||
| return self | ||
| @dataclass(init=False) | ||
| class BadBufferError(xcffib.Error): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -117,4 +153,5 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.bad_buffer, = unpacker.unpack("xx2xI") | ||
| (self.bad_buffer,) = unpacker.unpack("xx2xI") | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -125,6 +162,12 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| BadBadBuffer = BadBufferError | ||
| _errors[0] = BadBufferError | ||
| @dataclass(init=False) | ||
| class QueryVersionReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -137,6 +180,13 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class QueryVersionCookie(xcffib.Cookie): | ||
| reply_type = QueryVersionReply | ||
| @dataclass(init=False) | ||
| class GetVisualInfoReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -147,9 +197,18 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.n_supported_visuals, = unpacker.unpack("xx2x4xI20x") | ||
| self.supported_visuals = xcffib.List(unpacker, VisualInfos, self.n_supported_visuals) | ||
| (self.n_supported_visuals,) = unpacker.unpack("xx2x4xI20x") | ||
| self.supported_visuals = xcffib.List( | ||
| unpacker, VisualInfos, self.n_supported_visuals | ||
| ) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetVisualInfoCookie(xcffib.Cookie): | ||
| reply_type = GetVisualInfoReply | ||
| @dataclass(init=False) | ||
| class GetBackBufferAttributesReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -164,4 +223,10 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetBackBufferAttributesCookie(xcffib.Cookie): | ||
| reply_type = GetBackBufferAttributesReply | ||
| @dataclass(init=False) | ||
| class dbeExtension(xcffib.Extension): | ||
@@ -172,2 +237,3 @@ def QueryVersion(self, major_version, minor_version, is_checked=True): | ||
| return self.send_request(0, buf, QueryVersionCookie, is_checked=is_checked) | ||
| def AllocateBackBuffer(self, window, buffer, swap_action, is_checked=False): | ||
@@ -177,2 +243,3 @@ buf = io.BytesIO() | ||
| return self.send_request(1, buf, is_checked=is_checked) | ||
| def DeallocateBackBuffer(self, buffer, is_checked=False): | ||
@@ -182,2 +249,3 @@ buf = io.BytesIO() | ||
| return self.send_request(2, buf, is_checked=is_checked) | ||
| def SwapBuffers(self, n_actions, actions, is_checked=False): | ||
@@ -188,2 +256,3 @@ buf = io.BytesIO() | ||
| return self.send_request(3, buf, is_checked=is_checked) | ||
| def BeginIdiom(self, is_checked=False): | ||
@@ -193,2 +262,3 @@ buf = io.BytesIO() | ||
| return self.send_request(4, buf, is_checked=is_checked) | ||
| def EndIdiom(self, is_checked=False): | ||
@@ -198,2 +268,3 @@ buf = io.BytesIO() | ||
| return self.send_request(5, buf, is_checked=is_checked) | ||
| def GetVisualInfo(self, n_drawables, drawables, is_checked=True): | ||
@@ -204,6 +275,11 @@ buf = io.BytesIO() | ||
| return self.send_request(6, buf, GetVisualInfoCookie, is_checked=is_checked) | ||
| def GetBackBufferAttributes(self, buffer, is_checked=True): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xI", buffer)) | ||
| return self.send_request(7, buf, GetBackBufferAttributesCookie, is_checked=is_checked) | ||
| return self.send_request( | ||
| 7, buf, GetBackBufferAttributesCookie, is_checked=is_checked | ||
| ) | ||
| xcffib._add_ext(key, dbeExtension, _events, _errors) |
+73
-6
| import xcffib | ||
| import struct | ||
| import io | ||
| from dataclasses import dataclass | ||
| MAJOR_VERSION = 1 | ||
@@ -10,4 +12,8 @@ MINOR_VERSION = 2 | ||
| from . import xproto | ||
| @dataclass(init=False) | ||
| class GetVersionReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -18,8 +24,17 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.server_major_version, self.server_minor_version = unpacker.unpack("xx2x4xHH") | ||
| self.server_major_version, self.server_minor_version = unpacker.unpack( | ||
| "xx2x4xHH" | ||
| ) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetVersionCookie(xcffib.Cookie): | ||
| reply_type = GetVersionReply | ||
| @dataclass(init=False) | ||
| class CapableReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -30,8 +45,15 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.capable, = unpacker.unpack("xx2x4xB23x") | ||
| (self.capable,) = unpacker.unpack("xx2x4xB23x") | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class CapableCookie(xcffib.Cookie): | ||
| reply_type = CapableReply | ||
| @dataclass(init=False) | ||
| class GetTimeoutsReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -42,6 +64,14 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.standby_timeout, self.suspend_timeout, self.off_timeout = unpacker.unpack("xx2x4xHHH18x") | ||
| self.standby_timeout, self.suspend_timeout, self.off_timeout = unpacker.unpack( | ||
| "xx2x4xHHH18x" | ||
| ) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetTimeoutsCookie(xcffib.Cookie): | ||
| reply_type = GetTimeoutsReply | ||
| @dataclass(init=False) | ||
| class DPMSMode: | ||
@@ -52,4 +82,8 @@ On = 0 | ||
| Off = 3 | ||
| @dataclass(init=False) | ||
| class InfoReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -62,8 +96,18 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class InfoCookie(xcffib.Cookie): | ||
| reply_type = InfoReply | ||
| @dataclass(init=False) | ||
| class EventMask: | ||
| InfoNotify = 1 << 0 | ||
| @dataclass(init=False) | ||
| class InfoNotifyEvent(xcffib.Event): | ||
| xge = True | ||
| def __init__(self, unpacker): | ||
@@ -76,6 +120,9 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=B", 0)) | ||
| buf.write(struct.pack("=x2x2xIHB21x", self.timestamp, self.power_level, self.state)) | ||
| buf.write( | ||
| struct.pack("=x2x2xIHB21x", self.timestamp, self.power_level, self.state) | ||
| ) | ||
| buf_len = len(buf.getvalue()) | ||
@@ -85,2 +132,3 @@ if buf_len < 32: | ||
| return buf.getvalue() | ||
| @classmethod | ||
@@ -93,3 +141,8 @@ def synthetic(cls, timestamp, power_level, state): | ||
| return self | ||
| _events[0] = InfoNotifyEvent | ||
| @dataclass(init=False) | ||
| class dpmsExtension(xcffib.Extension): | ||
@@ -100,2 +153,3 @@ def GetVersion(self, client_major_version, client_minor_version, is_checked=True): | ||
| return self.send_request(0, buf, GetVersionCookie, is_checked=is_checked) | ||
| def Capable(self, is_checked=True): | ||
@@ -105,2 +159,3 @@ buf = io.BytesIO() | ||
| return self.send_request(1, buf, CapableCookie, is_checked=is_checked) | ||
| def GetTimeouts(self, is_checked=True): | ||
@@ -110,6 +165,12 @@ buf = io.BytesIO() | ||
| return self.send_request(2, buf, GetTimeoutsCookie, is_checked=is_checked) | ||
| def SetTimeouts(self, standby_timeout, suspend_timeout, off_timeout, is_checked=False): | ||
| def SetTimeouts( | ||
| self, standby_timeout, suspend_timeout, off_timeout, is_checked=False | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xHHH", standby_timeout, suspend_timeout, off_timeout)) | ||
| buf.write( | ||
| struct.pack("=xx2xHHH", standby_timeout, suspend_timeout, off_timeout) | ||
| ) | ||
| return self.send_request(3, buf, is_checked=is_checked) | ||
| def Enable(self, is_checked=False): | ||
@@ -119,2 +180,3 @@ buf = io.BytesIO() | ||
| return self.send_request(4, buf, is_checked=is_checked) | ||
| def Disable(self, is_checked=False): | ||
@@ -124,2 +186,3 @@ buf = io.BytesIO() | ||
| return self.send_request(5, buf, is_checked=is_checked) | ||
| def ForceLevel(self, power_level, is_checked=False): | ||
@@ -129,2 +192,3 @@ buf = io.BytesIO() | ||
| return self.send_request(6, buf, is_checked=is_checked) | ||
| def Info(self, is_checked=True): | ||
@@ -134,2 +198,3 @@ buf = io.BytesIO() | ||
| return self.send_request(7, buf, InfoCookie, is_checked=is_checked) | ||
| def SelectInput(self, event_mask, is_checked=False): | ||
@@ -139,2 +204,4 @@ buf = io.BytesIO() | ||
| return self.send_request(8, buf, is_checked=is_checked) | ||
| xcffib._add_ext(key, dpmsExtension, _events, _errors) |
+242
-19
| import xcffib | ||
| import struct | ||
| import io | ||
| from dataclasses import dataclass | ||
| MAJOR_VERSION = 1 | ||
@@ -10,2 +12,5 @@ MINOR_VERSION = 4 | ||
| from . import xproto | ||
| @dataclass(init=False) | ||
| class Attachment: | ||
@@ -23,5 +28,11 @@ BufferFrontLeft = 0 | ||
| BufferHiz = 10 | ||
| @dataclass(init=False) | ||
| class DriverType: | ||
| DRI = 0 | ||
| VDPAU = 1 | ||
| @dataclass(init=False) | ||
| class EventType: | ||
@@ -31,4 +42,8 @@ ExchangeComplete = 1 | ||
| FlipComplete = 3 | ||
| @dataclass(init=False) | ||
| class DRI2Buffer(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -39,9 +54,18 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.attachment, self.name, self.pitch, self.cpp, self.flags = unpacker.unpack("IIIII") | ||
| self.attachment, self.name, self.pitch, self.cpp, self.flags = unpacker.unpack( | ||
| "IIIII" | ||
| ) | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=IIIII", self.attachment, self.name, self.pitch, self.cpp, self.flags)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=IIIII", self.attachment, self.name, self.pitch, self.cpp, self.flags | ||
| ) | ||
| ) | ||
| return buf.getvalue() | ||
| fixed_size = 20 | ||
| @classmethod | ||
@@ -56,4 +80,8 @@ def synthetic(cls, attachment, name, pitch, cpp, flags): | ||
| return self | ||
| @dataclass(init=False) | ||
| class AttachFormat(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -66,2 +94,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -71,3 +100,5 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| fixed_size = 8 | ||
| @classmethod | ||
@@ -79,4 +110,8 @@ def synthetic(cls, attachment, format): | ||
| return self | ||
| @dataclass(init=False) | ||
| class QueryVersionReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -89,6 +124,13 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class QueryVersionCookie(xcffib.Cookie): | ||
| reply_type = QueryVersionReply | ||
| @dataclass(init=False) | ||
| class ConnectReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -99,13 +141,26 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.driver_name_length, self.device_name_length = unpacker.unpack("xx2x4xII16x") | ||
| self.driver_name_length, self.device_name_length = unpacker.unpack( | ||
| "xx2x4xII16x" | ||
| ) | ||
| self.driver_name = xcffib.List(unpacker, "c", self.driver_name_length) | ||
| unpacker.pad("c") | ||
| self.alignment_pad = xcffib.List(unpacker, "c", ((self.driver_name_length + 3) & (~3)) - self.driver_name_length) | ||
| self.alignment_pad = xcffib.List( | ||
| unpacker, | ||
| "c", | ||
| ((self.driver_name_length + 3) & (~3)) - self.driver_name_length, | ||
| ) | ||
| unpacker.pad("c") | ||
| self.device_name = xcffib.List(unpacker, "c", self.device_name_length) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class ConnectCookie(xcffib.Cookie): | ||
| reply_type = ConnectReply | ||
| @dataclass(init=False) | ||
| class AuthenticateReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -116,8 +171,15 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.authenticated, = unpacker.unpack("xx2x4xI") | ||
| (self.authenticated,) = unpacker.unpack("xx2x4xI") | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class AuthenticateCookie(xcffib.Cookie): | ||
| reply_type = AuthenticateReply | ||
| @dataclass(init=False) | ||
| class GetBuffersReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -131,6 +193,13 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetBuffersCookie(xcffib.Cookie): | ||
| reply_type = GetBuffersReply | ||
| @dataclass(init=False) | ||
| class CopyRegionReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -143,6 +212,13 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class CopyRegionCookie(xcffib.Cookie): | ||
| reply_type = CopyRegionReply | ||
| @dataclass(init=False) | ||
| class GetBuffersWithFormatReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -156,6 +232,13 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetBuffersWithFormatCookie(xcffib.Cookie): | ||
| reply_type = GetBuffersWithFormatReply | ||
| @dataclass(init=False) | ||
| class SwapBuffersReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -168,6 +251,13 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class SwapBuffersCookie(xcffib.Cookie): | ||
| reply_type = SwapBuffersReply | ||
| @dataclass(init=False) | ||
| class GetMSCReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -178,8 +268,17 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.ust_hi, self.ust_lo, self.msc_hi, self.msc_lo, self.sbc_hi, self.sbc_lo = unpacker.unpack("xx2x4xIIIIII") | ||
| self.ust_hi, self.ust_lo, self.msc_hi, self.msc_lo, self.sbc_hi, self.sbc_lo = ( | ||
| unpacker.unpack("xx2x4xIIIIII") | ||
| ) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetMSCCookie(xcffib.Cookie): | ||
| reply_type = GetMSCReply | ||
| @dataclass(init=False) | ||
| class WaitMSCReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -190,8 +289,17 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.ust_hi, self.ust_lo, self.msc_hi, self.msc_lo, self.sbc_hi, self.sbc_lo = unpacker.unpack("xx2x4xIIIIII") | ||
| self.ust_hi, self.ust_lo, self.msc_hi, self.msc_lo, self.sbc_hi, self.sbc_lo = ( | ||
| unpacker.unpack("xx2x4xIIIIII") | ||
| ) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class WaitMSCCookie(xcffib.Cookie): | ||
| reply_type = WaitMSCReply | ||
| @dataclass(init=False) | ||
| class WaitSBCReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -202,8 +310,17 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.ust_hi, self.ust_lo, self.msc_hi, self.msc_lo, self.sbc_hi, self.sbc_lo = unpacker.unpack("xx2x4xIIIIII") | ||
| self.ust_hi, self.ust_lo, self.msc_hi, self.msc_lo, self.sbc_hi, self.sbc_lo = ( | ||
| unpacker.unpack("xx2x4xIIIIII") | ||
| ) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class WaitSBCCookie(xcffib.Cookie): | ||
| reply_type = WaitSBCReply | ||
| @dataclass(init=False) | ||
| class GetParamReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -214,8 +331,17 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.is_param_recognized, self.value_hi, self.value_lo = unpacker.unpack("xB2x4xII") | ||
| self.is_param_recognized, self.value_hi, self.value_lo = unpacker.unpack( | ||
| "xB2x4xII" | ||
| ) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetParamCookie(xcffib.Cookie): | ||
| reply_type = GetParamReply | ||
| @dataclass(init=False) | ||
| class BufferSwapCompleteEvent(xcffib.Event): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -226,8 +352,28 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.event_type, self.drawable, self.ust_hi, self.ust_lo, self.msc_hi, self.msc_lo, self.sbc = unpacker.unpack("xx2xH2xIIIIII") | ||
| ( | ||
| self.event_type, | ||
| self.drawable, | ||
| self.ust_hi, | ||
| self.ust_lo, | ||
| self.msc_hi, | ||
| self.msc_lo, | ||
| self.sbc, | ||
| ) = unpacker.unpack("xx2xH2xIIIIII") | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=B", 0)) | ||
| buf.write(struct.pack("=x2xH2xIIIIII", self.event_type, self.drawable, self.ust_hi, self.ust_lo, self.msc_hi, self.msc_lo, self.sbc)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=x2xH2xIIIIII", | ||
| self.event_type, | ||
| self.drawable, | ||
| self.ust_hi, | ||
| self.ust_lo, | ||
| self.msc_hi, | ||
| self.msc_lo, | ||
| self.sbc, | ||
| ) | ||
| ) | ||
| buf_len = len(buf.getvalue()) | ||
@@ -237,2 +383,3 @@ if buf_len < 32: | ||
| return buf.getvalue() | ||
| @classmethod | ||
@@ -249,5 +396,11 @@ def synthetic(cls, event_type, drawable, ust_hi, ust_lo, msc_hi, msc_lo, sbc): | ||
| return self | ||
| _events[0] = BufferSwapCompleteEvent | ||
| @dataclass(init=False) | ||
| class InvalidateBuffersEvent(xcffib.Event): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -258,4 +411,5 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.drawable, = unpacker.unpack("xx2xI") | ||
| (self.drawable,) = unpacker.unpack("xx2xI") | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -269,2 +423,3 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| @classmethod | ||
@@ -275,3 +430,8 @@ def synthetic(cls, drawable): | ||
| return self | ||
| _events[1] = InvalidateBuffersEvent | ||
| @dataclass(init=False) | ||
| class dri2Extension(xcffib.Extension): | ||
@@ -282,2 +442,3 @@ def QueryVersion(self, major_version, minor_version, is_checked=True): | ||
| return self.send_request(0, buf, QueryVersionCookie, is_checked=is_checked) | ||
| def Connect(self, window, driver_type, is_checked=True): | ||
@@ -287,2 +448,3 @@ buf = io.BytesIO() | ||
| return self.send_request(1, buf, ConnectCookie, is_checked=is_checked) | ||
| def Authenticate(self, window, magic, is_checked=True): | ||
@@ -292,2 +454,3 @@ buf = io.BytesIO() | ||
| return self.send_request(2, buf, AuthenticateCookie, is_checked=is_checked) | ||
| def CreateDrawable(self, drawable, is_checked=False): | ||
@@ -297,2 +460,3 @@ buf = io.BytesIO() | ||
| return self.send_request(3, buf, is_checked=is_checked) | ||
| def DestroyDrawable(self, drawable, is_checked=False): | ||
@@ -302,3 +466,6 @@ buf = io.BytesIO() | ||
| return self.send_request(4, buf, is_checked=is_checked) | ||
| def GetBuffers(self, drawable, count, attachments_len, attachments, is_checked=True): | ||
| def GetBuffers( | ||
| self, drawable, count, attachments_len, attachments, is_checked=True | ||
| ): | ||
| buf = io.BytesIO() | ||
@@ -308,2 +475,3 @@ buf.write(struct.pack("=xx2xII", drawable, count)) | ||
| return self.send_request(5, buf, GetBuffersCookie, is_checked=is_checked) | ||
| def CopyRegion(self, drawable, region, dest, src, is_checked=True): | ||
@@ -313,11 +481,39 @@ buf = io.BytesIO() | ||
| return self.send_request(6, buf, CopyRegionCookie, is_checked=is_checked) | ||
| def GetBuffersWithFormat(self, drawable, count, attachments_len, attachments, is_checked=True): | ||
| def GetBuffersWithFormat( | ||
| self, drawable, count, attachments_len, attachments, is_checked=True | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xII", drawable, count)) | ||
| buf.write(xcffib.pack_list(attachments, AttachFormat)) | ||
| return self.send_request(7, buf, GetBuffersWithFormatCookie, is_checked=is_checked) | ||
| def SwapBuffers(self, drawable, target_msc_hi, target_msc_lo, divisor_hi, divisor_lo, remainder_hi, remainder_lo, is_checked=True): | ||
| return self.send_request( | ||
| 7, buf, GetBuffersWithFormatCookie, is_checked=is_checked | ||
| ) | ||
| def SwapBuffers( | ||
| self, | ||
| drawable, | ||
| target_msc_hi, | ||
| target_msc_lo, | ||
| divisor_hi, | ||
| divisor_lo, | ||
| remainder_hi, | ||
| remainder_lo, | ||
| is_checked=True, | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xIIIIIII", drawable, target_msc_hi, target_msc_lo, divisor_hi, divisor_lo, remainder_hi, remainder_lo)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=xx2xIIIIIII", | ||
| drawable, | ||
| target_msc_hi, | ||
| target_msc_lo, | ||
| divisor_hi, | ||
| divisor_lo, | ||
| remainder_hi, | ||
| remainder_lo, | ||
| ) | ||
| ) | ||
| return self.send_request(8, buf, SwapBuffersCookie, is_checked=is_checked) | ||
| def GetMSC(self, drawable, is_checked=True): | ||
@@ -327,6 +523,29 @@ buf = io.BytesIO() | ||
| return self.send_request(9, buf, GetMSCCookie, is_checked=is_checked) | ||
| def WaitMSC(self, drawable, target_msc_hi, target_msc_lo, divisor_hi, divisor_lo, remainder_hi, remainder_lo, is_checked=True): | ||
| def WaitMSC( | ||
| self, | ||
| drawable, | ||
| target_msc_hi, | ||
| target_msc_lo, | ||
| divisor_hi, | ||
| divisor_lo, | ||
| remainder_hi, | ||
| remainder_lo, | ||
| is_checked=True, | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xIIIIIII", drawable, target_msc_hi, target_msc_lo, divisor_hi, divisor_lo, remainder_hi, remainder_lo)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=xx2xIIIIIII", | ||
| drawable, | ||
| target_msc_hi, | ||
| target_msc_lo, | ||
| divisor_hi, | ||
| divisor_lo, | ||
| remainder_hi, | ||
| remainder_lo, | ||
| ) | ||
| ) | ||
| return self.send_request(10, buf, WaitMSCCookie, is_checked=is_checked) | ||
| def WaitSBC(self, drawable, target_sbc_hi, target_sbc_lo, is_checked=True): | ||
@@ -336,2 +555,3 @@ buf = io.BytesIO() | ||
| return self.send_request(11, buf, WaitSBCCookie, is_checked=is_checked) | ||
| def SwapInterval(self, drawable, interval, is_checked=False): | ||
@@ -341,2 +561,3 @@ buf = io.BytesIO() | ||
| return self.send_request(12, buf, is_checked=is_checked) | ||
| def GetParam(self, drawable, param, is_checked=True): | ||
@@ -346,2 +567,4 @@ buf = io.BytesIO() | ||
| return self.send_request(13, buf, GetParamCookie, is_checked=is_checked) | ||
| xcffib._add_ext(key, dri2Extension, _events, _errors) |
+81
-5
| import xcffib | ||
| import struct | ||
| import io | ||
| from dataclasses import dataclass | ||
| MAJOR_VERSION = 1 | ||
@@ -10,4 +12,8 @@ MINOR_VERSION = 4 | ||
| from . import xproto | ||
| @dataclass(init=False) | ||
| class QueryVersionReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -20,6 +26,13 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class QueryVersionCookie(xcffib.Cookie): | ||
| reply_type = QueryVersionReply | ||
| @dataclass(init=False) | ||
| class OpenReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -30,8 +43,15 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.nfd, = unpacker.unpack("xB2x4x24x") | ||
| (self.nfd,) = unpacker.unpack("xB2x4x24x") | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class OpenCookie(xcffib.Cookie): | ||
| reply_type = OpenReply | ||
| @dataclass(init=False) | ||
| class BufferFromPixmapReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -42,8 +62,23 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.nfd, self.size, self.width, self.height, self.stride, self.depth, self.bpp = unpacker.unpack("xB2x4xIHHHBB12x") | ||
| ( | ||
| self.nfd, | ||
| self.size, | ||
| self.width, | ||
| self.height, | ||
| self.stride, | ||
| self.depth, | ||
| self.bpp, | ||
| ) = unpacker.unpack("xB2x4xIHHHBB12x") | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class BufferFromPixmapCookie(xcffib.Cookie): | ||
| reply_type = BufferFromPixmapReply | ||
| @dataclass(init=False) | ||
| class FDFromFenceReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -54,6 +89,12 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.nfd, = unpacker.unpack("xB2x4x24x") | ||
| (self.nfd,) = unpacker.unpack("xB2x4x24x") | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class FDFromFenceCookie(xcffib.Cookie): | ||
| reply_type = FDFromFenceReply | ||
| @dataclass(init=False) | ||
| class dri3Extension(xcffib.Extension): | ||
@@ -64,2 +105,3 @@ def QueryVersion(self, major_version, minor_version, is_checked=True): | ||
| return self.send_request(0, buf, QueryVersionCookie, is_checked=is_checked) | ||
| def Open(self, drawable, provider, is_checked=True): | ||
@@ -69,6 +111,31 @@ buf = io.BytesIO() | ||
| return self.send_request(1, buf, OpenCookie, is_checked=is_checked) | ||
| def PixmapFromBuffer(self, pixmap, drawable, size, width, height, stride, depth, bpp, is_checked=False): | ||
| def PixmapFromBuffer( | ||
| self, | ||
| pixmap, | ||
| drawable, | ||
| size, | ||
| width, | ||
| height, | ||
| stride, | ||
| depth, | ||
| bpp, | ||
| is_checked=False, | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xIIIHHHBB", pixmap, drawable, size, width, height, stride, depth, bpp)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=xx2xIIIHHHBB", | ||
| pixmap, | ||
| drawable, | ||
| size, | ||
| width, | ||
| height, | ||
| stride, | ||
| depth, | ||
| bpp, | ||
| ) | ||
| ) | ||
| return self.send_request(2, buf, is_checked=is_checked) | ||
| def BufferFromPixmap(self, pixmap, is_checked=True): | ||
@@ -78,2 +145,3 @@ buf = io.BytesIO() | ||
| return self.send_request(3, buf, BufferFromPixmapCookie, is_checked=is_checked) | ||
| def FenceFromFD(self, drawable, fence, initially_triggered, is_checked=False): | ||
@@ -83,2 +151,3 @@ buf = io.BytesIO() | ||
| return self.send_request(4, buf, is_checked=is_checked) | ||
| def FDFromFence(self, drawable, fence, is_checked=True): | ||
@@ -88,2 +157,3 @@ buf = io.BytesIO() | ||
| return self.send_request(5, buf, FDFromFenceCookie, is_checked=is_checked) | ||
| def GetSupportedModifiers(self, window, depth, bpp, is_checked=False): | ||
@@ -93,2 +163,3 @@ buf = io.BytesIO() | ||
| return self.send_request(6, buf, is_checked=is_checked) | ||
| def BuffersFromPixmap(self, pixmap, is_checked=False): | ||
@@ -98,2 +169,3 @@ buf = io.BytesIO() | ||
| return self.send_request(8, buf, is_checked=is_checked) | ||
| def SetDRMDeviceInUse(self, window, drmMajor, drmMinor, is_checked=False): | ||
@@ -103,2 +175,3 @@ buf = io.BytesIO() | ||
| return self.send_request(9, buf, is_checked=is_checked) | ||
| def ImportSyncobj(self, syncobj, drawable, is_checked=False): | ||
@@ -108,2 +181,3 @@ buf = io.BytesIO() | ||
| return self.send_request(10, buf, is_checked=is_checked) | ||
| def FreeSyncobj(self, syncobj, is_checked=False): | ||
@@ -113,2 +187,4 @@ buf = io.BytesIO() | ||
| return self.send_request(11, buf, is_checked=is_checked) | ||
| xcffib._add_ext(key, dri3Extension, _events, _errors) |
+14
-0
| import xcffib | ||
| import struct | ||
| import io | ||
| from dataclasses import dataclass | ||
| MAJOR_VERSION = 1 | ||
@@ -9,4 +11,8 @@ MINOR_VERSION = 0 | ||
| _errors = {} | ||
| @dataclass(init=False) | ||
| class QueryVersionReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -19,4 +25,10 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class QueryVersionCookie(xcffib.Cookie): | ||
| reply_type = QueryVersionReply | ||
| @dataclass(init=False) | ||
| class geExtension(xcffib.Extension): | ||
@@ -27,2 +39,4 @@ def QueryVersion(self, client_major_version, client_minor_version, is_checked=True): | ||
| return self.send_request(0, buf, QueryVersionCookie, is_checked=is_checked) | ||
| xcffib._add_ext(key, geExtension, _events, _errors) |
+137
-8
| import xcffib | ||
| import struct | ||
| import io | ||
| from dataclasses import dataclass | ||
| MAJOR_VERSION = 1 | ||
@@ -14,2 +16,5 @@ MINOR_VERSION = 4 | ||
| from . import dri3 | ||
| @dataclass(init=False) | ||
| class Event: | ||
@@ -20,2 +25,5 @@ ConfigureNotify = 0 | ||
| RedirectNotify = 3 | ||
| @dataclass(init=False) | ||
| class EventMask: | ||
@@ -27,2 +35,5 @@ NoEvent = 0 | ||
| RedirectNotify = 1 << 3 | ||
| @dataclass(init=False) | ||
| class Option: | ||
@@ -35,2 +46,5 @@ _None = 0 | ||
| AsyncMayTear = 1 << 4 | ||
| @dataclass(init=False) | ||
| class Capability: | ||
@@ -43,5 +57,11 @@ _None = 0 | ||
| Syncobj = 1 << 4 | ||
| @dataclass(init=False) | ||
| class CompleteKind: | ||
| Pixmap = 0 | ||
| NotifyMSC = 1 | ||
| @dataclass(init=False) | ||
| class CompleteMode: | ||
@@ -52,4 +72,8 @@ Copy = 0 | ||
| SuboptimalCopy = 3 | ||
| @dataclass(init=False) | ||
| class Notify(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -62,2 +86,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -67,3 +92,5 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| fixed_size = 8 | ||
| @classmethod | ||
@@ -75,4 +102,8 @@ def synthetic(cls, window, serial): | ||
| return self | ||
| @dataclass(init=False) | ||
| class QueryVersionReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -85,6 +116,13 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class QueryVersionCookie(xcffib.Cookie): | ||
| reply_type = QueryVersionReply | ||
| @dataclass(init=False) | ||
| class QueryCapabilitiesReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -95,8 +133,15 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.capabilities, = unpacker.unpack("xx2x4xI") | ||
| (self.capabilities,) = unpacker.unpack("xx2x4xI") | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class QueryCapabilitiesCookie(xcffib.Cookie): | ||
| reply_type = QueryCapabilitiesReply | ||
| @dataclass(init=False) | ||
| class GenericEvent(xcffib.Event): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -107,8 +152,15 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.extension, self.length, self.evtype, self.event = unpacker.unpack("xB2xIH2xI") | ||
| self.extension, self.length, self.evtype, self.event = unpacker.unpack( | ||
| "xB2xIH2xI" | ||
| ) | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=B", 0)) | ||
| buf.write(struct.pack("=B2xIH2xI", self.extension, self.length, self.evtype, self.event)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=B2xIH2xI", self.extension, self.length, self.evtype, self.event | ||
| ) | ||
| ) | ||
| buf_len = len(buf.getvalue()) | ||
@@ -118,2 +170,3 @@ if buf_len < 32: | ||
| return buf.getvalue() | ||
| @classmethod | ||
@@ -127,5 +180,11 @@ def synthetic(cls, extension, length, evtype, event): | ||
| return self | ||
| _events[0] = GenericEvent | ||
| @dataclass(init=False) | ||
| class ConfigureNotifyEvent(xcffib.Event): | ||
| xge = True | ||
| def __init__(self, unpacker): | ||
@@ -136,8 +195,36 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.event, self.window, self.x, self.y, self.width, self.height, self.off_x, self.off_y, self.pixmap_width, self.pixmap_height, self.pixmap_flags = unpacker.unpack("xx2x2xIIhhHHhhHHI") | ||
| ( | ||
| self.event, | ||
| self.window, | ||
| self.x, | ||
| self.y, | ||
| self.width, | ||
| self.height, | ||
| self.off_x, | ||
| self.off_y, | ||
| self.pixmap_width, | ||
| self.pixmap_height, | ||
| self.pixmap_flags, | ||
| ) = unpacker.unpack("xx2x2xIIhhHHhhHHI") | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=B", 0)) | ||
| buf.write(struct.pack("=x2x2xIIhhHHhhHHI", self.event, self.window, self.x, self.y, self.width, self.height, self.off_x, self.off_y, self.pixmap_width, self.pixmap_height, self.pixmap_flags)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=x2x2xIIhhHHhhHHI", | ||
| self.event, | ||
| self.window, | ||
| self.x, | ||
| self.y, | ||
| self.width, | ||
| self.height, | ||
| self.off_x, | ||
| self.off_y, | ||
| self.pixmap_width, | ||
| self.pixmap_height, | ||
| self.pixmap_flags, | ||
| ) | ||
| ) | ||
| buf_len = len(buf.getvalue()) | ||
@@ -147,4 +234,18 @@ if buf_len < 32: | ||
| return buf.getvalue() | ||
| @classmethod | ||
| def synthetic(cls, event, window, x, y, width, height, off_x, off_y, pixmap_width, pixmap_height, pixmap_flags): | ||
| def synthetic( | ||
| cls, | ||
| event, | ||
| window, | ||
| x, | ||
| y, | ||
| width, | ||
| height, | ||
| off_x, | ||
| off_y, | ||
| pixmap_width, | ||
| pixmap_height, | ||
| pixmap_flags, | ||
| ): | ||
| self = cls.__new__(cls) | ||
@@ -163,5 +264,11 @@ self.event = event | ||
| return self | ||
| _events[0] = ConfigureNotifyEvent | ||
| @dataclass(init=False) | ||
| class IdleNotifyEvent(xcffib.Event): | ||
| xge = True | ||
| def __init__(self, unpacker): | ||
@@ -172,8 +279,20 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.event, self.window, self.serial, self.pixmap, self.idle_fence = unpacker.unpack("xx2x2xIIIII") | ||
| self.event, self.window, self.serial, self.pixmap, self.idle_fence = ( | ||
| unpacker.unpack("xx2x2xIIIII") | ||
| ) | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=B", 2)) | ||
| buf.write(struct.pack("=x2x2xIIIII", self.event, self.window, self.serial, self.pixmap, self.idle_fence)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=x2x2xIIIII", | ||
| self.event, | ||
| self.window, | ||
| self.serial, | ||
| self.pixmap, | ||
| self.idle_fence, | ||
| ) | ||
| ) | ||
| buf_len = len(buf.getvalue()) | ||
@@ -183,2 +302,3 @@ if buf_len < 32: | ||
| return buf.getvalue() | ||
| @classmethod | ||
@@ -193,3 +313,8 @@ def synthetic(cls, event, window, serial, pixmap, idle_fence): | ||
| return self | ||
| _events[2] = IdleNotifyEvent | ||
| @dataclass(init=False) | ||
| class presentExtension(xcffib.Extension): | ||
@@ -200,2 +325,3 @@ def QueryVersion(self, major_version, minor_version, is_checked=True): | ||
| return self.send_request(0, buf, QueryVersionCookie, is_checked=is_checked) | ||
| def SelectInput(self, eid, window, event_mask, is_checked=False): | ||
@@ -205,2 +331,3 @@ buf = io.BytesIO() | ||
| return self.send_request(3, buf, is_checked=is_checked) | ||
| def QueryCapabilities(self, target, is_checked=True): | ||
@@ -210,2 +337,4 @@ buf = io.BytesIO() | ||
| return self.send_request(4, buf, QueryCapabilitiesCookie, is_checked=is_checked) | ||
| xcffib._add_ext(key, presentExtension, _events, _errors) |
+965
-82
| import xcffib | ||
| import struct | ||
| import io | ||
| from dataclasses import dataclass | ||
| MAJOR_VERSION = 1 | ||
@@ -11,4 +13,8 @@ MINOR_VERSION = 6 | ||
| from . import render | ||
| @dataclass(init=False) | ||
| class BadOutputError(xcffib.Error): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -21,2 +27,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -27,6 +34,12 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| BadBadOutput = BadOutputError | ||
| _errors[0] = BadOutputError | ||
| @dataclass(init=False) | ||
| class BadCrtcError(xcffib.Error): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -39,2 +52,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -45,6 +59,12 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| BadBadCrtc = BadCrtcError | ||
| _errors[1] = BadCrtcError | ||
| @dataclass(init=False) | ||
| class BadModeError(xcffib.Error): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -57,2 +77,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -63,6 +84,12 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| BadBadMode = BadModeError | ||
| _errors[2] = BadModeError | ||
| @dataclass(init=False) | ||
| class BadProviderError(xcffib.Error): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -75,2 +102,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -81,4 +109,9 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| BadBadProvider = BadProviderError | ||
| _errors[3] = BadProviderError | ||
| @dataclass(init=False) | ||
| class Rotation: | ||
@@ -91,4 +124,8 @@ Rotate_0 = 1 << 0 | ||
| Reflect_Y = 1 << 5 | ||
| @dataclass(init=False) | ||
| class ScreenSize(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -101,7 +138,12 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=HHHH", self.width, self.height, self.mwidth, self.mheight)) | ||
| buf.write( | ||
| struct.pack("=HHHH", self.width, self.height, self.mwidth, self.mheight) | ||
| ) | ||
| return buf.getvalue() | ||
| fixed_size = 8 | ||
| @classmethod | ||
@@ -115,4 +157,8 @@ def synthetic(cls, width, height, mwidth, mheight): | ||
| return self | ||
| @dataclass(init=False) | ||
| class RefreshRates(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -123,5 +169,6 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.nRates, = unpacker.unpack("H") | ||
| (self.nRates,) = unpacker.unpack("H") | ||
| self.rates = xcffib.List(unpacker, "H", self.nRates) | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -132,2 +179,3 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| @classmethod | ||
@@ -139,4 +187,8 @@ def synthetic(cls, nRates, rates): | ||
| return self | ||
| @dataclass(init=False) | ||
| class QueryVersionReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -149,4 +201,10 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class QueryVersionCookie(xcffib.Cookie): | ||
| reply_type = QueryVersionReply | ||
| @dataclass(init=False) | ||
| class SetConfig: | ||
@@ -157,4 +215,8 @@ Success = 0 | ||
| Failed = 3 | ||
| @dataclass(init=False) | ||
| class SetScreenConfigReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -165,6 +227,18 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.status, self.new_timestamp, self.config_timestamp, self.root, self.subpixel_order = unpacker.unpack("xB2x4xIIIH10x") | ||
| ( | ||
| self.status, | ||
| self.new_timestamp, | ||
| self.config_timestamp, | ||
| self.root, | ||
| self.subpixel_order, | ||
| ) = unpacker.unpack("xB2x4xIIIH10x") | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class SetScreenConfigCookie(xcffib.Cookie): | ||
| reply_type = SetScreenConfigReply | ||
| @dataclass(init=False) | ||
| class NotifyMask: | ||
@@ -179,4 +253,8 @@ ScreenChange = 1 << 0 | ||
| Lease = 1 << 7 | ||
| @dataclass(init=False) | ||
| class GetScreenInfoReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -187,3 +265,13 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.rotations, self.root, self.timestamp, self.config_timestamp, self.nSizes, self.sizeID, self.rotation, self.rate, self.nInfo = unpacker.unpack("xB2x4xIIIHHHHH2x") | ||
| ( | ||
| self.rotations, | ||
| self.root, | ||
| self.timestamp, | ||
| self.config_timestamp, | ||
| self.nSizes, | ||
| self.sizeID, | ||
| self.rotation, | ||
| self.rate, | ||
| self.nInfo, | ||
| ) = unpacker.unpack("xB2x4xIIIHHHHH2x") | ||
| self.sizes = xcffib.List(unpacker, ScreenSize, self.nSizes) | ||
@@ -193,6 +281,13 @@ unpacker.pad(RefreshRates) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetScreenInfoCookie(xcffib.Cookie): | ||
| reply_type = GetScreenInfoReply | ||
| @dataclass(init=False) | ||
| class GetScreenSizeRangeReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -203,6 +298,14 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.min_width, self.min_height, self.max_width, self.max_height = unpacker.unpack("xx2x4xHHHH16x") | ||
| self.min_width, self.min_height, self.max_width, self.max_height = ( | ||
| unpacker.unpack("xx2x4xHHHH16x") | ||
| ) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetScreenSizeRangeCookie(xcffib.Cookie): | ||
| reply_type = GetScreenSizeRangeReply | ||
| @dataclass(init=False) | ||
| class ModeFlag: | ||
@@ -223,4 +326,8 @@ HsyncPositive = 1 << 0 | ||
| HalveClock = 1 << 13 | ||
| @dataclass(init=False) | ||
| class ModeInfo(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -231,11 +338,60 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.id, self.width, self.height, self.dot_clock, self.hsync_start, self.hsync_end, self.htotal, self.hskew, self.vsync_start, self.vsync_end, self.vtotal, self.name_len, self.mode_flags = unpacker.unpack("IHHIHHHHHHHHI") | ||
| ( | ||
| self.id, | ||
| self.width, | ||
| self.height, | ||
| self.dot_clock, | ||
| self.hsync_start, | ||
| self.hsync_end, | ||
| self.htotal, | ||
| self.hskew, | ||
| self.vsync_start, | ||
| self.vsync_end, | ||
| self.vtotal, | ||
| self.name_len, | ||
| self.mode_flags, | ||
| ) = unpacker.unpack("IHHIHHHHHHHHI") | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=IHHIHHHHHHHHI", self.id, self.width, self.height, self.dot_clock, self.hsync_start, self.hsync_end, self.htotal, self.hskew, self.vsync_start, self.vsync_end, self.vtotal, self.name_len, self.mode_flags)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=IHHIHHHHHHHHI", | ||
| self.id, | ||
| self.width, | ||
| self.height, | ||
| self.dot_clock, | ||
| self.hsync_start, | ||
| self.hsync_end, | ||
| self.htotal, | ||
| self.hskew, | ||
| self.vsync_start, | ||
| self.vsync_end, | ||
| self.vtotal, | ||
| self.name_len, | ||
| self.mode_flags, | ||
| ) | ||
| ) | ||
| return buf.getvalue() | ||
| fixed_size = 32 | ||
| @classmethod | ||
| def synthetic(cls, id, width, height, dot_clock, hsync_start, hsync_end, htotal, hskew, vsync_start, vsync_end, vtotal, name_len, mode_flags): | ||
| def synthetic( | ||
| cls, | ||
| id, | ||
| width, | ||
| height, | ||
| dot_clock, | ||
| hsync_start, | ||
| hsync_end, | ||
| htotal, | ||
| hskew, | ||
| vsync_start, | ||
| vsync_end, | ||
| vtotal, | ||
| name_len, | ||
| mode_flags, | ||
| ): | ||
| self = cls.__new__(cls) | ||
@@ -256,4 +412,8 @@ self.id = id | ||
| return self | ||
| @dataclass(init=False) | ||
| class GetScreenResourcesReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -264,3 +424,10 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.timestamp, self.config_timestamp, self.num_crtcs, self.num_outputs, self.num_modes, self.names_len = unpacker.unpack("xx2x4xIIHHHH8x") | ||
| ( | ||
| self.timestamp, | ||
| self.config_timestamp, | ||
| self.num_crtcs, | ||
| self.num_outputs, | ||
| self.num_modes, | ||
| self.names_len, | ||
| ) = unpacker.unpack("xx2x4xIIHHHH8x") | ||
| self.crtcs = xcffib.List(unpacker, "I", self.num_crtcs) | ||
@@ -274,4 +441,10 @@ unpacker.pad("I") | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetScreenResourcesCookie(xcffib.Cookie): | ||
| reply_type = GetScreenResourcesReply | ||
| @dataclass(init=False) | ||
| class Connection: | ||
@@ -281,4 +454,8 @@ Connected = 0 | ||
| Unknown = 2 | ||
| @dataclass(init=False) | ||
| class GetOutputInfoReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -289,3 +466,16 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.status, self.timestamp, self.crtc, self.mm_width, self.mm_height, self.connection, self.subpixel_order, self.num_crtcs, self.num_modes, self.num_preferred, self.num_clones, self.name_len = unpacker.unpack("xB2x4xIIIIBBHHHHH") | ||
| ( | ||
| self.status, | ||
| self.timestamp, | ||
| self.crtc, | ||
| self.mm_width, | ||
| self.mm_height, | ||
| self.connection, | ||
| self.subpixel_order, | ||
| self.num_crtcs, | ||
| self.num_modes, | ||
| self.num_preferred, | ||
| self.num_clones, | ||
| self.name_len, | ||
| ) = unpacker.unpack("xB2x4xIIIIBBHHHHH") | ||
| self.crtcs = xcffib.List(unpacker, "I", self.num_crtcs) | ||
@@ -299,6 +489,13 @@ unpacker.pad("I") | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetOutputInfoCookie(xcffib.Cookie): | ||
| reply_type = GetOutputInfoReply | ||
| @dataclass(init=False) | ||
| class ListOutputPropertiesReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -309,9 +506,16 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.num_atoms, = unpacker.unpack("xx2x4xH22x") | ||
| (self.num_atoms,) = unpacker.unpack("xx2x4xH22x") | ||
| self.atoms = xcffib.List(unpacker, "I", self.num_atoms) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class ListOutputPropertiesCookie(xcffib.Cookie): | ||
| reply_type = ListOutputPropertiesReply | ||
| @dataclass(init=False) | ||
| class QueryOutputPropertyReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -325,6 +529,13 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class QueryOutputPropertyCookie(xcffib.Cookie): | ||
| reply_type = QueryOutputPropertyReply | ||
| @dataclass(init=False) | ||
| class GetOutputPropertyReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -335,9 +546,18 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.format, self.type, self.bytes_after, self.num_items = unpacker.unpack("xB2x4xIII12x") | ||
| self.format, self.type, self.bytes_after, self.num_items = unpacker.unpack( | ||
| "xB2x4xIII12x" | ||
| ) | ||
| self.data = xcffib.List(unpacker, "B", self.num_items * (self.format // 8)) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetOutputPropertyCookie(xcffib.Cookie): | ||
| reply_type = GetOutputPropertyReply | ||
| @dataclass(init=False) | ||
| class CreateModeReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -348,8 +568,15 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.mode, = unpacker.unpack("xx2x4xI20x") | ||
| (self.mode,) = unpacker.unpack("xx2x4xI20x") | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class CreateModeCookie(xcffib.Cookie): | ||
| reply_type = CreateModeReply | ||
| @dataclass(init=False) | ||
| class GetCrtcInfoReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -360,3 +587,15 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.status, self.timestamp, self.x, self.y, self.width, self.height, self.mode, self.rotation, self.rotations, self.num_outputs, self.num_possible_outputs = unpacker.unpack("xB2x4xIhhHHIHHHH") | ||
| ( | ||
| self.status, | ||
| self.timestamp, | ||
| self.x, | ||
| self.y, | ||
| self.width, | ||
| self.height, | ||
| self.mode, | ||
| self.rotation, | ||
| self.rotations, | ||
| self.num_outputs, | ||
| self.num_possible_outputs, | ||
| ) = unpacker.unpack("xB2x4xIhhHHIHHHH") | ||
| self.outputs = xcffib.List(unpacker, "I", self.num_outputs) | ||
@@ -366,6 +605,13 @@ unpacker.pad("I") | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetCrtcInfoCookie(xcffib.Cookie): | ||
| reply_type = GetCrtcInfoReply | ||
| @dataclass(init=False) | ||
| class SetCrtcConfigReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -378,6 +624,13 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class SetCrtcConfigCookie(xcffib.Cookie): | ||
| reply_type = SetCrtcConfigReply | ||
| @dataclass(init=False) | ||
| class GetCrtcGammaSizeReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -388,8 +641,15 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.size, = unpacker.unpack("xx2x4xH22x") | ||
| (self.size,) = unpacker.unpack("xx2x4xH22x") | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetCrtcGammaSizeCookie(xcffib.Cookie): | ||
| reply_type = GetCrtcGammaSizeReply | ||
| @dataclass(init=False) | ||
| class GetCrtcGammaReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -400,3 +660,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.size, = unpacker.unpack("xx2x4xH22x") | ||
| (self.size,) = unpacker.unpack("xx2x4xH22x") | ||
| self.red = xcffib.List(unpacker, "H", self.size) | ||
@@ -408,6 +668,13 @@ unpacker.pad("H") | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetCrtcGammaCookie(xcffib.Cookie): | ||
| reply_type = GetCrtcGammaReply | ||
| @dataclass(init=False) | ||
| class GetScreenResourcesCurrentReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -418,3 +685,10 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.timestamp, self.config_timestamp, self.num_crtcs, self.num_outputs, self.num_modes, self.names_len = unpacker.unpack("xx2x4xIIHHHH8x") | ||
| ( | ||
| self.timestamp, | ||
| self.config_timestamp, | ||
| self.num_crtcs, | ||
| self.num_outputs, | ||
| self.num_modes, | ||
| self.names_len, | ||
| ) = unpacker.unpack("xx2x4xIIHHHH8x") | ||
| self.crtcs = xcffib.List(unpacker, "I", self.num_crtcs) | ||
@@ -428,4 +702,10 @@ unpacker.pad("I") | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetScreenResourcesCurrentCookie(xcffib.Cookie): | ||
| reply_type = GetScreenResourcesCurrentReply | ||
| @dataclass(init=False) | ||
| class Transform: | ||
@@ -436,4 +716,8 @@ Unit = 1 << 0 | ||
| Projective = 1 << 3 | ||
| @dataclass(init=False) | ||
| class GetCrtcTransformReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -446,6 +730,11 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.pending_transform = render.TRANSFORM(unpacker) | ||
| self.has_transforms, = unpacker.unpack("B3x") | ||
| (self.has_transforms,) = unpacker.unpack("B3x") | ||
| unpacker.pad(render.TRANSFORM) | ||
| self.current_transform = render.TRANSFORM(unpacker) | ||
| self.pending_len, self.pending_nparams, self.current_len, self.current_nparams = unpacker.unpack("4xHHHH") | ||
| ( | ||
| self.pending_len, | ||
| self.pending_nparams, | ||
| self.current_len, | ||
| self.current_nparams, | ||
| ) = unpacker.unpack("4xHHHH") | ||
| unpacker.pad("c") | ||
@@ -460,6 +749,13 @@ self.pending_filter_name = xcffib.List(unpacker, "c", self.pending_len) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetCrtcTransformCookie(xcffib.Cookie): | ||
| reply_type = GetCrtcTransformReply | ||
| @dataclass(init=False) | ||
| class GetPanningReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -470,8 +766,30 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.status, self.timestamp, self.left, self.top, self.width, self.height, self.track_left, self.track_top, self.track_width, self.track_height, self.border_left, self.border_top, self.border_right, self.border_bottom = unpacker.unpack("xB2x4xIHHHHHHHHhhhh") | ||
| ( | ||
| self.status, | ||
| self.timestamp, | ||
| self.left, | ||
| self.top, | ||
| self.width, | ||
| self.height, | ||
| self.track_left, | ||
| self.track_top, | ||
| self.track_width, | ||
| self.track_height, | ||
| self.border_left, | ||
| self.border_top, | ||
| self.border_right, | ||
| self.border_bottom, | ||
| ) = unpacker.unpack("xB2x4xIHHHHHHHHhhhh") | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetPanningCookie(xcffib.Cookie): | ||
| reply_type = GetPanningReply | ||
| @dataclass(init=False) | ||
| class SetPanningReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -484,6 +802,13 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class SetPanningCookie(xcffib.Cookie): | ||
| reply_type = SetPanningReply | ||
| @dataclass(init=False) | ||
| class GetOutputPrimaryReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -494,8 +819,15 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.output, = unpacker.unpack("xx2x4xI") | ||
| (self.output,) = unpacker.unpack("xx2x4xI") | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetOutputPrimaryCookie(xcffib.Cookie): | ||
| reply_type = GetOutputPrimaryReply | ||
| @dataclass(init=False) | ||
| class GetProvidersReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -509,4 +841,10 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetProvidersCookie(xcffib.Cookie): | ||
| reply_type = GetProvidersReply | ||
| @dataclass(init=False) | ||
| class ProviderCapability: | ||
@@ -517,4 +855,8 @@ SourceOutput = 1 << 0 | ||
| SinkOffload = 1 << 3 | ||
| @dataclass(init=False) | ||
| class GetProviderInfoReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -525,3 +867,11 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.status, self.timestamp, self.capabilities, self.num_crtcs, self.num_outputs, self.num_associated_providers, self.name_len = unpacker.unpack("xB2x4xIIHHHH8x") | ||
| ( | ||
| self.status, | ||
| self.timestamp, | ||
| self.capabilities, | ||
| self.num_crtcs, | ||
| self.num_outputs, | ||
| self.num_associated_providers, | ||
| self.name_len, | ||
| ) = unpacker.unpack("xB2x4xIIHHHH8x") | ||
| self.crtcs = xcffib.List(unpacker, "I", self.num_crtcs) | ||
@@ -531,12 +881,23 @@ unpacker.pad("I") | ||
| unpacker.pad("I") | ||
| self.associated_providers = xcffib.List(unpacker, "I", self.num_associated_providers) | ||
| self.associated_providers = xcffib.List( | ||
| unpacker, "I", self.num_associated_providers | ||
| ) | ||
| unpacker.pad("I") | ||
| self.associated_capability = xcffib.List(unpacker, "I", self.num_associated_providers) | ||
| self.associated_capability = xcffib.List( | ||
| unpacker, "I", self.num_associated_providers | ||
| ) | ||
| unpacker.pad("c") | ||
| self.name = xcffib.List(unpacker, "c", self.name_len) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetProviderInfoCookie(xcffib.Cookie): | ||
| reply_type = GetProviderInfoReply | ||
| @dataclass(init=False) | ||
| class ListProviderPropertiesReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -547,9 +908,16 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.num_atoms, = unpacker.unpack("xx2x4xH22x") | ||
| (self.num_atoms,) = unpacker.unpack("xx2x4xH22x") | ||
| self.atoms = xcffib.List(unpacker, "I", self.num_atoms) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class ListProviderPropertiesCookie(xcffib.Cookie): | ||
| reply_type = ListProviderPropertiesReply | ||
| @dataclass(init=False) | ||
| class QueryProviderPropertyReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -563,6 +931,13 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class QueryProviderPropertyCookie(xcffib.Cookie): | ||
| reply_type = QueryProviderPropertyReply | ||
| @dataclass(init=False) | ||
| class GetProviderPropertyReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -573,9 +948,18 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.format, self.type, self.bytes_after, self.num_items = unpacker.unpack("xB2x4xIII12x") | ||
| self.format, self.type, self.bytes_after, self.num_items = unpacker.unpack( | ||
| "xB2x4xIII12x" | ||
| ) | ||
| self.data = xcffib.List(unpacker, "c", self.num_items * (self.format // 8)) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetProviderPropertyCookie(xcffib.Cookie): | ||
| reply_type = GetProviderPropertyReply | ||
| @dataclass(init=False) | ||
| class ScreenChangeNotifyEvent(xcffib.Event): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -586,8 +970,36 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| 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.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 = io.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.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()) | ||
@@ -597,4 +1009,18 @@ if buf_len < 32: | ||
| return buf.getvalue() | ||
| @classmethod | ||
| def synthetic(cls, rotation, timestamp, config_timestamp, root, request_window, sizeID, subpixel_order, width, height, mwidth, mheight): | ||
| def synthetic( | ||
| cls, | ||
| rotation, | ||
| timestamp, | ||
| config_timestamp, | ||
| root, | ||
| request_window, | ||
| sizeID, | ||
| subpixel_order, | ||
| width, | ||
| height, | ||
| mwidth, | ||
| mheight, | ||
| ): | ||
| self = cls.__new__(cls) | ||
@@ -613,3 +1039,8 @@ self.rotation = rotation | ||
| return self | ||
| _events[0] = ScreenChangeNotifyEvent | ||
| @dataclass(init=False) | ||
| class Notify: | ||
@@ -623,4 +1054,8 @@ CrtcChange = 0 | ||
| Lease = 6 | ||
| @dataclass(init=False) | ||
| class CrtcChange(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -631,9 +1066,35 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.timestamp, self.window, self.crtc, self.mode, self.rotation, self.x, self.y, self.width, self.height = unpacker.unpack("IIIIH2xhhHH") | ||
| ( | ||
| self.timestamp, | ||
| self.window, | ||
| self.crtc, | ||
| self.mode, | ||
| self.rotation, | ||
| self.x, | ||
| self.y, | ||
| self.width, | ||
| self.height, | ||
| ) = unpacker.unpack("IIIIH2xhhHH") | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=IIIIH2xhhHH", self.timestamp, self.window, self.crtc, self.mode, self.rotation, self.x, self.y, self.width, self.height)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=IIIIH2xhhHH", | ||
| self.timestamp, | ||
| self.window, | ||
| self.crtc, | ||
| self.mode, | ||
| self.rotation, | ||
| self.x, | ||
| self.y, | ||
| self.width, | ||
| self.height, | ||
| ) | ||
| ) | ||
| return buf.getvalue() | ||
| fixed_size = 28 | ||
| @classmethod | ||
@@ -652,4 +1113,8 @@ def synthetic(cls, timestamp, window, crtc, mode, rotation, x, y, width, height): | ||
| return self | ||
| @dataclass(init=False) | ||
| class OutputChange(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -660,11 +1125,48 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.timestamp, self.config_timestamp, self.window, self.output, self.crtc, self.mode, self.rotation, self.connection, self.subpixel_order = unpacker.unpack("IIIIIIHBB") | ||
| ( | ||
| self.timestamp, | ||
| self.config_timestamp, | ||
| self.window, | ||
| self.output, | ||
| self.crtc, | ||
| self.mode, | ||
| self.rotation, | ||
| self.connection, | ||
| self.subpixel_order, | ||
| ) = unpacker.unpack("IIIIIIHBB") | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=IIIIIIHBB", self.timestamp, self.config_timestamp, self.window, self.output, self.crtc, self.mode, self.rotation, self.connection, self.subpixel_order)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=IIIIIIHBB", | ||
| self.timestamp, | ||
| self.config_timestamp, | ||
| self.window, | ||
| self.output, | ||
| self.crtc, | ||
| self.mode, | ||
| self.rotation, | ||
| self.connection, | ||
| self.subpixel_order, | ||
| ) | ||
| ) | ||
| return buf.getvalue() | ||
| fixed_size = 28 | ||
| @classmethod | ||
| def synthetic(cls, timestamp, config_timestamp, window, output, crtc, mode, rotation, connection, subpixel_order): | ||
| def synthetic( | ||
| cls, | ||
| timestamp, | ||
| config_timestamp, | ||
| window, | ||
| output, | ||
| crtc, | ||
| mode, | ||
| rotation, | ||
| connection, | ||
| subpixel_order, | ||
| ): | ||
| self = cls.__new__(cls) | ||
@@ -681,4 +1183,8 @@ self.timestamp = timestamp | ||
| return self | ||
| @dataclass(init=False) | ||
| class OutputProperty(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -689,9 +1195,23 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.window, self.output, self.atom, self.timestamp, self.status = unpacker.unpack("IIIIB11x") | ||
| self.window, self.output, self.atom, self.timestamp, self.status = ( | ||
| unpacker.unpack("IIIIB11x") | ||
| ) | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=IIIIB11x", self.window, self.output, self.atom, self.timestamp, self.status)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=IIIIB11x", | ||
| self.window, | ||
| self.output, | ||
| self.atom, | ||
| self.timestamp, | ||
| self.status, | ||
| ) | ||
| ) | ||
| return buf.getvalue() | ||
| fixed_size = 28 | ||
| @classmethod | ||
@@ -706,4 +1226,8 @@ def synthetic(cls, window, output, atom, timestamp, status): | ||
| return self | ||
| @dataclass(init=False) | ||
| class ProviderChange(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -716,2 +1240,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -721,3 +1246,5 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| fixed_size = 28 | ||
| @classmethod | ||
@@ -730,4 +1257,8 @@ def synthetic(cls, timestamp, window, provider): | ||
| return self | ||
| @dataclass(init=False) | ||
| class ProviderProperty(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -738,9 +1269,23 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.window, self.provider, self.atom, self.timestamp, self.state = unpacker.unpack("IIIIB11x") | ||
| self.window, self.provider, self.atom, self.timestamp, self.state = ( | ||
| unpacker.unpack("IIIIB11x") | ||
| ) | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=IIIIB11x", self.window, self.provider, self.atom, self.timestamp, self.state)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=IIIIB11x", | ||
| self.window, | ||
| self.provider, | ||
| self.atom, | ||
| self.timestamp, | ||
| self.state, | ||
| ) | ||
| ) | ||
| return buf.getvalue() | ||
| fixed_size = 28 | ||
| @classmethod | ||
@@ -755,4 +1300,8 @@ def synthetic(cls, window, provider, atom, timestamp, state): | ||
| return self | ||
| @dataclass(init=False) | ||
| class ResourceChange(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -765,2 +1314,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -770,3 +1320,5 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| fixed_size = 28 | ||
| @classmethod | ||
@@ -778,4 +1330,8 @@ def synthetic(cls, timestamp, window): | ||
| return self | ||
| @dataclass(init=False) | ||
| class MonitorInfo(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -786,12 +1342,52 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.name, self.primary, self.automatic, self.nOutput, self.x, self.y, self.width, self.height, self.width_in_millimeters, self.height_in_millimeters = unpacker.unpack("IBBHhhHHII") | ||
| ( | ||
| self.name, | ||
| self.primary, | ||
| self.automatic, | ||
| self.nOutput, | ||
| self.x, | ||
| self.y, | ||
| self.width, | ||
| self.height, | ||
| self.width_in_millimeters, | ||
| self.height_in_millimeters, | ||
| ) = unpacker.unpack("IBBHhhHHII") | ||
| self.outputs = xcffib.List(unpacker, "I", self.nOutput) | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=IBBHhhHHII", self.name, self.primary, self.automatic, self.nOutput, self.x, self.y, self.width, self.height, self.width_in_millimeters, self.height_in_millimeters)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=IBBHhhHHII", | ||
| self.name, | ||
| self.primary, | ||
| self.automatic, | ||
| self.nOutput, | ||
| self.x, | ||
| self.y, | ||
| self.width, | ||
| self.height, | ||
| self.width_in_millimeters, | ||
| self.height_in_millimeters, | ||
| ) | ||
| ) | ||
| buf.write(xcffib.pack_list(self.outputs, "I")) | ||
| return buf.getvalue() | ||
| @classmethod | ||
| def synthetic(cls, name, primary, automatic, nOutput, x, y, width, height, width_in_millimeters, height_in_millimeters, outputs): | ||
| def synthetic( | ||
| cls, | ||
| name, | ||
| primary, | ||
| automatic, | ||
| nOutput, | ||
| x, | ||
| y, | ||
| width, | ||
| height, | ||
| width_in_millimeters, | ||
| height_in_millimeters, | ||
| outputs, | ||
| ): | ||
| self = cls.__new__(cls) | ||
@@ -810,4 +1406,8 @@ self.name = name | ||
| return self | ||
| @dataclass(init=False) | ||
| class GetMonitorsReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -821,6 +1421,13 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetMonitorsCookie(xcffib.Cookie): | ||
| reply_type = GetMonitorsReply | ||
| @dataclass(init=False) | ||
| class CreateLeaseReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -831,8 +1438,15 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.nfd, = unpacker.unpack("xB2x4x24x") | ||
| (self.nfd,) = unpacker.unpack("xB2x4x24x") | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class CreateLeaseCookie(xcffib.Cookie): | ||
| reply_type = CreateLeaseReply | ||
| @dataclass(init=False) | ||
| class LeaseNotify(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -843,9 +1457,18 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.timestamp, self.window, self.lease, self.created = unpacker.unpack("IIIB15x") | ||
| self.timestamp, self.window, self.lease, self.created = unpacker.unpack( | ||
| "IIIB15x" | ||
| ) | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=IIIB15x", self.timestamp, self.window, self.lease, self.created)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=IIIB15x", self.timestamp, self.window, self.lease, self.created | ||
| ) | ||
| ) | ||
| return buf.getvalue() | ||
| fixed_size = 28 | ||
| @classmethod | ||
@@ -859,4 +1482,8 @@ def synthetic(cls, timestamp, window, lease, created): | ||
| return self | ||
| @dataclass(init=False) | ||
| class NotifyData(xcffib.Union): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -873,8 +1500,17 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.lc = LeaseNotify(unpacker.copy()) | ||
| def pack(self): | ||
| buf = io.BytesIO() | ||
| buf.write(self.cc.pack() if hasattr(self.cc, "pack") else CrtcChange.synthetic(*self.cc).pack()) | ||
| buf.write( | ||
| self.cc.pack() | ||
| if hasattr(self.cc, "pack") | ||
| else CrtcChange.synthetic(*self.cc).pack() | ||
| ) | ||
| return buf.getvalue() | ||
| @dataclass(init=False) | ||
| class NotifyEvent(xcffib.Event): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -885,5 +1521,6 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.subCode, = unpacker.unpack("xB2x") | ||
| (self.subCode,) = unpacker.unpack("xB2x") | ||
| self.u = NotifyData(unpacker) | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -893,3 +1530,7 @@ buf = io.BytesIO() | ||
| buf.write(struct.pack("=B2x", self.subCode)) | ||
| buf.write(self.u.pack() if hasattr(self.u, "pack") else NotifyData.synthetic(*self.u).pack()) | ||
| buf.write( | ||
| self.u.pack() | ||
| if hasattr(self.u, "pack") | ||
| else NotifyData.synthetic(*self.u).pack() | ||
| ) | ||
| buf_len = len(buf.getvalue()) | ||
@@ -899,2 +1540,3 @@ if buf_len < 32: | ||
| return buf.getvalue() | ||
| @classmethod | ||
@@ -906,3 +1548,8 @@ def synthetic(cls, subCode, u): | ||
| return self | ||
| _events[1] = NotifyEvent | ||
| @dataclass(init=False) | ||
| class randrExtension(xcffib.Extension): | ||
@@ -913,6 +1560,27 @@ def QueryVersion(self, major_version, minor_version, is_checked=True): | ||
| return self.send_request(0, buf, QueryVersionCookie, is_checked=is_checked) | ||
| def SetScreenConfig(self, window, timestamp, config_timestamp, sizeID, rotation, rate, is_checked=True): | ||
| def SetScreenConfig( | ||
| self, | ||
| window, | ||
| timestamp, | ||
| config_timestamp, | ||
| sizeID, | ||
| rotation, | ||
| rate, | ||
| is_checked=True, | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xIIIHHH2x", window, timestamp, config_timestamp, sizeID, rotation, rate)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=xx2xIIIHHH2x", | ||
| window, | ||
| timestamp, | ||
| config_timestamp, | ||
| sizeID, | ||
| rotation, | ||
| rate, | ||
| ) | ||
| ) | ||
| return self.send_request(2, buf, SetScreenConfigCookie, is_checked=is_checked) | ||
| def SelectInput(self, window, enable, is_checked=False): | ||
@@ -922,2 +1590,3 @@ buf = io.BytesIO() | ||
| return self.send_request(4, buf, is_checked=is_checked) | ||
| def GetScreenInfo(self, window, is_checked=True): | ||
@@ -927,14 +1596,24 @@ buf = io.BytesIO() | ||
| return self.send_request(5, buf, GetScreenInfoCookie, is_checked=is_checked) | ||
| def GetScreenSizeRange(self, window, is_checked=True): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xI", window)) | ||
| return self.send_request(6, buf, GetScreenSizeRangeCookie, is_checked=is_checked) | ||
| def SetScreenSize(self, window, width, height, mm_width, mm_height, is_checked=False): | ||
| return self.send_request( | ||
| 6, buf, GetScreenSizeRangeCookie, is_checked=is_checked | ||
| ) | ||
| def SetScreenSize( | ||
| self, window, width, height, mm_width, mm_height, is_checked=False | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xIHHII", window, width, height, mm_width, mm_height)) | ||
| return self.send_request(7, buf, is_checked=is_checked) | ||
| def GetScreenResources(self, window, is_checked=True): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xI", window)) | ||
| return self.send_request(8, buf, GetScreenResourcesCookie, is_checked=is_checked) | ||
| return self.send_request( | ||
| 8, buf, GetScreenResourcesCookie, is_checked=is_checked | ||
| ) | ||
| def GetOutputInfo(self, output, config_timestamp, is_checked=True): | ||
@@ -944,11 +1623,20 @@ buf = io.BytesIO() | ||
| return self.send_request(9, buf, GetOutputInfoCookie, is_checked=is_checked) | ||
| def ListOutputProperties(self, output, is_checked=True): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xI", output)) | ||
| return self.send_request(10, buf, ListOutputPropertiesCookie, is_checked=is_checked) | ||
| return self.send_request( | ||
| 10, buf, ListOutputPropertiesCookie, is_checked=is_checked | ||
| ) | ||
| def QueryOutputProperty(self, output, property, is_checked=True): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xII", output, property)) | ||
| return self.send_request(11, buf, QueryOutputPropertyCookie, is_checked=is_checked) | ||
| def ConfigureOutputProperty(self, output, property, pending, range, values_len, values, is_checked=False): | ||
| return self.send_request( | ||
| 11, buf, QueryOutputPropertyCookie, is_checked=is_checked | ||
| ) | ||
| def ConfigureOutputProperty( | ||
| self, output, property, pending, range, values_len, values, is_checked=False | ||
| ): | ||
| buf = io.BytesIO() | ||
@@ -958,7 +1646,15 @@ buf.write(struct.pack("=xx2xIIBB2x", output, property, pending, range)) | ||
| return self.send_request(12, buf, is_checked=is_checked) | ||
| def ChangeOutputProperty(self, output, property, type, format, mode, num_units, data, is_checked=False): | ||
| def ChangeOutputProperty( | ||
| self, output, property, type, format, mode, num_units, data, is_checked=False | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xIIIBB2xI", output, property, type, format, mode, num_units)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=xx2xIIIBB2xI", output, property, type, format, mode, num_units | ||
| ) | ||
| ) | ||
| buf.write(xcffib.pack_list(data, "c")) | ||
| return self.send_request(13, buf, is_checked=is_checked) | ||
| def DeleteOutputProperty(self, output, property, is_checked=False): | ||
@@ -968,12 +1664,42 @@ buf = io.BytesIO() | ||
| return self.send_request(14, buf, is_checked=is_checked) | ||
| def GetOutputProperty(self, output, property, type, long_offset, long_length, delete, pending, is_checked=True): | ||
| def GetOutputProperty( | ||
| self, | ||
| output, | ||
| property, | ||
| type, | ||
| long_offset, | ||
| long_length, | ||
| delete, | ||
| pending, | ||
| is_checked=True, | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xIIIIIBB2x", output, property, type, long_offset, long_length, delete, pending)) | ||
| return self.send_request(15, buf, GetOutputPropertyCookie, is_checked=is_checked) | ||
| buf.write( | ||
| struct.pack( | ||
| "=xx2xIIIIIBB2x", | ||
| output, | ||
| property, | ||
| type, | ||
| long_offset, | ||
| long_length, | ||
| delete, | ||
| pending, | ||
| ) | ||
| ) | ||
| return self.send_request( | ||
| 15, buf, GetOutputPropertyCookie, is_checked=is_checked | ||
| ) | ||
| def CreateMode(self, window, mode_info, name_len, name, is_checked=True): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xI", window)) | ||
| buf.write(mode_info.pack() if hasattr(mode_info, "pack") else ModeInfo.synthetic(*mode_info).pack()) | ||
| buf.write( | ||
| mode_info.pack() | ||
| if hasattr(mode_info, "pack") | ||
| else ModeInfo.synthetic(*mode_info).pack() | ||
| ) | ||
| buf.write(xcffib.pack_list(name, "c")) | ||
| return self.send_request(16, buf, CreateModeCookie, is_checked=is_checked) | ||
| def DestroyMode(self, mode, is_checked=False): | ||
@@ -983,2 +1709,3 @@ buf = io.BytesIO() | ||
| return self.send_request(17, buf, is_checked=is_checked) | ||
| def AddOutputMode(self, output, mode, is_checked=False): | ||
@@ -988,2 +1715,3 @@ buf = io.BytesIO() | ||
| return self.send_request(18, buf, is_checked=is_checked) | ||
| def DeleteOutputMode(self, output, mode, is_checked=False): | ||
@@ -993,2 +1721,3 @@ buf = io.BytesIO() | ||
| return self.send_request(19, buf, is_checked=is_checked) | ||
| def GetCrtcInfo(self, crtc, config_timestamp, is_checked=True): | ||
@@ -998,7 +1727,32 @@ buf = io.BytesIO() | ||
| return self.send_request(20, buf, GetCrtcInfoCookie, is_checked=is_checked) | ||
| def SetCrtcConfig(self, crtc, timestamp, config_timestamp, x, y, mode, rotation, outputs_len, outputs, is_checked=True): | ||
| def SetCrtcConfig( | ||
| self, | ||
| crtc, | ||
| timestamp, | ||
| config_timestamp, | ||
| x, | ||
| y, | ||
| mode, | ||
| rotation, | ||
| outputs_len, | ||
| outputs, | ||
| is_checked=True, | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xIIIhhIH2x", crtc, timestamp, config_timestamp, x, y, mode, rotation)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=xx2xIIIhhIH2x", | ||
| crtc, | ||
| timestamp, | ||
| config_timestamp, | ||
| x, | ||
| y, | ||
| mode, | ||
| rotation, | ||
| ) | ||
| ) | ||
| buf.write(xcffib.pack_list(outputs, "I")) | ||
| return self.send_request(21, buf, SetCrtcConfigCookie, is_checked=is_checked) | ||
| def GetCrtcGammaSize(self, crtc, is_checked=True): | ||
@@ -1008,2 +1762,3 @@ buf = io.BytesIO() | ||
| return self.send_request(22, buf, GetCrtcGammaSizeCookie, is_checked=is_checked) | ||
| def GetCrtcGamma(self, crtc, is_checked=True): | ||
@@ -1013,2 +1768,3 @@ buf = io.BytesIO() | ||
| return self.send_request(23, buf, GetCrtcGammaCookie, is_checked=is_checked) | ||
| def SetCrtcGamma(self, crtc, size, red, green, blue, is_checked=False): | ||
@@ -1021,16 +1777,42 @@ buf = io.BytesIO() | ||
| return self.send_request(24, buf, is_checked=is_checked) | ||
| def GetScreenResourcesCurrent(self, window, is_checked=True): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xI", window)) | ||
| return self.send_request(25, buf, GetScreenResourcesCurrentCookie, is_checked=is_checked) | ||
| def SetCrtcTransform(self, crtc, transform, filter_len, filter_name, filter_params_len, filter_params, is_checked=False): | ||
| return self.send_request( | ||
| 25, buf, GetScreenResourcesCurrentCookie, is_checked=is_checked | ||
| ) | ||
| def SetCrtcTransform( | ||
| self, | ||
| crtc, | ||
| transform, | ||
| filter_len, | ||
| filter_name, | ||
| filter_params_len, | ||
| filter_params, | ||
| is_checked=False, | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xI", crtc)) | ||
| buf.write(transform.pack() if hasattr(transform, "pack") else render.TRANSFORM.synthetic(*transform).pack()) | ||
| buf.write( | ||
| transform.pack() | ||
| if hasattr(transform, "pack") | ||
| else render.TRANSFORM.synthetic(*transform).pack() | ||
| ) | ||
| buf.write(struct.pack("=H", filter_len)) | ||
| buf.write(struct.pack("=2x", )) | ||
| buf.write( | ||
| struct.pack( | ||
| "=2x", | ||
| ) | ||
| ) | ||
| buf.write(xcffib.pack_list(filter_name, "c")) | ||
| buf.write(struct.pack("=4x", )) | ||
| buf.write( | ||
| struct.pack( | ||
| "=4x", | ||
| ) | ||
| ) | ||
| buf.write(xcffib.pack_list(filter_params, "i")) | ||
| return self.send_request(26, buf, is_checked=is_checked) | ||
| def GetCrtcTransform(self, crtc, is_checked=True): | ||
@@ -1040,2 +1822,3 @@ buf = io.BytesIO() | ||
| return self.send_request(27, buf, GetCrtcTransformCookie, is_checked=is_checked) | ||
| def GetPanning(self, crtc, is_checked=True): | ||
@@ -1045,6 +1828,43 @@ buf = io.BytesIO() | ||
| return self.send_request(28, buf, GetPanningCookie, is_checked=is_checked) | ||
| def SetPanning(self, crtc, timestamp, left, top, width, height, track_left, track_top, track_width, track_height, border_left, border_top, border_right, border_bottom, is_checked=True): | ||
| def SetPanning( | ||
| self, | ||
| crtc, | ||
| timestamp, | ||
| left, | ||
| top, | ||
| width, | ||
| height, | ||
| track_left, | ||
| track_top, | ||
| track_width, | ||
| track_height, | ||
| border_left, | ||
| border_top, | ||
| border_right, | ||
| border_bottom, | ||
| is_checked=True, | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xIIHHHHHHHHhhhh", crtc, timestamp, left, top, width, height, track_left, track_top, track_width, track_height, border_left, border_top, border_right, border_bottom)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=xx2xIIHHHHHHHHhhhh", | ||
| crtc, | ||
| timestamp, | ||
| left, | ||
| top, | ||
| width, | ||
| height, | ||
| track_left, | ||
| track_top, | ||
| track_width, | ||
| track_height, | ||
| border_left, | ||
| border_top, | ||
| border_right, | ||
| border_bottom, | ||
| ) | ||
| ) | ||
| return self.send_request(29, buf, SetPanningCookie, is_checked=is_checked) | ||
| def SetOutputPrimary(self, window, output, is_checked=False): | ||
@@ -1054,2 +1874,3 @@ buf = io.BytesIO() | ||
| return self.send_request(30, buf, is_checked=is_checked) | ||
| def GetOutputPrimary(self, window, is_checked=True): | ||
@@ -1059,2 +1880,3 @@ buf = io.BytesIO() | ||
| return self.send_request(31, buf, GetOutputPrimaryCookie, is_checked=is_checked) | ||
| def GetProviders(self, window, is_checked=True): | ||
@@ -1064,2 +1886,3 @@ buf = io.BytesIO() | ||
| return self.send_request(32, buf, GetProvidersCookie, is_checked=is_checked) | ||
| def GetProviderInfo(self, provider, config_timestamp, is_checked=True): | ||
@@ -1069,19 +1892,34 @@ buf = io.BytesIO() | ||
| return self.send_request(33, buf, GetProviderInfoCookie, is_checked=is_checked) | ||
| def SetProviderOffloadSink(self, provider, sink_provider, config_timestamp, is_checked=False): | ||
| def SetProviderOffloadSink( | ||
| self, provider, sink_provider, config_timestamp, is_checked=False | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xIII", provider, sink_provider, config_timestamp)) | ||
| return self.send_request(34, buf, is_checked=is_checked) | ||
| def SetProviderOutputSource(self, provider, source_provider, config_timestamp, is_checked=False): | ||
| def SetProviderOutputSource( | ||
| self, provider, source_provider, config_timestamp, is_checked=False | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xIII", provider, source_provider, config_timestamp)) | ||
| return self.send_request(35, buf, is_checked=is_checked) | ||
| def ListProviderProperties(self, provider, is_checked=True): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xI", provider)) | ||
| return self.send_request(36, buf, ListProviderPropertiesCookie, is_checked=is_checked) | ||
| return self.send_request( | ||
| 36, buf, ListProviderPropertiesCookie, is_checked=is_checked | ||
| ) | ||
| def QueryProviderProperty(self, provider, property, is_checked=True): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xII", provider, property)) | ||
| return self.send_request(37, buf, QueryProviderPropertyCookie, is_checked=is_checked) | ||
| def ConfigureProviderProperty(self, provider, property, pending, range, values_len, values, is_checked=False): | ||
| return self.send_request( | ||
| 37, buf, QueryProviderPropertyCookie, is_checked=is_checked | ||
| ) | ||
| def ConfigureProviderProperty( | ||
| self, provider, property, pending, range, values_len, values, is_checked=False | ||
| ): | ||
| buf = io.BytesIO() | ||
@@ -1091,7 +1929,15 @@ buf.write(struct.pack("=xx2xIIBB2x", provider, property, pending, range)) | ||
| return self.send_request(38, buf, is_checked=is_checked) | ||
| def ChangeProviderProperty(self, provider, property, type, format, mode, num_items, data, is_checked=False): | ||
| def ChangeProviderProperty( | ||
| self, provider, property, type, format, mode, num_items, data, is_checked=False | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xIIIBB2xI", provider, property, type, format, mode, num_items)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=xx2xIIIBB2xI", provider, property, type, format, mode, num_items | ||
| ) | ||
| ) | ||
| buf.write(xcffib.pack_list(data, "c")) | ||
| return self.send_request(39, buf, is_checked=is_checked) | ||
| def DeleteProviderProperty(self, provider, property, is_checked=False): | ||
@@ -1101,6 +1947,31 @@ buf = io.BytesIO() | ||
| return self.send_request(40, buf, is_checked=is_checked) | ||
| def GetProviderProperty(self, provider, property, type, long_offset, long_length, delete, pending, is_checked=True): | ||
| def GetProviderProperty( | ||
| self, | ||
| provider, | ||
| property, | ||
| type, | ||
| long_offset, | ||
| long_length, | ||
| delete, | ||
| pending, | ||
| is_checked=True, | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xIIIIIBB2x", provider, property, type, long_offset, long_length, delete, pending)) | ||
| return self.send_request(41, buf, GetProviderPropertyCookie, is_checked=is_checked) | ||
| buf.write( | ||
| struct.pack( | ||
| "=xx2xIIIIIBB2x", | ||
| provider, | ||
| property, | ||
| type, | ||
| long_offset, | ||
| long_length, | ||
| delete, | ||
| pending, | ||
| ) | ||
| ) | ||
| return self.send_request( | ||
| 41, buf, GetProviderPropertyCookie, is_checked=is_checked | ||
| ) | ||
| def GetMonitors(self, window, get_active, is_checked=True): | ||
@@ -1110,7 +1981,13 @@ buf = io.BytesIO() | ||
| return self.send_request(42, buf, GetMonitorsCookie, is_checked=is_checked) | ||
| def SetMonitor(self, window, monitorinfo, is_checked=False): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xI", window)) | ||
| buf.write(monitorinfo.pack() if hasattr(monitorinfo, "pack") else MonitorInfo.synthetic(*monitorinfo).pack()) | ||
| buf.write( | ||
| monitorinfo.pack() | ||
| if hasattr(monitorinfo, "pack") | ||
| else MonitorInfo.synthetic(*monitorinfo).pack() | ||
| ) | ||
| return self.send_request(43, buf, is_checked=is_checked) | ||
| def DeleteMonitor(self, window, name, is_checked=False): | ||
@@ -1120,3 +1997,6 @@ buf = io.BytesIO() | ||
| return self.send_request(44, buf, is_checked=is_checked) | ||
| def CreateLease(self, window, lid, num_crtcs, num_outputs, crtcs, outputs, is_checked=True): | ||
| def CreateLease( | ||
| self, window, lid, num_crtcs, num_outputs, crtcs, outputs, is_checked=True | ||
| ): | ||
| buf = io.BytesIO() | ||
@@ -1127,2 +2007,3 @@ buf.write(struct.pack("=xx2xIIHH", window, lid, num_crtcs, num_outputs)) | ||
| return self.send_request(45, buf, CreateLeaseCookie, is_checked=is_checked) | ||
| def FreeLease(self, lid, terminate, is_checked=False): | ||
@@ -1132,2 +2013,4 @@ buf = io.BytesIO() | ||
| return self.send_request(46, buf, is_checked=is_checked) | ||
| xcffib._add_ext(key, randrExtension, _events, _errors) |
+185
-19
| import xcffib | ||
| import struct | ||
| import io | ||
| from dataclasses import dataclass | ||
| MAJOR_VERSION = 1 | ||
@@ -9,4 +11,8 @@ MINOR_VERSION = 13 | ||
| _errors = {} | ||
| @dataclass(init=False) | ||
| class Range8(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -19,2 +25,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -24,3 +31,5 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| fixed_size = 2 | ||
| @classmethod | ||
@@ -32,4 +41,8 @@ def synthetic(cls, first, last): | ||
| return self | ||
| @dataclass(init=False) | ||
| class Range16(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -42,2 +55,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -47,3 +61,5 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| fixed_size = 4 | ||
| @classmethod | ||
@@ -55,4 +71,8 @@ def synthetic(cls, first, last): | ||
| return self | ||
| @dataclass(init=False) | ||
| class ExtRange(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -67,7 +87,17 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
| buf = io.BytesIO() | ||
| buf.write(self.major.pack() if hasattr(self.major, "pack") else Range8.synthetic(*self.major).pack()) | ||
| buf.write(self.minor.pack() if hasattr(self.minor, "pack") else Range16.synthetic(*self.minor).pack()) | ||
| buf.write( | ||
| self.major.pack() | ||
| if hasattr(self.major, "pack") | ||
| else Range8.synthetic(*self.major).pack() | ||
| ) | ||
| buf.write( | ||
| self.minor.pack() | ||
| if hasattr(self.minor, "pack") | ||
| else Range16.synthetic(*self.minor).pack() | ||
| ) | ||
| return buf.getvalue() | ||
| @classmethod | ||
@@ -79,4 +109,8 @@ def synthetic(cls, major, minor): | ||
| return self | ||
| @dataclass(init=False) | ||
| class Range(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -102,16 +136,57 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
| buf = io.BytesIO() | ||
| buf.write(self.core_requests.pack() if hasattr(self.core_requests, "pack") else Range8.synthetic(*self.core_requests).pack()) | ||
| buf.write(self.core_replies.pack() if hasattr(self.core_replies, "pack") else Range8.synthetic(*self.core_replies).pack()) | ||
| buf.write(self.ext_requests.pack() if hasattr(self.ext_requests, "pack") else ExtRange.synthetic(*self.ext_requests).pack()) | ||
| buf.write(self.ext_replies.pack() if hasattr(self.ext_replies, "pack") else ExtRange.synthetic(*self.ext_replies).pack()) | ||
| buf.write(self.delivered_events.pack() if hasattr(self.delivered_events, "pack") else Range8.synthetic(*self.delivered_events).pack()) | ||
| buf.write(self.device_events.pack() if hasattr(self.device_events, "pack") else Range8.synthetic(*self.device_events).pack()) | ||
| buf.write(self.errors.pack() if hasattr(self.errors, "pack") else Range8.synthetic(*self.errors).pack()) | ||
| buf.write( | ||
| self.core_requests.pack() | ||
| if hasattr(self.core_requests, "pack") | ||
| else Range8.synthetic(*self.core_requests).pack() | ||
| ) | ||
| buf.write( | ||
| self.core_replies.pack() | ||
| if hasattr(self.core_replies, "pack") | ||
| else Range8.synthetic(*self.core_replies).pack() | ||
| ) | ||
| buf.write( | ||
| self.ext_requests.pack() | ||
| if hasattr(self.ext_requests, "pack") | ||
| else ExtRange.synthetic(*self.ext_requests).pack() | ||
| ) | ||
| buf.write( | ||
| self.ext_replies.pack() | ||
| if hasattr(self.ext_replies, "pack") | ||
| else ExtRange.synthetic(*self.ext_replies).pack() | ||
| ) | ||
| buf.write( | ||
| self.delivered_events.pack() | ||
| if hasattr(self.delivered_events, "pack") | ||
| else Range8.synthetic(*self.delivered_events).pack() | ||
| ) | ||
| buf.write( | ||
| self.device_events.pack() | ||
| if hasattr(self.device_events, "pack") | ||
| else Range8.synthetic(*self.device_events).pack() | ||
| ) | ||
| buf.write( | ||
| self.errors.pack() | ||
| if hasattr(self.errors, "pack") | ||
| else Range8.synthetic(*self.errors).pack() | ||
| ) | ||
| buf.write(struct.pack("=B", self.client_started)) | ||
| buf.write(struct.pack("=B", self.client_died)) | ||
| return buf.getvalue() | ||
| @classmethod | ||
| def synthetic(cls, core_requests, core_replies, ext_requests, ext_replies, delivered_events, device_events, errors, client_started, client_died): | ||
| def synthetic( | ||
| cls, | ||
| core_requests, | ||
| core_replies, | ||
| ext_requests, | ||
| ext_replies, | ||
| delivered_events, | ||
| device_events, | ||
| errors, | ||
| client_started, | ||
| client_died, | ||
| ): | ||
| self = cls.__new__(cls) | ||
@@ -128,2 +203,5 @@ self.core_requests = core_requests | ||
| return self | ||
| @dataclass(init=False) | ||
| class HType: | ||
@@ -133,2 +211,5 @@ FromServerTime = 1 << 0 | ||
| FromClientSequence = 1 << 2 | ||
| @dataclass(init=False) | ||
| class CS: | ||
@@ -138,4 +219,8 @@ CurrentClients = 1 | ||
| AllClients = 3 | ||
| @dataclass(init=False) | ||
| class ClientInfo(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -149,2 +234,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -155,2 +241,3 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| @classmethod | ||
@@ -163,4 +250,8 @@ def synthetic(cls, client_resource, num_ranges, ranges): | ||
| return self | ||
| @dataclass(init=False) | ||
| class BadContextError(xcffib.Error): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -171,4 +262,5 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.invalid_record, = unpacker.unpack("xx2xI") | ||
| (self.invalid_record,) = unpacker.unpack("xx2xI") | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -179,6 +271,12 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| BadBadContext = BadContextError | ||
| _errors[0] = BadContextError | ||
| @dataclass(init=False) | ||
| class QueryVersionReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -191,6 +289,13 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class QueryVersionCookie(xcffib.Cookie): | ||
| reply_type = QueryVersionReply | ||
| @dataclass(init=False) | ||
| class GetContextReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -201,9 +306,20 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.enabled, self.element_header, self.num_intercepted_clients = unpacker.unpack("xB2x4xB3xI16x") | ||
| self.intercepted_clients = xcffib.List(unpacker, ClientInfo, self.num_intercepted_clients) | ||
| self.enabled, self.element_header, self.num_intercepted_clients = ( | ||
| unpacker.unpack("xB2x4xB3xI16x") | ||
| ) | ||
| self.intercepted_clients = xcffib.List( | ||
| unpacker, ClientInfo, self.num_intercepted_clients | ||
| ) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetContextCookie(xcffib.Cookie): | ||
| reply_type = GetContextReply | ||
| @dataclass(init=False) | ||
| class EnableContextReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -214,7 +330,20 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.category, self.element_header, self.client_swapped, self.xid_base, self.server_time, self.rec_sequence_num = unpacker.unpack("xB2x4xBB2xIII8x") | ||
| ( | ||
| self.category, | ||
| self.element_header, | ||
| self.client_swapped, | ||
| self.xid_base, | ||
| self.server_time, | ||
| self.rec_sequence_num, | ||
| ) = unpacker.unpack("xB2x4xBB2xIII8x") | ||
| self.data = xcffib.List(unpacker, "B", self.length * 4) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class EnableContextCookie(xcffib.Cookie): | ||
| reply_type = EnableContextReply | ||
| @dataclass(init=False) | ||
| class recordExtension(xcffib.Extension): | ||
@@ -225,15 +354,46 @@ def QueryVersion(self, major_version, minor_version, is_checked=True): | ||
| return self.send_request(0, buf, QueryVersionCookie, is_checked=is_checked) | ||
| def CreateContext(self, context, element_header, num_client_specs, num_ranges, client_specs, ranges, is_checked=False): | ||
| def CreateContext( | ||
| self, | ||
| context, | ||
| element_header, | ||
| num_client_specs, | ||
| num_ranges, | ||
| client_specs, | ||
| ranges, | ||
| is_checked=False, | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xIB3xII", context, element_header, num_client_specs, num_ranges)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=xx2xIB3xII", context, element_header, num_client_specs, num_ranges | ||
| ) | ||
| ) | ||
| buf.write(xcffib.pack_list(client_specs, "I")) | ||
| buf.write(xcffib.pack_list(ranges, Range)) | ||
| return self.send_request(1, buf, is_checked=is_checked) | ||
| def RegisterClients(self, context, element_header, num_client_specs, num_ranges, client_specs, ranges, is_checked=False): | ||
| def RegisterClients( | ||
| self, | ||
| context, | ||
| element_header, | ||
| num_client_specs, | ||
| num_ranges, | ||
| client_specs, | ||
| ranges, | ||
| is_checked=False, | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xIB3xII", context, element_header, num_client_specs, num_ranges)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=xx2xIB3xII", context, element_header, num_client_specs, num_ranges | ||
| ) | ||
| ) | ||
| buf.write(xcffib.pack_list(client_specs, "I")) | ||
| buf.write(xcffib.pack_list(ranges, Range)) | ||
| return self.send_request(2, buf, is_checked=is_checked) | ||
| def UnregisterClients(self, context, num_client_specs, client_specs, is_checked=False): | ||
| def UnregisterClients( | ||
| self, context, num_client_specs, client_specs, is_checked=False | ||
| ): | ||
| buf = io.BytesIO() | ||
@@ -243,2 +403,3 @@ buf.write(struct.pack("=xx2xII", context, num_client_specs)) | ||
| return self.send_request(3, buf, is_checked=is_checked) | ||
| def GetContext(self, context, is_checked=True): | ||
@@ -248,2 +409,3 @@ buf = io.BytesIO() | ||
| return self.send_request(4, buf, GetContextCookie, is_checked=is_checked) | ||
| def EnableContext(self, context, is_checked=True): | ||
@@ -253,2 +415,3 @@ buf = io.BytesIO() | ||
| return self.send_request(5, buf, EnableContextCookie, is_checked=is_checked) | ||
| def DisableContext(self, context, is_checked=False): | ||
@@ -258,2 +421,3 @@ buf = io.BytesIO() | ||
| return self.send_request(6, buf, is_checked=is_checked) | ||
| def FreeContext(self, context, is_checked=False): | ||
@@ -263,2 +427,4 @@ buf = io.BytesIO() | ||
| return self.send_request(7, buf, is_checked=is_checked) | ||
| xcffib._add_ext(key, recordExtension, _events, _errors) |
+586
-50
| import xcffib | ||
| import struct | ||
| import io | ||
| from dataclasses import dataclass | ||
| MAJOR_VERSION = 0 | ||
@@ -10,7 +12,16 @@ MINOR_VERSION = 11 | ||
| from . import xproto | ||
| @dataclass(init=False) | ||
| class PictType: | ||
| Indexed = 0 | ||
| Direct = 1 | ||
| @dataclass(init=False) | ||
| class Picture: | ||
| _None = 0 | ||
| @dataclass(init=False) | ||
| class PictOp: | ||
@@ -70,8 +81,17 @@ Clear = 0 | ||
| HSLLuminosity = 62 | ||
| @dataclass(init=False) | ||
| class PolyEdge: | ||
| Sharp = 0 | ||
| Smooth = 1 | ||
| @dataclass(init=False) | ||
| class PolyMode: | ||
| Precise = 0 | ||
| Imprecise = 1 | ||
| @dataclass(init=False) | ||
| class CP: | ||
@@ -91,2 +111,5 @@ Repeat = 1 << 0 | ||
| ComponentAlpha = 1 << 12 | ||
| @dataclass(init=False) | ||
| class SubPixel: | ||
@@ -99,2 +122,5 @@ Unknown = 0 | ||
| _None = 5 | ||
| @dataclass(init=False) | ||
| class Repeat: | ||
@@ -105,4 +131,8 @@ _None = 0 | ||
| Reflect = 3 | ||
| @dataclass(init=False) | ||
| class PictFormatError(xcffib.Error): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -115,2 +145,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -121,6 +152,12 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| BadPictFormat = PictFormatError | ||
| _errors[0] = PictFormatError | ||
| @dataclass(init=False) | ||
| class PictureError(xcffib.Error): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -133,2 +170,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -139,6 +177,12 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| BadPicture = PictureError | ||
| _errors[1] = PictureError | ||
| @dataclass(init=False) | ||
| class PictOpError(xcffib.Error): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -151,2 +195,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -157,6 +202,12 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| BadPictOp = PictOpError | ||
| _errors[2] = PictOpError | ||
| @dataclass(init=False) | ||
| class GlyphSetError(xcffib.Error): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -169,2 +220,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -175,6 +227,12 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| BadGlyphSet = GlyphSetError | ||
| _errors[3] = GlyphSetError | ||
| @dataclass(init=False) | ||
| class GlyphError(xcffib.Error): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -187,2 +245,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -193,6 +252,12 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| BadGlyph = GlyphError | ||
| _errors[4] = GlyphError | ||
| @dataclass(init=False) | ||
| class DIRECTFORMAT(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -203,11 +268,45 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.red_shift, self.red_mask, self.green_shift, self.green_mask, self.blue_shift, self.blue_mask, self.alpha_shift, self.alpha_mask = unpacker.unpack("HHHHHHHH") | ||
| ( | ||
| self.red_shift, | ||
| self.red_mask, | ||
| self.green_shift, | ||
| self.green_mask, | ||
| self.blue_shift, | ||
| self.blue_mask, | ||
| self.alpha_shift, | ||
| self.alpha_mask, | ||
| ) = unpacker.unpack("HHHHHHHH") | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=HHHHHHHH", self.red_shift, self.red_mask, self.green_shift, self.green_mask, self.blue_shift, self.blue_mask, self.alpha_shift, self.alpha_mask)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=HHHHHHHH", | ||
| self.red_shift, | ||
| self.red_mask, | ||
| self.green_shift, | ||
| self.green_mask, | ||
| self.blue_shift, | ||
| self.blue_mask, | ||
| self.alpha_shift, | ||
| self.alpha_mask, | ||
| ) | ||
| ) | ||
| return buf.getvalue() | ||
| fixed_size = 16 | ||
| @classmethod | ||
| def synthetic(cls, red_shift, red_mask, green_shift, green_mask, blue_shift, blue_mask, alpha_shift, alpha_mask): | ||
| def synthetic( | ||
| cls, | ||
| red_shift, | ||
| red_mask, | ||
| green_shift, | ||
| green_mask, | ||
| blue_shift, | ||
| blue_mask, | ||
| alpha_shift, | ||
| alpha_mask, | ||
| ): | ||
| self = cls.__new__(cls) | ||
@@ -223,4 +322,8 @@ self.red_shift = red_shift | ||
| return self | ||
| @dataclass(init=False) | ||
| class PICTFORMINFO(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -233,10 +336,16 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.direct = DIRECTFORMAT(unpacker) | ||
| self.colormap, = unpacker.unpack("I") | ||
| (self.colormap,) = unpacker.unpack("I") | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=IBB2x", self.id, self.type, self.depth)) | ||
| buf.write(self.direct.pack() if hasattr(self.direct, "pack") else DIRECTFORMAT.synthetic(*self.direct).pack()) | ||
| buf.write( | ||
| self.direct.pack() | ||
| if hasattr(self.direct, "pack") | ||
| else DIRECTFORMAT.synthetic(*self.direct).pack() | ||
| ) | ||
| buf.write(struct.pack("=I", self.colormap)) | ||
| return buf.getvalue() | ||
| @classmethod | ||
@@ -251,4 +360,8 @@ def synthetic(cls, id, type, depth, direct, colormap): | ||
| return self | ||
| @dataclass(init=False) | ||
| class PICTVISUAL(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -261,2 +374,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -266,3 +380,5 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| fixed_size = 8 | ||
| @classmethod | ||
@@ -274,4 +390,8 @@ def synthetic(cls, visual, format): | ||
| return self | ||
| @dataclass(init=False) | ||
| class PICTDEPTH(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -285,2 +405,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -291,2 +412,3 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| @classmethod | ||
@@ -299,4 +421,8 @@ def synthetic(cls, depth, num_visuals, visuals): | ||
| return self | ||
| @dataclass(init=False) | ||
| class PICTSCREEN(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -310,2 +436,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -316,2 +443,3 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| @classmethod | ||
@@ -324,4 +452,8 @@ def synthetic(cls, num_depths, fallback, depths): | ||
| return self | ||
| @dataclass(init=False) | ||
| class INDEXVALUE(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -332,9 +464,18 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.pixel, self.red, self.green, self.blue, self.alpha = unpacker.unpack("IHHHH") | ||
| self.pixel, self.red, self.green, self.blue, self.alpha = unpacker.unpack( | ||
| "IHHHH" | ||
| ) | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=IHHHH", self.pixel, self.red, self.green, self.blue, self.alpha)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=IHHHH", self.pixel, self.red, self.green, self.blue, self.alpha | ||
| ) | ||
| ) | ||
| return buf.getvalue() | ||
| fixed_size = 12 | ||
| @classmethod | ||
@@ -349,4 +490,8 @@ def synthetic(cls, pixel, red, green, blue, alpha): | ||
| return self | ||
| @dataclass(init=False) | ||
| class COLOR(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -359,2 +504,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -364,3 +510,5 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| fixed_size = 8 | ||
| @classmethod | ||
@@ -374,4 +522,8 @@ def synthetic(cls, red, green, blue, alpha): | ||
| return self | ||
| @dataclass(init=False) | ||
| class POINTFIX(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -384,2 +536,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -389,3 +542,5 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| fixed_size = 8 | ||
| @classmethod | ||
@@ -397,4 +552,8 @@ def synthetic(cls, x, y): | ||
| return self | ||
| @dataclass(init=False) | ||
| class LINEFIX(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -409,7 +568,17 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
| buf = io.BytesIO() | ||
| buf.write(self.p1.pack() if hasattr(self.p1, "pack") else POINTFIX.synthetic(*self.p1).pack()) | ||
| buf.write(self.p2.pack() if hasattr(self.p2, "pack") else POINTFIX.synthetic(*self.p2).pack()) | ||
| buf.write( | ||
| self.p1.pack() | ||
| if hasattr(self.p1, "pack") | ||
| else POINTFIX.synthetic(*self.p1).pack() | ||
| ) | ||
| buf.write( | ||
| self.p2.pack() | ||
| if hasattr(self.p2, "pack") | ||
| else POINTFIX.synthetic(*self.p2).pack() | ||
| ) | ||
| return buf.getvalue() | ||
| @classmethod | ||
@@ -421,4 +590,8 @@ def synthetic(cls, p1, p2): | ||
| return self | ||
| @dataclass(init=False) | ||
| class TRIANGLE(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -435,8 +608,22 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
| buf = io.BytesIO() | ||
| buf.write(self.p1.pack() if hasattr(self.p1, "pack") else POINTFIX.synthetic(*self.p1).pack()) | ||
| buf.write(self.p2.pack() if hasattr(self.p2, "pack") else POINTFIX.synthetic(*self.p2).pack()) | ||
| buf.write(self.p3.pack() if hasattr(self.p3, "pack") else POINTFIX.synthetic(*self.p3).pack()) | ||
| buf.write( | ||
| self.p1.pack() | ||
| if hasattr(self.p1, "pack") | ||
| else POINTFIX.synthetic(*self.p1).pack() | ||
| ) | ||
| buf.write( | ||
| self.p2.pack() | ||
| if hasattr(self.p2, "pack") | ||
| else POINTFIX.synthetic(*self.p2).pack() | ||
| ) | ||
| buf.write( | ||
| self.p3.pack() | ||
| if hasattr(self.p3, "pack") | ||
| else POINTFIX.synthetic(*self.p3).pack() | ||
| ) | ||
| return buf.getvalue() | ||
| @classmethod | ||
@@ -449,4 +636,8 @@ def synthetic(cls, p1, p2, p3): | ||
| return self | ||
| @dataclass(init=False) | ||
| class TRAPEZOID(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -462,8 +653,18 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=ii", self.top, self.bottom)) | ||
| buf.write(self.left.pack() if hasattr(self.left, "pack") else LINEFIX.synthetic(*self.left).pack()) | ||
| buf.write(self.right.pack() if hasattr(self.right, "pack") else LINEFIX.synthetic(*self.right).pack()) | ||
| buf.write( | ||
| self.left.pack() | ||
| if hasattr(self.left, "pack") | ||
| else LINEFIX.synthetic(*self.left).pack() | ||
| ) | ||
| buf.write( | ||
| self.right.pack() | ||
| if hasattr(self.right, "pack") | ||
| else LINEFIX.synthetic(*self.right).pack() | ||
| ) | ||
| return buf.getvalue() | ||
| @classmethod | ||
@@ -477,4 +678,8 @@ def synthetic(cls, top, bottom, left, right): | ||
| return self | ||
| @dataclass(init=False) | ||
| class GLYPHINFO(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -485,9 +690,24 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.width, self.height, self.x, self.y, self.x_off, self.y_off = unpacker.unpack("HHhhhh") | ||
| self.width, self.height, self.x, self.y, self.x_off, self.y_off = ( | ||
| unpacker.unpack("HHhhhh") | ||
| ) | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=HHhhhh", self.width, self.height, self.x, self.y, self.x_off, self.y_off)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=HHhhhh", | ||
| self.width, | ||
| self.height, | ||
| self.x, | ||
| self.y, | ||
| self.x_off, | ||
| self.y_off, | ||
| ) | ||
| ) | ||
| return buf.getvalue() | ||
| fixed_size = 12 | ||
| @classmethod | ||
@@ -503,4 +723,8 @@ def synthetic(cls, width, height, x, y, x_off, y_off): | ||
| return self | ||
| @dataclass(init=False) | ||
| class QueryVersionReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -513,6 +737,13 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class QueryVersionCookie(xcffib.Cookie): | ||
| reply_type = QueryVersionReply | ||
| @dataclass(init=False) | ||
| class QueryPictFormatsReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -523,3 +754,9 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.num_formats, self.num_screens, self.num_depths, self.num_visuals, self.num_subpixel = unpacker.unpack("xx2x4xIIIII4x") | ||
| ( | ||
| self.num_formats, | ||
| self.num_screens, | ||
| self.num_depths, | ||
| self.num_visuals, | ||
| self.num_subpixel, | ||
| ) = unpacker.unpack("xx2x4xIIIII4x") | ||
| self.formats = xcffib.List(unpacker, PICTFORMINFO, self.num_formats) | ||
@@ -531,6 +768,13 @@ unpacker.pad(PICTSCREEN) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class QueryPictFormatsCookie(xcffib.Cookie): | ||
| reply_type = QueryPictFormatsReply | ||
| @dataclass(init=False) | ||
| class QueryPictIndexValuesReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -541,9 +785,16 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.num_values, = unpacker.unpack("xx2x4xI20x") | ||
| (self.num_values,) = unpacker.unpack("xx2x4xI20x") | ||
| self.values = xcffib.List(unpacker, INDEXVALUE, self.num_values) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class QueryPictIndexValuesCookie(xcffib.Cookie): | ||
| reply_type = QueryPictIndexValuesReply | ||
| @dataclass(init=False) | ||
| class TRANSFORM(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -554,11 +805,48 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.matrix11, self.matrix12, self.matrix13, self.matrix21, self.matrix22, self.matrix23, self.matrix31, self.matrix32, self.matrix33 = unpacker.unpack("iiiiiiiii") | ||
| ( | ||
| self.matrix11, | ||
| self.matrix12, | ||
| self.matrix13, | ||
| self.matrix21, | ||
| self.matrix22, | ||
| self.matrix23, | ||
| self.matrix31, | ||
| self.matrix32, | ||
| self.matrix33, | ||
| ) = unpacker.unpack("iiiiiiiii") | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=iiiiiiiii", self.matrix11, self.matrix12, self.matrix13, self.matrix21, self.matrix22, self.matrix23, self.matrix31, self.matrix32, self.matrix33)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=iiiiiiiii", | ||
| self.matrix11, | ||
| self.matrix12, | ||
| self.matrix13, | ||
| self.matrix21, | ||
| self.matrix22, | ||
| self.matrix23, | ||
| self.matrix31, | ||
| self.matrix32, | ||
| self.matrix33, | ||
| ) | ||
| ) | ||
| return buf.getvalue() | ||
| fixed_size = 36 | ||
| @classmethod | ||
| def synthetic(cls, matrix11, matrix12, matrix13, matrix21, matrix22, matrix23, matrix31, matrix32, matrix33): | ||
| def synthetic( | ||
| cls, | ||
| matrix11, | ||
| matrix12, | ||
| matrix13, | ||
| matrix21, | ||
| matrix22, | ||
| matrix23, | ||
| matrix31, | ||
| matrix32, | ||
| matrix33, | ||
| ): | ||
| self = cls.__new__(cls) | ||
@@ -575,4 +863,8 @@ self.matrix11 = matrix11 | ||
| return self | ||
| @dataclass(init=False) | ||
| class QueryFiltersReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -588,6 +880,13 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class QueryFiltersCookie(xcffib.Cookie): | ||
| reply_type = QueryFiltersReply | ||
| @dataclass(init=False) | ||
| class ANIMCURSORELT(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -600,2 +899,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -605,3 +905,5 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| fixed_size = 8 | ||
| @classmethod | ||
@@ -613,4 +915,8 @@ def synthetic(cls, cursor, delay): | ||
| return self | ||
| @dataclass(init=False) | ||
| class SPANFIX(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -623,2 +929,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -628,3 +935,5 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| fixed_size = 12 | ||
| @classmethod | ||
@@ -637,4 +946,8 @@ def synthetic(cls, l, r, y): | ||
| return self | ||
| @dataclass(init=False) | ||
| class TRAP(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -649,7 +962,17 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
| buf = io.BytesIO() | ||
| buf.write(self.top.pack() if hasattr(self.top, "pack") else SPANFIX.synthetic(*self.top).pack()) | ||
| buf.write(self.bot.pack() if hasattr(self.bot, "pack") else SPANFIX.synthetic(*self.bot).pack()) | ||
| buf.write( | ||
| self.top.pack() | ||
| if hasattr(self.top, "pack") | ||
| else SPANFIX.synthetic(*self.top).pack() | ||
| ) | ||
| buf.write( | ||
| self.bot.pack() | ||
| if hasattr(self.bot, "pack") | ||
| else SPANFIX.synthetic(*self.bot).pack() | ||
| ) | ||
| return buf.getvalue() | ||
| @classmethod | ||
@@ -661,2 +984,5 @@ def synthetic(cls, top, bot): | ||
| return self | ||
| @dataclass(init=False) | ||
| class renderExtension(xcffib.Extension): | ||
@@ -667,2 +993,3 @@ def QueryVersion(self, client_major_version, client_minor_version, is_checked=True): | ||
| return self.send_request(0, buf, QueryVersionCookie, is_checked=is_checked) | ||
| def QueryPictFormats(self, is_checked=True): | ||
@@ -672,7 +999,13 @@ buf = io.BytesIO() | ||
| return self.send_request(1, buf, QueryPictFormatsCookie, is_checked=is_checked) | ||
| def QueryPictIndexValues(self, format, is_checked=True): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xI", format)) | ||
| return self.send_request(2, buf, QueryPictIndexValuesCookie, is_checked=is_checked) | ||
| def CreatePicture(self, pid, drawable, format, value_mask, value_list, is_checked=False): | ||
| return self.send_request( | ||
| 2, buf, QueryPictIndexValuesCookie, is_checked=is_checked | ||
| ) | ||
| def CreatePicture( | ||
| self, pid, drawable, format, value_mask, value_list, is_checked=False | ||
| ): | ||
| buf = io.BytesIO() | ||
@@ -720,2 +1053,3 @@ buf.write(struct.pack("=xx2xIIII", pid, drawable, format, value_mask)) | ||
| return self.send_request(4, buf, is_checked=is_checked) | ||
| def ChangePicture(self, picture, value_mask, value_list, is_checked=False): | ||
@@ -764,3 +1098,12 @@ buf = io.BytesIO() | ||
| return self.send_request(5, buf, is_checked=is_checked) | ||
| def SetPictureClipRectangles(self, picture, clip_x_origin, clip_y_origin, rectangles_len, rectangles, is_checked=False): | ||
| def SetPictureClipRectangles( | ||
| self, | ||
| picture, | ||
| clip_x_origin, | ||
| clip_y_origin, | ||
| rectangles_len, | ||
| rectangles, | ||
| is_checked=False, | ||
| ): | ||
| buf = io.BytesIO() | ||
@@ -770,2 +1113,3 @@ buf.write(struct.pack("=xx2xIhh", picture, clip_x_origin, clip_y_origin)) | ||
| return self.send_request(6, buf, is_checked=is_checked) | ||
| def FreePicture(self, picture, is_checked=False): | ||
@@ -775,7 +1119,51 @@ buf = io.BytesIO() | ||
| return self.send_request(7, buf, is_checked=is_checked) | ||
| def Composite(self, op, src, mask, dst, src_x, src_y, mask_x, mask_y, dst_x, dst_y, width, height, is_checked=False): | ||
| def Composite( | ||
| self, | ||
| op, | ||
| src, | ||
| mask, | ||
| dst, | ||
| src_x, | ||
| src_y, | ||
| mask_x, | ||
| mask_y, | ||
| dst_x, | ||
| dst_y, | ||
| width, | ||
| height, | ||
| is_checked=False, | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xB3xIIIhhhhhhHH", op, src, mask, dst, src_x, src_y, mask_x, mask_y, dst_x, dst_y, width, height)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=xx2xB3xIIIhhhhhhHH", | ||
| op, | ||
| src, | ||
| mask, | ||
| dst, | ||
| src_x, | ||
| src_y, | ||
| mask_x, | ||
| mask_y, | ||
| dst_x, | ||
| dst_y, | ||
| width, | ||
| height, | ||
| ) | ||
| ) | ||
| return self.send_request(8, buf, is_checked=is_checked) | ||
| def Trapezoids(self, op, src, dst, mask_format, src_x, src_y, traps_len, traps, is_checked=False): | ||
| def Trapezoids( | ||
| self, | ||
| op, | ||
| src, | ||
| dst, | ||
| mask_format, | ||
| src_x, | ||
| src_y, | ||
| traps_len, | ||
| traps, | ||
| is_checked=False, | ||
| ): | ||
| buf = io.BytesIO() | ||
@@ -785,3 +1173,15 @@ buf.write(struct.pack("=xx2xB3xIIIhh", op, src, dst, mask_format, src_x, src_y)) | ||
| return self.send_request(10, buf, is_checked=is_checked) | ||
| def Triangles(self, op, src, dst, mask_format, src_x, src_y, triangles_len, triangles, is_checked=False): | ||
| def Triangles( | ||
| self, | ||
| op, | ||
| src, | ||
| dst, | ||
| mask_format, | ||
| src_x, | ||
| src_y, | ||
| triangles_len, | ||
| triangles, | ||
| is_checked=False, | ||
| ): | ||
| buf = io.BytesIO() | ||
@@ -791,3 +1191,15 @@ buf.write(struct.pack("=xx2xB3xIIIhh", op, src, dst, mask_format, src_x, src_y)) | ||
| return self.send_request(11, buf, is_checked=is_checked) | ||
| def TriStrip(self, op, src, dst, mask_format, src_x, src_y, points_len, points, is_checked=False): | ||
| def TriStrip( | ||
| self, | ||
| op, | ||
| src, | ||
| dst, | ||
| mask_format, | ||
| src_x, | ||
| src_y, | ||
| points_len, | ||
| points, | ||
| is_checked=False, | ||
| ): | ||
| buf = io.BytesIO() | ||
@@ -797,3 +1209,15 @@ buf.write(struct.pack("=xx2xB3xIIIhh", op, src, dst, mask_format, src_x, src_y)) | ||
| return self.send_request(12, buf, is_checked=is_checked) | ||
| def TriFan(self, op, src, dst, mask_format, src_x, src_y, points_len, points, is_checked=False): | ||
| def TriFan( | ||
| self, | ||
| op, | ||
| src, | ||
| dst, | ||
| mask_format, | ||
| src_x, | ||
| src_y, | ||
| points_len, | ||
| points, | ||
| is_checked=False, | ||
| ): | ||
| buf = io.BytesIO() | ||
@@ -803,2 +1227,3 @@ buf.write(struct.pack("=xx2xB3xIIIhh", op, src, dst, mask_format, src_x, src_y)) | ||
| return self.send_request(13, buf, is_checked=is_checked) | ||
| def CreateGlyphSet(self, gsid, format, is_checked=False): | ||
@@ -808,2 +1233,3 @@ buf = io.BytesIO() | ||
| return self.send_request(17, buf, is_checked=is_checked) | ||
| def ReferenceGlyphSet(self, gsid, existing, is_checked=False): | ||
@@ -813,2 +1239,3 @@ buf = io.BytesIO() | ||
| return self.send_request(18, buf, is_checked=is_checked) | ||
| def FreeGlyphSet(self, glyphset, is_checked=False): | ||
@@ -818,3 +1245,6 @@ buf = io.BytesIO() | ||
| return self.send_request(19, buf, is_checked=is_checked) | ||
| def AddGlyphs(self, glyphset, glyphs_len, glyphids, glyphs, data_len, data, is_checked=False): | ||
| def AddGlyphs( | ||
| self, glyphset, glyphs_len, glyphids, glyphs, data_len, data, is_checked=False | ||
| ): | ||
| buf = io.BytesIO() | ||
@@ -826,2 +1256,3 @@ buf.write(struct.pack("=xx2xII", glyphset, glyphs_len)) | ||
| return self.send_request(20, buf, is_checked=is_checked) | ||
| def FreeGlyphs(self, glyphset, glyphs_len, glyphs, is_checked=False): | ||
@@ -832,23 +1263,78 @@ buf = io.BytesIO() | ||
| return self.send_request(22, buf, is_checked=is_checked) | ||
| def CompositeGlyphs8(self, op, src, dst, mask_format, glyphset, src_x, src_y, glyphcmds_len, glyphcmds, is_checked=False): | ||
| def CompositeGlyphs8( | ||
| self, | ||
| op, | ||
| src, | ||
| dst, | ||
| mask_format, | ||
| glyphset, | ||
| src_x, | ||
| src_y, | ||
| glyphcmds_len, | ||
| glyphcmds, | ||
| is_checked=False, | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xB3xIIIIhh", op, src, dst, mask_format, glyphset, src_x, src_y)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=xx2xB3xIIIIhh", op, src, dst, mask_format, glyphset, src_x, src_y | ||
| ) | ||
| ) | ||
| buf.write(xcffib.pack_list(glyphcmds, "B")) | ||
| return self.send_request(23, buf, is_checked=is_checked) | ||
| def CompositeGlyphs16(self, op, src, dst, mask_format, glyphset, src_x, src_y, glyphcmds_len, glyphcmds, is_checked=False): | ||
| def CompositeGlyphs16( | ||
| self, | ||
| op, | ||
| src, | ||
| dst, | ||
| mask_format, | ||
| glyphset, | ||
| src_x, | ||
| src_y, | ||
| glyphcmds_len, | ||
| glyphcmds, | ||
| is_checked=False, | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xB3xIIIIhh", op, src, dst, mask_format, glyphset, src_x, src_y)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=xx2xB3xIIIIhh", op, src, dst, mask_format, glyphset, src_x, src_y | ||
| ) | ||
| ) | ||
| buf.write(xcffib.pack_list(glyphcmds, "B")) | ||
| return self.send_request(24, buf, is_checked=is_checked) | ||
| def CompositeGlyphs32(self, op, src, dst, mask_format, glyphset, src_x, src_y, glyphcmds_len, glyphcmds, is_checked=False): | ||
| def CompositeGlyphs32( | ||
| self, | ||
| op, | ||
| src, | ||
| dst, | ||
| mask_format, | ||
| glyphset, | ||
| src_x, | ||
| src_y, | ||
| glyphcmds_len, | ||
| glyphcmds, | ||
| is_checked=False, | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xB3xIIIIhh", op, src, dst, mask_format, glyphset, src_x, src_y)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=xx2xB3xIIIIhh", op, src, dst, mask_format, glyphset, src_x, src_y | ||
| ) | ||
| ) | ||
| buf.write(xcffib.pack_list(glyphcmds, "B")) | ||
| return self.send_request(25, buf, is_checked=is_checked) | ||
| 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( | ||
| color.pack() if hasattr(color, "pack") else COLOR.synthetic(*color).pack() | ||
| ) | ||
| buf.write(xcffib.pack_list(rects, xproto.RECTANGLE)) | ||
| return self.send_request(26, buf, is_checked=is_checked) | ||
| def CreateCursor(self, cid, source, x, y, is_checked=False): | ||
@@ -858,7 +1344,13 @@ buf = io.BytesIO() | ||
| return self.send_request(27, buf, is_checked=is_checked) | ||
| def SetPictureTransform(self, picture, transform, is_checked=False): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xI", picture)) | ||
| buf.write(transform.pack() if hasattr(transform, "pack") else TRANSFORM.synthetic(*transform).pack()) | ||
| buf.write( | ||
| transform.pack() | ||
| if hasattr(transform, "pack") | ||
| else TRANSFORM.synthetic(*transform).pack() | ||
| ) | ||
| return self.send_request(28, buf, is_checked=is_checked) | ||
| def QueryFilters(self, drawable, is_checked=True): | ||
@@ -868,9 +1360,17 @@ buf = io.BytesIO() | ||
| return self.send_request(29, buf, QueryFiltersCookie, is_checked=is_checked) | ||
| def SetPictureFilter(self, picture, filter_len, filter, values_len, values, is_checked=False): | ||
| def SetPictureFilter( | ||
| self, picture, filter_len, filter, values_len, values, is_checked=False | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xIH2x", picture, filter_len)) | ||
| buf.write(xcffib.pack_list(filter, "c")) | ||
| buf.write(struct.pack("=4x", )) | ||
| buf.write( | ||
| struct.pack( | ||
| "=4x", | ||
| ) | ||
| ) | ||
| buf.write(xcffib.pack_list(values, "i")) | ||
| return self.send_request(30, buf, is_checked=is_checked) | ||
| def CreateAnimCursor(self, cid, cursors_len, cursors, is_checked=False): | ||
@@ -881,2 +1381,3 @@ buf = io.BytesIO() | ||
| return self.send_request(31, buf, is_checked=is_checked) | ||
| def AddTraps(self, picture, x_off, y_off, traps_len, traps, is_checked=False): | ||
@@ -887,8 +1388,14 @@ buf = io.BytesIO() | ||
| return self.send_request(32, buf, is_checked=is_checked) | ||
| def CreateSolidFill(self, picture, color, is_checked=False): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xI", picture)) | ||
| buf.write(color.pack() if hasattr(color, "pack") else COLOR.synthetic(*color).pack()) | ||
| buf.write( | ||
| color.pack() if hasattr(color, "pack") else COLOR.synthetic(*color).pack() | ||
| ) | ||
| return self.send_request(33, buf, is_checked=is_checked) | ||
| def CreateLinearGradient(self, picture, p1, p2, num_stops, stops, colors, is_checked=False): | ||
| def CreateLinearGradient( | ||
| self, picture, p1, p2, num_stops, stops, colors, is_checked=False | ||
| ): | ||
| buf = io.BytesIO() | ||
@@ -902,7 +1409,27 @@ buf.write(struct.pack("=xx2xI", picture)) | ||
| return self.send_request(34, buf, is_checked=is_checked) | ||
| def CreateRadialGradient(self, picture, inner, outer, inner_radius, outer_radius, num_stops, stops, colors, is_checked=False): | ||
| def CreateRadialGradient( | ||
| self, | ||
| picture, | ||
| inner, | ||
| outer, | ||
| inner_radius, | ||
| outer_radius, | ||
| num_stops, | ||
| stops, | ||
| colors, | ||
| is_checked=False, | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xI", picture)) | ||
| buf.write(inner.pack() if hasattr(inner, "pack") else POINTFIX.synthetic(*inner).pack()) | ||
| buf.write(outer.pack() if hasattr(outer, "pack") else POINTFIX.synthetic(*outer).pack()) | ||
| buf.write( | ||
| inner.pack() | ||
| if hasattr(inner, "pack") | ||
| else POINTFIX.synthetic(*inner).pack() | ||
| ) | ||
| buf.write( | ||
| outer.pack() | ||
| if hasattr(outer, "pack") | ||
| else POINTFIX.synthetic(*outer).pack() | ||
| ) | ||
| buf.write(struct.pack("=i", inner_radius)) | ||
@@ -914,6 +1441,13 @@ buf.write(struct.pack("=i", outer_radius)) | ||
| return self.send_request(35, buf, is_checked=is_checked) | ||
| def CreateConicalGradient(self, picture, center, angle, num_stops, stops, colors, is_checked=False): | ||
| def CreateConicalGradient( | ||
| self, picture, center, angle, num_stops, stops, colors, is_checked=False | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xI", picture)) | ||
| buf.write(center.pack() if hasattr(center, "pack") else POINTFIX.synthetic(*center).pack()) | ||
| buf.write( | ||
| center.pack() | ||
| if hasattr(center, "pack") | ||
| else POINTFIX.synthetic(*center).pack() | ||
| ) | ||
| buf.write(struct.pack("=i", angle)) | ||
@@ -924,2 +1458,4 @@ buf.write(struct.pack("=I", num_stops)) | ||
| return self.send_request(36, buf, is_checked=is_checked) | ||
| xcffib._add_ext(key, renderExtension, _events, _errors) |
+136
-13
| import xcffib | ||
| import struct | ||
| import io | ||
| from dataclasses import dataclass | ||
| MAJOR_VERSION = 1 | ||
@@ -10,4 +12,8 @@ MINOR_VERSION = 2 | ||
| from . import xproto | ||
| @dataclass(init=False) | ||
| class Client(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -20,2 +26,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -25,3 +32,5 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| fixed_size = 8 | ||
| @classmethod | ||
@@ -33,4 +42,8 @@ def synthetic(cls, resource_base, resource_mask): | ||
| return self | ||
| @dataclass(init=False) | ||
| class Type(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -43,2 +56,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -48,3 +62,5 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| fixed_size = 8 | ||
| @classmethod | ||
@@ -56,7 +72,14 @@ def synthetic(cls, resource_type, count): | ||
| return self | ||
| @dataclass(init=False) | ||
| class ClientIdMask: | ||
| ClientXID = 1 << 0 | ||
| LocalClientPID = 1 << 1 | ||
| @dataclass(init=False) | ||
| class ClientIdSpec(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -69,2 +92,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -74,3 +98,5 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| fixed_size = 8 | ||
| @classmethod | ||
@@ -82,4 +108,8 @@ def synthetic(cls, client, mask): | ||
| return self | ||
| @dataclass(init=False) | ||
| class ClientIdValue(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -91,12 +121,18 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.spec = ClientIdSpec(unpacker) | ||
| self.length, = unpacker.unpack("I") | ||
| (self.length,) = unpacker.unpack("I") | ||
| unpacker.pad("I") | ||
| self.value = xcffib.List(unpacker, "I", self.length // 4) | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
| buf = io.BytesIO() | ||
| buf.write(self.spec.pack() if hasattr(self.spec, "pack") else ClientIdSpec.synthetic(*self.spec).pack()) | ||
| buf.write( | ||
| self.spec.pack() | ||
| if hasattr(self.spec, "pack") | ||
| else ClientIdSpec.synthetic(*self.spec).pack() | ||
| ) | ||
| buf.write(struct.pack("=I", self.length)) | ||
| buf.write(xcffib.pack_list(self.value, "I")) | ||
| return buf.getvalue() | ||
| @classmethod | ||
@@ -109,4 +145,8 @@ def synthetic(cls, spec, length, value): | ||
| return self | ||
| @dataclass(init=False) | ||
| class ResourceIdSpec(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -119,2 +159,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -124,3 +165,5 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| fixed_size = 8 | ||
| @classmethod | ||
@@ -132,4 +175,8 @@ def synthetic(cls, resource, type): | ||
| return self | ||
| @dataclass(init=False) | ||
| class ResourceSizeSpec(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -143,5 +190,10 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
| buf = io.BytesIO() | ||
| buf.write(self.spec.pack() if hasattr(self.spec, "pack") else ResourceIdSpec.synthetic(*self.spec).pack()) | ||
| buf.write( | ||
| self.spec.pack() | ||
| if hasattr(self.spec, "pack") | ||
| else ResourceIdSpec.synthetic(*self.spec).pack() | ||
| ) | ||
| buf.write(struct.pack("=I", self.bytes)) | ||
@@ -151,2 +203,3 @@ buf.write(struct.pack("=I", self.ref_count)) | ||
| return buf.getvalue() | ||
| @classmethod | ||
@@ -160,4 +213,8 @@ def synthetic(cls, spec, bytes, ref_count, use_count): | ||
| return self | ||
| @dataclass(init=False) | ||
| class ResourceSizeValue(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -169,12 +226,20 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.size = ResourceSizeSpec(unpacker) | ||
| self.num_cross_references, = unpacker.unpack("I") | ||
| (self.num_cross_references,) = unpacker.unpack("I") | ||
| unpacker.pad(ResourceSizeSpec) | ||
| self.cross_references = xcffib.List(unpacker, ResourceSizeSpec, self.num_cross_references) | ||
| self.cross_references = xcffib.List( | ||
| unpacker, ResourceSizeSpec, self.num_cross_references | ||
| ) | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
| buf = io.BytesIO() | ||
| buf.write(self.size.pack() if hasattr(self.size, "pack") else ResourceSizeSpec.synthetic(*self.size).pack()) | ||
| buf.write( | ||
| self.size.pack() | ||
| if hasattr(self.size, "pack") | ||
| else ResourceSizeSpec.synthetic(*self.size).pack() | ||
| ) | ||
| buf.write(struct.pack("=I", self.num_cross_references)) | ||
| buf.write(xcffib.pack_list(self.cross_references, ResourceSizeSpec)) | ||
| return buf.getvalue() | ||
| @classmethod | ||
@@ -187,4 +252,8 @@ def synthetic(cls, size, num_cross_references, cross_references): | ||
| return self | ||
| @dataclass(init=False) | ||
| class QueryVersionReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -197,6 +266,13 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class QueryVersionCookie(xcffib.Cookie): | ||
| reply_type = QueryVersionReply | ||
| @dataclass(init=False) | ||
| class QueryClientsReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -207,9 +283,16 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.num_clients, = unpacker.unpack("xx2x4xI20x") | ||
| (self.num_clients,) = unpacker.unpack("xx2x4xI20x") | ||
| self.clients = xcffib.List(unpacker, Client, self.num_clients) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class QueryClientsCookie(xcffib.Cookie): | ||
| reply_type = QueryClientsReply | ||
| @dataclass(init=False) | ||
| class QueryClientResourcesReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -220,9 +303,16 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.num_types, = unpacker.unpack("xx2x4xI20x") | ||
| (self.num_types,) = unpacker.unpack("xx2x4xI20x") | ||
| self.types = xcffib.List(unpacker, Type, self.num_types) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class QueryClientResourcesCookie(xcffib.Cookie): | ||
| reply_type = QueryClientResourcesReply | ||
| @dataclass(init=False) | ||
| class QueryClientPixmapBytesReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -235,6 +325,13 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class QueryClientPixmapBytesCookie(xcffib.Cookie): | ||
| reply_type = QueryClientPixmapBytesReply | ||
| @dataclass(init=False) | ||
| class QueryClientIdsReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -245,9 +342,16 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.num_ids, = unpacker.unpack("xx2x4xI20x") | ||
| (self.num_ids,) = unpacker.unpack("xx2x4xI20x") | ||
| self.ids = xcffib.List(unpacker, ClientIdValue, self.num_ids) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class QueryClientIdsCookie(xcffib.Cookie): | ||
| reply_type = QueryClientIdsReply | ||
| @dataclass(init=False) | ||
| class QueryResourceBytesReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -258,7 +362,13 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.num_sizes, = unpacker.unpack("xx2x4xI20x") | ||
| (self.num_sizes,) = unpacker.unpack("xx2x4xI20x") | ||
| self.sizes = xcffib.List(unpacker, ResourceSizeValue, self.num_sizes) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class QueryResourceBytesCookie(xcffib.Cookie): | ||
| reply_type = QueryResourceBytesReply | ||
| @dataclass(init=False) | ||
| class resExtension(xcffib.Extension): | ||
@@ -269,2 +379,3 @@ def QueryVersion(self, client_major, client_minor, is_checked=True): | ||
| return self.send_request(0, buf, QueryVersionCookie, is_checked=is_checked) | ||
| def QueryClients(self, is_checked=True): | ||
@@ -274,10 +385,17 @@ buf = io.BytesIO() | ||
| return self.send_request(1, buf, QueryClientsCookie, is_checked=is_checked) | ||
| def QueryClientResources(self, xid, is_checked=True): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xI", xid)) | ||
| return self.send_request(2, buf, QueryClientResourcesCookie, is_checked=is_checked) | ||
| return self.send_request( | ||
| 2, buf, QueryClientResourcesCookie, is_checked=is_checked | ||
| ) | ||
| def QueryClientPixmapBytes(self, xid, is_checked=True): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xI", xid)) | ||
| return self.send_request(3, buf, QueryClientPixmapBytesCookie, is_checked=is_checked) | ||
| return self.send_request( | ||
| 3, buf, QueryClientPixmapBytesCookie, is_checked=is_checked | ||
| ) | ||
| def QueryClientIds(self, num_specs, specs, is_checked=True): | ||
@@ -288,2 +406,3 @@ buf = io.BytesIO() | ||
| return self.send_request(4, buf, QueryClientIdsCookie, is_checked=is_checked) | ||
| def QueryResourceBytes(self, client, num_specs, specs, is_checked=True): | ||
@@ -293,3 +412,7 @@ buf = io.BytesIO() | ||
| buf.write(xcffib.pack_list(specs, ResourceIdSpec)) | ||
| return self.send_request(5, buf, QueryResourceBytesCookie, is_checked=is_checked) | ||
| return self.send_request( | ||
| 5, buf, QueryResourceBytesCookie, is_checked=is_checked | ||
| ) | ||
| xcffib._add_ext(key, resExtension, _events, _errors) |
| import xcffib | ||
| import struct | ||
| import io | ||
| from dataclasses import dataclass | ||
| MAJOR_VERSION = 1 | ||
@@ -10,2 +12,5 @@ MINOR_VERSION = 1 | ||
| from . import xproto | ||
| @dataclass(init=False) | ||
| class Kind: | ||
@@ -15,5 +20,11 @@ Blanked = 0 | ||
| External = 2 | ||
| @dataclass(init=False) | ||
| class Event: | ||
| NotifyMask = 1 << 0 | ||
| CycleMask = 1 << 1 | ||
| @dataclass(init=False) | ||
| class State: | ||
@@ -24,4 +35,8 @@ Off = 0 | ||
| Disabled = 3 | ||
| @dataclass(init=False) | ||
| class QueryVersionReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -32,8 +47,17 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.server_major_version, self.server_minor_version = unpacker.unpack("xx2x4xHH20x") | ||
| self.server_major_version, self.server_minor_version = unpacker.unpack( | ||
| "xx2x4xHH20x" | ||
| ) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class QueryVersionCookie(xcffib.Cookie): | ||
| reply_type = QueryVersionReply | ||
| @dataclass(init=False) | ||
| class QueryInfoReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -44,8 +68,22 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.state, self.saver_window, self.ms_until_server, self.ms_since_user_input, self.event_mask, self.kind = unpacker.unpack("xB2x4xIIIIB7x") | ||
| ( | ||
| self.state, | ||
| self.saver_window, | ||
| self.ms_until_server, | ||
| self.ms_since_user_input, | ||
| self.event_mask, | ||
| self.kind, | ||
| ) = unpacker.unpack("xB2x4xIIIIB7x") | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class QueryInfoCookie(xcffib.Cookie): | ||
| reply_type = QueryInfoReply | ||
| @dataclass(init=False) | ||
| class NotifyEvent(xcffib.Event): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -56,8 +94,21 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.state, self.time, self.root, self.window, self.kind, self.forced = unpacker.unpack("xB2xIIIBB14x") | ||
| self.state, self.time, self.root, self.window, self.kind, self.forced = ( | ||
| unpacker.unpack("xB2xIIIBB14x") | ||
| ) | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=B", 0)) | ||
| buf.write(struct.pack("=B2xIIIBB14x", self.state, self.time, self.root, self.window, self.kind, self.forced)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=B2xIIIBB14x", | ||
| self.state, | ||
| self.time, | ||
| self.root, | ||
| self.window, | ||
| self.kind, | ||
| self.forced, | ||
| ) | ||
| ) | ||
| buf_len = len(buf.getvalue()) | ||
@@ -67,2 +118,3 @@ if buf_len < 32: | ||
| return buf.getvalue() | ||
| @classmethod | ||
@@ -78,3 +130,8 @@ def synthetic(cls, state, time, root, window, kind, forced): | ||
| return self | ||
| _events[0] = NotifyEvent | ||
| @dataclass(init=False) | ||
| class screensaverExtension(xcffib.Extension): | ||
@@ -85,2 +142,3 @@ def QueryVersion(self, client_major_version, client_minor_version, is_checked=True): | ||
| return self.send_request(0, buf, QueryVersionCookie, is_checked=is_checked) | ||
| def QueryInfo(self, drawable, is_checked=True): | ||
@@ -90,2 +148,3 @@ buf = io.BytesIO() | ||
| return self.send_request(1, buf, QueryInfoCookie, is_checked=is_checked) | ||
| def SelectInput(self, drawable, event_mask, is_checked=False): | ||
@@ -95,5 +154,34 @@ buf = io.BytesIO() | ||
| return self.send_request(2, buf, is_checked=is_checked) | ||
| def SetAttributes(self, drawable, x, y, width, height, border_width, _class, depth, visual, value_mask, value_list, is_checked=False): | ||
| def SetAttributes( | ||
| self, | ||
| drawable, | ||
| x, | ||
| y, | ||
| width, | ||
| height, | ||
| border_width, | ||
| _class, | ||
| depth, | ||
| visual, | ||
| value_mask, | ||
| value_list, | ||
| is_checked=False, | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xIhhHHHBBII", drawable, x, y, width, height, border_width, _class, depth, visual, value_mask)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=xx2xIhhHHHBBII", | ||
| drawable, | ||
| x, | ||
| y, | ||
| width, | ||
| height, | ||
| border_width, | ||
| _class, | ||
| depth, | ||
| visual, | ||
| value_mask, | ||
| ) | ||
| ) | ||
| if value_mask & xproto.CW: | ||
@@ -145,2 +233,3 @@ background_pixmap = value_list.pop(0) | ||
| return self.send_request(3, buf, is_checked=is_checked) | ||
| def UnsetAttributes(self, drawable, is_checked=False): | ||
@@ -150,2 +239,3 @@ buf = io.BytesIO() | ||
| return self.send_request(4, buf, is_checked=is_checked) | ||
| def Suspend(self, suspend, is_checked=False): | ||
@@ -155,2 +245,4 @@ buf = io.BytesIO() | ||
| return self.send_request(5, buf, is_checked=is_checked) | ||
| xcffib._add_ext(key, screensaverExtension, _events, _errors) |
+179
-13
| import xcffib | ||
| import struct | ||
| import io | ||
| from dataclasses import dataclass | ||
| MAJOR_VERSION = 1 | ||
@@ -10,2 +12,5 @@ MINOR_VERSION = 1 | ||
| from . import xproto | ||
| @dataclass(init=False) | ||
| class SO: | ||
@@ -17,2 +22,5 @@ Set = 0 | ||
| Invert = 4 | ||
| @dataclass(init=False) | ||
| class SK: | ||
@@ -22,4 +30,8 @@ Bounding = 0 | ||
| Input = 2 | ||
| @dataclass(init=False) | ||
| class NotifyEvent(xcffib.Event): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -30,8 +42,30 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.shape_kind, self.affected_window, self.extents_x, self.extents_y, self.extents_width, self.extents_height, self.server_time, self.shaped = unpacker.unpack("xB2xIhhHHIB11x") | ||
| ( | ||
| self.shape_kind, | ||
| self.affected_window, | ||
| self.extents_x, | ||
| self.extents_y, | ||
| self.extents_width, | ||
| self.extents_height, | ||
| self.server_time, | ||
| self.shaped, | ||
| ) = unpacker.unpack("xB2xIhhHHIB11x") | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=B", 0)) | ||
| buf.write(struct.pack("=B2xIhhHHIB11x", self.shape_kind, self.affected_window, self.extents_x, self.extents_y, self.extents_width, self.extents_height, self.server_time, self.shaped)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=B2xIhhHHIB11x", | ||
| self.shape_kind, | ||
| self.affected_window, | ||
| self.extents_x, | ||
| self.extents_y, | ||
| self.extents_width, | ||
| self.extents_height, | ||
| self.server_time, | ||
| self.shaped, | ||
| ) | ||
| ) | ||
| buf_len = len(buf.getvalue()) | ||
@@ -41,4 +75,15 @@ if buf_len < 32: | ||
| return buf.getvalue() | ||
| @classmethod | ||
| def synthetic(cls, shape_kind, affected_window, extents_x, extents_y, extents_width, extents_height, server_time, shaped): | ||
| def synthetic( | ||
| cls, | ||
| shape_kind, | ||
| affected_window, | ||
| extents_x, | ||
| extents_y, | ||
| extents_width, | ||
| extents_height, | ||
| server_time, | ||
| shaped, | ||
| ): | ||
| self = cls.__new__(cls) | ||
@@ -54,5 +99,11 @@ self.shape_kind = shape_kind | ||
| return self | ||
| _events[0] = NotifyEvent | ||
| @dataclass(init=False) | ||
| class QueryVersionReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -65,6 +116,13 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class QueryVersionCookie(xcffib.Cookie): | ||
| reply_type = QueryVersionReply | ||
| @dataclass(init=False) | ||
| class QueryExtentsReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -75,8 +133,26 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.bounding_shaped, self.clip_shaped, self.bounding_shape_extents_x, self.bounding_shape_extents_y, self.bounding_shape_extents_width, self.bounding_shape_extents_height, self.clip_shape_extents_x, self.clip_shape_extents_y, self.clip_shape_extents_width, self.clip_shape_extents_height = unpacker.unpack("xx2x4xBB2xhhHHhhHH") | ||
| ( | ||
| self.bounding_shaped, | ||
| self.clip_shaped, | ||
| self.bounding_shape_extents_x, | ||
| self.bounding_shape_extents_y, | ||
| self.bounding_shape_extents_width, | ||
| self.bounding_shape_extents_height, | ||
| self.clip_shape_extents_x, | ||
| self.clip_shape_extents_y, | ||
| self.clip_shape_extents_width, | ||
| self.clip_shape_extents_height, | ||
| ) = unpacker.unpack("xx2x4xBB2xhhHHhhHH") | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class QueryExtentsCookie(xcffib.Cookie): | ||
| reply_type = QueryExtentsReply | ||
| @dataclass(init=False) | ||
| class InputSelectedReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -87,8 +163,15 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.enabled, = unpacker.unpack("xB2x4x") | ||
| (self.enabled,) = unpacker.unpack("xB2x4x") | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class InputSelectedCookie(xcffib.Cookie): | ||
| reply_type = InputSelectedReply | ||
| @dataclass(init=False) | ||
| class GetRectanglesReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -102,4 +185,10 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetRectanglesCookie(xcffib.Cookie): | ||
| reply_type = GetRectanglesReply | ||
| @dataclass(init=False) | ||
| class shapeExtension(xcffib.Extension): | ||
@@ -110,19 +199,91 @@ def QueryVersion(self, is_checked=True): | ||
| return self.send_request(0, buf, QueryVersionCookie, is_checked=is_checked) | ||
| def Rectangles(self, operation, destination_kind, ordering, destination_window, x_offset, y_offset, rectangles_len, rectangles, is_checked=False): | ||
| def Rectangles( | ||
| self, | ||
| operation, | ||
| destination_kind, | ||
| ordering, | ||
| destination_window, | ||
| x_offset, | ||
| y_offset, | ||
| rectangles_len, | ||
| rectangles, | ||
| is_checked=False, | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xBBBxIhh", operation, destination_kind, ordering, destination_window, x_offset, y_offset)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=xx2xBBBxIhh", | ||
| operation, | ||
| destination_kind, | ||
| ordering, | ||
| destination_window, | ||
| x_offset, | ||
| y_offset, | ||
| ) | ||
| ) | ||
| buf.write(xcffib.pack_list(rectangles, xproto.RECTANGLE)) | ||
| return self.send_request(1, buf, is_checked=is_checked) | ||
| def Mask(self, operation, destination_kind, destination_window, x_offset, y_offset, source_bitmap, is_checked=False): | ||
| def Mask( | ||
| self, | ||
| operation, | ||
| destination_kind, | ||
| destination_window, | ||
| x_offset, | ||
| y_offset, | ||
| source_bitmap, | ||
| is_checked=False, | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xBB2xIhhI", operation, destination_kind, destination_window, x_offset, y_offset, source_bitmap)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=xx2xBB2xIhhI", | ||
| operation, | ||
| destination_kind, | ||
| destination_window, | ||
| x_offset, | ||
| y_offset, | ||
| source_bitmap, | ||
| ) | ||
| ) | ||
| return self.send_request(2, buf, is_checked=is_checked) | ||
| def Combine(self, operation, destination_kind, source_kind, destination_window, x_offset, y_offset, source_window, is_checked=False): | ||
| def Combine( | ||
| self, | ||
| operation, | ||
| destination_kind, | ||
| source_kind, | ||
| destination_window, | ||
| x_offset, | ||
| y_offset, | ||
| source_window, | ||
| is_checked=False, | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xBBBxIhhI", operation, destination_kind, source_kind, destination_window, x_offset, y_offset, source_window)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=xx2xBBBxIhhI", | ||
| operation, | ||
| destination_kind, | ||
| source_kind, | ||
| destination_window, | ||
| x_offset, | ||
| y_offset, | ||
| source_window, | ||
| ) | ||
| ) | ||
| return self.send_request(3, buf, is_checked=is_checked) | ||
| def Offset(self, destination_kind, destination_window, x_offset, y_offset, is_checked=False): | ||
| def Offset( | ||
| self, destination_kind, destination_window, x_offset, y_offset, is_checked=False | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xB3xIhh", destination_kind, destination_window, x_offset, y_offset)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=xx2xB3xIhh", destination_kind, destination_window, x_offset, y_offset | ||
| ) | ||
| ) | ||
| return self.send_request(4, buf, is_checked=is_checked) | ||
| def QueryExtents(self, destination_window, is_checked=True): | ||
@@ -132,2 +293,3 @@ buf = io.BytesIO() | ||
| return self.send_request(5, buf, QueryExtentsCookie, is_checked=is_checked) | ||
| def SelectInput(self, destination_window, enable, is_checked=False): | ||
@@ -137,2 +299,3 @@ buf = io.BytesIO() | ||
| return self.send_request(6, buf, is_checked=is_checked) | ||
| def InputSelected(self, destination_window, is_checked=True): | ||
@@ -142,2 +305,3 @@ buf = io.BytesIO() | ||
| return self.send_request(7, buf, InputSelectedCookie, is_checked=is_checked) | ||
| def GetRectangles(self, window, source_kind, is_checked=True): | ||
@@ -147,2 +311,4 @@ buf = io.BytesIO() | ||
| return self.send_request(8, buf, GetRectanglesCookie, is_checked=is_checked) | ||
| xcffib._add_ext(key, shapeExtension, _events, _errors) |
+154
-12
| import xcffib | ||
| import struct | ||
| import io | ||
| from dataclasses import dataclass | ||
| MAJOR_VERSION = 1 | ||
@@ -10,4 +12,8 @@ MINOR_VERSION = 2 | ||
| from . import xproto | ||
| @dataclass(init=False) | ||
| class CompletionEvent(xcffib.Event): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -18,8 +24,20 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.drawable, self.minor_event, self.major_event, self.shmseg, self.offset = unpacker.unpack("xx2xIHBxII") | ||
| self.drawable, self.minor_event, self.major_event, self.shmseg, self.offset = ( | ||
| unpacker.unpack("xx2xIHBxII") | ||
| ) | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
| buf = io.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.write( | ||
| struct.pack( | ||
| "=x2xIHBxII", | ||
| self.drawable, | ||
| self.minor_event, | ||
| self.major_event, | ||
| self.shmseg, | ||
| self.offset, | ||
| ) | ||
| ) | ||
| buf_len = len(buf.getvalue()) | ||
@@ -29,2 +47,3 @@ if buf_len < 32: | ||
| return buf.getvalue() | ||
| @classmethod | ||
@@ -39,5 +58,11 @@ def synthetic(cls, drawable, minor_event, major_event, shmseg, offset): | ||
| return self | ||
| _events[0] = CompletionEvent | ||
| @dataclass(init=False) | ||
| class BadSegError(xcffib.Error): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -48,13 +73,26 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.bad_value, self.minor_opcode, self.major_opcode = unpacker.unpack("xx2xIHBx") | ||
| self.bad_value, self.minor_opcode, self.major_opcode = unpacker.unpack( | ||
| "xx2xIHBx" | ||
| ) | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=B", 0)) | ||
| buf.write(struct.pack("=x2xIHBx", self.bad_value, self.minor_opcode, self.major_opcode)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=x2xIHBx", self.bad_value, self.minor_opcode, self.major_opcode | ||
| ) | ||
| ) | ||
| return buf.getvalue() | ||
| BadBadSeg = BadSegError | ||
| _errors[0] = BadSegError | ||
| @dataclass(init=False) | ||
| class QueryVersionReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -65,8 +103,22 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.shared_pixmaps, self.major_version, self.minor_version, self.uid, self.gid, self.pixmap_format = unpacker.unpack("xB2x4xHHHHB15x") | ||
| ( | ||
| self.shared_pixmaps, | ||
| self.major_version, | ||
| self.minor_version, | ||
| self.uid, | ||
| self.gid, | ||
| self.pixmap_format, | ||
| ) = unpacker.unpack("xB2x4xHHHHB15x") | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class QueryVersionCookie(xcffib.Cookie): | ||
| reply_type = QueryVersionReply | ||
| @dataclass(init=False) | ||
| class GetImageReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -79,6 +131,13 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetImageCookie(xcffib.Cookie): | ||
| reply_type = GetImageReply | ||
| @dataclass(init=False) | ||
| class CreateSegmentReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -89,6 +148,12 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.nfd, = unpacker.unpack("xB2x4x24x") | ||
| (self.nfd,) = unpacker.unpack("xB2x4x24x") | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class CreateSegmentCookie(xcffib.Cookie): | ||
| reply_type = CreateSegmentReply | ||
| @dataclass(init=False) | ||
| class shmExtension(xcffib.Extension): | ||
@@ -99,2 +164,3 @@ def QueryVersion(self, is_checked=True): | ||
| return self.send_request(0, buf, QueryVersionCookie, is_checked=is_checked) | ||
| def Attach(self, shmseg, shmid, read_only, is_checked=False): | ||
@@ -104,2 +170,3 @@ buf = io.BytesIO() | ||
| return self.send_request(1, buf, is_checked=is_checked) | ||
| def Detach(self, shmseg, is_checked=False): | ||
@@ -109,14 +176,86 @@ buf = io.BytesIO() | ||
| return self.send_request(2, buf, is_checked=is_checked) | ||
| def PutImage(self, drawable, gc, total_width, total_height, src_x, src_y, src_width, src_height, dst_x, dst_y, depth, format, send_event, shmseg, offset, is_checked=False): | ||
| def PutImage( | ||
| self, | ||
| drawable, | ||
| gc, | ||
| total_width, | ||
| total_height, | ||
| src_x, | ||
| src_y, | ||
| src_width, | ||
| src_height, | ||
| dst_x, | ||
| dst_y, | ||
| depth, | ||
| format, | ||
| send_event, | ||
| shmseg, | ||
| offset, | ||
| is_checked=False, | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xIIHHHHHHhhBBBxII", drawable, gc, total_width, total_height, src_x, src_y, src_width, src_height, dst_x, dst_y, depth, format, send_event, shmseg, offset)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=xx2xIIHHHHHHhhBBBxII", | ||
| drawable, | ||
| gc, | ||
| total_width, | ||
| total_height, | ||
| src_x, | ||
| src_y, | ||
| src_width, | ||
| src_height, | ||
| dst_x, | ||
| dst_y, | ||
| depth, | ||
| format, | ||
| send_event, | ||
| shmseg, | ||
| offset, | ||
| ) | ||
| ) | ||
| return self.send_request(3, buf, is_checked=is_checked) | ||
| def GetImage(self, drawable, x, y, width, height, plane_mask, format, shmseg, offset, is_checked=True): | ||
| def GetImage( | ||
| self, | ||
| drawable, | ||
| x, | ||
| y, | ||
| width, | ||
| height, | ||
| plane_mask, | ||
| format, | ||
| shmseg, | ||
| offset, | ||
| is_checked=True, | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xIhhHHIB3xII", drawable, x, y, width, height, plane_mask, format, shmseg, offset)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=xx2xIhhHHIB3xII", | ||
| drawable, | ||
| x, | ||
| y, | ||
| width, | ||
| height, | ||
| plane_mask, | ||
| format, | ||
| shmseg, | ||
| offset, | ||
| ) | ||
| ) | ||
| return self.send_request(4, buf, GetImageCookie, is_checked=is_checked) | ||
| def CreatePixmap(self, pid, drawable, width, height, depth, shmseg, offset, is_checked=False): | ||
| def CreatePixmap( | ||
| self, pid, drawable, width, height, depth, shmseg, offset, is_checked=False | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xIIHHB3xII", pid, drawable, width, height, depth, shmseg, offset)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=xx2xIIHHB3xII", pid, drawable, width, height, depth, shmseg, offset | ||
| ) | ||
| ) | ||
| return self.send_request(5, buf, is_checked=is_checked) | ||
| def AttachFd(self, shmseg, read_only, is_checked=False): | ||
@@ -126,2 +265,3 @@ buf = io.BytesIO() | ||
| return self.send_request(6, buf, is_checked=is_checked) | ||
| def CreateSegment(self, shmseg, size, read_only, is_checked=True): | ||
@@ -131,2 +271,4 @@ buf = io.BytesIO() | ||
| return self.send_request(7, buf, CreateSegmentCookie, is_checked=is_checked) | ||
| xcffib._add_ext(key, shmExtension, _events, _errors) |
+249
-30
| import xcffib | ||
| import struct | ||
| import io | ||
| from dataclasses import dataclass | ||
| MAJOR_VERSION = 3 | ||
@@ -10,2 +12,5 @@ MINOR_VERSION = 1 | ||
| from . import xproto | ||
| @dataclass(init=False) | ||
| class ALARMSTATE: | ||
@@ -15,2 +20,5 @@ Active = 0 | ||
| Destroyed = 2 | ||
| @dataclass(init=False) | ||
| class TESTTYPE: | ||
@@ -21,5 +29,11 @@ PositiveTransition = 0 | ||
| NegativeComparison = 3 | ||
| @dataclass(init=False) | ||
| class VALUETYPE: | ||
| Absolute = 0 | ||
| Relative = 1 | ||
| @dataclass(init=False) | ||
| class CA: | ||
@@ -32,4 +46,8 @@ Counter = 1 << 0 | ||
| Events = 1 << 5 | ||
| @dataclass(init=False) | ||
| class INT64(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -42,2 +60,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -47,3 +66,5 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| fixed_size = 8 | ||
| @classmethod | ||
@@ -55,4 +76,8 @@ def synthetic(cls, hi, lo): | ||
| return self | ||
| @dataclass(init=False) | ||
| class SYSTEMCOUNTER(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -63,16 +88,26 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.counter, = unpacker.unpack("I") | ||
| (self.counter,) = unpacker.unpack("I") | ||
| self.resolution = INT64(unpacker) | ||
| self.name_len, = unpacker.unpack("H") | ||
| (self.name_len,) = unpacker.unpack("H") | ||
| unpacker.pad("c") | ||
| self.name = xcffib.List(unpacker, "c", self.name_len) | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=I", self.counter)) | ||
| buf.write(self.resolution.pack() if hasattr(self.resolution, "pack") else INT64.synthetic(*self.resolution).pack()) | ||
| buf.write( | ||
| self.resolution.pack() | ||
| if hasattr(self.resolution, "pack") | ||
| else INT64.synthetic(*self.resolution).pack() | ||
| ) | ||
| buf.write(struct.pack("=H", self.name_len)) | ||
| buf.write(xcffib.pack_list(self.name, "c")) | ||
| buf.write(struct.pack("=4x", )) | ||
| buf.write( | ||
| struct.pack( | ||
| "=4x", | ||
| ) | ||
| ) | ||
| return buf.getvalue() | ||
| @classmethod | ||
@@ -86,4 +121,8 @@ def synthetic(cls, counter, resolution, name_len, name): | ||
| return self | ||
| @dataclass(init=False) | ||
| class TRIGGER(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -96,10 +135,16 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.wait_value = INT64(unpacker) | ||
| self.test_type, = unpacker.unpack("I") | ||
| (self.test_type,) = unpacker.unpack("I") | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=II", self.counter, self.wait_type)) | ||
| buf.write(self.wait_value.pack() if hasattr(self.wait_value, "pack") else INT64.synthetic(*self.wait_value).pack()) | ||
| buf.write( | ||
| self.wait_value.pack() | ||
| if hasattr(self.wait_value, "pack") | ||
| else INT64.synthetic(*self.wait_value).pack() | ||
| ) | ||
| buf.write(struct.pack("=I", self.test_type)) | ||
| return buf.getvalue() | ||
| @classmethod | ||
@@ -113,4 +158,8 @@ def synthetic(cls, counter, wait_type, wait_value, test_type): | ||
| return self | ||
| @dataclass(init=False) | ||
| class WAITCONDITION(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -125,7 +174,17 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
| buf = io.BytesIO() | ||
| buf.write(self.trigger.pack() if hasattr(self.trigger, "pack") else TRIGGER.synthetic(*self.trigger).pack()) | ||
| buf.write(self.event_threshold.pack() if hasattr(self.event_threshold, "pack") else INT64.synthetic(*self.event_threshold).pack()) | ||
| buf.write( | ||
| self.trigger.pack() | ||
| if hasattr(self.trigger, "pack") | ||
| else TRIGGER.synthetic(*self.trigger).pack() | ||
| ) | ||
| buf.write( | ||
| self.event_threshold.pack() | ||
| if hasattr(self.event_threshold, "pack") | ||
| else INT64.synthetic(*self.event_threshold).pack() | ||
| ) | ||
| return buf.getvalue() | ||
| @classmethod | ||
@@ -137,4 +196,8 @@ def synthetic(cls, trigger, event_threshold): | ||
| return self | ||
| @dataclass(init=False) | ||
| class CounterError(xcffib.Error): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -145,13 +208,26 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.bad_counter, self.minor_opcode, self.major_opcode = unpacker.unpack("xx2xIHB") | ||
| self.bad_counter, self.minor_opcode, self.major_opcode = unpacker.unpack( | ||
| "xx2xIHB" | ||
| ) | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=B", 0)) | ||
| buf.write(struct.pack("=x2xIHB", self.bad_counter, self.minor_opcode, self.major_opcode)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=x2xIHB", self.bad_counter, self.minor_opcode, self.major_opcode | ||
| ) | ||
| ) | ||
| return buf.getvalue() | ||
| BadCounter = CounterError | ||
| _errors[0] = CounterError | ||
| @dataclass(init=False) | ||
| class AlarmError(xcffib.Error): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -162,13 +238,24 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.bad_alarm, self.minor_opcode, self.major_opcode = unpacker.unpack("xx2xIHB") | ||
| self.bad_alarm, self.minor_opcode, self.major_opcode = unpacker.unpack( | ||
| "xx2xIHB" | ||
| ) | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=B", 1)) | ||
| buf.write(struct.pack("=x2xIHB", self.bad_alarm, self.minor_opcode, self.major_opcode)) | ||
| buf.write( | ||
| struct.pack("=x2xIHB", self.bad_alarm, self.minor_opcode, self.major_opcode) | ||
| ) | ||
| return buf.getvalue() | ||
| BadAlarm = AlarmError | ||
| _errors[1] = AlarmError | ||
| @dataclass(init=False) | ||
| class InitializeReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -181,6 +268,13 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class InitializeCookie(xcffib.Cookie): | ||
| reply_type = InitializeReply | ||
| @dataclass(init=False) | ||
| class ListSystemCountersReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -191,9 +285,16 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.counters_len, = unpacker.unpack("xx2x4xI20x") | ||
| (self.counters_len,) = unpacker.unpack("xx2x4xI20x") | ||
| self.counters = xcffib.List(unpacker, SYSTEMCOUNTER, self.counters_len) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class ListSystemCountersCookie(xcffib.Cookie): | ||
| reply_type = ListSystemCountersReply | ||
| @dataclass(init=False) | ||
| class QueryCounterReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -207,6 +308,13 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class QueryCounterCookie(xcffib.Cookie): | ||
| reply_type = QueryCounterReply | ||
| @dataclass(init=False) | ||
| class QueryAlarmReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -223,6 +331,13 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class QueryAlarmCookie(xcffib.Cookie): | ||
| reply_type = QueryAlarmReply | ||
| @dataclass(init=False) | ||
| class GetPriorityReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -233,8 +348,15 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.priority, = unpacker.unpack("xx2x4xi") | ||
| (self.priority,) = unpacker.unpack("xx2x4xi") | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetPriorityCookie(xcffib.Cookie): | ||
| reply_type = GetPriorityReply | ||
| @dataclass(init=False) | ||
| class QueryFenceReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -245,8 +367,15 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.triggered, = unpacker.unpack("xx2x4xB23x") | ||
| (self.triggered,) = unpacker.unpack("xx2x4xB23x") | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class QueryFenceCookie(xcffib.Cookie): | ||
| reply_type = QueryFenceReply | ||
| @dataclass(init=False) | ||
| class CounterNotifyEvent(xcffib.Event): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -263,2 +392,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -268,8 +398,20 @@ buf = io.BytesIO() | ||
| buf.write(struct.pack("=B2xI", self.kind, self.counter)) | ||
| buf.write(self.wait_value.pack() if hasattr(self.wait_value, "pack") else INT64.synthetic(*self.wait_value).pack()) | ||
| buf.write(self.counter_value.pack() if hasattr(self.counter_value, "pack") else INT64.synthetic(*self.counter_value).pack()) | ||
| buf.write( | ||
| self.wait_value.pack() | ||
| if hasattr(self.wait_value, "pack") | ||
| else INT64.synthetic(*self.wait_value).pack() | ||
| ) | ||
| buf.write( | ||
| self.counter_value.pack() | ||
| if hasattr(self.counter_value, "pack") | ||
| else INT64.synthetic(*self.counter_value).pack() | ||
| ) | ||
| buf.write(struct.pack("=I", self.timestamp)) | ||
| buf.write(struct.pack("=H", self.count)) | ||
| buf.write(struct.pack("=B", self.destroyed)) | ||
| buf.write(struct.pack("=x", )) | ||
| buf.write( | ||
| struct.pack( | ||
| "=x", | ||
| ) | ||
| ) | ||
| buf_len = len(buf.getvalue()) | ||
@@ -279,4 +421,7 @@ if buf_len < 32: | ||
| return buf.getvalue() | ||
| @classmethod | ||
| def synthetic(cls, kind, counter, wait_value, counter_value, timestamp, count, destroyed): | ||
| def synthetic( | ||
| cls, kind, counter, wait_value, counter_value, timestamp, count, destroyed | ||
| ): | ||
| self = cls.__new__(cls) | ||
@@ -291,5 +436,11 @@ self.kind = kind | ||
| return self | ||
| _events[0] = CounterNotifyEvent | ||
| @dataclass(init=False) | ||
| class AlarmNotifyEvent(xcffib.Event): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -306,2 +457,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -311,7 +463,19 @@ buf = io.BytesIO() | ||
| buf.write(struct.pack("=B2xI", self.kind, self.alarm)) | ||
| buf.write(self.counter_value.pack() if hasattr(self.counter_value, "pack") else INT64.synthetic(*self.counter_value).pack()) | ||
| buf.write(self.alarm_value.pack() if hasattr(self.alarm_value, "pack") else INT64.synthetic(*self.alarm_value).pack()) | ||
| buf.write( | ||
| self.counter_value.pack() | ||
| if hasattr(self.counter_value, "pack") | ||
| else INT64.synthetic(*self.counter_value).pack() | ||
| ) | ||
| buf.write( | ||
| self.alarm_value.pack() | ||
| if hasattr(self.alarm_value, "pack") | ||
| else INT64.synthetic(*self.alarm_value).pack() | ||
| ) | ||
| buf.write(struct.pack("=I", self.timestamp)) | ||
| buf.write(struct.pack("=B", self.state)) | ||
| buf.write(struct.pack("=3x", )) | ||
| buf.write( | ||
| struct.pack( | ||
| "=3x", | ||
| ) | ||
| ) | ||
| buf_len = len(buf.getvalue()) | ||
@@ -321,2 +485,3 @@ if buf_len < 32: | ||
| return buf.getvalue() | ||
| @classmethod | ||
@@ -332,3 +497,8 @@ def synthetic(cls, kind, alarm, counter_value, alarm_value, timestamp, state): | ||
| return self | ||
| _events[1] = AlarmNotifyEvent | ||
| @dataclass(init=False) | ||
| class syncExtension(xcffib.Extension): | ||
@@ -339,11 +509,20 @@ def Initialize(self, desired_major_version, desired_minor_version, is_checked=True): | ||
| return self.send_request(0, buf, InitializeCookie, is_checked=is_checked) | ||
| def ListSystemCounters(self, is_checked=True): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2x")) | ||
| return self.send_request(1, buf, ListSystemCountersCookie, is_checked=is_checked) | ||
| return self.send_request( | ||
| 1, buf, ListSystemCountersCookie, is_checked=is_checked | ||
| ) | ||
| def CreateCounter(self, id, initial_value, is_checked=False): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xI", id)) | ||
| buf.write(initial_value.pack() if hasattr(initial_value, "pack") else INT64.synthetic(*initial_value).pack()) | ||
| buf.write( | ||
| initial_value.pack() | ||
| if hasattr(initial_value, "pack") | ||
| else INT64.synthetic(*initial_value).pack() | ||
| ) | ||
| return self.send_request(2, buf, is_checked=is_checked) | ||
| def DestroyCounter(self, counter, is_checked=False): | ||
@@ -353,2 +532,3 @@ buf = io.BytesIO() | ||
| return self.send_request(6, buf, is_checked=is_checked) | ||
| def QueryCounter(self, counter, is_checked=True): | ||
@@ -358,2 +538,3 @@ buf = io.BytesIO() | ||
| return self.send_request(5, buf, QueryCounterCookie, is_checked=is_checked) | ||
| def Await(self, wait_list_len, wait_list, is_checked=False): | ||
@@ -364,12 +545,21 @@ buf = io.BytesIO() | ||
| return self.send_request(7, buf, is_checked=is_checked) | ||
| def ChangeCounter(self, counter, amount, is_checked=False): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xI", counter)) | ||
| buf.write(amount.pack() if hasattr(amount, "pack") else INT64.synthetic(*amount).pack()) | ||
| buf.write( | ||
| amount.pack() | ||
| if hasattr(amount, "pack") | ||
| else INT64.synthetic(*amount).pack() | ||
| ) | ||
| return self.send_request(4, buf, is_checked=is_checked) | ||
| def SetCounter(self, counter, value, is_checked=False): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xI", counter)) | ||
| buf.write(value.pack() if hasattr(value, "pack") else INT64.synthetic(*value).pack()) | ||
| buf.write( | ||
| value.pack() if hasattr(value, "pack") else INT64.synthetic(*value).pack() | ||
| ) | ||
| return self.send_request(3, buf, is_checked=is_checked) | ||
| def CreateAlarm(self, id, value_mask, value_list, is_checked=False): | ||
@@ -386,3 +576,7 @@ buf = io.BytesIO() | ||
| value = value_list.pop(0) | ||
| buf.write(value.pack() if hasattr(value, "pack") else INT64.synthetic(*value).pack()) | ||
| buf.write( | ||
| value.pack() | ||
| if hasattr(value, "pack") | ||
| else INT64.synthetic(*value).pack() | ||
| ) | ||
| if value_mask & CA.TestType: | ||
@@ -393,3 +587,7 @@ testType = value_list.pop(0) | ||
| delta = value_list.pop(0) | ||
| buf.write(delta.pack() if hasattr(delta, "pack") else INT64.synthetic(*delta).pack()) | ||
| buf.write( | ||
| delta.pack() | ||
| if hasattr(delta, "pack") | ||
| else INT64.synthetic(*delta).pack() | ||
| ) | ||
| if value_mask & CA.Events: | ||
@@ -399,2 +597,3 @@ events = value_list.pop(0) | ||
| return self.send_request(8, buf, is_checked=is_checked) | ||
| def ChangeAlarm(self, id, value_mask, value_list, is_checked=False): | ||
@@ -411,3 +610,7 @@ buf = io.BytesIO() | ||
| value = value_list.pop(0) | ||
| buf.write(value.pack() if hasattr(value, "pack") else INT64.synthetic(*value).pack()) | ||
| buf.write( | ||
| value.pack() | ||
| if hasattr(value, "pack") | ||
| else INT64.synthetic(*value).pack() | ||
| ) | ||
| if value_mask & CA.TestType: | ||
@@ -418,3 +621,7 @@ testType = value_list.pop(0) | ||
| delta = value_list.pop(0) | ||
| buf.write(delta.pack() if hasattr(delta, "pack") else INT64.synthetic(*delta).pack()) | ||
| buf.write( | ||
| delta.pack() | ||
| if hasattr(delta, "pack") | ||
| else INT64.synthetic(*delta).pack() | ||
| ) | ||
| if value_mask & CA.Events: | ||
@@ -424,2 +631,3 @@ events = value_list.pop(0) | ||
| return self.send_request(9, buf, is_checked=is_checked) | ||
| def DestroyAlarm(self, alarm, is_checked=False): | ||
@@ -429,2 +637,3 @@ buf = io.BytesIO() | ||
| return self.send_request(11, buf, is_checked=is_checked) | ||
| def QueryAlarm(self, alarm, is_checked=True): | ||
@@ -434,2 +643,3 @@ buf = io.BytesIO() | ||
| return self.send_request(10, buf, QueryAlarmCookie, is_checked=is_checked) | ||
| def SetPriority(self, id, priority, is_checked=False): | ||
@@ -439,2 +649,3 @@ buf = io.BytesIO() | ||
| return self.send_request(12, buf, is_checked=is_checked) | ||
| def GetPriority(self, id, is_checked=True): | ||
@@ -444,2 +655,3 @@ buf = io.BytesIO() | ||
| return self.send_request(13, buf, GetPriorityCookie, is_checked=is_checked) | ||
| def CreateFence(self, drawable, fence, initially_triggered, is_checked=False): | ||
@@ -449,2 +661,3 @@ buf = io.BytesIO() | ||
| return self.send_request(14, buf, is_checked=is_checked) | ||
| def TriggerFence(self, fence, is_checked=False): | ||
@@ -454,2 +667,3 @@ buf = io.BytesIO() | ||
| return self.send_request(15, buf, is_checked=is_checked) | ||
| def ResetFence(self, fence, is_checked=False): | ||
@@ -459,2 +673,3 @@ buf = io.BytesIO() | ||
| return self.send_request(16, buf, is_checked=is_checked) | ||
| def DestroyFence(self, fence, is_checked=False): | ||
@@ -464,2 +679,3 @@ buf = io.BytesIO() | ||
| return self.send_request(17, buf, is_checked=is_checked) | ||
| def QueryFence(self, fence, is_checked=True): | ||
@@ -469,2 +685,3 @@ buf = io.BytesIO() | ||
| return self.send_request(18, buf, QueryFenceCookie, is_checked=is_checked) | ||
| def AwaitFence(self, fence_list_len, fence_list, is_checked=False): | ||
@@ -475,2 +692,4 @@ buf = io.BytesIO() | ||
| return self.send_request(19, buf, is_checked=is_checked) | ||
| xcffib._add_ext(key, syncExtension, _events, _errors) |
+15
-16
@@ -28,3 +28,3 @@ # Copyright 2014 Tycho Andersen | ||
| def lock_path(display): | ||
| return '/tmp/.X%d-lock' % display | ||
| return "/tmp/.X%d-lock" % display | ||
@@ -49,6 +49,5 @@ | ||
| class XvfbTest: | ||
| """ A helper class for testing things with nosetests. This class will run | ||
| """A helper class for testing things with nosetests. This class will run | ||
| each test in its own fresh xvfb, leaving you with an xcffib connection to | ||
| that X session as `self.conn` for use in testing. """ | ||
| that X session as `self.conn` for use in testing.""" | ||
@@ -65,3 +64,3 @@ # Set this to true if you'd like to get xtrace output to stdout of each | ||
| def spawn(self, cmd): | ||
| """ Spawn a command but swallow its output. """ | ||
| """Spawn a command but swallow its output.""" | ||
| return subprocess.Popen(cmd) | ||
@@ -71,17 +70,17 @@ | ||
| if self._old_display is None: | ||
| del os.environ['DISPLAY'] | ||
| del os.environ["DISPLAY"] | ||
| else: | ||
| os.environ['DISPLAY'] = self._old_display | ||
| os.environ["DISPLAY"] = self._old_display | ||
| def setUp(self): | ||
| self._old_display = os.environ.get('DISPLAY') | ||
| self._old_display = os.environ.get("DISPLAY") | ||
| self._display, self._display_lock = find_display() | ||
| os.environ['DISPLAY'] = ':%d' % self._display | ||
| os.environ["DISPLAY"] = ":%d" % self._display | ||
| self._xvfb = self.spawn(self._xvfb_command()) | ||
| if self.xtrace: | ||
| subprocess.Popen(['xtrace', '-n']) | ||
| subprocess.Popen(["xtrace", "-n"]) | ||
| # xtrace's default display is :9; obviously this won't work | ||
| # concurrently, but it's not the default so... | ||
| os.environ['DISPLAY'] = ':9' | ||
| os.environ["DISPLAY"] = ":9" | ||
| try: | ||
@@ -128,7 +127,7 @@ self.conn = self._connect_to_xvfb() | ||
| def _xvfb_command(self): | ||
| """ You can override this if you have some extra args for Xvfb or | ||
| """You can override this if you have some extra args for Xvfb or | ||
| whatever. At this point, os.environ['DISPLAY'] is set to something Xvfb | ||
| can use. """ | ||
| screen = '%sx%sx%s' % (self.width, self.height, self.depth) | ||
| return ['Xvfb', os.environ['DISPLAY'], '-screen', '0', screen] | ||
| can use.""" | ||
| screen = "%sx%sx%s" % (self.width, self.height, self.depth) | ||
| return ["Xvfb", os.environ["DISPLAY"], "-screen", "0", screen] | ||
@@ -139,3 +138,3 @@ def _connect_to_xvfb(self): | ||
| try: | ||
| conn = Connection(os.environ['DISPLAY']) | ||
| conn = Connection(os.environ["DISPLAY"]) | ||
| conn.invalid() | ||
@@ -142,0 +141,0 @@ |
@@ -19,2 +19,3 @@ # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| """ | ||
| class Wrapper: | ||
@@ -21,0 +22,0 @@ def __init__(self, conn): |
+34
-2
| import xcffib | ||
| import struct | ||
| import io | ||
| from dataclasses import dataclass | ||
| MAJOR_VERSION = 1 | ||
@@ -9,4 +11,8 @@ MINOR_VERSION = 1 | ||
| _errors = {} | ||
| @dataclass(init=False) | ||
| class GetVersionReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -17,8 +23,17 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.server_major_version, self.server_minor_version = unpacker.unpack("xx2x4xHH") | ||
| self.server_major_version, self.server_minor_version = unpacker.unpack( | ||
| "xx2x4xHH" | ||
| ) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetVersionCookie(xcffib.Cookie): | ||
| reply_type = GetVersionReply | ||
| @dataclass(init=False) | ||
| class GetXIDRangeReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -31,6 +46,13 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetXIDRangeCookie(xcffib.Cookie): | ||
| reply_type = GetXIDRangeReply | ||
| @dataclass(init=False) | ||
| class GetXIDListReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -41,7 +63,13 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.ids_len, = unpacker.unpack("xx2x4xI20x") | ||
| (self.ids_len,) = unpacker.unpack("xx2x4xI20x") | ||
| self.ids = xcffib.List(unpacker, "I", self.ids_len) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetXIDListCookie(xcffib.Cookie): | ||
| reply_type = GetXIDListReply | ||
| @dataclass(init=False) | ||
| class xc_miscExtension(xcffib.Extension): | ||
@@ -52,2 +80,3 @@ def GetVersion(self, client_major_version, client_minor_version, is_checked=True): | ||
| return self.send_request(0, buf, GetVersionCookie, is_checked=is_checked) | ||
| def GetXIDRange(self, is_checked=True): | ||
@@ -57,2 +86,3 @@ buf = io.BytesIO() | ||
| return self.send_request(1, buf, GetXIDRangeCookie, is_checked=is_checked) | ||
| def GetXIDList(self, count, is_checked=True): | ||
@@ -62,2 +92,4 @@ buf = io.BytesIO() | ||
| return self.send_request(2, buf, GetXIDListCookie, is_checked=is_checked) | ||
| xcffib._add_ext(key, xc_miscExtension, _events, _errors) |
+66
-3
| import xcffib | ||
| import struct | ||
| import io | ||
| from dataclasses import dataclass | ||
| MAJOR_VERSION = 1 | ||
@@ -9,4 +11,8 @@ MINOR_VERSION = 0 | ||
| _errors = {} | ||
| @dataclass(init=False) | ||
| class QueryVersionReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -17,8 +23,17 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.server_major_version, self.server_minor_version = unpacker.unpack("xx2x4xHH20x") | ||
| self.server_major_version, self.server_minor_version = unpacker.unpack( | ||
| "xx2x4xHH20x" | ||
| ) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class QueryVersionCookie(xcffib.Cookie): | ||
| reply_type = QueryVersionReply | ||
| @dataclass(init=False) | ||
| class StartReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -31,6 +46,13 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class StartCookie(xcffib.Cookie): | ||
| reply_type = StartReply | ||
| @dataclass(init=False) | ||
| class EndReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -43,9 +65,19 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class EndCookie(xcffib.Cookie): | ||
| reply_type = EndReply | ||
| @dataclass(init=False) | ||
| class Datatype: | ||
| Unmodified = 0 | ||
| Modified = 1 | ||
| @dataclass(init=False) | ||
| class Event(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -58,2 +90,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -63,5 +96,10 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| fixed_size = 32 | ||
| @dataclass(init=False) | ||
| class SendReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -74,6 +112,13 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class SendCookie(xcffib.Cookie): | ||
| reply_type = SendReply | ||
| @dataclass(init=False) | ||
| class SelectInputReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -86,4 +131,10 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class SelectInputCookie(xcffib.Cookie): | ||
| reply_type = SelectInputReply | ||
| @dataclass(init=False) | ||
| class xevieExtension(xcffib.Extension): | ||
@@ -94,2 +145,3 @@ def QueryVersion(self, client_major_version, client_minor_version, is_checked=True): | ||
| return self.send_request(0, buf, QueryVersionCookie, is_checked=is_checked) | ||
| def Start(self, screen, is_checked=True): | ||
@@ -99,2 +151,3 @@ buf = io.BytesIO() | ||
| return self.send_request(1, buf, StartCookie, is_checked=is_checked) | ||
| def End(self, cmap, is_checked=True): | ||
@@ -104,9 +157,17 @@ buf = io.BytesIO() | ||
| return self.send_request(2, buf, EndCookie, is_checked=is_checked) | ||
| def Send(self, event, data_type, is_checked=True): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2x")) | ||
| buf.write(event.pack() if hasattr(event, "pack") else Event.synthetic(*event).pack()) | ||
| buf.write( | ||
| event.pack() if hasattr(event, "pack") else Event.synthetic(*event).pack() | ||
| ) | ||
| buf.write(struct.pack("=I", data_type)) | ||
| buf.write(struct.pack("=64x", )) | ||
| buf.write( | ||
| struct.pack( | ||
| "=64x", | ||
| ) | ||
| ) | ||
| return self.send_request(3, buf, SendCookie, is_checked=is_checked) | ||
| def SelectInput(self, event_mask, is_checked=True): | ||
@@ -116,2 +177,4 @@ buf = io.BytesIO() | ||
| return self.send_request(4, buf, SelectInputCookie, is_checked=is_checked) | ||
| xcffib._add_ext(key, xevieExtension, _events, _errors) |
+136
-13
| import xcffib | ||
| import struct | ||
| import io | ||
| from dataclasses import dataclass | ||
| MAJOR_VERSION = 4 | ||
@@ -9,4 +11,8 @@ MINOR_VERSION = 1 | ||
| _errors = {} | ||
| @dataclass(init=False) | ||
| class DrmClipRect(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -19,2 +25,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -24,3 +31,5 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| fixed_size = 8 | ||
| @classmethod | ||
@@ -34,4 +43,8 @@ def synthetic(cls, x1, y1, x2, x3): | ||
| return self | ||
| @dataclass(init=False) | ||
| class QueryVersionReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -42,8 +55,17 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.dri_major_version, self.dri_minor_version, self.dri_minor_patch = unpacker.unpack("xx2x4xHHI") | ||
| self.dri_major_version, self.dri_minor_version, self.dri_minor_patch = ( | ||
| unpacker.unpack("xx2x4xHHI") | ||
| ) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class QueryVersionCookie(xcffib.Cookie): | ||
| reply_type = QueryVersionReply | ||
| @dataclass(init=False) | ||
| class QueryDirectRenderingCapableReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -54,8 +76,15 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.is_capable, = unpacker.unpack("xx2x4xB") | ||
| (self.is_capable,) = unpacker.unpack("xx2x4xB") | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class QueryDirectRenderingCapableCookie(xcffib.Cookie): | ||
| reply_type = QueryDirectRenderingCapableReply | ||
| @dataclass(init=False) | ||
| class OpenConnectionReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -66,9 +95,18 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.sarea_handle_low, self.sarea_handle_high, self.bus_id_len = unpacker.unpack("xx2x4xIII12x") | ||
| self.sarea_handle_low, self.sarea_handle_high, self.bus_id_len = ( | ||
| unpacker.unpack("xx2x4xIII12x") | ||
| ) | ||
| self.bus_id = xcffib.List(unpacker, "c", self.bus_id_len) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class OpenConnectionCookie(xcffib.Cookie): | ||
| reply_type = OpenConnectionReply | ||
| @dataclass(init=False) | ||
| class GetClientDriverNameReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -79,9 +117,23 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.client_driver_major_version, self.client_driver_minor_version, self.client_driver_patch_version, self.client_driver_name_len = unpacker.unpack("xx2x4xIIII8x") | ||
| self.client_driver_name = xcffib.List(unpacker, "c", self.client_driver_name_len) | ||
| ( | ||
| self.client_driver_major_version, | ||
| self.client_driver_minor_version, | ||
| self.client_driver_patch_version, | ||
| self.client_driver_name_len, | ||
| ) = unpacker.unpack("xx2x4xIIII8x") | ||
| self.client_driver_name = xcffib.List( | ||
| unpacker, "c", self.client_driver_name_len | ||
| ) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetClientDriverNameCookie(xcffib.Cookie): | ||
| reply_type = GetClientDriverNameReply | ||
| @dataclass(init=False) | ||
| class CreateContextReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -92,8 +144,15 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.hw_context, = unpacker.unpack("xx2x4xI") | ||
| (self.hw_context,) = unpacker.unpack("xx2x4xI") | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class CreateContextCookie(xcffib.Cookie): | ||
| reply_type = CreateContextReply | ||
| @dataclass(init=False) | ||
| class CreateDrawableReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -104,8 +163,15 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.hw_drawable_handle, = unpacker.unpack("xx2x4xI") | ||
| (self.hw_drawable_handle,) = unpacker.unpack("xx2x4xI") | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class CreateDrawableCookie(xcffib.Cookie): | ||
| reply_type = CreateDrawableReply | ||
| @dataclass(init=False) | ||
| class GetDrawableInfoReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -116,11 +182,31 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.drawable_table_index, self.drawable_table_stamp, self.drawable_origin_X, self.drawable_origin_Y, self.drawable_size_W, self.drawable_size_H, self.num_clip_rects, self.back_x, self.back_y, self.num_back_clip_rects = unpacker.unpack("xx2x4xIIhhhhIhhI") | ||
| ( | ||
| self.drawable_table_index, | ||
| self.drawable_table_stamp, | ||
| self.drawable_origin_X, | ||
| self.drawable_origin_Y, | ||
| self.drawable_size_W, | ||
| self.drawable_size_H, | ||
| self.num_clip_rects, | ||
| self.back_x, | ||
| self.back_y, | ||
| self.num_back_clip_rects, | ||
| ) = unpacker.unpack("xx2x4xIIhhhhIhhI") | ||
| self.clip_rects = xcffib.List(unpacker, DrmClipRect, self.num_clip_rects) | ||
| unpacker.pad(DrmClipRect) | ||
| self.back_clip_rects = xcffib.List(unpacker, DrmClipRect, self.num_back_clip_rects) | ||
| self.back_clip_rects = xcffib.List( | ||
| unpacker, DrmClipRect, self.num_back_clip_rects | ||
| ) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetDrawableInfoCookie(xcffib.Cookie): | ||
| reply_type = GetDrawableInfoReply | ||
| @dataclass(init=False) | ||
| class GetDeviceInfoReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -131,9 +217,23 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.framebuffer_handle_low, self.framebuffer_handle_high, self.framebuffer_origin_offset, self.framebuffer_size, self.framebuffer_stride, self.device_private_size = unpacker.unpack("xx2x4xIIIIII") | ||
| ( | ||
| self.framebuffer_handle_low, | ||
| self.framebuffer_handle_high, | ||
| self.framebuffer_origin_offset, | ||
| self.framebuffer_size, | ||
| self.framebuffer_stride, | ||
| self.device_private_size, | ||
| ) = unpacker.unpack("xx2x4xIIIIII") | ||
| self.device_private = xcffib.List(unpacker, "I", self.device_private_size) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetDeviceInfoCookie(xcffib.Cookie): | ||
| reply_type = GetDeviceInfoReply | ||
| @dataclass(init=False) | ||
| class AuthConnectionReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -144,6 +244,12 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.authenticated, = unpacker.unpack("xx2x4xI") | ||
| (self.authenticated,) = unpacker.unpack("xx2x4xI") | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class AuthConnectionCookie(xcffib.Cookie): | ||
| reply_type = AuthConnectionReply | ||
| @dataclass(init=False) | ||
| class xf86driExtension(xcffib.Extension): | ||
@@ -154,6 +260,10 @@ def QueryVersion(self, is_checked=True): | ||
| return self.send_request(0, buf, QueryVersionCookie, is_checked=is_checked) | ||
| def QueryDirectRenderingCapable(self, screen, is_checked=True): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xI", screen)) | ||
| return self.send_request(1, buf, QueryDirectRenderingCapableCookie, is_checked=is_checked) | ||
| return self.send_request( | ||
| 1, buf, QueryDirectRenderingCapableCookie, is_checked=is_checked | ||
| ) | ||
| def OpenConnection(self, screen, is_checked=True): | ||
@@ -163,2 +273,3 @@ buf = io.BytesIO() | ||
| return self.send_request(2, buf, OpenConnectionCookie, is_checked=is_checked) | ||
| def CloseConnection(self, screen, is_checked=False): | ||
@@ -168,6 +279,10 @@ buf = io.BytesIO() | ||
| return self.send_request(3, buf, is_checked=is_checked) | ||
| def GetClientDriverName(self, screen, is_checked=True): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xI", screen)) | ||
| return self.send_request(4, buf, GetClientDriverNameCookie, is_checked=is_checked) | ||
| return self.send_request( | ||
| 4, buf, GetClientDriverNameCookie, is_checked=is_checked | ||
| ) | ||
| def CreateContext(self, screen, visual, context, is_checked=True): | ||
@@ -177,2 +292,3 @@ buf = io.BytesIO() | ||
| return self.send_request(5, buf, CreateContextCookie, is_checked=is_checked) | ||
| def DestroyContext(self, screen, context, is_checked=False): | ||
@@ -182,2 +298,3 @@ buf = io.BytesIO() | ||
| return self.send_request(6, buf, is_checked=is_checked) | ||
| def CreateDrawable(self, screen, drawable, is_checked=True): | ||
@@ -187,2 +304,3 @@ buf = io.BytesIO() | ||
| return self.send_request(7, buf, CreateDrawableCookie, is_checked=is_checked) | ||
| def DestroyDrawable(self, screen, drawable, is_checked=False): | ||
@@ -192,2 +310,3 @@ buf = io.BytesIO() | ||
| return self.send_request(8, buf, is_checked=is_checked) | ||
| def GetDrawableInfo(self, screen, drawable, is_checked=True): | ||
@@ -197,2 +316,3 @@ buf = io.BytesIO() | ||
| return self.send_request(9, buf, GetDrawableInfoCookie, is_checked=is_checked) | ||
| def GetDeviceInfo(self, screen, is_checked=True): | ||
@@ -202,2 +322,3 @@ buf = io.BytesIO() | ||
| return self.send_request(10, buf, GetDeviceInfoCookie, is_checked=is_checked) | ||
| def AuthConnection(self, screen, magic, is_checked=True): | ||
@@ -207,2 +328,4 @@ buf = io.BytesIO() | ||
| return self.send_request(11, buf, AuthConnectionCookie, is_checked=is_checked) | ||
| xcffib._add_ext(key, xf86driExtension, _events, _errors) |
+440
-21
| import xcffib | ||
| import struct | ||
| import io | ||
| from dataclasses import dataclass | ||
| MAJOR_VERSION = 2 | ||
@@ -9,2 +11,5 @@ MINOR_VERSION = 2 | ||
| _errors = {} | ||
| @dataclass(init=False) | ||
| class ModeFlag: | ||
@@ -24,9 +29,19 @@ Positive_HSync = 1 << 0 | ||
| Half_Clock = 1 << 12 | ||
| @dataclass(init=False) | ||
| class ClockFlag: | ||
| Programable = 1 << 0 | ||
| @dataclass(init=False) | ||
| class Permission: | ||
| Read = 1 << 0 | ||
| Write = 1 << 1 | ||
| @dataclass(init=False) | ||
| class ModeInfo(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -37,11 +52,57 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.dotclock, self.hdisplay, self.hsyncstart, self.hsyncend, self.htotal, self.hskew, self.vdisplay, self.vsyncstart, self.vsyncend, self.vtotal, self.flags, self.privsize = unpacker.unpack("IHHHHIHHHH4xI12xI") | ||
| ( | ||
| self.dotclock, | ||
| self.hdisplay, | ||
| self.hsyncstart, | ||
| self.hsyncend, | ||
| self.htotal, | ||
| self.hskew, | ||
| self.vdisplay, | ||
| self.vsyncstart, | ||
| self.vsyncend, | ||
| self.vtotal, | ||
| self.flags, | ||
| self.privsize, | ||
| ) = unpacker.unpack("IHHHHIHHHH4xI12xI") | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=IHHHHIHHHH4xI12xI", self.dotclock, self.hdisplay, self.hsyncstart, self.hsyncend, self.htotal, self.hskew, self.vdisplay, self.vsyncstart, self.vsyncend, self.vtotal, self.flags, self.privsize)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=IHHHHIHHHH4xI12xI", | ||
| self.dotclock, | ||
| self.hdisplay, | ||
| self.hsyncstart, | ||
| self.hsyncend, | ||
| self.htotal, | ||
| self.hskew, | ||
| self.vdisplay, | ||
| self.vsyncstart, | ||
| self.vsyncend, | ||
| self.vtotal, | ||
| self.flags, | ||
| self.privsize, | ||
| ) | ||
| ) | ||
| return buf.getvalue() | ||
| fixed_size = 48 | ||
| @classmethod | ||
| def synthetic(cls, dotclock, hdisplay, hsyncstart, hsyncend, htotal, hskew, vdisplay, vsyncstart, vsyncend, vtotal, flags, privsize): | ||
| def synthetic( | ||
| cls, | ||
| dotclock, | ||
| hdisplay, | ||
| hsyncstart, | ||
| hsyncend, | ||
| htotal, | ||
| hskew, | ||
| vdisplay, | ||
| vsyncstart, | ||
| vsyncend, | ||
| vtotal, | ||
| flags, | ||
| privsize, | ||
| ): | ||
| self = cls.__new__(cls) | ||
@@ -61,4 +122,8 @@ self.dotclock = dotclock | ||
| return self | ||
| @dataclass(init=False) | ||
| class QueryVersionReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -71,6 +136,13 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class QueryVersionCookie(xcffib.Cookie): | ||
| reply_type = QueryVersionReply | ||
| @dataclass(init=False) | ||
| class GetModeLineReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -81,9 +153,29 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.dotclock, self.hdisplay, self.hsyncstart, self.hsyncend, self.htotal, self.hskew, self.vdisplay, self.vsyncstart, self.vsyncend, self.vtotal, self.flags, self.privsize = unpacker.unpack("xx2x4xIHHHHHHHHH2xI12xI") | ||
| ( | ||
| self.dotclock, | ||
| self.hdisplay, | ||
| self.hsyncstart, | ||
| self.hsyncend, | ||
| self.htotal, | ||
| self.hskew, | ||
| self.vdisplay, | ||
| self.vsyncstart, | ||
| self.vsyncend, | ||
| self.vtotal, | ||
| self.flags, | ||
| self.privsize, | ||
| ) = unpacker.unpack("xx2x4xIHHHHHHHHH2xI12xI") | ||
| self.private = xcffib.List(unpacker, "B", self.privsize) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetModeLineCookie(xcffib.Cookie): | ||
| reply_type = GetModeLineReply | ||
| @dataclass(init=False) | ||
| class GetMonitorReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -94,3 +186,5 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.vendor_length, self.model_length, self.num_hsync, self.num_vsync = unpacker.unpack("xx2x4xBBBB20x") | ||
| self.vendor_length, self.model_length, self.num_hsync, self.num_vsync = ( | ||
| unpacker.unpack("xx2x4xBBBB20x") | ||
| ) | ||
| self.hsync = xcffib.List(unpacker, "I", self.num_hsync) | ||
@@ -102,10 +196,19 @@ unpacker.pad("I") | ||
| unpacker.pad("c") | ||
| self.alignment_pad = xcffib.List(unpacker, "c", ((self.vendor_length + 3) & (~3)) - self.vendor_length) | ||
| self.alignment_pad = xcffib.List( | ||
| unpacker, "c", ((self.vendor_length + 3) & (~3)) - self.vendor_length | ||
| ) | ||
| unpacker.pad("c") | ||
| self.model = xcffib.List(unpacker, "c", self.model_length) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetMonitorCookie(xcffib.Cookie): | ||
| reply_type = GetMonitorReply | ||
| @dataclass(init=False) | ||
| class GetAllModeLinesReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -116,9 +219,16 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.modecount, = unpacker.unpack("xx2x4xI20x") | ||
| (self.modecount,) = unpacker.unpack("xx2x4xI20x") | ||
| self.modeinfo = xcffib.List(unpacker, ModeInfo, self.modecount) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetAllModeLinesCookie(xcffib.Cookie): | ||
| reply_type = GetAllModeLinesReply | ||
| @dataclass(init=False) | ||
| class ValidateModeLineReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -129,8 +239,15 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.status, = unpacker.unpack("xx2x4xI20x") | ||
| (self.status,) = unpacker.unpack("xx2x4xI20x") | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class ValidateModeLineCookie(xcffib.Cookie): | ||
| reply_type = ValidateModeLineReply | ||
| @dataclass(init=False) | ||
| class GetViewPortReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -143,6 +260,13 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetViewPortCookie(xcffib.Cookie): | ||
| reply_type = GetViewPortReply | ||
| @dataclass(init=False) | ||
| class GetDotClocksReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -156,6 +280,13 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetDotClocksCookie(xcffib.Cookie): | ||
| reply_type = GetDotClocksReply | ||
| @dataclass(init=False) | ||
| class GetGammaReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -168,6 +299,13 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetGammaCookie(xcffib.Cookie): | ||
| reply_type = GetGammaReply | ||
| @dataclass(init=False) | ||
| class GetGammaRampReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -178,3 +316,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.size, = unpacker.unpack("xx2x4xH22x") | ||
| (self.size,) = unpacker.unpack("xx2x4xH22x") | ||
| self.red = xcffib.List(unpacker, "H", (self.size + 1) & (~1)) | ||
@@ -186,6 +324,13 @@ unpacker.pad("H") | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetGammaRampCookie(xcffib.Cookie): | ||
| reply_type = GetGammaRampReply | ||
| @dataclass(init=False) | ||
| class GetGammaRampSizeReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -196,8 +341,15 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.size, = unpacker.unpack("xx2x4xH22x") | ||
| (self.size,) = unpacker.unpack("xx2x4xH22x") | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetGammaRampSizeCookie(xcffib.Cookie): | ||
| reply_type = GetGammaRampSizeReply | ||
| @dataclass(init=False) | ||
| class GetPermissionsReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -208,8 +360,15 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.permissions, = unpacker.unpack("xx2x4xI20x") | ||
| (self.permissions,) = unpacker.unpack("xx2x4xI20x") | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetPermissionsCookie(xcffib.Cookie): | ||
| reply_type = GetPermissionsReply | ||
| @dataclass(init=False) | ||
| class BadClockError(xcffib.Error): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -222,2 +381,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -228,6 +388,12 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| BadBadClock = BadClockError | ||
| _errors[0] = BadClockError | ||
| @dataclass(init=False) | ||
| class BadHTimingsError(xcffib.Error): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -240,2 +406,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -246,6 +413,12 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| BadBadHTimings = BadHTimingsError | ||
| _errors[1] = BadHTimingsError | ||
| @dataclass(init=False) | ||
| class BadVTimingsError(xcffib.Error): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -258,2 +431,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -264,6 +438,12 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| BadBadVTimings = BadVTimingsError | ||
| _errors[2] = BadVTimingsError | ||
| @dataclass(init=False) | ||
| class ModeUnsuitableError(xcffib.Error): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -276,2 +456,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -282,6 +463,12 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| BadModeUnsuitable = ModeUnsuitableError | ||
| _errors[3] = ModeUnsuitableError | ||
| @dataclass(init=False) | ||
| class ExtensionDisabledError(xcffib.Error): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -294,2 +481,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -300,6 +488,12 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| BadExtensionDisabled = ExtensionDisabledError | ||
| _errors[4] = ExtensionDisabledError | ||
| @dataclass(init=False) | ||
| class ClientNotLocalError(xcffib.Error): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -312,2 +506,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -318,6 +513,12 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| BadClientNotLocal = ClientNotLocalError | ||
| _errors[5] = ClientNotLocalError | ||
| @dataclass(init=False) | ||
| class ZoomLockedError(xcffib.Error): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -330,2 +531,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -336,4 +538,9 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| BadZoomLocked = ZoomLockedError | ||
| _errors[6] = ZoomLockedError | ||
| @dataclass(init=False) | ||
| class xf86vidmodeExtension(xcffib.Extension): | ||
@@ -344,2 +551,3 @@ def QueryVersion(self, is_checked=True): | ||
| return self.send_request(0, buf, QueryVersionCookie, is_checked=is_checked) | ||
| def GetModeLine(self, screen, is_checked=True): | ||
@@ -349,7 +557,41 @@ buf = io.BytesIO() | ||
| return self.send_request(1, buf, GetModeLineCookie, is_checked=is_checked) | ||
| def ModModeLine(self, screen, hdisplay, hsyncstart, hsyncend, htotal, hskew, vdisplay, vsyncstart, vsyncend, vtotal, flags, privsize, private, is_checked=False): | ||
| def ModModeLine( | ||
| self, | ||
| screen, | ||
| hdisplay, | ||
| hsyncstart, | ||
| hsyncend, | ||
| htotal, | ||
| hskew, | ||
| vdisplay, | ||
| vsyncstart, | ||
| vsyncend, | ||
| vtotal, | ||
| flags, | ||
| privsize, | ||
| private, | ||
| is_checked=False, | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xIHHHHHHHHH2xI12xI", screen, hdisplay, hsyncstart, hsyncend, htotal, hskew, vdisplay, vsyncstart, vsyncend, vtotal, flags, privsize)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=xx2xIHHHHHHHHH2xI12xI", | ||
| screen, | ||
| hdisplay, | ||
| hsyncstart, | ||
| hsyncend, | ||
| htotal, | ||
| hskew, | ||
| vdisplay, | ||
| vsyncstart, | ||
| vsyncend, | ||
| vtotal, | ||
| flags, | ||
| privsize, | ||
| ) | ||
| ) | ||
| buf.write(xcffib.pack_list(private, "B")) | ||
| return self.send_request(2, buf, is_checked=is_checked) | ||
| def SwitchMode(self, screen, zoom, is_checked=False): | ||
@@ -359,2 +601,3 @@ buf = io.BytesIO() | ||
| return self.send_request(3, buf, is_checked=is_checked) | ||
| def GetMonitor(self, screen, is_checked=True): | ||
@@ -364,2 +607,3 @@ buf = io.BytesIO() | ||
| return self.send_request(4, buf, GetMonitorCookie, is_checked=is_checked) | ||
| def LockModeSwitch(self, screen, lock, is_checked=False): | ||
@@ -369,2 +613,3 @@ buf = io.BytesIO() | ||
| return self.send_request(5, buf, is_checked=is_checked) | ||
| def GetAllModeLines(self, screen, is_checked=True): | ||
@@ -374,22 +619,185 @@ buf = io.BytesIO() | ||
| return self.send_request(6, buf, GetAllModeLinesCookie, is_checked=is_checked) | ||
| def AddModeLine(self, screen, dotclock, hdisplay, hsyncstart, hsyncend, htotal, hskew, vdisplay, vsyncstart, vsyncend, vtotal, flags, privsize, after_dotclock, after_hdisplay, after_hsyncstart, after_hsyncend, after_htotal, after_hskew, after_vdisplay, after_vsyncstart, after_vsyncend, after_vtotal, after_flags, private, is_checked=False): | ||
| def AddModeLine( | ||
| self, | ||
| screen, | ||
| dotclock, | ||
| hdisplay, | ||
| hsyncstart, | ||
| hsyncend, | ||
| htotal, | ||
| hskew, | ||
| vdisplay, | ||
| vsyncstart, | ||
| vsyncend, | ||
| vtotal, | ||
| flags, | ||
| privsize, | ||
| after_dotclock, | ||
| after_hdisplay, | ||
| after_hsyncstart, | ||
| after_hsyncend, | ||
| after_htotal, | ||
| after_hskew, | ||
| after_vdisplay, | ||
| after_vsyncstart, | ||
| after_vsyncend, | ||
| after_vtotal, | ||
| after_flags, | ||
| private, | ||
| is_checked=False, | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xIIHHHHHHHHH2xI12xIIHHHHHHHHH2xI12x", screen, dotclock, hdisplay, hsyncstart, hsyncend, htotal, hskew, vdisplay, vsyncstart, vsyncend, vtotal, flags, privsize, after_dotclock, after_hdisplay, after_hsyncstart, after_hsyncend, after_htotal, after_hskew, after_vdisplay, after_vsyncstart, after_vsyncend, after_vtotal, after_flags)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=xx2xIIHHHHHHHHH2xI12xIIHHHHHHHHH2xI12x", | ||
| screen, | ||
| dotclock, | ||
| hdisplay, | ||
| hsyncstart, | ||
| hsyncend, | ||
| htotal, | ||
| hskew, | ||
| vdisplay, | ||
| vsyncstart, | ||
| vsyncend, | ||
| vtotal, | ||
| flags, | ||
| privsize, | ||
| after_dotclock, | ||
| after_hdisplay, | ||
| after_hsyncstart, | ||
| after_hsyncend, | ||
| after_htotal, | ||
| after_hskew, | ||
| after_vdisplay, | ||
| after_vsyncstart, | ||
| after_vsyncend, | ||
| after_vtotal, | ||
| after_flags, | ||
| ) | ||
| ) | ||
| buf.write(xcffib.pack_list(private, "B")) | ||
| return self.send_request(7, buf, is_checked=is_checked) | ||
| def DeleteModeLine(self, screen, dotclock, hdisplay, hsyncstart, hsyncend, htotal, hskew, vdisplay, vsyncstart, vsyncend, vtotal, flags, privsize, private, is_checked=False): | ||
| def DeleteModeLine( | ||
| self, | ||
| screen, | ||
| dotclock, | ||
| hdisplay, | ||
| hsyncstart, | ||
| hsyncend, | ||
| htotal, | ||
| hskew, | ||
| vdisplay, | ||
| vsyncstart, | ||
| vsyncend, | ||
| vtotal, | ||
| flags, | ||
| privsize, | ||
| private, | ||
| is_checked=False, | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xIIHHHHHHHHH2xI12xI", screen, dotclock, hdisplay, hsyncstart, hsyncend, htotal, hskew, vdisplay, vsyncstart, vsyncend, vtotal, flags, privsize)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=xx2xIIHHHHHHHHH2xI12xI", | ||
| screen, | ||
| dotclock, | ||
| hdisplay, | ||
| hsyncstart, | ||
| hsyncend, | ||
| htotal, | ||
| hskew, | ||
| vdisplay, | ||
| vsyncstart, | ||
| vsyncend, | ||
| vtotal, | ||
| flags, | ||
| privsize, | ||
| ) | ||
| ) | ||
| buf.write(xcffib.pack_list(private, "B")) | ||
| return self.send_request(8, buf, is_checked=is_checked) | ||
| def ValidateModeLine(self, screen, dotclock, hdisplay, hsyncstart, hsyncend, htotal, hskew, vdisplay, vsyncstart, vsyncend, vtotal, flags, privsize, private, is_checked=True): | ||
| def ValidateModeLine( | ||
| self, | ||
| screen, | ||
| dotclock, | ||
| hdisplay, | ||
| hsyncstart, | ||
| hsyncend, | ||
| htotal, | ||
| hskew, | ||
| vdisplay, | ||
| vsyncstart, | ||
| vsyncend, | ||
| vtotal, | ||
| flags, | ||
| privsize, | ||
| private, | ||
| is_checked=True, | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xIIHHHHHHHHH2xI12xI", screen, dotclock, hdisplay, hsyncstart, hsyncend, htotal, hskew, vdisplay, vsyncstart, vsyncend, vtotal, flags, privsize)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=xx2xIIHHHHHHHHH2xI12xI", | ||
| screen, | ||
| dotclock, | ||
| hdisplay, | ||
| hsyncstart, | ||
| hsyncend, | ||
| htotal, | ||
| hskew, | ||
| vdisplay, | ||
| vsyncstart, | ||
| vsyncend, | ||
| vtotal, | ||
| flags, | ||
| privsize, | ||
| ) | ||
| ) | ||
| buf.write(xcffib.pack_list(private, "B")) | ||
| return self.send_request(9, buf, ValidateModeLineCookie, is_checked=is_checked) | ||
| def SwitchToMode(self, screen, dotclock, hdisplay, hsyncstart, hsyncend, htotal, hskew, vdisplay, vsyncstart, vsyncend, vtotal, flags, privsize, private, is_checked=False): | ||
| def SwitchToMode( | ||
| self, | ||
| screen, | ||
| dotclock, | ||
| hdisplay, | ||
| hsyncstart, | ||
| hsyncend, | ||
| htotal, | ||
| hskew, | ||
| vdisplay, | ||
| vsyncstart, | ||
| vsyncend, | ||
| vtotal, | ||
| flags, | ||
| privsize, | ||
| private, | ||
| is_checked=False, | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xIIHHHHHHHHH2xI12xI", screen, dotclock, hdisplay, hsyncstart, hsyncend, htotal, hskew, vdisplay, vsyncstart, vsyncend, vtotal, flags, privsize)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=xx2xIIHHHHHHHHH2xI12xI", | ||
| screen, | ||
| dotclock, | ||
| hdisplay, | ||
| hsyncstart, | ||
| hsyncend, | ||
| htotal, | ||
| hskew, | ||
| vdisplay, | ||
| vsyncstart, | ||
| vsyncend, | ||
| vtotal, | ||
| flags, | ||
| privsize, | ||
| ) | ||
| ) | ||
| buf.write(xcffib.pack_list(private, "B")) | ||
| return self.send_request(10, buf, is_checked=is_checked) | ||
| def GetViewPort(self, screen, is_checked=True): | ||
@@ -399,2 +807,3 @@ buf = io.BytesIO() | ||
| return self.send_request(11, buf, GetViewPortCookie, is_checked=is_checked) | ||
| def SetViewPort(self, screen, x, y, is_checked=False): | ||
@@ -404,2 +813,3 @@ buf = io.BytesIO() | ||
| return self.send_request(12, buf, is_checked=is_checked) | ||
| def GetDotClocks(self, screen, is_checked=True): | ||
@@ -409,2 +819,3 @@ buf = io.BytesIO() | ||
| return self.send_request(13, buf, GetDotClocksCookie, is_checked=is_checked) | ||
| def SetClientVersion(self, major, minor, is_checked=False): | ||
@@ -414,2 +825,3 @@ buf = io.BytesIO() | ||
| return self.send_request(14, buf, is_checked=is_checked) | ||
| def SetGamma(self, screen, red, green, blue, is_checked=False): | ||
@@ -419,2 +831,3 @@ buf = io.BytesIO() | ||
| return self.send_request(15, buf, is_checked=is_checked) | ||
| def GetGamma(self, screen, is_checked=True): | ||
@@ -424,2 +837,3 @@ buf = io.BytesIO() | ||
| return self.send_request(16, buf, GetGammaCookie, is_checked=is_checked) | ||
| def GetGammaRamp(self, screen, size, is_checked=True): | ||
@@ -429,2 +843,3 @@ buf = io.BytesIO() | ||
| return self.send_request(17, buf, GetGammaRampCookie, is_checked=is_checked) | ||
| def SetGammaRamp(self, screen, size, red, green, blue, is_checked=False): | ||
@@ -437,2 +852,3 @@ buf = io.BytesIO() | ||
| return self.send_request(18, buf, is_checked=is_checked) | ||
| def GetGammaRampSize(self, screen, is_checked=True): | ||
@@ -442,2 +858,3 @@ buf = io.BytesIO() | ||
| return self.send_request(19, buf, GetGammaRampSizeCookie, is_checked=is_checked) | ||
| def GetPermissions(self, screen, is_checked=True): | ||
@@ -447,2 +864,4 @@ buf = io.BytesIO() | ||
| return self.send_request(20, buf, GetPermissionsCookie, is_checked=is_checked) | ||
| xcffib._add_ext(key, xf86vidmodeExtension, _events, _errors) |
+244
-18
| import xcffib | ||
| import struct | ||
| import io | ||
| from dataclasses import dataclass | ||
| MAJOR_VERSION = 6 | ||
@@ -12,4 +14,8 @@ MINOR_VERSION = 0 | ||
| from . import shape | ||
| @dataclass(init=False) | ||
| class QueryVersionReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -22,13 +28,28 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class QueryVersionCookie(xcffib.Cookie): | ||
| reply_type = QueryVersionReply | ||
| @dataclass(init=False) | ||
| class SaveSetMode: | ||
| Insert = 0 | ||
| Delete = 1 | ||
| @dataclass(init=False) | ||
| class SaveSetTarget: | ||
| Nearest = 0 | ||
| Root = 1 | ||
| @dataclass(init=False) | ||
| class SaveSetMapping: | ||
| Map = 0 | ||
| Unmap = 1 | ||
| @dataclass(init=False) | ||
| class SelectionEvent: | ||
@@ -38,2 +59,5 @@ SetSelectionOwner = 0 | ||
| SelectionClientClose = 2 | ||
| @dataclass(init=False) | ||
| class SelectionEventMask: | ||
@@ -43,4 +67,8 @@ SetSelectionOwner = 1 << 0 | ||
| SelectionClientClose = 1 << 2 | ||
| @dataclass(init=False) | ||
| class SelectionNotifyEvent(xcffib.Event): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -51,8 +79,26 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.subtype, self.window, self.owner, self.selection, self.timestamp, self.selection_timestamp = unpacker.unpack("xB2xIIIII8x") | ||
| ( | ||
| self.subtype, | ||
| self.window, | ||
| self.owner, | ||
| self.selection, | ||
| self.timestamp, | ||
| self.selection_timestamp, | ||
| ) = unpacker.unpack("xB2xIIIII8x") | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=B", 0)) | ||
| buf.write(struct.pack("=B2xIIIII8x", self.subtype, self.window, self.owner, self.selection, self.timestamp, self.selection_timestamp)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=B2xIIIII8x", | ||
| self.subtype, | ||
| self.window, | ||
| self.owner, | ||
| self.selection, | ||
| self.timestamp, | ||
| self.selection_timestamp, | ||
| ) | ||
| ) | ||
| buf_len = len(buf.getvalue()) | ||
@@ -62,4 +108,7 @@ if buf_len < 32: | ||
| return buf.getvalue() | ||
| @classmethod | ||
| def synthetic(cls, subtype, window, owner, selection, timestamp, selection_timestamp): | ||
| def synthetic( | ||
| cls, subtype, window, owner, selection, timestamp, selection_timestamp | ||
| ): | ||
| self = cls.__new__(cls) | ||
@@ -73,9 +122,21 @@ self.subtype = subtype | ||
| return self | ||
| _events[0] = SelectionNotifyEvent | ||
| @dataclass(init=False) | ||
| class CursorNotify: | ||
| DisplayCursor = 0 | ||
| @dataclass(init=False) | ||
| class CursorNotifyMask: | ||
| DisplayCursor = 1 << 0 | ||
| @dataclass(init=False) | ||
| class CursorNotifyEvent(xcffib.Event): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -86,8 +147,20 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.subtype, self.window, self.cursor_serial, self.timestamp, self.name = unpacker.unpack("xB2xIIII12x") | ||
| self.subtype, self.window, self.cursor_serial, self.timestamp, self.name = ( | ||
| unpacker.unpack("xB2xIIII12x") | ||
| ) | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=B", 1)) | ||
| buf.write(struct.pack("=B2xIIII12x", self.subtype, self.window, self.cursor_serial, self.timestamp, self.name)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=B2xIIII12x", | ||
| self.subtype, | ||
| self.window, | ||
| self.cursor_serial, | ||
| self.timestamp, | ||
| self.name, | ||
| ) | ||
| ) | ||
| buf_len = len(buf.getvalue()) | ||
@@ -97,2 +170,3 @@ if buf_len < 32: | ||
| return buf.getvalue() | ||
| @classmethod | ||
@@ -107,5 +181,11 @@ def synthetic(cls, subtype, window, cursor_serial, timestamp, name): | ||
| return self | ||
| _events[1] = CursorNotifyEvent | ||
| @dataclass(init=False) | ||
| class GetCursorImageReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -116,9 +196,24 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.x, self.y, self.width, self.height, self.xhot, self.yhot, self.cursor_serial = unpacker.unpack("xx2x4xhhHHHHI8x") | ||
| ( | ||
| self.x, | ||
| self.y, | ||
| self.width, | ||
| self.height, | ||
| self.xhot, | ||
| self.yhot, | ||
| self.cursor_serial, | ||
| ) = unpacker.unpack("xx2x4xhhHHHHI8x") | ||
| self.cursor_image = xcffib.List(unpacker, "I", self.width * self.height) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetCursorImageCookie(xcffib.Cookie): | ||
| reply_type = GetCursorImageReply | ||
| @dataclass(init=False) | ||
| class BadRegionError(xcffib.Error): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -131,2 +226,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -137,8 +233,17 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| BadBadRegion = BadRegionError | ||
| _errors[0] = BadRegionError | ||
| @dataclass(init=False) | ||
| class Region: | ||
| _None = 0 | ||
| @dataclass(init=False) | ||
| class FetchRegionReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -155,6 +260,13 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class FetchRegionCookie(xcffib.Cookie): | ||
| reply_type = FetchRegionReply | ||
| @dataclass(init=False) | ||
| class GetCursorNameReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -168,6 +280,13 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetCursorNameCookie(xcffib.Cookie): | ||
| reply_type = GetCursorNameReply | ||
| @dataclass(init=False) | ||
| class GetCursorImageAndNameReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -178,3 +297,13 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.x, self.y, self.width, self.height, self.xhot, self.yhot, self.cursor_serial, self.cursor_atom, self.nbytes = unpacker.unpack("xx2x4xhhHHHHIIH2x") | ||
| ( | ||
| self.x, | ||
| self.y, | ||
| self.width, | ||
| self.height, | ||
| self.xhot, | ||
| self.yhot, | ||
| self.cursor_serial, | ||
| self.cursor_atom, | ||
| self.nbytes, | ||
| ) = unpacker.unpack("xx2x4xhhHHHHIIH2x") | ||
| self.cursor_image = xcffib.List(unpacker, "I", self.width * self.height) | ||
@@ -184,4 +313,10 @@ unpacker.pad("c") | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetCursorImageAndNameCookie(xcffib.Cookie): | ||
| reply_type = GetCursorImageAndNameReply | ||
| @dataclass(init=False) | ||
| class BarrierDirections: | ||
@@ -192,7 +327,14 @@ PositiveX = 1 << 0 | ||
| NegativeY = 1 << 3 | ||
| @dataclass(init=False) | ||
| class ClientDisconnectFlags: | ||
| Default = 0 | ||
| Terminate = 1 << 0 | ||
| @dataclass(init=False) | ||
| class GetClientDisconnectModeReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -203,6 +345,12 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.disconnect_mode, = unpacker.unpack("xx2x4xI20x") | ||
| (self.disconnect_mode,) = unpacker.unpack("xx2x4xI20x") | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetClientDisconnectModeCookie(xcffib.Cookie): | ||
| reply_type = GetClientDisconnectModeReply | ||
| @dataclass(init=False) | ||
| class xfixesExtension(xcffib.Extension): | ||
@@ -213,2 +361,3 @@ def QueryVersion(self, client_major_version, client_minor_version, is_checked=True): | ||
| return self.send_request(0, buf, QueryVersionCookie, is_checked=is_checked) | ||
| def ChangeSaveSet(self, mode, target, map, window, is_checked=False): | ||
@@ -218,2 +367,3 @@ buf = io.BytesIO() | ||
| return self.send_request(1, buf, is_checked=is_checked) | ||
| def SelectSelectionInput(self, window, selection, event_mask, is_checked=False): | ||
@@ -223,2 +373,3 @@ buf = io.BytesIO() | ||
| return self.send_request(2, buf, is_checked=is_checked) | ||
| def SelectCursorInput(self, window, event_mask, is_checked=False): | ||
@@ -228,2 +379,3 @@ buf = io.BytesIO() | ||
| return self.send_request(3, buf, is_checked=is_checked) | ||
| def GetCursorImage(self, is_checked=True): | ||
@@ -233,2 +385,3 @@ buf = io.BytesIO() | ||
| return self.send_request(4, buf, GetCursorImageCookie, is_checked=is_checked) | ||
| def CreateRegion(self, region, rectangles_len, rectangles, is_checked=False): | ||
@@ -239,2 +392,3 @@ buf = io.BytesIO() | ||
| return self.send_request(5, buf, is_checked=is_checked) | ||
| def CreateRegionFromBitmap(self, region, bitmap, is_checked=False): | ||
@@ -244,2 +398,3 @@ buf = io.BytesIO() | ||
| return self.send_request(6, buf, is_checked=is_checked) | ||
| def CreateRegionFromWindow(self, region, window, kind, is_checked=False): | ||
@@ -249,2 +404,3 @@ buf = io.BytesIO() | ||
| return self.send_request(7, buf, is_checked=is_checked) | ||
| def CreateRegionFromGC(self, region, gc, is_checked=False): | ||
@@ -254,2 +410,3 @@ buf = io.BytesIO() | ||
| return self.send_request(8, buf, is_checked=is_checked) | ||
| def CreateRegionFromPicture(self, region, picture, is_checked=False): | ||
@@ -259,2 +416,3 @@ buf = io.BytesIO() | ||
| return self.send_request(9, buf, is_checked=is_checked) | ||
| def DestroyRegion(self, region, is_checked=False): | ||
@@ -264,2 +422,3 @@ buf = io.BytesIO() | ||
| return self.send_request(10, buf, is_checked=is_checked) | ||
| def SetRegion(self, region, rectangles_len, rectangles, is_checked=False): | ||
@@ -270,2 +429,3 @@ buf = io.BytesIO() | ||
| return self.send_request(11, buf, is_checked=is_checked) | ||
| def CopyRegion(self, source, destination, is_checked=False): | ||
@@ -275,2 +435,3 @@ buf = io.BytesIO() | ||
| return self.send_request(12, buf, is_checked=is_checked) | ||
| def UnionRegion(self, source1, source2, destination, is_checked=False): | ||
@@ -280,2 +441,3 @@ buf = io.BytesIO() | ||
| return self.send_request(13, buf, is_checked=is_checked) | ||
| def IntersectRegion(self, source1, source2, destination, is_checked=False): | ||
@@ -285,2 +447,3 @@ buf = io.BytesIO() | ||
| return self.send_request(14, buf, is_checked=is_checked) | ||
| def SubtractRegion(self, source1, source2, destination, is_checked=False): | ||
@@ -290,8 +453,14 @@ buf = io.BytesIO() | ||
| return self.send_request(15, buf, is_checked=is_checked) | ||
| def InvertRegion(self, source, bounds, destination, is_checked=False): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xI", source)) | ||
| buf.write(bounds.pack() if hasattr(bounds, "pack") else xproto.RECTANGLE.synthetic(*bounds).pack()) | ||
| buf.write( | ||
| bounds.pack() | ||
| if hasattr(bounds, "pack") | ||
| else xproto.RECTANGLE.synthetic(*bounds).pack() | ||
| ) | ||
| buf.write(struct.pack("=I", destination)) | ||
| return self.send_request(16, buf, is_checked=is_checked) | ||
| def TranslateRegion(self, region, dx, dy, is_checked=False): | ||
@@ -301,2 +470,3 @@ buf = io.BytesIO() | ||
| return self.send_request(17, buf, is_checked=is_checked) | ||
| def RegionExtents(self, source, destination, is_checked=False): | ||
@@ -306,2 +476,3 @@ buf = io.BytesIO() | ||
| return self.send_request(18, buf, is_checked=is_checked) | ||
| def FetchRegion(self, region, is_checked=True): | ||
@@ -311,2 +482,3 @@ buf = io.BytesIO() | ||
| return self.send_request(19, buf, FetchRegionCookie, is_checked=is_checked) | ||
| def SetGCClipRegion(self, gc, region, x_origin, y_origin, is_checked=False): | ||
@@ -316,10 +488,19 @@ buf = io.BytesIO() | ||
| return self.send_request(20, buf, is_checked=is_checked) | ||
| def SetWindowShapeRegion(self, dest, dest_kind, x_offset, y_offset, region, is_checked=False): | ||
| def SetWindowShapeRegion( | ||
| self, dest, dest_kind, x_offset, y_offset, region, is_checked=False | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xIB3xhhI", dest, dest_kind, x_offset, y_offset, region)) | ||
| buf.write( | ||
| struct.pack("=xx2xIB3xhhI", dest, dest_kind, x_offset, y_offset, region) | ||
| ) | ||
| return self.send_request(21, buf, is_checked=is_checked) | ||
| def SetPictureClipRegion(self, picture, region, x_origin, y_origin, is_checked=False): | ||
| def SetPictureClipRegion( | ||
| self, picture, region, x_origin, y_origin, is_checked=False | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xIIhh", picture, region, x_origin, y_origin)) | ||
| return self.send_request(22, buf, is_checked=is_checked) | ||
| def SetCursorName(self, cursor, nbytes, name, is_checked=False): | ||
@@ -330,2 +511,3 @@ buf = io.BytesIO() | ||
| return self.send_request(23, buf, is_checked=is_checked) | ||
| def GetCursorName(self, cursor, is_checked=True): | ||
@@ -335,6 +517,10 @@ buf = io.BytesIO() | ||
| return self.send_request(24, buf, GetCursorNameCookie, is_checked=is_checked) | ||
| def GetCursorImageAndName(self, is_checked=True): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2x")) | ||
| return self.send_request(25, buf, GetCursorImageAndNameCookie, is_checked=is_checked) | ||
| return self.send_request( | ||
| 25, buf, GetCursorImageAndNameCookie, is_checked=is_checked | ||
| ) | ||
| def ChangeCursor(self, source, destination, is_checked=False): | ||
@@ -344,2 +530,3 @@ buf = io.BytesIO() | ||
| return self.send_request(26, buf, is_checked=is_checked) | ||
| def ChangeCursorByName(self, src, nbytes, name, is_checked=False): | ||
@@ -350,6 +537,12 @@ buf = io.BytesIO() | ||
| return self.send_request(27, buf, is_checked=is_checked) | ||
| def ExpandRegion(self, source, destination, left, right, top, bottom, is_checked=False): | ||
| def ExpandRegion( | ||
| self, source, destination, left, right, top, bottom, is_checked=False | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xIIHHHH", source, destination, left, right, top, bottom)) | ||
| buf.write( | ||
| struct.pack("=xx2xIIHHHH", source, destination, left, right, top, bottom) | ||
| ) | ||
| return self.send_request(28, buf, is_checked=is_checked) | ||
| def HideCursor(self, window, is_checked=False): | ||
@@ -359,2 +552,3 @@ buf = io.BytesIO() | ||
| return self.send_request(29, buf, is_checked=is_checked) | ||
| def ShowCursor(self, window, is_checked=False): | ||
@@ -364,7 +558,33 @@ buf = io.BytesIO() | ||
| 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): | ||
| def CreatePointerBarrier( | ||
| self, | ||
| barrier, | ||
| window, | ||
| x1, | ||
| y1, | ||
| x2, | ||
| y2, | ||
| directions, | ||
| num_devices, | ||
| devices, | ||
| is_checked=False, | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xIIHHHHI2xH", barrier, window, x1, y1, x2, y2, directions, num_devices)) | ||
| 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): | ||
@@ -374,2 +594,3 @@ buf = io.BytesIO() | ||
| return self.send_request(32, buf, is_checked=is_checked) | ||
| def SetClientDisconnectMode(self, disconnect_mode, is_checked=False): | ||
@@ -379,6 +600,11 @@ buf = io.BytesIO() | ||
| return self.send_request(33, buf, is_checked=is_checked) | ||
| def GetClientDisconnectMode(self, is_checked=True): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2x")) | ||
| return self.send_request(34, buf, GetClientDisconnectModeCookie, is_checked=is_checked) | ||
| return self.send_request( | ||
| 34, buf, GetClientDisconnectModeCookie, is_checked=is_checked | ||
| ) | ||
| xcffib._add_ext(key, xfixesExtension, _events, _errors) |
+66
-3
| import xcffib | ||
| import struct | ||
| import io | ||
| from dataclasses import dataclass | ||
| MAJOR_VERSION = 1 | ||
@@ -10,4 +12,8 @@ MINOR_VERSION = 1 | ||
| from . import xproto | ||
| @dataclass(init=False) | ||
| class ScreenInfo(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -20,2 +26,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -25,3 +32,5 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| fixed_size = 8 | ||
| @classmethod | ||
@@ -35,4 +44,8 @@ def synthetic(cls, x_org, y_org, width, height): | ||
| return self | ||
| @dataclass(init=False) | ||
| class QueryVersionReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -45,6 +58,13 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class QueryVersionCookie(xcffib.Cookie): | ||
| reply_type = QueryVersionReply | ||
| @dataclass(init=False) | ||
| class GetStateReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -57,6 +77,13 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetStateCookie(xcffib.Cookie): | ||
| reply_type = GetStateReply | ||
| @dataclass(init=False) | ||
| class GetScreenCountReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -69,6 +96,13 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetScreenCountCookie(xcffib.Cookie): | ||
| reply_type = GetScreenCountReply | ||
| @dataclass(init=False) | ||
| class GetScreenSizeReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -79,8 +113,17 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.width, self.height, self.window, self.screen = unpacker.unpack("xx2x4xIIII") | ||
| self.width, self.height, self.window, self.screen = unpacker.unpack( | ||
| "xx2x4xIIII" | ||
| ) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetScreenSizeCookie(xcffib.Cookie): | ||
| reply_type = GetScreenSizeReply | ||
| @dataclass(init=False) | ||
| class IsActiveReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -91,8 +134,15 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.state, = unpacker.unpack("xx2x4xI") | ||
| (self.state,) = unpacker.unpack("xx2x4xI") | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class IsActiveCookie(xcffib.Cookie): | ||
| reply_type = IsActiveReply | ||
| @dataclass(init=False) | ||
| class QueryScreensReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -103,7 +153,13 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.number, = unpacker.unpack("xx2x4xI20x") | ||
| (self.number,) = unpacker.unpack("xx2x4xI20x") | ||
| self.screen_info = xcffib.List(unpacker, ScreenInfo, self.number) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class QueryScreensCookie(xcffib.Cookie): | ||
| reply_type = QueryScreensReply | ||
| @dataclass(init=False) | ||
| class xineramaExtension(xcffib.Extension): | ||
@@ -114,2 +170,3 @@ def QueryVersion(self, major, minor, is_checked=True): | ||
| return self.send_request(0, buf, QueryVersionCookie, is_checked=is_checked) | ||
| def GetState(self, window, is_checked=True): | ||
@@ -119,2 +176,3 @@ buf = io.BytesIO() | ||
| return self.send_request(1, buf, GetStateCookie, is_checked=is_checked) | ||
| def GetScreenCount(self, window, is_checked=True): | ||
@@ -124,2 +182,3 @@ buf = io.BytesIO() | ||
| return self.send_request(2, buf, GetScreenCountCookie, is_checked=is_checked) | ||
| def GetScreenSize(self, window, screen, is_checked=True): | ||
@@ -129,2 +188,3 @@ buf = io.BytesIO() | ||
| return self.send_request(3, buf, GetScreenSizeCookie, is_checked=is_checked) | ||
| def IsActive(self, is_checked=True): | ||
@@ -134,2 +194,3 @@ buf = io.BytesIO() | ||
| return self.send_request(4, buf, IsActiveCookie, is_checked=is_checked) | ||
| def QueryScreens(self, is_checked=True): | ||
@@ -139,2 +200,4 @@ buf = io.BytesIO() | ||
| return self.send_request(5, buf, QueryScreensCookie, is_checked=is_checked) | ||
| xcffib._add_ext(key, xineramaExtension, _events, _errors) |
+276
-31
| import xcffib | ||
| import struct | ||
| import io | ||
| from dataclasses import dataclass | ||
| MAJOR_VERSION = 1 | ||
@@ -10,4 +12,8 @@ MINOR_VERSION = 0 | ||
| from . import xproto | ||
| @dataclass(init=False) | ||
| class PRINTER(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -18,8 +24,9 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.nameLen, = unpacker.unpack("I") | ||
| (self.nameLen,) = unpacker.unpack("I") | ||
| self.name = xcffib.List(unpacker, "c", self.nameLen) | ||
| self.descLen, = unpacker.unpack("I") | ||
| (self.descLen,) = unpacker.unpack("I") | ||
| unpacker.pad("c") | ||
| self.description = xcffib.List(unpacker, "c", self.descLen) | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -29,7 +36,16 @@ buf = io.BytesIO() | ||
| buf.write(xcffib.pack_list(self.name, "c")) | ||
| buf.write(struct.pack("=4x", )) | ||
| buf.write( | ||
| struct.pack( | ||
| "=4x", | ||
| ) | ||
| ) | ||
| buf.write(struct.pack("=I", self.descLen)) | ||
| buf.write(xcffib.pack_list(self.description, "c")) | ||
| buf.write(struct.pack("=4x", )) | ||
| buf.write( | ||
| struct.pack( | ||
| "=4x", | ||
| ) | ||
| ) | ||
| return buf.getvalue() | ||
| @classmethod | ||
@@ -43,5 +59,11 @@ def synthetic(cls, nameLen, name, descLen, description): | ||
| return self | ||
| @dataclass(init=False) | ||
| class GetDoc: | ||
| Finished = 0 | ||
| SecondConsumer = 1 | ||
| @dataclass(init=False) | ||
| class EvMask: | ||
@@ -51,2 +73,5 @@ NoEventMask = 0 | ||
| AttributeMask = 1 << 1 | ||
| @dataclass(init=False) | ||
| class Detail: | ||
@@ -59,2 +84,5 @@ StartJobNotify = 1 | ||
| EndPageNotify = 6 | ||
| @dataclass(init=False) | ||
| class Attr: | ||
@@ -68,4 +96,8 @@ JobAttr = 1 | ||
| SpoolerAttr = 7 | ||
| @dataclass(init=False) | ||
| class PrintQueryVersionReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -78,6 +110,13 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class PrintQueryVersionCookie(xcffib.Cookie): | ||
| reply_type = PrintQueryVersionReply | ||
| @dataclass(init=False) | ||
| class PrintGetPrinterListReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -88,9 +127,16 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.listCount, = unpacker.unpack("xx2x4xI20x") | ||
| (self.listCount,) = unpacker.unpack("xx2x4xI20x") | ||
| self.printers = xcffib.List(unpacker, PRINTER, self.listCount) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class PrintGetPrinterListCookie(xcffib.Cookie): | ||
| reply_type = PrintGetPrinterListReply | ||
| @dataclass(init=False) | ||
| class PrintGetContextReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -101,8 +147,15 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.context, = unpacker.unpack("xx2x4xI") | ||
| (self.context,) = unpacker.unpack("xx2x4xI") | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class PrintGetContextCookie(xcffib.Cookie): | ||
| reply_type = PrintGetContextReply | ||
| @dataclass(init=False) | ||
| class PrintGetScreenOfContextReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -113,8 +166,15 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.root, = unpacker.unpack("xx2x4xI") | ||
| (self.root,) = unpacker.unpack("xx2x4xI") | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class PrintGetScreenOfContextCookie(xcffib.Cookie): | ||
| reply_type = PrintGetScreenOfContextReply | ||
| @dataclass(init=False) | ||
| class PrintGetDocumentDataReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -125,9 +185,18 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.status_code, self.finished_flag, self.dataLen = unpacker.unpack("xx2x4xIII12x") | ||
| self.status_code, self.finished_flag, self.dataLen = unpacker.unpack( | ||
| "xx2x4xIII12x" | ||
| ) | ||
| self.data = xcffib.List(unpacker, "B", self.dataLen) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class PrintGetDocumentDataCookie(xcffib.Cookie): | ||
| reply_type = PrintGetDocumentDataReply | ||
| @dataclass(init=False) | ||
| class PrintInputSelectedReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -140,6 +209,13 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class PrintInputSelectedCookie(xcffib.Cookie): | ||
| reply_type = PrintInputSelectedReply | ||
| @dataclass(init=False) | ||
| class PrintGetAttributesReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -150,9 +226,16 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.stringLen, = unpacker.unpack("xx2x4xI20x") | ||
| (self.stringLen,) = unpacker.unpack("xx2x4xI20x") | ||
| self.attributes = xcffib.List(unpacker, "c", self.stringLen) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class PrintGetAttributesCookie(xcffib.Cookie): | ||
| reply_type = PrintGetAttributesReply | ||
| @dataclass(init=False) | ||
| class PrintGetOneAttributesReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -163,9 +246,16 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.valueLen, = unpacker.unpack("xx2x4xI20x") | ||
| (self.valueLen,) = unpacker.unpack("xx2x4xI20x") | ||
| self.value = xcffib.List(unpacker, "c", self.valueLen) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class PrintGetOneAttributesCookie(xcffib.Cookie): | ||
| reply_type = PrintGetOneAttributesReply | ||
| @dataclass(init=False) | ||
| class PrintGetPageDimensionsReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -176,8 +266,22 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.width, self.height, self.offset_x, self.offset_y, self.reproducible_width, self.reproducible_height = unpacker.unpack("xx2x4xHHHHHH") | ||
| ( | ||
| self.width, | ||
| self.height, | ||
| self.offset_x, | ||
| self.offset_y, | ||
| self.reproducible_width, | ||
| self.reproducible_height, | ||
| ) = unpacker.unpack("xx2x4xHHHHHH") | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class PrintGetPageDimensionsCookie(xcffib.Cookie): | ||
| reply_type = PrintGetPageDimensionsReply | ||
| @dataclass(init=False) | ||
| class PrintQueryScreensReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -188,9 +292,16 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.listCount, = unpacker.unpack("xx2x4xI20x") | ||
| (self.listCount,) = unpacker.unpack("xx2x4xI20x") | ||
| self.roots = xcffib.List(unpacker, "I", self.listCount) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class PrintQueryScreensCookie(xcffib.Cookie): | ||
| reply_type = PrintQueryScreensReply | ||
| @dataclass(init=False) | ||
| class PrintSetImageResolutionReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -203,6 +314,13 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class PrintSetImageResolutionCookie(xcffib.Cookie): | ||
| reply_type = PrintSetImageResolutionReply | ||
| @dataclass(init=False) | ||
| class PrintGetImageResolutionReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -213,8 +331,15 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.image_resolution, = unpacker.unpack("xx2x4xH") | ||
| (self.image_resolution,) = unpacker.unpack("xx2x4xH") | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class PrintGetImageResolutionCookie(xcffib.Cookie): | ||
| reply_type = PrintGetImageResolutionReply | ||
| @dataclass(init=False) | ||
| class NotifyEvent(xcffib.Event): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -227,2 +352,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -236,2 +362,3 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| @classmethod | ||
@@ -244,5 +371,11 @@ def synthetic(cls, detail, context, cancel): | ||
| return self | ||
| _events[0] = NotifyEvent | ||
| @dataclass(init=False) | ||
| class AttributNotifyEvent(xcffib.Event): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -255,2 +388,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -264,2 +398,3 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| @classmethod | ||
@@ -271,5 +406,11 @@ def synthetic(cls, detail, context): | ||
| return self | ||
| _events[1] = AttributNotifyEvent | ||
| @dataclass(init=False) | ||
| class BadContextError(xcffib.Error): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -282,2 +423,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -288,6 +430,12 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| BadBadContext = BadContextError | ||
| _errors[0] = BadContextError | ||
| @dataclass(init=False) | ||
| class BadSequenceError(xcffib.Error): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -300,2 +448,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -306,4 +455,9 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| BadBadSequence = BadSequenceError | ||
| _errors[1] = BadSequenceError | ||
| @dataclass(init=False) | ||
| class xprintExtension(xcffib.Extension): | ||
@@ -314,9 +468,19 @@ def PrintQueryVersion(self, is_checked=True): | ||
| return self.send_request(0, buf, PrintQueryVersionCookie, is_checked=is_checked) | ||
| def PrintGetPrinterList(self, printerNameLen, localeLen, printer_name, locale, is_checked=True): | ||
| def PrintGetPrinterList( | ||
| self, printerNameLen, localeLen, printer_name, locale, is_checked=True | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xII", printerNameLen, localeLen)) | ||
| buf.write(xcffib.pack_list(printer_name, "c")) | ||
| buf.write(struct.pack("=4x", )) | ||
| buf.write( | ||
| struct.pack( | ||
| "=4x", | ||
| ) | ||
| ) | ||
| buf.write(xcffib.pack_list(locale, "c")) | ||
| return self.send_request(1, buf, PrintGetPrinterListCookie, is_checked=is_checked) | ||
| return self.send_request( | ||
| 1, buf, PrintGetPrinterListCookie, is_checked=is_checked | ||
| ) | ||
| def PrintRehashPrinterList(self, is_checked=False): | ||
@@ -326,9 +490,23 @@ buf = io.BytesIO() | ||
| return self.send_request(20, buf, is_checked=is_checked) | ||
| def CreateContext(self, context_id, printerNameLen, localeLen, printerName, locale, is_checked=False): | ||
| def CreateContext( | ||
| self, | ||
| context_id, | ||
| printerNameLen, | ||
| localeLen, | ||
| printerName, | ||
| locale, | ||
| is_checked=False, | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xIII", context_id, printerNameLen, localeLen)) | ||
| buf.write(xcffib.pack_list(printerName, "c")) | ||
| buf.write(struct.pack("=4x", )) | ||
| buf.write( | ||
| struct.pack( | ||
| "=4x", | ||
| ) | ||
| ) | ||
| buf.write(xcffib.pack_list(locale, "c")) | ||
| return self.send_request(2, buf, is_checked=is_checked) | ||
| def PrintSetContext(self, context, is_checked=False): | ||
@@ -338,2 +516,3 @@ buf = io.BytesIO() | ||
| return self.send_request(3, buf, is_checked=is_checked) | ||
| def PrintGetContext(self, is_checked=True): | ||
@@ -343,2 +522,3 @@ buf = io.BytesIO() | ||
| return self.send_request(4, buf, PrintGetContextCookie, is_checked=is_checked) | ||
| def PrintDestroyContext(self, context, is_checked=False): | ||
@@ -348,6 +528,10 @@ buf = io.BytesIO() | ||
| return self.send_request(5, buf, is_checked=is_checked) | ||
| def PrintGetScreenOfContext(self, is_checked=True): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2x")) | ||
| return self.send_request(6, buf, PrintGetScreenOfContextCookie, is_checked=is_checked) | ||
| return self.send_request( | ||
| 6, buf, PrintGetScreenOfContextCookie, is_checked=is_checked | ||
| ) | ||
| def PrintStartJob(self, output_mode, is_checked=False): | ||
@@ -357,2 +541,3 @@ buf = io.BytesIO() | ||
| return self.send_request(7, buf, is_checked=is_checked) | ||
| def PrintEndJob(self, cancel, is_checked=False): | ||
@@ -362,2 +547,3 @@ buf = io.BytesIO() | ||
| return self.send_request(8, buf, is_checked=is_checked) | ||
| def PrintStartDoc(self, driver_mode, is_checked=False): | ||
@@ -367,2 +553,3 @@ buf = io.BytesIO() | ||
| return self.send_request(9, buf, is_checked=is_checked) | ||
| def PrintEndDoc(self, cancel, is_checked=False): | ||
@@ -372,15 +559,38 @@ buf = io.BytesIO() | ||
| return self.send_request(10, buf, is_checked=is_checked) | ||
| def PrintPutDocumentData(self, drawable, len_data, len_fmt, len_options, data, doc_format, options, is_checked=False): | ||
| def PrintPutDocumentData( | ||
| self, | ||
| drawable, | ||
| len_data, | ||
| len_fmt, | ||
| len_options, | ||
| data, | ||
| doc_format, | ||
| options, | ||
| is_checked=False, | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xIIHH", drawable, len_data, len_fmt, len_options)) | ||
| buf.write(xcffib.pack_list(data, "B")) | ||
| buf.write(struct.pack("=4x", )) | ||
| buf.write( | ||
| struct.pack( | ||
| "=4x", | ||
| ) | ||
| ) | ||
| buf.write(xcffib.pack_list(doc_format, "c")) | ||
| buf.write(struct.pack("=4x", )) | ||
| buf.write( | ||
| struct.pack( | ||
| "=4x", | ||
| ) | ||
| ) | ||
| buf.write(xcffib.pack_list(options, "c")) | ||
| return self.send_request(11, buf, is_checked=is_checked) | ||
| def PrintGetDocumentData(self, context, max_bytes, is_checked=True): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xII", context, max_bytes)) | ||
| return self.send_request(12, buf, PrintGetDocumentDataCookie, is_checked=is_checked) | ||
| return self.send_request( | ||
| 12, buf, PrintGetDocumentDataCookie, is_checked=is_checked | ||
| ) | ||
| def PrintStartPage(self, window, is_checked=False): | ||
@@ -390,2 +600,3 @@ buf = io.BytesIO() | ||
| return self.send_request(13, buf, is_checked=is_checked) | ||
| def PrintEndPage(self, cancel, is_checked=False): | ||
@@ -395,2 +606,3 @@ buf = io.BytesIO() | ||
| return self.send_request(14, buf, is_checked=is_checked) | ||
| def PrintSelectInput(self, context, event_mask, is_checked=False): | ||
@@ -400,10 +612,17 @@ buf = io.BytesIO() | ||
| return self.send_request(15, buf, is_checked=is_checked) | ||
| def PrintInputSelected(self, context, is_checked=True): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xI", context)) | ||
| return self.send_request(16, buf, PrintInputSelectedCookie, is_checked=is_checked) | ||
| return self.send_request( | ||
| 16, buf, PrintInputSelectedCookie, is_checked=is_checked | ||
| ) | ||
| def PrintGetAttributes(self, context, pool, is_checked=True): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xIB3x", context, pool)) | ||
| return self.send_request(17, buf, PrintGetAttributesCookie, is_checked=is_checked) | ||
| return self.send_request( | ||
| 17, buf, PrintGetAttributesCookie, is_checked=is_checked | ||
| ) | ||
| def PrintGetOneAttributes(self, context, nameLen, pool, name, is_checked=True): | ||
@@ -413,4 +632,16 @@ buf = io.BytesIO() | ||
| buf.write(xcffib.pack_list(name, "c")) | ||
| return self.send_request(19, buf, PrintGetOneAttributesCookie, is_checked=is_checked) | ||
| def PrintSetAttributes(self, context, stringLen, pool, rule, attributes_len, attributes, is_checked=False): | ||
| return self.send_request( | ||
| 19, buf, PrintGetOneAttributesCookie, is_checked=is_checked | ||
| ) | ||
| def PrintSetAttributes( | ||
| self, | ||
| context, | ||
| stringLen, | ||
| pool, | ||
| rule, | ||
| attributes_len, | ||
| attributes, | ||
| is_checked=False, | ||
| ): | ||
| buf = io.BytesIO() | ||
@@ -420,18 +651,32 @@ buf.write(struct.pack("=xx2xIIBB2x", context, stringLen, pool, rule)) | ||
| return self.send_request(18, buf, is_checked=is_checked) | ||
| def PrintGetPageDimensions(self, context, is_checked=True): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xI", context)) | ||
| return self.send_request(21, buf, PrintGetPageDimensionsCookie, is_checked=is_checked) | ||
| return self.send_request( | ||
| 21, buf, PrintGetPageDimensionsCookie, is_checked=is_checked | ||
| ) | ||
| def PrintQueryScreens(self, is_checked=True): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2x")) | ||
| return self.send_request(22, buf, PrintQueryScreensCookie, is_checked=is_checked) | ||
| return self.send_request( | ||
| 22, buf, PrintQueryScreensCookie, is_checked=is_checked | ||
| ) | ||
| def PrintSetImageResolution(self, context, image_resolution, is_checked=True): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xIH", context, image_resolution)) | ||
| return self.send_request(23, buf, PrintSetImageResolutionCookie, is_checked=is_checked) | ||
| return self.send_request( | ||
| 23, buf, PrintSetImageResolutionCookie, is_checked=is_checked | ||
| ) | ||
| def PrintGetImageResolution(self, context, is_checked=True): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xI", context)) | ||
| return self.send_request(24, buf, PrintGetImageResolutionCookie, is_checked=is_checked) | ||
| return self.send_request( | ||
| 24, buf, PrintGetImageResolutionCookie, is_checked=is_checked | ||
| ) | ||
| xcffib._add_ext(key, xprintExtension, _events, _errors) |
+213
-30
| import xcffib | ||
| import struct | ||
| import io | ||
| from dataclasses import dataclass | ||
| MAJOR_VERSION = 1 | ||
@@ -10,4 +12,8 @@ MINOR_VERSION = 0 | ||
| from . import xproto | ||
| @dataclass(init=False) | ||
| class QueryVersionReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -20,6 +26,13 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class QueryVersionCookie(xcffib.Cookie): | ||
| reply_type = QueryVersionReply | ||
| @dataclass(init=False) | ||
| class GetDeviceCreateContextReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -30,9 +43,16 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.context_len, = unpacker.unpack("xx2x4xI20x") | ||
| (self.context_len,) = unpacker.unpack("xx2x4xI20x") | ||
| self.context = xcffib.List(unpacker, "c", self.context_len) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetDeviceCreateContextCookie(xcffib.Cookie): | ||
| reply_type = GetDeviceCreateContextReply | ||
| @dataclass(init=False) | ||
| class GetDeviceContextReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -43,9 +63,16 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.context_len, = unpacker.unpack("xx2x4xI20x") | ||
| (self.context_len,) = unpacker.unpack("xx2x4xI20x") | ||
| self.context = xcffib.List(unpacker, "c", self.context_len) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetDeviceContextCookie(xcffib.Cookie): | ||
| reply_type = GetDeviceContextReply | ||
| @dataclass(init=False) | ||
| class GetWindowCreateContextReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -56,9 +83,16 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.context_len, = unpacker.unpack("xx2x4xI20x") | ||
| (self.context_len,) = unpacker.unpack("xx2x4xI20x") | ||
| self.context = xcffib.List(unpacker, "c", self.context_len) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetWindowCreateContextCookie(xcffib.Cookie): | ||
| reply_type = GetWindowCreateContextReply | ||
| @dataclass(init=False) | ||
| class GetWindowContextReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -69,9 +103,16 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.context_len, = unpacker.unpack("xx2x4xI20x") | ||
| (self.context_len,) = unpacker.unpack("xx2x4xI20x") | ||
| self.context = xcffib.List(unpacker, "c", self.context_len) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetWindowContextCookie(xcffib.Cookie): | ||
| reply_type = GetWindowContextReply | ||
| @dataclass(init=False) | ||
| class ListItem(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -82,3 +123,5 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.name, self.object_context_len, self.data_context_len = unpacker.unpack("III") | ||
| self.name, self.object_context_len, self.data_context_len = unpacker.unpack( | ||
| "III" | ||
| ) | ||
| self.object_context = xcffib.List(unpacker, "c", self.object_context_len) | ||
@@ -88,12 +131,28 @@ unpacker.pad("c") | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=III", self.name, self.object_context_len, self.data_context_len)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=III", self.name, self.object_context_len, self.data_context_len | ||
| ) | ||
| ) | ||
| buf.write(xcffib.pack_list(self.object_context, "c")) | ||
| buf.write(struct.pack("=4x", )) | ||
| buf.write( | ||
| struct.pack( | ||
| "=4x", | ||
| ) | ||
| ) | ||
| buf.write(xcffib.pack_list(self.data_context, "c")) | ||
| buf.write(struct.pack("=4x", )) | ||
| buf.write( | ||
| struct.pack( | ||
| "=4x", | ||
| ) | ||
| ) | ||
| return buf.getvalue() | ||
| @classmethod | ||
| def synthetic(cls, name, object_context_len, data_context_len, object_context, data_context): | ||
| def synthetic( | ||
| cls, name, object_context_len, data_context_len, object_context, data_context | ||
| ): | ||
| self = cls.__new__(cls) | ||
@@ -106,4 +165,8 @@ self.name = name | ||
| return self | ||
| @dataclass(init=False) | ||
| class GetPropertyCreateContextReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -114,9 +177,16 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.context_len, = unpacker.unpack("xx2x4xI20x") | ||
| (self.context_len,) = unpacker.unpack("xx2x4xI20x") | ||
| self.context = xcffib.List(unpacker, "c", self.context_len) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetPropertyCreateContextCookie(xcffib.Cookie): | ||
| reply_type = GetPropertyCreateContextReply | ||
| @dataclass(init=False) | ||
| class GetPropertyUseContextReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -127,9 +197,16 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.context_len, = unpacker.unpack("xx2x4xI20x") | ||
| (self.context_len,) = unpacker.unpack("xx2x4xI20x") | ||
| self.context = xcffib.List(unpacker, "c", self.context_len) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetPropertyUseContextCookie(xcffib.Cookie): | ||
| reply_type = GetPropertyUseContextReply | ||
| @dataclass(init=False) | ||
| class GetPropertyContextReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -140,9 +217,16 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.context_len, = unpacker.unpack("xx2x4xI20x") | ||
| (self.context_len,) = unpacker.unpack("xx2x4xI20x") | ||
| self.context = xcffib.List(unpacker, "c", self.context_len) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetPropertyContextCookie(xcffib.Cookie): | ||
| reply_type = GetPropertyContextReply | ||
| @dataclass(init=False) | ||
| class GetPropertyDataContextReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -153,9 +237,16 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.context_len, = unpacker.unpack("xx2x4xI20x") | ||
| (self.context_len,) = unpacker.unpack("xx2x4xI20x") | ||
| self.context = xcffib.List(unpacker, "c", self.context_len) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetPropertyDataContextCookie(xcffib.Cookie): | ||
| reply_type = GetPropertyDataContextReply | ||
| @dataclass(init=False) | ||
| class ListPropertiesReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -166,9 +257,16 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.properties_len, = unpacker.unpack("xx2x4xI20x") | ||
| (self.properties_len,) = unpacker.unpack("xx2x4xI20x") | ||
| self.properties = xcffib.List(unpacker, ListItem, self.properties_len) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class ListPropertiesCookie(xcffib.Cookie): | ||
| reply_type = ListPropertiesReply | ||
| @dataclass(init=False) | ||
| class GetSelectionCreateContextReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -179,9 +277,16 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.context_len, = unpacker.unpack("xx2x4xI20x") | ||
| (self.context_len,) = unpacker.unpack("xx2x4xI20x") | ||
| self.context = xcffib.List(unpacker, "c", self.context_len) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetSelectionCreateContextCookie(xcffib.Cookie): | ||
| reply_type = GetSelectionCreateContextReply | ||
| @dataclass(init=False) | ||
| class GetSelectionUseContextReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -192,9 +297,16 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.context_len, = unpacker.unpack("xx2x4xI20x") | ||
| (self.context_len,) = unpacker.unpack("xx2x4xI20x") | ||
| self.context = xcffib.List(unpacker, "c", self.context_len) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetSelectionUseContextCookie(xcffib.Cookie): | ||
| reply_type = GetSelectionUseContextReply | ||
| @dataclass(init=False) | ||
| class GetSelectionContextReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -205,9 +317,16 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.context_len, = unpacker.unpack("xx2x4xI20x") | ||
| (self.context_len,) = unpacker.unpack("xx2x4xI20x") | ||
| self.context = xcffib.List(unpacker, "c", self.context_len) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetSelectionContextCookie(xcffib.Cookie): | ||
| reply_type = GetSelectionContextReply | ||
| @dataclass(init=False) | ||
| class GetSelectionDataContextReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -218,9 +337,16 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.context_len, = unpacker.unpack("xx2x4xI20x") | ||
| (self.context_len,) = unpacker.unpack("xx2x4xI20x") | ||
| self.context = xcffib.List(unpacker, "c", self.context_len) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetSelectionDataContextCookie(xcffib.Cookie): | ||
| reply_type = GetSelectionDataContextReply | ||
| @dataclass(init=False) | ||
| class ListSelectionsReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -231,9 +357,16 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.selections_len, = unpacker.unpack("xx2x4xI20x") | ||
| (self.selections_len,) = unpacker.unpack("xx2x4xI20x") | ||
| self.selections = xcffib.List(unpacker, ListItem, self.selections_len) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class ListSelectionsCookie(xcffib.Cookie): | ||
| reply_type = ListSelectionsReply | ||
| @dataclass(init=False) | ||
| class GetClientContextReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -244,7 +377,13 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.context_len, = unpacker.unpack("xx2x4xI20x") | ||
| (self.context_len,) = unpacker.unpack("xx2x4xI20x") | ||
| self.context = xcffib.List(unpacker, "c", self.context_len) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetClientContextCookie(xcffib.Cookie): | ||
| reply_type = GetClientContextReply | ||
| @dataclass(init=False) | ||
| class xselinuxExtension(xcffib.Extension): | ||
@@ -255,2 +394,3 @@ def QueryVersion(self, client_major, client_minor, is_checked=True): | ||
| return self.send_request(0, buf, QueryVersionCookie, is_checked=is_checked) | ||
| def SetDeviceCreateContext(self, context_len, context, is_checked=False): | ||
@@ -261,6 +401,10 @@ buf = io.BytesIO() | ||
| return self.send_request(1, buf, is_checked=is_checked) | ||
| def GetDeviceCreateContext(self, is_checked=True): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2x")) | ||
| return self.send_request(2, buf, GetDeviceCreateContextCookie, is_checked=is_checked) | ||
| return self.send_request( | ||
| 2, buf, GetDeviceCreateContextCookie, is_checked=is_checked | ||
| ) | ||
| def SetDeviceContext(self, device, context_len, context, is_checked=False): | ||
@@ -271,2 +415,3 @@ buf = io.BytesIO() | ||
| return self.send_request(3, buf, is_checked=is_checked) | ||
| def GetDeviceContext(self, device, is_checked=True): | ||
@@ -276,2 +421,3 @@ buf = io.BytesIO() | ||
| return self.send_request(4, buf, GetDeviceContextCookie, is_checked=is_checked) | ||
| def SetWindowCreateContext(self, context_len, context, is_checked=False): | ||
@@ -282,6 +428,10 @@ buf = io.BytesIO() | ||
| return self.send_request(5, buf, is_checked=is_checked) | ||
| def GetWindowCreateContext(self, is_checked=True): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2x")) | ||
| return self.send_request(6, buf, GetWindowCreateContextCookie, is_checked=is_checked) | ||
| return self.send_request( | ||
| 6, buf, GetWindowCreateContextCookie, is_checked=is_checked | ||
| ) | ||
| def GetWindowContext(self, window, is_checked=True): | ||
@@ -291,2 +441,3 @@ buf = io.BytesIO() | ||
| return self.send_request(7, buf, GetWindowContextCookie, is_checked=is_checked) | ||
| def SetPropertyCreateContext(self, context_len, context, is_checked=False): | ||
@@ -297,6 +448,10 @@ buf = io.BytesIO() | ||
| return self.send_request(8, buf, is_checked=is_checked) | ||
| def GetPropertyCreateContext(self, is_checked=True): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2x")) | ||
| return self.send_request(9, buf, GetPropertyCreateContextCookie, is_checked=is_checked) | ||
| return self.send_request( | ||
| 9, buf, GetPropertyCreateContextCookie, is_checked=is_checked | ||
| ) | ||
| def SetPropertyUseContext(self, context_len, context, is_checked=False): | ||
@@ -307,14 +462,24 @@ buf = io.BytesIO() | ||
| return self.send_request(10, buf, is_checked=is_checked) | ||
| def GetPropertyUseContext(self, is_checked=True): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2x")) | ||
| return self.send_request(11, buf, GetPropertyUseContextCookie, is_checked=is_checked) | ||
| return self.send_request( | ||
| 11, buf, GetPropertyUseContextCookie, is_checked=is_checked | ||
| ) | ||
| def GetPropertyContext(self, window, property, is_checked=True): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xII", window, property)) | ||
| return self.send_request(12, buf, GetPropertyContextCookie, is_checked=is_checked) | ||
| return self.send_request( | ||
| 12, buf, GetPropertyContextCookie, is_checked=is_checked | ||
| ) | ||
| def GetPropertyDataContext(self, window, property, is_checked=True): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xII", window, property)) | ||
| return self.send_request(13, buf, GetPropertyDataContextCookie, is_checked=is_checked) | ||
| return self.send_request( | ||
| 13, buf, GetPropertyDataContextCookie, is_checked=is_checked | ||
| ) | ||
| def ListProperties(self, window, is_checked=True): | ||
@@ -324,2 +489,3 @@ buf = io.BytesIO() | ||
| return self.send_request(14, buf, ListPropertiesCookie, is_checked=is_checked) | ||
| def SetSelectionCreateContext(self, context_len, context, is_checked=False): | ||
@@ -330,6 +496,10 @@ buf = io.BytesIO() | ||
| return self.send_request(15, buf, is_checked=is_checked) | ||
| def GetSelectionCreateContext(self, is_checked=True): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2x")) | ||
| return self.send_request(16, buf, GetSelectionCreateContextCookie, is_checked=is_checked) | ||
| return self.send_request( | ||
| 16, buf, GetSelectionCreateContextCookie, is_checked=is_checked | ||
| ) | ||
| def SetSelectionUseContext(self, context_len, context, is_checked=False): | ||
@@ -340,14 +510,24 @@ buf = io.BytesIO() | ||
| return self.send_request(17, buf, is_checked=is_checked) | ||
| def GetSelectionUseContext(self, is_checked=True): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2x")) | ||
| return self.send_request(18, buf, GetSelectionUseContextCookie, is_checked=is_checked) | ||
| return self.send_request( | ||
| 18, buf, GetSelectionUseContextCookie, is_checked=is_checked | ||
| ) | ||
| def GetSelectionContext(self, selection, is_checked=True): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xI", selection)) | ||
| return self.send_request(19, buf, GetSelectionContextCookie, is_checked=is_checked) | ||
| return self.send_request( | ||
| 19, buf, GetSelectionContextCookie, is_checked=is_checked | ||
| ) | ||
| def GetSelectionDataContext(self, selection, is_checked=True): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xI", selection)) | ||
| return self.send_request(20, buf, GetSelectionDataContextCookie, is_checked=is_checked) | ||
| return self.send_request( | ||
| 20, buf, GetSelectionDataContextCookie, is_checked=is_checked | ||
| ) | ||
| def ListSelections(self, is_checked=True): | ||
@@ -357,2 +537,3 @@ buf = io.BytesIO() | ||
| return self.send_request(21, buf, ListSelectionsCookie, is_checked=is_checked) | ||
| def GetClientContext(self, resource, is_checked=True): | ||
@@ -362,2 +543,4 @@ buf = io.BytesIO() | ||
| return self.send_request(22, buf, GetClientContextCookie, is_checked=is_checked) | ||
| xcffib._add_ext(key, xselinuxExtension, _events, _errors) |
+36
-3
| import xcffib | ||
| import struct | ||
| import io | ||
| from dataclasses import dataclass | ||
| MAJOR_VERSION = 2 | ||
@@ -10,4 +12,8 @@ MINOR_VERSION = 2 | ||
| from . import xproto | ||
| @dataclass(init=False) | ||
| class GetVersionReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -20,9 +26,19 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetVersionCookie(xcffib.Cookie): | ||
| reply_type = GetVersionReply | ||
| @dataclass(init=False) | ||
| class Cursor: | ||
| _None = 0 | ||
| Current = 1 | ||
| @dataclass(init=False) | ||
| class CompareCursorReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -33,6 +49,12 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.same, = unpacker.unpack("xB2x4x") | ||
| (self.same,) = unpacker.unpack("xB2x4x") | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class CompareCursorCookie(xcffib.Cookie): | ||
| reply_type = CompareCursorReply | ||
| @dataclass(init=False) | ||
| class xtestExtension(xcffib.Extension): | ||
@@ -43,2 +65,3 @@ def GetVersion(self, major_version, minor_version, is_checked=True): | ||
| return self.send_request(0, buf, GetVersionCookie, is_checked=is_checked) | ||
| def CompareCursor(self, window, cursor, is_checked=True): | ||
@@ -48,6 +71,14 @@ buf = io.BytesIO() | ||
| return self.send_request(1, buf, CompareCursorCookie, is_checked=is_checked) | ||
| def FakeInput(self, type, detail, time, root, rootX, rootY, deviceid, is_checked=False): | ||
| def FakeInput( | ||
| self, type, detail, time, root, rootX, rootY, deviceid, is_checked=False | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xBB2xII8xhh7xB", type, detail, time, root, rootX, rootY, deviceid)) | ||
| 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): | ||
@@ -57,2 +88,4 @@ buf = io.BytesIO() | ||
| return self.send_request(3, buf, is_checked=is_checked) | ||
| xcffib._add_ext(key, xtestExtension, _events, _errors) |
+542
-41
| import xcffib | ||
| import struct | ||
| import io | ||
| from dataclasses import dataclass | ||
| MAJOR_VERSION = 2 | ||
@@ -11,2 +13,5 @@ MINOR_VERSION = 2 | ||
| from . import shm | ||
| @dataclass(init=False) | ||
| class Type: | ||
@@ -18,11 +23,23 @@ InputMask = 1 << 0 | ||
| ImageMask = 1 << 4 | ||
| @dataclass(init=False) | ||
| class ImageFormatInfoType: | ||
| RGB = 0 | ||
| YUV = 1 | ||
| @dataclass(init=False) | ||
| class ImageFormatInfoFormat: | ||
| Packed = 0 | ||
| Planar = 1 | ||
| @dataclass(init=False) | ||
| class AttributeFlag: | ||
| Gettable = 1 << 0 | ||
| Settable = 1 << 1 | ||
| @dataclass(init=False) | ||
| class VideoNotifyReason: | ||
@@ -34,5 +51,11 @@ Started = 0 | ||
| HardError = 4 | ||
| @dataclass(init=False) | ||
| class ScanlineOrder: | ||
| TopToBottom = 0 | ||
| BottomToTop = 1 | ||
| @dataclass(init=False) | ||
| class GrabPortStatus: | ||
@@ -45,4 +68,8 @@ Success = 0 | ||
| BadAlloc = 5 | ||
| @dataclass(init=False) | ||
| class Rational(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -55,2 +82,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -60,3 +88,5 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| fixed_size = 8 | ||
| @classmethod | ||
@@ -68,4 +98,8 @@ def synthetic(cls, numerator, denominator): | ||
| return self | ||
| @dataclass(init=False) | ||
| class Format(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -78,2 +112,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -83,3 +118,5 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| fixed_size = 8 | ||
| @classmethod | ||
@@ -91,4 +128,8 @@ def synthetic(cls, visual, depth): | ||
| return self | ||
| @dataclass(init=False) | ||
| class AdaptorInfo(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -99,3 +140,5 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.base_id, self.name_size, self.num_ports, self.num_formats, self.type = unpacker.unpack("IHHHBx") | ||
| self.base_id, self.name_size, self.num_ports, self.num_formats, self.type = ( | ||
| unpacker.unpack("IHHHBx") | ||
| ) | ||
| self.name = xcffib.List(unpacker, "c", self.name_size) | ||
@@ -105,9 +148,24 @@ unpacker.pad(Format) | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=IHHHBx", self.base_id, self.name_size, self.num_ports, self.num_formats, self.type)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=IHHHBx", | ||
| self.base_id, | ||
| self.name_size, | ||
| self.num_ports, | ||
| self.num_formats, | ||
| self.type, | ||
| ) | ||
| ) | ||
| buf.write(xcffib.pack_list(self.name, "c")) | ||
| buf.write(struct.pack("=4x", )) | ||
| buf.write( | ||
| struct.pack( | ||
| "=4x", | ||
| ) | ||
| ) | ||
| buf.write(xcffib.pack_list(self.formats, Format)) | ||
| return buf.getvalue() | ||
| @classmethod | ||
@@ -124,4 +182,8 @@ def synthetic(cls, base_id, name_size, num_ports, num_formats, type, name, formats): | ||
| return self | ||
| @dataclass(init=False) | ||
| class EncodingInfo(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -132,3 +194,5 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.encoding, self.name_size, self.width, self.height = unpacker.unpack("IHHH2x") | ||
| self.encoding, self.name_size, self.width, self.height = unpacker.unpack( | ||
| "IHHH2x" | ||
| ) | ||
| self.rate = Rational(unpacker) | ||
@@ -138,9 +202,23 @@ unpacker.pad("c") | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=IHHH2x", self.encoding, self.name_size, self.width, self.height)) | ||
| buf.write(self.rate.pack() if hasattr(self.rate, "pack") else Rational.synthetic(*self.rate).pack()) | ||
| buf.write( | ||
| struct.pack( | ||
| "=IHHH2x", self.encoding, self.name_size, self.width, self.height | ||
| ) | ||
| ) | ||
| buf.write( | ||
| self.rate.pack() | ||
| if hasattr(self.rate, "pack") | ||
| else Rational.synthetic(*self.rate).pack() | ||
| ) | ||
| buf.write(xcffib.pack_list(self.name, "c")) | ||
| buf.write(struct.pack("=4x", )) | ||
| buf.write( | ||
| struct.pack( | ||
| "=4x", | ||
| ) | ||
| ) | ||
| return buf.getvalue() | ||
| @classmethod | ||
@@ -156,4 +234,8 @@ def synthetic(cls, encoding, name_size, width, height, rate, name): | ||
| return self | ||
| @dataclass(init=False) | ||
| class Image(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -164,3 +246,5 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.id, self.width, self.height, self.data_size, self.num_planes = unpacker.unpack("IHHII") | ||
| self.id, self.width, self.height, self.data_size, self.num_planes = ( | ||
| unpacker.unpack("IHHII") | ||
| ) | ||
| self.pitches = xcffib.List(unpacker, "I", self.num_planes) | ||
@@ -172,5 +256,15 @@ unpacker.pad("I") | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=IHHII", self.id, self.width, self.height, self.data_size, self.num_planes)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=IHHII", | ||
| self.id, | ||
| self.width, | ||
| self.height, | ||
| self.data_size, | ||
| self.num_planes, | ||
| ) | ||
| ) | ||
| buf.write(xcffib.pack_list(self.pitches, "I")) | ||
@@ -180,4 +274,7 @@ buf.write(xcffib.pack_list(self.offsets, "I")) | ||
| return buf.getvalue() | ||
| @classmethod | ||
| def synthetic(cls, id, width, height, data_size, num_planes, pitches, offsets, data): | ||
| def synthetic( | ||
| cls, id, width, height, data_size, num_planes, pitches, offsets, data | ||
| ): | ||
| self = cls.__new__(cls) | ||
@@ -193,4 +290,8 @@ self.id = id | ||
| return self | ||
| @dataclass(init=False) | ||
| class AttributeInfo(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -204,2 +305,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -209,4 +311,9 @@ buf = io.BytesIO() | ||
| buf.write(xcffib.pack_list(self.name, "c")) | ||
| buf.write(struct.pack("=4x", )) | ||
| buf.write( | ||
| struct.pack( | ||
| "=4x", | ||
| ) | ||
| ) | ||
| return buf.getvalue() | ||
| @classmethod | ||
@@ -221,4 +328,8 @@ def synthetic(cls, flags, min, max, size, name): | ||
| return self | ||
| @dataclass(init=False) | ||
| class ImageFormatInfo(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -231,7 +342,25 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.guid = xcffib.List(unpacker, "B", 16) | ||
| self.bpp, self.num_planes, self.depth, self.red_mask, self.green_mask, self.blue_mask, self.format, self.y_sample_bits, self.u_sample_bits, self.v_sample_bits, self.vhorz_y_period, self.vhorz_u_period, self.vhorz_v_period, self.vvert_y_period, self.vvert_u_period, self.vvert_v_period = unpacker.unpack("BB2xB3xIIIB3xIIIIIIIII") | ||
| ( | ||
| self.bpp, | ||
| self.num_planes, | ||
| self.depth, | ||
| self.red_mask, | ||
| self.green_mask, | ||
| self.blue_mask, | ||
| self.format, | ||
| self.y_sample_bits, | ||
| self.u_sample_bits, | ||
| self.v_sample_bits, | ||
| self.vhorz_y_period, | ||
| self.vhorz_u_period, | ||
| self.vhorz_v_period, | ||
| self.vvert_y_period, | ||
| self.vvert_u_period, | ||
| self.vvert_v_period, | ||
| ) = unpacker.unpack("BB2xB3xIIIB3xIIIIIIIII") | ||
| unpacker.pad("B") | ||
| self.vcomp_order = xcffib.List(unpacker, "B", 32) | ||
| self.vscanline_order, = unpacker.unpack("B11x") | ||
| (self.vscanline_order,) = unpacker.unpack("B11x") | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -243,5 +372,13 @@ buf = io.BytesIO() | ||
| buf.write(struct.pack("=B", self.num_planes)) | ||
| buf.write(struct.pack("=2x", )) | ||
| buf.write( | ||
| struct.pack( | ||
| "=2x", | ||
| ) | ||
| ) | ||
| buf.write(struct.pack("=B", self.depth)) | ||
| buf.write(struct.pack("=3x", )) | ||
| buf.write( | ||
| struct.pack( | ||
| "=3x", | ||
| ) | ||
| ) | ||
| buf.write(struct.pack("=I", self.red_mask)) | ||
@@ -251,3 +388,7 @@ buf.write(struct.pack("=I", self.green_mask)) | ||
| buf.write(struct.pack("=B", self.format)) | ||
| buf.write(struct.pack("=3x", )) | ||
| buf.write( | ||
| struct.pack( | ||
| "=3x", | ||
| ) | ||
| ) | ||
| buf.write(struct.pack("=I", self.y_sample_bits)) | ||
@@ -264,7 +405,37 @@ buf.write(struct.pack("=I", self.u_sample_bits)) | ||
| buf.write(struct.pack("=B", self.vscanline_order)) | ||
| buf.write(struct.pack("=11x", )) | ||
| buf.write( | ||
| struct.pack( | ||
| "=11x", | ||
| ) | ||
| ) | ||
| return buf.getvalue() | ||
| fixed_size = 128 | ||
| @classmethod | ||
| def synthetic(cls, id, type, byte_order, guid, bpp, num_planes, depth, red_mask, green_mask, blue_mask, format, y_sample_bits, u_sample_bits, v_sample_bits, vhorz_y_period, vhorz_u_period, vhorz_v_period, vvert_y_period, vvert_u_period, vvert_v_period, vcomp_order, vscanline_order): | ||
| def synthetic( | ||
| cls, | ||
| id, | ||
| type, | ||
| byte_order, | ||
| guid, | ||
| bpp, | ||
| num_planes, | ||
| depth, | ||
| red_mask, | ||
| green_mask, | ||
| blue_mask, | ||
| format, | ||
| y_sample_bits, | ||
| u_sample_bits, | ||
| v_sample_bits, | ||
| vhorz_y_period, | ||
| vhorz_u_period, | ||
| vhorz_v_period, | ||
| vvert_y_period, | ||
| vvert_u_period, | ||
| vvert_v_period, | ||
| vcomp_order, | ||
| vscanline_order, | ||
| ): | ||
| self = cls.__new__(cls) | ||
@@ -294,4 +465,8 @@ self.id = id | ||
| return self | ||
| @dataclass(init=False) | ||
| class BadPortError(xcffib.Error): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -304,2 +479,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -310,6 +486,12 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| BadBadPort = BadPortError | ||
| _errors[0] = BadPortError | ||
| @dataclass(init=False) | ||
| class BadEncodingError(xcffib.Error): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -322,2 +504,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -328,6 +511,12 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| BadBadEncoding = BadEncodingError | ||
| _errors[1] = BadEncodingError | ||
| @dataclass(init=False) | ||
| class BadControlError(xcffib.Error): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -340,2 +529,3 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
@@ -346,6 +536,12 @@ buf = io.BytesIO() | ||
| return buf.getvalue() | ||
| BadBadControl = BadControlError | ||
| _errors[2] = BadControlError | ||
| @dataclass(init=False) | ||
| class VideoNotifyEvent(xcffib.Event): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -358,6 +554,9 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=B", 0)) | ||
| buf.write(struct.pack("=B2xIII", self.reason, self.time, self.drawable, self.port)) | ||
| buf.write( | ||
| struct.pack("=B2xIII", self.reason, self.time, self.drawable, self.port) | ||
| ) | ||
| buf_len = len(buf.getvalue()) | ||
@@ -367,2 +566,3 @@ if buf_len < 32: | ||
| return buf.getvalue() | ||
| @classmethod | ||
@@ -376,5 +576,11 @@ def synthetic(cls, reason, time, drawable, port): | ||
| return self | ||
| _events[0] = VideoNotifyEvent | ||
| @dataclass(init=False) | ||
| class PortNotifyEvent(xcffib.Event): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -387,6 +593,9 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| def pack(self): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=B", 1)) | ||
| buf.write(struct.pack("=x2xIIIi", self.time, self.port, self.attribute, self.value)) | ||
| buf.write( | ||
| struct.pack("=x2xIIIi", self.time, self.port, self.attribute, self.value) | ||
| ) | ||
| buf_len = len(buf.getvalue()) | ||
@@ -396,2 +605,3 @@ if buf_len < 32: | ||
| return buf.getvalue() | ||
| @classmethod | ||
@@ -405,5 +615,11 @@ def synthetic(cls, time, port, attribute, value): | ||
| return self | ||
| _events[1] = PortNotifyEvent | ||
| @dataclass(init=False) | ||
| class QueryExtensionReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -416,6 +632,13 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class QueryExtensionCookie(xcffib.Cookie): | ||
| reply_type = QueryExtensionReply | ||
| @dataclass(init=False) | ||
| class QueryAdaptorsReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -426,9 +649,16 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.num_adaptors, = unpacker.unpack("xx2x4xH22x") | ||
| (self.num_adaptors,) = unpacker.unpack("xx2x4xH22x") | ||
| self.info = xcffib.List(unpacker, AdaptorInfo, self.num_adaptors) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class QueryAdaptorsCookie(xcffib.Cookie): | ||
| reply_type = QueryAdaptorsReply | ||
| @dataclass(init=False) | ||
| class QueryEncodingsReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -439,9 +669,16 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.num_encodings, = unpacker.unpack("xx2x4xH22x") | ||
| (self.num_encodings,) = unpacker.unpack("xx2x4xH22x") | ||
| self.info = xcffib.List(unpacker, EncodingInfo, self.num_encodings) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class QueryEncodingsCookie(xcffib.Cookie): | ||
| reply_type = QueryEncodingsReply | ||
| @dataclass(init=False) | ||
| class GrabPortReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -452,8 +689,15 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.result, = unpacker.unpack("xB2x4x") | ||
| (self.result,) = unpacker.unpack("xB2x4x") | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GrabPortCookie(xcffib.Cookie): | ||
| reply_type = GrabPortReply | ||
| @dataclass(init=False) | ||
| class QueryBestSizeReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -466,6 +710,13 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class QueryBestSizeCookie(xcffib.Cookie): | ||
| reply_type = QueryBestSizeReply | ||
| @dataclass(init=False) | ||
| class GetPortAttributeReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -476,8 +727,15 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.value, = unpacker.unpack("xx2x4xi") | ||
| (self.value,) = unpacker.unpack("xx2x4xi") | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class GetPortAttributeCookie(xcffib.Cookie): | ||
| reply_type = GetPortAttributeReply | ||
| @dataclass(init=False) | ||
| class QueryPortAttributesReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -491,6 +749,13 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class QueryPortAttributesCookie(xcffib.Cookie): | ||
| reply_type = QueryPortAttributesReply | ||
| @dataclass(init=False) | ||
| class ListImageFormatsReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -501,9 +766,16 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.num_formats, = unpacker.unpack("xx2x4xI20x") | ||
| (self.num_formats,) = unpacker.unpack("xx2x4xI20x") | ||
| self.format = xcffib.List(unpacker, ImageFormatInfo, self.num_formats) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class ListImageFormatsCookie(xcffib.Cookie): | ||
| reply_type = ListImageFormatsReply | ||
| @dataclass(init=False) | ||
| class QueryImageAttributesReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -514,3 +786,5 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.num_planes, self.data_size, self.width, self.height = unpacker.unpack("xx2x4xIIHH12x") | ||
| self.num_planes, self.data_size, self.width, self.height = unpacker.unpack( | ||
| "xx2x4xIIHH12x" | ||
| ) | ||
| self.pitches = xcffib.List(unpacker, "I", self.num_planes) | ||
@@ -520,4 +794,10 @@ unpacker.pad("I") | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class QueryImageAttributesCookie(xcffib.Cookie): | ||
| reply_type = QueryImageAttributesReply | ||
| @dataclass(init=False) | ||
| class xvExtension(xcffib.Extension): | ||
@@ -528,2 +808,3 @@ def QueryExtension(self, is_checked=True): | ||
| return self.send_request(0, buf, QueryExtensionCookie, is_checked=is_checked) | ||
| def QueryAdaptors(self, window, is_checked=True): | ||
@@ -533,2 +814,3 @@ buf = io.BytesIO() | ||
| return self.send_request(1, buf, QueryAdaptorsCookie, is_checked=is_checked) | ||
| def QueryEncodings(self, port, is_checked=True): | ||
@@ -538,2 +820,3 @@ buf = io.BytesIO() | ||
| return self.send_request(2, buf, QueryEncodingsCookie, is_checked=is_checked) | ||
| def GrabPort(self, port, time, is_checked=True): | ||
@@ -543,2 +826,3 @@ buf = io.BytesIO() | ||
| return self.send_request(3, buf, GrabPortCookie, is_checked=is_checked) | ||
| def UngrabPort(self, port, time, is_checked=False): | ||
@@ -548,18 +832,139 @@ buf = io.BytesIO() | ||
| return self.send_request(4, buf, is_checked=is_checked) | ||
| def PutVideo(self, port, drawable, gc, vid_x, vid_y, vid_w, vid_h, drw_x, drw_y, drw_w, drw_h, is_checked=False): | ||
| def PutVideo( | ||
| self, | ||
| port, | ||
| drawable, | ||
| gc, | ||
| vid_x, | ||
| vid_y, | ||
| vid_w, | ||
| vid_h, | ||
| drw_x, | ||
| drw_y, | ||
| drw_w, | ||
| drw_h, | ||
| is_checked=False, | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xIIIhhHHhhHH", port, drawable, gc, vid_x, vid_y, vid_w, vid_h, drw_x, drw_y, drw_w, drw_h)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=xx2xIIIhhHHhhHH", | ||
| port, | ||
| drawable, | ||
| gc, | ||
| vid_x, | ||
| vid_y, | ||
| vid_w, | ||
| vid_h, | ||
| drw_x, | ||
| drw_y, | ||
| drw_w, | ||
| drw_h, | ||
| ) | ||
| ) | ||
| return self.send_request(5, buf, is_checked=is_checked) | ||
| def PutStill(self, port, drawable, gc, vid_x, vid_y, vid_w, vid_h, drw_x, drw_y, drw_w, drw_h, is_checked=False): | ||
| def PutStill( | ||
| self, | ||
| port, | ||
| drawable, | ||
| gc, | ||
| vid_x, | ||
| vid_y, | ||
| vid_w, | ||
| vid_h, | ||
| drw_x, | ||
| drw_y, | ||
| drw_w, | ||
| drw_h, | ||
| is_checked=False, | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xIIIhhHHhhHH", port, drawable, gc, vid_x, vid_y, vid_w, vid_h, drw_x, drw_y, drw_w, drw_h)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=xx2xIIIhhHHhhHH", | ||
| port, | ||
| drawable, | ||
| gc, | ||
| vid_x, | ||
| vid_y, | ||
| vid_w, | ||
| vid_h, | ||
| drw_x, | ||
| drw_y, | ||
| drw_w, | ||
| drw_h, | ||
| ) | ||
| ) | ||
| return self.send_request(6, buf, is_checked=is_checked) | ||
| def GetVideo(self, port, drawable, gc, vid_x, vid_y, vid_w, vid_h, drw_x, drw_y, drw_w, drw_h, is_checked=False): | ||
| def GetVideo( | ||
| self, | ||
| port, | ||
| drawable, | ||
| gc, | ||
| vid_x, | ||
| vid_y, | ||
| vid_w, | ||
| vid_h, | ||
| drw_x, | ||
| drw_y, | ||
| drw_w, | ||
| drw_h, | ||
| is_checked=False, | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xIIIhhHHhhHH", port, drawable, gc, vid_x, vid_y, vid_w, vid_h, drw_x, drw_y, drw_w, drw_h)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=xx2xIIIhhHHhhHH", | ||
| port, | ||
| drawable, | ||
| gc, | ||
| vid_x, | ||
| vid_y, | ||
| vid_w, | ||
| vid_h, | ||
| drw_x, | ||
| drw_y, | ||
| drw_w, | ||
| drw_h, | ||
| ) | ||
| ) | ||
| return self.send_request(7, buf, is_checked=is_checked) | ||
| def GetStill(self, port, drawable, gc, vid_x, vid_y, vid_w, vid_h, drw_x, drw_y, drw_w, drw_h, is_checked=False): | ||
| def GetStill( | ||
| self, | ||
| port, | ||
| drawable, | ||
| gc, | ||
| vid_x, | ||
| vid_y, | ||
| vid_w, | ||
| vid_h, | ||
| drw_x, | ||
| drw_y, | ||
| drw_w, | ||
| drw_h, | ||
| is_checked=False, | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xIIIhhHHhhHH", port, drawable, gc, vid_x, vid_y, vid_w, vid_h, drw_x, drw_y, drw_w, drw_h)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=xx2xIIIhhHHhhHH", | ||
| port, | ||
| drawable, | ||
| gc, | ||
| vid_x, | ||
| vid_y, | ||
| vid_w, | ||
| vid_h, | ||
| drw_x, | ||
| drw_y, | ||
| drw_w, | ||
| drw_h, | ||
| ) | ||
| ) | ||
| return self.send_request(8, buf, is_checked=is_checked) | ||
| def StopVideo(self, port, drawable, is_checked=False): | ||
@@ -569,2 +974,3 @@ buf = io.BytesIO() | ||
| return self.send_request(9, buf, is_checked=is_checked) | ||
| def SelectVideoNotify(self, drawable, onoff, is_checked=False): | ||
@@ -574,2 +980,3 @@ buf = io.BytesIO() | ||
| return self.send_request(10, buf, is_checked=is_checked) | ||
| def SelectPortNotify(self, port, onoff, is_checked=False): | ||
@@ -579,6 +986,10 @@ buf = io.BytesIO() | ||
| return self.send_request(11, buf, is_checked=is_checked) | ||
| def QueryBestSize(self, port, vid_w, vid_h, drw_w, drw_h, motion, is_checked=True): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xIHHHHB3x", port, vid_w, vid_h, drw_w, drw_h, motion)) | ||
| buf.write( | ||
| struct.pack("=xx2xIHHHHB3x", port, vid_w, vid_h, drw_w, drw_h, motion) | ||
| ) | ||
| return self.send_request(12, buf, QueryBestSizeCookie, is_checked=is_checked) | ||
| def SetPortAttribute(self, port, attribute, value, is_checked=False): | ||
@@ -588,2 +999,3 @@ buf = io.BytesIO() | ||
| return self.send_request(13, buf, is_checked=is_checked) | ||
| def GetPortAttribute(self, port, attribute, is_checked=True): | ||
@@ -593,6 +1005,10 @@ buf = io.BytesIO() | ||
| return self.send_request(14, buf, GetPortAttributeCookie, is_checked=is_checked) | ||
| def QueryPortAttributes(self, port, is_checked=True): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xI", port)) | ||
| return self.send_request(15, buf, QueryPortAttributesCookie, is_checked=is_checked) | ||
| return self.send_request( | ||
| 15, buf, QueryPortAttributesCookie, is_checked=is_checked | ||
| ) | ||
| def ListImageFormats(self, port, is_checked=True): | ||
@@ -602,15 +1018,100 @@ buf = io.BytesIO() | ||
| return self.send_request(16, buf, ListImageFormatsCookie, is_checked=is_checked) | ||
| def QueryImageAttributes(self, port, id, width, height, is_checked=True): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xIIHH", port, id, width, height)) | ||
| return self.send_request(17, buf, QueryImageAttributesCookie, is_checked=is_checked) | ||
| def PutImage(self, port, drawable, gc, id, src_x, src_y, src_w, src_h, drw_x, drw_y, drw_w, drw_h, width, height, data_len, data, is_checked=False): | ||
| return self.send_request( | ||
| 17, buf, QueryImageAttributesCookie, is_checked=is_checked | ||
| ) | ||
| def PutImage( | ||
| self, | ||
| port, | ||
| drawable, | ||
| gc, | ||
| id, | ||
| src_x, | ||
| src_y, | ||
| src_w, | ||
| src_h, | ||
| drw_x, | ||
| drw_y, | ||
| drw_w, | ||
| drw_h, | ||
| width, | ||
| height, | ||
| data_len, | ||
| data, | ||
| is_checked=False, | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xIIIIhhHHhhHHHH", port, drawable, gc, id, src_x, src_y, src_w, src_h, drw_x, drw_y, drw_w, drw_h, width, height)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=xx2xIIIIhhHHhhHHHH", | ||
| port, | ||
| drawable, | ||
| gc, | ||
| id, | ||
| src_x, | ||
| src_y, | ||
| src_w, | ||
| src_h, | ||
| drw_x, | ||
| drw_y, | ||
| drw_w, | ||
| drw_h, | ||
| width, | ||
| height, | ||
| ) | ||
| ) | ||
| buf.write(xcffib.pack_list(data, "B")) | ||
| return self.send_request(18, buf, is_checked=is_checked) | ||
| def ShmPutImage(self, port, drawable, gc, shmseg, id, offset, src_x, src_y, src_w, src_h, drw_x, drw_y, drw_w, drw_h, width, height, send_event, is_checked=False): | ||
| def ShmPutImage( | ||
| self, | ||
| port, | ||
| drawable, | ||
| gc, | ||
| shmseg, | ||
| id, | ||
| offset, | ||
| src_x, | ||
| src_y, | ||
| src_w, | ||
| src_h, | ||
| drw_x, | ||
| drw_y, | ||
| drw_w, | ||
| drw_h, | ||
| width, | ||
| height, | ||
| send_event, | ||
| is_checked=False, | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xIIIIIIhhHHhhHHHHB3x", port, drawable, gc, shmseg, id, offset, src_x, src_y, src_w, src_h, drw_x, drw_y, drw_w, drw_h, width, height, send_event)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=xx2xIIIIIIhhHHhhHHHHB3x", | ||
| port, | ||
| drawable, | ||
| gc, | ||
| shmseg, | ||
| id, | ||
| offset, | ||
| src_x, | ||
| src_y, | ||
| src_w, | ||
| src_h, | ||
| drw_x, | ||
| drw_y, | ||
| drw_w, | ||
| drw_h, | ||
| width, | ||
| height, | ||
| send_event, | ||
| ) | ||
| ) | ||
| return self.send_request(19, buf, is_checked=is_checked) | ||
| xcffib._add_ext(key, xvExtension, _events, _errors) |
+129
-12
| import xcffib | ||
| import struct | ||
| import io | ||
| from dataclasses import dataclass | ||
| MAJOR_VERSION = 1 | ||
@@ -10,4 +12,8 @@ MINOR_VERSION = 1 | ||
| from . import xv | ||
| @dataclass(init=False) | ||
| class SurfaceInfo(xcffib.Struct): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -18,11 +24,48 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| 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.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 = io.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)) | ||
| 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 | ||
| @classmethod | ||
| def synthetic(cls, id, chroma_format, pad0, max_width, max_height, subpicture_max_width, subpicture_max_height, mc_type, flags): | ||
| def synthetic( | ||
| cls, | ||
| id, | ||
| chroma_format, | ||
| pad0, | ||
| max_width, | ||
| max_height, | ||
| subpicture_max_width, | ||
| subpicture_max_height, | ||
| mc_type, | ||
| flags, | ||
| ): | ||
| self = cls.__new__(cls) | ||
@@ -39,4 +82,8 @@ self.id = id | ||
| return self | ||
| @dataclass(init=False) | ||
| class QueryVersionReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -49,6 +96,13 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class QueryVersionCookie(xcffib.Cookie): | ||
| reply_type = QueryVersionReply | ||
| @dataclass(init=False) | ||
| class ListSurfaceTypesReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -59,9 +113,16 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.num, = unpacker.unpack("xx2x4xI20x") | ||
| (self.num,) = unpacker.unpack("xx2x4xI20x") | ||
| self.surfaces = xcffib.List(unpacker, SurfaceInfo, self.num) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class ListSurfaceTypesCookie(xcffib.Cookie): | ||
| reply_type = ListSurfaceTypesReply | ||
| @dataclass(init=False) | ||
| class CreateContextReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -72,9 +133,18 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.width_actual, self.height_actual, self.flags_return = unpacker.unpack("xx2x4xHHI20x") | ||
| self.width_actual, self.height_actual, self.flags_return = unpacker.unpack( | ||
| "xx2x4xHHI20x" | ||
| ) | ||
| self.priv_data = xcffib.List(unpacker, "I", self.length) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class CreateContextCookie(xcffib.Cookie): | ||
| reply_type = CreateContextReply | ||
| @dataclass(init=False) | ||
| class CreateSurfaceReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -88,6 +158,13 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class CreateSurfaceCookie(xcffib.Cookie): | ||
| reply_type = CreateSurfaceReply | ||
| @dataclass(init=False) | ||
| class CreateSubpictureReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -98,3 +175,8 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.width_actual, self.height_actual, self.num_palette_entries, self.entry_bytes = unpacker.unpack("xx2x4xHHHH") | ||
| ( | ||
| self.width_actual, | ||
| self.height_actual, | ||
| self.num_palette_entries, | ||
| self.entry_bytes, | ||
| ) = unpacker.unpack("xx2x4xHHHH") | ||
| self.component_order = xcffib.List(unpacker, "B", 4) | ||
@@ -105,6 +187,13 @@ unpacker.unpack("12x") | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class CreateSubpictureCookie(xcffib.Cookie): | ||
| reply_type = CreateSubpictureReply | ||
| @dataclass(init=False) | ||
| class ListSubpictureTypesReply(xcffib.Reply): | ||
| xge = False | ||
| def __init__(self, unpacker): | ||
@@ -115,7 +204,13 @@ if isinstance(unpacker, xcffib.Protobj): | ||
| base = unpacker.offset | ||
| self.num, = unpacker.unpack("xx2x4xI20x") | ||
| (self.num,) = unpacker.unpack("xx2x4xI20x") | ||
| self.types = xcffib.List(unpacker, xv.ImageFormatInfo, self.num) | ||
| self.bufsize = unpacker.offset - base | ||
| @dataclass(init=False) | ||
| class ListSubpictureTypesCookie(xcffib.Cookie): | ||
| reply_type = ListSubpictureTypesReply | ||
| @dataclass(init=False) | ||
| class xvmcExtension(xcffib.Extension): | ||
@@ -126,2 +221,3 @@ def QueryVersion(self, is_checked=True): | ||
| return self.send_request(0, buf, QueryVersionCookie, is_checked=is_checked) | ||
| def ListSurfaceTypes(self, port_id, is_checked=True): | ||
@@ -131,6 +227,14 @@ buf = io.BytesIO() | ||
| return self.send_request(1, buf, ListSurfaceTypesCookie, is_checked=is_checked) | ||
| def CreateContext(self, context_id, port_id, surface_id, width, height, flags, is_checked=True): | ||
| def CreateContext( | ||
| self, context_id, port_id, surface_id, width, height, flags, is_checked=True | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xIIIHHI", context_id, port_id, surface_id, width, height, flags)) | ||
| buf.write( | ||
| struct.pack( | ||
| "=xx2xIIIHHI", context_id, port_id, surface_id, width, height, flags | ||
| ) | ||
| ) | ||
| return self.send_request(2, buf, CreateContextCookie, is_checked=is_checked) | ||
| def DestroyContext(self, context_id, is_checked=False): | ||
@@ -140,2 +244,3 @@ buf = io.BytesIO() | ||
| return self.send_request(3, buf, is_checked=is_checked) | ||
| def CreateSurface(self, surface_id, context_id, is_checked=True): | ||
@@ -145,2 +250,3 @@ buf = io.BytesIO() | ||
| return self.send_request(4, buf, CreateSurfaceCookie, is_checked=is_checked) | ||
| def DestroySurface(self, surface_id, is_checked=False): | ||
@@ -150,6 +256,12 @@ buf = io.BytesIO() | ||
| return self.send_request(5, buf, is_checked=is_checked) | ||
| def CreateSubpicture(self, subpicture_id, context, xvimage_id, width, height, is_checked=True): | ||
| def CreateSubpicture( | ||
| self, subpicture_id, context, xvimage_id, width, height, is_checked=True | ||
| ): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xIIIHH", subpicture_id, context, xvimage_id, width, height)) | ||
| buf.write( | ||
| struct.pack("=xx2xIIIHH", subpicture_id, context, xvimage_id, width, height) | ||
| ) | ||
| return self.send_request(6, buf, CreateSubpictureCookie, is_checked=is_checked) | ||
| def DestroySubpicture(self, subpicture_id, is_checked=False): | ||
@@ -159,6 +271,11 @@ buf = io.BytesIO() | ||
| return self.send_request(7, buf, is_checked=is_checked) | ||
| def ListSubpictureTypes(self, port_id, surface_id, is_checked=True): | ||
| buf = io.BytesIO() | ||
| buf.write(struct.pack("=xx2xII", port_id, surface_id)) | ||
| return self.send_request(8, buf, ListSubpictureTypesCookie, is_checked=is_checked) | ||
| return self.send_request( | ||
| 8, buf, ListSubpictureTypesCookie, is_checked=is_checked | ||
| ) | ||
| xcffib._add_ext(key, xvmcExtension, _events, _errors) |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
1077679
14.54%30585
46.28%