ooxcb.protobj¶
-
class
ooxcb.protobj.Error(conn)¶ An error is a special kind of response that is used when an error occured. It will be “packed into” a Python exception in
Error.set().-
classmethod
set(conn, err)¶ raise the right exception for the
ooxcb.libxcb.xcb_generic_error_tstruct err if it is an error.Parameters: err – a ctypes pointer to a ooxcb.libxcb.xcb_generic_error_t.
-
classmethod
-
class
ooxcb.protobj.Event(conn)¶ An event is a special kind of response. And in ooxcb, it comes with a builtin ability to be dispatched.
For that purpose, every Event subclass has an event_name member. That’s the name of the event, e.g. ‘on_configure_notify’. It is ‘on_event’ as fallback here, so if you stumble upon ‘on_event’ somewhere, there is something wrong.
So, if you want to dispatch an event, just call
dispatch(). A typical line in the main loop would then be:conn.wait_for_event().dispatch()
which will automatically dispatch every received event.
Every event will be dispatched to an appropriate target, e.g. a
ooxcb.xproto.ButtonPressEventwill be dispatched to the window the event happened in. The targets are defined in the interface files. The fallback target is the connection.If you want to know which event types a class receives, you can access the event_types attribute that is a list of event names.
If you want to know the event target of an event, you can access its event_target attribute.
Every event is sent with the event itself as the first and only argument. So all ooxcb event handlers have the following signature:
def on_blabla(evt)
-
dispatch()¶ dispatch self to my event target
-
-
class
ooxcb.protobj.Protobj(conn)¶ Base class for all protocol objects.
-
create_lazy¶ None as default, but it can be a classmethod used to create a Protobj instance lazily for convenience.
See: ooxcb.builder.build_list()
-
pythonize_lazy¶ None as default, but if it can be a method used to pythonize a protocol object lazily if it’s inside a list.
See: ooxcb.list.List
-
classmethod
create_from_address(conn, address)¶ Parameters: address – an int pointing to the data in the memory
-
classmethod
create_from_stream(conn, stream)¶ Parameters: stream – a stream-like object to read from.
-
read(stream)¶ Placeholder for subclasses. :param stream: an object providing a buffer interface. Read
myself from that stream!
-
read_from_address(address)¶ parse the memory at address
-
-
class
ooxcb.protobj.Request(conn, buffer, opcode, void, checked)¶ mostly just a value holder for
ooxcb.ext.Extension.send_request()
-
class
ooxcb.protobj.Response(conn)¶ a response wrapper. Had a sequence getter in the past, but it isn’t used. If it should be added again, file a bug.
-
class
ooxcb.protobj.Struct(conn)¶ also just a subclass of
protobj.Protobj. Nothing special here.
-
class
ooxcb.protobj.Union(conn)¶ the baseclass for Unions. Nothing special.