De-registering events from the previous active window may fail (when
the previous window has been destroyed).
Catch this early, and only log a debug message. This avoids having a
normal occurrence polluting the output with error messages.
For now, we *require* everything.
We _could_ modify the build system to exclude modules whose
dependencies haven't been met. That would allow us to make some of the
dependencies optional.
In begin_expose(), we call cairo_scaled_font_text_to_glyphs()
with (x,y) = (0,0), in order to calculate the glyph extents (needed
for width calculation).
Then, in expose(), we called it again, but with correct (x,y) offsets.
Simplify this, by caching the glyphs from begin_expose(). Then, in
expose(), simply adjust the glyph offsets before calling
cairo_show_text_glyphs().
Instead, we need to check if xcb_connection_has_error() says something
went wrong. We also need to call xcb_disconnect() on the disfunctional
XCB connection object.
When limiting a string (due to it exceeding it's max length), make
sure not to cut it in the middle of an utf-8 multibyte, as this
results in an invalid utf-8 string.
In particular, use cairo_scaled_font_text_to_glyphs() to calculate the
extents, since the cairo_scaled_font_text_extents() will leave the
scaled font in an error state, which is impossible to recuperate from.
Instantiating a new font is expensive, both in CPU and
memory. Mitigate by adding a cache. On a hit, instead of instantiating
a new font, clone the one from the cache.
Remember, cloning is basically just a ref counter bump.
By default, generates an error message with the major/minor opcodes,
the error code and sequence number.
If available, it will use xcb-errors to generate an even better
description.
Because it's the right thing to do. It worked without it, since the
f00bar main binary is linked with -rdynamic (to give plugins access to
core functions).