The ooxcb connection class is the main point of ooxcb. It is
similar to libX11’s Display.
The Connection class is an event dispatcher, so you can register
for events.
The Connection instance has a core attribute that is the core
extension instance, and it also sets the xproto attribute for
the xproto extension.
-
synchronous_check
- If synchronous_check is True, all requests
will be sent as checked (regardless if
x() or x_checked() is called) and each requests
will be checked automatically (and that’s slow).
Additionally, it also provokes lazy programming,
because if a request is checked, it is immediately
sent. If you are not careful, you will have a
non-working program if you turn out the synchronous
checks because you didn’t care about calling
conn.flush() at the correct places :)
-
keysyms
- A ooxcb.keysyms.Keysyms helper instance.
-
atoms
- A ooxcb.atoms.AtomDict helper instance.
-
conn
- The opaque libxcb connection pointer. You will most likely
do not have to use that.
-
add_to_cache(xid, obj)
- add the X object obj with the X ID xid
to the internal X object cache.
-
alive
- True if the connection is valid, False if it
is not (ie disconnected)
-
bunch(*args, **kwds)
Use this in a with statement.
Example:
with conn.bunch():
for window in windows:
window.map()
When the with statement is left,
the connection will be flushed.
-
check_conn()
- checks self.conn and raises an IOError if it’s None.
-
disconnect()
- disconnect from the X server gracefully and set
self.conn to None.
-
do_initial_setup()
loads the core events, the core errors and sets them up.
-
flush()
- flushes the connection. All cached requests are sent.
-
generate_id()
- generates a new X ID and return it.
-
get_file_descriptor()
- get the unix file descriptor.
-
get_from_cache_fallback(xid, cls)
- If there is a resource using the xid xid in the cache,
return it. If not, instantiate cls, add to cache
and return the newly created object.
-
get_maximum_request_length()
- return the connection’s maxmimum request length.
-
get_setup()
- get the connection’s setup and return it.
The setup instance is cached.
-
has_error()
- returns True if the connection has encountered an error.
-
load_ext(key)
load an extension.
-
poll_for_event()
polls for an event (non-blocking) and returns it.
If there was no event, None is returned.
-
pref_screen_object
- Return the preferred protocol.xproto.Screen instance.
Shortcut for conn.setup.roots[conn.pref_screen]
-
prefetch_maximum_request_length()
- prefetches the maximum request length without blocking.
-
remove_from_cache(xid)
- removes the object managing the X resource with the X id xid
from the cache. Will raise a KeyError if there is no such
resource in the cache.
-
remove_from_cache_safe(xid)
- same as remove_from_cache(), but does not raise a KeyError.
Instead, it does nothing. It is safe.
-
setup
- get the connection’s setup and return it.
The setup instance is cached.
-
setup_helper(ext, events, errors)
gets all events and errors from ext and registers
them.
-
wait_for_event()
waits for an event (blocking) and returns it.
If an connection IO error encountered, it raises an IOError.
This can also raise Xcb protocol errors.