packages feed

xcffib 1.10.0 → 1.11.0

raw patch · 16 files changed

+77/−49 lines, 16 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

generator/Data/XCB/Python/Parse.hs view
@@ -96,8 +96,9 @@           globals = [mkDict "_events", mkDict "_errors"]           name = xheader_header header           add = [mkAddExt header]-      parts <- mapM (processXDecl name) $ xheader_decls header-      let (requests, decls) = collectBindings parts+      partsList <- mapM (processXDecl name) $ xheader_decls header+      let parts = concat partsList+          (requests, decls) = collectBindings parts           ext = if length requests > 0                 then [mkClass (name ++ "Extension") "xcffib.Extension" requests]                 else []@@ -674,18 +675,18 @@  processXDecl :: String              -> XDecl-             -> State TypeInfoMap BindingPart+             -> State TypeInfoMap [BindingPart] processXDecl ext (XTypeDef name typ) =   do modify $ \m -> mkModify ext name (m M.! typ) m-     return Noop+     return [Noop] processXDecl ext (XidType name) =   -- http://www.markwitmer.com/guile-xcb/doc/guile-xcb/XIDs.html   do modify $ mkModify ext name (BaseType "I")-     return Noop+     return [Noop] processXDecl _ (XImport n) =-  return $ Declaration [ mkRelImport n]+  return [Declaration [ mkRelImport n]] processXDecl _ (XEnum name membs) =-  return $ Declaration [mkEnum name $ xEnumElemsToPyEnum id membs]+  return [Declaration [mkEnum name $ xEnumElemsToPyEnum id membs]] processXDecl ext (XStruct n _ membs) = do   m <- get   let (statements, len) = mkStructStyleUnpack "" ext m membs@@ -696,7 +697,7 @@         let rhs = Int theLen         return $ mkAssign "fixed_size" rhs   modify $ mkModify ext n (CompositeType ext n)-  return $ Declaration [mkXClass n "xcffib.Struct" False statements (pack : fixedLength ++ synthetic)]+  return [Declaration [mkXClass n "xcffib.Struct" False statements (pack : fixedLength ++ synthetic)]] processXDecl ext (XEvent name opcode _ xge membs noSequence) = do   m <- get   let cname = name ++ "Event"@@ -707,9 +708,9 @@       eventsUpd = mkDictUpdate "_events" opcode cname       isxge = fromMaybe False xge       -- xgeexp = mkAssign "xge" (if fromMaybe False xge then (mkName "True") else (mkName "False"))-  return $ Declaration [ mkXClass cname "xcffib.Event" isxge statements (pack : synthetic)+  return [Declaration [ mkXClass cname "xcffib.Event" isxge statements (pack : synthetic)                        , eventsUpd-                       ]+                       ]] processXDecl ext (XError name opcode _ membs) = do   m <- get   let cname = name ++ "Error"@@ -718,10 +719,10 @@       (statements, _) = mkStructStyleUnpack prefix ext m membs       errorsUpd = mkDictUpdate "_errors" opcode cname       alias = mkAssign ("Bad" ++ name) (mkName cname)-  return $ Declaration [ mkXClass cname "xcffib.Error" False statements [pack]+  return [Declaration [ mkXClass cname "xcffib.Error" False statements [pack]                        , alias                        , errorsUpd-                       ]+                       ]] processXDecl ext (XRequest name opcode _ membs reply) = do   m <- get   let@@ -756,7 +757,17 @@                                                    ++ [argChecked])       requestBody = buf ++ packStmts ++ [ret]       request = mkMethod name allArgs requestBody-  return $ Request request replyDecl++      -- Generate the non-default variant method+      baseArgs = ("self" : (filter (not . null) args))+      isCheckedDefault = isJust reply+      (variantName, variantCall) =+        if isCheckedDefault+        then ("Unchecked", mkReturn $ mkCall ("self." ++ name) (map mkName (tail baseArgs) ++ [mkName "is_checked=False"]))+        else ("Checked", mkReturn $ mkCall ("self." ++ name) (map mkName (tail baseArgs) ++ [mkName "is_checked=True"]))+      variantMethod = mkMethod (name ++ variantName) baseArgs [variantCall]++  return [Request request replyDecl, Request variantMethod []] processXDecl ext (XUnion name _ membs) = do   m <- get   let unpackF = structElemToPyUnpack unpackerCopy ext m@@ -772,7 +783,7 @@       pack = mkPackMethod ext name m Nothing [head membs] Nothing       decl = [mkXClass name "xcffib.Union" False initMethodStmts [pack]]   modify $ mkModify ext name (CompositeType ext name)-  return $ Declaration decl+  return [Declaration decl]   where     unpackerCopy = mkCall "unpacker.copy" []     mkUnionUnpack :: (Maybe String, String)@@ -788,7 +799,7 @@ processXDecl ext (XidUnion name _) =   -- These are always unions of only XIDs.   do modify $ mkModify ext name (BaseType "I")-     return Noop+     return [Noop]  -- EventStruct basically describes a set of possible events that could be -- represented by this one member. Slated to land in 1.13, it is only used in@@ -803,7 +814,7 @@ -- again. processXDecl ext (XEventStruct name _) = do   modify $ mkModify ext name (CompositeType ext name)-  return $ Declaration $ [mkXClass name "xcffib.Buffer" False [] []]+  return [Declaration $ [mkXClass name "xcffib.Buffer" False [] []]]  mkVersion :: XHeader -> Suite mkVersion header =
generator/Data/XCB/Python/PyHelpers.hs view
@@ -106,7 +106,8 @@   let lhs = Tuple $ map mkAttr names       -- Don't spam with this default arg unless it is really necessary.       unpackF = mkDot unpacker "unpack"-      rhs = mkCall unpackF [mkStr packs]+      packs' = if null packs then packs else '=' : packs+      rhs = mkCall unpackF [mkStr packs']       stmt = if length names > 0 then mkAssign lhs rhs else StmtExpr rhs   in if length packs > 0 then [stmt] else [] 
test/generator/action.py view
@@ -10,7 +10,7 @@             unpacker = xcffib.MemoryUnpacker(unpacker.pack())         xcffib.Struct.__init__(self, unpacker)         base = unpacker.offset-        self.type, = unpacker.unpack("B7x")+        self.type, = unpacker.unpack("=B7x")         self.bufsize = unpacker.offset - base     def pack(self):         buf = io.BytesIO()@@ -29,7 +29,7 @@             unpacker = xcffib.MemoryUnpacker(unpacker.pack())         xcffib.Struct.__init__(self, unpacker)         base = unpacker.offset-        self.type, self.flags, self.mask, self.realMods, self.vmodsHigh, self.vmodsLow = unpacker.unpack("BBBBBB2x")+        self.type, self.flags, self.mask, self.realMods, self.vmodsHigh, self.vmodsLow = unpacker.unpack("=BBBBBB2x")         self.bufsize = unpacker.offset - base     def pack(self):         buf = io.BytesIO()@@ -53,7 +53,7 @@             unpacker = xcffib.MemoryUnpacker(unpacker.pack())         xcffib.Struct.__init__(self, unpacker)         base = unpacker.offset-        self.type, self.flags, self.group = unpacker.unpack("BBb5x")+        self.type, self.flags, self.group = unpacker.unpack("=BBb5x")         self.bufsize = unpacker.offset - base     def pack(self):         buf = io.BytesIO()@@ -78,7 +78,7 @@             unpacker = xcffib.MemoryUnpacker(unpacker.pack())         xcffib.Struct.__init__(self, unpacker)         base = unpacker.offset-        self.type, self.flags, self.xHigh, self.xLow, self.yHigh, self.yLow = unpacker.unpack("BBbBbB2x")+        self.type, self.flags, self.xHigh, self.xLow, self.yHigh, self.yLow = unpacker.unpack("=BBbBbB2x")         self.bufsize = unpacker.offset - base     def pack(self):         buf = io.BytesIO()@@ -102,7 +102,7 @@             unpacker = xcffib.MemoryUnpacker(unpacker.pack())         xcffib.Struct.__init__(self, unpacker)         base = unpacker.offset-        self.type, self.flags, self.count, self.button = unpacker.unpack("BBBB4x")+        self.type, self.flags, self.count, self.button = unpacker.unpack("=BBBB4x")         self.bufsize = unpacker.offset - base     def pack(self):         buf = io.BytesIO()@@ -124,7 +124,7 @@             unpacker = xcffib.MemoryUnpacker(unpacker.pack())         xcffib.Struct.__init__(self, unpacker)         base = unpacker.offset-        self.type, self.flags, self.button = unpacker.unpack("BBxB4x")+        self.type, self.flags, self.button = unpacker.unpack("=BBxB4x")         self.bufsize = unpacker.offset - base     def pack(self):         buf = io.BytesIO()@@ -152,7 +152,7 @@         self.moveptr = SAMovePtr(unpacker.copy())         self.ptrbtn = SAPtrBtn(unpacker.copy())         self.lockptrbtn = SALockPtrBtn(unpacker.copy())-        self.type, = unpacker.copy().unpack("B")+        self.type, = unpacker.copy().unpack("=B")     def pack(self):         buf = io.BytesIO()         buf.write(self.noaction.pack() if hasattr(self.noaction, "pack") else SANoAction.synthetic(*self.noaction).pack())
test/generator/error.py view
@@ -13,7 +13,7 @@             unpacker = xcffib.MemoryUnpacker(unpacker.pack())         xcffib.Error.__init__(self, unpacker)         base = unpacker.offset-        self.bad_value, self.minor_opcode, self.major_opcode = unpacker.unpack("xx2xIHBx")+        self.bad_value, self.minor_opcode, self.major_opcode = unpacker.unpack("=xx2xIHBx")         self.bufsize = unpacker.offset - base     def pack(self):         buf = io.BytesIO()
test/generator/event.py view
@@ -13,7 +13,7 @@             unpacker = xcffib.MemoryUnpacker(unpacker.pack())         xcffib.Event.__init__(self, unpacker)         base = unpacker.offset-        self.rotation, self.timestamp, self.config_timestamp, self.root, self.request_window, self.sizeID, self.subpixel_order, self.width, self.height, self.mwidth, self.mheight = unpacker.unpack("xB2xIIIIHHHHHH")+        self.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()
test/generator/eventstruct.py view
@@ -12,4 +12,6 @@         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 SendExtensionEventChecked(self, device_id, propagate, num_classes, num_events, events, classes):+        return self.SendExtensionEvent(device_id, propagate, num_classes, num_events, events, classes, is_checked=True) xcffib._add_ext(key, eventstructExtension, _events, _errors)
test/generator/no_sequence.py view
@@ -10,7 +10,7 @@             unpacker = xcffib.MemoryUnpacker(unpacker.pack())         xcffib.Event.__init__(self, unpacker)         base = unpacker.offset-        unpacker.unpack("x")+        unpacker.unpack("=x")         self.keys = xcffib.List(unpacker, "B", 31)         self.bufsize = unpacker.offset - base     def pack(self):
test/generator/randr.py view
@@ -13,7 +13,7 @@             unpacker = xcffib.MemoryUnpacker(unpacker.pack())         xcffib.Struct.__init__(self, unpacker)         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()@@ -40,12 +40,12 @@             unpacker = xcffib.MemoryUnpacker(unpacker.pack())         xcffib.Reply.__init__(self, unpacker)         base = unpacker.offset-        unpacker.unpack("xx2x4x")+        unpacker.unpack("=xx2x4x")         self.pending_transform = TRANSFORM(unpacker)-        self.has_transforms, = unpacker.unpack("B3x")+        self.has_transforms, = unpacker.unpack("=B3x")         unpacker.pad(TRANSFORM)         self.current_transform = 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")         self.pending_filter_name = xcffib.List(unpacker, "c", self.pending_len)         unpacker.pad("i")@@ -62,4 +62,6 @@         buf = io.BytesIO()         buf.write(struct.pack("=xx2xI", crtc))         return self.send_request(27, buf, GetCrtcTransformCookie, is_checked=is_checked)+    def GetCrtcTransformUnchecked(self, crtc):+        return self.GetCrtcTransform(crtc, is_checked=False) xcffib._add_ext(key, randrExtension, _events, _errors)
test/generator/record.py view
@@ -13,7 +13,7 @@             unpacker = xcffib.MemoryUnpacker(unpacker.pack())         xcffib.Struct.__init__(self, unpacker)         base = unpacker.offset-        self.first, self.last = unpacker.unpack("BB")+        self.first, self.last = unpacker.unpack("=BB")         self.bufsize = unpacker.offset - base     def pack(self):         buf = io.BytesIO()@@ -33,7 +33,7 @@             unpacker = xcffib.MemoryUnpacker(unpacker.pack())         xcffib.Struct.__init__(self, unpacker)         base = unpacker.offset-        self.first, self.last = unpacker.unpack("HH")+        self.first, self.last = unpacker.unpack("=HH")         self.bufsize = unpacker.offset - base     def pack(self):         buf = io.BytesIO()@@ -88,7 +88,7 @@         self.device_events = Range8(unpacker)         unpacker.pad(Range8)         self.errors = Range8(unpacker)-        self.client_started, self.client_died = unpacker.unpack("BB")+        self.client_started, self.client_died = unpacker.unpack("=BB")         self.bufsize = unpacker.offset - base     def pack(self):         buf = io.BytesIO()
test/generator/render.py view
@@ -13,7 +13,7 @@             unpacker = xcffib.MemoryUnpacker(unpacker.pack())         xcffib.Struct.__init__(self, unpacker)         base = unpacker.offset-        self.red, self.green, self.blue, self.alpha = unpacker.unpack("HHHH")+        self.red, self.green, self.blue, self.alpha = unpacker.unpack("=HHHH")         self.bufsize = unpacker.offset - base     def pack(self):         buf = io.BytesIO()@@ -35,7 +35,7 @@             unpacker = xcffib.MemoryUnpacker(unpacker.pack())         xcffib.Struct.__init__(self, unpacker)         base = unpacker.offset-        self.x, self.y, self.width, self.height = unpacker.unpack("hhHH")+        self.x, self.y, self.width, self.height = unpacker.unpack("=hhHH")         self.bufsize = unpacker.offset - base     def pack(self):         buf = io.BytesIO()@@ -57,4 +57,6 @@         buf.write(color.pack() if hasattr(color, "pack") else COLOR.synthetic(*color).pack())         buf.write(xcffib.pack_list(rects, RECTANGLE))         return self.send_request(26, buf, is_checked=is_checked)+    def FillRectanglesChecked(self, op, dst, color, rects_len, rects):+        return self.FillRectangles(op, dst, color, rects_len, rects, is_checked=True) xcffib._add_ext(key, renderExtension, _events, _errors)
test/generator/request.py view
@@ -10,4 +10,6 @@         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)+    def CreateWindowChecked(self, depth, wid, parent, x, y, width, height, border_width, _class, visual, value_mask, value_list):+        return self.CreateWindow(depth, wid, parent, x, y, width, height, border_width, _class, visual, value_mask, value_list, is_checked=True) xcffib._add_ext(key, requestExtension, _events, _errors)
test/generator/request_reply.py view
@@ -10,7 +10,7 @@             unpacker = xcffib.MemoryUnpacker(unpacker.pack())         xcffib.Struct.__init__(self, unpacker)         base = unpacker.offset-        self.name_len, = unpacker.unpack("B")+        self.name_len, = unpacker.unpack("=B")         self.name = xcffib.List(unpacker, "c", self.name_len)         self.bufsize = unpacker.offset - base     def pack(self):@@ -31,7 +31,7 @@             unpacker = xcffib.MemoryUnpacker(unpacker.pack())         xcffib.Reply.__init__(self, unpacker)         base = unpacker.offset-        self.names_len, = unpacker.unpack("xB2x4x24x")+        self.names_len, = unpacker.unpack("=xB2x4x24x")         self.names = xcffib.List(unpacker, STR, self.names_len)         self.bufsize = unpacker.offset - base class ListExtensionsCookie(xcffib.Cookie):@@ -41,4 +41,6 @@         buf = io.BytesIO()         buf.write(struct.pack("=xx2x"))         return self.send_request(99, buf, ListExtensionsCookie, is_checked=is_checked)+    def ListExtensionsUnchecked(self):+        return self.ListExtensions(is_checked=False) xcffib._add_ext(key, request_replyExtension, _events, _errors)
test/generator/struct.py view
@@ -10,7 +10,7 @@             unpacker = xcffib.MemoryUnpacker(unpacker.pack())         xcffib.Struct.__init__(self, unpacker)         base = unpacker.offset-        self.resolution, self.minimum, self.maximum = unpacker.unpack("Iii")+        self.resolution, self.minimum, self.maximum = unpacker.unpack("=Iii")         self.bufsize = unpacker.offset - base     def pack(self):         buf = io.BytesIO()@@ -31,7 +31,7 @@             unpacker = xcffib.MemoryUnpacker(unpacker.pack())         xcffib.Struct.__init__(self, unpacker)         base = unpacker.offset-        self.class_id, self.len, self.axes_len, self.mode, self.motion_size = unpacker.unpack("BBBBI")+        self.class_id, self.len, self.axes_len, self.mode, self.motion_size = unpacker.unpack("=BBBBI")         self.axes = xcffib.List(unpacker, AxisInfo, self.axes_len)         self.bufsize = unpacker.offset - base     def pack(self):
test/generator/switch.py view
@@ -10,7 +10,7 @@             unpacker = xcffib.MemoryUnpacker(unpacker.pack())         xcffib.Struct.__init__(self, unpacker)         base = unpacker.offset-        self.hi, self.lo = unpacker.unpack("iI")+        self.hi, self.lo = unpacker.unpack("=iI")         self.bufsize = unpacker.offset - base     def pack(self):         buf = io.BytesIO()@@ -30,7 +30,7 @@             unpacker = xcffib.MemoryUnpacker(unpacker.pack())         xcffib.Reply.__init__(self, unpacker)         base = unpacker.offset-        self.num_items, self.format = unpacker.unpack("xx2x4xIB")+        self.num_items, self.format = unpacker.unpack("=xx2x4xIB")         if self.format & PropertyFormat._8Bits:             self.data8 = xcffib.List(unpacker, "B", self.num_items)         if self.format & PropertyFormat._16Bits:@@ -47,7 +47,7 @@             unpacker = xcffib.MemoryUnpacker(unpacker.pack())         xcffib.Reply.__init__(self, unpacker)         base = unpacker.offset-        self.num_items, self.format = unpacker.unpack("xx2x4xIB")+        self.num_items, self.format = unpacker.unpack("=xx2x4xIB")         self.names = xcffib.List(unpacker, "B", self.num_items)         if self.format & PropertyFormat._8Bits:             unpacker.pad("B")@@ -78,8 +78,12 @@             events = items.pop(0)             buf.write(struct.pack("=I", events))         return self.send_request(59, buf, GetPropertyCookie, is_checked=is_checked)+    def GetPropertyUnchecked(self, value_mask, items):+        return self.GetProperty(value_mask, items, is_checked=False)     def GetPropertyWithPad(self, is_checked=True):         buf = io.BytesIO()         buf.write(struct.pack("=xx2x"))         return self.send_request(60, buf, GetPropertyWithPadCookie, is_checked=is_checked)+    def GetPropertyWithPadUnchecked(self):+        return self.GetPropertyWithPad(is_checked=False) xcffib._add_ext(key, switchExtension, _events, _errors)
test/generator/type_pad.py view
@@ -10,7 +10,7 @@             unpacker = xcffib.MemoryUnpacker(unpacker.pack())         xcffib.Struct.__init__(self, unpacker)         base = unpacker.offset-        self.left_side_bearing, self.right_side_bearing, self.character_width, self.ascent, self.descent, self.attributes = unpacker.unpack("hhhhhH")+        self.left_side_bearing, self.right_side_bearing, self.character_width, self.ascent, self.descent, self.attributes = unpacker.unpack("=hhhhhH")         self.bufsize = unpacker.offset - base     def pack(self):         buf = io.BytesIO()@@ -34,7 +34,7 @@             unpacker = xcffib.MemoryUnpacker(unpacker.pack())         xcffib.Struct.__init__(self, unpacker)         base = unpacker.offset-        self.name, self.value = unpacker.unpack("II")+        self.name, self.value = unpacker.unpack("=II")         self.bufsize = unpacker.offset - base     def pack(self):         buf = io.BytesIO()@@ -54,12 +54,12 @@             unpacker = xcffib.MemoryUnpacker(unpacker.pack())         xcffib.Reply.__init__(self, unpacker)         base = unpacker.offset-        self.name_len, = unpacker.unpack("xB2x4x")+        self.name_len, = unpacker.unpack("=xB2x4x")         self.min_bounds = CHARINFO(unpacker)-        unpacker.unpack("4x")+        unpacker.unpack("=4x")         unpacker.pad(CHARINFO)         self.max_bounds = CHARINFO(unpacker)-        self.min_char_or_byte2, self.max_char_or_byte2, self.default_char, self.properties_len, self.draw_direction, self.min_byte1, self.max_byte1, self.all_chars_exist, self.font_ascent, self.font_descent, self.replies_hint = unpacker.unpack("4xHHHHBBBBhhI")+        self.min_char_or_byte2, self.max_char_or_byte2, self.default_char, self.properties_len, self.draw_direction, self.min_byte1, self.max_byte1, self.all_chars_exist, self.font_ascent, self.font_descent, self.replies_hint = unpacker.unpack("=4xHHHHBBBBhhI")         unpacker.pad(FONTPROP)         self.properties = xcffib.List(unpacker, FONTPROP, self.properties_len)         unpacker.pad("c")@@ -73,4 +73,6 @@         buf.write(struct.pack("=xx2xxHH", max_names, pattern_len))         buf.write(xcffib.pack_list(pattern, "c"))         return self.send_request(50, buf, ListFontsWithInfoCookie, is_checked=is_checked)+    def ListFontsWithInfoUnchecked(self, max_names, pattern_len, pattern):+        return self.ListFontsWithInfo(max_names, pattern_len, pattern, is_checked=False) xcffib._add_ext(key, type_padExtension, _events, _errors)
xcffib.cabal view
@@ -1,6 +1,6 @@ cabal-version:       2.4 name:                xcffib-version:             1.10.0+version:             1.11.0 synopsis:            A cffi-based python binding for X homepage:            http://github.com/tych0/xcffib license:             Apache-2.0