Fixes for use without window manager

These changes make it possible to use meh on a system running X without a window manager. In this case, no ConfigureNotify event will be received, so also handle MapNotify events to make sure we have valid height and width.
This change also exposed a race condition: XSelectInput must be called before XMapRaised or the MapNotify event may be lost.