For my sins (and for fun the learning experience) I am writing a window manager (I know, I know).
I'm using python and XCB (python-xpyb).
So far I have figured out that I need to use a SubStructureRedirect mask on the root window(s), and I am successfully being passed events related to applications' top-level windows. I'm testing this by launching xterm.
I get a ConfigureRequestEvent, followed by a pause, followed by another ConfigureRequestEvent, and then a MapRequestEvent.
When I get the MapRequestEvent I call connection.core.MapWindowChecked(e.window), which works, but maps a window that is only a pixel or two wide/tall.
My question, then, is what should I do with the ConfigureRequestEvent to make the window the correct size (assuming thats what I'm missing)?
More accurately, what exactly do i call? MapWindowChecked was an obvious choice, but I can't seem to find how to actually configure the width/height. I'm guessing it is ConfigureWindow, but the arguments that accepts seem obscure to me. Last time I called it I used xcb.xproto.CW.EventMask, but none of the flags in CW seem to be related to width/height.
PS The documentation on all of this seems quite elusive to me. I've looked at a couple of python window managers that supposedly use xcb, and they seem to use their own custom versions with extra functionality. Also, Examining/debugging a running window manager (which is also responsible for mapping your debugger's window) is a PITA, hence my asking here. probably would be better to use two machines or a VM or something.
Thanks.
The short answer is configure the window (size, stacking, etc.) by calling ConfigureWindow. The long answer is here you impose policy and honor specs such as XSizeHints. Best to have a look at some existing WMs' source and get a sense of what they do. Exactly what you do depends on your desired UI. 
The simplest thing to get it working is to just ConfigureWindow exactly as the request asks with no policy or hint overrides. But you'll probably see lots of usability problems quickly and have to add some more smarts.
What should a Window Manager do with a ConfigureRequestEvent?