def SetGammaRamp(self, screen, size, red, green, blue, is_checked=False): buf = six.BytesIO() buf.write(struct.pack("=xx2xHH", screen, size)) buf.write(xcffib.pack_list(red, "H")) buf.write(xcffib.pack_list(green, "H")) buf.write(xcffib.pack_list(blue, "H")) return self.send_request(18, buf, is_checked=is_checked)
def pack(self): buf = six.BytesIO() 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(xcffib.pack_list(self.data_context, "c")) return buf.getvalue()
def pack(self): buf = six.BytesIO() 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(xcffib.pack_list(self.formats, Format)) return buf.getvalue()
def pack(self): buf = six.BytesIO() 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")) buf.write(xcffib.pack_list(self.offsets, "I")) buf.write(xcffib.pack_list(self.data, "B")) return buf.getvalue()
def SetPictureFilter(self, picture, filter_len, filter, values_len, values, is_checked=False): buf = six.BytesIO() buf.write(struct.pack("=xx2xIH2x", picture, filter_len)) buf.write(xcffib.pack_list(filter, "c")) buf.write(xcffib.pack_list(values, "i")) return self.send_request(30, buf, is_checked=is_checked)
def pack(self): buf = six.BytesIO() buf.write( struct.pack("=IBB2xBB2xB3xIIIB3xIIIIIIIIIB11x", self.id, self.type, self.byte_order, 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, self.vscanline_order)) buf.write(xcffib.pack_list(self.guid, "B")) buf.write(xcffib.pack_list(self.vcomp_order, "B")) return buf.getvalue()
def AddGlyphs(self, glyphset, glyphs_len, glyphids, glyphs, data_len, data, is_checked=False): buf = six.BytesIO() buf.write(struct.pack("=xx2xII", glyphset, glyphs_len)) buf.write(xcffib.pack_list(glyphids, "I")) buf.write(xcffib.pack_list(glyphs, GLYPHINFO)) buf.write(xcffib.pack_list(data, "B")) return self.send_request(20, buf, is_checked=is_checked)
def RegisterClients(self, context, element_header, num_client_specs, num_ranges, client_specs, ranges, is_checked=False): buf = six.BytesIO() 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 CreateConicalGradient(self, picture, angle, num_stops, center, stops, colors, is_checked=False): buf = six.BytesIO() buf.write(struct.pack("=xx2xIiI", picture, angle, num_stops)) buf.write(center.pack() if hasattr(center, "pack") else POINTFIX. synthetic(*center).pack()) buf.write(xcffib.pack_list(stops, "i")) buf.write(xcffib.pack_list(colors, COLOR)) return self.send_request(36, buf, is_checked=is_checked)
def FillRectangles(self, op, dst, color, rects_len, rects, is_checked=False): buf = six.BytesIO() buf.write(struct.pack("=xx2xB3xI", op, dst)) buf.write(color.pack() if hasattr(color, "pack") else COLOR.synthetic(*color).pack()) buf.write("") buf.write(xcffib.pack_list(rects, RECTANGLE)) return self.send_request(26, 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): buf = six.BytesIO() 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 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 = six.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(xcffib.pack_list(data, "B")) return self.send_request(18, buf, is_checked=is_checked)
def pack(self): buf = six.BytesIO() buf.write(struct.pack("=IH", self.counter, self.name_len)) buf.write(self.resolution.pack() if hasattr(self.resolution, "pack") else INT64.synthetic(*self.resolution).pack()) buf.write(xcffib.pack_list(self.name, "c")) return buf.getvalue()
def pack(self): buf = six.BytesIO() buf.write( struct.pack("=BBBBI", self.class_id, self.len, self.axes_len, self.mode, self.motion_size)) buf.write(xcffib.pack_list(self.axes, AxisInfo)) return buf.getvalue()
def pack(self): buf = six.BytesIO() buf.write(struct.pack("=B", 11)) buf.write(xcffib.pack_list(self.keys, "B")) buf_len = len(buf.getvalue()) if buf_len < 32: buf.write(struct.pack("x" * (32 - buf_len))) return buf.getvalue()
def CreateLinearGradient(self, picture, num_stops, p1, p2, stops, colors, is_checked=False): buf = six.BytesIO() buf.write(struct.pack("=xx2xII", picture, num_stops)) buf.write(p1.pack() if hasattr(p1, "pack") else POINTFIX.synthetic( *p1).pack()) buf.write(p2.pack() if hasattr(p2, "pack") else POINTFIX.synthetic( *p2).pack()) buf.write(xcffib.pack_list(stops, "i")) buf.write(xcffib.pack_list(colors, COLOR)) return self.send_request(34, buf, is_checked=is_checked)
def SetSelectionCreateContext(self, context_len, context, is_checked=False): buf = six.BytesIO() buf.write(struct.pack("=xx2xI", context_len)) buf.write(xcffib.pack_list(context, "c")) return self.send_request(15, buf, is_checked=is_checked)
def CreateRegion(self, region, rectangles_len, rectangles, is_checked=False): buf = six.BytesIO() buf.write(struct.pack("=xx2xI", region)) buf.write(xcffib.pack_list(rectangles, xproto.RECTANGLE)) return self.send_request(5, buf, is_checked=is_checked)
def UnregisterClients(self, context, num_client_specs, client_specs, is_checked=False): buf = six.BytesIO() buf.write(struct.pack("=xx2xII", context, num_client_specs)) buf.write(xcffib.pack_list(client_specs, "I")) return self.send_request(3, buf, is_checked=is_checked)
def pack(self): buf = six.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(xcffib.pack_list(self.name, "c")) return buf.getvalue()
def AddTraps(self, picture, x_off, y_off, traps_len, traps, is_checked=False): buf = six.BytesIO() buf.write(struct.pack("=xx2xIhh", picture, x_off, y_off)) buf.write(xcffib.pack_list(traps, TRAP)) return self.send_request(32, buf, is_checked=is_checked)
def SetPictureClipRectangles(self, picture, clip_x_origin, clip_y_origin, rectangles_len, rectangles, is_checked=False): buf = six.BytesIO() buf.write( struct.pack("=xx2xIhh", picture, clip_x_origin, clip_y_origin)) buf.write(xcffib.pack_list(rectangles, xproto.RECTANGLE)) return self.send_request(6, buf, is_checked=is_checked)
def ListFontsWithInfo(self, max_names, pattern_len, pattern, is_checked=True): buf = six.BytesIO() buf.write(struct.pack("=xx2xHH", max_names, pattern_len)) buf.write(xcffib.pack_list(pattern, "c")) return self.send_request(50, buf, ListFontsWithInfoCookie, is_checked=is_checked)
def CreateRadialGradient(self, picture, inner_radius, outer_radius, num_stops, inner, outer, stops, colors, is_checked=False): buf = six.BytesIO() buf.write( struct.pack("=xx2xIiiI", picture, inner_radius, outer_radius, num_stops)) 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(xcffib.pack_list(stops, "i")) buf.write(xcffib.pack_list(colors, COLOR)) return self.send_request(35, buf, is_checked=is_checked)
def FillRectangles(self, op, dst, color, rects_len, rects, is_checked=False): buf = six.BytesIO() buf.write(struct.pack("=xx2xB3xI", op, dst)) buf.write(color.pack() if hasattr(color, "pack") else COLOR.synthetic( *color).pack()) buf.write(xcffib.pack_list(rects, xproto.RECTANGLE)) return self.send_request(26, buf, is_checked=is_checked)
def Trapezoids(self, op, src, dst, mask_format, src_x, src_y, traps_len, traps, is_checked=False): buf = six.BytesIO() buf.write( struct.pack("=xx2xB3xIIIhh", op, src, dst, mask_format, src_x, src_y)) buf.write(xcffib.pack_list(traps, TRAPEZOID)) return self.send_request(10, buf, is_checked=is_checked)
def TriFan(self, op, src, dst, mask_format, src_x, src_y, points_len, points, is_checked=False): buf = six.BytesIO() buf.write( struct.pack("=xx2xB3xIIIhh", op, src, dst, mask_format, src_x, src_y)) buf.write(xcffib.pack_list(points, POINTFIX)) return self.send_request(13, buf, is_checked=is_checked)
def Triangles(self, op, src, dst, mask_format, src_x, src_y, triangles_len, triangles, is_checked=False): buf = six.BytesIO() buf.write( struct.pack("=xx2xB3xIIIhh", op, src, dst, mask_format, src_x, src_y)) buf.write(xcffib.pack_list(triangles, TRIANGLE)) return self.send_request(11, buf, is_checked=is_checked)
def Rectangles(self, operation, destination_kind, ordering, destination_window, x_offset, y_offset, rectangles_len, rectangles, is_checked=False): buf = six.BytesIO() 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 CompositeGlyphs32(self, op, src, dst, mask_format, glyphset, src_x, src_y, glyphcmds_len, glyphcmds, is_checked=False): buf = six.BytesIO() 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 CreatePointerBarrier(self, barrier, window, x1, y1, x2, y2, directions, num_devices, devices, is_checked=False): buf = six.BytesIO() buf.write( struct.pack("=xx2xIIHHHHI2xH", barrier, window, x1, y1, x2, y2, directions, num_devices)) buf.write(xcffib.pack_list(devices, "H")) return self.send_request(31, buf, is_checked=is_checked)
def pack_list_test_struct(struct_list, pack_type): packed = xcffib.pack_list(struct_list, pack_type) unpacker = xcffib.MemoryUnpacker(packed) for s in struct_list: assert type(s)(s.fmt, unpacker) == s assert unpacker.offset == unpacker.known_max
def test_pack_list_string(self): data = [[(-2, -1, 0, 1, 2), "i"], [(1.1, 2.2, 3.3), "d"]] for d, f in data: packed = xcffib.pack_list(d, f) assert d == struct.unpack("=%s%s" % (len(d), f), packed)
def pack_list_test_synthetic(iterable_list, pack_type): packed = xcffib.pack_list(iterable_list, pack_type) unpacker = xcffib.MemoryUnpacker(packed) for i in iterable_list: assert pack_type.synthetic(*i) == pack_type(i[0], unpacker) assert unpacker.offset == unpacker.known_max
def pack(self): buf = six.BytesIO() buf.write(xcffib.pack_list(self.data8, "B")) return buf.getvalue()
def pack(self): buf = six.BytesIO() buf.write(struct.pack("=B", self.name_len)) buf.write(xcffib.pack_list(self.name, "c")) return buf.getvalue()
def pack(self): buf = six.BytesIO() buf.write(struct.pack("=BBBBI", self.class_id, self.len, self.axes_len, self.mode, self.motion_size)) buf.write(xcffib.pack_list(self.axes, AxisInfo)) return buf.getvalue()
def SendExtensionEvent(self, device_id, propagate, num_classes, num_events, events, classes, is_checked=False): buf = six.BytesIO() buf.write(struct.pack("=xx2xBBHB3x", device_id, propagate, num_classes, num_events)) buf.write(xcffib.pack_list(events, EventForSend)) buf.write(xcffib.pack_list(classes, "B")) return self.send_request(31, buf, is_checked=is_checked)
def pack_list_test_packed(packed_list): packed_a = xcffib.pack_list(packed_list, None) packed_b = b"".join(b for b in packed_list) assert packed_a == packed_b
def test_pack_list_unpacked(self): data_unpacked = [object(), [1, 2, 3]] xcffib.pack_list(data_unpacked, None)
def CreateWindow(self, depth, wid, parent, x, y, width, height, border_width, _class, visual, value_mask, value_list, is_checked=False): buf = six.BytesIO() buf.write(struct.pack("=xB2xIIhhHHHHI", depth, wid, parent, x, y, width, height, border_width, _class, visual)) buf.write(struct.pack("=I", value_mask)) buf.write(xcffib.pack_list(value_list, "I")) return self.send_request(1, buf, is_checked=is_checked)