[Xcb] Problem with XCB Python and RandR

Peter Harris peter.harris at hummingbird.com
Fri Oct 17 16:38:56 PDT 2008


Alberto Milone wrote:
> I'm writing because I have a problem when I try to call the following function 
> of RandR through XCB from Python:
> 
> XRRGetCrtcInfo (Display *dpy, XRRScreenResources *resources, RRCrtc crtc);

That's not an XCB function. That looks more like Xlib. XCB is just
different enough from Xlib that the Xlib headers will be nearly useless
to you. The XCB function reads:

xcb_randr_get_crtc_info(xcb_connection_t *c, uint32_t crtc,
xcb_timestamp_t config_timestamp);

> Calling it like this:
>  self.conn.randr.GetCrtcInfo(resources, resources.crtcs[it])
> 
> throws this warning:
> /usr/local/lib/python2.5/site-packages/xcb/randr.py:562: DeprecationWarning: 
> 'I' format requires 0 <= number <= 4294967295
>   buf.write(pack('xx2xII', crtc, config_timestamp))

...since 'resources' is an object, not an integer.

I suspect you want something like:
self.conn.randr.GetCrtcInfo(resources.crtcs[it], resources.config_timestamp)

> and the following error:
> xcb.randr.BadCrtc: <xcb.randr.CrtcError object at 0x9fd0b6c>

...since whatever an object passed through 'I' resolves to, it's not an
XID that the server recognizes.

Peter Harris
-- 
     Hummingbird Connectivity - A Division of Open Text
Peter Harris                    http://connectivity.hummingbird.com
Research and Development        Phone: +1 905 762 6001
peter.harris at hummingbird.com    Toll Free: 1 877 359 4866


More information about the Xcb mailing list