ooxcb.resource

class ooxcb.resource.Resource(conn, xid)

A resource is nearly every object in the X world having an X ID: Windows, Graphics Contexts, Fonts ... Except atoms. Atoms are not part of the XID space, and they have a separate cache.

Each resource has an xid attribute. It can also be accessed by get_internal().

Resources are also ooxcb.eventsys.EventDispatcher subclasses.

get_internal()

The internal representation of a resource is its X id. Return it.

ooxcb.resource.get_internal(obj)

get the stream-ready internal representation of obj. There are multiple possible cases:

  • If obj has a get_internal method, the return value of that will be returned.
  • If obj is an int, it will be returned immediately.
  • If obj is None, 0 will be returned.
  • If obj is something else, a ProtocolDataError will be raised.