Move window-manipulating functions into x.c