[dev] [dwm] Conversion to XCB

From: Markus Wichmann <nullplan_AT_gmx.net>
Date: Tue, 21 Jan 2014 09:41:54 +0100

Hi all,

I got bored over the weekend and decided to start porting dwm to XCB.
The reason being that XCB rules and Xlib drools. I'm almost done with
dwm.c, but I have come across a few problems I'd like to discuss here.

First of all, how do we do error handling? Xlib has those error handler
functions that it calls automatically whenever an error is encountered.
For the moment, I'm doing the following:

- For every request for which there is no meaningful reply, i.e.
  everything that returns xcb_void_cookie_t, an error will be put into
  the event queue. So xcb_wait_for_event(), which is run in run(), will
  return a message with the response type XCB_ERROR. Maybe I should make
  an event handler for that.
- For every request /with/ a meaningful reply, I don't fetch the error
  information and handle the case were no reply was received
  (something_reply() returned NULL) as the corresponding Xlib function
  returning false.
Second: XCB has no FontSets. From what I could read in Xlib, a FontSet
is created, more or less, by making a ListFonts request to the server
and opening the first returned font, using it for everything. At least,
that's the default version. The generic version opens all returned fonts
and then when requested to draw a string, draws that string with the
applicable fonts. Now I have some problems emulating that behaviour. For
one, it's Xlib code, and that means it's hard to read and harder to
write. For two, it apparently relies on external data to figure out
which font can draw what unicode points. Does anyone here have insight
into how to figure that out from just the data the X server can send to
us? For instance, what do the fields of a ListFontsWithInfo reply mean?

Header files: Currently I require <X11/keysymdef.h> and
<X11/cursorfont.h>. Is there a way to get the data written in them into

Received on Tue Jan 21 2014 - 09:41:54 CET

This archive was generated by hypermail 2.3.0 : Tue Jan 21 2014 - 09:48:08 CET