Fixes for use without window manager
Added handling of MapNotify event to make sure we have valid width and height in case we never get a ConfigureNotify event (for example when there's no window manager)
Fixed race condition. XSelectInput must be called before XMapRaised.