xcffib 0.5.1 → 0.6.0
raw patch · 5 files changed
+75/−7 lines, 5 filesdep ~xcb-typesdep ~xcffib
Dependency ranges changed: xcb-types, xcffib
Files
- generator/Data/XCB/Python/Parse.hs +15/−0
- test/GeneratorTests.hs +1/−0
- test/generator/eventstruct.py +15/−0
- test/generator/eventstruct.xml +37/−0
- xcffib.cabal +7/−7
generator/Data/XCB/Python/Parse.hs view
@@ -758,6 +758,21 @@ do modify $ mkModify ext name (BaseType "I") 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+-- SendExtensionEvent for now.+--+-- Rather than do a bunch of work nobody will use, I've punted on this for now,+-- leaving EventStructs as raw buffers. Since we support synthetic creation of+-- events from buffers and SendExtensionEvent has the event types, people can+-- unpack the thing themselves, by using the raw buffer that we keep around in+-- the new Buffer class. Maybe some day in the future someone can add some+-- syntactic sugar to make this a little nicer, but at least things compile+-- again.+processXDecl ext (XEventStruct name _) = do+ modify $ mkModify ext name (CompositeType ext name)+ return $ Declaration $ [mkXClass name "xcffib.Buffer" [] []]+ mkVersion :: XHeader -> Suite () mkVersion header = let major = ver "MAJOR_VERSION" (xheader_major_version header)
test/GeneratorTests.hs view
@@ -41,6 +41,7 @@ , "render_1.7" , "xproto_1.7" , "render"+ , "eventstruct" ] mkFname :: String -> FilePath
+ test/generator/eventstruct.py view
@@ -0,0 +1,15 @@+import xcffib+import struct+import six+_events = {}+_errors = {}+class EventForSend(xcffib.Buffer):+ pass+class eventstructExtension(xcffib.Extension):+ def SendExtensionEvent(self, device_id, propagate, num_classes, num_events, events, classes, is_checked=False):+ buf = six.BytesIO()+ buf.write(struct.pack("=xx2xBBHB3x", device_id, propagate, num_classes, num_events))+ buf.write(xcffib.pack_list(events, EventForSend))+ buf.write(xcffib.pack_list(classes, "B"))+ return self.send_request(31, buf, is_checked=is_checked)+xcffib._add_ext(key, eventstructExtension, _events, _errors)
+ test/generator/eventstruct.xml view
@@ -0,0 +1,37 @@+<!-- based on xinput -->+<xcb header="eventstruct" extension-name="eventstruct" extension-name="eventstruct">+++ <!-- SendExtensionEvent -->+ <eventstruct name="EventForSend">+ <allowed extension="Input" xge="false" opcode-min="0" opcode-max="16" />+ <!-- We need not allow the newer events which are based on+ the GenericEvent extension:+ The wire-protocol-spec+ https://cgit.freedesktop.org/xorg/lib/libXi/tree/specs/encoding.xml?idĺibXi-1.7.9#n1793+ only allows fixed sized events, which seems+ to rule out GenericEvent.++ The xlib-implementation also assumes fixed-sized events.+ https://cgit.freedesktop.org/xorg/lib/libXi/tree/src/XSndExEv.c?id=libXi-1.7.9#n106++ The Xserver also allows only non-GE events:+ https:g/xorg/xserver/tree/Xi/sendexev.c?id=xorg-server-1.19.1#n144+ -->+ </eventstruct>++ <request name="SendExtensionEvent" opcode="31">+ <field type="CARD8" name="device_id" />+ <field type="BOOL" name="propagate" />+ <field type="CARD16" name="num_classes" />+ <field type="CARD8" name="num_events" />+ <pad bytes="3" />+ <list type="EventForSend" name="events">+ <fieldref>num_events</fieldref>+ </list>+ <list type="CARD8" name="classes">+ <fieldref>num_classes</fieldref>+ </list>+ </request>++</xcb>
xcffib.cabal view
@@ -1,5 +1,5 @@ name: xcffib-version: 0.5.1+version: 0.6.0 synopsis: A cffi-based python binding for X homepage: http://github.com/tych0/xcffib license: OtherLicense@@ -25,7 +25,7 @@ library build-depends: base ==4.*,- xcb-types >= 0.8.0,+ xcb-types >= 0.9.0, language-python >= 0.5.0, filepath, filemanip,@@ -44,10 +44,10 @@ main-is: xcffibgen.hs hs-source-dirs: generator build-depends: base ==4.*,- xcffib >= 0.1.0,+ xcffib, language-python >= 0.5.0, split,- xcb-types >= 0.8.0,+ xcb-types >= 0.9.0, optparse-applicative >= 0.13, filepath, filemanip,@@ -65,7 +65,7 @@ main-is: PyHelpersTests.hs type: exitcode-stdio-1.0 build-depends: base ==4.*,- xcffib >= 0.1.0,+ xcffib, language-python >= 0.5.0, HUnit, test-framework,@@ -76,8 +76,8 @@ main-is: GeneratorTests.hs type: exitcode-stdio-1.0 build-depends: base ==4.*,- xcffib >= 0.1.0,- xcb-types >= 0.8.0,+ xcffib,+ xcb-types >= 0.9.0, language-python >= 0.5.0, HUnit, test-framework,