This kind of assumes that set-window-configuration is called in a sort of tight loop, and that window matrix sizes actually don't change.