use global win/dpy in XEvent handler
fix glib assertion warnings