示例#1
0
 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)
示例#2
0
 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()
示例#3
0
 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()
示例#4
0
 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()
示例#5
0
 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)
示例#6
0
 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()
示例#7
0
 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)
示例#8
0
 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)
示例#9
0
 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)
示例#10
0
 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)
示例#11
0
 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)
示例#12
0
 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)
示例#13
0
 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()
示例#14
0
文件: struct.py 项目: rbarraud/xcffib
 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()
示例#15
0
 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()
示例#16
0
 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()
示例#17
0
 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)
示例#18
0
 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)
示例#19
0
 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)
示例#20
0
 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)
示例#21
0
 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()
示例#22
0
 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)
示例#23
0
 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)
示例#24
0
文件: type_pad.py 项目: Hadron/xcffib
 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)
示例#25
0
 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)
示例#26
0
 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)
示例#27
0
 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)
示例#28
0
 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)
示例#29
0
 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)
示例#30
0
 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)
示例#31
0
 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)
示例#32
0
 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)
示例#33
0
 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
示例#34
0
 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)
示例#35
0
 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
示例#36
0
文件: union.py 项目: cknave/xcffib
 def pack(self):
     buf = six.BytesIO()
     buf.write(xcffib.pack_list(self.data8, "B"))
     return buf.getvalue()
示例#37
0
 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()
示例#38
0
文件: struct.py 项目: ichigo-0/xcffib
 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()
示例#39
0
 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)
示例#40
0
 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
示例#41
0
 def test_pack_list_unpacked(self):
     data_unpacked = [object(), [1, 2, 3]]
     xcffib.pack_list(data_unpacked, None)
示例#42
0
 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)
示例#43
0
 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)