-
-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for XCB surfaces via xcffib [updated] #39
Conversation
Ping @SimonSapin |
Add cairo-xcb.h functions to constants as cairocffi.constants._CAIRO_XCB_HEADERS
Create cairocffi.xcb module, which uses xcffib as a library to create XCBSurface objects
Add test cases for the new cairocffi.xcb module. Two test cases are for creating XCB surfaces on pixmap and window.
Add documentation for cairocffi.xcb module to sphinx docs
Installs xcffib for xcb support when running: pip install cairocffi[xcb]
When using XCB extensions you need to query the extension before making requests to it. (This is referred to in the XCB documentation as the "extension cache".) Older versions of cairo sometimes don't do this, so the first test will pass, but the second test will fail because cairo is caching request ids from the old connection (an example wth an xtrace is [1]). To work around this, we run each test in a separate process via --boxed, which forces cairo to ask XCB about the extensions for each test. [1]: http://paste.ubuntu.com/8320590/
@SimonSapin I've just updated this, between some work on this and on xcffib, this is now passing and robust, and we think is ready to merge. Let me know what you think about these changes as they stand, thanks. |
Released on PyPI in version 0.6, thanks! |
I haven't taken an extensive look at testing against different cairo versions, I know it works fine on my machine with 1.12, but running in Ubuntu 12.04 with 1.10, I've seen the same problem as seen on Travis. Thanks for getting this up! |
Yeah, all the XCB-related functions in cairo were added in 1.12. |
They've been around since at least 1.8 (that was the earliest I ever encountered them): http://cgit.freedesktop.org/cairo/tree/src/cairo-xcb-surface.c?h=1.8 I have no idea why the docs say 1.12, that seems wrong :). In any case, I haven't seen this bug on anything >= 1.13, although I haven't actually looked through the cairo source to see when they patched their implementation. |
Well, the error message seems pretty clear to me, the function is not in my build of 1.10.0: (And same with 1.8.2.)
I built this cairo from cairo-1.10.0.tar.gz with I do see these functions in the git tree as you point out, but for some reason the files are not included in the release tarballs. |
Now I’m confused. I’m not sure how I came to that conclusion 10 minutes ago. The files are there, but the |
I guess it depends on distro configuration, too. The debian/ubuntu packages On Wed, Sep 24, 2014 at 3:27 AM, Simon Sapin notifications@github.com
|
........... Released on 2014-09-23. * `#39 <https://github.com/SimonSapin/cairocffi/pull/39>`_: Add :class:`xcb.XCBSurface`. * `#42 <https://github.com/SimonSapin/cairocffi/pull/42>`_: Add :class:`Win32PrintingSurface`.
........... Released on 2014-09-23. * `#39 <https://github.com/SimonSapin/cairocffi/pull/39>`_: Add :class:`xcb.XCBSurface`. * `#42 <https://github.com/SimonSapin/cairocffi/pull/42>`_: Add :class:`Win32PrintingSurface`.
I'm seeing a very similar issue on Arch Linux, with
The really weird thing is, according to
and the string even shows up in the
It seems like there's a mismatch between what |
Also, just to clarify, I did install |
I managed to get it working using |
@whitelynx The way the XCB stuff works here currently, xcffib has to be installed before installing cairocffi in order for the XCB stuff to come in correctly. We have seen similar issues in qtile and have had to put in install-time checks that this AttributeError isn't being thrown. |
Even separating |
I was just looking at this. I wonder if we can get away with copying and pasting the whole types definition from xcffib into cairocffi? We'd have to change it in both places when new structures were added, but given where XCB is at in its software life, perhaps that won't ever happen. At least this way it wouldn't depend on what order things were installed in, which seems like it bites a lot of people today. Thoughts? |
Adaptation of #37 addressing the concerns raised there. This adds
cairocffi.xcb
which allows for interfacing with XCB surfaces through cairo with thecairocffi.xcb.XCBSurface
objects. There are also tests and docs for the new module. I couldn't think of a good way to verify the images that are rendered, but just left them to be if the tests run successfully.I know the tests won't pass now, as the version of xcffib currently tagged on pypi isn't up to date. Once @tych0 takes care of that, the tests can be re-run and should pass (fingers crossed).
EDIT: all tests should pass now https://travis-ci.org/flacjacket/cairocffi/builds/31476403